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>MTXPushInv</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">MTXPushInv</H1>
12<H2 align="left">C Specification</H2>
13<BLOCKQUOTE><CODE><CODE>#include &lt;revolution/mtx.h&gt;</CODE></CODE></BLOCKQUOTE>
14<BLOCKQUOTE><CODE><CODE>MtxPtr MTXPushInv ( MtxStack* <EM>sPtr</EM>, const Mtx <EM>m</EM> );</CODE></CODE></BLOCKQUOTE>
15<H2 align="left">Arguments</H2>
16<DIV align="left">
17<TABLE border="1" cellpadding="3" cellspacing="0.1">
18  <TBODY>
19    <TR>
20<TD width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>sPtr</EM></STRONG></CODE></TD>
21<TD width="520" valign="top" align="left">The <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack</CODE></A> structure including the inverse matrix stack. </TD>
22    </TR>
23    <TR>
24<TD width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>m</EM></STRONG></CODE></TD>
25<TD width="520">Source matrix for inverse computation and pre-concatenated with the matrix stack. <code><em><strong>m</strong></em></code> is not altered by this processing. <code><em><strong>m</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>
26    </TR>
27  </TBODY>
28</TABLE>
29</DIV>
30<H2 align="left">Return Values</H2>
31<P>Returns a pointer to the resultant matrix of the push inverse operation.</P>
32<H2 align="left">Description</H2>
33<P>Computes the inverse of <code><em><strong>m</strong></em></code>, pre-concatenates the result with <code><em><strong>sPtr-&gt;stackPtr</strong></em></code>, and then pushes the result to (<code><em><strong>sPtr-&gt;stackPtr</strong></em> + MTX_PTR_OFFSET</code>). <code><em><strong>m</strong></em></code> is not altered by this function;  the inverse of <code><em><strong>m</strong></em></code> is computed as a temporary local variable.</P>
34<P>On an empty stack, the function simply copies the inverse of <code><em><strong>m</strong></em></code> to<strong> <code><em>sPtr</em>-&gt;stackBase</code></strong> and sets <code><strong><em>sPtr</em>-&gt;stackPtr</strong></code> equal to <code><strong><em>sPtr</em>-&gt;stackBase</strong></code>.&nbsp;On an active stack, the inverse of <code><em><strong>m</strong></em></code> is multiplied by <code><strong><em>sPtr</em>-&gt;stackPtr</strong></code> and the result is copied to <code><strong><em>sPtr</em>-&gt;stackPtr</strong> + MTX_PTR_OFFSET</code>.</P>
35<P>This operation is equivalent to the following:</P>
36<BLOCKQUOTE><CODE><A href="../general/MTXCopy.html">MTXCopy</A>( m, mTmp );<BR> <A href="../general/MTXInverse.html">MTXInverse</A>( mTmp, mTmp );<BR> <A href="../general/MTXConcat.html">MTXConcat</A>( mTmp, sPtr-&gt;stackPtr, ( sPtr-&gt;stackPtr + MTX_PTR_OFFSET );</CODE></BLOCKQUOTE>
37<P><code>MTXPushInv</code> is intended to create an inverse transformation stack in parallel with a forward transformation stack.&nbsp;This is why the order of multiplication is pre-order, i.e., the opposite to that of <a href="MTXPushFwd.html"><code>MTXPushFwd</code></a>.&nbsp;</P>
38<P>Using this function, a single copy of each transformation matrix can be used to create both forward and inverse composite transformation matrices. These can be used to transform objects into and out of each other's local space for efficient collision detection. </P>
39<P>When the result of <code>MTXPushInv</code> causes a stack overflow, <A href="../../os/Error/ASSERTMSG.html"><code>ASSERTMSG</code></a> is executed.</P>
40
41
42<H2 align="left">See Also</H2>
43<P align="left"><A href="../../os/Error/ASSERTMSG.html"><CODE>ASSERTMSG, </CODE></A><A href="../structures/Mtx_MtxPtr.html"><CODE>Mtx, MtxPtr</CODE></A>, <A href="../structures/MtxStack_MtxStackPtr.html"><CODE>MtxStack, MtxStackPtr</CODE></A>, <A href="../general/MTXConcat.html"><CODE>MTXConcat</CODE></A>, <A href="../general/MTXInverse.html"><CODE>MTXInverse</CODE></A>, <A href="MTXPop.html"><CODE>MTXPop</CODE></A>, <CODE><A href="MTXPush.html">MTXPush</A></CODE>, <A href="MTXPushFwd.html"><CODE>MTXPushFwd</CODE></A>, <A href="MTXPushInvXpose.html"><CODE>MTXPushInvXpose</CODE></A></P>
44<H2>Revision History</H2>
45<P>03/01/2006 Initial version.</P>
46</BODY>
47</HTML>