ML Reference
ml::Tvec4< DT > Class Template Reference

A four dimensional vector class for floating point types. More...

#include <mlVector4.h>

Inheritance diagram for ml::Tvec4< DT >:
ml::FloatingPointVector< DT, 4 > ml::FloatingPointVectorDataContainerBase< DT, size >

List of all members.

Public Types

typedef FloatingPointVector
< DT, 4 > 
Superclass
 A typedef as a shorthand for the base class.
typedef DT ComponentType
 A typedef to "export" the type of components.

Public Member Functions

Constructors
 Tvec4 (const DT value=0)
 Default and value constructor. Set all entries to a user given value.
 Tvec4 (const Superclass &v)
 Copy constructor from FloatingPointVector.
 Tvec4 (const DT x, const DT y, const DT z, const DT w)
 Build the vector from the scalars x, y, z and w to the components 0 to 3, respectively.
 Tvec4 (const Tvec2< DT > &v, const DT z, const DT w)
 Cast Vector2 to Tvec4. Set last two entries are given by z and w.
 Tvec4 (const Tvec3< DT > &v, const DT w)
 Cast Vector3 to Tvec4. Set last entry to the passed value w.
void assign (const DT x, const DT y, const DT z, const DT c)
 Set all components to the passed values.
Tvec4< DT > divideByLastComp () const
 Divide all vector components by its last component and return it as Tvec4 which then has a 1 as last component.

Detailed Description

template<class DT>
class ml::Tvec4< DT >

A four dimensional vector class for floating point types.

Definition at line 56 of file mlVector4.h.


Member Typedef Documentation

template<class DT>
typedef DT ml::Tvec4< DT >::ComponentType

A typedef to "export" the type of components.

Reimplemented from ml::FloatingPointVector< DT, 4 >.

Definition at line 63 of file mlVector4.h.

template<class DT>
typedef FloatingPointVector<DT,4> ml::Tvec4< DT >::Superclass

A typedef as a shorthand for the base class.

Definition at line 60 of file mlVector4.h.


Constructor & Destructor Documentation

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const DT  value = 0) [inline, explicit]

Default and value constructor. Set all entries to a user given value.

Definition at line 70 of file mlVector4.h.

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const Superclass v) [inline]

Copy constructor from FloatingPointVector.

This allows the usage of SclarVectorTemplate objects of the same DT in operators using the Tvec4, because the FloatingPointVector objects can implicitly be cast.

Definition at line 78 of file mlVector4.h.

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const DT  x,
const DT  y,
const DT  z,
const DT  w 
) [inline]

Build the vector from the scalars x, y, z and w to the components 0 to 3, respectively.

Definition at line 85 of file mlVector4.h.

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const Tvec2< DT > &  v,
const DT  z,
const DT  w 
) [inline]

Cast Vector2 to Tvec4. Set last two entries are given by z and w.

Definition at line 96 of file mlVector4.h.

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const Tvec3< DT > &  v,
const DT  w 
) [inline]

Cast Vector3 to Tvec4. Set last entry to the passed value w.

Definition at line 107 of file mlVector4.h.


Member Function Documentation

template<class DT>
void ml::Tvec4< DT >::assign ( const DT  x,
const DT  y,
const DT  z,
const DT  c 
) [inline]

Set all components to the passed values.

Definition at line 118 of file mlVector4.h.

template<class DT>
Tvec4<DT> ml::Tvec4< DT >::divideByLastComp ( ) const [inline]

Divide all vector components by its last component and return it as Tvec4 which then has a 1 as last component.

It is useful to scale the vector from homogeneous space to normal space. It's up to the caller to avoid a division by zero if last component is 0.

Definition at line 132 of file mlVector4.h.


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