Drag[en]gine Game Engine  1.21
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 ()
 Create new vector initialized to ( 0,0,0 ). More...
 
 decDVector (double nx, double ny, double nz)
 Create new vector with the given values. More...
 
 decDVector (const decDVector &v)
 Creatses a new vector with the values of another vector. More...
 
 decDVector (const decVector &v)
 Creatses a new vector with the values of another vector. More...
 
 decDVector (const decPoint3 &p)
 Creatses a new vector with the values of another vector. More...
 
Management
double Length () const
 Length of the vector. More...
 
double LengthSquared () const
 Squared length of the vector. More...
 
void Normalize ()
 Normalizes the vector. If the length of the vector is 0 an exception is thrown. More...
 
const decDVector Normalized () const
 Retrieves normalized vector. If the length of the vector is 0 an exception is thrown. More...
 
const decDVector Absolute () const
 Retrieves absolute vector. More...
 
void Snap (double grid)
 Snaps the components of the vector to a grid with the given size. More...
 
bool IsEqualTo (const decDVector &v, double threshold=DVECTOR_THRESHOLD) const
 Components of this vector are equal to another one with respect to a threshold. More...
 
bool IsZero (double threshold=DVECTOR_THRESHOLD) const
 All components are equal to zero with respect to a threshold. More...
 
void SetZero ()
 Sets all components to 0. More...
 
void Set (double nx, double ny, double nz)
 Set components to the given values. More...
 
void Set (const decDVector &v)
 Set components to the given vector. More...
 
void Set (const decVector &v)
 Set components to the given vector. More...
 
void Negate ()
 Negates the vector. More...
 
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
 Concerts to a normal precision vector with possible precision loss. More...
 
decPoint3 Round () const
 Convert to point rounding to the nearest integer value. More...
 
decDVector Mix (const decDVector &vector, double blendFactor) const
 Mix vectors component wise. More...
 
decDVector Multiply (const decDVector &vector) const
 Multiply component wise. More...
 
Operators
decDVector operator- () const
 Negation of this vector. More...
 
decDVectoroperator= (const decDVector &v)
 Set components of this vector to the values of another one. More...
 
decDVectoroperator+= (const decDVector &v)
 Adds the components of another vector to this one. More...
 
decDVectoroperator-= (const decDVector &v)
 Subtracts the components of another vector from this vector. More...
 
decDVectoroperator*= (double k)
 Multiplies the components of this vector with a value k. More...
 
decDVectoroperator/= (double k)
 Divide components of this vector by a value k. More...
 
decDVector operator+ (const decDVector &v) const
 Vector with the sum of this vector with another one. More...
 
decDVector operator- (const decDVector &v) const
 Vector with the difference of this vector to another one. More...
 
decDVector operator* (double k) const
 Vector with this vector scaled by k. More...
 
double operator* (const decDVector &v) const
 Calculates the dor product of this vector with another one. More...
 
decDVector operator/ (double k) const
 Vector with this vector divided by k. More...
 
decDVector operator% (const decDVector &v) const
 Vector with the cross producr of this vector with another one. More...
 
bool operator< (const decDVector &v) const
 All components of this vector are less then the components of another one. More...
 
bool operator> (const decDVector &v) const
 All components of this vector are greater then the components of another one. More...
 
bool operator<= (const decDVector &v) const
 All components of this vector are less then or equal to the components of another one. More...
 
bool operator>= (const decDVector &v) const
 All components of this vector are greater then or equal to the components of another one. More...
 

Public Attributes

double x
 X Component of vector. More...
 
double y
 Y Component of vector. More...
 
double z
 Z Component of vector. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ decDVector() [1/5]

decDVector::decDVector ( )

Create new vector initialized to ( 0,0,0 ).

◆ decDVector() [2/5]

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

Create 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

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

Length of the vector.

◆ LengthSquared()

double decDVector::LengthSquared ( ) const

Squared length of the vector.

◆ Mix()

decDVector decDVector::Mix ( const decDVector vector,
double  blendFactor 
) const

Mix vectors component wise.

◆ Multiply()

decDVector decDVector::Multiply ( const decDVector vector) const

Multiply component wise.

◆ 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

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]

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

Calculates the dor product of this vector with another one.

◆ operator*() [2/2]

decDVector decDVector::operator* ( double  k) const

Vector with this vector scaled by k.

◆ operator*=()

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

Multiplies the components of this vector with a value k.

◆ operator+()

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

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

Negation of this vector.

◆ operator-() [2/2]

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

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

Vector with this vector divided by k.

If k is 0 an exception is thrown.

◆ operator/=()

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

Divide 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

All components of this vector are less then the components of another one.

◆ operator<=()

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

All components of this vector are less then or equal to the components of another one.

◆ operator=()

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

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

◆ operator>()

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

All components of this vector are greater then the components of another one.

◆ operator>=()

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

All 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 ( const decDVector v)

Set components to the given vector.

◆ Set() [2/3]

void decDVector::Set ( const decVector v)

Set components to the given vector.

◆ Set() [3/3]

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

Set components to the given values.

◆ 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.

◆ y

double decDVector::y

Y Component of vector.

◆ z

double decDVector::z

Z Component of vector.


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