SOFA API  59c939c2
Open source framework for multi-physics simuation
sofa::defaulttype::RigidCoord< 3, real > Class Template Reference

#include <RigidTypes.h>

Protected Attributes

Vec3 center
 
Quat orientation
 

Public Member Functions

 RigidCoord (const Vec3 &posCenter, const Quat &orient)
 
 RigidCoord ()
 
template<typename real2 >
 RigidCoord (const RigidCoord< 3, real2 > &c)
 
void clear ()
 
template<typename real2 >
void operator= (const RigidCoord< 3, real2 > &c)
 
void operator= (const Vec3 &p)
 
void operator+= (const Deriv &dg)
 
RigidCoord< 3, real > operator+ (const Deriv &dg) const
 
RigidCoord< 3, real > operator- (const RigidCoord< 3, real > &a) const
 
RigidCoord< 3, real > operator+ (const RigidCoord< 3, real > &a) const
 
RigidCoord< 3, real > operator- () const
 
void operator+= (const RigidCoord< 3, real > &a)
 
template<typename real2 >
void operator*= (real2 a)
 
template<typename real2 >
void operator/= (real2 a)
 
template<typename real2 >
RigidCoord< 3, real > operator* (real2 a) const
 
template<typename real2 >
RigidCoord< 3, real > operator/ (real2 a) const
 
Real operator* (const RigidCoord< 3, real > &a) const
 dot product, mostly used to compute residuals as sqrt(x*x) More...
 
real norm2 () const
 
real norm () const
 Euclidean norm. More...
 
Vec3getCenter ()
 
QuatgetOrientation ()
 
const Vec3getCenter () const
 
const QuatgetOrientation () const
 
Vec3 rotate (const Vec3 &v) const
 
Vec3 inverseRotate (const Vec3 &v) const
 
Vec3 translate (const Vec3 &v) const
 
void multRight (const RigidCoord< 3, real > &c)
 Apply a transformation with respect to itself. More...
 
RigidCoord< 3, real > mult (const RigidCoord< 3, real > &c) const
 compute the product with another frame on the right More...
 
template<class Mat >
void fromMatrix (const Mat &m)
 Set from the given matrix. More...
 
template<class Mat >
void toMatrix (Mat &m) const
 Write to the given matrix. More...
 
template<class Mat >
void writeRotationMatrix (Mat &m) const
 
void writeOpenGlMatrix (float m[16]) const
 Write the OpenGL transformation matrix. More...
 
Vec3 projectPoint (const Vec3 &v) const
 Apply the transform to a point, i.e. project a point from the child frame to the parent frame (translation and rotation) More...
 
Vec3 projectVector (const Vec3 &v) const
 Apply the transform to a vector, i.e. project a vector from the child frame to the parent frame (rotation only, no translation added) More...
 
Vec3 unprojectPoint (const Vec3 &v) const
 Apply the inverse transform to a point, i.e. project a point from the parent frame to the child frame (translation and rotation) More...
 
Vec3 unprojectVector (const Vec3 &v) const
 Apply the inverse transform to a vector, i.e. project a vector from the parent frame to the child frame (rotation only, no translation) More...
 
Vec3 pointToParent (const Vec3 &v) const
 obsolete. Use projectPoint. More...
 
Vec3 pointToChild (const Vec3 &v) const
 obsolete. Use unprojectPoint. More...
 
real * ptr ()
 
const real * ptr () const
 
real & operator[] (int i)
 Access to i-th element. More...
 
const real & operator[] (int i) const
 Const access to i-th element. More...
 
Tests operators
bool operator== (const RigidCoord< 3, real > &b) const
 
bool operator!= (const RigidCoord< 3, real > &b) const
 

Static Public Member Functions

static RigidCoord rand (SReal a)
 Random rigid transform composed of 3 random translations and 3 random Euler angles. More...
 
static RigidCoord< 3, real > identity ()
 
template<typename V >
static HomogeneousVec toHomogeneous (V v, real r=1.)
 create a homogeneous vector from a 3d vector More...
 
template<typename V >
static Vec3 fromHomogeneous (V v)
 create a 3d vector from a homogeneous vector More...
 
static int max_size ()
 
static unsigned int size ()
 

Friends

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

Attribute details

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::center
protected
template<typename real >
Quat sofa::defaulttype::RigidCoord< 3, real >::orientation
protected

Constructor details

template<typename real >
sofa::defaulttype::RigidCoord< 3, real >::RigidCoord ( const Vec3 posCenter,
const Quat orient 
)
inline
template<typename real >
sofa::defaulttype::RigidCoord< 3, real >::RigidCoord ( )
inline
template<typename real >
template<typename real2 >
sofa::defaulttype::RigidCoord< 3, real >::RigidCoord ( const RigidCoord< 3, real2 > &  c)
inline

Function details

template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::clear ( )
inline
template<typename real >
template<typename V >
static Vec3 sofa::defaulttype::RigidCoord< 3, real >::fromHomogeneous ( v)
inlinestatic

create a 3d vector from a homogeneous vector

template<typename real >
template<class Mat >
void sofa::defaulttype::RigidCoord< 3, real >::fromMatrix ( const Mat m)
inline

Set from the given matrix.

template<typename real >
Vec3& sofa::defaulttype::RigidCoord< 3, real >::getCenter ( )
inline
template<typename real >
const Vec3& sofa::defaulttype::RigidCoord< 3, real >::getCenter ( ) const
inline
template<typename real >
Quat& sofa::defaulttype::RigidCoord< 3, real >::getOrientation ( )
inline
template<typename real >
const Quat& sofa::defaulttype::RigidCoord< 3, real >::getOrientation ( ) const
inline
template<typename real >
static RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::identity ( )
inlinestatic
template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::inverseRotate ( const Vec3 v) const
inline
template<typename real >
static int sofa::defaulttype::RigidCoord< 3, real >::max_size ( )
inlinestatic
template<typename real >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::mult ( const RigidCoord< 3, real > &  c) const
inline

compute the product with another frame on the right

template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::multRight ( const RigidCoord< 3, real > &  c)
inline

Apply a transformation with respect to itself.

template<typename real >
real sofa::defaulttype::RigidCoord< 3, real >::norm ( ) const
inline

Euclidean norm.

template<typename real >
real sofa::defaulttype::RigidCoord< 3, real >::norm2 ( ) const
inline

Squared norm. For the rotation we use the xyz components of the quaternion. Note that this is not equivalent to the angle, so a 2d rotation and the equivalent 3d rotation have different norms.

template<typename real >
bool sofa::defaulttype::RigidCoord< 3, real >::operator!= ( const RigidCoord< 3, real > &  b) const
inline
template<typename real >
template<typename real2 >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator* ( real2  a) const
inline
template<typename real >
Real sofa::defaulttype::RigidCoord< 3, real >::operator* ( const RigidCoord< 3, real > &  a) const
inline

dot product, mostly used to compute residuals as sqrt(x*x)

template<typename real >
template<typename real2 >
void sofa::defaulttype::RigidCoord< 3, real >::operator*= ( real2  a)
inline
template<typename real >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator+ ( const Deriv dg) const
inline
template<typename real >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator+ ( const RigidCoord< 3, real > &  a) const
inline
template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::operator+= ( const Deriv dg)
inline
template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::operator+= ( const RigidCoord< 3, real > &  a)
inline
template<typename real >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator- ( const RigidCoord< 3, real > &  a) const
inline
template<typename real >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator- ( ) const
inline
template<typename real >
template<typename real2 >
RigidCoord<3,real> sofa::defaulttype::RigidCoord< 3, real >::operator/ ( real2  a) const
inline
template<typename real >
template<typename real2 >
void sofa::defaulttype::RigidCoord< 3, real >::operator/= ( real2  a)
inline
template<typename real >
template<typename real2 >
void sofa::defaulttype::RigidCoord< 3, real >::operator= ( const RigidCoord< 3, real2 > &  c)
inline
template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::operator= ( const Vec3 p)
inline
template<typename real >
bool sofa::defaulttype::RigidCoord< 3, real >::operator== ( const RigidCoord< 3, real > &  b) const
inline
template<typename real >
real& sofa::defaulttype::RigidCoord< 3, real >::operator[] ( int  i)
inline

Access to i-th element.

template<typename real >
const real& sofa::defaulttype::RigidCoord< 3, real >::operator[] ( int  i) const
inline

Const access to i-th element.

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::pointToChild ( const Vec3 v) const
inline

obsolete. Use unprojectPoint.

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::pointToParent ( const Vec3 v) const
inline

obsolete. Use projectPoint.

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::projectPoint ( const Vec3 v) const
inline

Apply the transform to a point, i.e. project a point from the child frame to the parent frame (translation and rotation)

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::projectVector ( const Vec3 v) const
inline

Apply the transform to a vector, i.e. project a vector from the child frame to the parent frame (rotation only, no translation added)

template<typename real >
real* sofa::defaulttype::RigidCoord< 3, real >::ptr ( )
inline
template<typename real >
const real* sofa::defaulttype::RigidCoord< 3, real >::ptr ( ) const
inline
template<typename real >
static RigidCoord sofa::defaulttype::RigidCoord< 3, real >::rand ( SReal  a)
inlinestatic

Random rigid transform composed of 3 random translations and 3 random Euler angles.

Parameters
aRange of each random value: (-a,+a)
Returns
random rigid transform
template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::rotate ( const Vec3 v) const
inline
template<typename real >
static unsigned int sofa::defaulttype::RigidCoord< 3, real >::size ( void  )
inlinestatic
template<typename real >
template<typename V >
static HomogeneousVec sofa::defaulttype::RigidCoord< 3, real >::toHomogeneous ( v,
real  r = 1. 
)
inlinestatic

create a homogeneous vector from a 3d vector

template<typename real >
template<class Mat >
void sofa::defaulttype::RigidCoord< 3, real >::toMatrix ( Mat m) const
inline

Write to the given matrix.

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::translate ( const Vec3 v) const
inline
template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::unprojectPoint ( const Vec3 v) const
inline

Apply the inverse transform to a point, i.e. project a point from the parent frame to the child frame (translation and rotation)

template<typename real >
Vec3 sofa::defaulttype::RigidCoord< 3, real >::unprojectVector ( const Vec3 v) const
inline

Apply the inverse transform to a vector, i.e. project a vector from the parent frame to the child frame (rotation only, no translation)

template<typename real >
void sofa::defaulttype::RigidCoord< 3, real >::writeOpenGlMatrix ( float  m[16]) const
inline

Write the OpenGL transformation matrix.

template<typename real >
template<class Mat >
void sofa::defaulttype::RigidCoord< 3, real >::writeRotationMatrix ( Mat m) const
inline

Enum details

template<typename real >
anonymous enum

Compile-time constant specifying the number of scalars within this vector (equivalent to the size() method)

Enumerator
total_size 
template<typename real >
anonymous enum

Compile-time constant specifying the number of dimensions of space (NOT equivalent to total_size for rigids)

Enumerator
spatial_dimensions 

Related details

template<typename real >
std::ostream& operator<< ( std::ostream &  out,
const RigidCoord< 3, real > &  v 
)
friend

write to an output stream

template<typename real >
std::istream& operator>> ( std::istream &  in,
RigidCoord< 3, real > &  v 
)
friend

read from an input stream