What is the best way to cut a polydata with a sphere and fill it

Hi,
What is the best way to cut a polydata with a sphere and fill it?
I have already tried lots of different approaches:

  1. vtkBooleanOperationPolydataFilter (with SetOpperationtoDifference) - this seems to achieve the desired result but it fails randomly in some cases

  2. vtkClipPolydata with the implicit function of the sphere and fill it using FillHoles - The cut is not smooth

  3. Find the points of the polydata inside of the sphere using SelectEnclosedPoints and fill them with vtkExtractSurface - also the result is not smooth enough

Do you have some suggestions?

If you haven’t already check out vtkClipClosedSurface / vtkContourTriangulator

Thanks for the reply!

However, I believe (and correct me if I’m wrong) that vtkClipClosedSurface can only be used with infinite planes (which is not the case with a sphere).

Regarding the vtkContourTriangulator it does not seem to work for 3D data.

Please try vtkbool package to do your boolean difference

1 Like