<div>Hi All, </div><div><br></div>I want a pointer to point ID's from an instance of class vtkPoints. At present I simply assume that points are indexed from 0 to N, and this may not be good. Below illustrates what I'm trying to do in general:<div>
<br> vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();<br> const float p[4][3] = { {1.0, 2.0, 3.0},<br> {0.5, 1.0, .76},<br> {0.3, 0.1, .9}, };<br>
// Create the topology of the point (a vertex)<br> vtkSmartPointer<vtkCellArray> vertices = vtkSmartPointer<vtkCellArray>::New();<br> vtkIdType pid[1];<br> <br> for(int i = 0; i < 3; ++i)<br>
{<br> pid[0] = points->InsertNextPoint(p[i]);<br> vertices->InsertNextCell(1,pid); <br> }<br> <br> // Create a polydata object<br> vtkSmartPointer<vtkPolyData> poly = vtkSmartPointer<vtkPolyData>::New();<br>
poly->SetPoints(points); poly->SetVerts(vertices);<br> vtkSmartPointer<vtkPoints> pointss = poly->GetPoints();<br> vtkIdType numPts = pointss->GetNumberOfPoints();<br> double x[3]={0,0,0};<br>
for (int i = 0; i< numPts; ++i)<br> {<br> pointss->GetPoint(i, x); //here is where I want to use a pointer to point ID's instead of 'int i'<br> std::cout<< "Point: " << x[0] << " " << x[1] << " "<< x[2] << "\n";<br>
}<br>//end code snippet <br>Got an idea? </div><div><br>All the best, <br><br></div><div>Arvind</div>