Ninja Library - Collision Function

njGetPlaneNormal2

Finds the vector that is normal to a plane.

FORMAT

void njGetPlaneNormal( *p0, *p1, *p2 *v )
NJS_POINT3 *p0
NJS_POINT3 *p1
NJS_POINT3 *p2
NJS_VECTOR *v

PARAMETER

 *p0  Data of point 1 on plane 
 *p1  Data of point 2 on plane 
 *p2  Data of point 3 on plane 
 *v  Normal vector to plane 

RETURN

None

DESCRIPTION

Finds the normal vector from three points on a plane.

EXAMPLE

The following finds the normal vector to the plane passing 
through points (1, 2, 3), (1, -1, 2), and (2, 3, 1).

NJS_POINT3 p0, p1, p2;
NJS_VECTOR v;
p0.x = 1.f;
p0.y = 2.f;
p0.z = 3.f;
p1.x = 1.f;
p1.y = -1,f;
p1.z = 2.f;
p2.x = 2.f;
p2.y = 3.f;
p2.z = 1.f;
njGetPlaneNormal(&p0, &p1, &p2, &v);
% Result %
v (7, -1, 3)

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