1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>MTXInverse</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">MTXInverse</H1> 12<H2 align="left">C Specification</H2> 13<BLOCKQUOTE><CODE><CODE>#include <revolution/mtx.h></CODE></CODE></BLOCKQUOTE> 14<BLOCKQUOTE><CODE>u32 C_MTXInverse ( const Mtx <EM>src</EM>, Mtx <EM>inv</EM> );<BR> u32 PSMTXInverse ( const Mtx <EM>src</EM>, Mtx <EM>inv</EM> );</CODE></BLOCKQUOTE> 15<BLOCKQUOTE><CODE><CODE>#define MTXInverse C_MTXInverse // for debug build<BR> #define MTXInverse PSMTXInverse // for nondebug build</CODE></CODE></BLOCKQUOTE> 16<H2 align="left">Arguments</H2> 17<DIV align="left"> 18<TABLE border="1" cellpadding="3" cellspacing="0.1"> 19 <TBODY> 20 <TR> 21<TD width="120" valign="top" align="left" bgcolor="#ffffe8"><CODE><STRONG><EM>src</EM></STRONG></CODE></TD> 22<TD width="520" valign="top" align="left">Matrix to be inverted. <code><em><strong>src</strong></em></code> may be either an <A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx</CODE></A> or an <A href="../structures/Mtx_MtxPtr.html"><CODE>MtxPtr</CODE></A>.</TD> 23 </TR> 24 <TR> 25<TD width="120" valign="top" align="left" bgcolor="#ffffe8"><CODE><STRONG><EM>inv</EM></STRONG></CODE></TD> 26<TD width="520">Resultant inverse of source matrix. <code><em><strong>dst</strong></em></code> may be either an <A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx</CODE></A> or an <A href="../structures/Mtx_MtxPtr.html"><CODE>MtxPtr.</CODE></A><code><em><strong>src</strong></em></code> can be the same as <CODE><EM><STRONG>inv</STRONG></EM></CODE>.</TD> 27 </TR> 28 </TBODY> 29</TABLE> 30</DIV> 31<H2 align="left">Return Values</H2> 32<P align="left">0 if matrix is not invertible. In this case <STRONG><EM><CODE>inv</CODE></EM></STRONG> is unchanged.</P> 33<P align="left">1 on success.</P> 34<H2 align="left">Description</H2> 35<P align="left">Computes a fast inverse of a 3x4 matrix.</P> 36<P align="left">The algorithm used is as follows for a 3x4 matrix M:</P> 37<P align="left"> M = [ A C ] <BR> (A = upper 3x3 subMatrix; C = 3x1 column vector) </P> 38<P align="left"> Minv = [ Ainv ( Ainv ) * ( -C ) ]</P> 39<P align="left">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 <CODE>MTXInverse</CODE> 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). </P> 40<P>During a debug build, <code>MTXInverse</code> is interpreted as <code>C_MTXInverse</code>, which is a normal C language version. During a nondebug build for a Broadway processor, the paired-singles equivalent of this function, <code>PSMTXInverse</code>, will be automatically substituted. You can also call <code>C_MTXInverse</CODE> or <CODE>PSMTXInverse</code> explicitly.</P> 41<P align="left">The C version of this function becomes more efficient if <code><em><strong>src</strong></em></code> is not equal to <em><strong><code>xPose</code></strong></em> as it saves a copy operation from a temporary matrix.</P> 42 43 44<H2 align="left">See Also</H2> 45<P align="left"><CODE><A href="../structures/Mtx_MtxPtr.html">Mtx</A></CODE>, <CODE><A href="../structures/Mtx_MtxPtr.html">MtxPtr</A></CODE>, 46<A href="../stack/MTXPushInv.html"><CODE>MTXPushInv</CODE></A></P> 47<H2>Revision History</H2> 48<P>2006/03/01 Initial version.</P> 49<hr> 50<P>CONFIDENTIAL</p> 51</BODY> 52</HTML>