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>Vec, VecPtr</TITLE> 9</HEAD> 10<BODY> 11<H1>Vec, VecPtr</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/mtx/GeoTypes.h> 16 17typedef struct 18{ 19 20 f32 x, y, z; 21 22} Vec, *VecPtr, Point3d, *Point3dPtr; 23</pre></dd></dl> 24 25<H2>Arguments</H2> 26<P>None.</P> 27 28<H2>Return Values</H2> 29<P>None.</P> 30 31<H2>Description</H2> 32<P><STRONG>Vec</STRONG> is a three-element vector with x, y and z components. When used in 3D transformations, it is treated as a column vector with an implied fourth <EM>w</EM> coordinate of 1. For example, to multiply a vector (<CODE>vOld</CODE>) by a matrix (<CODE>m</CODE>): <CODE>vNew = m x vOld</CODE>. This is done as follows in a program.</P> 33<dl><dd><pre class="construction"> 34<A href="../general/MTXMultVec.html">MTXMultVec</A>( m, &vOld, &vNew ); 35</pre></dd></dl> 36<P><STRONG>VecPtr</STRONG> is a pointer to a <STRONG>Vec</STRONG>. It's most often used as a function argument.</P> 37<P>Be aware that <STRONG>Vec</STRONG> and <A href="Point3d_Point3dPtr.html"><CODE>Point3d</CODE></A> are aliases for the same structure. These may be freely interchanged. Two names for the same (x,y,z) set were created for convenience. This is because sometimes it is more natural to think of an x,y,z coordinate as a vector (normal), and sometimes as a point (vertex). For example:</P> 38<dl><dd><pre class="construction"> 39Vec v; 40Point3dPtr pPtr = &v; // use a Point3dPtr to point to a Vec 41 42MTXMultVec( m, &v, &v ); 43MTXMultVec( m, pPtr, pPtr ); // use a Point3dPtr in place of a VecPtr 44</pre></dd></dl> 45 46<H2>See Also</H2> 47<P class="reference"> 48<A href="Mtx_MtxPtr.html">Mtx, MtxPtr</A>, 49<A href="../general/MTXMultVec.html">MTXMultVec</A>, 50<A href="../general/MTXMultVecArray.html">MTXMultVecArray</A>, 51<A href="../vector/VECAdd.html">VECAdd</A>, 52<A href="../vector/VECCrossProduct.html">VECCrossProduct</A> , 53<A href="../vector/VECDotProduct.html">VECDotProduct</A>, 54<A href="../vector/VECHalfAngle.html">VECHalfAngle</A>, 55<A href="../vector/VECMag.html">VECMag</A>, 56<A href="../vector/VECNormalize.html">VECNormalize</A>, 57<A href="../vector/VECReflect.html">VECReflect</A>, 58<A href="../vector/VECScale.html">VECScale</A>, 59<A href="../vector/VECSubtract.html">VECSubtract</A> 60</P> 61 62<H2>Revision History</H2> 63<P> 642006/03/01 Initial version.<BR> 65</P> 66 67<hr><p>CONFIDENTIAL</p></body> 68</HTML>