RotMatrix

Calculates a rotation matrix from a rotation vector

MATRIX* RotMatrix (
        MATRIX *m
        SVECTOR *r
)

Arguments

m Pointer to output rotation matrix
r Pointer to input rotation vector

Return Value

The rotation matrix m is returned.

Explanation

The rotation matrix m is calculated from the rotation vector (r->vx, r->vy, r->vz).
In the rotation vector, 360° is represented as 4096, and 4096 is equivalent to 1.0 in each element.
The matrix is an expansion of the following product:
 1   0   0   c1   0   s1   c2   -s2   0 
[  0   c0   -s0  ]*[  0   1   0  ]*[  s2   c2   0  ]
 0   s0   c0   -s1   0   c1   0   0   1 

Using GTE coordinate transformation, the vectors are multiplied from the right. Thus the matrix rotates around the Z, Y and X axes in that order.

Angle value:
c0=cos(r->vx), s0=sin(r->vx)
c1=cos(r->vy), s1=sin(r->vy)
c2=cos(r->vz), s2=sin(r->vz)

The argument format is as follows:
    m->m[i][j] : (1,3,12)
    r->vx,vy,vz :(1,3,12) (however 360° is 1.0)

See Also

MATRIX, SVECTOR