Vector Class Reference

#include <math.h>

Class Description

Represents a 3D vector or point with S23E8 floating point elements.

+ Examples:

Definition at line 35 of file math.h.

Public Member Functions

 Vector (void) throw ()
 Constructs the vector with zero values. More...
 
 Vector (float fX, float fY, float fZ=0.0f) throw ()
 Constructs the vector with specified values. More...
 
 Vector (const Vector &vVector) throw ()
 Copy constructor. More...
 
 Vector (const char *pVector) throw ()
 Construct the vector from a pointer to 8bit signed data. More...
 
 Vector (const short *pVector) throw ()
 Construct the vector from a pointer to 16bit signed data. More...
 
VectorSet (float fX, float fY, float fZ) throw ()
 Sets the values of the vector elements and returns the vector. More...
 
VectorClear (void) throw ()
 Zeros all the components of the Vector, then returns it. More...
 
VectorNormalize (void) throw ()
 Normalizes the vector and returns it. More...
 
VectorNormalizeApprox (void) throw ()
 Normalizes the vector and returns it. More...
 
Vector Normalized (void) const throw ()
 Returns a normalized version of the vector, without changing this vector. More...
 
VectorMakeOrthogonal (const Vector &vBase)
 Makes this vector orthogonal to the given vBase vector and normalizes it. More...
 
VectorSetLength (float fLength)
 Sets the vector to the given length, without changing its direction. More...
 
VectorRotateOrthogonal (const Vector &vBase)
 Rotates this vector to be orthogonal to vBase without changing its length, and returns it. More...
 
float LengthSquare (void) const
 Returns the square of the length of the vector. More...
 
float Length () const throw ()
 Returns the length of the vector. More...
 
float Length2D () const throw ()
 Returns the 2D length of the vector, ignoring the z element. More...
 
float DistanceFrom (const Vector &v) const
 Returns the distance between two points (this and another, represented as Vector objects). More...
 
float DistanceSquareFrom (const Vector &v) const
 Returns the square of the distance between two points (this and another, represented as Vector objects). More...
 
float DistanceFromLine (const Vector &v0, const Vector &v1) const
 Returns the shortest distance between this point and a line defined by two other points (all points represented by vector objects). More...
 
float DistanceFromSegment (const Vector &v0, const Vector &v1) const
 Returns the distance between this point and a line segment defined by the two ending points. More...
 
float DistanceFromTriangleSquared (const Vector &v0, const Vector &v1, const Vector &v2, float *aBaryCoords=0) const
 Returns the squared distance from this point to the closest point on the triangle defined by v0, v1, v2. More...
 
const VectorRelocate2D (const Vector &v0, const Vector &v1)
 Converts this (2d) vector to represent itself as a linear combination of the supplied basis vectors. More...
 
void Relocate (const Vector &v0, const Vector &v1, const Vector &v2)
 Converts this vector to represent itself as a linear combination of the supplied basis vectors. More...
 
bool Relocate2DQuad (const Vector &v0, const Vector &v1, const Vector &v2, const Vector &v3)
 This operation calculates the baricentric coordinates inside a quad where the quad corners are v0,v1,v2,v3. More...
 
bool RelocateQuad (const Vector &v0, const Vector &v1, const Vector &v2, const Vector &v3)
 This operation calculates the baricentric coordinates inside a quad where the quad corners are v0,v1,v2,v3. More...
 
float AngleCos (const Vector &v1) const throw ()
 Returns the cosine of the angle between this vector and the one passed in. More...
 
Vector Minimum (const Vector &o)
 Returns the minimum of this and the argument vector. More...
 
Vector Maximum (const Vector &o)
 Returns the maximum of this and the argument vector. More...
 
Vector operator- (void) const throw ()
 Returns the inverse of the vector. More...
 
Vector operator+ (float f) const throw ()
 Returns the sum of a vector and a scalar. More...
 
Vector operator+ (const Vector &v) const throw ()
 Returns the sum of two vectors. More...
 
Vector operator- (const Vector &v) const throw ()
 Returns the difference between two vectors/points. More...
 
Vector operator* (const Vector &v) const throw ()
 Returns the product of two vectors by components. More...
 
Vector operator* (float f) const throw ()
 Returns the product of the vector and a scalar. More...
 
Vector operator/ (const Vector &v) const throw ()
 Returns the quotient of two vectors by components. More...
 
Vector operator/ (float f) const throw ()
 Returns the quotient of a vector and a scalar. More...
 
Vector operator* (int i) const throw ()
 Returns the product of a vector and an integer. More...
 
Vector operator/ (int i) const throw ()
 Returns the quotient of a vector and an integer. More...
 
Vector operator/ (unsigned int i) const throw ()
 Returns the quotient of a vector and an unsigned integer. More...
 
float operator| (const Vector &v) const throw ()
 Returns the dot product of two vectors. More...
 
Vector operator& (const Vector &v) const
 Returns the cross product of two vectors. More...
 
bool operator== (const Vector &v) const throw ()
 Returns true if the two vectors are identical, false otherwise. More...
 
bool operator!= (const Vector &v) const throw ()
 Returns true if the two vectors are different, false otherwise. More...
 
 operator bool (void) const throw ()
 Returns true if the vector is not a zero vector, false otherwise. More...
 
bool operator! (void) const throw ()
 Returns true if the vector is a zero vector, false otherwise. More...
 
Vectoroperator= (const Vector &v)
 Sets this vector to equal another one and returns it. More...
 
Vectoroperator<< (const Vector &v)
 Sets this vector to equal another one and returns it. More...
 
Vectoroperator-= (const Vector &v) throw ()
 Subtracts the component values of another vector from this one's, and returns the result. More...
 
Vectoroperator+= (const Vector &v) throw ()
 Adds another vector to this one and returns the result. More...
 
Vectoroperator+= (const float f) throw ()
 Adds a float to all the elements of this vector and returns the result. More...
 
Vectoroperator-= (const float f) throw ()
 Subtracts a float to all the elements of this vector and returns the result. More...
 
Vectoroperator*= (float f) throw ()
 Multiplies the components of the vector with a scalar value and returns the result. More...
 
Vectoroperator*= (const Vector &v) throw ()
 Multiplies the vector with another vector by components and returns the result. More...
 
Vectoroperator/= (float f)
 Divides the vector by a scalar and returns the result. More...
 
float & operator[] (int i) throw ()
 Returns a individual components of the vector. More...
 
float & operator[] (unsigned int i) throw ()
 Returns a component of the vector. More...
 
 operator const float * (void) const
 Returns a pointer to the data of the vector. Do not delete this pointer. More...
 

Public Attributes

union {
   struct {
      float   m_fX
 
      float   m_fY
 
      float   m_fZ
 
   } 
 
   struct {
      float   x
 
      float   y
 
      float   z
 
   } 
 
   float   m_aCoors [3]
 
}; 
 

Constructor & Destructor Documentation

Vector ( void  )
throw (
)
inline

Constructs the vector with zero values.

Definition at line 39 of file math.h.

39 { x = y = z = 0.0f; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector ( float  fX,
float  fY,
float  fZ = 0.0f 
)
throw (
)
inline

Constructs the vector with specified values.

Definition at line 42 of file math.h.

43  { x = fX; y = fY; z = fZ; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector ( const Vector vVector)
throw (
)
inline

Copy constructor.

Definition at line 46 of file math.h.

47  { x = vVector.x; y = vVector.y; z = vVector.z; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector ( const char *  pVector)
throw (
)
inline

Construct the vector from a pointer to 8bit signed data.

The array must have at least 3 elements, with values in the range -127 to +127.

Definition at line 52 of file math.h.

53  { x = pVector[0]*(1.0f/127.0f); y = pVector[1]*(1.0f/127.0f); z = pVector[2]*(1.0f/127.0f); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector ( const short *  pVector)
throw (
)
inline

Construct the vector from a pointer to 16bit signed data.

The array must have at least 3 elements in the range -32767 to +32767.

Definition at line 57 of file math.h.

58  { x = pVector[0]*(1.0f/32767.0f); y = pVector[1]*(1.0f/32767.0f); z = pVector[2]*(1.0f/32767.0f); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876

Member Function Documentation

Vector& Set ( float  fX,
float  fY,
float  fZ 
)
throw (
)
inline

Sets the values of the vector elements and returns the vector.

Definition at line 61 of file math.h.

62  { x = fX; y = fY; z = fZ; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector& Clear ( void  )
throw (
)
inline

Zeros all the components of the Vector, then returns it.

Definition at line 65 of file math.h.

66  { return Set( 0.0f, 0.0f, 0.0f ); };
Vector & Set(float fX, float fY, float fZ)
Sets the values of the vector elements and returns the vector.
Definition: math.h:61
GLclampf f
Definition: GLee.h:9303
Vector& Normalize ( void  )
throw (
)

Normalizes the vector and returns it.

If the vector is zero length, it is set to (0,1,0)

Vector& NormalizeApprox ( void  )
throw (
)

Normalizes the vector and returns it.

If the vector is zero length, it is set to (0,1,0) TO BE REMOVED. This was an experiment at improving speed in exchange for accurracy.

Vector Normalized ( void  ) const
throw (
)

Returns a normalized version of the vector, without changing this vector.

Vector& MakeOrthogonal ( const Vector vBase)

Makes this vector orthogonal to the given vBase vector and normalizes it.

Returns the vector.

The resulting vector will lie on the plane defined by the original value of this vector, and vBase.

Vector& SetLength ( float  fLength)
inline

Sets the vector to the given length, without changing its direction.

If the vector is of zero length, then it is arbitrarily made parallel to the Y axis.

Definition at line 94 of file math.h.

95  { Normalize(); operator *=( fLength ); return *this; };
Vector & Normalize(void)
Normalizes the vector and returns it.
Vector & operator*=(float f)
Multiplies the components of the vector with a scalar value and returns the result.
Definition: math.h:315
Vector& RotateOrthogonal ( const Vector vBase)
inline

Rotates this vector to be orthogonal to vBase without changing its length, and returns it.

The resulting vector will lie on the plane defined by the original value of this vector, and vBase.

Definition at line 103 of file math.h.

104  { float fLen = Length(); MakeOrthogonal( vBase ); SetLength( fLen ); return *this; };
Vector & SetLength(float fLength)
Sets the vector to the given length, without changing its direction.
Definition: math.h:94
Vector & MakeOrthogonal(const Vector &vBase)
Makes this vector orthogonal to the given vBase vector and normalizes it.
float Length() const
Returns the length of the vector.
float LengthSquare ( void  ) const
inline

Returns the square of the length of the vector.

Definition at line 108 of file math.h.

108 { return x*x+y*y+z*z; };
float z
Definition: math.h:340
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
float Length ( ) const
throw (
)

Returns the length of the vector.

float Length2D ( ) const
throw (
)

Returns the 2D length of the vector, ignoring the z element.

float DistanceFrom ( const Vector v) const
inline

Returns the distance between two points (this and another, represented as Vector objects).

Definition at line 118 of file math.h.

118 { return operator -(v).Length(); };
Vector operator-(void) const
Returns the inverse of the vector.
Definition: math.h:214
const GLdouble * v
Definition: GLee.h:1174
float Length() const
Returns the length of the vector.
float DistanceSquareFrom ( const Vector v) const
inline

Returns the square of the distance between two points (this and another, represented as Vector objects).

Definition at line 122 of file math.h.

122 { return operator -(v).LengthSquare(); };
Vector operator-(void) const
Returns the inverse of the vector.
Definition: math.h:214
float LengthSquare(void) const
Returns the square of the length of the vector.
Definition: math.h:108
const GLdouble * v
Definition: GLee.h:1174
float DistanceFromLine ( const Vector v0,
const Vector v1 
) const

Returns the shortest distance between this point and a line defined by two other points (all points represented by vector objects).

float DistanceFromSegment ( const Vector v0,
const Vector v1 
) const

Returns the distance between this point and a line segment defined by the two ending points.

float DistanceFromTriangleSquared ( const Vector v0,
const Vector v1,
const Vector v2,
float *  aBaryCoords = 0 
) const

Returns the squared distance from this point to the closest point on the triangle defined by v0, v1, v2.

Optionally, the barycentric coordinates of the point on the triangle are returned in aBaryCoords, which must be an array of 3 floats, or NULL. To compute the 3d point use: Vector vPoint = v0 * aBaryCoords[0] + v1 * aBaryCoords[1] + v2 * aBaryCoords[2]

const Vector& Relocate2D ( const Vector v0,
const Vector v1 
)

Converts this (2d) vector to represent itself as a linear combination of the supplied basis vectors.

Returns the result.

This function works in 2d, ignoring the Z component of all the vectors. The supplied basis vectors must not be parallel.

This method figures out how to express this vector (x,y) as a linear combination of the two vector arguments. X is set to the multiplier on the first vector, and Y to the multiplier on the second vector. So the original vector could be reconstructed from the final one like this: original = x*v0 + y*v1

void Relocate ( const Vector v0,
const Vector v1,
const Vector v2 
)

Converts this vector to represent itself as a linear combination of the supplied basis vectors.

This method figures out how to express this vector (x,y,z) as a linear combination of the three vector arguments. X is set to the multiplier on the first vector, Y to the multiplier on the second vector, and Z to the multiplier on the third. The supplied basis vectors must not be parallel. So the original vector could be reconstructed from the final one like this: original = x*v0 + y*v1 + z*v2

bool Relocate2DQuad ( const Vector v0,
const Vector v1,
const Vector v2,
const Vector v3 
)

This operation calculates the baricentric coordinates inside a quad where the quad corners are v0,v1,v2,v3.

2d points in this function are represented by 3d Vector objects, with the Z component ignored. This function works in 2d only. If v0, v1, v2 and v3 are the corners of a quad in a 2d space (such as UV space), and this object's (x,y) coordinates represent a point inside that quad, then this function will calculate the baricentric coordinates inside the quad (v0 and v3 are opposite corners). After this operation the following code can calculate the original value stored in the vector (this can help you understand what the function does):

Vector vEdgeA = v1-v0;
Vector vEdgeB = v3-v2;
Vector vPointA = v0+vEdgeA*x;
Vector vPointB = v2+vEdgeB*x;
Vector vEdge = vPointB-vPointA;
Vector vValueBeforeOperation = vPointA+vEdge*y;
bool RelocateQuad ( const Vector v0,
const Vector v1,
const Vector v2,
const Vector v3 
)

This operation calculates the baricentric coordinates inside a quad where the quad corners are v0,v1,v2,v3.

This is the 3d version of the Relocate2DQuad function. The result will only be correct if the four points lie on the same plane.

float AngleCos ( const Vector v1) const
throw (
)
inline

Returns the cosine of the angle between this vector and the one passed in.

Definition at line 199 of file math.h.

200  { return Vector(*this).Normalize()|Vector(v1).Normalize(); };
GLfloat GLfloat v1
Definition: GLee.h:1735
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector Minimum ( const Vector o)
inline

Returns the minimum of this and the argument vector.

Minimums are calculated individually for z, y, and z.

Definition at line 205 of file math.h.

206  { return Vector( Min(x, o.x), Min(y, o.y), Min(z, o.z) ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
type Min(type a, type b)
Definition: mudbox.h:184
GLenum GLint x
Definition: GLee.h:876
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector Maximum ( const Vector o)
inline

Returns the maximum of this and the argument vector.

Maximums are calculated individually for z, y, and z.

Definition at line 210 of file math.h.

211  { return Vector( Max(x, o.x), Max(y, o.y), Max(z, o.z) ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
type Max(type a, type b)
Definition: mudbox.h:186
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator- ( void  ) const
throw (
)
inline

Returns the inverse of the vector.

Definition at line 214 of file math.h.

215  { return Vector( -x, -y, -z ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator+ ( float  f) const
throw (
)
inline

Returns the sum of a vector and a scalar.

(The scalar is added to each component individually).

Definition at line 219 of file math.h.

220  { return Vector( x+f, y+f, z+f ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
GLclampf f
Definition: GLee.h:9303
Vector operator+ ( const Vector v) const
throw (
)
inline

Returns the sum of two vectors.

Definition at line 223 of file math.h.

224  { return Vector( x+v.x, y+v.y, z+v.z ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator- ( const Vector v) const
throw (
)
inline

Returns the difference between two vectors/points.

Definition at line 227 of file math.h.

228  { return Vector( x-v.x, y-v.y, z-v.z ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator* ( const Vector v) const
throw (
)
inline

Returns the product of two vectors by components.

Definition at line 231 of file math.h.

232  { return Vector( x*v.x, y*v.y, z*v.z ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator* ( float  f) const
throw (
)
inline

Returns the product of the vector and a scalar.

Definition at line 235 of file math.h.

236  { return Vector( x*f, y*f, z*f ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
GLclampf f
Definition: GLee.h:9303
Vector operator/ ( const Vector v) const
throw (
)
inline

Returns the quotient of two vectors by components.

Definition at line 239 of file math.h.

240  { return Vector( x/v.x, y/v.y, z/v.z ); };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
Vector operator/ ( float  f) const
throw (
)
inline

Returns the quotient of a vector and a scalar.

Definition at line 243 of file math.h.

244  { return operator *( 1.0f/f ); };
Vector operator*(const Vector &v) const
Returns the product of two vectors by components.
Definition: math.h:231
GLclampf f
Definition: GLee.h:9303
Vector operator* ( int  i) const
throw (
)
inline

Returns the product of a vector and an integer.

Definition at line 247 of file math.h.

248  { return operator *( float(i) ); };
Vector operator*(const Vector &v) const
Returns the product of two vectors by components.
Definition: math.h:231
Vector operator/ ( int  i) const
throw (
)
inline

Returns the quotient of a vector and an integer.

Definition at line 251 of file math.h.

252  { return operator /( float(i) ); };
Vector operator/(const Vector &v) const
Returns the quotient of two vectors by components.
Definition: math.h:239
Vector operator/ ( unsigned int  i) const
throw (
)
inline

Returns the quotient of a vector and an unsigned integer.

Definition at line 255 of file math.h.

256  { return operator /( float(i) ); };
Vector operator/(const Vector &v) const
Returns the quotient of two vectors by components.
Definition: math.h:239
float operator| ( const Vector v) const
throw (
)
inline

Returns the dot product of two vectors.

Definition at line 259 of file math.h.

260  { return x*v.x+y*v.y+z*v.z; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector operator& ( const Vector v) const
inline

Returns the cross product of two vectors.

Definition at line 263 of file math.h.

264  {
265  Vector vR;
266  vR.m_fX = m_fY*v.m_fZ-m_fZ*v.m_fY;
267  vR.m_fY = m_fZ*v.m_fX-m_fX*v.m_fZ;
268  vR.m_fZ = m_fX*v.m_fY-m_fY*v.m_fX;
269  return vR;
270  };
float m_fZ
Definition: math.h:339
float m_fY
Definition: math.h:339
float m_fX
Definition: math.h:339
const GLdouble * v
Definition: GLee.h:1174
Vector(void)
Constructs the vector with zero values.
Definition: math.h:39
bool operator== ( const Vector v) const
throw (
)
inline

Returns true if the two vectors are identical, false otherwise.

Definition at line 275 of file math.h.

276  { return x == v.x && y == v.y && z == v.z; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
bool operator!= ( const Vector v) const
throw (
)
inline

Returns true if the two vectors are different, false otherwise.

Definition at line 279 of file math.h.

280  { return !operator ==( v ); };
const GLdouble * v
Definition: GLee.h:1174
bool operator==(const Vector &v) const
Returns true if the two vectors are identical, false otherwise.
Definition: math.h:275
operator bool ( void  ) const
throw (
)
inline

Returns true if the vector is not a zero vector, false otherwise.

Definition at line 283 of file math.h.

283 { return x || y || z; };
float z
Definition: math.h:340
GLenum GLint GLint y
Definition: GLee.h:876
GLenum GLint x
Definition: GLee.h:876
bool operator! ( void  ) const
throw (
)
inline

Returns true if the vector is a zero vector, false otherwise.

Definition at line 286 of file math.h.

286 { return !operator bool(); };
Vector& operator= ( const Vector v)
inline

Sets this vector to equal another one and returns it.

Definition at line 289 of file math.h.

290  { x = v.x; y = v.y; z = v.z; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector& operator<< ( const Vector v)
inline

Sets this vector to equal another one and returns it.

Definition at line 293 of file math.h.

294  { x = v.x; y = v.y; z = v.z; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector& operator-= ( const Vector v)
throw (
)
inline

Subtracts the component values of another vector from this one's, and returns the result.

Definition at line 298 of file math.h.

299  { x-=v.x; y-=v.y; z-=v.z; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector& operator+= ( const Vector v)
throw (
)
inline

Adds another vector to this one and returns the result.

Definition at line 302 of file math.h.

303  { x+=v.x; y+=v.y; z+=v.z; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector& operator+= ( const float  f)
throw (
)
inline

Adds a float to all the elements of this vector and returns the result.

Definition at line 306 of file math.h.

307  { x+=f; y+=f; z+=f; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
GLclampf f
Definition: GLee.h:9303
Vector& operator-= ( const float  f)
throw (
)
inline

Subtracts a float to all the elements of this vector and returns the result.

Definition at line 310 of file math.h.

311  { x-=f; y-=f; z-=f; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
GLclampf f
Definition: GLee.h:9303
Vector& operator*= ( float  f)
throw (
)
inline

Multiplies the components of the vector with a scalar value and returns the result.

Definition at line 315 of file math.h.

315 { x *= f; y *= f; z *= f; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
GLclampf f
Definition: GLee.h:9303
Vector& operator*= ( const Vector v)
throw (
)
inline

Multiplies the vector with another vector by components and returns the result.

Definition at line 319 of file math.h.

320  { x *= v.x; y *= v.y; z *= v.z; return *this; };
GLenum GLint GLint y
Definition: GLee.h:876
GLdouble GLdouble z
Definition: GLee.h:1393
GLenum GLint x
Definition: GLee.h:876
const GLdouble * v
Definition: GLee.h:1174
Vector& operator/= ( float  f)
inline

Divides the vector by a scalar and returns the result.

Definition at line 323 of file math.h.

323 { return operator *=( 1.0f/f ); };
Vector & operator*=(float f)
Multiplies the components of the vector with a scalar value and returns the result.
Definition: math.h:315
GLclampf f
Definition: GLee.h:9303
float& operator[] ( int  i)
throw (
)
inline

Returns a individual components of the vector.

Parameters
[in]iAllowed range: 0 to 2.

Definition at line 326 of file math.h.

328  { return m_aCoors[i]; };
float m_aCoors[3]
Definition: math.h:341
float& operator[] ( unsigned int  i)
throw (
)
inline

Returns a component of the vector.

Parameters
[in]iAllowed range: 0 to 2.

Definition at line 331 of file math.h.

333  { return m_aCoors[i]; };
float m_aCoors[3]
Definition: math.h:341
operator const float * ( void  ) const
inline

Returns a pointer to the data of the vector. Do not delete this pointer.

Definition at line 336 of file math.h.

336 { return &x; };
float x
Definition: math.h:340

Member Data Documentation

float m_fX

Definition at line 339 of file math.h.

float m_fY

Definition at line 339 of file math.h.

float m_fZ

Definition at line 339 of file math.h.

float x
+ Examples:

Definition at line 340 of file math.h.

float y
+ Examples:

Definition at line 340 of file math.h.

float z
+ Examples:

Definition at line 340 of file math.h.

float m_aCoors[3]

Definition at line 341 of file math.h.

union { ... }

The documentation for this class was generated from the following file: