Vector2< T > Class Template Reference

Represents a two dimensions vector for both CPU and GPU. More...

General Functions

_FCT_CPU_GPU_ int size () const
 
_FCT_CPU_GPU_ Vector2 ()
 
_FCT_CPU_GPU_ Vector2 (const T &t)
 
_FCT_CPU_GPU_ Vector2 (const T *tp)
 
_FCT_CPU_GPU_ Vector2 (const T v0, const T v1)
 
_FCT_CPU_GPU_ Vector2 (const Vector2< T > &v)
 
_FCT_CPU_GPU_ const T * ptr () const
 
_FCT_CPU_GPU_ Vector2setValues (const T *b)
 
_FCT_CPU_GPU_ T & operator[] (int i)
 
_FCT_CPU_GPU_ float norm ()
 returns the norm of the vector More...
 
_FCT_CPU_GPU_ float square ()
 returns the squared norm of the vector More...
 
_FCT_CPU_GPU_ float sum ()
 returns the sum of the vector More...
 
_FCT_CPU_GPU_ float dot (const Vector2< T > &a, const Vector2< T > &b)
 returns the dot product of two vector More...
 
_FCT_CPU_GPU_ float distance (const Vector2< T > &a, const Vector2< T > &b)
 returns the distance between two vector More...
 

Friends

_FCT_CPU_GPU_ friend Vector2< T > & operator*= (Vector2< T > &itself, T d)
 
_FCT_CPU_GPU_ friend Vector2< T > & operator*= (Vector2< T > &itself, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > & operator/= (Vector2< T > &itself, T d)
 
_FCT_CPU_GPU_ friend Vector2< T > & operator/= (Vector2< T > &itself, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > & operator+= (Vector2< T > &itself, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > & operator-= (Vector2< T > &itself, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator+ (const Vector2< T > &a, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator- (const Vector2< T > &a, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator* (const Vector2< T > &a, T b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator* (const Vector2< T > &a, const Vector2< T > &b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator/ (const Vector2< T > &a, T b)
 
_FCT_CPU_GPU_ friend Vector2< T > operator/ (const Vector2< T > &a, const Vector2< T > &b)
 

Detailed Description

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

Represents a two dimensions vector for both CPU and GPU.

Constructor and Destructor

◆ Vector2() [1/5]

_FCT_CPU_GPU_ Vector2 ( )
inline

◆ Vector2() [2/5]

_FCT_CPU_GPU_ Vector2 ( const T &  t)
inline

◆ Vector2() [3/5]

_FCT_CPU_GPU_ Vector2 ( const T *  tp)
inline

◆ Vector2() [4/5]

_FCT_CPU_GPU_ Vector2 ( const T  v0,
const T  v1 
)
inline

◆ Vector2() [5/5]

_FCT_CPU_GPU_ Vector2 ( const Vector2< T > &  v)
inline

Functions

◆ size()

_FCT_CPU_GPU_ int size ( ) const
inline

◆ ptr()

_FCT_CPU_GPU_ const T* ptr ( ) const
inline

◆ setValues()

_FCT_CPU_GPU_ Vector2& setValues ( const T *  b)
inline

◆ operator[]()

_FCT_CPU_GPU_ T& operator[] ( int  i)
inline

◆ norm()

_FCT_CPU_GPU_ float norm ( )
inline

returns the norm of the vector

◆ square()

_FCT_CPU_GPU_ float square ( )
inline

returns the squared norm of the vector

◆ sum()

_FCT_CPU_GPU_ float sum ( )
inline

returns the sum of the vector

◆ dot()

_FCT_CPU_GPU_ float dot ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
inline

returns the dot product of two vector

◆ distance()

_FCT_CPU_GPU_ float distance ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
inline

returns the distance between two vector

Friends And Related Function Documentation

◆ operator*= [1/2]

_FCT_CPU_GPU_ friend Vector2<T>& operator*= ( Vector2< T > &  itself,
d 
)
friend

◆ operator*= [2/2]

_FCT_CPU_GPU_ friend Vector2<T>& operator*= ( Vector2< T > &  itself,
const Vector2< T > &  b 
)
friend

◆ operator/= [1/2]

_FCT_CPU_GPU_ friend Vector2<T>& operator/= ( Vector2< T > &  itself,
d 
)
friend

◆ operator/= [2/2]

_FCT_CPU_GPU_ friend Vector2<T>& operator/= ( Vector2< T > &  itself,
const Vector2< T > &  b 
)
friend

◆ operator+=

_FCT_CPU_GPU_ friend Vector2<T>& operator+= ( Vector2< T > &  itself,
const Vector2< T > &  b 
)
friend

◆ operator-=

_FCT_CPU_GPU_ friend Vector2<T>& operator-= ( Vector2< T > &  itself,
const Vector2< T > &  b 
)
friend

◆ operator+

_FCT_CPU_GPU_ friend Vector2<T> operator+ ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
friend

◆ operator-

_FCT_CPU_GPU_ friend Vector2<T> operator- ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
friend

◆ operator* [1/2]

_FCT_CPU_GPU_ friend Vector2<T> operator* ( const Vector2< T > &  a,
b 
)
friend

◆ operator* [2/2]

_FCT_CPU_GPU_ friend Vector2<T> operator* ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
friend

◆ operator/ [1/2]

_FCT_CPU_GPU_ friend Vector2<T> operator/ ( const Vector2< T > &  a,
b 
)
friend

◆ operator/ [2/2]

_FCT_CPU_GPU_ friend Vector2<T> operator/ ( const Vector2< T > &  a,
const Vector2< T > &  b 
)
friend