Skip to content

Commit 48a7892

Browse files
committed
Issue #2169: The fix for #1528 did not properly consider the case
of full-circle spirals. Signed-off-by: andypugh <andy@bodgesoc.org>
1 parent 532711b commit 48a7892

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/libnml/posemath/_posemath.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,8 @@ int pmCircleInit(PmCircle * const circle,
17741774
PmCartesian v;
17751775
double d;
17761776
int r1;
1777+
PmCartesian p1;
1778+
PmCartesian p2;
17771779

17781780
#ifdef PM_DEBUG
17791781
if (0 == circle) {
@@ -1850,8 +1852,12 @@ int pmCircleInit(PmCircle * const circle,
18501852
circle->angle = PM_2_PI - circle->angle;
18511853
}
18521854
/* Issue #1528 24-Jan-2022. Additional test for nearly-straight *
1853-
* short arcs of very large radius becoming circles */
1854-
pmCartCartDisp(start, end, &d);
1855+
* short arcs of very large radius becoming circles *
1856+
* Revisited 4-Dec-2022 Issue #2169 - endpoints of spirals are not*
1857+
* close to each other, project to working plane */
1858+
pmCartPlaneProj(start, normal, &p1);
1859+
pmCartPlaneProj(end, normal, &p2);
1860+
pmCartCartDisp(&p1, &p2, &d);
18551861
if (d < CART_FUZZ){
18561862
circle->angle = PM_2_PI;
18571863
}
@@ -1862,7 +1868,7 @@ int pmCircleInit(PmCircle * const circle,
18621868
}
18631869

18641870
/* FIXME: some code has an unguarded division by circle->angle */
1865-
if (circle->angle == 0) circle->angle += CIRCLE_FUZZ;
1871+
if (circle->angle == 0) circle->angle += CIRCLE_FUZZ / 2;
18661872

18671873
//Default to invalid
18681874
/* if 0'ed out while not debugging*/

0 commit comments

Comments
 (0)