![]() |
libgenua
Basic Geometry, Numerical Algorithms and Interfaces
|
Reference Frame.
Every geometric entity inherits its own local reference frame which provides methods to translate and rotate the body with respect to a global reference. All transformation operations modify the reference frame. When multiple rotations are specified, they will be performed in axes order, i.e. (1.) Rotation about x-Axis, (2) about y-Axis, (3) about z-Axis.
An object which inherits from RFrame must provide a method
void apply();
which implements the homogeneous transform for the objects using the protected 4x4 transformation matrix 'mat'. A example transformation sequence would look like:
Surface surf; [...] surf.scale(3.0); surf.rotate(0.2, 0, 0); surf.translate(3.0, 4.0, -2.5); surf.apply();
#include <trafo.h>
Public Member Functions | |
RFrame () | |
default construction | |
virtual | ~RFrame () |
virtual destructor | |
virtual void | apply ()=0 |
this method must be provided by childs | |
void | clear () |
apply should finally call this method to clear transformation matrix | |
Vct3 | getOrigin () const |
return the position of the current frame relative to global origin | |
void | translate (const Vct3 &v) |
move reference frame by translation vector | |
void | translate (Real dx, Real dy, Real dz) |
move reference by (dx,dy,dz) | |
void | rotate (Real betax, Real betay, Real betaz) |
rotate by (betax, bety, betaz) around origin axis | |
void | rotate (const Vct3 &rotax, Real angle) |
rotate by angle around axis | |
void | scale (Real xf, Real yf, Real zf) |
scales in three dimensions by the factors given | |
void | scale (Real f) |
scale in all directions | |
void | mirror (const Vct3 &normal) |
mirror about plane - parameter is mirror plane normal | |
const SMatrix< 4, 4 > & | trafoMatrix () const |
return transformation matrix | |
void | setTrafoMatrix (const SMatrix< 4, 4 > &m) |
set transformation matrix | |
Vct3 | forward (const Vct3 &a) const |
coordinate-transform vector | |
void | forward (const PointList< 4 > &a, PointList< 4 > &b) const |
coordinate-transform vector backwards | |
Protected Attributes | |
SMatrix< 4, 4 > | mat |
transformation matrix | |