Kindr
Kinematics and Dynamics for Robotics
kindr::Vector< PhysicalType_, PrimType_, Dimension_ > Class Template Reference

Vector in n-dimensional-space. More...

#include <Vector.hpp>

Inheritance diagram for kindr::Vector< PhysicalType_, PrimType_, Dimension_ >:
Inheritance graph

Public Types

typedef PrimType_ Scalar
 The primitive type of the coordinates. More...
 
- Public Types inherited from kindr::VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > >
typedef internal::get_scalar< Vector< PhysicalType_, PrimType_, Dimension_ > >::Scalar Scalar
 The primitive type of a vector coordinate. More...
 

Public Member Functions

template<int DimensionCopy_ = Dimension_>
 Vector (typename std::enable_if< DimensionCopy_ !=DynamicDimension >::type *=nullptr)
 Default constructor for static sized vectors which initializes all components with zero. More...
 
template<int DimensionCopy_ = Dimension_>
 Vector (typename std::enable_if< DimensionCopy_==DynamicDimension >::type *=nullptr)
 Default constructor for dynamic sized vectors. More...
 
template<enum PhysicalType OtherPhysicalType_, typename OtherPrimType_ >
 Vector (const Vector< OtherPhysicalType_, OtherPrimType_, Dimension_ > &other)
 Constructor using other vector with generic type. More...
 
template<int DimensionOther_, int DimensionCopy_ = Dimension_>
 Vector (const Vector< PhysicalType_, PrimType_, DimensionOther_ > &other, typename std::enable_if< DimensionCopy_==DynamicDimension >::type *=nullptr)
 Constructor of a dynamic vector using a static vector. More...
 
 Vector (const Implementation &other)
 Constructor using Eigen::Matrix. More...
 
template<int DimensionCopy_ = Dimension_>
 Vector (Scalar x, Scalar y, Scalar z, typename std::enable_if< DimensionCopy_==3 >::type *=nullptr)
 Constructor using three scalars. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & setZero ()
 Sets all components of the vector to zero. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & setRandom ()
 Sets all components of the vector to random. More...
 
template<int DimensionOutput_>
Vector< PhysicalType_, PrimType_, DimensionOutput_ > getHead () const
 Get the head of the vector (copy) More...
 
Vector< PhysicalType_, PrimType_, DynamicDimensiongetHead (int length) const
 Get the head of the vector (copy) More...
 
template<int DimensionOutput_>
Vector< PhysicalType_, PrimType_, DimensionOutput_ > getTail () const
 Get the tail of the vector (copy) More...
 
Vector< PhysicalType_, PrimType_, DynamicDimensiongetTail (int length) const
 Get the tail of the vector (copy) More...
 
template<int DimensionOutput_>
Vector< PhysicalType_, PrimType_, DimensionOutput_ > getSegment (int start) const
 Get a segment of the vector (copy) More...
 
Vector< PhysicalType_, PrimType_, DynamicDimensiongetSegment (int start, int length) const
 Get a segment of the vector (copy) More...
 
template<int DimensionInput_>
void setHead (const Vector< PhysicalType_, PrimType_, DimensionInput_ > &input)
 Set the head of the vector. More...
 
template<int DimensionInput_>
void setTail (const Vector< PhysicalType_, PrimType_, DimensionInput_ > &input)
 Set the tail of the vector. More...
 
template<int DimensionInput_>
void setSegment (int start, const Vector< PhysicalType_, PrimType_, DimensionInput_ > &input)
 Set a segment of the vector. More...
 
template<int DimensionCopy_ = Dimension_>
Scalar x (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr) const
 Get x-coordinate of the vector (copy) More...
 
template<int DimensionCopy_ = Dimension_>
Scalarx (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr)
 Get x-coordinate of the vector (reference) More...
 
template<int DimensionCopy_ = Dimension_>
Scalar y (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr) const
 Get y-coordinate of the vector (copy) More...
 
template<int DimensionCopy_ = Dimension_>
Scalary (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr)
 Get y-coordinate of the vector (reference) More...
 
template<int DimensionCopy_ = Dimension_>
Scalar z (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr) const
 Get z-coordinate of the vector (copy) More...
 
template<int DimensionCopy_ = Dimension_>
Scalarz (typename std::enable_if< DimensionCopy_==3 >::type *=nullptr)
 Get z-coordinate of the vector (reference) More...
 
ImplementationtoImplementation ()
 Cast to the implementation type. More...
 
const ImplementationtoImplementation () const
 Cast to the implementation type. More...
 
Implementationvector ()
 Cast to Eigen::Matrix<PrimType_, Dimension_, 1>. More...
 
const Implementationvector () const
 Cast to Eigen::Matrix<PrimType_, Dimension_, 1>. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator= (const Vector< PhysicalType_, PrimType_, Dimension_ > &other)
 Assignment operator. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator+ (const Vector< PhysicalType_, PrimType_, Dimension_ > &other) const
 Addition of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator- (const Vector< PhysicalType_, PrimType_, Dimension_ > &other) const
 Subtraction of two vectors. More...
 
template<typename PrimTypeFactor_ >
Vector< PhysicalType_, PrimType_, Dimension_ > operator* (PrimTypeFactor_ factor) const
 Multiplies vector with a scalar. More...
 
template<typename PrimTypeDivisor_ >
Vector< PhysicalType_, PrimType_, Dimension_ > operator/ (PrimTypeDivisor_ divisor) const
 Divides vector by a scalar. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator+= (const Vector< PhysicalType_, PrimType_, Dimension_ > &other)
 Addition and assignment of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator-= (const Vector< PhysicalType_, PrimType_, Dimension_ > &other)
 Subtraction and assignment of two vectors. More...
 
template<typename PrimTypeFactor_ >
Vector< PhysicalType_, PrimType_, Dimension_ > & operator*= (PrimTypeFactor_ factor)
 Multiplication with a scalar and assignment. More...
 
template<typename PrimTypeDivisor_ >
Vector< PhysicalType_, PrimType_, Dimension_ > & operator/= (PrimTypeDivisor_ divisor)
 Division by a scalar and assignment. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator- () const
 Negation of a vector. More...
 
bool operator== (const Vector< PhysicalType_, PrimType_, Dimension_ > &other) const
 Comparison operator. More...
 
bool operator!= (const Vector< PhysicalType_, PrimType_, Dimension_ > &other) const
 Comparison operator. More...
 
bool isSimilarTo (const Vector< PhysicalType_, PrimType_, Dimension_ > &other, Scalar tol) const
 Comparison function. More...
 
Scalar norm () const
 Norm of the vector. More...
 
Scalar squaredNorm () const
 Squared norm of the vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & normalize ()
 Normalizes the vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > normalized () const
 Get a normalized version of the vector. More...
 
template<enum PhysicalType PhysicalTypeOther_>
Scalar dot (const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &other) const
 Dot product with other vector. More...
 
template<enum PhysicalType PhysicalTypeOther_, int DimensionCopy_ = Dimension_>
internal::MultiplicationReturnTypeTrait< Vector< PhysicalType_, PrimType_, Dimension_ >, Vector< PhysicalTypeOther_, PrimType_, Dimension_ > >::ReturnType cross (const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &other, typename std::enable_if< DimensionCopy_==3 >::type *=nullptr) const
 Cross product with other vector. More...
 
template<enum PhysicalType PhysicalTypeOther_>
Vector< PhysicalType_, PrimType_, Dimension_ > projectOn (const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &other) const
 Projects this vector (a) on the other vector (b). The result is proj = b/|b| * |a| * cos(angle) = b/|b| * |a| * a.b / |a| / |b|, which is computed by a.b proj = ----— * a |a|*|a|. More...
 
template<enum PhysicalType PhysicalTypeOther_>
internal::MultiplicationReturnTypeTrait< Vector< PhysicalType_, PrimType_, Dimension_ >, Vector< PhysicalTypeOther_, PrimType_, Dimension_ > >::ReturnType elementwiseMultiplication (const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &other) const
 Elementwise product with other vector. More...
 
template<enum PhysicalType PhysicalTypeOther_>
internal::DivisionReturnTypeTrait< Vector< PhysicalType_, PrimType_, Dimension_ >, Vector< PhysicalTypeOther_, PrimType_, Dimension_ > >::ReturnType elementwiseDivision (const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &other) const
 Elementwise division by other vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > 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...
 
- Public Member Functions inherited from kindr::VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > >
 VectorBase ()=default
 Default constructor. More...
 
 VectorBase (const Vector< PhysicalType_, PrimType_, Dimension_ > &)=delete
 Constructor from derived vector. More...
 
 operator Vector< PhysicalType_, PrimType_, Dimension_ > & ()
 Gets the derived vector. (only for advanced users) More...
 
 operator const Vector< PhysicalType_, PrimType_, Dimension_ > & () const
 Gets the derived vector. (only for advanced users) More...
 
const Vector< PhysicalType_, PrimType_, Dimension_ > & derived () const
 Gets the derived vector. (only for advanced users) More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & setZero ()
 Sets the vector to zero. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & 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...
 
Output_ getHead () const
 Get the head of the vector (copy) More...
 
Output_ getTail () const
 Get the tail of the vector (copy) More...
 
Output_ getSegment () const
 Get a segment of the vector (copy) More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator+ (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other) const
 Addition of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator- (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other) const
 Subtraction of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator- () const
 Negation of a vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator* (PrimTypeFactor_ factor) const
 Multiplies vector with a scalar. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > operator/ (PrimTypeDivisor_ divisor) const
 Divides vector by a scalar. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator+= (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other)
 Addition and assignment of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator-= (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other)
 Subtraction and assignment of two vectors. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator*= (PrimTypeFactor_ factor)
 Multiplication with a scalar and assignment. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & operator/= (PrimTypeDivisor_ divisor)
 Division by a scalar and assignment. More...
 
bool operator== (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other) const
 Comparison operator. More...
 
bool operator!= (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other) const
 Comparison operator. More...
 
bool isSimilarTo (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other, Scalar tol) const
 Comparison function. More...
 
Scalar norm () const
 Norm of the vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > & normalize ()
 Normalizes the vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > normalized () const
 Get a normalized version of the vector. More...
 
Scalar dot (const VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > &other) const
 Dot product with other vector. More...
 
ReturnDerived_ cross (const VectorBase< OtherDerived_ > &other) const
 Cross product with other vector. More...
 
ReturnDerived_ elementwiseMultiplication (const VectorBase< OtherDerived_ > &other) const
 Elementwise product with other vector. More...
 
ReturnDerived_ elementwiseDivision (const VectorBase< OtherDerived_ > &other) const
 Elementwise product with other vector. More...
 
Vector< PhysicalType_, PrimType_, Dimension_ > 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 Vector< PhysicalType_, PrimType_, Dimension_ > Zero ()
 Get zero element. More...
 
static Vector< PhysicalType_, PrimType_, Dimension_ > Random ()
 Get random element. More...
 
static Vector< PhysicalType_, PrimType_, Dimension_ > UnitX ()
 Get the unity vector in x. More...
 
static Vector< PhysicalType_, PrimType_, Dimension_ > UnitY ()
 Get the unity vector in y. More...
 
static Vector< PhysicalType_, PrimType_, Dimension_ > UnitZ ()
 Get the unity vector in z. More...
 
- Static Public Member Functions inherited from kindr::VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > >
static Vector< PhysicalType_, PrimType_, Dimension_ > Zero ()
 Get zero element. More...
 
static Vector< PhysicalType_, PrimType_, Dimension_ > Random ()
 Get random element. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< PrimType_, Dimension_, 1 > Implementation
 The implementation type. More...
 

Static Public Attributes

static constexpr int Dimension = Dimension_
 The dimension of the vector. More...
 
- Static Public Attributes inherited from kindr::VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > >
static constexpr int Dimension
 The dimension of the vector. More...
 

Private Types

typedef VectorBase< Vector< PhysicalType_, PrimType_, Dimension_ > > Base
 The base type. More...
 

Static Private Attributes

static constexpr int DynamicDimension = -1
 The size if the vector has dynamic dimension (must be equal to Eigen::Dynamic). More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Vector< PhysicalType_, PrimType_, Dimension_ > &vector)
 Used for printing the object with std::cout. More...
 

Detailed Description

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
class kindr::Vector< PhysicalType_, PrimType_, Dimension_ >

Vector in n-dimensional-space.

This class implements a vector in n-dimensional-space. More precisely an interface to store and access the coordinates of a vector of a point in n-dimensional-space is provided.

Template Parameters
PhysicalType_Physical type of the vector.
PrimType_Primitive type of the coordinates.
Dimension_Dimension of the vector.

Definition at line 52 of file Vector.hpp.

Member Typedef Documentation

◆ Base

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
typedef VectorBase<Vector<PhysicalType_, PrimType_, Dimension_> > kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Base
private

The base type.

Definition at line 56 of file Vector.hpp.

◆ Scalar

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
typedef PrimType_ kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Scalar

The primitive type of the coordinates.

Definition at line 73 of file Vector.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( typename std::enable_if< DimensionCopy_ !=DynamicDimension >::type *  = nullptr)
inline

Default constructor for static sized vectors which initializes all components with zero.

Definition at line 82 of file Vector.hpp.

◆ Vector() [2/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( typename std::enable_if< DimensionCopy_==DynamicDimension >::type *  = nullptr)
inline

Default constructor for dynamic sized vectors.

Definition at line 89 of file Vector.hpp.

◆ Vector() [3/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType OtherPhysicalType_, typename OtherPrimType_ >
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( const Vector< OtherPhysicalType_, OtherPrimType_, Dimension_ > &  other)
inlineexplicit

Constructor using other vector with generic type.

Parameters
otherVector<OtherPhysicalType_, OtherPrimType_, Dimension_>

Definition at line 97 of file Vector.hpp.

◆ Vector() [4/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionOther_, int DimensionCopy_ = Dimension_>
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( const Vector< PhysicalType_, PrimType_, DimensionOther_ > &  other,
typename std::enable_if< DimensionCopy_==DynamicDimension >::type *  = nullptr 
)
inline

Constructor of a dynamic vector using a static vector.

Parameters
otherVector<OtherPhysicalType_, OtherPrimType_, Dimension_>

Definition at line 105 of file Vector.hpp.

◆ Vector() [5/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( const Implementation other)
inlineexplicit

Constructor using Eigen::Matrix.

Parameters
otherEigen::Matrix<PrimType_,Dimension_,1>

Definition at line 112 of file Vector.hpp.

◆ Vector() [6/6]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Vector ( Scalar  x,
Scalar  y,
Scalar  z,
typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr 
)
inline

Constructor using three scalars.

Parameters
xx-Component
yy-Component
zz-Component

Definition at line 122 of file Vector.hpp.

Member Function Documentation

◆ abs()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::abs ( ) const
inline

Absolute components.

Returns
absolute components.

Definition at line 531 of file Vector.hpp.

◆ cross()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType PhysicalTypeOther_, int DimensionCopy_ = Dimension_>
internal::MultiplicationReturnTypeTrait<Vector<PhysicalType_, PrimType_, Dimension_>, Vector<PhysicalTypeOther_, PrimType_, Dimension_> >::ReturnType kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::cross ( const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &  other,
typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr 
) const
inline

Cross product with other vector.

Parameters
otherother vector
Returns
cross product.

Definition at line 488 of file Vector.hpp.

◆ dot()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType PhysicalTypeOther_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::dot ( const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &  other) const
inline

Dot product with other vector.

Parameters
otherother vector
Returns
dot product.

Definition at line 478 of file Vector.hpp.

◆ elementwiseDivision()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType PhysicalTypeOther_>
internal::DivisionReturnTypeTrait<Vector<PhysicalType_, PrimType_, Dimension_>, Vector<PhysicalTypeOther_, PrimType_, Dimension_> >::ReturnType kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::elementwiseDivision ( const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &  other) const
inline

Elementwise division by other vector.

Parameters
otherother vector
Returns
elementwise quotient.

Definition at line 524 of file Vector.hpp.

◆ elementwiseMultiplication()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType PhysicalTypeOther_>
internal::MultiplicationReturnTypeTrait<Vector<PhysicalType_, PrimType_, Dimension_>, Vector<PhysicalTypeOther_, PrimType_, Dimension_> >::ReturnType kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::elementwiseMultiplication ( const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &  other) const
inline

Elementwise product with other vector.

Parameters
otherother vector
Returns
elementwise product.

Definition at line 514 of file Vector.hpp.

◆ getHead() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionOutput_>
Vector<PhysicalType_, PrimType_, DimensionOutput_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getHead ( ) const
inline

Get the head of the vector (copy)

Returns
the head of the vector (copy)

Definition at line 189 of file Vector.hpp.

◆ getHead() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, DynamicDimension> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getHead ( int  length) const
inline

Get the head of the vector (copy)

Returns
the head of the vector (copy)

Definition at line 196 of file Vector.hpp.

◆ getSegment() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionOutput_>
Vector<PhysicalType_, PrimType_, DimensionOutput_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getSegment ( int  start) const
inline

Get a segment of the vector (copy)

Returns
a segment of the vector (copy)

Definition at line 219 of file Vector.hpp.

◆ getSegment() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, DynamicDimension> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getSegment ( int  start,
int  length 
) const
inline

Get a segment of the vector (copy)

Returns
a segment of the vector (copy)

Definition at line 226 of file Vector.hpp.

◆ getTail() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionOutput_>
Vector<PhysicalType_, PrimType_, DimensionOutput_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getTail ( ) const
inline

Get the tail of the vector (copy)

Returns
the tail of the vector (copy)

Definition at line 204 of file Vector.hpp.

◆ getTail() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, DynamicDimension> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::getTail ( int  length) const
inline

Get the tail of the vector (copy)

Returns
the tail of the vector (copy)

Definition at line 211 of file Vector.hpp.

◆ isSimilarTo()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
bool kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::isSimilarTo ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other,
Scalar  tol 
) const
inline

Comparison function.

Parameters
otherother vector
toltolerance
Returns
true if similar within tolerance

Definition at line 436 of file Vector.hpp.

◆ max()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::max ( ) const
inline

Maximum of the components.

Returns
maximum.

Definition at line 538 of file Vector.hpp.

◆ mean()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::mean ( ) const
inline

Mean of the components.

Returns
mean.

Definition at line 559 of file Vector.hpp.

◆ min()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::min ( ) const
inline

Minimum of the components.

Returns
minimum.

Definition at line 545 of file Vector.hpp.

◆ norm()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::norm ( ) const
inline

Norm of the vector.

Returns
norm.

Definition at line 447 of file Vector.hpp.

◆ normalize()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::normalize ( )
inline

Normalizes the vector.

Returns
reference.

Definition at line 461 of file Vector.hpp.

◆ normalized()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::normalized ( ) const
inline

Get a normalized version of the vector.

Returns
normalized vector.

Definition at line 469 of file Vector.hpp.

◆ operator!=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
bool kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator!= ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other) const
inline

Comparison operator.

Parameters
otherother vector
Returns
true if unequal

Definition at line 427 of file Vector.hpp.

◆ operator*()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<typename PrimTypeFactor_ >
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator* ( PrimTypeFactor_  factor) const
inline

Multiplies vector with a scalar.

Parameters
factorfactor
Returns
product

Definition at line 357 of file Vector.hpp.

◆ operator*=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<typename PrimTypeFactor_ >
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator*= ( PrimTypeFactor_  factor)
inline

Multiplication with a scalar and assignment.

Parameters
factorfactor
Returns
reference

Definition at line 393 of file Vector.hpp.

◆ operator+()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator+ ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other) const
inline

Addition of two vectors.

Parameters
otherother vector
Returns
sum

Definition at line 340 of file Vector.hpp.

◆ operator+=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator+= ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other)
inline

Addition and assignment of two vectors.

Parameters
otherother vector
Returns
reference

Definition at line 374 of file Vector.hpp.

◆ operator-() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator- ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other) const
inline

Subtraction of two vectors.

Parameters
otherother vector
Returns
difference

Definition at line 348 of file Vector.hpp.

◆ operator-() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator- ( ) const
inline

Negation of a vector.

Returns
negative vector

Definition at line 411 of file Vector.hpp.

◆ operator-=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator-= ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other)
inline

Subtraction and assignment of two vectors.

Parameters
otherother vector
Returns
reference

Definition at line 383 of file Vector.hpp.

◆ operator/()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<typename PrimTypeDivisor_ >
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator/ ( PrimTypeDivisor_  divisor) const
inline

Divides vector by a scalar.

Parameters
divisordivisor
Returns
quotient

Definition at line 366 of file Vector.hpp.

◆ operator/=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<typename PrimTypeDivisor_ >
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator/= ( PrimTypeDivisor_  divisor)
inline

Division by a scalar and assignment.

Parameters
divisordivisor
Returns
reference

Definition at line 403 of file Vector.hpp.

◆ operator=()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator= ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other)
inline

Assignment operator.

Parameters
otherother vector
Returns
reference

Definition at line 331 of file Vector.hpp.

◆ operator==()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
bool kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::operator== ( const Vector< PhysicalType_, PrimType_, Dimension_ > &  other) const
inline

Comparison operator.

Parameters
otherother vector
Returns
true if equal

Definition at line 419 of file Vector.hpp.

◆ projectOn()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<enum PhysicalType PhysicalTypeOther_>
Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::projectOn ( const Vector< PhysicalTypeOther_, PrimType_, Dimension_ > &  other) const
inline

Projects this vector (a) on the other vector (b). The result is proj = b/|b| * |a| * cos(angle) = b/|b| * |a| * a.b / |a| / |b|, which is computed by a.b proj = ----— * a |a|*|a|.

Parameters
otherother vector
Returns
projected vector.

Definition at line 503 of file Vector.hpp.

◆ Random()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
static Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Random ( )
inlinestatic

Get random element.

Returns
random element

Definition at line 144 of file Vector.hpp.

◆ setHead()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionInput_>
void kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::setHead ( const Vector< PhysicalType_, PrimType_, DimensionInput_ > &  input)
inline

Set the head of the vector.

Definition at line 233 of file Vector.hpp.

◆ setRandom()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::setRandom ( )
inline

Sets all components of the vector to random.

Returns
reference

Definition at line 151 of file Vector.hpp.

◆ setSegment()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionInput_>
void kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::setSegment ( int  start,
const Vector< PhysicalType_, PrimType_, DimensionInput_ > &  input 
)
inline

Set a segment of the vector.

Definition at line 247 of file Vector.hpp.

◆ setTail()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionInput_>
void kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::setTail ( const Vector< PhysicalType_, PrimType_, DimensionInput_ > &  input)
inline

Set the tail of the vector.

Definition at line 240 of file Vector.hpp.

◆ setZero()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Vector<PhysicalType_, PrimType_, Dimension_>& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::setZero ( )
inline

Sets all components of the vector to zero.

Returns
reference

Definition at line 136 of file Vector.hpp.

◆ squaredNorm()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::squaredNorm ( ) const
inline

Squared norm of the vector.

Returns
norm.

Definition at line 454 of file Vector.hpp.

◆ sum()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::sum ( ) const
inline

Sum of the components.

Returns
sum.

Definition at line 552 of file Vector.hpp.

◆ toImplementation() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Implementation& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::toImplementation ( )
inline

Cast to the implementation type.

Returns
the implementation (recommended only for advanced users)

Definition at line 302 of file Vector.hpp.

◆ toImplementation() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
const Implementation& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::toImplementation ( ) const
inline

Cast to the implementation type.

Returns
the implementation (recommended only for advanced users)

Definition at line 309 of file Vector.hpp.

◆ UnitX()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
static Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::UnitX ( )
inlinestatic

Get the unity vector in x.

Returns
the unity vector in x

Definition at line 159 of file Vector.hpp.

◆ UnitY()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
static Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::UnitY ( )
inlinestatic

Get the unity vector in y.

Returns
the unity vector in y

Definition at line 166 of file Vector.hpp.

◆ UnitZ()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
static Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::UnitZ ( )
inlinestatic

Get the unity vector in z.

Returns
the unity vector in z

Definition at line 173 of file Vector.hpp.

◆ vector() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
Implementation& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::vector ( )
inline

Cast to Eigen::Matrix<PrimType_, Dimension_, 1>.

Returns
Eigen::Matrix<PrimType_, Dimension_, 1>

Definition at line 316 of file Vector.hpp.

◆ vector() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
const Implementation& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::vector ( ) const
inline

Cast to Eigen::Matrix<PrimType_, Dimension_, 1>.

Returns
Eigen::Matrix<PrimType_, Dimension_, 1>

Definition at line 323 of file Vector.hpp.

◆ x() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::x ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr) const
inline

Get x-coordinate of the vector (copy)

Returns
the x-coordinate of the vector (copy)

Definition at line 255 of file Vector.hpp.

◆ x() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::x ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr)
inline

Get x-coordinate of the vector (reference)

Returns
the x-coordinate of the vector (reference)

Definition at line 263 of file Vector.hpp.

◆ y() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::y ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr) const
inline

Get y-coordinate of the vector (copy)

Returns
the y-coordinate of the vector (copy)

Definition at line 271 of file Vector.hpp.

◆ y() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::y ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr)
inline

Get y-coordinate of the vector (reference)

Returns
the y-coordinate of the vector (reference)

Definition at line 279 of file Vector.hpp.

◆ z() [1/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::z ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr) const
inline

Get z-coordinate of the vector (copy)

Returns
the z-coordinate of the vector (copy)

Definition at line 287 of file Vector.hpp.

◆ z() [2/2]

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
template<int DimensionCopy_ = Dimension_>
Scalar& kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::z ( typename std::enable_if< DimensionCopy_==3 >::type *  = nullptr)
inline

Get z-coordinate of the vector (reference)

Returns
the z-coordinate of the vector (reference)

Definition at line 295 of file Vector.hpp.

◆ Zero()

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
static Vector<PhysicalType_, PrimType_, Dimension_> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Zero ( )
inlinestatic

Get zero element.

Returns
zero element

Definition at line 129 of file Vector.hpp.

Friends And Related Function Documentation

◆ operator<<

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
std::ostream& operator<< ( std::ostream &  out,
const Vector< PhysicalType_, PrimType_, Dimension_ > &  vector 
)
friend

Used for printing the object with std::cout.

Returns
std::stream object

Definition at line 566 of file Vector.hpp.

Member Data Documentation

◆ Dimension

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
constexpr int kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Dimension = Dimension_
static

The dimension of the vector.

Definition at line 77 of file Vector.hpp.

◆ DynamicDimension

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
constexpr int kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::DynamicDimension = -1
staticprivate

The size if the vector has dynamic dimension (must be equal to Eigen::Dynamic).

Definition at line 60 of file Vector.hpp.

◆ Implementation

template<enum PhysicalType PhysicalType_, typename PrimType_, int Dimension_>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix<PrimType_, Dimension_, 1> kindr::Vector< PhysicalType_, PrimType_, Dimension_ >::Implementation

The implementation type.

The implementation type is always an Eigen object.

Definition at line 69 of file Vector.hpp.


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