Ninja Library - Collision Function

njDistanceP2L

Returns the distance between a point and a line

FORMAT

Float njDistanceP2L( *p, *l, *cp )
NJS_POINT3 *p
NJS_LINE *l
NJS_POINT3 *cp

PARAMETER

 *p  Point data 
 *l  Line data 
 *cp  Coordinates of the base of the perpendicular from the point p to the line l 

RETURN

Distance between a point and a line

DESCRIPTION

Returns the distance between a point and a line. When parameter cp is not NULL, the coordinates of the base of the perpendicular from the point p to the line l are returned in cp.

EXAMPLE

NJS_POINT3 p, cp;
NJS_LINE l;
p.x = 6.f;
p.y = 6.f;
p.z = 4.f;
l.px = 4.f;
l.py = 3.f;
l.pz = 2.f;
l.vx = 3.f;
l.vy = 2.f;
l.vz = 1.f;
njDistanceP2L(&p, &l, &cp);
% Result %
Return : 1.732051
cp (7, 5, 3)

njDistanceP2L
COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999