Skip to content

Commit

Permalink
IsClosed fix for nurbs curves
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelbaran authored and Fraser Greenroyd committed Dec 2, 2019
1 parent cdd023b commit 44682fd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Geometry_Engine/Query/IsClosed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public static bool IsClosed(this NurbsCurve curve, double tolerance = Tolerance.
if (curve == null || curve.ControlPoints == null || curve.ControlPoints.Count < 2)
return false;

// TODO: This does not take into account periodic curves
return curve.ControlPoints.First() == curve.ControlPoints.Last();
return curve.ControlPoints.First().SquareDistance(curve.ControlPoints.Last()) <= tolerance * tolerance || curve.IsPeriodic();
}

/***************************************************/
Expand Down

0 comments on commit 44682fd

Please sign in to comment.