A 2D vector template. More...
#include <Math/Vector.h>
Public Member Functions | |
| Vector2 () | |
| Default constructor. Constructs the zero vector.  | |
| Vector2 (T _x, T _y) | |
| Constructs a spacific vector.   | |
| void | Set (T _x, T _y) | 
| Sets the x and y values of the vector.   | |
| T | Dot (const Vector2 &v) const | 
| Computes the dot product.   | |
| T | Length () const | 
| Computes the length of this vector.   | |
| T | SquaredLength () const | 
| Computes the squared length of this vector.   | |
| T | Angle (const Vector2 &v) const | 
| Computes the angle in radians between this vector and v.   | |
| void | Normalize () | 
| Normalizes this the vector.   | |
| const Vector2 | Reflect (const Vector2 &n) const | 
| Reflects this vector about the vector n.   | |
| const Vector2 | Refract (const Vector2 &n, T index=1.0f) const | 
| Refracts this vector about the vector n with index of refraction index.   | |
| const Vector2 | Project (const Vector2 &L) const | 
| Projects this vector onto the vector L.   | |
| const Vector2 | Perp () const | 
| Computes a vector perpendicular to this vector.   | |
| const Vector2 | operator+ (const Vector2 &v) const | 
| Overloaded vector addition operator.   | |
| const Vector2 | operator- (const Vector2 &v) const | 
| Overloaded vector subtraction operator.   | |
| Vector2< T > | operator- () const | 
| Overloaded vector negation operator.   | |
| const Vector2 | operator* (T c) const | 
| Overloaded constant multiplication operator.   | |
| const Vector2 | operator/ (T c) const | 
| Overloaded constant division operator.   | |
| T & | operator[] (int i) | 
| Overloaded array access operator.   | |
| T | operator[] (int i) const | 
| Overloaded array access operator.   | |
Public Attributes | |
| T | x | 
| The (x,y) vector data.  | |
Friends | |
| const Vector2 | operator* (T c, const Vector2 &v) | 
| Overloaded constant-vector multiplication operator.   | |
A 2D vector template.
| T | the type that x and y take. Usually float or double. | 
A 2D vector template that provides useful methods for manipulating 2D vectors.
Constructs a spacific vector.
| [in] | _x | the value x is set to. | 
| [in] | _y | the value y is set to. | 
Computes the angle in radians between this vector and v.
| [in] | v | the vector used to compute and angle between. | 
Computes the dot product.
| [in] | v | the vector to compute the dot product with. | 
 | T Vector2< T >::Length | ( | ) |  const [inline] | 
        
Computes the length of this vector.
 | void Vector2< T >::Normalize | ( | ) |  [inline] | 
        
Normalizes this the vector.
Changes x and y such that the length of this vector is 1 and the direction is preserved.
Overloaded constant multiplication operator.
| [in] | c | the constant to multiply by. | 
Overloaded vector addition operator.
| [in] | v | the vector to add. | 
Overloaded vector negation operator.
Overloaded vector subtraction operator.
| [in] | v | the vector to subtract. | 
Overloaded constant division operator.
| [in] | c | the constant to divide by. | 
| T Vector2< T >::operator[] | ( | int | i | ) |  const [inline] | 
        
Overloaded array access operator.
| [in] | i | must be either 0 for x or 1 for y | 
| T& Vector2< T >::operator[] | ( | int | i | ) |  [inline] | 
        
Overloaded array access operator.
| [in] | i | must be either 0 for x or 1 for y | 
Computes a vector perpendicular to this vector.
Projects this vector onto the vector L.
| [in] | L | the vector to project onto. | 
 Reflects this vector about the vector n.
| [in] | n | the vector that to reflect against. | 
 | const Vector2 Vector2< T >::Refract | ( | const Vector2< T > & | n, | |
| T |  index = 1.0f | |||
| ) |  const [inline] | 
        
Refracts this vector about the vector n with index of refraction index.
| [in] | n | the vector that to refract against. | 
| [in] | index | the index of refraction. | 
| void Vector2< T >::Set | ( | T | _x, | |
| T | _y | |||
| ) |  [inline] | 
        
Sets the x and y values of the vector.
| [in] | _x | the value x is set to. | 
| [in] | _y | the value y is set to. | 
| T Vector2< T >::SquaredLength | ( | ) |  const [inline] | 
        
Computes the squared length of this vector.
 Overloaded constant-vector multiplication operator.
| [in] | c | the constant. | 
| [in] | v | the vector. | 
 1.6.3