You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
An IndexOutOfRangeException is raised in Geometry.TangentCC when it attempts to process the result from TangentPointCircle.
The issue arises because TangentPointCircle can return an empty array, but TangentCC is not prepared to handle this case.
CADability.Geometry.TangentCC(CADability.GeoPoint2D, double, CADability.GeoPoint2D, double) in Geometry.cs
CADability.Curve2D.Curves2D.TangentLines(CADability.Curve2D.ICurve2D, CADability.Curve2D.ICurve2D) in Curves2D.cs
CADability.Shapes.Border.ConvexHull() in Border.cs
CADability.Shapes.Border.GetSmallestEnclosingRectangle() in Border.cs
Expected Behavior:
TangentCC should handle cases where TangentPointCircle returns an empty array gracefully, either by:
Returning an empty result.
Throwing a meaningful exception with a descriptive message.
Actual Behavior:
An IndexOutOfRangeException is thrown because TangentCC assumes TangentPointCircle always returns at least two points.
Suggested Fix:
Add validation in TangentCC to check if the result from TangentPointCircle is null or empty before processing further.
The TangentPointCircle method should be updated to handle floating-point inaccuracies using a tolerance check:
if (pc < radius - Precision.eps)
return new GeoPoint2D[0]; // no solution
The text was updated successfully, but these errors were encountered:
Description:
An IndexOutOfRangeException is raised in Geometry.TangentCC when it attempts to process the result from TangentPointCircle.
The issue arises because TangentPointCircle can return an empty array, but TangentCC is not prepared to handle this case.
Expected Behavior:
TangentCC should handle cases where TangentPointCircle returns an empty array gracefully, either by:
Actual Behavior:
An IndexOutOfRangeException is thrown because TangentCC assumes TangentPointCircle always returns at least two points.
Suggested Fix:
Add validation in TangentCC to check if the result from TangentPointCircle is null or empty before processing further.
The TangentPointCircle method should be updated to handle floating-point inaccuracies using a tolerance check:
The text was updated successfully, but these errors were encountered: