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 align="left">Vec, VecPtr</H1> 12<H2 align="left">C Specification</H2> 13<BLOCKQUOTE><CODE><code>#include <revolution/mtx/GeoTypes.h></CODE></CODE></BLOCKQUOTE> 14<BLOCKQUOTE><CODE><CODE>typedef struct<BR> {<BR> <BR> f32 x, y, z;<BR> <BR> } Vec, *VecPtr, Point3d, *Point3dPtr;</CODE></CODE></BLOCKQUOTE> 15<H2 align="left">Arguments</H2> 16<P align="left">None.</P> 17<H2 align="left">Return Values</H2> 18<P align="left">None.</P> 19<H2 align="left">Description</H2> 20<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 'w' coordinate of 1. For example, to multiply a vector (vOld) by a matrix (m): vNew = m x vOld. In code: </P> 21<BLOCKQUOTE><CODE><A href="../general/MTXMultVec.html">MTXMultVec</A>( m, &vOld, &vNew );</CODE></BLOCKQUOTE> 22<P><code><strong>VecPtr</strong></code> is a pointer to a <code><strong>Vec</strong></code>. It's most often used as a function argument.</P> 23<P><B>Note:</B> <code><strong>Vec</strong></code> and <a href="Point3d_Point3dPtr.html"><code>Point3d</code></a> are aliases for the same structure and may be freely interchanged. Two names for the same (x,y,z) triple were created for convenience 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> 24<BLOCKQUOTE><CODE>Vec v;<BR> Point3dPtr pPtr = &v; // use a Point3dPtr to point to a Vec</CODE></BLOCKQUOTE> 25<BLOCKQUOTE><CODE>MTXMultVec( m, &v, &v );<BR> MTXMultVec( m, pPtr, pPtr ); // use a Point3dPtr in place of a VecPtr</CODE></BLOCKQUOTE> 26 27 28<H2 align="left">See Also</H2> 29<P align="left"><A href="Mtx_MtxPtr.html">Mtx, MtxPtr</A>, <A href="Vec_VecPtr.html">Vec, VecPtr</A>, <A href="../general/MTXMultVec.html">MTXMultVec</A>, <A href="../general/MTXMultVecArray.html">MTXMultVecArray</A>, <A href="../vector/VECAdd.html">VECAdd</A>, <A href="../vector/VECCrossProduct.html">VECCrossProduct</A>, <A href="../vector/VECDotProduct.html">VECDotProduct</A>, <A href="../vector/VECHalfAngle.html">VECHalfAngle</A>, <A href="../vector/VECMag.html">VECMag</A>, <A href="../vector/VECNormalize.html">VECNormalize</A>, <A href="../vector/VECReflect.html">VECReflect</A>, <A href="../vector/VECScale.html">VECScale</A>, <A href="../vector/VECSubtract.html">VECSubtract</A></P> 30<H2>Revision History</H2> 31<P>2006/03/01 Initial version.</P> 32<hr> 33<P>CONFIDENTIAL</p> 34</BODY> 35</HTML>