Vec, VecPtr

C Specification

#include <revolution/mtx/GeoTypes.h>
typedef struct
{

    f32 x, y, z;

} Vec, *VecPtr, Point3d, *Point3dPtr;

Arguments

None.

Return Values

None.

Description

Vec 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:

MTXMultVec( m, &vOld, &vNew );

VecPtr is a pointer to a Vec. It's most often used as a function argument.

Note: Vec and Point3d 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:

Vec v;
Point3dPtr pPtr = &v;           // use a Point3dPtr to point to a Vec
MTXMultVec( m, &v,   &v );
MTXMultVec( m, pPtr, pPtr );    // use a Point3dPtr in place of a VecPtr

See Also

Mtx, MtxPtr, Vec, VecPtr, MTXMultVec, MTXMultVecArray, VECAdd, VECCrossProduct, VECDotProduct, VECHalfAngle, VECMag, VECNormalize, VECReflect, VECScale, VECSubtract

Revision History

03/01/2006 Initial version.