This class represents a 2-dimensional vector. More...
#include "Vector2.hpp"
Public Member Functions | |
| Vector2T () | |
| The default constructor. It initializes all components to zero. More... | |
| Vector2T (T x_, T y_) | |
| This constructor initializes the components from x_ and y_ respectively. More... | |
| template<class C > | |
| Vector2T (const C Values[]) | |
| This constructor initializes the components from an array of (at least) two Ts. More... | |
| bool | IsValid () const |
| Returns true if the vector is valid, that is, all components are non-NANs. More... | |
| T & | operator[] (unsigned int Index) |
| Component access by index number (0 to 1) rather than by name. More... | |
| const T & | operator[] (unsigned int Index) const |
| Component access by index number (0 to 1) rather than by name. More... | |
| Vector2T< float > | AsVectorOfFloat () const |
| Gets this Vector2T<T> as a Vector2T<float>, so that the cast is explicitly visible in user code. More... | |
| Vector2T< double > | AsVectorOfDouble () const |
| Gets this Vector2T<T> as a Vector2T<double>, so that the cast is explicitly visible in user code. More... | |
Group of const inspector methods. They are all const and thus do not modify this object. | |
| T | GetLengthSqr () const |
| Returns the square of the length of this vector. More... | |
| bool | IsEqual (const Vector2T< T > &B, const T Epsilon) const |
| Returns whether this vector is equal to B within tolerance Epsilon, that is, whether it is geometrically closer to B than Epsilon. More... | |
| Vector2T< T > | GetScaled (const T s) const |
| Returns a copy of this vector scaled by s, that is, the scalar product (Skalarmultiplikation) of this vector and s. More... | |
| Vector2T< T > | GetScaled (const Vector2T< T > &S) const |
| Returns a copy of this vector non-uniformely scaled by S. More... | |
Group of (constructive) binary operators that do not modify their operands. | |
| bool | operator== (const Vector2T< T > &B) const |
| Returns whether this vector and B are truly (bit-wise) identical. More... | |
| bool | operator!= (const Vector2T< T > &B) const |
| Returns whether this vector and B are not equal (bit-wise). More... | |
| Vector2T< T > | operator+ (const Vector2T< T > &B) const |
| Returns the sum of this Vector2T<T> and B. More... | |
| Vector2T< T > | operator- (const Vector2T< T > &B) const |
| Returns the difference between this Vector2T<T> and B. More... | |
| Vector2T< T > | operator- () const |
| The unary minus operator. B=-A is quasi identical with B=A.GetScaled(-1). More... | |
| Vector2T< T > | operator* (const T s) const |
| Returns a copy of this vector scaled by s, that is, the scalar product (Skalarmultiplikation) of this vector and s. More... | |
| Vector2T< T > | operator/ (const T s) const |
| Returns a copy of this vector divided by s, that is, the scalar product (Skalarmultiplikation) of this vector and 1/s. More... | |
| T | dot (const Vector2T< T > &B) const |
| Returns the dot product (Skalarprodukt) of this vector and B. More... | |
Group of operators that modify this vector. | |
| Vector2T< T > & | operator+= (const Vector2T< T > &B) |
| Adds B to this vector. More... | |
| Vector2T< T > & | operator-= (const Vector2T< T > &B) |
| Subtracts B from this vector. More... | |
| Vector2T< T > & | operator*= (const T s) |
| Scales this vector by s. More... | |
| Vector2T< T > & | operator/= (const T s) |
| Divides this vector by s. Assumes that s is not 0. More... | |
Public Attributes | |
| T | x |
| The x-component of this vector. More... | |
| T | y |
| The y-component of this vector. More... | |
This class represents a 2-dimensional vector.
The default constructor. It initializes all components to zero.
This constructor initializes the components from x_ and y_ respectively.
This constructor initializes the components from an array of (at least) two Ts.
Gets this Vector2T<T> as a Vector2T<double>, so that the cast is explicitly visible in user code.
Gets this Vector2T<T> as a Vector2T<float>, so that the cast is explicitly visible in user code.
Returns the dot product (Skalarprodukt) of this vector and B.
|
inline |
Returns the square of the length of this vector.
Returns a copy of this vector scaled by s, that is, the scalar product (Skalarmultiplikation) of this vector and s.
| s | Scale factor to scale this vector by. |
Returns a copy of this vector non-uniformely scaled by S.
|
inline |
Returns whether this vector is equal to B within tolerance Epsilon, that is, whether it is geometrically closer to B than Epsilon.
| B | Vector to compare to. |
| Epsilon | Tolerance value. |
|
inline |
Returns true if the vector is valid, that is, all components are non-NANs.
Returns whether this vector and B are not equal (bit-wise).
Use this operator with care, as it comes without any epsilon threshold for taking rounding errors into account.
| B | Vector to compare to. |
Returns a copy of this vector scaled by s, that is, the scalar product (Skalarmultiplikation) of this vector and s.
| s | Factor to multiply this vector with. |
Scales this vector by s.
Returns the sum of this Vector2T<T> and B.
Adds B to this vector.
Returns the difference between this Vector2T<T> and B.
The unary minus operator. B=-A is quasi identical with B=A.GetScaled(-1).
Subtracts B from this vector.
Returns a copy of this vector divided by s, that is, the scalar product (Skalarmultiplikation) of this vector and 1/s.
Divides this vector by s. Assumes that s is not 0.
Returns whether this vector and B are truly (bit-wise) identical.
Use this operator with care, as it comes without any epsilon threshold for taking rounding errors into account.
| B | Vector to compare to. |
|
inline |
Component access by index number (0 to 1) rather than by name.
| Index | Index of the component to access. Can only be 0 or 1 (for x or y). |
| InvalidOperationE | if Index is not 0 or 1. |
|
inline |
Component access by index number (0 to 1) rather than by name.
| Index | Index of the component to access. Can only be 0 or 1 (for x or y). |
| InvalidOperationE | if Index is not 0 or 1. |
| T Vector2T< T >::x |
The x-component of this vector.
| T Vector2T< T >::y |
The y-component of this vector.