#include <vmath.h>
Public Member Functions | |
Vector2 () | |
Creates and sets to (0,0). | |
Vector2 (T nx, T ny) | |
Creates and sets to (x,y). | |
Vector2 (const Vector2< T > &src) | |
Copy constructor. | |
template<class FromT > | |
Vector2 (const Vector2< FromT > &src) | |
Copy casting constructor. | |
template<class FromT > | |
Vector2< T > & | operator= (const Vector2< FromT > &rhs) |
Copy casting operator. | |
Vector2< T > & | operator= (const Vector2< T > &rhs) |
Copy operator. | |
T & | operator[] (int n) |
Array access operator. | |
Vector2< T > | operator+ (const Vector2< T > &rhs) const |
Addition operator. | |
Vector2< T > | operator- (const Vector2< T > &rhs) const |
Substraction operator. | |
Vector2< T > | operator* (const Vector2< T > &rhs) const |
Multiplication operator. | |
Vector2< T > | operator/ (const Vector2< T > &rhs) const |
Division operator. | |
Vector2< T > & | operator+= (const Vector2< T > &rhs) |
Addition operator. | |
Vector2< T > & | operator-= (const Vector2< T > &rhs) |
Substraction operator. | |
Vector2< T > & | operator*= (const Vector2< T > &rhs) |
Multiplication operator. | |
Vector2< T > & | operator/= (const Vector2< T > &rhs) |
Division operator. | |
Vector2< T > | operator+ (T rhs) const |
Addition operator. | |
Vector2< T > | operator- (T rhs) const |
Substraction operator. | |
Vector2< T > | operator* (T rhs) const |
Multiplication operator. | |
Vector2< T > | operator/ (T rhs) const |
Division operator. | |
Vector2< T > & | operator+= (T rhs) |
Addition operator. | |
Vector2< T > & | operator-= (T rhs) |
Substraction operator. | |
Vector2< T > & | operator*= (T rhs) |
Multiplication operator. | |
Vector2< T > & | operator/= (T rhs) |
Division operator. | |
bool | operator== (const Vector2< T > &rhs) const |
Equality test operator. | |
bool | operator!= (const Vector2< T > &rhs) const |
Inequality test operator. | |
Vector2< T > | operator- () const |
Unary negate operator. | |
T | length () const |
Get lenght of vector. | |
void | normalize () |
Normalize vector. | |
T | lengthSq () const |
Return square of length. | |
Vector2< T > | lerp (T fact, const Vector2< T > &r) const |
Linear interpolation of two vectors. | |
operator T * () | |
Conversion to pointer operator. | |
operator const T * () const | |
Conversion to pointer operator. | |
Public Attributes | |
union { | |
T x | |
First element of vector, alias for X-coordinate. | |
T s | |
First element of vector, alias for S-coordinate. | |
}; | |
union { | |
T y | |
Second element of vector, alias for Y-coordinate. | |
T t | |
Second element of vector, alias for T-coordinate. | |
}; | |
Friends | |
std::ostream & | operator<< (std::ostream &lhs, const Vector2< T > &rhs) |
Output to stream operator. |
Creates and sets to (x,y).
nx | intial x-coordinate value | |
ny | intial y-coordinate value |
Copy constructor.
src | Source of data for new created instace. |
Vector2< T >::Vector2 | ( | const Vector2< FromT > & | src | ) | [inline] |
Copy casting constructor.
src | Source of data for new created instace. |
T Vector2< T >::length | ( | ) | const [inline] |
Get lenght of vector.
T Vector2< T >::lengthSq | ( | ) | const [inline] |
Linear interpolation of two vectors.
fact | Factor of interpolation. For translation from positon of this vector to vector r, values of factor goes from 0.0 to 1.0. | |
r | Second Vector for interpolation |
void Vector2< T >::normalize | ( | ) | [inline] |
Normalize vector.
Vector2< T >::operator const T * | ( | ) | const [inline] |
Conversion to pointer operator.
Vector2< T >::operator T * | ( | ) | [inline] |
Conversion to pointer operator.
Inequality test operator.
rhs | Right hand side argument of binary operator. |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Multiplication operator.
rhs | Right hand side argument of binary operator. |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Addition operator.
rhs | Right hand side argument of binary operator. |
Addition operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Addition operator.
rhs | Right hand side argument of binary operator. |
Addition operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Unary negate operator.
Substraction operator.
rhs | Right hand side argument of binary operator. |
Substraction operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Substraction operator.
rhs | Right hand side argument of binary operator. |
Substraction operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Division operator.
rhs | Right hand side argument of binary operator. |
Division operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Division operator.
rhs | Right hand side argument of binary operator. |
Division operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Copy operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Vector2<T>& Vector2< T >::operator= | ( | const Vector2< FromT > & | rhs | ) | [inline] |
Copy casting operator.
rhs | Right hand side argument of binary operator. |
References Vector2< T >::x, and Vector2< T >::y.
Equality test operator.
rhs | Right hand side argument of binary operator. |
References EPSILON, Vector2< T >::x, and Vector2< T >::y.
T& Vector2< T >::operator[] | ( | int | n | ) | [inline] |
Array access operator.
n | Array index |
std::ostream& operator<< | ( | std::ostream & | lhs, | |
const Vector2< T > & | rhs | |||
) | [friend] |
Output to stream operator.
lhs | Left hand side argument of operator (commonly ostream instance). | |
rhs | Right hand side argument of operator. |
union { ... } |
union { ... } |
First element of vector, alias for S-coordinate.
For textures notation.
Second element of vector, alias for T-coordinate.
For textures notation.
First element of vector, alias for X-coordinate.
Referenced by Vector2< T >::operator*(), Vector2< T >::operator*=(), Vector2< T >::operator+(), Vector2< T >::operator+=(), Vector2< T >::operator-(), Vector2< T >::operator-=(), Vector2< T >::operator/(), Vector2< T >::operator/=(), Vector2< T >::operator=(), and Vector2< T >::operator==().
Second element of vector, alias for Y-coordinate.
Referenced by Vector2< T >::operator*(), Vector2< T >::operator*=(), Vector2< T >::operator+(), Vector2< T >::operator+=(), Vector2< T >::operator-(), Vector2< T >::operator-=(), Vector2< T >::operator/(), Vector2< T >::operator/=(), Vector2< T >::operator=(), and Vector2< T >::operator==().