40 #include <vtkSmartPointer.h> 41 #include <vtkPoints.h> 42 #include <vtkPolygon.h> 43 #include <vtkUnstructuredGrid.h> 50 if (cloud->
points.empty ())
56 poly_points->SetNumberOfPoints (cloud->
points.size ());
57 polygon->GetPointIds ()->SetNumberOfIds (cloud->
points.size ());
60 for (i = 0; i < cloud->
points.size (); ++i)
63 polygon->GetPointIds ()->SetId (i, i);
67 poly_grid->Allocate (1, 1);
68 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
69 poly_grid->SetPoints (poly_points);
85 poly_points->SetNumberOfPoints (planar_polygon.
getContour ().size () + 1);
86 polygon->GetPointIds ()->SetNumberOfIds (planar_polygon.
getContour ().size () + 1);
89 for (i = 0; i < planar_polygon.
getContour ().size (); ++i)
91 poly_points->SetPoint (i, planar_polygon.
getContour ()[i].x,
94 polygon->GetPointIds ()->SetId (i, i);
97 poly_points->SetPoint (i, planar_polygon.
getContour ()[0].x,
100 polygon->GetPointIds ()->SetId (i, i);
103 poly_grid->Allocate (1, 1);
104 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
105 poly_grid->SetPoints (poly_points);
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
pcl::PointCloud< PointT >::VectorType & getContour()
Getter for the contour / boundary.
PlanarPolygon represents a planar (2D) polygon, potentially in a 3D space.
vtkSmartPointer< vtkDataSet > createPolygon(const typename pcl::PointCloud< PointT >::ConstPtr &cloud)
Create a 3d poly line from a set of points.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
PCL_EXPORTS void allocVtkUnstructuredGrid(vtkSmartPointer< vtkUnstructuredGrid > &polydata)
Allocate a new unstructured grid smartpointer.