[vtkusers] Broken surfaces for vtkBooleanOperationPolyDataFilter() - Bug?

Cory Quammen cory.quammen at kitware.com
Tue Dec 8 14:50:08 EST 2015


I assume this is failing even with the crash fix recently merged to master?

Do you have data sets you can share to reproduce the problem?

Thanks,
Cory

On Tue, Dec 8, 2015 at 2:34 PM, normanius <juch at zhaw.ch> wrote:

> Hi,
>
> For two polydata objects I create boolean operations, and /often/ this does
> not cause any problems. However, /sometimes/ I get results as seen in the
> image below. The second image shows that there are indeed non-manifold
> edges
> resulting from the operations.
>
> I verified that the input objects are manifold.
>
> I came across  this
> <
> http://vtk.1045678.n5.nabble.com/Non-manifold-triangles-after-running-vtkBooleanOperationPolydataFilter-td5713964.html
> >
> post where Cory Quammen states it might be related to a bug in the
> algorithm.
>
> (I've cross-posted the problem also on  Stackoverflow
> <http://stackoverflow.com/questions/34100211>  , but I found that I reach
> the vtk cracks much more efficiently through this mailing list.)
>
> I'm calling the following code:
>
> def doApplyCutAdvanced(source, cutCylinder, domeCutCenter):
>     '''
>     Cut a cylinder B from source A according to the following recipe:
>     A = A \ B
>     A = connectivityFilter(A, domeCenter)
>     A = A v (A ^ B)
>     '''
>
>     # Extract triangles.
>     sourceTriangles = vtk.vtkTriangleFilter()
>     sourceTriangles.SetInputConnection(source.GetOutputPort())
>     sourceTriangles.Update()
>
>     cylinderTriangles = vtk.vtkTriangleFilter()
>     cylinderTriangles.SetInputConnection(cutCylinder.GetOutputPort())
>     cylinderTriangles.Update()
>
>     # First operation: A \ B
>     operation1 = vtk.vtkBooleanOperationPolyDataFilter()
>     operation1.SetOperationToDifference()
>     operation1.SetInputConnection(0, sourceTriangles.GetOutputPort())
>     operation1.SetInputConnection(1, cylinderTriangles.GetOutputPort())
>     operation1.Update()
>
>     # Second operation: A ^ B
>     operation2 = vtk.vtkBooleanOperationPolyDataFilter()
>     operation2.SetOperationToIntersection()
>     operation2.SetInputConnection(0, source.GetOutputPort())
>     operation2.SetInputConnection(1, cylinderTriangles.GetOutputPort())
>     operation2.Update()
>
>     # Apply the cut.
>     cutSurfaceConnected = vtk.vtkPolyDataConnectivityFilter()
>     cutSurfaceConnected.SetInputConnection(operation1.GetOutputPort())
>     cutSurfaceConnected.SetExtractionModeToClosestPointRegion()
>     cutSurfaceConnected.SetClosestPoint(domeCutCenter)
>     cutSurfaceConnected.Update()
>
>     # Fix up the source object (if it was cut partially by the cylinder)
>     appendFilter = vtk.vtkAppendPolyData()
>     if vtk.vtkVersion.GetVTKMajorVersion() == 5:
>         appendFilter.AddInput(cutSurfaceConnected.GetOutput())
>         appendFilter.AddInput(operation2.GetOutput())
>     else:
>         appendFilter.AddInputData(cutSurfaceConnected.GetOutput())
>         appendFilter.AddInputData(operation2.GetOutput())
>     appendFilter.Update()
>
>     cutSurfaceRepaired = vtk.vtkCleanPolyData()
>     cutSurfaceRepaired.SetInputConnection(appendFilter.GetOutputPort())
>     cutSurfaceRepaired.Update()
>
>     cutSurfaceRepairedTriangles = vtk.vtkTriangleFilter()
>
>
> cutSurfaceRepairedTriangles.SetInputConnection(cutSurfaceRepaired.GetOutputPort())
>     cutSurfaceRepairedTriangles.Update()
>
>     return cutSurfaceRepairedTriangles
>
> <http://vtk.1045678.n5.nabble.com/file/n5735413/example_broken_surface.png
> >
> <
> http://vtk.1045678.n5.nabble.com/file/n5735413/example_broken_surface_nonmanifold_edges.png
> >
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Broken-surfaces-for-vtkBooleanOperationPolyDataFilter-Bug-tp5735413.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151208/08a36eb5/attachment.html>


More information about the vtkusers mailing list