Commit 64566e61 authored by Anatoly Baksheev's avatar Anatoly Baksheev

minor

parent 0d702b83
...@@ -298,12 +298,8 @@ void cv::viz::InteractorStyle::OnKeyDown() ...@@ -298,12 +298,8 @@ void cv::viz::InteractorStyle::OnKeyDown()
{ {
vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera(); vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera();
Vec2d clip; Vec2d clip(cam->GetClippingRange());
Vec3d focal, pos, view; Vec3d focal(cam->GetFocalPoint()), pos(cam->GetPosition()), view(cam->GetViewUp());
cam->GetClippingRange(clip.val);
cam->GetFocalPoint(focal.val);
cam->GetPosition(pos.val);
cam->GetViewUp(view.val);
Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition()); Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition());
Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize());
double angle = cam->GetViewAngle () / 180.0 * CV_PI; double angle = cam->GetViewAngle () / 180.0 * CV_PI;
......
...@@ -45,18 +45,9 @@ ...@@ -45,18 +45,9 @@
#include "precomp.hpp" #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) 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(); renderer_ = vtkSmartPointer<vtkRenderer>::New();
window_ = vtkSmartPointer<vtkRenderWindow>::New(); window_ = vtkSmartPointer<vtkRenderWindow>::New();
...@@ -72,12 +63,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) ...@@ -72,12 +63,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
style_->setWidgetActorMap(widget_actor_map_); style_->setWidgetActorMap(widget_actor_map_);
style_->UseTimersOn(); style_->UseTimersOn();
/////////////////////////////////////////////////
#if (1 || !defined __APPLE__) && !defined _MSC_VER
interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::Take(vtkRenderWindowInteractorFixNew());
#else
interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::New(); interactor_ = vtkSmartPointer<vtkRenderWindowInteractor>::New();
#endif
window_->AlphaBitPlanesOff(); window_->AlphaBitPlanesOff();
window_->PointSmoothingOff(); window_->PointSmoothingOff();
...@@ -88,7 +74,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) ...@@ -88,7 +74,7 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
interactor_->SetRenderWindow(window_); interactor_->SetRenderWindow(window_);
interactor_->SetInteractorStyle(style_); interactor_->SetInteractorStyle(style_);
interactor_->SetDesiredUpdateRate(30.0); interactor_->SetDesiredUpdateRate(24.0);
// Initialize and create timer, also create window // Initialize and create timer, also create window
interactor_->Initialize(); interactor_->Initialize();
...@@ -401,10 +387,7 @@ void cv::viz::Viz3d::VizImpl::converTo3DRay(const Point3d &window_coord, Point3d ...@@ -401,10 +387,7 @@ void cv::viz::Viz3d::VizImpl::converTo3DRay(const Point3d &window_coord, Point3d
{ {
Vec4d world_pt; Vec4d world_pt;
vtkInteractorObserver::ComputeDisplayToWorld(renderer_, window_coord.x, window_coord.y, window_coord.z, world_pt.val); vtkInteractorObserver::ComputeDisplayToWorld(renderer_, window_coord.x, window_coord.y, window_coord.z, world_pt.val);
Vec3d cam_pos(renderer_->GetActiveCamera()->GetPosition());
vtkCamera &active_camera = *renderer_->GetActiveCamera();
Vec3d cam_pos;
active_camera.GetPosition(cam_pos.val);
origin = cam_pos; origin = cam_pos;
direction = normalize(Vec3d(world_pt.val) - cam_pos); direction = normalize(Vec3d(world_pt.val) - cam_pos);
} }
...@@ -479,7 +462,6 @@ void cv::viz::Viz3d::VizImpl::setRepresentation(int representation) ...@@ -479,7 +462,6 @@ void cv::viz::Viz3d::VizImpl::setRepresentation(int representation)
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setFullScreen(bool mode) void cv::viz::Viz3d::VizImpl::setFullScreen(bool mode)
{ {
...@@ -488,12 +470,7 @@ 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 cv::String cv::viz::Viz3d::VizImpl::getWindowName() const { return window_ ? window_->GetWindowName() : ""; }
{
return (window_ ? window_->GetWindowName() : "");
}
//////////////////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setWindowPosition(const Point& position) { window_->SetPosition(position.x, position.y); } 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); } 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]); } cv::Size cv::viz::Viz3d::VizImpl::getWindowSize() const { return Size(window_->GetSize()[0], window_->GetSize()[1]); }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment