Vector2< T > Class Template Reference

Class representing a 2-dimensional vector for both CPU and GPU. More...

Functions

_FCT_CPU_GPU_ int size () const
 Return the size of the sl::Vector2. More...
 
_FCT_CPU_GPU_ Vector2 ()
 Default constructor. More...
 
_FCT_CPU_GPU_ Vector2 (const T &t)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector2 (const T *tp)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector2 (const T v0, const T v1)
 Constructor. More...
 
_FCT_CPU_GPU_ Vector2 (const Vector2< T > &v)
 Copy constructor. More...
 
_FCT_CPU_GPU_ const T * ptr () const
 Returns a pointer of the first component. More...
 
_FCT_CPU_GPU_ Vector2setValues (const T *b)
 Sets the components of the sl::Vector2 to the values of the argument. More...
 
_FCT_CPU_GPU_ T & operator[] (int i)
 Returns the i-th component. More...
 
_FCT_CPU_GPU_ float norm ()
 Returns the norm of the sl::Vector2. More...
 
_FCT_CPU_GPU_ float square ()
 Returns the squared norm of the sl::Vector2. More...
 
_FCT_CPU_GPU_ float sum ()
 Returns the sum of the components of the sl::Vector2. More...
 

Static Functions

static _FCT_CPU_GPU_ float dot (const Vector2< T > &a, const Vector2< T > &b)
 Returns the dot product of two sl::Vector2. More...
 
static _FCT_CPU_GPU_ float distance (const Vector2< T > &a, const Vector2< T > &b)
 Returns the distance between two sl::Vector2. More...
 

Detailed Description

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

Class representing a 2-dimensional vector for both CPU and GPU.

Constructor and Destructor

◆ Vector2() [1/5]

_FCT_CPU_GPU_ Vector2 ( )
inline

Default constructor.

Initialize the sl::Vector2 to 0.

◆ Vector2() [2/5]

_FCT_CPU_GPU_ Vector2 ( const T &  t)
inline

Constructor.

Initialize the sl::Vector2 to ( t, t ).

◆ Vector2() [3/5]

_FCT_CPU_GPU_ Vector2 ( const T *  tp)
inline

Constructor.

Initialize the sl::Vector2 with the component of the argument.

◆ Vector2() [4/5]

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

Constructor.

Initialize the sl::Vector2 to ( v0, v1 ).

◆ Vector2() [5/5]

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

Copy constructor.

Initialize the sl::Vector2 by copying another sl::Vector2.

Functions

◆ size()

_FCT_CPU_GPU_ int size ( ) const
inline

Return the size of the sl::Vector2.

Returns
2

◆ ptr()

_FCT_CPU_GPU_ const T* ptr ( ) const
inline

Returns a pointer of the first component.

◆ setValues()

_FCT_CPU_GPU_ Vector2& setValues ( const T *  b)
inline

Sets the components of the sl::Vector2 to the values of the argument.

◆ operator[]()

_FCT_CPU_GPU_ T& operator[] ( int  i)
inline

Returns the i-th component.

◆ norm()

_FCT_CPU_GPU_ float norm ( )
inline

Returns the norm of the sl::Vector2.

◆ square()

_FCT_CPU_GPU_ float square ( )
inline

Returns the squared norm of the sl::Vector2.

◆ sum()

_FCT_CPU_GPU_ float sum ( )
inline

Returns the sum of the components of the sl::Vector2.

◆ dot()

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

Returns the dot product of two sl::Vector2.

◆ distance()

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

Returns the distance between two sl::Vector2.