Vec, VecPtr

Syntax

#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. This is done as follows in a program.

MTXMultVec( m, &vOld, &vNew );

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

Be aware that Vec and Point3d 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:

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, MTXMultVec, MTXMultVecArray, VECAdd, VECCrossProduct , VECDotProduct, VECHalfAngle, VECMag, VECNormalize, VECReflect, VECScale, VECSubtract

Revision History

2006/03/01 Initial version.


CONFIDENTIAL