RenderWare V2.1

Previous Page Index Next Page

RwMatrix4d *

RwOrthoNormalizeMatrix(RwMatrix4d *source, RwMatrix4d *dest);

Description

Ortho-normalizes the source matrix and places the result in the destination matrix.

Arguments

source Pointer to the matrix to orthonormalize.

dest Pointer to the matrix to receive the result.

Return Value

The argument dest if successful, and NULL otherwise.

Comments

Whilst RenderWare supports arbitrary 4 x 4 homogenous matrices, many applications deal only in "rigid body" transformations comprising only rotation and translation without scaling or shearing.

The 4 x 4 homogeneous matrix representing such a transformation has a special form of upper-left 3 x 3 sub-matrix known as an orthonormal matrix. An orthonormal matrix is characterized by its inverse being equal to its transpose.

Mathematically, the upper-left 3 x 3 sub-matrix corresponding to a rigid body transformation remains orthonormal after that transformation is combined with other rigid body transformations. The upper 3 x 3 sub matrix corresponding to the inverse of a rigid body transformation should also be orthonormal.

Numerically however, after extended matrix composition, some scale or shear factors may begin to accumulate due to rounding. To prevent the significant build up of such factors, RwOrthoNormalizeMatrix() should be periodically applied to a clump’s modeling or joint matrix as appropriate. This will filter out any such accumulated rounding factors from the upper-left 3 x 3 sub-matrix.

The minimal satisfactory frequency of orthonormalization will depend on the nature of the application and whether a fixed- or floating- point version of the RenderWare library is being used. Typically, an orthonormalization frequency of once every 128 frames is adequate.

See Also

RwIdentityMatrix()

RwInvertMatrix()

RwMultiplyMatrix()

RwOrthoNormalizeMatrix()

RwRotateMatrix()

RwRotateMatrixCos()

RwScaleMatrix()

RwTransformMatrix()

RwTranslateMatrix()