3D City v-1.0
Computer Graphics Project
vec2_T< T > Struct Template Reference

2d Vector class for storing x and y. More...

#include <maths.h>

Public Member Functions

 vec2_T ()
 
 vec2_T (T a)
 
 vec2_T (T a, T b)
 
 vec2_T (const glm::vec2 &in)
 
 vec2_T (glm::vec2 &in)
 
 vec2_T (const vec3_T< T > &in)
 
 vec2_T (const vec4_T< T > &in)
 
template<class U >
 vec2_T (const vec2_T< U > &in)
 
float getmag () const
 
 operator glm::vec4 ()
 
 operator glm::vec2 ()
 
vec2_T< T > operator+ (const vec2_T< T > &b) const
 
vec2_T< T > operator+ (T a) const
 
vec2_T< T > operator- (const vec2_T< T > &b) const
 
vec2_T< T > operator- (T a) const
 
vec2_T< T > operator* (const vec2_T< T > &b) const
 
vec2_T< float > operator* (float a) const
 
vec2_T< T > operator/ (const vec2_T< T > &b) const
 
vec2_T< T > operator/ (T a) const
 
vec2_T< T > operator- () const
 
vec2_T< T > operator+= (const vec2_T< T > &in)
 
vec2_T< T > operator-= (const vec2_T< T > &in)
 
template<class U >
void operator*= (const U &in)
 
template<class U >
void operator/= (const U &in)
 
bool operator== (const vec2_T< T > &in) const
 
bool operator!= (const vec2_T< T > &in) const
 
vec2_T< T > normalize ()
 

Static Public Member Functions

static vec2_T< T > normalize (const vec2_T< T > &in)
 
static double dist (const vec2_T< T > &a, const vec2_T< T > &b)
 
static T dot (const vec2_T< T > &a, const vec2_T< T > &b)
 

Public Attributes

T x
 
T y
 

Friends

std::ostream & operator<< (std::ostream &out, const vec2_T< T > &vec)
 

Detailed Description

template<class T>
struct vec2_T< T >

2d Vector class for storing x and y.

Template Parameters
Typeof vector

Definition at line 25 of file maths.h.

Constructor & Destructor Documentation

◆ vec2_T() [1/8]

template<class T >
vec2_T< T >::vec2_T ( )
inline

Definition at line 28 of file maths.h.

◆ vec2_T() [2/8]

template<class T >
vec2_T< T >::vec2_T ( T  a)
inlineexplicit

Definition at line 29 of file maths.h.

◆ vec2_T() [3/8]

template<class T >
vec2_T< T >::vec2_T ( T  a,
T  b 
)
inline

Definition at line 30 of file maths.h.

◆ vec2_T() [4/8]

template<class T >
vec2_T< T >::vec2_T ( const glm::vec2 &  in)
inline

Definition at line 31 of file maths.h.

◆ vec2_T() [5/8]

template<class T >
vec2_T< T >::vec2_T ( glm::vec2 &  in)
inline

Definition at line 32 of file maths.h.

◆ vec2_T() [6/8]

template<class T >
vec2_T< T >::vec2_T ( const vec3_T< T > &  in)
inline

Definition at line 33 of file maths.h.

◆ vec2_T() [7/8]

template<class T >
vec2_T< T >::vec2_T ( const vec4_T< T > &  in)
inline

Definition at line 34 of file maths.h.

◆ vec2_T() [8/8]

template<class T >
template<class U >
vec2_T< T >::vec2_T ( const vec2_T< U > &  in)
inline

Definition at line 37 of file maths.h.

Member Function Documentation

◆ dist()

template<class T >
static double vec2_T< T >::dist ( const vec2_T< T > &  a,
const vec2_T< T > &  b 
)
inlinestatic

Definition at line 145 of file maths.h.

◆ dot()

template<class T >
static T vec2_T< T >::dot ( const vec2_T< T > &  a,
const vec2_T< T > &  b 
)
inlinestatic

Definition at line 149 of file maths.h.

◆ getmag()

template<class T >
float vec2_T< T >::getmag ( ) const
inline

Definition at line 39 of file maths.h.

◆ normalize() [1/2]

template<class T >
vec2_T< T > vec2_T< T >::normalize ( )
inline

Definition at line 134 of file maths.h.

◆ normalize() [2/2]

template<class T >
static vec2_T< T > vec2_T< T >::normalize ( const vec2_T< T > &  in)
inlinestatic

Definition at line 140 of file maths.h.

◆ operator glm::vec2()

template<class T >
vec2_T< T >::operator glm::vec2 ( )
inline

Definition at line 47 of file maths.h.

◆ operator glm::vec4()

template<class T >
vec2_T< T >::operator glm::vec4 ( )
inline

Definition at line 43 of file maths.h.

◆ operator!=()

template<class T >
bool vec2_T< T >::operator!= ( const vec2_T< T > &  in) const
inline

Definition at line 125 of file maths.h.

◆ operator*() [1/2]

template<class T >
vec2_T< T > vec2_T< T >::operator* ( const vec2_T< T > &  b) const
inline

Definition at line 67 of file maths.h.

◆ operator*() [2/2]

template<class T >
vec2_T< float > vec2_T< T >::operator* ( float  a) const
inline

Definition at line 71 of file maths.h.

◆ operator*=()

template<class T >
template<class U >
void vec2_T< T >::operator*= ( const U &  in)
inline

Definition at line 105 of file maths.h.

◆ operator+() [1/2]

template<class T >
vec2_T< T > vec2_T< T >::operator+ ( const vec2_T< T > &  b) const
inline

Definition at line 51 of file maths.h.

◆ operator+() [2/2]

template<class T >
vec2_T< T > vec2_T< T >::operator+ ( T  a) const
inline

Definition at line 55 of file maths.h.

◆ operator+=()

template<class T >
vec2_T< T > vec2_T< T >::operator+= ( const vec2_T< T > &  in)
inline

Definition at line 87 of file maths.h.

◆ operator-() [1/3]

template<class T >
vec2_T< T > vec2_T< T >::operator- ( ) const
inline

Definition at line 83 of file maths.h.

◆ operator-() [2/3]

template<class T >
vec2_T< T > vec2_T< T >::operator- ( const vec2_T< T > &  b) const
inline

Definition at line 59 of file maths.h.

◆ operator-() [3/3]

template<class T >
vec2_T< T > vec2_T< T >::operator- ( T  a) const
inline

Definition at line 63 of file maths.h.

◆ operator-=()

template<class T >
vec2_T< T > vec2_T< T >::operator-= ( const vec2_T< T > &  in)
inline

Definition at line 93 of file maths.h.

◆ operator/() [1/2]

template<class T >
vec2_T< T > vec2_T< T >::operator/ ( const vec2_T< T > &  b) const
inline

Definition at line 75 of file maths.h.

◆ operator/() [2/2]

template<class T >
vec2_T< T > vec2_T< T >::operator/ ( T  a) const
inline

Definition at line 79 of file maths.h.

◆ operator/=()

template<class T >
template<class U >
void vec2_T< T >::operator/= ( const U &  in)
inline

Definition at line 116 of file maths.h.

◆ operator==()

template<class T >
bool vec2_T< T >::operator== ( const vec2_T< T > &  in) const
inline

Definition at line 121 of file maths.h.

Friends And Related Function Documentation

◆ operator<<

template<class T >
std::ostream & operator<< ( std::ostream &  out,
const vec2_T< T > &  vec 
)
friend

Definition at line 129 of file maths.h.

Member Data Documentation

◆ x

template<class T >
T vec2_T< T >::x

Definition at line 26 of file maths.h.

◆ y

template<class T >
T vec2_T< T >::y

Definition at line 26 of file maths.h.