LOOS  v2.3.2
loos::XForm Class Reference

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)
void scale (const GCoord &)
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.

Detailed Description

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...

Definition at line 91 of file XForm.hpp.

Member Function Documentation

void loos::XForm::rotate ( const GCoord ov,
const greal  angle 

Rotate about an arbitrary vector Angles are specified in degrees.

Definition at line 64 of file XForm.cpp.

void loos::XForm::rotate ( const char  axis,
const greal  angle 

Rotate about a specified axis Axis is given by either 'x', 'y', or 'z'. Angles are in degrees.

Definition at line 90 of file XForm.cpp.

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