|
vmath
vmath-0.11
|
Class for four dimensional vector. More...
#include <vmath.h>
Collaboration diagram for Vector4< T >:Public Member Functions | |
| Vector4 () | |
| Creates and sets to (0,0,0,0) More... | |
| Vector4 (T nx, T ny, T nz, T nw) | |
| Creates and sets to (x,y,z,z) More... | |
| Vector4 (const Vector4< T > &src) | |
| Copy constructor. More... | |
| template<class FromT > | |
| Vector4 (const Vector4< FromT > &src) | |
| Copy casting constructor. More... | |
| Vector4 (const Vector3< T > &src, T w) | |
| template<typename FromT > | |
| Vector4 (const Vector3< FromT > &src, FromT w) | |
| Vector4< T > | operator= (const Vector4< T > &rhs) |
| Copy operator. More... | |
| template<class FromT > | |
| Vector4< T > | operator= (const Vector4< FromT > &rhs) |
| Copy casting operator. More... | |
| T & | operator[] (int n) |
| Array access operator. More... | |
| const T & | operator[] (int n) const |
| Array access operator. More... | |
| Vector4< T > | operator+ (const Vector4< T > &rhs) const |
| Addition operator. More... | |
| Vector4< T > | operator- (const Vector4< T > &rhs) const |
| Subtraction operator. More... | |
| Vector4< T > | operator* (const Vector4< T > rhs) const |
| Multiplication operator. More... | |
| Vector4< T > | operator/ (const Vector4< T > &rhs) const |
| Division operator. More... | |
| Vector4< T > & | operator+= (const Vector4< T > &rhs) |
| Addition operator. More... | |
| Vector4< T > & | operator-= (const Vector4< T > &rhs) |
| Subtraction operator. More... | |
| Vector4< T > & | operator*= (const Vector4< T > &rhs) |
| Multiplication operator. More... | |
| Vector4< T > & | operator/= (const Vector4< T > &rhs) |
| Division operator. More... | |
| bool | operator== (const Vector4< T > &rhs) const |
| Equality test operator. More... | |
| bool | operator!= (const Vector4< T > &rhs) const |
| Inequality test operator. More... | |
| Vector4< T > | operator- () const |
| Unary negate operator. More... | |
| Vector4< T > | operator+ (T rhs) const |
| Addition operator. More... | |
| Vector4< T > | operator- (T rhs) const |
| Subtraction operator. More... | |
| Vector4< T > | operator* (T rhs) const |
| Multiplication operator. More... | |
| Vector4< T > | operator/ (T rhs) const |
| Division operator. More... | |
| Vector4< T > & | operator+= (T rhs) |
| Addition operator. More... | |
| Vector4< T > & | operator-= (T rhs) |
| Subtraction operator. More... | |
| Vector4< T > & | operator*= (T rhs) |
| Multiplication operator. More... | |
| Vector4< T > & | operator/= (T rhs) |
| Division operator. More... | |
| T | length () const |
| Get length of vector. More... | |
| void | normalize () |
| Normalize vector. More... | |
| T | lengthSq () const |
| Return square of length. More... | |
| Vector4< T > | lerp (T fact, const Vector4< T > &r) const |
| Linear interpolation of two vectors. More... | |
| operator T* () | |
| Conversion to pointer operator. More... | |
| operator const T * () const | |
| Conversion to pointer operator. More... | |
| Vector3< T > | xyz () const |
| Gets 3D vector. More... | |
| std::string | toString () const |
| Gets string representation. More... | |
Public Attributes | |
| union { | |
| T r | |
| First element of vector, alias for R-coordinate. More... | |
| T x | |
| }; | |
| union { | |
| T g | |
| Second element of vector, alias for G-coordinate. More... | |
| T y | |
| Second element of vector, alias for Y-coordinate. More... | |
| }; | |
| union { | |
| T b | |
| Third element of vector, alias for B-coordinate. More... | |
| T z | |
| Third element of vector, alias for Z-coordinate. More... | |
| }; | |
| union { | |
| T a | |
| Fourth element of vector, alias for A-coordinate. More... | |
| T w | |
| First element of vector, alias for W-coordinate. More... | |
| }; | |
Friends | |
| std::ostream & | operator<< (std::ostream &lhs, const Vector4< T > &rhs) |
| Output to stream operator. More... | |
Class for four dimensional vector.
There are four ways of accessing vector components. Let's have Vector4f v, you can either:
v.x = v.y = v.z = v.w = 1; v.s = v.t = v.u = v.v = 1; v.r = v.g = v.b = v.a = 1; v[0] = v[1] = v[2] = v[3] = 1; Creates and sets to (x,y,z,z)
| nx | initial x-coordinate value (R) |
| ny | initial y-coordinate value (G) |
| nz | initial z-coordinate value (B) |
| nw | initial w-coordinate value (Alpha) |
Copy constructor.
| src | Source of data for new created Vector4 instance. |
|
inline |
Copy casting constructor.
| src | Source of data for new created Vector4 instance. |
|
inline |
|
inline |
Get length of vector.
|
inline |
Linear interpolation of two vectors.
| fact | Factor of interpolation. For translation from position of this vector to vector r, values of factor goes from 0.0 to 1.0. |
| r | Second Vector for interpolation |
|
inline |
Normalize vector.
|
inline |
Conversion to pointer operator.
|
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. |
Multiplication operator.
| rhs | Right hand side argument of binary operator. |
Multiplication operator.
| rhs | Right hand side argument of binary operator. |
Addition operator.
| rhs | Right hand side argument of binary operator. |
Addition operator.
| rhs | Right hand side argument of binary operator. |
Addition operator.
| rhs | Right hand side argument of binary operator. |
Addition operator.
| rhs | Right hand side argument of binary operator. |
Subtraction operator.
| rhs | Right hand side argument of binary operator. |
Unary negate operator.
Subtraction operator.
| rhs | Right hand side argument of binary operator. |
Subtraction operator.
| rhs | Right hand side argument of binary operator. |
Subtraction operator.
| rhs | Right hand side argument of binary operator. |
Division operator.
| rhs | Right hand side argument of binary operator. |
Division operator.
| rhs | Right hand side argument of binary operator. |
Division operator.
| rhs | Right hand side argument of binary operator. |
Division operator.
| rhs | Right hand side argument of binary operator. |
Copy operator.
| rhs | Right hand side argument of binary operator. |
|
inline |
Copy casting operator.
| rhs | Right hand side argument of binary operator. |
Equality test operator.
| rhs | Right hand side argument of binary operator. |
|
inline |
Array access operator.
| n | Array index |
|
inline |
Array access operator.
| n | Array index |
|
inline |
Gets string representation.
Gets 3D vector.
Note that the output is divided by w coordinate to apply projection transform. If the w coordinate is equal to zero, the result is not divided.
|
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 { ... } |
| T Vector4< T >::a |
Fourth element of vector, alias for A-coordinate.
For color notation. This represnt aplha chanell
| T Vector4< T >::b |
Third element of vector, alias for B-coordinate.
For color notation.
| T Vector4< T >::g |
Second element of vector, alias for G-coordinate.
For color notation.
| T Vector4< T >::r |
First element of vector, alias for R-coordinate.
For color notation. First element of vector, alias for X-coordinate.
| T Vector4< T >::w |
First element of vector, alias for W-coordinate.
| T Vector4< T >::x |
| T Vector4< T >::y |
Second element of vector, alias for Y-coordinate.
| T Vector4< T >::z |
Third element of vector, alias for Z-coordinate.