Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

DecomposeAffineC Class Reference

Decomposes a matrix into affine parts. More...

#include <DecomposeAffineC.h>

List of all members.

Public Methods

 DecomposeAffineC (const PajaTypes::Matrix3C &rMat)
 Constructor.

 ~DecomposeAffineC ()
 Desctructor.

PajaTypes::float32 get_sign ()
 Returns sign of the determinant.


Public Attributes

PajaTypes::Vector3C get_translation ()
 Returns the translation part of the matrix.

PajaTypes::QuatC get_rotation ()
 Return essential rotation part of the matrix.

PajaTypes::Vector3C get_scale ()
 Return scale part of the matrix.

PajaTypes::QuatC get_scale_rotation ()
 Return scale rotation part of the matrix.


Detailed Description

Decomposes a matrix into affine parts.

Decomposes matrix into translation, rotation, scale and scael rotation parts. The class is based on the article: "Polar Matrix Decomposition" by Ken Shoemake, shoemake@graphics.cis.upenn.edu in "Graphics Gems IV", Academic Press, 1994

To reassemble the matrix use following:

        Matrix3C    rScaleMat, rScaleRotMat, rInvScaleRotMat;
        Matrix3C    rPosMat, rRotMat, rTM;
        QuatC       rInvScaleRot;
        // scale
        rScaleMat.set_scale( rScale );
        // scale rot
        rScaleRot.from_axis_angle( rScaleAxis, f32ScaleAngle );
        rScaleRotMat.set_rot( rScaleRot );
        // inv scale rot
        rInvScaleRot = rScaleRot.unit_inverse();
        rInvScaleRotMat.set_rot( rInvScaleRot );
        // rot
        rRot.from_axis_angle( rRotAxis, f32RotAngle );
        rRotMat.set_rot( rRot );
        // pos
        rPosMat.set_trans( rPos );
        // Compose matrix
        rTM = rInvScaleRotMat * rScaleMat * rScaleRotMat * rRotMat * rPosMat;

Or using OpenGL:

        float32     f32X, f32Y, f32Z, f32A;
        QuatC       rInvScaleRot = rScaleRot.unit_inverse();

        glTranslatef( rPos[0], rPos[1], rPos[2] );

        rRot.to_axis_angle( f32X, f32Y, f32Z, f32A );
        glRotatef( f32A / (float32)M_PI * 180.0f, f32X, f32Y, f32Z );

        rScaleRot.to_axis_angle( f32X, f32Y, f32Z, f32A );
        glRotatef( f32A / (float32)M_PI * 180.0f, f32X, f32Y, f32Z );

        glScalef( rScale[0], rScale[1], rScale[2] );

        rInvScaleRot.to_axis_angle( f32X, f32Y, f32Z, f32A );
        glRotatef( f32A / (float32)M_PI * 180.0f, f32X, f32Y, f32Z );


Constructor & Destructor Documentation

DecomposeAffineC const PajaTypes::Matrix3C   rMat
 

Constructor.

~DecomposeAffineC  
 

Desctructor.


Member Function Documentation

PajaTypes::float32 get_sign  
 

Returns sign of the determinant.


Member Data Documentation

PajaTypes::QuatC get_rotation()
 

Return essential rotation part of the matrix.

PajaTypes::Vector3C get_scale()
 

Return scale part of the matrix.

PajaTypes::QuatC get_scale_rotation()
 

Return scale rotation part of the matrix.

PajaTypes::Vector3C get_translation()
 

Returns the translation part of the matrix.


Moppi Demopaja SDK Documentation -- Copyright © 2000-2002 Moppi Productions