I've been trying to use the SphericalManipulator class that was posted to the submission list a few weeks ago and it is throwing exceptions when it is trying to calculate acos(1.00000000002) in the last line of this function:
void SphericalManipulator::setByMatrix(const osg::Matrixd& matrix) { _center=osg::Vec3(0,0,-_distance)*matrix; _azimuth=atan2(-matrix(0,0),matrix(0,1)); if(_rotationMode != MODE_2D) _zenith=acos(matrix(2,2)); } In my code, the matrix parameter is created by an inverse operation. In general, is there some way to avoid this problem, or do I need to add code that range checks critical values? Should the last line be changed to this block: double val = matrix(2,2); if ((val >= 1) || (val <= 1)) zenith = 0; else zenith = acos(val); Yuck. Cory _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org