[vtkusers] boundary cells
Gonzalo Amadio
gonzaloamadio at gmail.com
Mon Aug 13 12:10:17 EDT 2012
Hello, I am trying to extract boundary cells of a polydata. I've used
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Meshes/BoundaryEdges to extract
boundary edges.
Then I looked to this example :
http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capSphere.tcl?root=VTK&content-type=text/plain
to extract the cells.
But when I print the result polydata data , gives me an error.
vtkSmartPointer<vtkFeatureEdges> boundaryEdges =
> vtkSmartPointer<vtkFeatureEdges>::New();
> boundaryEdges->SetInput(myPolyData);
> boundaryEdges->BoundaryEdgesOn();
> boundaryEdges->FeatureEdgesOff();
> boundaryEdges->ManifoldEdgesOff();
> boundaryEdges->NonManifoldEdgesOff();
> boundaryEdges->Update();
>
vtkSmartPointer<vtkCleanPolyData> boundaryClean =
> vtkSmartPointer<vtkCleanPolyData>::New();
> boundaryClean->SetInput(boundaryEdges->GetOutput());
>
> vtkSmartPointer<vtkStripper> boundaryStrips =
> vtkSmartPointer<vtkStripper>::New();
> boundaryStrips->SetInput(boundaryClean->GetOutput());
> boundaryStrips->Update();
>
vtkSmartPointer<vtkPolyData> boundaryPoly =
> vtkSmartPointer<vtkPolyData>::New();
> boundaryPoly->SetPoints((boundaryStrips->GetOutput())->GetPoints());
> boundaryPoly->SetPolys((boundaryStrips->GetOutput())->GetLines());
>
vtkSmartPointer<vtkTriangleFilter> boundaryTriangles =
> vtkSmartPointer<vtkTriangleFilter>::New();
> boundaryTriangles->SetInput(boundaryPoly);
>
vtkSmartPointer<vtkPolyData> boundaryTrianglesPD =
> boundaryTriangles->GetOutput();
std::cout << "cell " << boundaryTrianglesPD->GetNumberOfCells() <<
> std::endl; // gives me 0
> std::cout << "lines "
> << boundaryTrianglesPD->GetLines()->GetNumberOfCells() << std::endl; //gives
> me 0
> std::cout << "points "
> << boundaryTrianglesPD->GetPoints()->GetNumberOfPoints() << std::endl; //
> crash here
Can someone help me?
Thank you!
--
--------
Gonzalo Amadio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120813/b11ca2fe/attachment.htm>
More information about the vtkusers
mailing list