Vector.h File Reference
Defines a 2D vector class.
More...
#include <cmath>
Classes |
class | Vector2< T > |
| A 2D vector template. More...
|
Typedefs |
typedef Vector2< float > | Vector2f |
| A Template instansiation of the Vector2 template using the float data type.
|
typedef Vector2< double > | Vector2d |
| A Template instansiation of the Vector2 template using the double data type.
|
Functions |
template<class T > |
Vector2< T > | Normalize (const Vector2< T > &v) |
| Normalizes the given vector.
|
template<class T > |
T | Dot (const Vector2< T > &v1, const Vector2< T > &v2) |
| Computes the dot product between two vectors.
|
template<class T > |
T | Length (const Vector2< T > &v) |
| Computes the length of the given vector.
|
Detailed Description
Defines a 2D vector class.
- Author:
- Joe Forte
- Date:
- 3/27/2008
Defines a 2D vector template along with the most common template instansiations.
Function Documentation
Computes the dot product between two vectors.
- Template Parameters:
-
| T | the data type of the vector. Usually float or double |
- Parameters:
-
[in] | v1 | the first vector. |
[in] | v2 | the second vector. |
- Returns:
- The dot product of v1 and v2
template<class T >
T Length |
( |
const Vector2< T > & |
v |
) |
[inline] |
Computes the length of the given vector.
- Template Parameters:
-
| T | the data type of the vector. Usually float or double |
- Parameters:
-
[in] | v | the vector to compute the length of. |
- Returns:
- The length of the vector v
Normalizes the given vector.
- Template Parameters:
-
| T | the data type of the vector. Usually float or double |
- Parameters:
-
[in] | v | the vector to normalize. |
- Returns:
- The normalized vector v.