#include <vmath.h>
Public Member Functions | |
Vector4 () | |
Creates and sets to (0,0,0,0). | |
Vector4 (T nx, T ny, T nz, T nw) | |
Creates and sets to (x,y,z,z). | |
Vector4 (const Vector4< T > &src) | |
Copy constructor. | |
template<class FromT > | |
Vector4 (const Vector4< FromT > &src) | |
Copy casting constructor. | |
Vector4< T > | operator= (const Vector4< T > &rhs) |
Copy operator. | |
template<class FromT > | |
Vector4< T > | operator= (const Vector4< FromT > &rhs) |
Copy casting operator. | |
T & | operator[] (int n) |
Array access operator. | |
Vector4< T > | operator+ (const Vector4< T > &rhs) const |
Addition operator. | |
Vector4< T > | operator- (const Vector4< T > &rhs) const |
Substraction operator. | |
Vector4< T > | operator* (const Vector4< T > rhs) const |
Multiplication operator. | |
Vector4< T > | operator/ (const Vector4< T > &rhs) const |
Division operator. | |
Vector4< T > & | operator+= (const Vector4< T > &rhs) |
Addition operator. | |
Vector4< T > & | operator-= (const Vector4< T > &rhs) |
Substraction operator. | |
Vector4< T > & | operator*= (const Vector4< T > &rhs) |
Multiplication operator. | |
Vector4< T > & | operator/= (const Vector4< T > &rhs) |
Division operator. | |
bool | operator== (const Vector4< T > &rhs) const |
Equality test operator. | |
bool | operator!= (const Vector4< T > &rhs) const |
Inequality test operator. | |
Vector4< T > | operator- () const |
Unary negate operator. | |
Vector4< T > | operator+ (T rhs) const |
Addition operator. | |
Vector4< T > | operator- (T rhs) const |
Substraction operator. | |
Vector4< T > | operator* (T rhs) const |
Multiplication operator. | |
Vector4< T > | operator/ (T rhs) const |
Division operator. | |
Vector4< T > & | operator+= (T rhs) |
Addition operator. | |
Vector4< T > & | operator-= (T rhs) |
Substraction operator. | |
Vector4< T > & | operator*= (T rhs) |
Multiplication operator. | |
Vector4< T > & | operator/= (T rhs) |
Division operator. | |
T | length () const |
Get lenght of vector. | |
void | normalize () |
Normalize vector. | |
T | lengthSq () const |
Return square of length. | |
Vector4< T > | lerp (T fact, const Vector4< 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 r | |
First element of vector, alias for R-coordinate. | |
T x | |
}; | |
union { | |
T g | |
Second element of vector, alias for G-coordinate. | |
T y | |
Second element of vector, alias for Y-coordinate. | |
}; | |
union { | |
T b | |
Third element of vector, alias for B-coordinate. | |
T z | |
Third element of vector, alias for Z-coordinate. | |
}; | |
union { | |
T a | |
Fourth element of vector, alias for A-coordinate. | |
T w | |
First element of vector, alias for W-coordinate. | |
}; | |
Friends | |
std::ostream & | operator<< (std::ostream &lhs, const Vector4< T > &rhs) |
Output to stream operator. |
Creates and sets to (x,y,z,z).
nx | intial x-coordinate value (R) | |
ny | intial y-coordinate value (G) | |
nz | intial z-coordinate value (B) | |
nw | intial w-coordinate value (Aplha) |
T Vector4< T >::length | ( | ) | const [inline] |
Get lenght of vector.
T Vector4< 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 Vector4< T >::normalize | ( | ) | [inline] |
Normalize vector.
Vector4< T >::operator const T * | ( | ) | const [inline] |
Conversion to pointer operator.
Vector4< 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 Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Multiplication operator.
rhs | Right hand side argument of binary operator. |
Multiplication operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Addition operator.
rhs | Right hand side argument of binary operator. |
Addition operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Addition operator.
rhs | Right hand side argument of binary operator. |
Addition operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Substraction operator.
rhs | Right hand side argument of binary operator. |
Unary negate operator.
Substraction operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Substraction operator.
rhs | Right hand side argument of binary operator. |
Substraction operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Division operator.
rhs | Right hand side argument of binary operator. |
Division operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Division operator.
rhs | Right hand side argument of binary operator. |
Division operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Vector4<T> Vector4< T >::operator= | ( | const Vector4< FromT > & | rhs | ) | [inline] |
Copy casting operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Copy operator.
rhs | Right hand side argument of binary operator. |
References Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
Equality test operator.
rhs | Right hand side argument of binary operator. |
References EPSILON, Vector4< T >::w, Vector4< T >::x, Vector4< T >::y, and Vector4< T >::z.
T& Vector4< T >::operator[] | ( | int | n | ) | [inline] |
Array access operator.
n | Array index |
std::ostream& operator<< | ( | std::ostream & | lhs, | |
const Vector4< 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 { ... } |
union { ... } |
union { ... } |
Fourth element of vector, alias for A-coordinate.
For color notation. This represnt aplha chanell
Third element of vector, alias for B-coordinate.
For color notation.
Second element of vector, alias for G-coordinate.
For color notation.
First element of vector, alias for R-coordinate.
For color notation. First element of vector, alias for X-coordinate.
First element of vector, alias for W-coordinate.
Referenced by Matrix4< T >::operator*(), Vector4< T >::operator*(), Vector4< T >::operator*=(), Vector4< T >::operator+(), Vector4< T >::operator+=(), Vector4< T >::operator-(), Vector4< T >::operator-=(), Vector4< T >::operator/(), Vector4< T >::operator/=(), Vector4< T >::operator=(), and Vector4< T >::operator==().
Referenced by Matrix4< T >::operator*(), Vector4< T >::operator*(), Vector4< T >::operator*=(), Vector4< T >::operator+(), Vector4< T >::operator+=(), Vector4< T >::operator-(), Vector4< T >::operator-=(), Vector4< T >::operator/(), Vector4< T >::operator/=(), Vector4< T >::operator=(), and Vector4< T >::operator==().
Second element of vector, alias for Y-coordinate.
Referenced by Matrix4< T >::operator*(), Vector4< T >::operator*(), Vector4< T >::operator*=(), Vector4< T >::operator+(), Vector4< T >::operator+=(), Vector4< T >::operator-(), Vector4< T >::operator-=(), Vector4< T >::operator/(), Vector4< T >::operator/=(), Vector4< T >::operator=(), and Vector4< T >::operator==().
Third element of vector, alias for Z-coordinate.
Referenced by Matrix4< T >::operator*(), Vector4< T >::operator*(), Vector4< T >::operator*=(), Vector4< T >::operator+(), Vector4< T >::operator+=(), Vector4< T >::operator-(), Vector4< T >::operator-=(), Vector4< T >::operator/(), Vector4< T >::operator/=(), Vector4< T >::operator=(), and Vector4< T >::operator==().