Skip to content

Commit fa6f2fd

Browse files
committed
Update workaround which prevents an infinite loop in aCutes GetStarPoints method.
See #58
1 parent fb8f2a7 commit fa6f2fd

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/Triangle/NewLocation.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ class NewLocation
2222
{
2323
const double EPS = 1e-50;
2424

25-
// A safeguard to prevent an infinite loop in GetStarPoints method, see
26-
// https://github.com/wo80/Triangle.NET/issues/58
27-
const int GETSTARPOINTS_SAFEGUARD = 2000;
28-
2925
IPredicates predicates;
3026

3127
Mesh mesh;
@@ -2295,7 +2291,11 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r,
22952291

22962292
if (numvertices == points.Length)
22972293
{
2298-
Array.Resize(ref points, numvertices * 2);
2294+
// See https://github.com/wo80/Triangle.NET/issues/58
2295+
Log.Instance.Warning("aCute smoothing ran out of precision", "NewLocation.GetStarPoints()");
2296+
2297+
numvertices = 0;
2298+
break;
22992299
}
23002300

23012301
// add a new point to the list of surrounding points
@@ -2310,12 +2310,6 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r,
23102310
break;
23112311
}
23122312

2313-
if (numvertices > GETSTARPOINTS_SAFEGUARD)
2314-
{
2315-
numvertices = 0;
2316-
break;
2317-
}
2318-
23192313
} while (!((Math.Abs(returnPoint[0] - third_x) <= EPS) &&
23202314
(Math.Abs(returnPoint[1] - third_y) <= EPS)));
23212315
return numvertices / 2;

0 commit comments

Comments
 (0)