From: <mk...@us...> - 2003-08-06 07:52:44
|
Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv31224/Source Modified Files: Quat.cpp Log Message: Index: Quat.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Quat.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Quat.cpp 6 Aug 2003 06:36:25 -0000 1.1 --- Quat.cpp 6 Aug 2003 07:52:41 -0000 1.2 *************** *** 184,194 **** } ! void Quat::getEulerAngles(double &roll, double &pitch, double &yaw) { ! roll = atan2(2.0*(_y*_z + _w*_x), _w*_w-_x*_x-_y*_y+_z*_z); ! pitch = asin(-2.0*(_x*_z - _w*_y)); ! yaw = atan2(2.0*(_x*_y + _w*_z), _w*_w+_x*_x-_y*_y-_z*_z); } - void Quat::getRotate(double& angle, Vector3& vec) const { getRotate(angle, vec.x(), vec.y(), vec.z()); --- 184,204 ---- } ! void Quat::getEulerAngles(double &roll, double &pitch, double &yaw) const { ! double x2 = _x*_x; ! double y2 = _y*_y; ! double z2 = _z*_z; ! double w2 = _w*_w; ! double sin_theta = 2.0 * (_w*_y - _x*_z); ! if (fabs(sin_theta) > 0.99999) { ! roll = 0.0; ! pitch = asin(sin_theta); ! yaw = atan2(2.0*(_w*_z - _x*_y), w2-x2+y2-z2); ! } else { ! roll = atan2(2.0*(_y*_z + _w*_x), w2-x2-y2+z2); ! pitch = asin(sin_theta); ! yaw = atan2(2.0*(_x*_y + _w*_z), w2+x2-y2-z2); ! } } void Quat::getRotate(double& angle, Vector3& vec) const { getRotate(angle, vec.x(), vec.y(), vec.z()); |