SOFA API  cbddc29e
Open source framework for multi-physics simuation
sofa::type::SpatialVector< TReal > Class Template Reference

#include <SpatialVector.h>

Inheritance diagram for sofa::type::SpatialVector< TReal >:

Detailed Description

template<class TReal>
class sofa::type::SpatialVector< TReal >

A spatial vector. When representing a velocity, lineVec is the angular velocity and freeVec is the linear velocity. When representing a spatial force, lineVec is the force and freeVec is the torque.

Public Attributes

Vec lineVec { type::NOINIT }
 
Vec freeVec { type::NOINIT }
 

Public Member Functions

void clear ()
 
 SpatialVector ()=default
 
 SpatialVector (const Vec &l, const Vec &f)
 
SpatialVectoroperator+= (const SpatialVector &v)
 
SpatialVector operator* (Real a) const
 
SpatialVectoroperator*= (Real a)
 
SpatialVector operator+ (const SpatialVector &v) const
 
SpatialVector operator- (const SpatialVector &v) const
 
SpatialVector operator- () const
 
Real operator* (const SpatialVector &v) const
 Spatial dot product (cross terms) More...
 
SpatialVector cross (const SpatialVector &v) const
 Spatial cross product. More...
 
SpatialVector operator* (const Mat66 &) const
 product with a dense matrix More...
 
VecgetLinearVelocity ()
 
const VecgetLinearVelocity () const
 
void setLinearVelocity (const Vec &v)
 
VecgetAngularVelocity ()
 
const VecgetAngularVelocity () const
 
void setAngularVelocity (const Vec &v)
 
VecgetTorque ()
 
const VecgetTorque () const
 
void setTorque (const Vec &v)
 
VecgetForce ()
 
const VecgetForce () const
 
void setForce (const Vec &v)
 

Friends

std::ostream & operator<< (std::ostream &out, const SpatialVector &t)
 write to an output stream More...
 
std::istream & operator>> (std::istream &in, SpatialVector &t)
 read from an input stream More...
 

Attribute details

◆ freeVec

template<class TReal >
Vec sofa::type::SpatialVector< TReal >::freeVec { type::NOINIT }

◆ lineVec

template<class TReal >
Vec sofa::type::SpatialVector< TReal >::lineVec { type::NOINIT }

Constructor details

◆ SpatialVector() [1/2]

template<class TReal >
sofa::type::SpatialVector< TReal >::SpatialVector ( )
default

◆ SpatialVector() [2/2]

template<class TReal >
sofa::type::SpatialVector< TReal >::SpatialVector ( const Vec l,
const Vec f 
)
Parameters
lThe line vector: angular velocity, or force
fThe free vector: linear velocity, or torque

Function details

◆ clear()

template<class TReal >
void sofa::type::SpatialVector< TReal >::clear

◆ cross()

template<class TReal >
SpatialVector< TReal > sofa::type::SpatialVector< TReal >::cross ( const SpatialVector< TReal > &  v) const

Spatial cross product.

◆ getAngularVelocity() [1/2]

template<class TReal >
Vec& sofa::type::SpatialVector< TReal >::getAngularVelocity ( )
inline

If the SpatialVector models a spatial velocity, then the angular velocity is the lineVec. Otherwise, the SpatialVector models a spatial force, and this method returns a force.

◆ getAngularVelocity() [2/2]

template<class TReal >
const Vec& sofa::type::SpatialVector< TReal >::getAngularVelocity ( ) const
inline

◆ getForce() [1/2]

template<class TReal >
Vec& sofa::type::SpatialVector< TReal >::getForce ( )
inline

If the SpatialVector models a spatial force, then the torque is the lineVec. Otherwise, the SpatialVector models a spatial velocity, and this method returns an angular velocity.

◆ getForce() [2/2]

template<class TReal >
const Vec& sofa::type::SpatialVector< TReal >::getForce ( ) const
inline

◆ getLinearVelocity() [1/2]

template<class TReal >
Vec& sofa::type::SpatialVector< TReal >::getLinearVelocity ( )
inline

If the SpatialVector models a spatial velocity, then the linear velocity is the freeVec. Otherwise, the SpatialVector models a spatial force, and this method returns a torque.

◆ getLinearVelocity() [2/2]

template<class TReal >
const Vec& sofa::type::SpatialVector< TReal >::getLinearVelocity ( ) const
inline

◆ getTorque() [1/2]

template<class TReal >
Vec& sofa::type::SpatialVector< TReal >::getTorque ( )
inline

If the SpatialVector models a spatial force, then the torque is the freeVec. Otherwise, the SpatialVector models a spatial velocity, and this method returns a linear velocity.

◆ getTorque() [2/2]

template<class TReal >
const Vec& sofa::type::SpatialVector< TReal >::getTorque ( ) const
inline

◆ operator*() [1/3]

template<class TReal >
SpatialVector< TReal > sofa::type::SpatialVector< TReal >::operator* ( const Mat66 m) const

product with a dense matrix

◆ operator*() [2/3]

template<class TReal >
TReal sofa::type::SpatialVector< TReal >::operator* ( const SpatialVector< TReal > &  v) const

Spatial dot product (cross terms)

◆ operator*() [3/3]

template<class TReal >
SpatialVector sofa::type::SpatialVector< TReal >::operator* ( Real  a) const
inline

◆ operator*=()

template<class TReal >
SpatialVector& sofa::type::SpatialVector< TReal >::operator*= ( Real  a)
inline

◆ operator+()

template<class TReal >
SpatialVector< TReal > sofa::type::SpatialVector< TReal >::operator+ ( const SpatialVector< TReal > &  v) const

◆ operator+=()

template<class TReal >
SpatialVector< TReal > & sofa::type::SpatialVector< TReal >::operator+= ( const SpatialVector< TReal > &  v)

◆ operator-() [1/2]

template<class TReal >
SpatialVector< TReal > sofa::type::SpatialVector< TReal >::operator-

◆ operator-() [2/2]

template<class TReal >
SpatialVector< TReal > sofa::type::SpatialVector< TReal >::operator- ( const SpatialVector< TReal > &  v) const

◆ setAngularVelocity()

template<class TReal >
void sofa::type::SpatialVector< TReal >::setAngularVelocity ( const Vec v)
inline

◆ setForce()

template<class TReal >
void sofa::type::SpatialVector< TReal >::setForce ( const Vec v)
inline

◆ setLinearVelocity()

template<class TReal >
void sofa::type::SpatialVector< TReal >::setLinearVelocity ( const Vec v)
inline

◆ setTorque()

template<class TReal >
void sofa::type::SpatialVector< TReal >::setTorque ( const Vec v)
inline

Related details

◆ operator<<

template<class TReal >
std::ostream& operator<< ( std::ostream &  out,
const SpatialVector< TReal > &  t 
)
friend

write to an output stream

◆ operator>>

template<class TReal >
std::istream& operator>> ( std::istream &  in,
SpatialVector< TReal > &  t 
)
friend

read from an input stream