#include <revolution/mtx.h> MtxPtr MTXPushInv ( MtxStack* sPtr, const Mtx m );
| sPtr | The MtxStack structure including the inverse matrix stack. |
|---|---|
| m | Source matrix used to calculate the inverse matrix and join from the beginning of the matrix stack. m is not altered by this processing. m can be an Mtx or an MtxPtr. |
Returns a pointer to the matrix generated as a result of pushing in the reverse direction.
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.
For an empty stack, this function simply copies the inverse of m to sPtr->stackBase and sets sPtr->stackPtr equal to sPtr->stackBase. For 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, that is, the opposite of MTXPushFwd's.
Using this function allows composite transform matrices in both the forward and reverse direction to be generated by simply copying each transform matrix. These can be used to efficiently detect collisions by having objects go back and forth in the local space.
If the result of MTXPushInv causes stack overflow, ASSERTMSG is triggered.
ASSERTMSG, Mtx, MtxPtr, MtxStack, MtxStackPtr, MTXConcat, MTXInverse, MTXPop, MTXPush, MTXPushFwd, MTXPushInvXpose
2006/03/01 Initial version.
CONFIDENTIAL