Drag[en]gine Game Engine
1.21
|
3 Component Vector. More...
#include <decVector.h>
Public Member Functions | |
Constructors and Destructors | |
decVector () | |
Create new vector initialized to ( 0,0,0 ). More... | |
decVector (float nx, float ny, float nz) | |
Create new vector with the given values. More... | |
decVector (const decVector &v) | |
Create copy of a vector. More... | |
decVector (const decDVector &v) | |
Create copy of a double vector. More... | |
decVector (const decPoint3 &p) | |
Create copy of a double vector. More... | |
Management | |
float | Length () const |
Length of the vector. More... | |
float | 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 decVector | Normalized () const |
Retrieves normalized vector. If the length of the vector is 0 an exception is thrown. More... | |
const decVector | Absolute () const |
Retrieves absolute vector. More... | |
void | Snap (float grid) |
Snaps the components of the vector to a grid with the given size. More... | |
bool | IsEqualTo (const decVector &v, float threshold=VECTOR_THRESHOLD) const |
Components of this vector are equal to another one with respect to a threshold. More... | |
bool | IsZero (float threshold=VECTOR_THRESHOLD) const |
All components are equal to zero with respect to a threshold. More... | |
void | SetZero () |
Sets all components to 0. More... | |
void | Set (float nx, float ny, float nz) |
Set components to the given values. More... | |
void | Set (const decVector &v) |
Set components to the given vector. More... | |
void | Negate () |
Negates the vector. More... | |
void | SetSmallest (const decVector &v) |
Set each component to the smallest value of this vector and another vector. More... | |
decVector | Smallest (const decVector &v) const |
Retrieve vector with each component set to the smallest value of this vector and another vector. More... | |
void | SetLargest (const decVector &v) |
Set each component to the largest value of this vector and another vector. More... | |
decVector | Largest (const decVector &v) const |
Retrieve vector with each component set to the largest value of this vector and another vector. More... | |
void | SetClamped (const decVector &minValue, const decVector &maxValue) |
Clamp each component to the provided range. More... | |
decVector | Clamped (const decVector &minValue, const decVector &maxValue) const |
Retrieves vector with each component clamped to the provided range. More... | |
decPoint3 | Round () const |
Convert to point rounding to the nearest integer value. More... | |
decVector | Mix (const decVector &vector, float blendFactor) const |
Mix vectors component wise. More... | |
decVector | Multiply (const decVector &vector) const |
Multiply component wise. More... | |
Operators | |
decVector | operator- () const |
Negation of this vector. More... | |
decVector & | operator= (const decVector &v) |
Set components of this vector to the values of another one. More... | |
decVector & | operator+= (const decVector &v) |
Adds the components of another vector to this one. More... | |
decVector & | operator-= (const decVector &v) |
Subtracts the components of another vector from this vector. More... | |
decVector & | operator*= (float k) |
Multiplies the components of this vector with a value k. More... | |
decVector & | operator/= (float k) |
Divides the components of this vector by a value k. If the value k is 0 an exception is thrown. More... | |
decVector | operator+ (const decVector &v) const |
Retrieves a new vector with the sum of this vector with another one. More... | |
decVector | operator- (const decVector &v) const |
Retrieves a new vector with the difference of this vector to another one. More... | |
decVector | operator* (float k) const |
Retrieves a new vector with this vector scaled by k. More... | |
float | operator* (const decVector &v) const |
Calculates the dot product of this vector with another one. More... | |
decVector | operator/ (float k) const |
Retrieves a new vector with this vector divided by k. If k is 0 an exception is thrown. More... | |
decVector | operator% (const decVector &v) const |
Retrieves a new vector with the cross product of this vector with another one. More... | |
bool | operator< (const decVector &v) const |
Determines if all the components of this vector are less then the components of another one. More... | |
bool | operator> (const decVector &v) const |
Determines if all the components of this vector are greater then the components of another one. More... | |
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. More... | |
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. More... | |
Public Attributes | |
float | x |
X Component of vector. More... | |
float | y |
Y Component of vector. More... | |
float | z |
Z Component of vector. More... | |
3 Component Vector.
decVector::decVector | ( | ) |
Create new vector initialized to ( 0,0,0 ).
decVector::decVector | ( | float | nx, |
float | ny, | ||
float | nz | ||
) |
Create new vector with the given values.
decVector::decVector | ( | const decVector & | v | ) |
Create copy of a vector.
decVector::decVector | ( | const decDVector & | v | ) |
Create copy of a double vector.
decVector::decVector | ( | const decPoint3 & | p | ) |
Create copy of a double vector.
const decVector decVector::Absolute | ( | ) | const |
Retrieves absolute vector.
Retrieves vector with each component clamped to the provided range.
bool decVector::IsEqualTo | ( | const decVector & | v, |
float | threshold = VECTOR_THRESHOLD |
||
) | const |
Components of this vector are equal to another one with respect to a threshold.
bool decVector::IsZero | ( | float | threshold = VECTOR_THRESHOLD | ) | const |
All components are equal to zero with respect to a threshold.
Retrieve vector with each component set to the largest value of this vector and another vector.
float decVector::Length | ( | ) | const |
Length of the vector.
float decVector::LengthSquared | ( | ) | const |
Squared length of the vector.
Mix vectors component wise.
void decVector::Negate | ( | ) |
Negates the vector.
void decVector::Normalize | ( | ) |
Normalizes the vector. If the length of the vector is 0 an exception is thrown.
const decVector decVector::Normalized | ( | ) | const |
Retrieves normalized vector. If the length of the vector is 0 an exception is thrown.
Retrieves a new vector with the cross product 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.
float decVector::operator* | ( | const decVector & | v | ) | const |
Calculates the dot product of this vector with another one.
decVector decVector::operator* | ( | float | k | ) | const |
Retrieves a new vector with this vector scaled by k.
decVector& decVector::operator*= | ( | float | k | ) |
Multiplies the components of this vector with a value k.
Retrieves a new vector with the sum of this vector with another one.
Adds the components of another vector to this one.
decVector decVector::operator- | ( | ) | const |
Negation of this vector.
Retrieves a new vector with the difference of this vector to another one.
Subtracts the components of another vector from this vector.
decVector decVector::operator/ | ( | float | k | ) | const |
Retrieves a new vector with this vector divided by k. If k is 0 an exception is thrown.
decVector& decVector::operator/= | ( | float | k | ) |
Divides the components of this vector by a value k. If the value k is 0 an exception is thrown.
bool decVector::operator< | ( | const decVector & | v | ) | const |
Determines if all the components of this vector are less then the components of another one.
bool decVector::operator<= | ( | const decVector & | v | ) | const |
Determines if all the components of this vector are less then or equal to the components of another one.
Set components of this vector to the values of another one.
bool decVector::operator> | ( | const decVector & | v | ) | const |
Determines if all the components of this vector are greater then the components of another one.
bool decVector::operator>= | ( | const decVector & | v | ) | const |
Determines if all the components of this vector are greater then or equal to the components of another one.
decPoint3 decVector::Round | ( | ) | const |
Convert to point rounding to the nearest integer value.
void decVector::Set | ( | const decVector & | v | ) |
Set components to the given vector.
void decVector::Set | ( | float | nx, |
float | ny, | ||
float | nz | ||
) |
Set components to the given values.
Clamp each component to the provided range.
void decVector::SetLargest | ( | const decVector & | v | ) |
Set each component to the largest value of this vector and another vector.
void decVector::SetSmallest | ( | const decVector & | v | ) |
Set each component to the smallest value of this vector and another vector.
void decVector::SetZero | ( | ) |
Sets all components to 0.
Retrieve vector with each component set to the smallest value of this vector and another vector.
void decVector::Snap | ( | float | grid | ) |
Snaps the components of the vector to a grid with the given size.
float decVector::x |
X Component of vector.
float decVector::y |
Y Component of vector.
float decVector::z |
Z Component of vector.