|
vmath
vmath-0.11
|
Class for three dimensional vector. More...
#include <vmath.h>
Collaboration diagram for Vector3< T >:Public Member Functions | |
| Vector3 () | |
| Creates and sets to (0,0,0) More... | |
| Vector3 (T nx, T ny, T nz) | |
| Creates and sets to (x,y,z) More... | |
| Vector3 (const Vector3< T > &src) | |
| Copy constructor. More... | |
| template<class FromT > | |
| Vector3 (const Vector3< FromT > &src) | |
| Copy casting constructor. More... | |
| Vector3< T > | operator= (const Vector3< T > &rhs) |
| Copy operator. More... | |
| template<class FromT > | |
| Vector3< T > | operator= (const Vector3< FromT > &rhs) |
| Copy casting operator. More... | |
| T & | operator[] (int n) |
| Array access operator. More... | |
| const T & | operator[] (int n) const |
| Constant array access operator. More... | |
| Vector3< T > | operator+ (const Vector3< T > &rhs) const |
| Addition operator. More... | |
| Vector3< T > | operator- (const Vector3< T > &rhs) const |
| Subtraction operator. More... | |
| Vector3< T > | operator* (const Vector3< T > &rhs) const |
| Multiplication operator. More... | |
| Vector3< T > | operator/ (const Vector3< T > &rhs) const |
| Division operator. More... | |
| Vector3< T > & | operator+= (const Vector3< T > &rhs) |
| Addition operator. More... | |
| Vector3< T > & | operator-= (const Vector3< T > &rhs) |
| Subtraction operator. More... | |
| Vector3< T > & | operator*= (const Vector3< T > &rhs) |
| Multiplication operator. More... | |
| Vector3< T > & | operator/= (const Vector3< T > &rhs) |
| Division operator. More... | |
| T | dotProduct (const Vector3< T > &rhs) const |
| Dot product of two vectors. More... | |
| Vector3< T > | crossProduct (const Vector3< T > &rhs) const |
| Cross product operator. More... | |
| Vector3< T > | operator+ (T rhs) const |
| Addition operator. More... | |
| Vector3< T > | operator- (T rhs) const |
| Subtraction operator. More... | |
| Vector3< T > | operator* (T rhs) const |
| Multiplication operator. More... | |
| Vector3< T > | operator/ (T rhs) const |
| Division operator. More... | |
| Vector3< T > & | operator+= (T rhs) |
| Addition operator. More... | |
| Vector3< T > & | operator-= (T rhs) |
| Subtraction operator. More... | |
| Vector3< T > & | operator*= (T rhs) |
| Multiplication operator. More... | |
| Vector3< T > & | operator/= (T rhs) |
| Division operator. More... | |
| bool | operator== (const Vector3< T > &rhs) const |
| Equality test operator. More... | |
| bool | operator!= (const Vector3< T > &rhs) const |
| Inequality test operator. More... | |
| Vector3< T > | operator- () const |
| Unary negate operator. More... | |
| T | length () const |
| Get length of vector. More... | |
| T | lengthSq () const |
| Return square of length. More... | |
| void | normalize () |
| Normalize vector. More... | |
| void | rotate (T ax, T ay, T az) |
| Rotate vector around three axis. More... | |
| Vector3< T > | lerp (T fact, const Vector3< 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... | |
| std::string | toString () const |
| Gets string representation. More... | |
Public Attributes | |
| union { | |
| T x | |
| First element of vector, alias for X-coordinate. More... | |
| T s | |
| First element of vector, alias for S-coordinate. More... | |
| T r | |
| First element of vector, alias for R-coordinate. More... | |
| }; | |
| union { | |
| T y | |
| Second element of vector, alias for Y-coordinate. More... | |
| T t | |
| Second element of vector, alias for T-coordinate. More... | |
| T g | |
| Second element of vector, alias for G-coordinate. More... | |
| }; | |
| union { | |
| T z | |
| Third element of vector, alias for Z-coordinate. More... | |
| T u | |
| Third element of vector, alias for U-coordinate. More... | |
| T b | |
| Third element of vector, alias for B-coordinate. More... | |
| }; | |
Friends | |
| std::ostream & | operator<< (std::ostream &lhs, const Vector3< T > rhs) |
| Output to stream operator. More... | |
Class for three dimensional vector.
There are four ways of accessing vector components. Let's have Vector3f v, you can either:
v.x = v.y = v.z = 1; v.s = v.t = v.u = 1; v.r = v.g = v.b = 1; v[0] = v[1] = v[2] = 1; Creates and sets to (x,y,z)
| nx | initial x-coordinate value |
| ny | initial y-coordinate value |
| nz | initial z-coordinate value |
Copy constructor.
| src | Source of data for new created Vector3 instance. |
|
inline |
Copy casting constructor.
| src | Source of data for new created Vector3 instance. |
Cross product operator.
| rhs | Right hand side argument of binary operator. |
Dot product of two vectors.
| rhs | Right hand side argument of binary operator. |
|
inline |
Get length of vector.
|
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 |
|
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. |
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. |
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 |
Constant array access operator.
| n | Array index |
|
inline |
Rotate vector around three axis.
| ax | Angle (in degrees) to be rotated around X-axis. |
| ay | Angle (in degrees) to be rotated around Y-axis. |
| az | Angle (in degrees) to be rotated around Z-axis. |
|
inline |
Gets string representation.
|
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 { ... } |
| T Vector3< T >::b |
Third element of vector, alias for B-coordinate.
For color notation.
| T Vector3< T >::g |
Second element of vector, alias for G-coordinate.
For color notation.
| T Vector3< T >::r |
First element of vector, alias for R-coordinate.
For color notation.
| T Vector3< T >::s |
First element of vector, alias for S-coordinate.
For textures notation.
| T Vector3< T >::t |
Second element of vector, alias for T-coordinate.
For textures notation.
| T Vector3< T >::u |
Third element of vector, alias for U-coordinate.
For textures notation.
| T Vector3< T >::x |
First element of vector, alias for X-coordinate.
| T Vector3< T >::y |
Second element of vector, alias for Y-coordinate.
| T Vector3< T >::z |
Third element of vector, alias for Z-coordinate.