R-Type
Public Member Functions | Public Attributes | List of all members
GameEngine::Vector2< T > Class Template Reference

a Vector2 class More...

#include <Vector.hpp>

Public Member Functions

 Vector2 ()=default
 default constructor More...
 
 Vector2 (T x, T y)
 constructor More...
 
 ~Vector2 ()=default
 destructor More...
 
float length () const
 calculate the length of the vector More...
 
Vector2 normalize () const
 normalize the vector More...
 
float dotProduct (Vector2 vec) const
 calculate the dot product of the vector More...
 
bool operator== (const Vector2 &other) const
 overload operator == to compare two Vector2 More...
 
bool operator!= (const Vector2 &other) const
 overload operator != to compare two Vector2 More...
 
Vector2 operator+ (const Vector2 &vec) const
 overload of the + operator More...
 
Vector2operator+= (const Vector2 &vec)
 overload of the += operator More...
 
Vector2 operator- (const Vector2 &vec) const
 overload of the - operator More...
 
Vector2operator-= (const Vector2 &vec)
 overload of the -= operator More...
 
Vector2< T > operator* (const T &val) const
 overload of the * operator More...
 
Vector2< T > & operator*= (const T &val)
 overload of the *= operator More...
 
Vector2< T > operator/ (const T &val) const
 overload of the / operator More...
 
Vector2< T > & operator/= (const T &val)
 overload of the /= operator More...
 

Public Attributes

x
 
y
 

Detailed Description

template<typename T>
class GameEngine::Vector2< T >

a Vector2 class

Template Parameters
Tthe type contained in the vector

Constructor & Destructor Documentation

◆ Vector2() [1/2]

template<typename T >
GameEngine::Vector2< T >::Vector2 ( )
default

default constructor

◆ Vector2() [2/2]

template<typename T >
GameEngine::Vector2< T >::Vector2 ( x,
y 
)
inline

constructor

Parameters
xvalue of the vector
yvalue of the vector

◆ ~Vector2()

template<typename T >
GameEngine::Vector2< T >::~Vector2 ( )
default

destructor

Member Function Documentation

◆ dotProduct()

template<typename T >
float GameEngine::Vector2< T >::dotProduct ( Vector2< T >  vec) const
inline

calculate the dot product of the vector

Parameters
vecthe vector to calculate the dot product with
Returns
the dot product

◆ length()

template<typename T >
float GameEngine::Vector2< T >::length ( ) const
inline

calculate the length of the vector

Returns
the length of the vector

◆ normalize()

template<typename T >
Vector2 GameEngine::Vector2< T >::normalize ( ) const
inline

normalize the vector

Returns
a normalized copy of the vector

◆ operator!=()

template<typename T >
bool GameEngine::Vector2< T >::operator!= ( const Vector2< T > &  other) const
inline

overload operator != to compare two Vector2

Parameters
thevector to compare
Returns
a boolean for the comparison

◆ operator*()

template<typename T >
Vector2<T> GameEngine::Vector2< T >::operator* ( const T &  val) const
inline

overload of the * operator

Parameters
valthe factor
Returns
result of the multiplication

◆ operator*=()

template<typename T >
Vector2<T>& GameEngine::Vector2< T >::operator*= ( const T &  val)
inline

overload of the *= operator

Parameters
valthe factor
Returns
reference to vector

◆ operator+()

template<typename T >
Vector2 GameEngine::Vector2< T >::operator+ ( const Vector2< T > &  vec) const
inline

overload of the + operator

Parameters
vecthe vector to add with
Returns
the vector resulting of the addition

◆ operator+=()

template<typename T >
Vector2& GameEngine::Vector2< T >::operator+= ( const Vector2< T > &  vec)
inline

overload of the += operator

Parameters
vecthe vector to add with
Returns
the vector resulting of the addition

◆ operator-()

template<typename T >
Vector2 GameEngine::Vector2< T >::operator- ( const Vector2< T > &  vec) const
inline

overload of the - operator

Parameters
vecthe vector to subtract with
Returns
the vector resulting of the subtraction

◆ operator-=()

template<typename T >
Vector2& GameEngine::Vector2< T >::operator-= ( const Vector2< T > &  vec)
inline

overload of the -= operator

Parameters
vecthe vector to subtract with
Returns
result of the subtraction

◆ operator/()

template<typename T >
Vector2<T> GameEngine::Vector2< T >::operator/ ( const T &  val) const
inline

overload of the / operator

Parameters
valthe divisor
Returns
result of the division

◆ operator/=()

template<typename T >
Vector2<T>& GameEngine::Vector2< T >::operator/= ( const T &  val)
inline

overload of the /= operator

Parameters
valthe divisor
Returns
reference to vector

◆ operator==()

template<typename T >
bool GameEngine::Vector2< T >::operator== ( const Vector2< T > &  other) const
inline

overload operator == to compare two Vector2

Parameters
thevector to compare
Returns
a boolean for the comparison

Member Data Documentation

◆ x

template<typename T >
T GameEngine::Vector2< T >::x

◆ y

template<typename T >
T GameEngine::Vector2< T >::y

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