Public Attributes

decVector Class Reference

3 Component Vector. More...

#include <decVector.h>

List of all members.

Public Member Functions

Constructors and Destructors
 decVector ()
 Creates a new vector initialized to ( 0,0,0 ).
 decVector (float nx, float ny, float nz)
 Creates a new vector with the given values.
 decVector (const decVector &v)
 Creates a new vector with the values of another vector.
Management
float Length () const
 Retrieves the length of the vector.
void Normalize ()
 Normalizes the vector.
void Snap (float grid)
 Snaps the components of the vector to a grid with the given size.
bool IsEqualTo (const decVector &v, float threshold=0.0001) const
 Determines if the components of this vector are equal to another one with respect to a threshold.
void SetZero ()
 Sets all components to 0.
void Set (float nx, float ny, float nz)
 Sets the components to the given values.
void Set (const decVector &v)
 Sets the components to the given vector.
void Negate ()
 Negates the vector.
Operators
decVector operator- () const
 Retrieves the negation of this vector.
decVectoroperator= (const decVector &v)
 Sets the components of this vector to the values of another one.
decVectoroperator+= (const decVector &v)
 Adds the components of another vector to this one.
decVectoroperator-= (const decVector &v)
 Subtracts the components of another vector from this vector.
decVectoroperator*= (float k)
 Multiplies the components of this vector with a value k.
decVectoroperator/= (float k)
 Divides the components of this vector by a value k.
decVector operator+ (const decVector &v) const
 Retrieves a new vector with the sum of this vector with another one.
decVector operator- (const decVector &v) const
 Retrieves a new vector with the difference of this vector to another one.
decVector operator* (float k) const
 Retrieves a new vector with this vector scaled by k.
float operator* (const decVector &v) const
 Calculates the dot product of this vector with another one.
decVector operator/ (float k) const
 Retrieves a new vector with this vector divided by k.
decVector operator% (const decVector &v) const
 Retrieves a new vector with the cross producr of this vector with another one.
bool operator< (const decVector &v) const
 Determines if all the components of this vector are less then the components of another one.
bool operator> (const decVector &v) const
 Determines if all the components of this vector are greater then the components of another one.
bool operator<= (const decVector &v) const
 Determines if all the components of this vector are less then or equal to the components of another one.
bool operator>= (const decVector &v) const
 Determines if all the components of this vector are greater then or equal to the components of another one.

Public Attributes

float x
 X Component of vector.
float y
 Y Component of vector.
float z
 Z Component of vector.

Detailed Description

3 Component Vector.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

decVector::decVector (  ) [inline]

Creates a new vector initialized to ( 0,0,0 ).

References x, y, and z.

Referenced by operator%(), operator*(), operator+(), operator-(), and operator/().

decVector::decVector ( float  nx,
float  ny,
float  nz 
) [inline]

Creates a new vector with the given values.

References x, y, and z.

decVector::decVector ( const decVector v ) [inline]

Creates a new vector with the values of another vector.

References x, y, and z.


Member Function Documentation

bool decVector::IsEqualTo ( const decVector v,
float  threshold = 0.0001 
) const

Determines if the components of this vector are equal to another one with respect to a threshold.

float decVector::Length (  ) const

Retrieves the length of the vector.

void decVector::Negate (  ) [inline]

Negates the vector.

References x, y, and z.

void decVector::Normalize (  )

Normalizes the vector.

If the length of the vector is 0 an exception is thrown.

decVector decVector::operator% ( const decVector v ) const [inline]

Retrieves a new vector with the cross producr of this vector with another one.

References decVector(), x, y, and z.

decVector decVector::operator* ( float  k ) const [inline]

Retrieves a new vector with this vector scaled by k.

References decVector(), x, y, and z.

float decVector::operator* ( const decVector v ) const [inline]

Calculates the dot product of this vector with another one.

References x, y, and z.

decVector& decVector::operator*= ( float  k ) [inline]

Multiplies the components of this vector with a value k.

References x, y, and z.

decVector decVector::operator+ ( const decVector v ) const [inline]

Retrieves a new vector with the sum of this vector with another one.

References decVector(), x, y, and z.

decVector& decVector::operator+= ( const decVector v ) [inline]

Adds the components of another vector to this one.

References x, y, and z.

decVector decVector::operator- ( const decVector v ) const [inline]

Retrieves a new vector with the difference of this vector to another one.

References decVector(), x, y, and z.

decVector decVector::operator- (  ) const [inline]

Retrieves the negation of this vector.

References decVector(), x, y, and z.

decVector& decVector::operator-= ( const decVector v ) [inline]

Subtracts the components of another vector from this vector.

References x, y, and z.

decVector decVector::operator/ ( float  k ) const [inline]

Retrieves a new vector with this vector divided by k.

If k is 0 an exception is thrown.

References decVector(), THROW, x, y, and z.

decVector& decVector::operator/= ( float  k ) [inline]

Divides the components of this vector by a value k.

If the value k is 0 an exception is thrown.

References THROW, x, y, and z.

bool decVector::operator< ( const decVector v ) const [inline]

Determines if all the components of this vector are less then the components of another one.

References x, y, and z.

bool decVector::operator<= ( const decVector v ) const [inline]

Determines if all the components of this vector are less then or equal to the components of another one.

References x, y, and z.

decVector& decVector::operator= ( const decVector v ) [inline]

Sets the components of this vector to the values of another one.

References x, y, and z.

bool decVector::operator> ( const decVector v ) const [inline]

Determines if all the components of this vector are greater then the components of another one.

References x, y, and z.

bool decVector::operator>= ( const decVector v ) const [inline]

Determines if all the components of this vector are greater then or equal to the components of another one.

References x, y, and z.

void decVector::Set ( const decVector v ) [inline]

Sets the components to the given vector.

References x, y, and z.

void decVector::Set ( float  nx,
float  ny,
float  nz 
) [inline]

Sets the components to the given values.

References x, y, and z.

void decVector::SetZero (  ) [inline]

Sets all components to 0.

References x, y, and z.

void decVector::Snap ( float  grid )

Snaps the components of the vector to a grid with the given size.


Member Data Documentation

float decVector::x
float decVector::y
float decVector::z

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