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 13<H2 align="left">Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/mtx.h> 16 17u32 C_MTXInverse ( const Mtx src, Mtx inv ); 18u32 PSMTXInverse ( const Mtx src, Mtx inv ); 19 20#define MTXInverse C_MTXInverse // for debug build 21#define MTXInverse PSMTXInverse // for nondebug build 22</pre></dd></dl> 23 24<H2 align="left">Arguments</H2> 25<TABLE class="arguments" border="1" > 26 <TBODY> 27 <TR> 28<TH>src</TH> 29<TD>Matrix to be inverted. <SPAN class="argument">src</SPAN> may be either a <A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx</CODE></A> or a <A href="../structures/Mtx_MtxPtr.html"><CODE>MtxPtr</CODE></A>.</TD> 30 </TR> 31 <TR> 32<TH>inv</TH> 33<TD>Resulting inverse matrix. <SPAN class="argument">dst</SPAN> may be either a <A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx</CODE></A> or a <A href="../structures/Mtx_MtxPtr.html"><CODE>MtxPtr</CODE></A>.<BR>OK if <SPAN class="argument">src</SPAN> = <SPAN class="argument">inv</SPAN>.</TD> 34 </TR> 35 </TBODY> 36</TABLE> 37 38<H2 align="left">Return Values</H2> 39<P>Returns 0 if the specified matrix has no inverse. <SPAN class="argument">inv</SPAN> is not changed in this case.</P> 40<P>Returns 1 if successful.</P> 41 42<H2 align="left">Description</H2> 43<P>Computes a fast inverse of a 3x4 matrix.</P> 44<P>The algorithm used is as follows for a 3x4 matrix M:</P> 45<BLOCKQUOTE><PRE> 46M = [ A C ] 47( A = Upper 3x3 submatrix; C = 3x1 column vector) 48 49Minv = [ Ainv ( Ainv ) * ( -C ) ] 50</PRE></BLOCKQUOTE> 51<P>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 <CODE>MTXInverse</CODE> 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.</P> 52<P>During a debug build, <code>MTXInverse</code> is interpreted as <code>C_MTXInverse</code>, which is a normal C language version. During a non-debug build for a Broadway processor, the paired-singles equivalent of this function, <code><font face="Courier New">PSMTXInverse</font></code>, will be automatically substituted. You can also call each of <code>C_MTXInverse/PSMTXInverse</code> explicitly.</P> 53<P>The C version of this function becomes more efficient if <SPAN class="argument">src</SPAN> is not equal to <SPAN class="argument">inv</SPAN> because it saves a copy operation from a temporary matrix.</P> 54 55<H2 align="left">See Also</H2> 56<P class="reference"> 57<A href="../structures/Mtx_MtxPtr.html">Mtx, MtxPtr</A>, 58<A href="../stack/MTXPushInv.html">MTXPushInv</A> 59</P> 60 61<H2>Revision History</H2> 62<P> 632006/03/01 Initial version.<br> 64</P> 65 66<hr><p>CONFIDENTIAL</p></body> 67</HTML>