[vtkusers] vtkImplicitLoop and vtkExtractPolyDataGeometry
NsPx
nspx.roronoa at gmail.com
Mon Mar 19 13:17:51 EDT 2012
Hi all,
I am coding a tools to interactively select a region of a mesh with
vtkContourWidget.
To get this contour, I headed for vtkExtractPolyDataGeometry and
vtkImplicitLoop.
Now I don't understand very well what happened : most of the time I get
extra cells which doesn't belong to the interior of the contour.
For example here :
http://img341.imageshack.us/img341/523/sanstitreypg.jpg, I get the
desired region + the back face of this region.
Can someone explain me what's wrong with this code ?
// 1. close the loop if not
vtkContourWidget->CloseLoop();
// 2. get the contour as a polydata
vtkContourRepresentation *contourRep =
reinterpret_cast<vtkContourRepresentation*>(vtkContourWidget->WidgetRep);
vtkSmartPointer<vtkPoints> selectionPoints =
vtkSmartPointer<vtkPoints>::New();
selectionPoints =
contourRep->GetContourRepresentationAsPolyData()->GetPoints();
// 3. Pass convert the contour into vtkImplicitSelectionLoop
vtkSmartPointer<vtkImplicitSelectionLoop> loop =
vtkSmartPointer<vtkImplicitSelectionLoop>::New();
loop->SetLoop(selectionPoints);
// 4. clip mesh with the contour
vtkSmartPointer<vtkExtractPolyDataGeometry> clip =
vtkSmartPointer<vtkExtractPolyDataGeometry>::New();
clip->SetImplicitFunction(loop);
clip->SetInput(mesh);
clip->SetExtractInside(1);
clip->SetExtractBoundaryCells(1);
clip->Update();
Thanks by advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120319/6b628a58/attachment.htm>
More information about the vtkusers
mailing list