[vtkusers] how to get Cell ID?

Grzegorz Pytel bioinfguy at gmail.com
Thu Nov 12 08:35:59 EST 2009


I want to get cell id while traversing vtkCellArray. How can I get it?
Regards,
Gregory

This is my code:
vtkCellArray * CA = this->data->GetPolys();
CA->InitTraversal();
vtkIdType npts;
vtkIdType *pts;

int i=0;
while(CA->GetNextCell(npts,pts))
{
glBegin(GL_TRIANGLES);
for (int j = 0; j < npts; ++j)
{
if (i == 0)
{
//double * p = points->GetPoint(pts[j]);
double * p = this->data->GetPoint(pts[j]);
points->SetPoint(pts[j], p[0] - 0.3, p[1], p[2]);
}
double *p = points->GetPoint(pts[j]);
double x = p[0];
double y = p[1];
double z = p[2];
glVertex3f((float)x,(float)y,(float)z);
//cout << endl;
//cout << "X: " << x << " " << "Y: " << y << " " << "Z: " << z << endl;
//cout << endl;
}
glEnd();
i++;
}
cout << i << endl;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091112/c4ee1861/attachment.htm>


More information about the vtkusers mailing list