SOFA API  38ecbea1
Open source framework for multi-physics simuation
sofa::type::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 &matrix)
 
 Frame (const Vec3 &origin, const Quat &orientation, const Vec3 &scale=Vec3(1_sreal, 1_sreal, 1_sreal))
 
 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

◆ Frame() [1/4]

sofa::type::Frame::Frame ( const Vec3 origin,
const Mat33 matrix 
)

Define the local frame using origin and basis vectors

◆ Frame() [2/4]

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

Define the local frame using three transforms

◆ Frame() [3/4]

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

Define the local frame without rotation

◆ Frame() [4/4]

sofa::type::Frame::Frame ( )

Default constructor set the transformation to identity.

Function details

◆ clear()

void sofa::type::Frame::clear ( )

Reset the transformation to identity.

◆ getBasis() [1/2]

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

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

◆ getBasis() [2/2]

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

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

◆ getOrigin() [1/2]

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

Origin of the local frame in the reference frame,.

◆ getOrigin() [2/2]

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

Origin of the local frame in the reference frame,.

◆ identity()

Frame sofa::type::Frame::identity ( )
static

The identity transform.

◆ inversed()

Frame sofa::type::Frame::inversed ( ) const

Transformation from the reference frame to the local frame.

Compute the transformation from the parent to the child.

◆ mult()

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

compute the product with another frame on the right

◆ multRight()

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

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

◆ projectPoint()

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

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

◆ projectVector()

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

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

◆ setBasis()

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

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

◆ setOrigin()

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

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

◆ setTransform()

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

Define the local frame using three transforms

◆ writeOpenGlMatrix() [1/2]

void sofa::type::Frame::writeOpenGlMatrix ( double *  m) const

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

Write the OpenGL transformation matrix.

◆ writeOpenGlMatrix() [2/2]

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

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

Write the OpenGL transformation matrix.

Related details

◆ operator<<

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