Vector2< T > Class Template Reference

#include <vmath.h>

List of all members.

Public Member Functions

 Vector2 ()
 Vector2 (T nx, T ny)
Vector2< T > & operator= (const Vector2< T > &rhs)
T & operator[] (int n)
Vector2< T > operator+ (const Vector2< T > &rhs) const
Vector2< T > operator- (const Vector2< T > &rhs) const
Vector2< T > operator * (const Vector2< T > &rhs) const
Vector2< T > operator/ (const Vector2< T > &rhs) const
Vector2< T > & operator+= (const Vector2< T > &rhs)
Vector2< T > & operator-= (const Vector2< T > &rhs)
Vector2< T > & operator *= (const Vector2< T > &rhs)
Vector2< T > & operator/= (const Vector2< T > &rhs)
Vector2< T > operator+ (T rhs) const
Vector2< T > operator- (T rhs) const
Vector2< T > operator * (T rhs) const
Vector2< T > operator/ (T rhs) const
Vector2< T > & operator+= (T rhs)
Vector2< T > & operator-= (T rhs)
Vector2< T > & operator *= (T rhs)
Vector2< T > & operator/= (T rhs)
bool operator== (const Vector2< T > &rhs) const
bool operator!= (const Vector2< T > &rhs) const
length ()
void normalize ()
lengthSq ()
Vector2< T > lerp (T fact, const Vector2< T > &r) const
 operator T * ()
 operator const T * () const

Friends

std::ostream & operator<< (std::ostream &lhs, const Vector2< T > &rhs)


Detailed Description

template<class T>
class Vector2< T >

Class for two dimensional vector.


Constructor & Destructor Documentation

template<class T>
Vector2< T >::Vector2 (  )  [inline]

Creates and sets to (0,0)

template<class T>
Vector2< T >::Vector2 ( nx,
ny 
) [inline]

Creates and sets to (x,y)

Parameters:
nx intial x-coordinate value
ny intial y-coordinate value


Member Function Documentation

template<class T>
Vector2<T>& Vector2< T >::operator= ( const Vector2< T > &  rhs  )  [inline]

Copy operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
T& Vector2< T >::operator[] ( int  n  )  [inline]

Array access operator

Parameters:
n Array index
Returns:
For n = 0, reference to x coordinate, else reference to y y coordinate.

template<class T>
Vector2<T> Vector2< T >::operator+ ( const Vector2< T > &  rhs  )  const [inline]

Addition operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator- ( const Vector2< T > &  rhs  )  const [inline]

Substraction operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator * ( const Vector2< T > &  rhs  )  const [inline]

Multiplication operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator/ ( const Vector2< T > &  rhs  )  const [inline]

Division operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator+= ( const Vector2< T > &  rhs  )  [inline]

Addition operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator-= ( const Vector2< T > &  rhs  )  [inline]

Substraction operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator *= ( const Vector2< T > &  rhs  )  [inline]

Multiplication operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator/= ( const Vector2< T > &  rhs  )  [inline]

Division operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator+ ( rhs  )  const [inline]

Addition operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator- ( rhs  )  const [inline]

Substraction operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator * ( rhs  )  const [inline]

Multiplication operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T> Vector2< T >::operator/ ( rhs  )  const [inline]

Division operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator+= ( rhs  )  [inline]

Addition operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator-= ( rhs  )  [inline]

Substraction operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator *= ( rhs  )  [inline]

Multiplication operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
Vector2<T>& Vector2< T >::operator/= ( rhs  )  [inline]

Division operator

Parameters:
rhs Right hand side argument of binary operator.

template<class T>
bool Vector2< T >::operator== ( const Vector2< T > &  rhs  )  const [inline]

Equality test operator

Parameters:
rhs Right hand side argument of binary operator.
Note:
Test of equality is based of threshold EPSILON value. To be two values equal, must satisfy this condition | lws.x - rhs.y | < EPSILON, same for y-coordinate.

template<class T>
bool Vector2< T >::operator!= ( const Vector2< T > &  rhs  )  const [inline]

Inequality test operator

Parameters:
rhs Right hand side argument of binary operator.
Returns:
not (lhs == rhs) :-P

template<class T>
T Vector2< T >::length (  )  [inline]

Get lenght of vector.

Returns:
lenght of vector

template<class T>
void Vector2< T >::normalize (  )  [inline]

Normalize vector

template<class T>
T Vector2< T >::lengthSq (  )  [inline]

Return square of length.

Returns:
lenght ^ 2
Note:
This method is faster then length(). For comparsion of length of two vector can be used just this value, instead of computionaly more expensive length() method.

template<class T>
Vector2<T> Vector2< T >::lerp ( fact,
const Vector2< T > &  r 
) const [inline]

Linear interpolation of two vectors

Parameters:
fact Factor of interpolation. For translation from positon of this vector to vector r, values of factor goes from 0.0 to 1.0.
r Second Vector for interpolation
Note:
Hovewer values of fact parameter are reasonable only in interval [0.0 , 1.0], you can pass also values outside of this interval and you can get result (extrapolation?)

template<class T>
Vector2< T >::operator T * (  )  [inline]

Conversion to pointer operator

Returns:
Pointer to internaly stored (in managment of class Vector2<T>) used for passing Vector2<T> values to gl*2[fd] functions.

template<class T>
Vector2< T >::operator const T * (  )  const [inline]

Conversion to pointer operator

Returns:
Constant Pointer to internaly stored (in managment of class Vector2<T>) used for passing Vector2<T> values to gl*2[fd] functions.


Friends And Related Function Documentation

template<class T>
std::ostream& operator<< ( std::ostream &  lhs,
const Vector2< T > &  rhs 
) [friend]

Output to stream operator

Parameters:
lhs Left hand side argument of operator (commonly ostream instance).
rhs Right hand side argument of operator.
Returns:
Left hand side argument - the ostream object passed to operator.


Member Data Documentation

template<class T>
T Vector2< T >::x

First element of vector, alias for X-coordinate.

template<class T>
T Vector2< T >::s

First element of vector, alias for S-coordinate. For textures notation.

template<class T>
T Vector2< T >::y

Second element of vector, alias for Y-coordinate.

template<class T>
T Vector2< T >::t

Second element of vector, alias for T-coordinate. For textures notation.


The documentation for this class was generated from the following file:
Generated on Wed Jan 17 14:53:45 2007 for iTunesIslands by  doxygen 1.5.1-p1