GClasses
|
Represents a 3D vector. More...
#include <G3D.h>
Public Member Functions | |
G3DVector () | |
G3DVector (const G3DVector *pThat) | |
Copies the values from pThat. | |
G3DVector (G3DReal x, G3DReal y, G3DReal z) | |
Initializes the values to <x,y,z> | |
G3DReal * | vals () |
Returns the vector as an array of reals. | |
GDomNode * | serialize (GDom *pDoc) |
Marshal this object into a DOM, which can then be converted to a variety of serial formats. | |
void | deserialize (GDomNode *pNode) |
Load this object from a DOM. | |
bool | isEqual (const G3DVector &that) const |
Returns true iff all three elements are equal. | |
void | copy (const G3DVector *pThat) |
Makes a copy of pThat. | |
void | set (G3DReal x, G3DReal y, G3DReal z) |
Sets the values of this vector. | |
void | normalize () |
Normalizes this vector. | |
void | makeRandom (GRand *pRand) |
Picks a random vector from a spherical distribution. | |
G3DReal | squaredDist (const G3DVector *pThat) const |
returns the squared distance between this and pThat | |
double | squaredMag () const |
returns the squared magnitude of this vector | |
void | add (const G3DVector *pThat) |
adds pThat to this | |
void | add (G3DReal mag, const G3DVector *pThat) |
adds mag * pThat to this | |
void | add (G3DReal dx, G3DReal dy, G3DReal dz) |
void | subtract (const G3DVector *pThat) |
subtracts pThat from this | |
void | multiply (G3DReal mag) |
multiplies this by mag | |
void | multiply (G3DMatrix *pMatrix, G3DVector *pVector) |
this = pMatrix * pVector | |
G3DReal | dotProduct (const G3DVector *pThat) |
returns the dot product of this and that | |
void | crossProduct (G3DVector *pA, G3DVector *pB) |
this = pA x pB | |
void | triangleNormal (const G3DVector *pPoint1, const G3DVector *pPoint2, const G3DVector *pPoint3) |
Sets this to the normal vector of the triangle specified by three points. | |
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. | |
void | reflectionVector (G3DVector *pRay, G3DVector *pNormal) |
Sets this to the reflection of pRay on a surface with normal vector pNormal. | |
void | yawAndPitch (G3DReal *pYaw, G3DReal *pPitch) const |
*pYaw and *pPitch are in radians | |
void | fromYawAndPitch (G3DReal dYaw, G3DReal dPitch) |
dYaw and dPitch are in radians | |
Public Attributes | |
G3DReal | m_vals [3] |
Represents a 3D vector.
GClasses::G3DVector::G3DVector | ( | ) | [inline] |
GClasses::G3DVector::G3DVector | ( | const G3DVector * | pThat | ) | [inline] |
Copies the values from pThat.
Initializes the values to <x,y,z>
void GClasses::G3DVector::add | ( | const G3DVector * | pThat | ) | [inline] |
adds pThat to this
adds mag * pThat to this
void GClasses::G3DVector::copy | ( | const G3DVector * | pThat | ) | [inline] |
Makes a copy of pThat.
void GClasses::G3DVector::deserialize | ( | GDomNode * | pNode | ) |
Load this object from a DOM.
returns the dot product of this and that
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.
this = pMatrix * pVector
void GClasses::G3DVector::multiply | ( | G3DReal | mag | ) | [inline] |
multiplies this by mag
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.
Sets this to the reflection of pRay on a surface with normal vector pNormal.
Marshal this object into a DOM, which can then be converted to a variety of serial formats.
Sets the values of this vector.
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.
*pYaw and *pPitch are in radians