[vtkusers] boundary cells
Gonzalo Amadio
gonzaloamadio at gmail.com
Mon Aug 13 13:16:42 EDT 2012
Sorry for asking so directly like this, but, Is there another way of doing
this?
Because the result obtained is not the desired.
Thank you.!
2012/8/13 David Doria <daviddoria at gmail.com>
> On Mon, Aug 13, 2012 at 12:10 PM, Gonzalo Amadio
> <gonzaloamadio at gmail.com> wrote:
> > 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
>
> You need to call boundaryTriangles->Update() before
> boundaryTriangles->GetOutput() if you're going to use it like this.
>
> David
>
--
--------
Gonzalo Amadio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120813/945df0fd/attachment.htm>
More information about the vtkusers
mailing list