MTXInverse

Syntax

#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 a Mtx or a MtxPtr.
inv Resulting inverse matrix. dst may be either a Mtx or a MtxPtr.
OK if src = inv.

Return Values

Returns 0 if the specified matrix has no inverse. inv is not changed in this case.

Returns 1 if successful.

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 operations, is 48 multiplies, 1 division, 2 additions, and 25 subtractions. Although MTXInverse can be used to find the inverse of all 3x4 matrices, from an efficiency standpoint, it should not be used for operations (such as rotation, parallel translation, and magnification/reduction) that can be found directly.

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

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

See Also

Mtx, MtxPtr, MTXPushInv

Revision History

2006/03/01 Initial version.


CONFIDENTIAL