Hello, I am building a PolyData including just vertex cells, i.e. isolated points. I have the point coordinates so I easily create the points, but I cannot find an example (possibly in Python) explaining how to add one vertex cell for each point automatically.
My code is (having
coords as a points_number x 3 array)
points = vtk.vtkPoints() cells = vtk.vtkCellArray() poly = vtk.vtkPolyData() for i in range(points_number): points.InsertPoint(i, coords[i, 0], coords[i, 1], coords[i, 2]) poly.SetPoints(points) for pid in range(poly.GetNumberOfPoints()): cells.InsertNextCell(0, pid) poly.SetVerts(cells)
When I check the PolyData (i.e. with print) I have the right number of points and vertex cells (same number), but the bounds are messed up (they show high values around 1e+299 and 1e-299), and this results in a completely messed up zoom level when I try to plot in a 3D view.
However the point coordinates are correct, so I guess that there is some problem with the topology.
Thanks very much in advance!