Drag[en]gine Game Engine
1.21
|
2 component vector. More...
#include <decVector2.h>
Public Member Functions | |
Constructors and Destructors | |
decVector2 () | |
Create zero vector. More... | |
decVector2 (float nx, float ny) | |
Create vector with initial values. More... | |
decVector2 (const decVector2 &v) | |
Create copy of vector. More... | |
decVector2 (const decPoint &p) | |
Create vector from point. More... | |
Management | |
float | Length () const |
Length. More... | |
void | Normalize () |
Normalize vector. More... | |
decVector2 | Normalized () const |
Normalized vector. More... | |
const decVector2 | Absolute () const |
Absolute vector. More... | |
void | Snap (float grid) |
Snaps the components of the vector to a grid with the given size. More... | |
bool | IsEqualTo (const decVector2 &v, float threshold=VECTOR_THRESHOLD) const |
Component of vector are equal to another one with respect to a threshold. More... | |
void | SetZero () |
Set all components to 0. More... | |
void | Set (float nx, float ny) |
Set components to the given values. More... | |
void | Set (const decVector2 &v) |
Set components to the given vector. More... | |
void | Negate () |
Negate vector. More... | |
void | SetSmallest (const decVector2 &v) |
Set each component to the smallest value of this vector and another vector. More... | |
decVector2 | Smallest (const decVector2 &v) const |
Vector with each component set to the smallest value of this vector and another vector. More... | |
void | SetLargest (const decVector2 &v) |
Set each component to the largest value of this vector and another vector. More... | |
decVector2 | Largest (const decVector2 &v) const |
Vector with each component set to the largest value of this vector and another vector. More... | |
void | SetClamped (const decVector2 &minValue, const decVector2 &maxValue) |
Clamp each component to the provided range. More... | |
decVector2 | Clamped (const decVector2 &minValue, const decVector2 &maxValue) const |
Vector with each component clamped to the provided range. More... | |
decVector2 | RotateLeft () const |
Rotate vector counter-clock-wise by 90 degrees. More... | |
decVector2 | RotateRight () const |
Rotate vector clock-wise by 90 degrees. More... | |
decPoint | Round () const |
Convert to point rounding to the nearest integer value. More... | |
decVector2 | Mix (const decVector2 &vector, float blendFactor) const |
Mix vectors component wise. More... | |
decVector2 | Multiply (const decVector2 &vector) const |
Multiply component wise. More... | |
Operators | |
decVector2 | operator- () const |
Negation of this vector. More... | |
decVector2 & | operator= (const decVector2 &v) |
Set components of this vector to the values of another one. More... | |
decVector2 & | operator+= (const decVector2 &v) |
Add components of another vector to this one. More... | |
decVector2 & | operator-= (const decVector2 &v) |
Subtract components of another vector from this vector. More... | |
decVector2 & | operator*= (float k) |
Multiply components of this vector with a value k. More... | |
decVector2 & | operator/= (float k) |
Divide components of this vector by a value k. More... | |
decVector2 | operator+ (const decVector2 &v) const |
Vector with the sum of this vector with another one. More... | |
decVector2 | operator- (const decVector2 &v) const |
Vector with the difference of this vector to another one. More... | |
decVector2 | operator* (float k) const |
Vector with this vector scaled by k. More... | |
float | operator* (const decVector2 &v) const |
Calculate dot product of this vector with another one. More... | |
decVector2 | operator/ (float k) const |
Vector with this vector divided by k. More... | |
bool | operator< (const decVector2 &v) const |
All the components of this vector are less then the components of another one. More... | |
bool | operator> (const decVector2 &v) const |
All the components of this vector are greater then the components of another one. More... | |
bool | operator<= (const decVector2 &v) const |
All the components of this vector are less then or equal to the components of another one. More... | |
bool | operator>= (const decVector2 &v) const |
All the components of this vector are greater then or equal to the components of another one. More... | |
Public Attributes | |
float | x |
float | y |
2 component vector.
decVector2::decVector2 | ( | ) |
Create zero vector.
decVector2::decVector2 | ( | float | nx, |
float | ny | ||
) |
Create vector with initial values.
decVector2::decVector2 | ( | const decVector2 & | v | ) |
Create copy of vector.
decVector2::decVector2 | ( | const decPoint & | p | ) |
Create vector from point.
const decVector2 decVector2::Absolute | ( | ) | const |
Absolute vector.
decVector2 decVector2::Clamped | ( | const decVector2 & | minValue, |
const decVector2 & | maxValue | ||
) | const |
Vector with each component clamped to the provided range.
bool decVector2::IsEqualTo | ( | const decVector2 & | v, |
float | threshold = VECTOR_THRESHOLD |
||
) | const |
Component of vector are equal to another one with respect to a threshold.
decVector2 decVector2::Largest | ( | const decVector2 & | v | ) | const |
Vector with each component set to the largest value of this vector and another vector.
float decVector2::Length | ( | ) | const |
Length.
decVector2 decVector2::Mix | ( | const decVector2 & | vector, |
float | blendFactor | ||
) | const |
Mix vectors component wise.
decVector2 decVector2::Multiply | ( | const decVector2 & | vector | ) | const |
Multiply component wise.
void decVector2::Negate | ( | ) |
Negate vector.
void decVector2::Normalize | ( | ) |
Normalize vector.
deeDivisionByZero | Length of vector is 0. |
decVector2 decVector2::Normalized | ( | ) | const |
Normalized vector.
deeDivisionByZero | Length of vector is 0. |
float decVector2::operator* | ( | const decVector2 & | v | ) | const |
Calculate dot product of this vector with another one.
decVector2 decVector2::operator* | ( | float | k | ) | const |
Vector with this vector scaled by k.
decVector2& decVector2::operator*= | ( | float | k | ) |
Multiply components of this vector with a value k.
decVector2 decVector2::operator+ | ( | const decVector2 & | v | ) | const |
Vector with the sum of this vector with another one.
decVector2& decVector2::operator+= | ( | const decVector2 & | v | ) |
Add components of another vector to this one.
decVector2 decVector2::operator- | ( | ) | const |
Negation of this vector.
decVector2 decVector2::operator- | ( | const decVector2 & | v | ) | const |
Vector with the difference of this vector to another one.
decVector2& decVector2::operator-= | ( | const decVector2 & | v | ) |
Subtract components of another vector from this vector.
decVector2 decVector2::operator/ | ( | float | k | ) | const |
Vector with this vector divided by k.
deeDivisionByZero | Length of vector is 0. |
decVector2& decVector2::operator/= | ( | float | k | ) |
Divide components of this vector by a value k.
deeDivisionByZero | Length of vector is 0. |
bool decVector2::operator< | ( | const decVector2 & | v | ) | const |
All the components of this vector are less then the components of another one.
bool decVector2::operator<= | ( | const decVector2 & | v | ) | const |
All the components of this vector are less then or equal to the components of another one.
decVector2& decVector2::operator= | ( | const decVector2 & | v | ) |
Set components of this vector to the values of another one.
bool decVector2::operator> | ( | const decVector2 & | v | ) | const |
All the components of this vector are greater then the components of another one.
bool decVector2::operator>= | ( | const decVector2 & | v | ) | const |
All the components of this vector are greater then or equal to the components of another one.
decVector2 decVector2::RotateLeft | ( | ) | const |
Rotate vector counter-clock-wise by 90 degrees.
decVector2 decVector2::RotateRight | ( | ) | const |
Rotate vector clock-wise by 90 degrees.
decPoint decVector2::Round | ( | ) | const |
Convert to point rounding to the nearest integer value.
void decVector2::Set | ( | const decVector2 & | v | ) |
Set components to the given vector.
void decVector2::Set | ( | float | nx, |
float | ny | ||
) |
Set components to the given values.
void decVector2::SetClamped | ( | const decVector2 & | minValue, |
const decVector2 & | maxValue | ||
) |
Clamp each component to the provided range.
void decVector2::SetLargest | ( | const decVector2 & | v | ) |
Set each component to the largest value of this vector and another vector.
void decVector2::SetSmallest | ( | const decVector2 & | v | ) |
Set each component to the smallest value of this vector and another vector.
void decVector2::SetZero | ( | ) |
Set all components to 0.
decVector2 decVector2::Smallest | ( | const decVector2 & | v | ) | const |
Vector with each component set to the smallest value of this vector and another vector.
void decVector2::Snap | ( | float | grid | ) |
Snaps the components of the vector to a grid with the given size.
float decVector2::x |
float decVector2::y |