39 template <
typename Po
intT> vtkSmartPointer<vtkDataSet>
42 vtkSmartPointer<vtkUnstructuredGrid> poly_grid;
43 if (cloud->
points.empty ())
46 vtkSmartPointer<vtkPoints> poly_points = vtkSmartPointer<vtkPoints>::New ();
47 vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New ();
49 poly_points->SetNumberOfPoints (cloud->
points.size ());
50 polygon->GetPointIds ()->SetNumberOfIds (cloud->
points.size ());
53 for (i = 0; i < cloud->
points.size (); ++i)
56 polygon->GetPointIds ()->SetId (i, i);
60 poly_grid->Allocate (1, 1);
61 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
62 poly_grid->SetPoints (poly_points);
69 template <
typename Po
intT> vtkSmartPointer<vtkDataSet>
72 vtkSmartPointer<vtkUnstructuredGrid> poly_grid;
76 vtkSmartPointer<vtkPoints> poly_points = vtkSmartPointer<vtkPoints>::New ();
77 vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New ();
79 poly_points->SetNumberOfPoints (planar_polygon.
getContour ().size () + 1);
80 polygon->GetPointIds ()->SetNumberOfIds (planar_polygon.
getContour ().size () + 1);
83 for (i = 0; i < planar_polygon.
getContour ().size (); ++i)
85 poly_points->SetPoint (i, planar_polygon.
getContour ()[i].x,
88 polygon->GetPointIds ()->SetId (i, i);
91 poly_points->SetPoint (i, planar_polygon.
getContour ()[0].x,
94 polygon->GetPointIds ()->SetId (i, i);
97 poly_grid->Allocate (1, 1);
98 poly_grid->InsertNextCell (polygon->GetCellType (), polygon->GetPointIds ());
99 poly_grid->SetPoints (poly_points);
100 poly_grid->Update ();