#include <vector2.h>
Collaboration diagram for NUM::Vector2< T >:
Public Types | |
enum | { X = 0, Y = 1 } |
Public Member Functions | |
Vector2 () | |
Default constructor does not initialize the variables. | |
Vector2 (T x, T y) | |
Construct 2dim vector with specified entries. | |
Vector2 (const Vector2 &a) | |
Copy-constructor as usual. | |
Vector2 (const T *a) | |
Construct a vector using passed elements a[0..1] (from array). | |
~Vector2 () | |
T & | operator[] (int i) |
const T & | operator[] (int i) const |
operator T * () | |
Get internally used array of elements. Use with care. | |
operator const T * () const | |
int | dim () const |
Get dimension of vector. This is always 2. | |
Vector2 & | operator= (const Vector2 &a) |
Assignment operator: Copy passed vector. | |
Vector2 & | promote (T a) |
"Promote" a value, i.e. set all elements of the vector to a. | |
T | len2 () const |
Get the squared length (Euclidic norm) of the vector. | |
T | len () const |
Get the length of the vector (Euclidic norm). | |
T | norm1 () const |
Get the 1-norm of the vector, i.e. |x|+|y|+|z|,. | |
T | max () const |
Get the largest element of the vector. | |
T | min () const |
Get the smallest element of the vector. | |
Vector2 & | operator+= (const Vector2 &a) |
Add a vector to this one:. | |
Vector2 & | operator-= (const Vector2 &a) |
Subtract a vector from this one:. | |
Vector2 & | AddScaled (const Vector2 &a, T f) |
Add a*f to *this. | |
Vector2 & | operator *= (T a) |
Multiply vector with sclar value:. | |
Vector2 & | operator/= (T a) |
T | normalize () |
Bring the vector to length 1; returns previous length. | |
T | normalize (T wl) |
Bring the vector to specified length l; returns previous length. | |
Vector2 & | neg () |
Change the sign of every element:. | |
bool | IsNull (T epsilon) const |
Static Public Attributes | |
const Vector2< T > | UX |
Unity vectors in x and y direction as well as the 0 vector:. | |
const Vector2< T > | UY |
Unity vectors in x and y direction as well as the 0 vector:. | |
const Vector2< T > | Null |
Unity vectors in x and y direction as well as the 0 vector:. | |
Private Attributes | |
T | v [2] |
Internally stores the vector. |
Definition at line 49 of file vector2.h.
|
These are just array indices which may come handy if one wants to make code more readable. |
|
Default constructor does not initialize the variables.
|
|
Construct 2dim vector with specified entries.
Definition at line 67 of file vector2.h. References NUM::Vector2< T >::v, and NUM::y. |
|
Copy-constructor as usual.
Definition at line 70 of file vector2.h. References NUM::Vector2< T >::v. |
|
Construct a vector using passed elements a[0..1] (from array).
Definition at line 73 of file vector2.h. References NUM::Vector2< T >::v. |
|
|
|
Add a*f to *this.
Definition at line 124 of file vector2.h. References NUM::Vector2< T >::v. |
|
Get dimension of vector. This is always 2.
|
|
Compare vector against 0 with specified epsilon value:
Definition at line 148 of file vector2.h. References NUM::fabs(), and NUM::Vector2< T >::v. |
|
Get the length of the vector (Euclidic norm).
Definition at line 102 of file vector2.h. References NUM::Vector2< T >::v. Referenced by NUM::normalize(), and NUM::Vector2< T >::normalize(). |
|
Get the squared length (Euclidic norm) of the vector.
Definition at line 99 of file vector2.h. References NUM::Vector2< T >::v. Referenced by NUM::angle(). |
|
Get the largest element of the vector.
Definition at line 110 of file vector2.h. References NUM::Vector2< T >::v. |
|
Get the smallest element of the vector.
Definition at line 113 of file vector2.h. References NUM::Vector2< T >::v. |
|
Change the sign of every element:.
Definition at line 143 of file vector2.h. References NUM::Vector2< T >::v. |
|
Get the 1-norm of the vector, i.e. |x|+|y|+|z|,.
Definition at line 106 of file vector2.h. References NUM::fabs(), and NUM::Vector2< T >::v. |
|
Bring the vector to specified length l; returns previous length.
Definition at line 139 of file vector2.h. References NUM::Vector2< T >::len(), and NUM::Vector2< T >::v. |
|
Bring the vector to length 1; returns previous length.
Definition at line 136 of file vector2.h. References NUM::Vector2< T >::len(), and NUM::Vector2< T >::v. |
|
Multiply vector with sclar value:.
Definition at line 128 of file vector2.h. References NUM::Vector2< T >::v. |
|
Definition at line 84 of file vector2.h. References NUM::Vector2< T >::v. |
|
Get internally used array of elements. Use with care.
Definition at line 83 of file vector2.h. References NUM::Vector2< T >::v. |
|
Add a vector to this one:.
Definition at line 117 of file vector2.h. References NUM::Vector2< T >::v. |
|
Subtract a vector from this one:.
Definition at line 120 of file vector2.h. References NUM::Vector2< T >::v. |
|
Divide vector by scalar value. For speed reasons, you should better multiply with 1/a. Definition at line 132 of file vector2.h. References NUM::Vector2< T >::v. |
|
Assignment operator: Copy passed vector.
Definition at line 91 of file vector2.h. References NUM::Vector2< T >::v. |
|
Definition at line 80 of file vector2.h. References NUM::Vector2< T >::v. |
|
Access to the vector members. Indices 0,1 or X,Y. No range check. Definition at line 79 of file vector2.h. References NUM::Vector2< T >::v. |
|
"Promote" a value, i.e. set all elements of the vector to a.
Definition at line 95 of file vector2.h. References NUM::Vector2< T >::v. |
|
Unity vectors in x and y direction as well as the 0 vector:.
|
|
Unity vectors in x and y direction as well as the 0 vector:.
|
|
Unity vectors in x and y direction as well as the 0 vector:.
|
|