Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Maths::TVector2 Class Template Reference

Template Class TVector2. More...

#include <Vector2.h>

Inheritance diagram for Teddy::Maths::TVector2:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Maths::TVector2:

Collaboration graph
[legend]
List of all members.

Public Methods

 TVector2 ()
 TVector2 (const int a, const int b)
 TVector2 (const float a, const float b)
 TVector2 (const double a, const double b)
 TVector2 (const TVector2< double > &v)
 TVector2 (const TVector2< float > &v)
 TVector2 (const TVector2< int > &v)
T & operator[] (const int n)
operator[] (const int n) const
TVector2< T > operator- () const
void operator= (const TVector2< T > &vec)
bool operator== (TVector2< T > &vec) const
bool operator!= (TVector2< T > &vec) const
TVector2< T > operator+ (const T t) const
TVector2< T > operator- (const T t) const
TVector2< T > operator * (const T t) const
TVector2< T > operator/ (const T t) const
const TVector2< T > & operator+= (const T t)
const TVector2< T > & operator-= (const T t)
const TVector2< T > & operator *= (const T t)
const TVector2< T > & operator/= (const T t)
TVector2< T > operator+ (const TVector2< T > &vec) const
TVector2< T > operator- (const TVector2< T > &vec) const
TVector2< T > operator * (const TVector2< T > &vec) const
TVector2< T > operator/ (const TVector2< T > &vec) const
const TVector2< T > & operator+= (const TVector2< T > &vec)
const TVector2< T > & operator-= (const TVector2< T > &vec)
const TVector2< T > & operator *= (const TVector2< T > &vec)
const TVector2< T > & operator/= (const TVector2< T > &vec)
operator| (const TVector2< T > &vec) const
magnitudeSquared () const
magnitude () const
distanceSquared (const TVector2< T > &vec) const
distance (const TVector2< T > &vec) const
TVector2< T > midpoint (const TVector2< T > &vec) const
TVector2< T > average (const TVector2< T > &vec) const
void normalize ()
double angle (const TVector2< T > &vec) const
TVector2< T > reflect (const TVector2< T > &n) const

Public Attributes

v [2]

Detailed Description

template<typename T>
class Teddy::Maths::TVector2< T >

Template Class TVector2.

Author:
Sean O'Neil
This template class implements a simple 2D vector with v[0] and v[1] coordinates. Several functions and operators are defined to make working with vectors easier, and because it's templatized, any numeric type can be used with it. Macros are defined for the most common types.

Definition at line 72 of file Vector2.h.


Constructor & Destructor Documentation

template<typename T>
Teddy::Maths::TVector2< T >::TVector2   [inline]
 

Definition at line 78 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const int    a,
const int    b
[inline]
 

Definition at line 79 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const float    a,
const float    b
[inline]
 

Definition at line 83 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const double    a,
const double    b
[inline]
 

Definition at line 87 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const TVector2< double > &    v [inline]
 

Definition at line 92 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const TVector2< float > &    v [inline]
 

Definition at line 93 of file Vector2.h.

template<typename T>
Teddy::Maths::TVector2< T >::TVector2 const TVector2< int > &    v [inline]
 

Definition at line 94 of file Vector2.h.


Member Function Documentation

template<typename T>
double Teddy::Maths::TVector2< T >::angle const TVector2< T > &    vec const [inline]
 

Definition at line 151 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::average const TVector2< T > &    vec const [inline]
 

Definition at line 147 of file Vector2.h.

template<typename T>
T Teddy::Maths::TVector2< T >::distance const TVector2< T > &    vec const [inline]
 

Definition at line 145 of file Vector2.h.

template<typename T>
T Teddy::Maths::TVector2< T >::distanceSquared const TVector2< T > &    vec const [inline]
 

Definition at line 144 of file Vector2.h.

template<typename T>
T Teddy::Maths::TVector2< T >::magnitude   const [inline]
 

Definition at line 143 of file Vector2.h.

Referenced by Teddy::Maths::TVector2< int >::normalize, and Teddy::Maths::TVector2< int >::reflect.

template<typename T>
T Teddy::Maths::TVector2< T >::magnitudeSquared   const [inline]
 

Definition at line 142 of file Vector2.h.

Referenced by Teddy::Maths::TVector2< int >::magnitude.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::midpoint const TVector2< T > &    vec const [inline]
 

Definition at line 146 of file Vector2.h.

template<typename T>
void Teddy::Maths::TVector2< T >::normalize   [inline]
 

Definition at line 150 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator * const TVector2< T > &    vec const [inline]
 

Definition at line 131 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator * const T    t const [inline]
 

Definition at line 121 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator *= const TVector2< T > &    vec [inline]
 

Definition at line 135 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator *= const T    t [inline]
 

Definition at line 125 of file Vector2.h.

template<typename T>
bool Teddy::Maths::TVector2< T >::operator!= TVector2< T > &    vec const [inline]
 

Definition at line 116 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator+ const TVector2< T > &    vec const [inline]
 

Definition at line 129 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator+ const T    t const [inline]
 

Definition at line 119 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator+= const TVector2< T > &    vec [inline]
 

Definition at line 133 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator+= const T    t [inline]
 

Definition at line 123 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator- const TVector2< T > &    vec const [inline]
 

Definition at line 130 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator- const T    t const [inline]
 

Definition at line 120 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator-   const [inline]
 

Definition at line 109 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator-= const TVector2< T > &    vec [inline]
 

Definition at line 134 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator-= const T    t [inline]
 

Definition at line 124 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator/ const TVector2< T > &    vec const [inline]
 

Definition at line 132 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::operator/ const T    t const [inline]
 

Definition at line 122 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator/= const TVector2< T > &    vec [inline]
 

Definition at line 136 of file Vector2.h.

template<typename T>
const TVector2<T>& Teddy::Maths::TVector2< T >::operator/= const T    t [inline]
 

Definition at line 126 of file Vector2.h.

template<typename T>
void Teddy::Maths::TVector2< T >::operator= const TVector2< T > &    vec [inline]
 

Definition at line 114 of file Vector2.h.

template<typename T>
bool Teddy::Maths::TVector2< T >::operator== TVector2< T > &    vec const [inline]
 

Definition at line 115 of file Vector2.h.

template<typename T>
T Teddy::Maths::TVector2< T >::operator[] const int    n const [inline]
 

Definition at line 103 of file Vector2.h.

template<typename T>
T& Teddy::Maths::TVector2< T >::operator[] const int    n [inline]
 

Definition at line 97 of file Vector2.h.

template<typename T>
T Teddy::Maths::TVector2< T >::operator| const TVector2< T > &    vec const [inline]
 

Definition at line 139 of file Vector2.h.

template<typename T>
TVector2<T> Teddy::Maths::TVector2< T >::reflect const TVector2< T > &    n const [inline]
 

Definition at line 152 of file Vector2.h.


Member Data Documentation

template<typename T>
T Teddy::Maths::TVector2::v[2]
 

Definition at line 75 of file Vector2.h.

Referenced by Teddy::Maths::TVector2< int >::magnitudeSquared, Teddy::Maths::TVector2< int >::midpoint, Teddy::Maths::TVector2< int >::operator *, Teddy::Maths::TVector2< int >::operator *=, Teddy::Maths::TVector2< int >::operator+, Teddy::Maths::TVector2< int >::operator+=, Teddy::Maths::TVector2< int >::operator-, Teddy::Maths::TVector2< int >::operator-=, Teddy::Maths::TVector2< int >::operator/, Teddy::Maths::TVector2< int >::operator/=, Teddy::Maths::TVector2< int >::operator=, Teddy::Maths::TVector2< int >::operator==, Teddy::Maths::TVector2< int >::operator[], Teddy::Maths::TVector2< int >::operator|, Teddy::Maths::TVector2< int >::reflect, and Teddy::Maths::TVector2< int >::TVector2.


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