From 2cd4bd513a56a8d4693074b316401b615819a4d5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 17 May 2004 22:22:24 +0000 Subject: [PATCH] Changed how the rotation and panning are managed, therby improving the handling of the center point going over a pole. --- include/osgGA/TerrainManipulator | 2 +- src/osgGA/TerrainManipulator.cpp | 77 +++++++++++++++++++++++--------- 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/include/osgGA/TerrainManipulator b/include/osgGA/TerrainManipulator index 6b7b9c636..18a5c9edc 100644 --- a/include/osgGA/TerrainManipulator +++ b/include/osgGA/TerrainManipulator @@ -129,7 +129,7 @@ class OSGGA_EXPORT TerrainManipulator : public MatrixManipulator bool _thrown; - osg::CoordinateFrame _coordinateFrame; + double _center[3]; osg::Quat _rotation; float _distance; diff --git a/src/osgGA/TerrainManipulator.cpp b/src/osgGA/TerrainManipulator.cpp index 863f0745a..419fd0c5a 100644 --- a/src/osgGA/TerrainManipulator.cpp +++ b/src/osgGA/TerrainManipulator.cpp @@ -214,7 +214,8 @@ void TerrainManipulator::setByMatrix(const osg::Matrixd& matrix) osg::Vec3 start_segment = eye; osg::Vec3 end_segment = eye + lookVector*distance; - osg::notify(INFO)<<"start="<getBound().radius(); - osg::Vec3 start_segment = _coordinateFrame.getTrans() + getUpVector(_coordinateFrame) * distance; - osg::Vec3 end_segment = start_segment - getUpVector(_coordinateFrame) * (2.0f*distance); + osg::Vec3 start_segment = osg::Vec3(_center[0],_center[1],_center[2]) + getUpVector(coordinateFrame) * distance; + osg::Vec3 end_segment = start_segment - getUpVector(coordinateFrame) * (2.0f*distance); //end_segment.set(0.0f,0.0f,0.0f); - osg::notify(INFO)<<"start="<