SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::defaulttype::Frame Class Reference

#include <Frame.h>

Detailed Description

The affine transformation of points and vectors from a coordinate system (the local frame) to another (the reference frame). The transformation is not necessarily rigid.

When defined using (origin, rotation, scale), the transfrom can be seen as three frame displacements starting from the reference frame: translation, then rotation along the new origin, then scale along the new axes. Conversely, the projection of a point from the local frame to the reference frame undergoes scaling, then rotation, then translation. Vectors do not undergo translation since they model directions or displacement.

The product F1F2 can be seen as a frame displacement F1 starting from the reference frame followed by a frame displacement F2 starting from the new frame. It is used in frame hierarchies to model the transfromation frome frame 2 wrt the reference frame.

Author
Francois Faure, INRIA-UJF, 2006

Public Member Functions

 Frame (const Vec3 &origin, const Mat33 &m)
 
 Frame (const Vec3 &origin, const Quat &orientation, const Vec3 &scale=Vec3(1, 1, 1))
 
 Frame (const Vec3 &origin)
 
 Frame ()
 Default constructor set the transformation to identity. More...
 
void setTransform (const Vec3 &origin, const Quat &orientation, const Vec3 &scale)
 
void clear ()
 Reset the transformation to identity. More...
 
Vec3getOrigin ()
 Origin of the local frame in the reference frame,. More...
 
const Vec3getOrigin () const
 Origin of the local frame in the reference frame,. More...
 
void setOrigin (const Vec3 &origin)
 Set the origin of the local frame in the reference frame,. More...
 
Mat33getBasis ()
 The columns represent the base vectors of the local frame wrt the reference frame. More...
 
const Mat33getBasis () const
 The columns represent the base vectors of the local frame wrt the reference frame. More...
 
void setBasis (const Mat33 &m)
 The columns represent the base vectors of the local frame wrt the reference frame. More...
 
void multRight (const Frame &c)
 Apply a transformation defined in the child frame (mult. right) More...
 
Frame mult (const Frame &c) const
 compute the product with another frame on the right More...
 
void writeOpenGlMatrix (float *m) const
 Write the OpenGL transformation matrix to a float[16]. More...
 
void writeOpenGlMatrix (double *m) const
 Write the OpenGL transformation matrix to a double[16]. More...
 
template<class V >
projectVector (const V &v) const
 compute the projection of a vector from the local frame to the reference frame More...
 
template<class V >
projectPoint (const V &v) const
 compute the projection of a point from the local frame to the reference frame More...
 
Frame inversed () const
 Transformation from the reference frame to the local frame. More...
 

Static Public Member Functions

static Frame identity ()
 The identity transform. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Frame &c)
 

Constructor details

sofa::defaulttype::Frame::Frame ( const Vec3 origin,
const Mat33 m 
)

Define the local frame using origin and basis vectors

sofa::defaulttype::Frame::Frame ( const Vec3 origin,
const Quat orientation,
const Vec3 scale = Vec3(1,1,1) 
)

Define the local frame using three transforms

sofa::defaulttype::Frame::Frame ( const Vec3 origin)

Define the local frame without rotation

sofa::defaulttype::Frame::Frame ( )

Default constructor set the transformation to identity.

Function details

void sofa::defaulttype::Frame::clear ( )

Reset the transformation to identity.

Frame::Mat33 & sofa::defaulttype::Frame::getBasis ( )

The columns represent the base vectors of the local frame wrt the reference frame.

const Frame::Mat33 & sofa::defaulttype::Frame::getBasis ( ) const

The columns represent the base vectors of the local frame wrt the reference frame.

Frame::Vec3 & sofa::defaulttype::Frame::getOrigin ( )

Origin of the local frame in the reference frame,.

const Frame::Vec3 & sofa::defaulttype::Frame::getOrigin ( ) const

Origin of the local frame in the reference frame,.

Frame sofa::defaulttype::Frame::identity ( )
static

The identity transform.

Frame sofa::defaulttype::Frame::inversed ( ) const

Transformation from the reference frame to the local frame.

Compute the transformation from the parent to the child.

Frame sofa::defaulttype::Frame::mult ( const Frame c) const

compute the product with another frame on the right

void sofa::defaulttype::Frame::multRight ( const Frame c)

Apply a transformation defined in the child frame (mult. right)

template<class V >
V sofa::defaulttype::Frame::projectPoint ( const V &  v) const
inline

compute the projection of a point from the local frame to the reference frame

template<class V >
V sofa::defaulttype::Frame::projectVector ( const V &  v) const
inline

compute the projection of a vector from the local frame to the reference frame

void sofa::defaulttype::Frame::setBasis ( const Mat33 m)

The columns represent the base vectors of the local frame wrt the reference frame.

void sofa::defaulttype::Frame::setOrigin ( const Vec3 origin)

Set the origin of the local frame in the reference frame,.

void sofa::defaulttype::Frame::setTransform ( const Vec3 origin,
const Quat orientation,
const Vec3 scale 
)

Define the local frame using three transforms

void sofa::defaulttype::Frame::writeOpenGlMatrix ( float m) const

Write the OpenGL transformation matrix to a float[16].

Write the OpenGL transformation matrix.

void sofa::defaulttype::Frame::writeOpenGlMatrix ( double m) const

Write the OpenGL transformation matrix to a double[16].

Write the OpenGL transformation matrix.

Related details

std::ostream& operator<< ( std::ostream &  out,
const Frame c 
)
friend