Tao.Ode SDK Documentation

Ode.dClosestLineSegmentPoints Method 

Given two line segments A and B with endpoints a1-a2 and b1-b2, return the points on A and B that are closest to each other (in cp1 and cp2). In the case of parallel lines where there are multiple solutions, a solution involving the endpoint of at least one line will be returned. This will work correctly for zero length lines, e.g. if a1==a2 and/or b1==b2.

[Visual Basic]
Public Shared Sub dClosestLineSegmentPoints( _
   ByVal a1 As dVector3, _
   ByVal a2 As dVector3, _
   ByVal b1 As dVector3, _
   ByVal b2 As dVector3, _
   ByRef cp1 As dVector3, _
   ByRef cp2 As dVector3 _
)
[C#]
public static void dClosestLineSegmentPoints(
   dVector3 a1,
   dVector3 a2,
   dVector3 b1,
   dVector3 b2,
   ref dVector3 cp1,
   ref dVector3 cp2
);

Parameters

a1
A dVector3 containing endpoint 1 of line segment A
a2
A dVector3 containing endpoint 2 of line segment A
b1
A dVector3 containing endpoint 1 of line segment B
b2
A dVector3 containing endpoint 2 of line segment B
cp1
A dVector3 returning the closest point on A
cp2
A dVector3 returning the closest point on B

See Also

Ode Class | Tao.Ode Namespace