MathHelperFindLineEllipseIntersections Method
|
Finds the intersection points between an ellipse and a line segment.
Namespace:
DXFReaderNET
Assembly:
DXFReaderNET (in DXFReaderNET.dll) Version: 20.12.2
Syntaxpublic static int FindLineEllipseIntersections(
Ellipse ellipse,
Line line,
out Vector2 intersection1,
out Vector2 intersection2,
bool edgeLine = true,
bool edgeArc = true
)
Public Shared Function FindLineEllipseIntersections (
ellipse As Ellipse,
line As Line,
<OutAttribute> ByRef intersection1 As Vector2,
<OutAttribute> ByRef intersection2 As Vector2,
Optional edgeLine As Boolean = true,
Optional edgeArc As Boolean = true
) As Integer
public:
static int FindLineEllipseIntersections(
Ellipse^ ellipse,
Line^ line,
[OutAttribute] Vector2% intersection1,
[OutAttribute] Vector2% intersection2,
bool edgeLine = true,
bool edgeArc = true
)
static member FindLineEllipseIntersections :
ellipse : Ellipse *
line : Line *
intersection1 : Vector2 byref *
intersection2 : Vector2 byref *
?edgeLine : bool *
?edgeArc : bool
(* Defaults:
let _edgeLine = defaultArg edgeLine true
let _edgeArc = defaultArg edgeArc true
*)
-> int
STATIC METHOD FindLineEllipseIntersections(
ellipse AS Ellipse,
line AS Line,
intersection1 OUT Vector2,
intersection2 OUT Vector2,
edgeLine AS LOGIC := TRUE,
edgeArc AS LOGIC := TRUE
) AS LONG
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