etk::Vector3D< T > Class Template Reference

#include <Vector3D.hpp>

Public Member Functions

 Vector3D ()
 
 Vector3D (const T &_xxx, const T &_yyy, const T &_zzz)
 
Vector3D< T > & operator+= (const Vector3D< T > &_obj)
 
Vector3D< T > operator+ (const Vector3D< T > &_obj)
 
Vector3D< T > & operator-= (const Vector3D< T > &_obj)
 
Vector3D< T > operator- (const Vector3D< T > &_obj)
 
Vector3D< T > & operator*= (const T &_val)
 
Vector3D< T > operator* (const T &_val)
 
Vector3D< T > & operator/= (const Vector3D< T > &_val)
 
Vector3D< T > & operator/= (const T &_val)
 
float dot (const Vector3D< T > &_obj) const
 
float length2 () const
 
float length () const
 
float distance2 (const Vector3D< T > &_obj) const
 
float distance (const Vector3D< T > &_obj) const
 
Vector3D< T > & safeNormalize ()
 
Vector3D< T > & normalize ()
 
Vector3D< T > normalized () const
 
Vector3D< T > rotate (const Vector3D< T > &_wAxis, const float _angle) const
 
float angle (const Vector3D< T > &_obj) const
 
Vector3D< T > absolute () const
 
Vector3D< T > cross (const Vector3D< T > &_obj) const
 
triple (const Vector3D< T > &_obj1, const Vector3D< T > &_obj2) const
 
int32_t minAxis () const
 
int32_t maxAxis () const
 
int32_t furthestAxis () const
 
int32_t closestAxis () const
 
void setInterpolate3 (const Vector3D< T > &_obj0, const Vector3D< T > &_obj1, T _ratio)
 
Vector3D< T > lerp (const Vector3D< T > &_obj, const float &_ratio) const
 
Vector3D< T > & operator*= (const Vector3D< T > &_obj)
 
Vector3D< T > operator* (const Vector3D< T > &_obj)
 
const T & getX () const
 
const T & getY () const
 
const T & getZ () const
 
void setX (T _x)
 
void setY (T _y)
 
void setZ (T _z)
 
const T & x () const
 
const T & y () const
 
const T & z () const
 
 operator T* ()
 
 operator const T * () const
 
bool operator== (const Vector3D< T > &_obj) const
 
bool operator!= (const Vector3D< T > &_obj) const
 
void setMax (const Vector3D< T > &_obj)
 
void setMin (const Vector3D< T > &_obj)
 
void setValue (const T &_xxx, const T &_yyy, const T &_zzz)
 
void getSkewSymmetricMatrix (Vector3D< T > *_obj0, Vector3D< T > *_obj1, Vector3D< T > *_obj2) const
 
void setZero ()
 
bool isZero () const
 

Public Attributes

m_floats [4]
 

Detailed Description

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

Vectorial 3-dimention vector (x/y/z)

Constructor & Destructor Documentation

§ Vector3D() [1/2]

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

No initialization constructor (faster ...)

§ Vector3D() [2/2]

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

Constructor from scalars.

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

Member Function Documentation

§ absolute()

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

Return a vector will the absolute values of each element.

Returns
New vector containing the value

§ angle()

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

Calculate the angle between this and another vector.

Parameters
[in]_objThe other vector
Returns
Angle in radian

§ closestAxis()

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

Return the axis with the largest ABSOLUTE value.

Returns
values 0,1,2 for x, y, or z

§ cross()

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

Return the cross product between this and another vector.

Parameters
[in]_objThe other vector
Returns
Vector with the result of the cross product

§ distance()

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

Return the dot product.

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

§ furthestAxis()

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

Return the axis with the smallest ABSOLUTE value.

Returns
values 0,1,2 for x, y, or z

§ getSkewSymmetricMatrix()

template<typename T>
void etk::Vector3D< T >::getSkewSymmetricMatrix ( Vector3D< T > *  _obj0,
Vector3D< T > *  _obj1,
Vector3D< T > *  _obj2 
) const
inline

Create a skew matrix of the object.

Parameters
[out]_obj0Vector matric first line
[out]_obj1Vector matric second line
[out]_obj2Vector matric third line

§ getX()

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

Get X value.

Returns
the x value

§ getY()

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

Get Y value.

Returns
the y value

§ getZ()

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

Get Z value.

Returns
the z value

§ isZero()

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

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

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

§ length()

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

Get the length of the vector.

Returns
Length value

§ length2()

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

Get the length of the vector squared.

Returns
Squared length value.

§ lerp()

template<typename T>
Vector3D<T> etk::Vector3D< T >::lerp ( const Vector3D< T > &  _obj,
const float &  _ratio 
) const
inline

Return the linear interpolation between this and another vector.

Parameters
[in]_objThe other vector
[in]_ratioThe ratio of this to _obj (_ratio = 0 => return copy of this, _ratio=1 => return other)
Returns
New vector containing the value

§ maxAxis()

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

Return the axis with the largest value.

Returns
values 0,1,2 for x, y, or z

§ minAxis()

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

Return the axis with the smallest value.

Returns
values 0,1,2 for x, y, or z

§ normalize()

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

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

Returns
Local reference of the vector normalized

§ normalized()

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

Return a normalized version of this vector.

Returns
New vector containing the value

§ operator const T *()

template<typename T>
etk::Vector3D< 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::Vector3D< T >::operator T* ( )
inline

Cast the vector in the type T* requested.

Returns
Pointer on the data

§ operator!=()

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

Elementwise multiply this vector by the other.

Parameters
_objThe other vector
Returns
New vector containing the value

§ operator*=() [1/2]

template<typename T>
Vector3D<T>& etk::Vector3D< 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>
Vector3D<T>& etk::Vector3D< T >::operator*= ( const Vector3D< T > &  _obj)
inline

Elementwise multiply this vector by the other.

Parameters
_objThe other vector
Returns
Local reference of the vector normalized

§ operator+()

template<typename T>
Vector3D<T> etk::Vector3D< T >::operator+ ( const Vector3D< 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>
Vector3D<T>& etk::Vector3D< T >::operator+= ( const Vector3D< 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>
Vector3D<T> etk::Vector3D< T >::operator- ( const Vector3D< T > &  _obj)
inline

Subtract a vector from this one.

Parameters
[in]_objThe vector to subtract
Returns
New vector containing the value

§ operator-=()

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

Subtract a vector from this one.

Parameters
[in]_objThe vector to subtract
Returns
Local reference of the vector

§ operator/=() [1/2]

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

Inversely scale the vector.

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

§ operator/=() [2/2]

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

§ rotate()

template<typename T>
Vector3D<T> etk::Vector3D< T >::rotate ( const Vector3D< T > &  _wAxis,
const float  _angle 
) const
inline

Return a rotated version of this vector.

Parameters
[in]_wAxisThe axis to rotate about
[in]_angleThe angle to rotate by
Returns
New vector containing the value

§ safeNormalize()

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

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

Returns
Local reference of the vector normalized

§ setInterpolate3()

template<typename T>
void etk::Vector3D< T >::setInterpolate3 ( const Vector3D< T > &  _obj0,
const Vector3D< T > &  _obj1,
_ratio 
)
inline

Interpolate the vector with a ration between 2 others.

Parameters
[in]_obj0First vector
[in]_obj1Second vector
[in]_ratioRatio between _obj0 and _obj1

§ setMax()

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

Set each element to the max of the current values and the values of another Vector3D<T>

Parameters
_objThe other Vector3D<T> to compare with

§ setMin()

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

Set each element to the min of the current values and the values of another Vector3D<T>

Parameters
_objThe other Vector3D<T> to compare with

§ setValue()

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

Set Value on the vector.

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

§ setX()

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

Set the x value.

Parameters
[in]_xNew value

§ setY()

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

Set the y value.

Parameters
[in]_yNew value

§ setZ()

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

Set the z value.

Parameters
[in]_zNew value

§ setZero()

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

Set 0 value on all the vector.

§ triple()

template<typename T>
T etk::Vector3D< T >::triple ( const Vector3D< T > &  _obj1,
const Vector3D< T > &  _obj2 
) const
inline

Return the triple product between this and another vector and another.

Parameters
[in]_obj1The other vector 1
[in]_obj2The other vector 2
Returns
Value with the result of the triple product

§ x()

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

Get X value.

Returns
the x value

§ y()

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

Get Y value.

Returns
the y value

§ z()

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

Get Z value.

Returns
the z value

Member Data Documentation

§ m_floats

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

all internal values


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