[vtkusers] extract verticies from polydata
Matt and Elizabeth Kay
mandekay at yahoo.com
Wed Jul 17 15:40:08 EDT 2002
Hi All-
I have a vtkPolyData called 'spoly'. I would like to
extract from spoly the vertex positions of each
polygon in the dataset and save them in a float array
called 'verticies'. Polygons are triangles. Here is a
segment of my code:
float **verticies;int i, numverts, numcells;
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(1);
sphere->Update();
vtkPolyData *spoly=sphere->GetOutput();
numverts=spoly->GetNumberOfPoints();
numcells=spoly->GetNumberOfCells();
verticies=(float **)malloc((unsigned
int)numcells*sizeof(float*));
for (i=0;i<numcells;++i){
verticies[i]=(float *)malloc(3*sizeof(float));}
Now I want something like this, but of course this
doesn't work:
for (i=0;i<numcells;++i){
points[i][0] spoly->GetVertex(i,0);
points[i][1] spoly->GetVertex(i,1);
points[i][2] spoly->GetVertex(i,2);
}
Any suggestions?
Thanks a ton,
Matt
__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
More information about the vtkusers
mailing list