etk::Vector4D< T > Class Template Reference

#include <Vector4D.hpp>

Public Member Functions

 Vector4D ()
 
 Vector4D (const T &_xxx, const T &_yyy, const T &_zzz, const T &_www)
 
Vector4D< T > & operator+= (const Vector4D< T > &_obj)
 
Vector4D< T > operator+ (const Vector4D< T > &_obj)
 
Vector4D< T > & operator-= (const Vector4D< T > &_obj)
 
Vector4D< T > operator- (const Vector4D< T > &_obj)
 
Vector4D< T > & operator*= (const T &_val)
 
Vector4D< T > operator* (const T &_val)
 
Vector4D< T > & operator/= (const T &_val)
 
Vector4D< T > operator/ (const T &_val)
 
float dot (const Vector4D< T > &_obj) const
 
float length2 () const
 
float length () const
 
float distance2 (const Vector4D< T > &_obj) const
 
float distance (const Vector4D< T > &_obj) const
 
Vector4D< T > & normalize ()
 
Vector4D< T > normalized () const
 
Vector4D< T > absolute () const
 
Vector4D< T > & operator*= (const Vector4D< T > &_obj)
 
Vector4D< T > operator* (const Vector4D< T > &_obj)
 
const T & getX () const
 
const T & getY () const
 
const T & getZ () const
 
const T & getW () const
 
void setX (T _x)
 
void setY (T _y)
 
void setZ (T _z)
 
void setW (T _w)
 
const T & x () const
 
const T & y () const
 
const T & z () const
 
const T & w () const
 
 operator T* ()
 
 operator const T * () const
 
bool operator== (const Vector4D< T > &_obj) const
 
bool operator!= (const Vector4D< T > &_obj) const
 
void setMax (const Vector4D< T > &_obj)
 
void setMin (const Vector4D< T > &_obj)
 
void setValue (const T &_xxx, const T &_yyy, const T &_zzz, const T &_www)
 
void setZero ()
 
bool isZero () const
 

Public Attributes

m_floats [4]
 

Detailed Description

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

Vectorial 4-dimention vector (x/y/z/w)

Constructor & Destructor Documentation

§ Vector4D() [1/2]

template<typename T>
etk::Vector4D< T >::Vector4D ( )
inline

No initialization constructor (faster ...)

§ Vector4D() [2/2]

template<typename T>
etk::Vector4D< T >::Vector4D ( const T &  _xxx,
const T &  _yyy,
const T &  _zzz,
const T &  _www 
)
inline

Constructor from scalars.

Parameters
_xxxX value
_yyyY value
_zzzZ value
_wwwW value

Member Function Documentation

§ absolute()

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

Return a vector will the absolute values of each element.

Returns
New vector with the absolute value

§ distance()

template<typename T>
float etk::Vector4D< T >::distance ( const Vector4D< 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>
float etk::Vector4D< T >::distance2 ( const Vector4D< 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>
float etk::Vector4D< T >::dot ( const Vector4D< T > &  _obj) const
inline

Return the dot product.

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

§ getW()

template<typename T>
const T& etk::Vector4D< T >::getW ( ) const
inline

Get W value.

Returns
the w value

§ getX()

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

Get X value.

Returns
the x value

§ getY()

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

Get Y value.

Returns
the y value

§ getZ()

template<typename T>
const T& etk::Vector4D< T >::getZ ( ) const
inline

Get Z value.

Returns
the z value

§ isZero()

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

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

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

§ length()

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

Return the length of the vector.

Returns
Length value

§ length2()

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

Return the squared length of the vector.

Returns
Squared length value.

§ normalize()

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

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

Returns
Local reference of the vector normalized

§ normalized()

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

Return a normalized version of this vector.

Returns
New vector containing the value

§ operator const T *()

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

Cast the vector in the type const T* requested.

Returns
Pointer on the const data

§ operator T*()

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

Cast the vector in the type T* requested.

Returns
Pointer on the data

§ operator!=()

template<typename T>
bool etk::Vector4D< T >::operator!= ( const Vector4D< 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>
Vector4D<T> etk::Vector4D< T >::operator* ( const T &  _val)
inline

Scale the vector.

Parameters
[in]_valScale factor
Returns
New vector containing the value

§ operator*() [2/2]

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

Multiply this vector by the other.

Parameters
_objThe other vector
Returns
New vector containing the value

§ operator*=() [1/2]

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

Scale the vector.

Parameters
[in]_valScale factor
Returns
Local reference of the vector

§ operator*=() [2/2]

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

Multiply this vector by the other.

Parameters
_objThe other vector
Returns
Local reference of the vector

§ operator+()

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

Add a vector to this one.

Parameters
[in]_objThe vector to add to this one
Returns
New vector containing the value

§ operator+=()

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

Add a vector to this one.

Parameters
[in]_objThe vector to add to this one
Returns
Local reference of the vector

§ operator-()

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

Subtract a vector from this one.

Parameters
_objThe vector to subtract
Returns
New vector containing the value

§ operator-=()

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

Subtract a vector from this one.

Parameters
_objThe vector to subtract
Returns
Local reference of the vector

§ operator/()

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

Inversely scale the vector.

Parameters
[in]_valScale factor to divide by.
Returns
New vector containing the value

§ operator/=()

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

Inversely scale the vector.

Parameters
[in]_valScale factor to divide by.
Returns
Local reference of the vector

§ operator==()

template<typename T>
bool etk::Vector4D< T >::operator== ( const Vector4D< 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

§ setMax()

template<typename T>
void etk::Vector4D< T >::setMax ( const Vector4D< T > &  _obj)
inline

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

Parameters
_objThe other Vector to compare with

§ setMin()

template<typename T>
void etk::Vector4D< T >::setMin ( const Vector4D< T > &  _obj)
inline

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

Parameters
_objThe other Vector to compare with

§ setValue()

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

Set Value on the vector.

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

§ setW()

template<typename T>
void etk::Vector4D< T >::setW ( _w)
inline

Set the w value.

Parameters
[in]_wNew value

§ setX()

template<typename T>
void etk::Vector4D< T >::setX ( _x)
inline

Set the x value.

Parameters
[in]_xNew value

§ setY()

template<typename T>
void etk::Vector4D< T >::setY ( _y)
inline

Set the y value.

Parameters
[in]_yNew value

§ setZ()

template<typename T>
void etk::Vector4D< T >::setZ ( _z)
inline

Set the z value.

Parameters
[in]_zNew value

§ setZero()

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

Set 0 value on all the vector.

§ w()

template<typename T>
const T& etk::Vector4D< T >::w ( ) const
inline

Get W value.

Returns
the w value

§ x()

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

Get X value.

Returns
the x value

§ y()

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

Get Y value.

Returns
the y value

§ z()

template<typename T>
const T& etk::Vector4D< T >::z ( ) const
inline

Get Z value.

Returns
the z value

Member Data Documentation

§ m_floats

template<typename T>
T etk::Vector4D< T >::m_floats[4]

all internal values


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