[vtkusers] Re: How to get the cg of a surface

An Jiye an_jiye at hotmail.com
Thu Jun 9 22:20:27 EDT 2005


> No you don't the pixel coordinates. You only need the coordinates of all
> points (remember that you have a triangulated surface here) which can be
> extracted directly from the vtkPolyData structure. Doing this on a pixel
> basis indeed will give you the wrong results.

Thank you for the kindly reply.

Do you mean doing like this:

vtkPolyData* polyData = (vtkMarchingCubes filter)->GetOutput();
vtkPoints* points = polyData->GetPoints();

int number = points->GetNumberOfPoints();
for (int i = 0; i < number; ++ i) {
  double* point = points->GetPoint(i);
}

By this means, I can get *ALL* points that on the surface.
After that, I can calculate the cg using these coordinates.

Am I right?

Thank you in advance.

Regards,
An Jiye




More information about the vtkusers mailing list