Kindr
Kinematics and Dynamics for Robotics
kindr::VectorBase< Derived_ > Class Template Reference

Interface for a vector. More...

#include <VectorBase.hpp>

Public Types

typedef internal::get_scalar< Derived_ >::Scalar Scalar
 The primitive type of a vector coordinate. More...
 

Public Member Functions

 VectorBase ()=default
 Default constructor. More...
 
 VectorBase (const Derived_ &)=delete
 Constructor from derived vector. More...
 
 operator Derived_ & ()
 Gets the derived vector. (only for advanced users) More...
 
 operator const Derived_ & () const
 Gets the derived vector. (only for advanced users) More...
 
const Derived_ & derived () const
 Gets the derived vector. (only for advanced users) More...
 
Derived_ & setZero ()
 Sets the vector to zero. More...
 
Derived_ & setRandom ()
 Sets the vector to random. More...
 
Scalar operator() (int index) const
 Accesses an entry of the vector. More...
 
Scalaroperator() (int index)
 Accesses an entry of the vector. More...
 
template<typename Output_ , int DimensionOutput_>
Output_ getHead () const
 Get the head of the vector (copy) More...
 
template<typename Output_ , int DimensionOutput_>
Output_ getTail () const
 Get the tail of the vector (copy) More...
 
template<typename Output_ , int Start_, int DimensionOutput_>
Output_ getSegment () const
 Get a segment of the vector (copy) More...
 
Derived_ operator+ (const VectorBase< Derived_ > &other) const
 Addition of two vectors. More...
 
Derived_ operator- (const VectorBase< Derived_ > &other) const
 Subtraction of two vectors. More...
 
template<typename PrimTypeFactor_ >
Derived_ operator* (PrimTypeFactor_ factor) const
 Multiplies vector with a scalar. More...
 
template<typename PrimTypeDivisor_ >
Derived_ operator/ (PrimTypeDivisor_ divisor) const
 Divides vector by a scalar. More...
 
Derived_ & operator+= (const VectorBase< Derived_ > &other)
 Addition and assignment of two vectors. More...
 
Derived_ & operator-= (const VectorBase< Derived_ > &other)
 Subtraction and assignment of two vectors. More...
 
template<typename PrimTypeFactor_ >
Derived_ & operator*= (PrimTypeFactor_ factor)
 Multiplication with a scalar and assignment. More...
 
template<typename PrimTypeDivisor_ >
Derived_ & operator/= (PrimTypeDivisor_ divisor)
 Division by a scalar and assignment. More...
 
Derived_ operator- () const
 Negation of a vector. More...
 
bool operator== (const VectorBase< Derived_ > &other) const
 Comparison operator. More...
 
bool operator!= (const VectorBase< Derived_ > &other) const
 Comparison operator. More...
 
bool isSimilarTo (const VectorBase< Derived_ > &other, Scalar tol) const
 Comparison function. More...
 
Scalar norm () const
 Norm of the vector. More...
 
Derived_ & normalize ()
 Normalizes the vector. More...
 
Derived_ normalized () const
 Get a normalized version of the vector. More...
 
Scalar dot (const VectorBase< Derived_ > &other) const
 Dot product with other vector. More...
 
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ cross (const VectorBase< OtherDerived_ > &other) const
 Cross product with other vector. More...
 
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ elementwiseMultiplication (const VectorBase< OtherDerived_ > &other) const
 Elementwise product with other vector. More...
 
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ elementwiseDivision (const VectorBase< OtherDerived_ > &other) const
 Elementwise product with other vector. More...
 
Derived_ abs () const
 Absolute components. More...
 
Scalar max () const
 Maximum of the components. More...
 
Scalar min () const
 Minimum of the components. More...
 
Scalar sum () const
 Sum of the components. More...
 
Scalar mean () const
 Mean of the components. More...
 

Static Public Member Functions

static Derived_ Zero ()
 Get zero element. More...
 
static Derived_ Random ()
 Get random element. More...
 

Static Public Attributes

static constexpr int Dimension = internal::get_dimension<Derived_>::Dimension
 The dimension of the vector. More...
 

Detailed Description

template<typename Derived_>
class kindr::VectorBase< Derived_ >

Interface for a vector.

This class defines the generic interface for a vector. More precisely an interface to store and access the coordinates of a vector of a point is provided.

Template Parameters
Derived_the derived class that should implement the vector.

Definition at line 71 of file VectorBase.hpp.

Member Typedef Documentation

template<typename Derived_>
typedef internal::get_scalar<Derived_>::Scalar kindr::VectorBase< Derived_ >::Scalar

The primitive type of a vector coordinate.

Definition at line 75 of file VectorBase.hpp.

Constructor & Destructor Documentation

template<typename Derived_>
kindr::VectorBase< Derived_ >::VectorBase ( )
default

Default constructor.

Creates a vector with zero coefficients.

template<typename Derived_>
kindr::VectorBase< Derived_ >::VectorBase ( const Derived_ &  )
delete

Constructor from derived vector.

This constructor has been deleted because the abstract class does not contain any data.

Member Function Documentation

template<typename Derived_>
Derived_ kindr::VectorBase< Derived_ >::abs ( ) const

Absolute components.

Returns
absolute components.
template<typename Derived_>
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ kindr::VectorBase< Derived_ >::cross ( const VectorBase< OtherDerived_ > &  other) const

Cross product with other vector.

Returns
cross product.
template<typename Derived_>
const Derived_& kindr::VectorBase< Derived_ >::derived ( ) const
inline

Gets the derived vector. (only for advanced users)

Returns
the derived vector

Definition at line 113 of file VectorBase.hpp.

template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::dot ( const VectorBase< Derived_ > &  other) const

Dot product with other vector.

Returns
dot product.
template<typename Derived_>
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ kindr::VectorBase< Derived_ >::elementwiseDivision ( const VectorBase< OtherDerived_ > &  other) const

Elementwise product with other vector.

Parameters
otherother vector
Returns
elementwise product.
template<typename Derived_>
template<typename ReturnDerived_ , typename OtherDerived_ >
ReturnDerived_ kindr::VectorBase< Derived_ >::elementwiseMultiplication ( const VectorBase< OtherDerived_ > &  other) const

Elementwise product with other vector.

Parameters
otherother vector
Returns
elementwise product.
template<typename Derived_>
template<typename Output_ , int DimensionOutput_>
Output_ kindr::VectorBase< Derived_ >::getHead ( ) const

Get the head of the vector (copy)

Returns
the head of the vector (copy)
template<typename Derived_>
template<typename Output_ , int Start_, int DimensionOutput_>
Output_ kindr::VectorBase< Derived_ >::getSegment ( ) const

Get a segment of the vector (copy)

Returns
a segment of the vector (copy)
template<typename Derived_>
template<typename Output_ , int DimensionOutput_>
Output_ kindr::VectorBase< Derived_ >::getTail ( ) const

Get the tail of the vector (copy)

Returns
the tail of the vector (copy)
template<typename Derived_>
bool kindr::VectorBase< Derived_ >::isSimilarTo ( const VectorBase< Derived_ > &  other,
Scalar  tol 
) const

Comparison function.

Parameters
otherother vector
toltolerance
Returns
true if similar within tolerance
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::max ( ) const

Maximum of the components.

Returns
maximum.
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::mean ( ) const

Mean of the components.

Returns
mean.
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::min ( ) const

Minimum of the components.

Returns
minimum.
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::norm ( ) const

Norm of the vector.

Returns
norm.
template<typename Derived_>
Derived_& kindr::VectorBase< Derived_ >::normalize ( )

Normalizes the vector.

Returns
reference.
template<typename Derived_>
Derived_ kindr::VectorBase< Derived_ >::normalized ( ) const

Get a normalized version of the vector.

Returns
normalized vector.
template<typename Derived_>
kindr::VectorBase< Derived_ >::operator const Derived_ & ( ) const
inline

Gets the derived vector. (only for advanced users)

Returns
the derived vector

Definition at line 105 of file VectorBase.hpp.

template<typename Derived_>
kindr::VectorBase< Derived_ >::operator Derived_ & ( )
inline

Gets the derived vector. (only for advanced users)

Returns
the derived vector

Definition at line 97 of file VectorBase.hpp.

template<typename Derived_>
bool kindr::VectorBase< Derived_ >::operator!= ( const VectorBase< Derived_ > &  other) const

Comparison operator.

Parameters
otherother vector
Returns
true if unequal
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::operator() ( int  index) const

Accesses an entry of the vector.

Returns
A copy of an entry of the vector.
template<typename Derived_>
Scalar& kindr::VectorBase< Derived_ >::operator() ( int  index)

Accesses an entry of the vector.

Returns
A reference to an entry of the vector.
template<typename Derived_>
template<typename PrimTypeFactor_ >
Derived_ kindr::VectorBase< Derived_ >::operator* ( PrimTypeFactor_  factor) const

Multiplies vector with a scalar.

Parameters
factorfactor
Returns
product
template<typename Derived_>
template<typename PrimTypeFactor_ >
Derived_& kindr::VectorBase< Derived_ >::operator*= ( PrimTypeFactor_  factor)

Multiplication with a scalar and assignment.

Parameters
factorfactor
Returns
reference
template<typename Derived_>
Derived_ kindr::VectorBase< Derived_ >::operator+ ( const VectorBase< Derived_ > &  other) const

Addition of two vectors.

Parameters
otherother vector
Returns
sum
template<typename Derived_>
Derived_& kindr::VectorBase< Derived_ >::operator+= ( const VectorBase< Derived_ > &  other)

Addition and assignment of two vectors.

Parameters
otherother vector
Returns
reference
template<typename Derived_>
Derived_ kindr::VectorBase< Derived_ >::operator- ( const VectorBase< Derived_ > &  other) const

Subtraction of two vectors.

Parameters
otherother vector
Returns
difference
template<typename Derived_>
Derived_ kindr::VectorBase< Derived_ >::operator- ( ) const

Negation of a vector.

Returns
negative vector
template<typename Derived_>
Derived_& kindr::VectorBase< Derived_ >::operator-= ( const VectorBase< Derived_ > &  other)

Subtraction and assignment of two vectors.

Parameters
otherother vector
Returns
reference
template<typename Derived_>
template<typename PrimTypeDivisor_ >
Derived_ kindr::VectorBase< Derived_ >::operator/ ( PrimTypeDivisor_  divisor) const

Divides vector by a scalar.

Parameters
divisordivisor
Returns
quotient
template<typename Derived_>
template<typename PrimTypeDivisor_ >
Derived_& kindr::VectorBase< Derived_ >::operator/= ( PrimTypeDivisor_  divisor)

Division by a scalar and assignment.

Parameters
divisordivisor
Returns
reference
template<typename Derived_>
bool kindr::VectorBase< Derived_ >::operator== ( const VectorBase< Derived_ > &  other) const

Comparison operator.

Parameters
otherother vector
Returns
true if equal
template<typename Derived_>
static Derived_ kindr::VectorBase< Derived_ >::Random ( )
static

Get random element.

Returns
random element
template<typename Derived_>
Derived_& kindr::VectorBase< Derived_ >::setRandom ( )

Sets the vector to random.

Returns
reference
template<typename Derived_>
Derived_& kindr::VectorBase< Derived_ >::setZero ( )

Sets the vector to zero.

Returns
reference
template<typename Derived_>
Scalar kindr::VectorBase< Derived_ >::sum ( ) const

Sum of the components.

Returns
sum.
template<typename Derived_>
static Derived_ kindr::VectorBase< Derived_ >::Zero ( )
static

Get zero element.

Returns
zero element

Member Data Documentation

template<typename Derived_>
constexpr int kindr::VectorBase< Derived_ >::Dimension = internal::get_dimension<Derived_>::Dimension
static

The dimension of the vector.

Definition at line 79 of file VectorBase.hpp.


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