Viz code beautification
authorAnatoly Baksheev <no@email>
Sun, 17 Nov 2013 11:18:39 +0000 (15:18 +0400)
committerAnatoly Baksheev <no@email>
Sun, 17 Nov 2013 15:33:55 +0000 (19:33 +0400)
modules/viz/include/opencv2/viz.hpp
modules/viz/src/interactor_style.cpp
modules/viz/src/interactor_style.h
modules/viz/src/precomp.hpp
modules/viz/src/viz.cpp
modules/viz/src/viz3d_impl.cpp
modules/viz/src/viz3d_impl.hpp
modules/viz/test/test_tutorial3.cpp
modules/viz/test/test_viz3d.cpp

index f6dc882..5c2fe03 100644 (file)
@@ -108,10 +108,9 @@ namespace cv
             void remove(const String &window_name);
 
             static VizAccessor * instance_;
-            static bool is_instantiated_;
 
             struct VizAccessorImpl;
-            static VizAccessorImpl * impl_;
+            VizAccessorImpl * impl_;
 
             friend class Viz3d;
         };
index c740b24..ccf188d 100644 (file)
@@ -48,9 +48,6 @@
 
 #include "precomp.hpp"
 
-
-using namespace cv;
-
 //////////////////////////////////////////////////////////////////////////////////////////////
 void cv::viz::InteractorStyle::Initialize()
 {
@@ -78,11 +75,11 @@ void cv::viz::InteractorStyle::Initialize()
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////////
-void cv::viz::InteractorStyle::saveScreenshot(const std::string &file)
+void cv::viz::InteractorStyle::saveScreenshot(const String &file)
 {
     FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);
     wif_->SetInput(Interactor->GetRenderWindow());
-    wif_->Modified();      // Update the WindowToImageFilter
+    wif_->Modified(); // Update the WindowToImageFilter
     snapshot_writer_->Modified();
     snapshot_writer_->SetFileName(file.c_str());
     snapshot_writer_->Write();
@@ -117,30 +114,19 @@ void cv::viz::InteractorStyle::OnChar()
     FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);
     if (Interactor->GetKeyCode() >= '0' && Interactor->GetKeyCode() <= '9')
         return;
-    std::string key(Interactor->GetKeySym());
-    if (key.find("XF86ZoomIn") != std::string::npos)
+
+    String key(Interactor->GetKeySym());
+    if (key.find("XF86ZoomIn") != String::npos)
         zoomIn();
-    else if (key.find("XF86ZoomOut") != std::string::npos)
+    else if (key.find("XF86ZoomOut") != String::npos)
         zoomOut();
 
     int keymod = false;
     switch (modifier_)
     {
-    case KB_MOD_ALT:
-    {
-        keymod = Interactor->GetAltKey();
-        break;
-    }
-    case KB_MOD_CTRL:
-    {
-        keymod = Interactor->GetControlKey();
-        break;
-    }
-    case KB_MOD_SHIFT:
-    {
-        keymod = Interactor->GetShiftKey();
-        break;
-    }
+    case KB_MOD_ALT:   keymod = Interactor->GetAltKey(); break;
+    case KB_MOD_CTRL:  keymod = Interactor->GetControlKey(); break;
+    case KB_MOD_SHIFT: keymod = Interactor->GetShiftKey(); break;
     }
 
     switch (Interactor->GetKeyCode())
@@ -202,7 +188,6 @@ bool cv::viz::InteractorStyle::getControlKey() { return Interactor->GetControlKe
 void
 cv::viz::InteractorStyle::OnKeyDown()
 {
-
     CV_Assert("Interactor style not initialized. Please call Initialize() before continuing" && init_);
     CV_Assert("No renderer given! Use SetRendererCollection() before continuing." && renderer_);
 
@@ -274,42 +259,40 @@ cv::viz::InteractorStyle::OnKeyDown()
         vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors();
         vtkCollectionSimpleIterator ait;
         for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); )
-        {
             for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); )
             {
                 vtkActor* apart = reinterpret_cast <vtkActor*>(path->GetLastNode()->GetViewProp());
                 apart->GetProperty()->SetRepresentationToPoints();
             }
-        }
         break;
     }
         // Save a PNG snapshot with the current screen
     case 'j': case 'J':
     {
-        char cam_fn[80], snapshot_fn[80];
-        unsigned t = static_cast<unsigned>(time(0));
-        sprintf(snapshot_fn, "screenshot-%d.png" , t);
-        saveScreenshot(snapshot_fn);
-
-        sprintf(cam_fn, "screenshot-%d.cam", t);
-        ofstream ofs_cam;
-        ofs_cam.open(cam_fn);
+        unsigned int t = static_cast<unsigned int>(time(0));
+        String png_file = cv::format("screenshot-%d.png", t);
+        String cam_file = cv::format("screenshot-%d.cam", t);
+
         vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera();
-        double clip[2], focal[3], pos[3], view[3];
-        cam->GetClippingRange(clip);
-        cam->GetFocalPoint(focal);
-        cam->GetPosition(pos);
-        cam->GetViewUp(view);
-
-        int *win_pos = Interactor->GetRenderWindow()->GetPosition();
-        int *win_size = Interactor->GetRenderWindow()->GetSize();
-        ofs_cam << clip[0]  << "," << clip[1]  << "/" << focal[0] << "," << focal[1] << "," << focal[2] << "/" <<
-                               pos[0]   << "," << pos[1]   << "," << pos[2]   << "/" << view[0]  << "," << view[1]  << "," << view[2] << "/" <<
-                               cam->GetViewAngle() / 180.0 * CV_PI  << "/" << win_size[0] << "," << win_size[1] << "/" << win_pos[0] << "," << win_pos[1]
-                            << endl;
+        Vec2d clip;
+        Vec3d focal, pos, view;
+        cam->GetClippingRange(clip.val);
+        cam->GetFocalPoint(focal.val);
+        cam->GetPosition(pos.val);
+        cam->GetViewUp(view.val);
+        Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition());
+        Vec2i win_size(Interactor->GetRenderWindow()->GetSize());
+        double angle = cam->GetViewAngle() / 180.0 * CV_PI;
+
+        String data = cv::format("%f,%f/%f,%f,%f/%f,%f,%f/%f,%f,%f/%f/%d,%d/%d,%d", clip[0],clip[1], focal[0],focal[1],focal[2],
+                 pos[0],pos[1],pos[2], view[0],view[1], view[2], angle , win_size[0],win_size[1], win_pos[0], win_pos[1]);
+
+        saveScreenshot(png_file);
+        ofstream ofs_cam(cam_file.c_str());
+        ofs_cam << data.c_str() << endl;
         ofs_cam.close();
 
-        std::cout << "Screenshot (" << snapshot_fn << ") and camera information (" << cam_fn << ") successfully captured." << std::endl;
+        cout << "Screenshot (" << png_file.c_str() << ") and camera information (" << cam_file.c_str() << ") successfully captured." << endl;
         break;
     }
         // display current camera settings/parameters
@@ -354,7 +337,6 @@ cv::viz::InteractorStyle::OnKeyDown()
             vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors();
             vtkCollectionSimpleIterator ait;
             for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); )
-            {
                 for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); )
                 {
                     vtkActor* apart = reinterpret_cast <vtkActor*>(path->GetLastNode()->GetViewProp());
@@ -362,7 +344,6 @@ cv::viz::InteractorStyle::OnKeyDown()
                     if (psize < 63.0f)
                         apart->GetProperty()->SetPointSize(psize + 1.0f);
                 }
-            }
         }
         break;
     }
@@ -375,7 +356,6 @@ cv::viz::InteractorStyle::OnKeyDown()
             vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors();
             vtkCollectionSimpleIterator ait;
             for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); )
-            {
                 for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); )
                 {
                     vtkActor* apart = static_cast<vtkActor*>(path->GetLastNode()->GetViewProp());
@@ -383,7 +363,6 @@ cv::viz::InteractorStyle::OnKeyDown()
                     if (psize > 1.0f)
                         apart->GetProperty()->SetPointSize(psize - 1.0f);
                 }
-            }
         }
         break;
     }
@@ -460,9 +439,7 @@ cv::viz::InteractorStyle::OnKeyDown()
     case 'o': case 'O':
     {
         vtkSmartPointer<vtkCamera> cam = CurrentRenderer->GetActiveCamera();
-        int flag = cam->GetParallelProjection();
-        cam->SetParallelProjection(!flag);
-
+        cam->SetParallelProjection(!cam->GetParallelProjection());
         CurrentRenderer->SetActiveCamera(cam);
         CurrentRenderer->Render();
         break;
@@ -499,18 +476,14 @@ cv::viz::InteractorStyle::OnKeyDown()
         // if a valid transformation was found, use it otherwise fall back to default view point.
         if (found_transformation)
         {
-            vtkProp3D * actor = vtkProp3D::SafeDownCast(it->second);
-            cam->SetPosition(actor->GetUserMatrix()->GetElement(0, 3),
-                             actor->GetUserMatrix()->GetElement(1, 3),
-                             actor->GetUserMatrix()->GetElement(2, 3));
+            const vtkMatrix4x4* m = vtkProp3D::SafeDownCast(it->second)->GetUserMatrix();
 
-            cam->SetFocalPoint(actor->GetUserMatrix()->GetElement(0, 3) - actor->GetUserMatrix()->GetElement(0, 2),
-                               actor->GetUserMatrix()->GetElement(1, 3) - actor->GetUserMatrix()->GetElement(1, 2),
-                               actor->GetUserMatrix()->GetElement(2, 3) - actor->GetUserMatrix()->GetElement(2, 2));
+            cam->SetFocalPoint(m->GetElement(0, 3) - m->GetElement(0, 2),
+                               m->GetElement(1, 3) - m->GetElement(1, 2),
+                               m->GetElement(2, 3) - m->GetElement(2, 2));
 
-            cam->SetViewUp(actor->GetUserMatrix()->GetElement(0, 1),
-                           actor->GetUserMatrix()->GetElement(1, 1),
-                           actor->GetUserMatrix()->GetElement(2, 1));
+            cam->SetViewUp  (m->GetElement(0, 1), m->GetElement(1, 1), m->GetElement(2, 1));
+            cam->SetPosition(m->GetElement(0, 3), m->GetElement(1, 3), m->GetElement(2, 3));
         }
         else
         {
@@ -712,11 +685,8 @@ void cv::viz::InteractorStyle::OnTimer()
     Interactor->Render();
 }
 
-namespace cv
+namespace cv { namespace viz
 {
-    namespace viz
-    {
-        //Standard VTK macro for *New()
-        vtkStandardNewMacro(InteractorStyle)
-    }
-}
+    //Standard VTK macro for *New()
+    vtkStandardNewMacro(InteractorStyle)
+}}
index ed3f4df..3af13fc 100644 (file)
@@ -57,16 +57,9 @@ namespace cv
         {
         public:
 
-            enum KeyboardModifier
-            {
-                KB_MOD_ALT,
-                KB_MOD_CTRL,
-                KB_MOD_SHIFT
-            };
+            enum KeyboardModifier { KB_MOD_ALT, KB_MOD_CTRL, KB_MOD_SHIFT };
 
             static InteractorStyle *New();
-
-            InteractorStyle() {}
             virtual ~InteractorStyle() {}
 
             // this macro defines Superclass, the isA functionality and the safe downcast method
@@ -75,32 +68,24 @@ namespace cv
             /** \brief Initialization routine. Must be called before anything else. */
             virtual void Initialize();
 
-            inline void setWidgetActorMap(const Ptr<WidgetActorMap>& actors) { widget_actor_map_ = actors; }
+            void setWidgetActorMap(const Ptr<WidgetActorMap>& actors) { widget_actor_map_ = actors; }
             void setRenderer(vtkSmartPointer<vtkRenderer>& ren) { renderer_ = ren; }
             void registerMouseCallback(void (*callback)(const MouseEvent&, void*), void* cookie = 0);
             void registerKeyboardCallback(void (*callback)(const KeyboardEvent&, void*), void * cookie = 0);
-            void saveScreenshot(const std::string &file);
+            void saveScreenshot(const String &file);
 
             /** \brief Change the default keyboard modified from ALT to a different special key.*/
             inline void setKeyboardModifier(const KeyboardModifier &modifier) { modifier_ = modifier; }
 
-        protected:
+        private:
             /** \brief Set to true after initialization is complete. */
             bool init_;
 
-            /** \brief Collection of vtkRenderers stored internally. */
             vtkSmartPointer<vtkRenderer> renderer_;
+            Ptr<WidgetActorMap> widget_actor_map_;
 
-            /** \brief Actor map stored internally. */
-            cv::Ptr<WidgetActorMap> widget_actor_map_;
-
-            /** \brief The current window width/height. */
             Vec2i win_size_;
-
-            /** \brief The current window position x/y. */
             Vec2i win_pos_;
-
-            /** \brief The maximum resizeable window width/height. */
             Vec2i max_win_size_;
 
             /** \brief A PNG writer for screenshot captures. */
index beb7c5c..6df03e4 100644 (file)
 #include <opencv2/core.hpp>
 #include <opencv2/viz.hpp>
 #include <opencv2/viz/widget_accessor.hpp>
+#include <opencv2/core/utility.hpp>
 
 namespace cv
 {
index 2517d13..747c8de 100644 (file)
 
 cv::Affine3f cv::viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin)
 {
-    Affine3f::Mat3 R;
-    R.val[0] = axis_x.val[0];
-    R.val[3] = axis_x.val[1];
-    R.val[6] = axis_x.val[2];
-
-    R.val[1] = axis_y.val[0];
-    R.val[4] = axis_y.val[1];
-    R.val[7] = axis_y.val[2];
-
-    R.val[2] = axis_z.val[0];
-    R.val[5] = axis_z.val[1];
-    R.val[8] = axis_z.val[2];
+    Affine3f::Mat3 R(axis_x[0], axis_y[0], axis_z[0],
+                     axis_x[1], axis_y[1], axis_z[1],
+                     axis_x[2], axis_y[2], axis_z[2]);
 
     return Affine3f(R, origin);
 }
@@ -73,22 +64,7 @@ cv::Affine3f cv::viz::makeCameraPose(const Vec3f& position, const Vec3f& focal_p
     Vec3f u = normalize(y_dir.cross(n));
     Vec3f v = n.cross(u);
 
-    Matx44f pose_mat = Matx44f::zeros();
-    pose_mat(0,0) = u[0];
-    pose_mat(0,1) = u[1];
-    pose_mat(0,2) = u[2];
-    pose_mat(1,0) = v[0];
-    pose_mat(1,1) = v[1];
-    pose_mat(1,2) = v[2];
-    pose_mat(2,0) = n[0];
-    pose_mat(2,1) = n[1];
-    pose_mat(2,2) = n[2];
-    pose_mat(3,0) = position[0];
-    pose_mat(3,1) = position[1];
-    pose_mat(3,2) = position[2];
-    pose_mat(3,3) = 1.0f;
-    pose_mat = pose_mat.t();
-    return pose_mat;
+    return makeTransformToGlobal(u, v, n, position);
 }
 
 vtkSmartPointer<vtkMatrix4x4> cv::viz::convertToVtkMatrix(const cv::Matx44f &m)
@@ -109,36 +85,31 @@ cv::Matx44f cv::viz::convertToMatx(const vtkSmartPointer<vtkMatrix4x4>& vtk_matr
     return m;
 }
 
-namespace cv
+namespace cv { namespace viz
 {
-    namespace viz
+    template<typename _Tp> Vec<_Tp, 3>* vtkpoints_data(vtkSmartPointer<vtkPoints>& points);
+
+    template<> Vec3f* vtkpoints_data<float>(vtkSmartPointer<vtkPoints>& points)
     {
-        template<typename _Tp> Vec<_Tp, 3>* vtkpoints_data(vtkSmartPointer<vtkPoints>& points);
-
-        template<> Vec3f* vtkpoints_data<float>(vtkSmartPointer<vtkPoints>& points)
-        {
-            CV_Assert(points->GetDataType() == VTK_FLOAT);
-            vtkDataArray *data = points->GetData();
-            float *pointer = static_cast<vtkFloatArray*>(data)->GetPointer(0);
-            return reinterpret_cast<Vec3f*>(pointer);
-        }
-
-        template<> Vec3d* vtkpoints_data<double>(vtkSmartPointer<vtkPoints>& points)
-        {
-            CV_Assert(points->GetDataType() == VTK_DOUBLE);
-            vtkDataArray *data = points->GetData();
-            double *pointer = static_cast<vtkDoubleArray*>(data)->GetPointer(0);
-            return reinterpret_cast<Vec3d*>(pointer);
-        }
+        CV_Assert(points->GetDataType() == VTK_FLOAT);
+        vtkDataArray *data = points->GetData();
+        float *pointer = static_cast<vtkFloatArray*>(data)->GetPointer(0);
+        return reinterpret_cast<Vec3f*>(pointer);
     }
-}
+
+    template<> Vec3d* vtkpoints_data<double>(vtkSmartPointer<vtkPoints>& points)
+    {
+        CV_Assert(points->GetDataType() == VTK_DOUBLE);
+        vtkDataArray *data = points->GetData();
+        double *pointer = static_cast<vtkDoubleArray*>(data)->GetPointer(0);
+        return reinterpret_cast<Vec3d*>(pointer);
+    }
+}}
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 /// Viz accessor implementation
 
 cv::viz::VizAccessor * cv::viz::VizAccessor::instance_ = 0;
-bool cv::viz::VizAccessor::is_instantiated_ = false;
-cv::viz::VizAccessor::VizAccessorImpl * cv::viz::VizAccessor::impl_ = 0;
 
 struct cv::viz::VizAccessor::VizAccessorImpl
 {
@@ -146,33 +117,22 @@ struct cv::viz::VizAccessor::VizAccessorImpl
 };
 
 cv::viz::VizAccessor::VizAccessor() { impl_ = new cv::viz::VizAccessor::VizAccessorImpl;}
-
-cv::viz::VizAccessor::~VizAccessor()
-{
-    if(impl_)
-    {
-        delete impl_;
-        impl_ = 0;
-    }
-}
+cv::viz::VizAccessor::~VizAccessor() { delete impl_; }
 
 cv::viz::VizAccessor & cv::viz::VizAccessor::getInstance()
 {
-    if (!is_instantiated_)
-    {
+    if (!instance_)
         instance_ = new VizAccessor();
-        is_instantiated_ = true;
-    }
+
     return *instance_;
 }
 
 void cv::viz::VizAccessor::release()
 {
-    if (is_instantiated_)
+    if (instance_)
     {
         delete instance_;
         instance_ = 0;
-        is_instantiated_ = false;
     }
 }
 
@@ -183,18 +143,15 @@ cv::viz::Viz3d cv::viz::VizAccessor::get(const String & window_name)
     generateWindowName(window_name, name);
 
     VizMap::iterator vm_itr = impl_->viz_map.find(name);
-    bool exists = vm_itr != impl_->viz_map.end();
-    if (exists) return vm_itr->second;
-    else return Viz3d(window_name);
+    return vm_itr != impl_->viz_map.end() ? vm_itr->second : Viz3d(window_name);
 }
 
 void cv::viz::VizAccessor::add(Viz3d window)
 {
     String window_name = window.getWindowName();
     VizMap::iterator vm_itr = impl_->viz_map.find(window_name);
-    bool exists = vm_itr != impl_->viz_map.end();
-    if (exists) return ;
-    impl_->viz_map.insert(VizPair(window_name, window));
+    if (vm_itr == impl_->viz_map.end())
+        impl_->viz_map.insert(VizPair(window_name, window));
 }
 
 void cv::viz::VizAccessor::remove(const String &window_name)
@@ -204,21 +161,24 @@ void cv::viz::VizAccessor::remove(const String &window_name)
     generateWindowName(window_name, name);
 
     VizMap::iterator vm_itr = impl_->viz_map.find(name);
-    bool exists = vm_itr != impl_->viz_map.end();
-    if (!exists) return ;
-    impl_->viz_map.erase(vm_itr);
+    if (vm_itr != impl_->viz_map.end())
+        impl_->viz_map.erase(vm_itr);
 }
 
 void cv::viz::VizAccessor::generateWindowName(const String &window_name, String &output)
 {
     output = "Viz";
     // Already is Viz
-    if (window_name == output) return;
+    if (window_name == output)
+        return;
 
     String prefixed = output + " - ";
-    if (window_name.substr(0, prefixed.length()) == prefixed) output = window_name; // Already has "Viz - "
-    else if (window_name.substr(0, output.length()) == output) output = prefixed + window_name; // Doesn't have prefix
-    else output = (window_name == "" ? output : prefixed + window_name);
+    if (window_name.substr(0, prefixed.length()) == prefixed)
+        output = window_name; // Already has "Viz - "
+    else if (window_name.substr(0, output.length()) == output)
+        output = prefixed + window_name; // Doesn't have prefix
+    else
+        output = (window_name == "" ? output : prefixed + window_name);
 }
 
 cv::viz::Viz3d cv::viz::get(const String &window_name)
index d014372..ae8fc15 100644 (file)
@@ -47,9 +47,6 @@
 //M*/
 
 #include "precomp.hpp"
-#include "opencv2/core/utility.hpp"
-
-#include <vtkRenderWindowInteractor.h>
 
 #if 1 || !defined __APPLE__
 vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew()
@@ -60,9 +57,7 @@ vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew()
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 cv::viz::Viz3d::VizImpl::VizImpl(const String &name)
-    :  style_(vtkSmartPointer<cv::viz::InteractorStyle>::New())
-    , widget_actor_map_(new WidgetActorMap)
-    , s_lastDone_(0.0)
+    :  style_(vtkSmartPointer<cv::viz::InteractorStyle>::New()) , widget_actor_map_(new WidgetActorMap), s_lastDone_(0.0)
 {
     renderer_ = vtkSmartPointer<vtkRenderer>::New();
 
@@ -127,7 +122,8 @@ cv::viz::Viz3d::VizImpl::~VizImpl()
 {
     if (interactor_)
         interactor_->DestroyTimer(timer_id_);
-    if (renderer_) renderer_->Clear();
+    if (renderer_)
+        renderer_->Clear();
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -394,7 +390,7 @@ cv::viz::Camera cv::viz::Viz3d::VizImpl::getCamera() const
 
     Size window_size(renderer_->GetRenderWindow()->GetSize()[0],
                      renderer_->GetRenderWindow()->GetSize()[1]);
-    double aspect_ratio = static_cast<double>(window_size.width) / static_cast<double>(window_size.height);
+    double aspect_ratio = window_size.width / (double)window_size.height;
 
     Matx44f proj_matrix = convertToMatx(active_camera.GetProjectionTransformMatrix(aspect_ratio, -1.0f, 1.0f));
     Camera camera(proj_matrix, window_size);
index 50d642e..88f8424 100644 (file)
@@ -124,10 +124,7 @@ private:
 
     struct ExitMainLoopTimerCallback : public vtkCommand
     {
-        static ExitMainLoopTimerCallback* New()
-        {
-            return new ExitMainLoopTimerCallback;
-        }
+        static ExitMainLoopTimerCallback* New() { return new ExitMainLoopTimerCallback; }
         virtual void Execute(vtkObject* vtkNotUsed(caller), unsigned long event_id, void* call_data)
         {
             if (event_id != vtkCommand::TimerEvent)
@@ -146,10 +143,7 @@ private:
 
     struct ExitCallback : public vtkCommand
     {
-        static ExitCallback* New()
-        {
-            return new ExitCallback;
-        }
+        static ExitCallback* New() { return new ExitCallback; }
         virtual void Execute(vtkObject*, unsigned long event_id, void*)
         {
             if (event_id == vtkCommand::ExitEvent)
@@ -188,21 +182,7 @@ private:
 
     bool removeActorFromRenderer(const vtkSmartPointer<vtkProp> &actor);
 
-    /** \brief Internal method. Creates a vtk actor from a vtk polydata object.
-          * \param[in] data the vtk polydata object to create an actor for
-          * \param[out] actor the resultant vtk actor object
-          * \param[in] use_scalars set scalar properties to the mapper if it exists in the data. Default: true.
-          */
     void createActorFromVTKDataSet(const vtkSmartPointer<vtkDataSet> &data, vtkSmartPointer<vtkLODActor> &actor, bool use_scalars = true);
-
-    /** \brief Updates a set of cells (vtkIdTypeArray) if the number of points in a cloud changes
-          * \param[out] cells the vtkIdTypeArray object (set of cells) to update
-          * \param[out] initcells a previously saved set of cells. If the number of points in the current cloud is
-          * higher than the number of cells in \a cells, and initcells contains enough data, then a copy from it
-          * will be made instead of regenerating the entire array.
-          * \param[in] nr_points the number of points in the new cloud. This dictates how many cells we need to
-          * generate
-          */
     void updateCells(vtkSmartPointer<vtkIdTypeArray> &cells, vtkSmartPointer<vtkIdTypeArray> &initcells, vtkIdType nr_points);
 };
 
index 27544a9..6c63763 100644 (file)
@@ -75,12 +75,12 @@ void tutorial3(bool camera_pov)
     myWindow.spin();
 }
 
-TEST(Viz_viz3d, tutorial3_global_view)
+TEST(Viz_viz3d, DISABLED_tutorial3_global_view)
 {
     tutorial3(false);
 }
 
-TEST(Viz_viz3d, tutorial3_camera_view)
+TEST(Viz_viz3d, DISABLED_tutorial3_camera_view)
 {
     tutorial3(true);
 }
index 2acb5a3..9881116 100644 (file)
@@ -96,18 +96,18 @@ TEST(Viz_viz3d, develop)
     cv::viz::WMesh bunny_widget(bunny_mesh);
     bunny_widget.setColor(cv::viz::Color::cyan());
 
-    cam_1 = cv::viz::WCameraPosition(cv::Vec2f(0.6, 0.4), 0.2, cv::viz::Color::green());
+    cam_1 = cv::viz::WCameraPosition(cv::Vec2f(0.6f, 0.4f), 0.2, cv::viz::Color::green());
     cam_coordinates = cv::viz::WCameraPosition(0.2);
 
     viz.showWidget("bunny", bunny_widget);
-    viz.showWidget("cam_1", cam_1, viz::makeCameraPose(Point3f(1.0,0.0,0.0), Point3f(0.0,0.0,0.0), Point3f(0.0,1.0,0.0)));
-    viz.showWidget("cam_coordinate", cam_coordinates, viz::makeCameraPose(Point3f(1.0,0.0,0.0), Point3f(0.0,0.0,0.0), Point3f(0.0,1.0,0.0)));
+    viz.showWidget("cam_1", cam_1, viz::makeCameraPose(Point3f(1.f,0.f,0.f), Point3f(0.f,0.f,0.f), Point3f(0.f,1.f,0.f)));
+    viz.showWidget("cam_coordinate", cam_coordinates, viz::makeCameraPose(Point3f(1.f,0.f,0.f), Point3f(0.f,0.f,0.f), Point3f(0.f,1.f,0.f)));
 
     std::vector<Affine3f> cam_path;
 
     for (int i = 0, j = 0; i <= 360; ++i, j+=5)
     {
-        cam_path.push_back(viz::makeCameraPose(Vec3d(0.5*cos(double(i)*CV_PI/180.0), 0.5*sin(double(j)*CV_PI/180.0), 0.5*sin(double(i)*CV_PI/180.0)), Vec3f(0.f, 0.f, 0.f), Vec3f(0.f, 1.f, 0.f)));
+        cam_path.push_back(viz::makeCameraPose(Vec3d(0.5*cos(i*CV_PI/180.0), 0.5*sin(j*CV_PI/180.0), 0.5*sin(i*CV_PI/180.0)), Vec3f(0.f, 0.f, 0.f), Vec3f(0.f, 1.f, 0.f)));
     }
 
     int path_counter = 0;