sofa::defaulttype::Frame Class Reference

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

#include <Frame.h>

Collaboration diagram for sofa::defaulttype::Frame:

Collaboration graph
[legend]

Public Types

typedef Vec< 3, SReal > Vec3
typedef helper::Quater< SReal > Quat
typedef Mat< 3, 3, SReal > Mat33

Public Member Functions

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

Static Public Member Functions

static Frame identity ()
 The identity transform.

Private Attributes

Vec3 origin_
Mat33 basis_

Friends

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

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

Definition at line 48 of file Frame.h.


Member Typedef Documentation

Definition at line 53 of file Frame.h.

Definition at line 52 of file Frame.h.

Definition at line 51 of file Frame.h.


Constructor & Destructor Documentation

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

Define the local frame using origin and basis vectors.

Definition at line 40 of file Frame.cpp.

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

Define the local frame using three transforms.

Definition at line 44 of file Frame.cpp.

References setTransform().

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

Define the local frame without rotation.

Definition at line 49 of file Frame.cpp.

References basis_.

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

Default constructor set the transformation to identity.

Definition at line 55 of file Frame.cpp.

References clear().

Referenced by inversed().


Member Function Documentation

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

Reset the transformation to identity.

Definition at line 60 of file Frame.cpp.

References basis_, and origin_.

Referenced by Frame(), and identity().

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

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

Definition at line 85 of file Frame.cpp.

References basis_.

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

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

Definition at line 81 of file Frame.cpp.

References basis_.

Referenced by multRight(), and sofa::defaulttype::operator<<().

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

Origin of the local frame in the reference frame,.

Definition at line 72 of file Frame.cpp.

References origin_.

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

Origin of the local frame in the reference frame,.

Definition at line 68 of file Frame.cpp.

References origin_.

Referenced by multRight(), and sofa::defaulttype::operator<<().

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

The identity transform.

Definition at line 107 of file Frame.cpp.

References clear().

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

Transformation from the reference frame to the local frame.

Compute the transformation from the parent to the child.

Definition at line 172 of file Frame.cpp.

References basis_, Frame(), and origin_.

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

compute the product with another frame on the right

Definition at line 122 of file Frame.cpp.

References multRight().

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

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

Definition at line 115 of file Frame.cpp.

References basis_, getBasis(), getOrigin(), and origin_.

Referenced by mult().

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

Definition at line 122 of file Frame.h.

References origin_, and projectVector().

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

Definition at line 111 of file Frame.h.

References basis_.

Referenced by projectPoint().

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

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

Definition at line 89 of file Frame.cpp.

References basis_.

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

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

Definition at line 76 of file Frame.cpp.

References origin_.

Referenced by setTransform().

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

Define the local frame using three transforms.

Definition at line 94 of file Frame.cpp.

References basis_, setOrigin(), and sofa::helper::Quater< Real >::toMatrix().

Referenced by Frame().

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

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

Write the OpenGL transformation matrix.

Definition at line 151 of file Frame.cpp.

References basis_, and origin_.

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

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

Write the OpenGL transformation matrix.

Definition at line 130 of file Frame.cpp.

References basis_, and origin_.

Referenced by sofa::simulation::VisualDrawVisitor::processNodeTopDown().


Friends And Related Function Documentation

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

Definition at line 184 of file Frame.cpp.


Field Documentation

Definition at line 55 of file Frame.h.

Referenced by clear(), getOrigin(), inversed(), multRight(), projectPoint(), setOrigin(), and writeOpenGlMatrix().


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

Generated on Sun Nov 23 04:23:51 2008 for Sofa by  doxygen 1.5.7.1