Click or drag to resize

MathHelperFindLineEllipseIntersections Method

Finds the intersection points between an ellipse and a line segment.

Namespace:  DXFReaderNET
Assembly:  DXFReaderNET (in DXFReaderNET.dll) Version: 20.12.2
Syntax
public static int FindLineEllipseIntersections(
	Ellipse ellipse,
	Line line,
	out Vector2 intersection1,
	out Vector2 intersection2,
	bool edgeLine = true,
	bool edgeArc = true
)

Parameters

ellipse
Type: DXFReaderNET.EntitiesEllipse
The ellipse entity to test for intersection.
line
Type: DXFReaderNET.EntitiesLine
The line segment to test for intersection.
intersection1
Type: DXFReaderNETVector2
Output: the first intersection point, if found.
intersection2
Type: DXFReaderNETVector2
Output: the second intersection point, if found.
edgeLine (Optional)
Type: SystemBoolean
If true, considers only the line segment between start and end points. If false, treats the line as infinite in both directions.
edgeArc (Optional)
Type: SystemBoolean
If true, considers only the arc portion of the ellipse (if it's an elliptical arc). If false, treats the ellipse as a complete closed curve.

Return Value

Type: Int32
The number of intersection points found:
  • 0 - No intersections (line and ellipse don't touch)
  • 1 - One intersection (line is tangent to ellipse, or one point is outside bounds)
  • 2 - Two intersections (line crosses through ellipse)
Remarks
This method solves the intersection using parametric equations for both the line and ellipse. When multiple intersections exist, they are returned in order from closest to farthest from the line's start point. Edge parameters allow control over whether to consider finite segments or infinite geometric objects.
See Also