Commit 7227a295 authored by slevy's avatar slevy
Browse files

Add tfm2euler(), tfm2xyzeuler().

parent b92b2ae0
......@@ -166,6 +166,21 @@ void mtranslation( Matrix *dst, float tx, float ty, float tz );
float tfm2xyzaer( Point *xyz, float aer[3], CONST Matrix *c2w ); /* => scale */
void xyzaer2tfm( Matrix *c2w, CONST Point *xyz, CONST float aer[3] );
/* extract Euler angles (for application in arbitrary permutation of xyz order) from 4x4 matrix.
* If T is an object-to-world matrix such that
* p_obj * T = p_world
* then, with axABC being a string which is some permutation of "xyz"
* (so that if axABC="yxz" then A=y, B=x, C=z) then
* p_obj * rotC(rc) * rotB(rb) * rotA(ra) = p_world
* so if axABC="yxz" then p_obj * rotZ(rz) * rotX(rx) * rotY(ry) = p_world
* with all rotations in degrees (not radians).
* Given the above, then
* tfm2euler( rABC, "yxz", T ) returns { ry, rx, rz } in rABC while
* tfm2xyzeuler( rXYZ, "yxz", T ) returns { rx, ry, rz } in rXYZ.
*/
int tfm2euler( float rABC[3], CONST char *axABC, CONST Matrix *T );
int tfm2xyzeuler( float rXYZ[3], CONST char *axABC, CONST Matrix *T );
/* perspective frustum */
void mfrustum( Matrix *Tproj, float nl, float nr, float nd, float nu, float cnear, float cfar );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment