[vtkusers] Convert vtkUnstructuredGrid to vtkPolyData
mandalin
mandalin147 at gmail.com
Thu Nov 10 19:17:19 EST 2011
Greetings !
*So, from buildings and terrain information, I have populated a
vtkUnstructuredGrid with VTK_POLYGON as follows :*
//Store the positions of the vertices
vtkPoints *GeometryVertices = vtkPoints::New();
GeometryVertices->Allocate(NumVertices);
for(int i=0; i<NumVertices; i++)
{
GeometryVertices->InsertPoint(i, unique_corners[i].x,
unique_corners[i].y, unique_corners[i].z);
}
//Makeing an array of ID's for each polygon
vtkIdList** pointIDs;
pointIDs= new vtkIdList *[NumWalls];
int cornersperwall;
for(int wallind=0; wallind<NumWalls; wallind++)
{ cornersperwall=walls[wallind].corners.size();
// std::cout<<"Corners in this wall
"<<cornersperwall<<std::endl;
pointIDs[wallind]= vtkIdList::New();
for(int cornerind=0; cornerind<walls[wallind].corners.size();
cornerind++)
{
pointIDs[wallind]->InsertNextId(walls[wallind].corner_indices[cornerind]);
}
}
//Make the Polygons
vtkUnstructuredGrid * ugridGeom= vtkUnstructuredGrid::New();
ugridGeom->Allocate(totnumcnx+10);
for(int wallind=0; wallind<NumWalls; wallind++)
{ //if(wallind==9) //excludes ground planes
//{
for(int cornerind=0; cornerind<walls[wallind].corners.size();
cornerind++)
{ ugridGeom->InsertNextCell(VTK_POLYGON, pointIDs[wallind]);
}
//}
}
*NOW, I would like to convert this to vtkPolyData so that I may later probe
and interpolate*
*When I use *
vtkGeometryFilter * geometryFilter = vtkGeometryFilter::New();
geometryFilter->SetInput(ugridGeom);
geometryFilter->Update();
vtkPolyData* polydata = geometryFilter->GetOutput();
std::cout << "Output has " << polydata->GetNumberOfPoints() << "
points." << std::endl;
*
I find that there are 0 points. *
Any suggestions ?
Thanks in advance,
~Amanda
--
View this message in context: http://vtk.1045678.n5.nabble.com/Convert-vtkUnstructuredGrid-to-vtkPolyData-tp4982862p4982862.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list