cube wire_frame fix using vtkOutlineSource

pull/1453/head
ozantonkal 12 years ago
parent 4b85c849ca
commit 769eba7535
  1. 1
      modules/viz/src/precomp.hpp
  2. 19
      modules/viz/src/shape_widgets.cpp

@ -43,6 +43,7 @@
#include <vtkPlaneSource.h> #include <vtkPlaneSource.h>
#include <vtkSphereSource.h> #include <vtkSphereSource.h>
#include <vtkArrowSource.h> #include <vtkArrowSource.h>
#include <vtkOutlineSource.h>
#include <vtkIdentityTransform.h> #include <vtkIdentityTransform.h>
#include <vtkTransform.h> #include <vtkTransform.h>
#include <vtkTransformPolyDataFilter.h> #include <vtkTransformPolyDataFilter.h>

@ -270,18 +270,23 @@ template<> cv::viz::CylinderWidget cv::viz::Widget::cast<cv::viz::CylinderWidget
cv::viz::CubeWidget::CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame, const Color &color) cv::viz::CubeWidget::CubeWidget(const Point3f& pt_min, const Point3f& pt_max, bool wire_frame, const Color &color)
{ {
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New ();
cube->SetBounds (pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New (); vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New ();
mapper->SetInput(cube->GetOutput ()); if (wire_frame)
{
vtkSmartPointer<vtkOutlineSource> cube = vtkSmartPointer<vtkOutlineSource>::New();
cube->SetBounds (pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
mapper->SetInput(cube->GetOutput ());
}
else
{
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New ();
cube->SetBounds (pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
mapper->SetInput(cube->GetOutput ());
}
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New(); vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
actor->SetMapper(mapper); actor->SetMapper(mapper);
if (wire_frame)
actor->GetProperty ()->SetRepresentationToWireframe ();
WidgetAccessor::setProp(*this, actor); WidgetAccessor::setProp(*this, actor);
setColor(color); setColor(color);
} }

Loading…
Cancel
Save