MeVisLab Toolbox Reference
ml::Tvec4< DT > Class Template Reference

Forward declarations to resolve header file dependencies. More...

#include <mlVector4.h>

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

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 Types inherited from ml::FloatingPointVector< DT, 4 >
enum  
typedef DT ComponentType
 A typedef to 'export' the type of components.

Public Member Functions

Constructors
 Tvec4 (const DT value=0)
 Default and value constructor. Sets all entries to a user given value.
 Tvec4 (const Superclass &v)
 Tvec4 (const DT x, const DT y, const DT z, const DT w)
 Tvec4 (const Tvec2< DT > &v, const DT z, const DT w)
 Casts Vector2 to Tvec4. Sets last two entries are given by z and w.
 Tvec4 (const Tvec3< DT > &v, const DT w)
 Casts Vector3 to Tvec4. Sets last entry to the passed value w.
void assign (const DT x, const DT y, const DT z, const DT c)
 Sets all components to the passed values.
Tvec4< DT > divideByLastComp () const
Public Member Functions inherited from ml::FloatingPointVector< DT, 4 >
 FloatingPointVector (DT value=DT(0))
FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > & operator= (DT value)
 Assignment of scalar value to all components.
bool operator== (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
 Returns whether *this and buffer are component-wise equal.
bool operator!= (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
 Returns whether any components of *this and buffer are not equal.
bool operator< (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
const DT & operator[] (const size_t i) const
DT & operator[] (const size_t i)
size_t getSize () const
 Returns the number of elements of value buffer.
DT norm2 () const
DT norm2 (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &weight) const
DT dot (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
DT normalize ()
DT length () const
 Returns the length of the vector, i.e., norm2().
DT distance (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
 Returns the distance of this vector to a given one.
DT distanceSquared (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &buffer) const
 Returns the squared distance of this vector to a given one.
DT lengthSquared () const
 Returns the squared length of the vector.
DT compSum () const
 Returns the sum of all components.
DT compMul () const
 Returns the product of all vector components.
DT compMaxAbs () const
 Returns the maximum of absolute component values.
void compMin (FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > buffer)
 Sets the component-wise minimum of *this and buffer in *this.
void compMax (FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > buffer)
 Sets the component-wise maximum of *this and buffer in *this.
void compAbs ()
 Kills negative signs from all components.
void compDiv (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &d)
void compSqr ()
 Calculates and sets the square of all components.
void compSqrt ()
void clampMin (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &lower)
void clampMax (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &upper)
void clamp (const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &lower, const FloatingPointVector< DT, size, FloatingPointVectorDataContainerBase< DT, size > > &upper)
void compRound ()
 Rounds all components of this vector using floor(component + 0.5).
void compFloor ()
 Rounds all components of this vector using floor(component).
void compCeil ()
 Rounds all components of this vector to integer using ceil(component).
FloatingPointVector< DT, 3, FloatingPointVectorDataContainerBase< DT, size > > cross (const FloatingPointVector< DT, 3, FloatingPointVectorDataContainerBase< DT, size > > &b) const
 Returns the cross product for elements, i.e., the returned vector is orthogonal to *this and b.
void apply (ML_LA_FROM_DOUBLE_TO_DOUBLE f)
 Applies the function f to each component starting from index 0 to index size-1.
std::ostream & writeOut (std::ostream &os) const
std::istream & readIn (std::istream &is)
 Reads all components from istream is starting starting from index 0 to size-1.

Additional Inherited Members

Protected Attributes inherited from ml::FloatingPointVectorDataContainerBase< DT, size >
DT _buffer [size]

Detailed Description

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

Forward declarations to resolve header file dependencies.

A four dimensional vector class for floating point types.

Definition at line 49 of file mlVector4.h.

Member Typedef Documentation

◆ ComponentType

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

A typedef to 'export' the type of components.

Definition at line 57 of file mlVector4.h.

◆ Superclass

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

A typedef as a shorthand for the base class.

Definition at line 54 of file mlVector4.h.

Constructor & Destructor Documentation

◆ Tvec4() [1/5]

template<class DT>
ml::Tvec4< DT >::Tvec4 ( const DT value = 0)
inlineexplicit

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

Definition at line 64 of file mlVector4.h.

◆ Tvec4() [2/5]

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, as the FloatingPointVector objects can implicitly be cast.

Definition at line 71 of file mlVector4.h.

◆ Tvec4() [3/5]

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

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

Definition at line 77 of file mlVector4.h.

◆ Tvec4() [4/5]

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

Casts Vector2 to Tvec4. Sets last two entries are given by z and w.

Definition at line 86 of file mlVector4.h.

◆ Tvec4() [5/5]

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

Casts Vector3 to Tvec4. Sets last entry to the passed value w.

Definition at line 95 of file mlVector4.h.

Member Function Documentation

◆ assign()

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

Sets all components to the passed values.

Definition at line 104 of file mlVector4.h.

◆ divideByLastComp()

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

Divides all vector components by its last component and returns 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 is up to the caller to avoid a division by zero if last component is 0.

Definition at line 116 of file mlVector4.h.


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