All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | Static Public Attributes | Friends | List of all members
ignition::math::Vector4< T > Class Template Reference

T Generic x, y, z, w vector. More...

#include <ignition/math/Vector4.hh>

Public Member Functions

 Vector4 ()
 Constructor. More...
 
 Vector4 (const T &_x, const T &_y, const T &_z, const T &_w)
 Constructor with component values. More...
 
 Vector4 (const Vector4< T > &_v)
 Copy constructor. More...
 
virtual ~Vector4 ()
 Destructor. More...
 
Distance (const Vector4< T > &_pt) const
 Calc distance to the given point. More...
 
bool IsFinite () const
 See if a point is finite (e.g., not nan) More...
 
Length () const
 Returns the length (magnitude) of the vector. More...
 
void Normalize ()
 Normalize the vector length. More...
 
bool operator!= (const Vector4< T > &_pt) const
 Not equal to operator. More...
 
const Vector4< T > operator* (const Vector4< T > &_pt) const
 Multiplication operator. More...
 
const Vector4< T > operator* (const Matrix4< T > &_m) const
 Matrix multiplication operator. More...
 
const Vector4< T > operator* (T _v) const
 Multiplication operators. More...
 
const Vector4< T > & operator*= (const Vector4< T > &_pt)
 Multiplication assignment operator. More...
 
const Vector4< T > & operator*= (T _v)
 Multiplication assignment operator. More...
 
Vector4< T > operator+ (const Vector4< T > &_v) const
 Addition operator. More...
 
const Vector4< T > & operator+= (const Vector4< T > &_v)
 Addition operator. More...
 
Vector4< T > operator- (const Vector4< T > &_v) const
 Subtraction operator. More...
 
const Vector4< T > & operator-= (const Vector4< T > &_v)
 Subtraction assigment operators. More...
 
const Vector4< T > operator/ (const Vector4< T > &_v) const
 Division assignment operator. More...
 
const Vector4< T > operator/ (T _v) const
 Division assignment operator. More...
 
const Vector4< T > & operator/= (const Vector4< T > &_v)
 Division assignment operator. More...
 
const Vector4< T > & operator/= (T _v)
 Division operator. More...
 
Vector4< T > & operator= (const Vector4< T > &_v)
 Assignment operator. More...
 
Vector4< T > & operator= (T _value)
 Assignment operator. More...
 
bool operator== (const Vector4< T > &_v) const
 Equal to operator. More...
 
operator[] (size_t _index) const
 Array subscript operator. More...
 
void Set (T _x=0, T _y=0, T _z=0, T _w=0)
 Set the contents of the vector. More...
 
SquaredLength () const
 Return the square of the length (magnitude) of the vector. More...
 
W () const
 Get the w value. More...
 
void W (const T &_v)
 Set the w value. More...
 
X () const
 Get the x value. More...
 
void X (const T &_v)
 Set the x value. More...
 
Y () const
 Get the y value. More...
 
void Y (const T &_v)
 Set the y value. More...
 
Z () const
 Get the z value. More...
 
void Z (const T &_v)
 Set the z value. More...
 

Static Public Attributes

static const Vector4< T > One
 math::Vector3(1, 1, 1) More...
 
static const Vector4< T > Zero
 math::Vector3(0, 0, 0) More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const ignition::math::Vector4< T > &_pt)
 Stream insertion operator. More...
 
std::istream & operator>> (std::istream &_in, ignition::math::Vector4< T > &_pt)
 Stream extraction operator. More...
 

Detailed Description

template<typename T>
class ignition::math::Vector4< T >

T Generic x, y, z, w vector.

Constructor & Destructor Documentation

template<typename T>
ignition::math::Vector4< T >::Vector4 ( )
inline

Constructor.

template<typename T>
ignition::math::Vector4< T >::Vector4 ( const T &  _x,
const T &  _y,
const T &  _z,
const T &  _w 
)
inline

Constructor with component values.

Parameters
[in]_xvalue along x axis
[in]_yvalue along y axis
[in]_zvalue along z axis
[in]_wvalue along w axis
template<typename T>
ignition::math::Vector4< T >::Vector4 ( const Vector4< T > &  _v)
inline

Copy constructor.

Parameters
[in]_vvector
template<typename T>
virtual ignition::math::Vector4< T >::~Vector4 ( )
inlinevirtual

Destructor.

Member Function Documentation

template<typename T>
T ignition::math::Vector4< T >::Distance ( const Vector4< T > &  _pt) const
inline

Calc distance to the given point.

Parameters
[in]_ptthe point
Returns
the distance
template<typename T>
bool ignition::math::Vector4< T >::IsFinite ( ) const
inline

See if a point is finite (e.g., not nan)

Returns
true if finite, false otherwise
template<typename T>
T ignition::math::Vector4< T >::Length ( ) const
inline

Returns the length (magnitude) of the vector.

Referenced by ignition::math::Vector4< T >::Normalize().

template<typename T>
void ignition::math::Vector4< T >::Normalize ( )
inline

Normalize the vector length.

References ignition::math::Vector4< T >::Length().

template<typename T>
bool ignition::math::Vector4< T >::operator!= ( const Vector4< T > &  _pt) const
inline

Not equal to operator.

Parameters
[in]_ptthe other vector
Returns
true if each component is equal withing a default tolerence (1e-6), false otherwise
template<typename T>
const Vector4<T> ignition::math::Vector4< T >::operator* ( const Vector4< T > &  _pt) const
inline

Multiplication operator.

Remarks
Performs element wise multiplication, which has limited use.
Parameters
[in]_ptanother vector
Returns
result vector
template<typename T>
const Vector4<T> ignition::math::Vector4< T >::operator* ( const Matrix4< T > &  _m) const
inline

Matrix multiplication operator.

Parameters
[in]_mmatrix
Returns
the vector multiplied by _m
template<typename T>
const Vector4<T> ignition::math::Vector4< T >::operator* ( _v) const
inline

Multiplication operators.

Parameters
[in]_vscaling factor
Returns
a scaled vector
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator*= ( const Vector4< T > &  _pt)
inline

Multiplication assignment operator.

Remarks
Performs element wise multiplication, which has limited use.
Parameters
[in]_pta vector
Returns
this
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator*= ( _v)
inline

Multiplication assignment operator.

Parameters
[in]_vscaling factor
Returns
this
template<typename T>
Vector4<T> ignition::math::Vector4< T >::operator+ ( const Vector4< T > &  _v) const
inline

Addition operator.

Parameters
[in]_vthe vector to add
Returns
a sum vector
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator+= ( const Vector4< T > &  _v)
inline

Addition operator.

Parameters
[in]_vthe vector to add
Returns
this vector
template<typename T>
Vector4<T> ignition::math::Vector4< T >::operator- ( const Vector4< T > &  _v) const
inline

Subtraction operator.

Parameters
[in]_vthe vector to substract
Returns
a vector
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator-= ( const Vector4< T > &  _v)
inline

Subtraction assigment operators.

Parameters
[in]_vthe vector to substract
Returns
this vector
template<typename T>
const Vector4<T> ignition::math::Vector4< T >::operator/ ( const Vector4< T > &  _v) const
inline

Division assignment operator.

Remarks
Performs element wise division, which has limited use.
Parameters
[in]_vthe vector to perform element wise division with
Returns
a result vector
template<typename T>
const Vector4<T> ignition::math::Vector4< T >::operator/ ( _v) const
inline

Division assignment operator.

Remarks
Performs element wise division, which has limited use.
Parameters
[in]_ptanother vector
Returns
a result vector
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator/= ( const Vector4< T > &  _v)
inline

Division assignment operator.

Remarks
Performs element wise division, which has limited use.
Parameters
[in]_vthe vector to perform element wise division with
Returns
this
template<typename T>
const Vector4<T>& ignition::math::Vector4< T >::operator/= ( _v)
inline

Division operator.

Parameters
[in]_vscaling factor
Returns
a vector
template<typename T>
Vector4<T>& ignition::math::Vector4< T >::operator= ( const Vector4< T > &  _v)
inline

Assignment operator.

Parameters
[in]_vthe vector
Returns
a reference to this vector
template<typename T>
Vector4<T>& ignition::math::Vector4< T >::operator= ( _value)
inline

Assignment operator.

Parameters
[in]_value
template<typename T>
bool ignition::math::Vector4< T >::operator== ( const Vector4< T > &  _v) const
inline

Equal to operator.

Parameters
[in]_vthe other vector
Returns
true if each component is equal withing a default tolerence (1e-6), false otherwise

References ignition::math::equal().

template<typename T>
T ignition::math::Vector4< T >::operator[] ( size_t  _index) const
inline

Array subscript operator.

Parameters
[in]_indexThe index, where 0 == x, 1 == y, 2 == z, 3 == w.
Returns
The value. Throws an IndexException if _index is out of bounds.
Exceptions
IndexExceptionif _index is >= 4.
template<typename T>
void ignition::math::Vector4< T >::Set ( _x = 0,
_y = 0,
_z = 0,
_w = 0 
)
inline

Set the contents of the vector.

Parameters
[in]_xvalue along x axis
[in]_yvalue along y axis
[in]_zvalue along z axis
[in]_wvalue along w axis
template<typename T>
T ignition::math::Vector4< T >::SquaredLength ( ) const
inline

Return the square of the length (magnitude) of the vector.

Returns
the length
template<typename T>
T ignition::math::Vector4< T >::W ( ) const
inline

Get the w value.

Returns
The w component of the vector
template<typename T>
void ignition::math::Vector4< T >::W ( const T &  _v)
inline

Set the w value.

Parameters
[in]_vValue for the w component.
template<typename T>
T ignition::math::Vector4< T >::X ( ) const
inline

Get the x value.

Returns
The x component of the vector
template<typename T>
void ignition::math::Vector4< T >::X ( const T &  _v)
inline

Set the x value.

Parameters
[in]_vValue for the x component.
template<typename T>
T ignition::math::Vector4< T >::Y ( ) const
inline

Get the y value.

Returns
The y component of the vector
template<typename T>
void ignition::math::Vector4< T >::Y ( const T &  _v)
inline

Set the y value.

Parameters
[in]_vValue for the y component.
template<typename T>
T ignition::math::Vector4< T >::Z ( ) const
inline

Get the z value.

Returns
The z component of the vector
template<typename T>
void ignition::math::Vector4< T >::Z ( const T &  _v)
inline

Set the z value.

Parameters
[in]_vValue for the z component.

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  _out,
const ignition::math::Vector4< T > &  _pt 
)
friend

Stream insertion operator.

Parameters
[in]_outoutput stream
[in]_ptVector4 to output
Returns
The stream
template<typename T>
std::istream& operator>> ( std::istream &  _in,
ignition::math::Vector4< T > &  _pt 
)
friend

Stream extraction operator.

Parameters
[in]_ininput stream
[in]_ptVector4 to read values into
Returns
the stream

Member Data Documentation

template<typename T>
const Vector4< T > ignition::math::Vector4< T >::One
static

math::Vector3(1, 1, 1)

template<typename T>
const Vector4< T > ignition::math::Vector4< T >::Zero
static

math::Vector3(0, 0, 0)


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