pull/2173/head
Anatoly Baksheev 11 years ago
parent 0d702b83f4
commit 64566e6178
  1. 8
      modules/viz/src/interactor_style.cpp
  2. 31
      modules/viz/src/vizimpl.cpp

@ -298,12 +298,8 @@ void cv::viz::InteractorStyle::OnKeyDown()
{
vtkSmartPointer<vtkCamera> 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;

@ -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<cv::viz::InteractorStyle>::New()), widget_actor_map_(new WidgetActorMap)
: s_lastDone_(0.0), style_(vtkSmartPointer<InteractorStyle>::New()), widget_actor_map_(new WidgetActorMap)
{
renderer_ = vtkSmartPointer<vtkRenderer>::New();
window_ = vtkSmartPointer<vtkRenderWindow>::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<vtkRenderWindowInteractor>::Take(vtkRenderWindowInteractorFixNew());
#else
interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::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]); }

Loading…
Cancel
Save