diff --git a/include/osgGA/TerrainManipulator b/include/osgGA/TerrainManipulator index 942dc7d2e..7de61b9ff 100644 --- a/include/osgGA/TerrainManipulator +++ b/include/osgGA/TerrainManipulator @@ -132,6 +132,7 @@ class OSGGA_EXPORT TerrainManipulator : public MatrixManipulator osg::Vec3d _center; osg::Quat _rotation; float _distance; + osg::Vec3d _previousUp; }; diff --git a/src/osg/Quat.cpp b/src/osg/Quat.cpp index fe2a16bf5..9649b00c3 100644 --- a/src/osg/Quat.cpp +++ b/src/osg/Quat.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -103,7 +104,7 @@ void Quat::makeRotate( const Vec3f& from, const Vec3f& to ) // are co-incident or opposite in direction. void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) { - const value_type epsilon = 0.00001; + const value_type epsilon = 0.0000001; value_type length1 = from.length(); value_type length2 = to.length(); @@ -113,10 +114,12 @@ void Quat::makeRotate( const Vec3d& from, const Vec3d& to ) if ( fabs(cosangle - 1) < epsilon ) { + osg::notify(osg::INFO)<<"*** Quat::makeRotate(from,to) with near co-linear vectors, epsilon= "<getBound().radius(); - osg::Vec3d start_segment = osg::Vec3d(_center[0],_center[1],_center[2]) + getUpVector(coordinateFrame) * distance; + osg::Vec3d start_segment = _center + getUpVector(coordinateFrame) * distance; osg::Vec3d end_segment = start_segment - getUpVector(coordinateFrame) * (2.0f*distance); osg::notify(INFO)<<"start="<