diff --git a/modules/viz/src/interactor_style.cpp b/modules/viz/src/interactor_style.cpp index 2e948e660d..c2583f9363 100644 --- a/modules/viz/src/interactor_style.cpp +++ b/modules/viz/src/interactor_style.cpp @@ -298,12 +298,8 @@ void cv::viz::InteractorStyle::OnKeyDown() { vtkSmartPointer cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera(); - Vec2d clip; - Vec3d focal, pos, view; - cam->GetClippingRange(clip.val); - cam->GetFocalPoint(focal.val); - cam->GetPosition(pos.val); - cam->GetViewUp(view.val); + Vec2d clip(cam->GetClippingRange()); + Vec3d focal(cam->GetFocalPoint()), pos(cam->GetPosition()), view(cam->GetViewUp()); Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); double angle = cam->GetViewAngle () / 180.0 * CV_PI; diff --git a/modules/viz/src/vizimpl.cpp b/modules/viz/src/vizimpl.cpp index 4b9d65b43e..5974cc6e03 100644 --- a/modules/viz/src/vizimpl.cpp +++ b/modules/viz/src/vizimpl.cpp @@ -45,18 +45,9 @@ #include "precomp.hpp" - -#if (1 || !defined __APPLE__) && !defined _MSC_VER -vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew(); -vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew() -{ - return vtkRenderWindowInteractor::New(); -} -#endif - ///////////////////////////////////////////////////////////////////////////////////////////// cv::viz::Viz3d::VizImpl::VizImpl(const String &name) - : s_lastDone_(0.0), style_(vtkSmartPointer::New()), widget_actor_map_(new WidgetActorMap) + : s_lastDone_(0.0), style_(vtkSmartPointer::New()), widget_actor_map_(new WidgetActorMap) { renderer_ = vtkSmartPointer::New(); window_ = vtkSmartPointer::New(); @@ -72,12 +63,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) style_->setWidgetActorMap(widget_actor_map_); style_->UseTimersOn(); - ///////////////////////////////////////////////// -#if (1 || !defined __APPLE__) && !defined _MSC_VER - interactor_ = vtkSmartPointer::Take(vtkRenderWindowInteractorFixNew()); -#else interactor_ = vtkSmartPointer::New(); -#endif window_->AlphaBitPlanesOff(); window_->PointSmoothingOff(); @@ -88,7 +74,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) interactor_->SetRenderWindow(window_); interactor_->SetInteractorStyle(style_); - interactor_->SetDesiredUpdateRate(30.0); + interactor_->SetDesiredUpdateRate(24.0); // Initialize and create timer, also create window interactor_->Initialize(); @@ -401,10 +387,7 @@ void cv::viz::Viz3d::VizImpl::converTo3DRay(const Point3d &window_coord, Point3d { Vec4d world_pt; vtkInteractorObserver::ComputeDisplayToWorld(renderer_, window_coord.x, window_coord.y, window_coord.z, world_pt.val); - - vtkCamera &active_camera = *renderer_->GetActiveCamera(); - Vec3d cam_pos; - active_camera.GetPosition(cam_pos.val); + Vec3d cam_pos(renderer_->GetActiveCamera()->GetPosition()); origin = cam_pos; direction = normalize(Vec3d(world_pt.val) - cam_pos); } @@ -479,7 +462,6 @@ void cv::viz::Viz3d::VizImpl::setRepresentation(int representation) } } - ////////////////////////////////////////////////////////////////////////////////////////////// void cv::viz::Viz3d::VizImpl::setFullScreen(bool mode) { @@ -488,12 +470,7 @@ void cv::viz::Viz3d::VizImpl::setFullScreen(bool mode) } ////////////////////////////////////////////////////////////////////////////////////////////// -cv::String cv::viz::Viz3d::VizImpl::getWindowName() const -{ - return (window_ ? window_->GetWindowName() : ""); -} - -////////////////////////////////////////////////////////////////////////////////////////////// +cv::String cv::viz::Viz3d::VizImpl::getWindowName() const { return window_ ? window_->GetWindowName() : ""; } void cv::viz::Viz3d::VizImpl::setWindowPosition(const Point& position) { window_->SetPosition(position.x, position.y); } void cv::viz::Viz3d::VizImpl::setWindowSize(const Size& window_size) { window_->SetSize(window_size.width, window_size.height); } cv::Size cv::viz::Viz3d::VizImpl::getWindowSize() const { return Size(window_->GetSize()[0], window_->GetSize()[1]); }