#include <Frame.h>
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.
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... | |
Vec3 & | getOrigin () |
Origin of the local frame in the reference frame,. More... | |
const Vec3 & | getOrigin () 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... | |
Mat33 & | getBasis () |
The columns represent the base vectors of the local frame wrt the reference frame. More... | |
const Mat33 & | getBasis () 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 > | |
V | projectVector (const V &v) const |
compute the projection of a vector from the local frame to the reference frame More... | |
template<class V > | |
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) |
Define the local frame using origin and basis vectors
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
sofa::type::Frame::Frame | ( | const Vec3 & | origin | ) |
Define the local frame without rotation
sofa::type::Frame::Frame | ( | ) |
Default constructor set the transformation to identity.
void sofa::type::Frame::clear | ( | ) |
Reset the transformation to identity.
Frame::Mat33 & sofa::type::Frame::getBasis | ( | ) |
The columns represent the base vectors of the local frame wrt the reference frame.
const Frame::Mat33 & sofa::type::Frame::getBasis | ( | ) | const |
The columns represent the base vectors of the local frame wrt the reference frame.
Vec3 & sofa::type::Frame::getOrigin | ( | ) |
Origin of the local frame in the reference frame,.
const Vec3 & sofa::type::Frame::getOrigin | ( | ) | const |
Origin of the local frame in the reference frame,.
|
static |
The identity transform.
Frame sofa::type::Frame::inversed | ( | ) | const |
Transformation from the reference frame to the local frame.
Compute the transformation from the parent to the child.
compute the product with another frame on the right
void sofa::type::Frame::multRight | ( | const Frame & | c | ) |
Apply a transformation defined in the child frame (mult. right)
|
inline |
compute the projection of a point from the local frame to the reference frame
|
inline |
compute the projection of a vector from the local frame to the reference frame
void sofa::type::Frame::setBasis | ( | const Mat33 & | m | ) |
The columns represent the base vectors of the local frame wrt the reference frame.
void sofa::type::Frame::setOrigin | ( | const Vec3 & | origin | ) |
Set the origin of the local frame in the reference frame,.
void sofa::type::Frame::setTransform | ( | const Vec3 & | origin, |
const Quat & | orientation, | ||
const Vec3 & | scale | ||
) |
Define the local frame using three transforms
void sofa::type::Frame::writeOpenGlMatrix | ( | double * | m | ) | const |
Write the OpenGL transformation matrix to a double[16].
Write the OpenGL transformation matrix.
void sofa::type::Frame::writeOpenGlMatrix | ( | float * | m | ) | const |
Write the OpenGL transformation matrix to a float[16].
Write the OpenGL transformation matrix.
|
friend |