etk::Vector2D< T > Class Template Reference

#include <Vector2D.hpp>

Public Member Functions

 Vector2D (T _xxx, T _yyy)
 
 Vector2D (const Vector2D< double > &_obj)
 
 Vector2D (const Vector2D< float > &_obj)
 
 Vector2D (const Vector2D< int32_t > &_obj)
 
 Vector2D (const std::string &_str)
 
const Vector2D< T > & operator= (const Vector2D< T > &_obj)
 
const Vector2D< T > & operator= (const T _val)
 
bool operator== (const Vector2D< T > &_obj) const
 
bool operator!= (const Vector2D< T > &_obj) const
 
const Vector2D< T > & operator+= (const Vector2D< T > &_obj)
 
const Vector2D< T > & operator+= (const T _val)
 
Vector2D< T > operator+ (const Vector2D< T > &_obj) const
 
Vector2D< T > operator+ (const T _val) const
 
const Vector2D< T > & operator-= (const Vector2D< T > &_obj)
 
const Vector2D< T > & operator-= (const T _val)
 
Vector2D< T > operator- (const Vector2D< T > &_obj) const
 
Vector2D< T > operator- (const T _val) const
 
const Vector2D< T > & operator*= (const Vector2D< T > &_obj)
 
const Vector2D< T > & operator*= (const T _val)
 
Vector2D< T > operator* (const Vector2D< T > &_obj) const
 
Vector2D< T > operator* (const T _val) const
 
Vector2D< T > operator/ (const Vector2D< T > &_obj) const
 
Vector2D< T > operator/ (const T _val) const
 
const Vector2D< T > & operator/= (const Vector2D< T > &_obj)
 
const Vector2D< T > & operator/= (const T _val)
 
Vector2D< T > & operator++ ()
 
Vector2D< T > operator++ (int)
 
Vector2D< T > & operator-- ()
 
Vector2D< T > operator-- (int)
 
cross (const Vector2D< T > &_obj) const
 
dot (const Vector2D< T > &_obj) const
 
length2 () const
 
float length () const
 
distance2 (const Vector2D< T > &_obj) const
 
float distance (const Vector2D< T > &_obj) const
 
Vector2D< T > & normalize ()
 
Vector2D< T > & safeNormalize ()
 
Vector2D< T > normalized () const
 
Vector2D< T > absolute () const
 
int32_t minAxis () const
 
int32_t maxAxis () const
 
int32_t furthestAxis () const
 
int32_t closestAxis () const
 
const T & getX () const
 
const T & getY () const
 
void setX (T _xxx)
 
void setY (T _yyy)
 
const T & x () const
 
const T & y () const
 
 operator T* ()
 
 operator const T * () const
 
void setMax (const Vector2D< T > &_other)
 
void setMin (const Vector2D< T > &_other)
 
void setValue (const T &_xxx, const T &_yyy)
 
void setZero ()
 
bool isZero () const
 
 operator std::string () const
 

Public Attributes

m_floats [2]
 

Detailed Description

template<typename T>
class etk::Vector2D< T >

Vectorial 2-dimention vector (x/y)

Constructor & Destructor Documentation

§ Vector2D() [1/5]

template<typename T>
etk::Vector2D< T >::Vector2D ( _xxx,
_yyy 
)
inline

Constructor from scalars.

Parameters
[in]_xxxX value
[in]_yyyY value

§ Vector2D() [2/5]

template<typename T>
etk::Vector2D< T >::Vector2D ( const Vector2D< double > &  _obj)
inline

Constructor with external vector.

Parameters
[in]_objThe vector to add to this one

§ Vector2D() [3/5]

template<typename T>
etk::Vector2D< T >::Vector2D ( const Vector2D< float > &  _obj)
inline

Constructor with external vector.

Parameters
[in]_objThe vector to add to this one

§ Vector2D() [4/5]

template<typename T>
etk::Vector2D< T >::Vector2D ( const Vector2D< int32_t > &  _obj)
inline

Constructor with external vector.

Parameters
[in]_objThe vector to add to this one

§ Vector2D() [5/5]

template<typename T>
etk::Vector2D< T >::Vector2D ( const std::string &  _str)

Constructor with string data.

Parameters
[in]_strSting containing the value to parse

Member Function Documentation

§ absolute()

template<typename T>
Vector2D<T> etk::Vector2D< T >::absolute ( ) const
inline

Return a vector will the absolute values of each element.

Returns
New vector containing the value

§ closestAxis()

template<typename T>
int32_t etk::Vector2D< T >::closestAxis ( ) const
inline

Return the axis with the largest ABSOLUTE value.

Returns
values 0,1 for x or y

§ cross()

template<typename T>
T etk::Vector2D< T >::cross ( const Vector2D< T > &  _obj) const
inline

Return the cross product / determinant.

Parameters
_objThe other vector in the cross product
Returns
cross product value

§ distance()

template<typename T>
float etk::Vector2D< T >::distance ( const Vector2D< T > &  _obj) const
inline

Return the distance between the ends of this and another vector This is symantically treating the vector like a point.

Parameters
[in]_objThe other vector to compare distance
Returns
the distance of the 2 points

§ distance2()

template<typename T>
T etk::Vector2D< T >::distance2 ( const Vector2D< T > &  _obj) const
inline

Return the distance squared between the ends of this and another vector This is symantically treating the vector like a point.

Parameters
[in]_objThe other vector to compare distance
Returns
the square distance of the 2 points

§ dot()

template<typename T>
T etk::Vector2D< T >::dot ( const Vector2D< T > &  _obj) const
inline

Return the dot product.

Parameters
_objThe other vector in the dot product
Returns
Dot product value

§ furthestAxis()

template<typename T>
int32_t etk::Vector2D< T >::furthestAxis ( ) const
inline

Return the axis with the smallest ABSOLUTE value.

Returns
values 0,1 for x, or z

§ getX()

template<typename T>
const T& etk::Vector2D< T >::getX ( ) const
inline

Get X value.

Returns
the x value

§ getY()

template<typename T>
const T& etk::Vector2D< T >::getY ( ) const
inline

Get Y value.

Returns
the y value

§ isZero()

template<typename T>
bool etk::Vector2D< T >::isZero ( ) const
inline

Check if the vector is equal to (0,0)

Returns
true The value is equal to (0,0)
false The value is NOT equal to (0,0)

§ length()

template<typename T>
float etk::Vector2D< T >::length ( ) const
inline

Get the length of the vector.

Returns
Length value

§ length2()

template<typename T>
T etk::Vector2D< T >::length2 ( ) const
inline

Get the length of the vector squared.

Returns
Squared length value.

§ maxAxis()

template<typename T>
int32_t etk::Vector2D< T >::maxAxis ( ) const
inline

Return the axis with the largest value.

Returns
values are 0,1 for x or y

§ minAxis()

template<typename T>
int32_t etk::Vector2D< T >::minAxis ( ) const
inline

Return the axis with the smallest value.

Returns
values are 0,1 for x or y

§ normalize()

template<typename T>
Vector2D<T>& etk::Vector2D< T >::normalize ( )
inline

Normalize this vector x^2 + y^2 = 1.

Returns
Local reference of the vector normalized

§ normalized()

template<typename T>
Vector2D<T> etk::Vector2D< T >::normalized ( ) const
inline

Return a normalized version of this vector.

Returns
New vector containing the value

§ operator const T *()

template<typename T>
etk::Vector2D< T >::operator const T * ( ) const
inline

Cast the vector in the type const T* requested.

Returns
Pointer on the const data

§ operator std::string()

template<typename T>
etk::Vector2D< T >::operator std::string ( ) const

String caster of the object.

Returns
the Object cated in string (x.x,y.y)

§ operator T*()

template<typename T>
etk::Vector2D< T >::operator T* ( )
inline

Cast the vector in the type T* requested.

Returns
Pointer on the data

§ operator!=()

template<typename T>
bool etk::Vector2D< T >::operator!= ( const Vector2D< T > &  _obj) const
inline

In-Equality compare operator with an other object.

Parameters
[in]_objReference on the comparing object
Returns
true The Objects are NOT identical
false The Objects are identical

§ operator*() [1/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator* ( const Vector2D< T > &  _obj) const
inline

Operator* Multiplication an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
New vector containing the value

§ operator*() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator* ( const T  _val) const
inline

Operator* Multiplication an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
New vector containing the value

§ operator*=() [1/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator*= ( const Vector2D< T > &  _obj)
inline

Operator*= Multiplication an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
Local reference of the vector multiplicated

§ operator*=() [2/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator*= ( const T  _val)
inline

Operator*= Multiplication an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
Local reference of the vector multiplicated

§ operator+() [1/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator+ ( const Vector2D< T > &  _obj) const
inline

Operator+ Addition an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
New vector containing the value

§ operator+() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator+ ( const T  _val) const
inline

Operator+ Addition an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
New vector containing the value

§ operator++() [1/2]

template<typename T>
Vector2D<T>& etk::Vector2D< T >::operator++ ( )
inline

Operator++ Pre-incrementation of this vector.

Returns
Local reference of the vector incremented

§ operator++() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator++ ( int  )
inline

Operator++ Post-incrementation of this vector.

Returns
New vector containing the last value

§ operator+=() [1/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator+= ( const Vector2D< T > &  _obj)
inline

Operator+= Addition an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
Local reference of the vector additionned

§ operator+=() [2/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator+= ( const T  _val)
inline

Operator+= Addition an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
Local reference of the vector additionned

§ operator-() [1/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator- ( const Vector2D< T > &  _obj) const
inline

Operator- Decrement an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
New vector containing the value

§ operator-() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator- ( const T  _val) const
inline

Operator- Decrement an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
New vector containing the value

§ operator--() [1/2]

template<typename T>
Vector2D<T>& etk::Vector2D< T >::operator-- ( )
inline

Operator++ Pre-decrementation of this vector.

Returns
Local reference of the vector incremented

§ operator--() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator-- ( int  )
inline

Operator++ Post-decrementation of this vector.

Returns
New vector containing the last value

§ operator-=() [1/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator-= ( const Vector2D< T > &  _obj)
inline

Operator-= Decrement an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
Local reference of the vector decremented

§ operator-=() [2/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator-= ( const T  _val)
inline

Operator-= Decrement an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
Local reference of the vector decremented

§ operator/() [1/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator/ ( const Vector2D< T > &  _obj) const
inline

Operator/= Dividing an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
Local reference of the vector divided

§ operator/() [2/2]

template<typename T>
Vector2D<T> etk::Vector2D< T >::operator/ ( const T  _val) const
inline

Operator/= Dividing an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
Local reference of the vector divided

§ operator/=() [1/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator/= ( const Vector2D< T > &  _obj)
inline

Operator/ Dividing an other vertor with this one.

Parameters
[in]_objReference on the external object
Returns
New vector containing the value

§ operator/=() [2/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator/= ( const T  _val)
inline

Operator/ Dividing an other vertor with this one.

Parameters
[in]_valValue to addition at x/y
Returns
New vector containing the value

§ operator=() [1/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator= ( const Vector2D< T > &  _obj)
inline

Operator= Asign the current object with an other object.

Parameters
[in]_objReference on the external object
Returns
Local reference of the vector asigned

§ operator=() [2/2]

template<typename T>
const Vector2D<T>& etk::Vector2D< T >::operator= ( const T  _val)
inline

Operator= Asign the current object with a value.

Parameters
[in]_valValue to assign on the object
Returns
Local reference of the vector asigned

§ operator==()

template<typename T>
bool etk::Vector2D< T >::operator== ( const Vector2D< T > &  _obj) const
inline

Equality compare operator with an other object.

Parameters
[in]_objReference on the comparing object
Returns
true The Objects are identical
false The Objects are NOT identical

§ safeNormalize()

template<typename T>
Vector2D<T>& etk::Vector2D< T >::safeNormalize ( )
inline

Normalize this vector x^2 + y^2 = 1 (check if not deviding by 0, if it is the case ==> return (1,0))

Returns
Local reference of the vector normalized

§ setMax()

template<typename T>
void etk::Vector2D< T >::setMax ( const Vector2D< T > &  _other)
inline

Set each element to the max of the current values and the values of another vector.

Parameters
_otherThe other vector to compare with

§ setMin()

template<typename T>
void etk::Vector2D< T >::setMin ( const Vector2D< T > &  _other)
inline

Set each element to the min of the current values and the values of another vector.

Parameters
_otherThe other vector to compare with

§ setValue()

template<typename T>
void etk::Vector2D< T >::setValue ( const T &  _xxx,
const T &  _yyy 
)
inline

Set Value on the vector.

Parameters
[in]_xxxX value.
[in]_yyyY value.

§ setX()

template<typename T>
void etk::Vector2D< T >::setX ( _xxx)
inline

Set the x value.

Parameters
[in]_xxxNew value

§ setY()

template<typename T>
void etk::Vector2D< T >::setY ( _yyy)
inline

Set the y value.

Parameters
[in]_yyyNew value

§ setZero()

template<typename T>
void etk::Vector2D< T >::setZero ( )
inline

Set 0 value on all the vector.

§ x()

template<typename T>
const T& etk::Vector2D< T >::x ( ) const
inline

Get X value.

Returns
the x value

§ y()

template<typename T>
const T& etk::Vector2D< T >::y ( ) const
inline

Get Y value.

Returns
the y value

Member Data Documentation

§ m_floats

template<typename T>
T etk::Vector2D< T >::m_floats[2]

all internal values


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