#include <revolution/mtx.h>
MtxPtr MTXPushInv ( MtxStack* sPtr, const Mtx m );
sPtr |
The MtxStack structure including the inverse matrix stack. |
m |
Source matrix for inverse computation and pre-concatenated with the matrix stack. m is not altered by this processing. m may be either an Mtx or an MtxPtr. |
Returns a pointer to the resultant matrix of the push inverse operation.
Computes the inverse of m, pre-concatenates the result with sPtr->stackPtr, and then pushes the result to (sPtr->stackPtr + MTX_PTR_OFFSET). m is not altered by this function; the inverse of m is computed as a temporary local variable.
On an empty stack, the function simply copies the inverse of m to sPtr->stackBase and sets sPtr->stackPtr equal to sPtr->stackBase. On an active stack, the inverse of m is multiplied by sPtr->stackPtr and the result is copied to sPtr->stackPtr + MTX_PTR_OFFSET.
This operation is equivalent to the following:
MTXCopy( m, mTmp );
MTXInverse( mTmp, mTmp );
MTXConcat( mTmp, sPtr->stackPtr, ( sPtr->stackPtr + MTX_PTR_OFFSET );
MTXPushInv is intended to create an inverse transformation stack in parallel with a forward transformation stack. This is why the order of multiplication is pre-order, i.e., the opposite to that of MTXPushFwd.
Using this function, a single copy of each transformation matrix can be used to create both forward and inverse composite transformation matrices. These can be used to transform objects into and out of each other's local space for efficient collision detection.
When the result of MTXPushInv causes a stack overflow, ASSERTMSG is executed.
ASSERTMSG, Mtx, MtxPtr, MtxStack, MtxStackPtr, MTXConcat, MTXInverse, MTXPop, MTXPush, MTXPushFwd, MTXPushInvXpose
03/01/2006 Initial version.