UtilCalculateLineLineIntersection(Vector3, Vector3, Vector3, Vector3, Vector3, Vector3) Method |
Calculates the intersection line segment between 2 lines (not segments).
Namespace: Demo3D.CommonAssembly: Demo3D.Common (in Demo3D.Common.dll) Version: 19.01.00
Syntaxpublic static bool CalculateLineLineIntersection(
Vector3 line1Point1,
Vector3 line1Point2,
Vector3 line2Point1,
Vector3 line2Point2,
out Vector3 resultSegmentPoint1,
out Vector3 resultSegmentPoint2
)
Parameters
- line1Point1 Vector3
- Start of the first line.
- line1Point2 Vector3
- End of the first line.
- line2Point1 Vector3
- Start of the second line.
- line2Point2 Vector3
- End of the second line.
- resultSegmentPoint1 Vector3
- Start of the resulting line segment.
- resultSegmentPoint2 Vector3
- End of the resulting line segment.
Return Value
Boolean
Returns false if no solution is found (lines are parallel or co-incident) or true if
resultSegmentPoint1 and
resultSegmentPoint2 are filled in; noting that if the lines actually do intersect, these two values will be the same.
Remarks
It returns a line segment, because in general, two 3D lines will not actually intersect, but there is a line segment which joins the two
lines at the point where the distance between them is minimised.
See Also