Vector2< T > Struct Template Reference

2D vector class More...

#include <Vector.h>

List of all members.

Public Member Functions

 Vector2 ()
 Construct a new Vector at position (0, 0).
 Vector2 (T x, T y)
 Construct a new Vector at position (x, y).
 Vector2 (T x)
 Construct a new Vector at position (x, x).
 Vector2 (const T p[])
 Construct a new Vector at position (p[0], p[1]).
 Vector2 (const Vector2< T > &c)
 Copy construct a new Vector.
Vector2< T > operator/ (const T &f) const
 Divide by scalar operator.
Vector2< T > operator* (const T &scale) const
 Multiply by scalar operator.
Vector2< T > operator+ (const Vector2< T > v) const
 Binary addition operator.
Vector2< T > operator- (const Vector2< T > v) const
 Binary subtraction operator.
Vector2< T > & operator+= (const Vector2< T > &v)
 Addition assignment operator.
Vector2< T > & operator-= (const Vector2< T > &v)
 Subtraction assignment operator.
Vector2< T > & operator*= (const T &scale)
 Multiplication assignment operator.
Vector2< T > & operator/= (const T &scale)
 Division assignment operator.
Vector2< T > & operator= (const Vector2< T > &v)
 Assignment to Vector2<T> operator.
Vector2< T > & operator= (const T &v)
 Assignment to scalar operator.
bool operator== (const Vector2< T > &v)
 Equality operator.
Vector2< T > rotate (const T &v)
 Rotate a vector.
bool operator< (const Vector2< T > &v) const
 Less than operator, x is given preference to y.
operator[] (int index) const
 Subscript operator.
distance (const Vector2< T > &p) const
 Distance from a point stored in this vector to some point p.
distancesq (const Vector2< T > &p) const
 Distance squared from a point stored in this vector to some point p.
dot (const Vector2< T > &v) const
 Vector dot product.
cross (const Vector2< T > &v) const
 Vector cross product.
magnitude () const
 Length of this vector.
magsq () const
 Squared length of this vector.
void flip ()
 Swap the x and y components of the vector.


Detailed Description

template<typename T>
struct Vector2< T >

2D vector class

Member Function Documentation

template<typename T>
Vector2<T> Vector2< T >::rotate ( const T &  v  )  [inline]

Rotate a vector.

Parameters:
v rotation amount in radians

template<typename T>
T Vector2< T >::operator[] ( int  index  )  const [inline]

Subscript operator.

Vector components can be accessed by index using this operator.

template<typename T>
T Vector2< T >::distance ( const Vector2< T > &  p  )  const [inline]

Distance from a point stored in this vector to some point p.

Parameters:
p point to measure to

template<typename T>
T Vector2< T >::distancesq ( const Vector2< T > &  p  )  const [inline]

Distance squared from a point stored in this vector to some point p.

Parameters:
p point to measure to

template<typename T>
T Vector2< T >::dot ( const Vector2< T > &  v  )  const [inline]

Vector dot product.

Parameters:
v vector to compute dot product with

template<typename T>
T Vector2< T >::cross ( const Vector2< T > &  v  )  const [inline]

Vector cross product.

Parameters:
v vector to compute cross product with

template<typename T>
T Vector2< T >::magnitude (  )  const [inline]

Length of this vector.

Returns:
length

template<typename T>
T Vector2< T >::magsq (  )  const [inline]

Squared length of this vector.

Returns:
squared length


The documentation for this struct was generated from the following file:

Generated on Fri Feb 22 15:56:24 2008 for Scene2D by  doxygen 1.5.5