MatrixToRotAxis is nummerically instable
- 
 THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED On 09/09/2005 at 08:26, xxxxxxxx wrote: User Information: 
 Cinema 4D Version: 9.1
 Platform: Windows ; Mac ;
 Language(s) : C++ ;--------- 
 HelloThe problem in MatrixToRotAxis is this code // Achse berechnen 
 v->x= m.v2.z-m.v3.y;
 v->y= m.v3.x-m.v1.z;
 v->z= m.v1.y-m.v2.x;
 *v = !(*v);if the matrix is near identity then v will be really small.. the normalization however will bring it to length 1. This results in an almost random unit vector. Which is now our rotation axis..  My workaround is: Quaternion q; 
 q.SetMatrix(LM(m));
 if(Len(q.v)<1.0e-6) {
 v = Vector(1,0,0);
 w = 0;
 }
 else {
 v = SV(!(q.v));
 w = 2.0*acos(q.w);
 }Not that you would call this efficient. But it seems to work. best regards 
 Michael