guRotate

guRotate [Function]

Function

guRotate

Creates a modeling matrix for rotation around an arbitrary axis (fixed point)

Syntax

#include <ultra64.h>        /* gu.h */
void guRotate(Mtx *m, float a, float x, float y, float z);

Arguments

m
Pointer to the matrix resulting from the calculation
a
Angle of rotation (in degrees) around an arbitrary axis
x
x component of axis of rotation
y
y component of axis of rotation
z
z component of axis of rotation

Returned value

None

Description

Returns a modeling matrix to the structure indicated by m for use in rotating around the arbitrary axis represented by the line passing through the origin and a point (x, y, z) by an amount of a degrees in the positive direction. When this function is called, the result is the creation of the following kind of modeling matrix:


(* Note that the values (x,y,z) here are normalized inside the function)

For a detailed explanation about the fixed-point format, see gSPMatrix. Floating-point is handled using the guRotateF function.

Note

The vector does not have to be normalized ahead of time. This is done inside the function. However, when = 0 the operation of this macro cannot be guaranteed. Also, note that an angle with a positive value represents counter-clockwise rotation.

Comment

The Mtx structure looks like this:

typedef long  Mtx_t[4][4];
typedef union {
     Mtx_t          m;
     long long int  force_structure_alignment;
} Mtx;

See also

gSPMatrix, guAlign, guAlignF, guPosition, guPositionF, guRotateF, guRotateRPY, guRotateRPYF, guScale, guScaleF, guTranslate, and guTranslateF

Revision history

03/01/99 Completely rewritten.