MTXInverse

C Specification

#include <revolution/mtx.h>
u32 C_MTXInverse ( const Mtx src, Mtx inv );
u32 PSMTXInverse ( const Mtx src, Mtx inv );
#define MTXInverse  C_MTXInverse // for debug build
#define MTXInverse  PSMTXInverse // for nondebug build

Arguments

src Matrix to be inverted.   src may be either an Mtx or an MtxPtr.
inv Resultant inverse of source matrix.   dst may be either an Mtx or an MtxPtr.src can be the same as inv.

Return Values

0 if matrix is not invertible. In this case inv is unchanged.

1 on success.

Description

Computes a fast inverse of a 3x4 matrix.

The algorithm used is as follows for a 3x4 matrix M:

                                        M       = [  A                   C             ]
         (A = upper 3x3 subMatrix; C = 3x1 column vector)    

                                        Minv   = [  Ainv    ( Ainv ) * ( -C ) ]

This function should be used whenever the inverse of a general 3x4 matrix is required. The cost of the function, in opertions, is 48 multiplies, 1 division, 2 additions, 25 subtractions.  While MTXInverse will work for any invertible 3x4 matrix, for reasons of efficiency it should not be used when the inverse of a matrix can be computed directly (as in single axis rotation, scale, translation).

During a debug build, MTXInverse is interpreted as C_MTXInverse, which is a normal C language version. During a nondebug build for a Broadway processor, the paired-singles equivalent of this function, PSMTXInverse, will be automatically substituted. You can also call C_MTXInverse or PSMTXInverse explicitly.

The C version of this function becomes more efficient if src is not equal to inv as it saves a copy operation from a temporary matrix.

See Also

Mtx, MtxPtr, MTXPushInv

Revision History

03/01/2006 Initial version.