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

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

#include <mlVector2.h>

Inheritance diagram for ml::Tvec2< DT >:
ml::FloatingPointVector< DT, 2, Vector2DataContainer< DT > > ml::Vector2DataContainer< DT >

List of all members.

Public Types

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

Public Member Functions

Tvec3< DT > affineVec () const
 Build a homogeneous Tvec3vector from *this and return it, i.e.
Tvec3< DT > affinePoint () const
 Build a homogeneous Tvec3point from *this and return it, i.e.
Constructors
 Tvec2 (const DT value=0)
 Default and value constructor.
 Tvec2 (const Superclass &v)
 Copy constructor from FloatingPointVector.
 Tvec2 (const DT px, const DT py)
 Constructor building the vector x (first entry) and y (second entry).
void assign (const DT px, const DT py)
 Set all components to the passed values.
 Tvec2 (const Tvec3< DT > &v, const bool normalize)
 Cast v to Tvec2.
 Tvec2 (const Tvec3< DT > &v, const int axis)
 Cast v3 to v2.

Detailed Description

template<class DT>
class ml::Tvec2< DT >

A two dimensional vector class for floating point types.

Definition at line 57 of file mlVector2.h.


Member Typedef Documentation

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

A typedef to "export" the type of components.

Reimplemented from ml::FloatingPointVector< DT, 2, Vector2DataContainer< DT > >.

Definition at line 64 of file mlVector2.h.

template<class DT>
typedef FloatingPointVector<DT, 2, Vector2DataContainer<DT> > ml::Tvec2< DT >::Superclass

A typedef as a shorthand for the base class.

Definition at line 61 of file mlVector2.h.


Constructor & Destructor Documentation

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

Default and value constructor.

Set all entries to a user given value. value is the init value for all entries. 0 is the default value.

Definition at line 72 of file mlVector2.h.

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

Copy constructor from FloatingPointVector.

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

Definition at line 80 of file mlVector2.h.

template<class DT>
ml::Tvec2< DT >::Tvec2 ( const DT  px,
const DT  py 
) [inline]

Constructor building the vector x (first entry) and y (second entry).

Definition at line 86 of file mlVector2.h.

template<class DT>
ml::Tvec2< DT >::Tvec2 ( const Tvec3< DT > &  v,
const bool  normalize 
) [inline]

Cast v to Tvec2.

If normalize is true then the first two components are divided by the last one to implement a homogeneous cast. In that case it is up to the caller to avoid a division by zero. If normalize if false then the first two components are taken unchanged.

Definition at line 106 of file mlVector2.h.

template<class DT>
ml::Tvec2< DT >::Tvec2 ( const Tvec3< DT > &  v,
const int  axis 
) [inline]

Cast v3 to v2.

axis specifies component to be thrown away. All other components are copied sequentially. If axis is not within [0,2] then the last component is thrown away.

Definition at line 129 of file mlVector2.h.


Member Function Documentation

template<class DT>
Tvec3<DT> ml::Tvec2< DT >::affinePoint ( ) const [inline]

Build a homogeneous Tvec3point from *this and return it, i.e.

leave all components unchanged and set the third component to 1.

Definition at line 155 of file mlVector2.h.

template<class DT>
Tvec3<DT> ml::Tvec2< DT >::affineVec ( ) const [inline]

Build a homogeneous Tvec3vector from *this and return it, i.e.

leave all components unchanged and set the third component to 0.

Definition at line 146 of file mlVector2.h.

template<class DT>
void ml::Tvec2< DT >::assign ( const DT  px,
const DT  py 
) [inline]

Set all components to the passed values.

Definition at line 94 of file mlVector2.h.


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