Michael.Kellner++at++szm.de
Tue, 15 Sep 1998 11:46:48 +0200
In my Performer application I used pfGetOrthoMatCoord() to
retrieve HPR from the matrix. Now, for a small converter
application (non Performer) with it's own matrix handling
I have also to retrieve this values. I used the following code:
void matrix_get_rot( MATRIX mat, float * xrot, float * yrot, float *
zrot )
{
double cy;
cy = sqrt( mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1] );
if( cy > 16 * FLT_EPSILON ) {
*xrot = atan2f( mat[1][2], mat[2][2] );
*yrot = atan2f( -mat[0][2], cy );
*zrot = atan2f( mat[0][1], mat[0][0] );
}
else {
*xrot = atan2f( -mat[2][1], mat[1][1] );
*yrot = atan2f( mat[0][2], cy );
*zrot = 0.f;
}
}
Alternatively I used the Performer function pfGetOrthoMatCoord():
void matrix_get_rot( MATRIX mat, float * xrot, float * yrot, float *
zrot )
{
pfMatrix pfmatrix;
pfCoord pfcoord;
pfSetMatRow( pfmatrix, 0, mat[0][0], mat[0][1], mat[0][2], 0.f
);
pfSetMatRow( pfmatrix, 1, mat[1][0], mat[1][1], mat[1][2], 0.f
);
pfSetMatRow( pfmatrix, 2, mat[2][0], mat[2][1], mat[2][2], 0.f
);
pfGetOrthoMatCoord( pfmatrix, & pfcoord );
*xrot = pfcoord.hpr[1];
*yrot = pfcoord.hpr[2];
*zrot = pfcoord.hpr[0];
}
The result values shows me that the Performer function returns
higher precision values than my code.
So, could anybody give me a pointer how I can increase the precision
or is it a secret how Performer computes this values?
Thank you
Michael
===================================================================
Michael Kellner Telefon : +49 89 95 07 65 55
SZM Studios Fax : +49 89 95 07 65 09
Film-, TV- und Multimedia-
Produktions GmbH
Medienallee 7
85774 Unterfoehring mailto:michael.kellner++at++szm.de
Germany http://www.szm-studios.de
===================================================================
This archive was generated by hypermail 2.0b2 on Tue Sep 15 1998 - 02:46:59 PDT