Linderdaum Engine: LTransform.cpp File Reference
Updated: Sat Dec 15 2012 03:54:34
LTransform.cpp File Reference

Transformation. More...

#include "LTransform.h"
#include "LProjection.h"

Functions

LMatrix4 ComposeTransformation (const LVector3 &Pos, const LMatrix4 &Rot)
LMatrix4 ComposeCameraTransformation (const LVector3 &Pos, const LMatrix4 &Rot)
void DecomposeTransformation (const LMatrix4 &T, LVector3 &Pos, LMatrix4 &Rot)
void DecomposeCameraTransformation (const LMatrix4 &T, LVector3 &Pos, LMatrix4 &Rot)
void GivensRotation (float a, float b, float &c, float &s, float &r)
void MatrixToAngles (LEulerAngleSystem Sys, const LMatrix3 &M, float &T1, float &T2, float &T3)
void MakeRotationMatrix (LMatrix4 &R, int axis, float angle)
void AnglesToMatrix (LEulerAngleSystem Sys, LMatrix4 &M, float T1, float T2, float T3)

Variables

int EulerAxes [12][3]
 indices of the axes fora given coordinate system
LVector3 EuclideanBasis [3] = { vec3( 1, 0, 0 ), vec3( 0, 1, 0 ), vec3( 0, 0, 1 ) }

Detailed Description

Transformation.

Version:
0.5.91
Date:
01/03/2010
Author:
Viktor Latypov, 2009-2010
support@linderdaum.com http://www.linderdaum.com

Function Documentation

void AnglesToMatrix ( LEulerAngleSystem  Sys,
LMatrix4 M,
float  T1,
float  T2,
float  T3 
)

Calculate orientation from three Euler angles in a given axis system (ZXZ etc.)

LMatrix4 ComposeCameraTransformation ( const LVector3 Pos,
const LMatrix4 Rot 
)
LMatrix4 ComposeTransformation ( const LVector3 Pos,
const LMatrix4 Rot 
)
void DecomposeCameraTransformation ( const LMatrix4 T,
LVector3 Pos,
LMatrix4 Rot 
)
void DecomposeTransformation ( const LMatrix4 T,
LVector3 Pos,
LMatrix4 Rot 
)
void GivensRotation ( float  a,
float  b,
float c,
float s,
float r 
)

Find a planar rotation (c=cos, s=sin) which maps (a,b) vector to (r,0)

http://www.cgafaq.info/wiki/Euler_angles_from_matrix

The following method, choosing either t=cot(theta) or t=tan(theta) as route, is a variation of that recommended by Golub and Van Loan, made continuous as suggested by Edward Anderson

void MakeRotationMatrix ( LMatrix4 R,
int  axis,
float  angle 
)
void MatrixToAngles ( LEulerAngleSystem  Sys,
const LMatrix3 M,
float T1,
float T2,
float T3 
)

Calculate three Euler angles from orientation in a given axis system (ZXZ etc.)

[T1,T2,T3] -> [T3,T2,T1]


Variable Documentation

LVector3 EuclideanBasis[3] = { vec3( 1, 0, 0 ), vec3( 0, 1, 0 ), vec3( 0, 0, 1 ) }
int EulerAxes[12][3]
Initial value:
{
        {0, 2, 0}, {0, 2, 1}, {0, 1, 0}, {0, 1, 2},
        {1, 0, 1}, {1, 0, 2}, {1, 2, 1}, {1, 2, 0},
        {2, 1, 2}, {2, 1, 0}, {2, 0, 2}, {2, 0, 1}
}

indices of the axes fora given coordinate system