GClasses
GClasses::G3DVector Class Reference

Detailed Description

Represents a 3D vector.

#include <G3D.h>

Public Member Functions

 G3DVector ()
 
 G3DVector (const G3DVector *pThat)
 Copies the values from pThat. More...
 
 G3DVector (G3DReal x, G3DReal y, G3DReal z)
 Initializes the values to <x,y,z> More...
 
void add (const G3DVector *pThat)
 adds pThat to this More...
 
void add (G3DReal mag, const G3DVector *pThat)
 adds mag * pThat to this More...
 
void add (G3DReal dx, G3DReal dy, G3DReal dz)
 
void copy (const G3DVector *pThat)
 Makes a copy of pThat. More...
 
void crossProduct (G3DVector *pA, G3DVector *pB)
 this = pA x pB More...
 
void deserialize (GDomNode *pNode)
 Load this object from a DOM. More...
 
G3DReal dotProduct (const G3DVector *pThat)
 returns the dot product of this and that More...
 
void fromYawAndPitch (G3DReal dYaw, G3DReal dPitch)
 dYaw and dPitch are in radians More...
 
bool isEqual (const G3DVector &that) const
 Returns true iff all three elements are equal. More...
 
void makeRandom (GRand *pRand)
 Picks a random vector from a spherical distribution. More...
 
void multiply (G3DReal mag)
 multiplies this by mag More...
 
void multiply (G3DMatrix *pMatrix, G3DVector *pVector)
 this = pMatrix * pVector More...
 
void normalize ()
 Normalizes this vector. More...
 
void planeEquation (const G3DVector *pPoint1, const G3DVector *pPoint2, const G3DVector *pPoint3, G3DReal *pOutD)
 Computes the plane equation (ax + by + cz + d = 0) of the specified triangle. this = <a, b, c> and *pOutD = d. More...
 
void reflectionVector (G3DVector *pRay, G3DVector *pNormal)
 Sets this to the reflection of pRay on a surface with normal vector pNormal. More...
 
GDomNodeserialize (GDom *pDoc) const
 Marshal this object into a DOM, which can then be converted to a variety of serial formats. More...
 
void set (G3DReal x, G3DReal y, G3DReal z)
 Sets the values of this vector. More...
 
G3DReal squaredDist (const G3DVector *pThat) const
 returns the squared distance between this and pThat More...
 
double squaredMag () const
 returns the squared magnitude of this vector More...
 
void subtract (const G3DVector *pThat)
 subtracts pThat from this More...
 
void triangleNormal (const G3DVector *pPoint1, const G3DVector *pPoint2, const G3DVector *pPoint3)
 Sets this to the normal vector of the triangle specified by three points. More...
 
G3DRealvals ()
 Returns the vector as an array of reals. More...
 
void yawAndPitch (G3DReal *pYaw, G3DReal *pPitch) const
 *pYaw and *pPitch are in radians More...
 

Public Attributes

G3DReal m_vals [3]
 

Constructor & Destructor Documentation

GClasses::G3DVector::G3DVector ( )
inline
GClasses::G3DVector::G3DVector ( const G3DVector pThat)
inline

Copies the values from pThat.

GClasses::G3DVector::G3DVector ( G3DReal  x,
G3DReal  y,
G3DReal  z 
)
inline

Initializes the values to <x,y,z>

Member Function Documentation

void GClasses::G3DVector::add ( const G3DVector pThat)
inline

adds pThat to this

void GClasses::G3DVector::add ( G3DReal  mag,
const G3DVector pThat 
)
inline

adds mag * pThat to this

void GClasses::G3DVector::add ( G3DReal  dx,
G3DReal  dy,
G3DReal  dz 
)
inline
void GClasses::G3DVector::copy ( const G3DVector pThat)
inline

Makes a copy of pThat.

void GClasses::G3DVector::crossProduct ( G3DVector pA,
G3DVector pB 
)
inline

this = pA x pB

void GClasses::G3DVector::deserialize ( GDomNode pNode)

Load this object from a DOM.

G3DReal GClasses::G3DVector::dotProduct ( const G3DVector pThat)
inline

returns the dot product of this and that

void GClasses::G3DVector::fromYawAndPitch ( G3DReal  dYaw,
G3DReal  dPitch 
)
inline

dYaw and dPitch are in radians

bool GClasses::G3DVector::isEqual ( const G3DVector that) const
inline

Returns true iff all three elements are equal.

void GClasses::G3DVector::makeRandom ( GRand pRand)

Picks a random vector from a spherical distribution.

void GClasses::G3DVector::multiply ( G3DReal  mag)
inline

multiplies this by mag

void GClasses::G3DVector::multiply ( G3DMatrix pMatrix,
G3DVector pVector 
)

this = pMatrix * pVector

void GClasses::G3DVector::normalize ( )
inline

Normalizes this vector.

void GClasses::G3DVector::planeEquation ( const G3DVector pPoint1,
const G3DVector pPoint2,
const G3DVector pPoint3,
G3DReal pOutD 
)
inline

Computes the plane equation (ax + by + cz + d = 0) of the specified triangle. this = <a, b, c> and *pOutD = d.

void GClasses::G3DVector::reflectionVector ( G3DVector pRay,
G3DVector pNormal 
)

Sets this to the reflection of pRay on a surface with normal vector pNormal.

GDomNode* GClasses::G3DVector::serialize ( GDom pDoc) const

Marshal this object into a DOM, which can then be converted to a variety of serial formats.

void GClasses::G3DVector::set ( G3DReal  x,
G3DReal  y,
G3DReal  z 
)
inline

Sets the values of this vector.

G3DReal GClasses::G3DVector::squaredDist ( const G3DVector pThat) const
inline

returns the squared distance between this and pThat

double GClasses::G3DVector::squaredMag ( ) const
inline

returns the squared magnitude of this vector

void GClasses::G3DVector::subtract ( const G3DVector pThat)
inline

subtracts pThat from this

void GClasses::G3DVector::triangleNormal ( const G3DVector pPoint1,
const G3DVector pPoint2,
const G3DVector pPoint3 
)
inline

Sets this to the normal vector of the triangle specified by three points.

G3DReal* GClasses::G3DVector::vals ( )
inline

Returns the vector as an array of reals.

void GClasses::G3DVector::yawAndPitch ( G3DReal pYaw,
G3DReal pPitch 
) const

*pYaw and *pPitch are in radians

Member Data Documentation

G3DReal GClasses::G3DVector::m_vals[3]