LinearAlgebra
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Public Attributes | List of all members
a3d::Vector4< T, M > Struct Template Reference

A vector of four values for 3d calculations in homogeneous coordinates. More...

Collaboration diagram for a3d::Vector4< T, M >:
Collaboration graph
[legend]

Public Member Functions

 Vector4 ()
 Creates an uninitialized vector. More...
 
 Vector4 (int i)
 Creates a vector initialized to [ 0 0 0 1 ]. More...
 
 Vector4 (T x, T y, T z, T s)
 Creates a vector with the specified values. More...
 
 Vector4 (const float *va)
 Copies a float array vector. More...
 
template<class T2 , class M2 >
 Vector4 (const Vector4< T2, M2 > &x)
 Copies the specified vector. More...
 
template<class T2 , class M2 >
 Vector4 (const Vector3< T2, M2 > &x)
 Casts from non-homogeneous coordinates. More...
 
Vector4< T, M > & operator= (const Vector4< T, M > &o)
 Copy operator. More...
 
template<class T2 , class M2 >
Vector4< T, M > & operator= (const Vector4< T2, M2 > &o)
 Copy operator. More...
 
Vector4< T, M > & operator= (const float *va)
 Copies a float array vector. More...
 
Vector4< T, M > operator- () const
 Negates the vector. More...
 
Vector4< T, M > hsv2rgb () const
 This function treats this vector as a HSVA space color vector and returns it transformed to RGBA color space. More...
 
Vector4< T, M > rgb2hsv () const
 This function treats this vector as a RGBA space color vector and returns it transformed to HSVA color space. More...
 
length () const
 Returns the length of this vector. More...
 
length2 () const
 Returns the square length of this vector. More...
 
 operator const T * () const
 Casts this vector to an array representation. More...
 
 operator T * ()
 Casts this vector to an array representation. More...
 
const T & operator() (int i) const
 Index operator. More...
 
const T & operator[] (int i) const
 Index operator. More...
 
T & operator() (int i)
 Index operator. More...
 
T & operator[] (int i)
 Index operator. More...
 

Public Attributes

v [4]
 

Detailed Description

template<class T, class M = Math<T>>
struct a3d::Vector4< T, M >

A vector of four values for 3d calculations in homogeneous coordinates.

Constructor & Destructor Documentation

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::Vector4 ( )
inline

Creates an uninitialized vector.

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::Vector4 ( int  i)
inlineexplicit

Creates a vector initialized to [ 0 0 0 1 ].

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::Vector4 ( x,
y,
z,
s 
)
inline

Creates a vector with the specified values.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::Vector4 ( const float *  va)
inline

Copies a float array vector.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
template<class T2 , class M2 >
a3d::Vector4< T, M >::Vector4 ( const Vector4< T2, M2 > &  x)
inline

Copies the specified vector.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
template<class T2 , class M2 >
a3d::Vector4< T, M >::Vector4 ( const Vector3< T2, M2 > &  x)
inlineexplicit

Casts from non-homogeneous coordinates.

References a3d::Vector3< T, M >::v, and a3d::Vector4< T, M >::v.

Member Function Documentation

template<class T , class M >
a3d::Vector4< T, M > a3d::Vector4< T, M >::hsv2rgb ( ) const
inline

This function treats this vector as a HSVA space color vector and returns it transformed to RGBA color space.

References a3d::Vector3< T, M >::hsv2rgb().

Here is the call graph for this function:

template<class T, class M = Math<T>>
T a3d::Vector4< T, M >::length ( ) const
inline

Returns the length of this vector.

template<class T, class M = Math<T>>
T a3d::Vector4< T, M >::length2 ( ) const
inline

Returns the square length of this vector.

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::operator const T * ( ) const
inline

Casts this vector to an array representation.

This makes it possible to provide for example a float vector as an array argument in for example OpenGL.

Use like this:

Vector4f c = Vector4f::hsv2rgb( 0.5, 0.5, 0.5, 0.7 );
glColor4fv( (float*)c );

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
a3d::Vector4< T, M >::operator T * ( )
inline

Casts this vector to an array representation.

This makes it possible to provide for example a float vector as an array argument in for example OpenGL. Anything written in the returned array will end up in the vector.

Use like this:

Vector4f c = Vector4f::hsv2rgb( 0.5, 0.5, 0.5, 0.7 );
glColor4fv( (float*)c );

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
const T& a3d::Vector4< T, M >::operator() ( int  i) const
inline

Index operator.

Access element.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
T& a3d::Vector4< T, M >::operator() ( int  i)
inline

Index operator.

Access element.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
Vector4<T,M> a3d::Vector4< T, M >::operator- ( ) const
inline

Negates the vector.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
Vector4<T,M>& a3d::Vector4< T, M >::operator= ( const Vector4< T, M > &  o)
inline

Copy operator.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
template<class T2 , class M2 >
Vector4<T,M>& a3d::Vector4< T, M >::operator= ( const Vector4< T2, M2 > &  o)
inline

Copy operator.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
Vector4<T,M>& a3d::Vector4< T, M >::operator= ( const float *  va)
inline

Copies a float array vector.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
const T& a3d::Vector4< T, M >::operator[] ( int  i) const
inline

Index operator.

Access element.

References a3d::Vector4< T, M >::v.

template<class T, class M = Math<T>>
T& a3d::Vector4< T, M >::operator[] ( int  i)
inline

Index operator.

Access element.

References a3d::Vector4< T, M >::v.

template<class T , class M >
a3d::Vector4< T, M > a3d::Vector4< T, M >::rgb2hsv ( ) const
inline

This function treats this vector as a RGBA space color vector and returns it transformed to HSVA color space.

References a3d::Vector3< T, M >::rgb2hsv().

Here is the call graph for this function:

Member Data Documentation

template<class T, class M = Math<T>>
T a3d::Vector4< T, M >::v[4]