[vtkusers] About vtkCellCenters
Wenlong
scc.wwl at gmail.com
Mon Apr 30 14:26:25 EDT 2012
Dear all,
I have a 3D surface which is comprised of 9000 triangles. I'm trying to
compute the center point coordinates of polygons on the surface.
I know there is a class vtkCellCenters can get access to the center of
cells. But I am wondering if the following codes have the same results as
vtkCellCenters?
vtkPolyData* polydata;
vtkCellArray* polygon;
double center[9000][3], pointA[3], pointB[3], pointC[3], ID[3];
for(int i = 0; i < 9000; i++)
{
polygon->GetPoly(i, ID);
polydata->GetPoint(ID[0], pointA);
polydata->GetPoint(ID[1], pointB);
polydata->GetPoint(ID[2], pointC);
center[i][0] = (pointA[0] + pointB[0] + pointC[0]) / 3;
center[i][1] = (pointA[1] + pointB[1] + pointC[1]) / 3;
center[i][2] = (pointA[2] + pointB[2] + pointC[2]) / 3;
}
Is there any difference to use above code block?
Many thanks.
Wenlong
--
View this message in context: http://vtk.1045678.n5.nabble.com/About-vtkCellCenters-tp5676567.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list