From ed817b0e0532b4baea698dbb68934672f8eb83b6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 13 Nov 2017 21:53:10 +0100 Subject: [PATCH] make retrieving view direction numerically more stable, change orientation of bottom view --- src/Gui/View3DInventor.cpp | 2 +- src/Gui/View3DInventorViewer.cpp | 6 ++---- src/Gui/View3DPy.cpp | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 76becbb088..1616723c4e 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -664,7 +664,7 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn) return true; } else if(strcmp("ViewBottom",pMsg) == 0 ) { - _viewer->setCameraOrientation(SbRotation(-1, 0, 0, 0)); + _viewer->setCameraOrientation(SbRotation(0, -1, 0, 0)); _viewer->viewAll(); return true; } diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 31d5101f3a..d756f152db 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1766,10 +1766,8 @@ SbVec3f View3DInventorViewer::getViewDirection() const if (!cam) return SbVec3f(0,0,-1); // this is the default - SbRotation camrot = cam->orientation.getValue(); - SbVec3f lookat(0, 0, -1); // init to default view direction vector - camrot.multVec(lookat, lookat); - return lookat; + SbVec3f projDir = cam->getViewVolume().getProjectionDirection(); + return projDir; } void View3DInventorViewer::setViewDirection(SbVec3f dir) diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index d359d9293a..15761214ff 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -325,7 +325,7 @@ Py::Object View3DInventorPy::viewBottom(const Py::Tuple& args) throw Py::Exception(); try { - _view->getViewer()->setCameraOrientation(SbRotation(-1, 0, 0, 0)); + _view->getViewer()->setCameraOrientation(SbRotation(0, -1, 0, 0)); } catch (const Base::Exception& e) { throw Py::Exception(e.what());