Method ClosestPointsOnTwoLineSegments
ClosestPointsOnTwoLineSegments(Vector3, Vector3, Vector3, Vector3, out Vector3, out Vector3, double)
Finds the closest points between two line segments.
Declaration
public static bool ClosestPointsOnTwoLineSegments(Vector3 a, Vector3 aLineVector, Vector3 b, Vector3 bLineVector, out Vector3 resultA, out Vector3 resultB, double parallelTest = 5E-324)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | a | Starting point of segment A. |
Vector3 | aLineVector | Vector from point a to the end point of segment A. |
Vector3 | b | Starting point of segment B. |
Vector3 | bLineVector | Vector from point b to the end point of segment B. |
Vector3 | resultA | Set to the coordinates of the point along segment A that is closest to any point on segment B. |
Vector3 | resultB | Set to the coordinates of the point along segment B that is closest to any point on segment A. |
double | parallelTest | (Optional) epsilon value for parallel lines test |
Returns
Type | Description |
---|---|
bool | True if the line segments are parallel, false otherwise |
Remarks
If the two line segments are parallel, then resultA
and resultB
are set to the midpoint of the respective line segments.