3 Component Vector. More...
#include <decVector.h>
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. | |
| decVector & | operator= (const decVector &v) |
| Sets the components of this vector to the values of another one. | |
| decVector & | operator+= (const decVector &v) |
| Adds the components of another vector to this one. | |
| decVector & | operator-= (const decVector &v) |
| Subtracts the components of another vector from this vector. | |
| decVector & | operator*= (float k) |
| Multiplies the components of this vector with a value k. | |
| decVector & | operator/= (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. | |
3 Component Vector.
| decVector::decVector | ( | ) | [inline] |
Creates a new vector initialized to ( 0,0,0 ).
Referenced by operator%(), operator*(), operator+(), operator-(), and operator/().
| decVector::decVector | ( | float | nx, |
| float | ny, | ||
| float | nz | ||
| ) | [inline] |
| decVector::decVector | ( | const decVector & | v ) | [inline] |
| 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::Normalize | ( | ) |
Normalizes the vector.
If the length of the vector is 0 an exception is thrown.
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] |
| decVector& decVector::operator*= | ( | float | k ) | [inline] |
Retrieves a new vector with the sum of this vector with another one.
References decVector(), x, y, and z.
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/ | ( | 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] |
| bool decVector::operator< | ( | const decVector & | v ) | const [inline] |
| bool decVector::operator<= | ( | const decVector & | v ) | const [inline] |
| bool decVector::operator> | ( | const decVector & | v ) | const [inline] |
| bool decVector::operator>= | ( | const decVector & | v ) | const [inline] |
| void decVector::Set | ( | const decVector & | v ) | [inline] |
| void decVector::Set | ( | float | nx, |
| float | ny, | ||
| float | nz | ||
| ) | [inline] |
| 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.
Referenced by decDVector::decDVector(), decVector(), Negate(), operator%(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator<=(), operator=(), operator>(), operator>=(), Set(), decDVector::Set(), and SetZero().
| float decVector::y |
Y Component of vector.
Referenced by decDVector::decDVector(), decVector(), Negate(), operator%(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator<=(), operator=(), operator>(), operator>=(), Set(), decDVector::Set(), and SetZero().
| float decVector::z |
Z Component of vector.
Referenced by decDVector::decDVector(), decVector(), Negate(), operator%(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator<=(), operator=(), operator>(), operator>=(), Set(), decDVector::Set(), and SetZero().
1.7.2