Drag[en]gine Game Engine  1.0
decDVector Class Reference

3 Component Double precision Vector. The difference to the other vector class is just that this class uses double instead of float. More...

#include <decDVector.h>

Public Member Functions

Constructors and Destructors
 decDVector ()
 
 decDVector (double nx, double ny, double nz)
 
 decDVector (const decDVector &v)
 
 decDVector (const decVector &v)
 
 decDVector (const decPoint3 &p)
 
Management
double Length () const
 
double LengthSquared () const
 
void Normalize ()
 
const decDVector Normalized () const
 
const decDVector Absolute () const
 Retrieves absolute vector. More...
 
void Snap (double grid)
 
bool IsEqualTo (const decDVector &v, double threshold=DVECTOR_THRESHOLD) const
 
bool IsZero (double threshold=DVECTOR_THRESHOLD) const
 All components are equal to zero with respect to a threshold. More...
 
void SetZero ()
 
void Set (double nx, double ny, double nz)
 
void Set (const decDVector &v)
 
void Set (const decVector &v)
 
void Negate ()
 
void SetSmallest (const decDVector &v)
 Set each component to the smallest value of this vector and another vector. More...
 
decDVector Smallest (const decDVector &v) const
 Retrieve vector with each component set to the smallest value of this vector and another vector. More...
 
void SetLargest (const decDVector &v)
 Set each component to the largest value of this vector and another vector. More...
 
decDVector Largest (const decDVector &v) const
 Retrieve vector with each component set to the largest value of this vector and another vector. More...
 
void SetClamped (const decDVector &minValue, const decDVector &maxValue)
 Clamp each component to the provided range. More...
 
decDVector Clamped (const decDVector &minValue, const decDVector &maxValue) const
 Retrieves vector with each component clamped to the provided range. More...
 
decVector ToVector () const
 
decPoint3 Round () const
 Convert to point rounding to the nearest integer value. More...
 
Operators
decDVector operator- () const
 
decDVectoroperator= (const decDVector &v)
 
decDVectoroperator+= (const decDVector &v)
 
decDVectoroperator-= (const decDVector &v)
 
decDVectoroperator*= (double k)
 
decDVectoroperator/= (double k)
 
decDVector operator+ (const decDVector &v) const
 
decDVector operator- (const decDVector &v) const
 
decDVector operator* (double k) const
 
double operator* (const decDVector &v) const
 
decDVector operator/ (double k) const
 
decDVector operator% (const decDVector &v) const
 Retrieves a new vector with the cross producr of this vector with another one. More...
 
bool operator< (const decDVector &v) const
 
bool operator> (const decDVector &v) const
 
bool operator<= (const decDVector &v) const
 
bool operator>= (const decDVector &v) const
 

Public Attributes

double x
 
double y
 
double z
 

Detailed Description

3 Component Double precision Vector. The difference to the other vector class is just that this class uses double instead of float.

Author
Pl├╝ss Roland
Version
1.0
Date
2014

Constructor & Destructor Documentation

◆ decDVector() [1/5]

decDVector::decDVector ( )

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

◆ decDVector() [2/5]

decDVector::decDVector ( double  nx,
double  ny,
double  nz 
)

Creates a new vector with the given values.

◆ decDVector() [3/5]

decDVector::decDVector ( const decDVector v)

Creatses a new vector with the values of another vector.

◆ decDVector() [4/5]

decDVector::decDVector ( const decVector v)

Creatses a new vector with the values of another vector.

◆ decDVector() [5/5]

decDVector::decDVector ( const decPoint3 p)

Creatses a new vector with the values of another vector.

Member Function Documentation

◆ Absolute()

const decDVector decDVector::Absolute ( ) const

Retrieves absolute vector.

◆ Clamped()

decDVector decDVector::Clamped ( const decDVector minValue,
const decDVector maxValue 
) const

Retrieves vector with each component clamped to the provided range.

◆ IsEqualTo()

bool decDVector::IsEqualTo ( const decDVector v,
double  threshold = DVECTOR_THRESHOLD 
) const

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

◆ IsZero()

bool decDVector::IsZero ( double  threshold = DVECTOR_THRESHOLD) const

All components are equal to zero with respect to a threshold.

◆ Largest()

decDVector decDVector::Largest ( const decDVector v) const

Retrieve vector with each component set to the largest value of this vector and another vector.

◆ Length()

double decDVector::Length ( ) const

Retrieves the length of the vector.

◆ LengthSquared()

double decDVector::LengthSquared ( ) const

Retrieves the squared length of the vector.

◆ Negate()

void decDVector::Negate ( )

Negates the vector.

◆ Normalize()

void decDVector::Normalize ( )

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

◆ Normalized()

const decDVector decDVector::Normalized ( ) const

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

◆ operator%()

decDVector decDVector::operator% ( const decDVector v) const

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

The length of the result vector is len(a)*len(b)*cos(alpha). Hence the length of the result vector is only 1 if both vertices are of length 1 and orthogonal to each other.

◆ operator*() [1/2]

decDVector decDVector::operator* ( double  k) const

Retrieves a new vector with this vector scaled by k.

◆ operator*() [2/2]

double decDVector::operator* ( const decDVector v) const

Calculates the dor product of this vector with another one.

◆ operator*=()

decDVector& decDVector::operator*= ( double  k)

Multiplies the components of this vector with a value k.

◆ operator+()

decDVector decDVector::operator+ ( const decDVector v) const

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

◆ operator+=()

decDVector& decDVector::operator+= ( const decDVector v)

Adds the components of another vector to this one.

◆ operator-() [1/2]

decDVector decDVector::operator- ( ) const

Retrieves the negation of this vector.

◆ operator-() [2/2]

decDVector decDVector::operator- ( const decDVector v) const

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

◆ operator-=()

decDVector& decDVector::operator-= ( const decDVector v)

Subtracts the components of another vector from this vector.

◆ operator/()

decDVector decDVector::operator/ ( double  k) const

Retrieves a new vector with this vector divided by k. If k is 0 an exception is thrown.

◆ operator/=()

decDVector& decDVector::operator/= ( double  k)

Divides the components of this vector by a value k. If the value k is 0 an exception is thrown.

◆ operator<()

bool decDVector::operator< ( const decDVector v) const

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

◆ operator<=()

bool decDVector::operator<= ( const decDVector v) const

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

◆ operator=()

decDVector& decDVector::operator= ( const decDVector v)

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

◆ operator>()

bool decDVector::operator> ( const decDVector v) const

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

◆ operator>=()

bool decDVector::operator>= ( const decDVector v) const

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

◆ Round()

decPoint3 decDVector::Round ( ) const

Convert to point rounding to the nearest integer value.

◆ Set() [1/3]

void decDVector::Set ( double  nx,
double  ny,
double  nz 
)

Sets the components to the given values.

◆ Set() [2/3]

void decDVector::Set ( const decDVector v)

Sets the components to the given vector.

◆ Set() [3/3]

void decDVector::Set ( const decVector v)

Sets the components to the given vector.

◆ SetClamped()

void decDVector::SetClamped ( const decDVector minValue,
const decDVector maxValue 
)

Clamp each component to the provided range.

◆ SetLargest()

void decDVector::SetLargest ( const decDVector v)

Set each component to the largest value of this vector and another vector.

◆ SetSmallest()

void decDVector::SetSmallest ( const decDVector v)

Set each component to the smallest value of this vector and another vector.

◆ SetZero()

void decDVector::SetZero ( )

Sets all components to 0.

◆ Smallest()

decDVector decDVector::Smallest ( const decDVector v) const

Retrieve vector with each component set to the smallest value of this vector and another vector.

◆ Snap()

void decDVector::Snap ( double  grid)

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

◆ ToVector()

decVector decDVector::ToVector ( ) const

Concerts to a normal precision vector with possible precision loss.

Member Data Documentation

◆ x

double decDVector::x

X Component of vector.

Referenced by decDCollisionBox::ProjectExtends().

◆ y

double decDVector::y

Y Component of vector.

Referenced by decDCollisionBox::ProjectExtends().

◆ z

double decDVector::z

Z Component of vector.

Referenced by decDCollisionBox::ProjectExtends().


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