vtkPointSource & vtkPoints

I found (one) answer from another post here: How to create a mesh data from vtkPoints? - #4 by Charles_Gueunet

  // vtk data set to fill
  vtkNew<vtkPolyData> myPolyData;

   // compute a vtkIdList that contains ids of each points 
 vtkIdType numPoints = points->GetNumberOfPoints();  
 vtkSmartPointer<vtkIdList> pointIds = vtkSmartPointer<vtkIdList>::New();
 pointIds->SetNumberOfIds(numPoints);
 for (vtkIdType i = 0; i < numPoints; ++i)
 {
    pointIds->SetId(i, i);
 }

   // create a vtkCellArray from this list
  vtkSmartPointer<vtkCellArray> polyPoint = vtkSmartPointer<vtkCellArray>::New();
  polyPoint->InsertNextCell(pointIds);
 
   // give the points and cells to the final poly data
  myPolyData->SetPoints(points);
  myPolyData->SetVerts(polyPoint);

So, the points are used to construct the cell(s). It seems all points are “within” one cell. But not sure if that is proper semantics.

I believe I read somewhere that in order to render any data, the data need to be in “cells”.

I guess this small example goes to the core of how primitive data is represented in vtk, in order to be visualized, so, time to read the manual(!)

1 Like