Ninja Library - Matrix Function

njRotate

Rotates a matrix around an arbitrary axis

FORMAT

void njRotate(*m, *v, ang)
NJS_MATRIX *m
NJS_VECTOR *v
Angle ang

PARAMETER

 *m  Calculation matrix 
 *v  Data for arbitrary axis 
 ang  Rotation angle 

RETURN

None

DESCRIPTION

Rotates matrix m around an arbitrary axis. When parameter m is NULL, the current matrix is used for calculation.

EXAMPLE

The following rotates the current matrix 90 degrees around the arbitrary axis 
containing vector v(1,1,1).

NJS_MATRIX stack[10];
NJS_VIEW view;
NJS_VECTOR v;
v.x = 1.f;
v.y = 1.f;
v.z = 1.f;
njInitMatrix(stack, 10);
njInitView(&view);
njSetView(&view);
njClearMatrix();
njPushMatrix(NULL);
njRotate(NULL, &v, NJM_DEG_ANG(90));
njPopMatrix(1);

NOTE

For a matrix [M] and multiplicative rotational matrix [R], [M] = [R] * [M]. Care must be taken with the order in which matrices are multiplied.

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