vtkImplicitSelectionLoop does not work as expected

I implemented a function that clips a polydata from another polydata. The clip operation is fine for polys that don’t have sharp corners, but it gives weird results for those with sharp corners. How do I get about this?
def clip(pd1: vtk.vtkPolyData, pd2: vtk.vtkPolyData, inside_out=False) -> vtk.vtkPolyData:
Clips out regions of pd1 from pd2. The result is a difference pd1 - pd2
Set inside_out = True; if the end result is required to be an intersection of pd1, pd2
:param pd1: a polydata object. This is the one you want to clip.
:type pd1: vtk.vtkPolyData
:param pd2: a polydata object. This is the one you want to use to clip pd1.
:type pd2: vtk.vtkPolyData
:return: a clipped polydata pd1 - pd2 or pd1 \cap pd2
:rtype: None
inout = vtk.vtkImplicitSelectionLoop()
clip = vtk.vtkClipPolyData()
return clip.GetOutput()


1 Like