<div>I want to get cell id while traversing vtkCellArray. How can I get it? <br></div><div>Regards, </div><div>Gregory</div><div><br></div><div>This is my code: </div>vtkCellArray * CA = this->data->GetPolys();<br> CA->InitTraversal();<br>
vtkIdType npts;<br> vtkIdType *pts;<br><br> int i=0;<br> while(CA->GetNextCell(npts,pts))<br> {<br> glBegin(GL_TRIANGLES);<br> for (int j = 0; j < npts; ++j)<br> {<br> if (i == 0)<br> {<br> //double * p = points->GetPoint(pts[j]);<br>
double * p = this->data->GetPoint(pts[j]);<br> points->SetPoint(pts[j], p[0] - 0.3, p[1], p[2]);<br> }<br> double *p = points->GetPoint(pts[j]);<br> double x = p[0];<br> double y = p[1];<br> double z = p[2];<br>
glVertex3f((float)x,(float)y,(float)z);<br> //cout << endl;<br> //cout << "X: " << x << " " << "Y: " << y << " " << "Z: " << z << endl;<br>
//cout << endl;<br> }<br> glEnd();<br> i++;<br> }<br> cout << i << endl;<br>