LineToolsLineIntersect(Vector2, Vector2, Vector2, Vector2, Boolean, Boolean, Vector2) Method |
This method detects if two line segments (or lines) intersect,
and, if so, the point of intersection. Use the firstIsSegment and
secondIsSegment parameters to set whether the intersection point
must be on the first and second line segments. Setting these
both to true means you are doing a line-segment to line-segment
intersection. Setting one of them to true means you are doing a
line to line-segment intersection test, and so on.
Note: If two line segments are coincident, then
no intersection is detected (there are actually
infinite intersection points).
Author: Jeremy Bell
Namespace: Internal.tainicom.Aether.Physics2D.CommonAssembly: NeoAxis.Core (in NeoAxis.Core.dll) Version: 2026.1.1.0 (2026.1.1.0)
Syntaxpublic static bool LineIntersect(
ref Vector2 point1,
ref Vector2 point2,
ref Vector2 point3,
ref Vector2 point4,
bool firstIsSegment,
bool secondIsSegment,
out Vector2 point
)
Parameters
- point1 Vector2
- The first point of the first line segment.
- point2 Vector2
- The second point of the first line segment.
- point3 Vector2
- The first point of the second line segment.
- point4 Vector2
- The second point of the second line segment.
- firstIsSegment Boolean
- Set this to true to require that the
intersection point be on the first line segment.
- secondIsSegment Boolean
- Set this to true to require that the
intersection point be on the second line segment.
- point Vector2
- This is set to the intersection
point if an intersection is detected.
Return Value
BooleanTrue if an intersection is detected, false otherwise.
See Also