LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
|
Matrix class for handling coordinate transforms... More...
#include <XForm.hpp>
Public Member Functions | |
XForm (const GMatrix &m) | |
Initialize an XForm with an existing matrix. | |
XForm (const XForm &x) | |
void | push (void) |
Push the current matrix onto the stack. | |
void | pop (void) |
Pop the top matrix off the stack. | |
void | load (const GMatrix &) |
Load a matrix onto the current transform. | |
void | concat (const GMatrix &) |
Concatenate (post-multiply) a matrix with the current transform. | |
void | premult (const GMatrix &) |
Premultiply the current transform. | |
void | identity (void) |
Set the current transform to the identity. | |
bool | unset (void) const |
void | translate (const greal, const greal, const greal) |
Translation matrix. | |
void | translate (const GCoord &) |
Translation specified by a GCoord() | |
void | scale (const greal, const greal, const greal) |
Scaling. | |
void | scale (const GCoord &) |
Scaling. | |
void | rotate (const GCoord &, const greal) |
void | rotate (const char, const greal) |
GCoord | transform (const GCoord &) |
Transform a GCoord() with the current transformation. | |
GMatrix | current (void) const |
Get the current trasnformation. | |
Matrix class for handling coordinate transforms...
This is based on the OpenGL/RenderMan model of handling geometric transforms. Coords are expected to be homegenous and the transformation matrix is 4x4. Rotations are all left-handed.
The transform mantains a stack of transformation matrices that you can push and pop as necessary. You can also load the current transformation with an arbitrary matrix.
Transformations are concatenated by post-multiplication. This means the last declared transformation is the first one applied to an atom's coordinates... Imagine you've defined a set of transformations in your code:
* * rotate -> M_r * translate -> M_t * scale -> M_s *
These are post-multiplied together to create the composite transformation matrix:
* M = M_r * M_t * M_s *
Now, when you transform your coordinate vector, it's just the matrix-vector multiplication:
* v' = Mv = M_r * M_t * M_s * v *
So from the perspective of the atom's coordinate frame, we're scaled, then translated, then rotated into the global coordinates...
Rotate about a specified axis Axis is given by either 'x', 'y', or 'z'. Angles are in degrees.
Rotate about an arbitrary vector Angles are specified in degrees.