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

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

#include <mlVector3.h>

Inheritance diagram for ml::Tvec3< DT >:
ml::FloatingPointVector< DT, 3, Vector3DataContainer< DT > > ml::Vector3DataContainer< DT >

List of all members.

Public Types

typedef FloatingPointVector
< DT, 3, Vector3DataContainer
< 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

void assign (const DT px, const DT py, const DT pz)
 Set all components to the passed values.
Tvec3< DT > divideByLastComp () const
 Divide all vector components by its last component and return it as Tvec3 which then has a 1 as last component.
Tvec4< DT > affineVec () const
 Build a homogeneous Tvec4 vector from *this and return it, i.e.
Tvec4< DT > affinePoint () const
 Build a homogeneous Tvec4 point from *this and return it, i.e.
Constructors
 Tvec3 (const DT value=0)
 Default and value constructor.
 Tvec3 (const Superclass &v)
 Copy constructor from FloatingPointVector.
 Tvec3 (const DT px, const DT py, const DT pz)
 Constructor building the vector x (first entry), y (second entry) and z (third entry).
 Tvec3 (const Tvec2< DT > &v, const DT pz)
 Build a Tvec3 from a Tvec2 and a scalar. Set third entry to user given value z.
 Tvec3 (const Tvec4< DT > &v, const bool normalizeV)
 Cast a Tvec4 v to Tvec3.
 Tvec3 (const Tvec4< DT > &v, const int axis)
 Cast a Tvec4 v to Tvec3.
Deprecated
void Set (const DT px, const DT py, const DT pz)

Detailed Description

template<class DT>
class ml::Tvec3< DT >

A three dimensional vector class for floating point types.

Definition at line 65 of file mlVector3.h.


Member Typedef Documentation

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

A typedef to "export" the type of components.

Reimplemented from ml::FloatingPointVector< DT, 3, Vector3DataContainer< DT > >.

Definition at line 74 of file mlVector3.h.

template<class DT>
typedef FloatingPointVector<DT, 3, Vector3DataContainer<DT> > ml::Tvec3< DT >::Superclass

A typedef as a shorthand for the base class.

Definition at line 71 of file mlVector3.h.


Constructor & Destructor Documentation

template<class DT>
ml::Tvec3< DT >::Tvec3 ( 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 82 of file mlVector3.h.

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

Copy constructor from FloatingPointVector.

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

Definition at line 90 of file mlVector3.h.

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

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

Definition at line 97 of file mlVector3.h.

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

Build a Tvec3 from a Tvec2 and a scalar. Set third entry to user given value z.

Definition at line 107 of file mlVector3.h.

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

Cast a Tvec4 v to Tvec3.

If normalize is true then the first three 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 three components are taken unchanged.

Definition at line 121 of file mlVector3.h.

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

Cast a Tvec4 v to Tvec3.

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

Definition at line 156 of file mlVector3.h.


Member Function Documentation

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

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

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

Definition at line 231 of file mlVector3.h.

Referenced by ml::operator*(), and ml::Tmat4< MLdouble >::transformPoint().

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

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

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

Definition at line 222 of file mlVector3.h.

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

Set all components to the passed values.

Definition at line 186 of file mlVector3.h.

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

Divide all vector components by its last component and return it as Tvec3 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 199 of file mlVector3.h.

template<class DT>
void ml::Tvec3< DT >::Set ( const DT  px,
const DT  py,
const DT  pz 
) [inline]
Deprecated:
Use assign() instead.

For compatibility with SMLVec3f.

Definition at line 243 of file mlVector3.h.


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