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 ());
59 for (std::size_t i = 0; i < cloud->
points.size (); ++i)
62 polygon->GetPointIds ()->SetId (i, i);
66 poly_grid->Allocate (1, 1);
67 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
68 poly_grid->SetPoints (poly_points);
84 poly_points->SetNumberOfPoints (planar_polygon.
getContour ().size () + 1);
85 polygon->GetPointIds ()->SetNumberOfIds (planar_polygon.
getContour ().size () + 1);
87 for (std::size_t i = 0; i < planar_polygon.
getContour ().size (); ++i)
89 poly_points->SetPoint (i, planar_polygon.
getContour ()[i].x,
92 polygon->GetPointIds ()->SetId (i, i);
95 std::size_t closingContourId = planar_polygon.
getContour ().size ();
96 auto firstContour = planar_polygon.
getContour ()[0];
97 poly_points->SetPoint (closingContourId, firstContour.x,
100 polygon->GetPointIds ()->SetId (closingContourId, closingContourId);
103 poly_grid->Allocate (1, 1);
104 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
105 poly_grid->SetPoints (poly_points);