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

**URL:** https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734
**Category:** Support
**Created:** [June 15, 2022, 9:58am UTC](https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734 "2022-06-15T09:58:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pedrorib3](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pedrorib3](https://discourse.vtk.org/u/pedrorib3)
#### Post date: [June 15, 2022, 9:58am UTC](https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734/1 "2022-06-15T09:58:34Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [June 15, 2022, 10:13am UTC](https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734/2 "2022-06-15T10:13:21Z")

</div>

If you haven’t already check out vtkClipClosedSurface / vtkContourTriangulator

---

<div class="post-metadata">

### Author: ![pedrorib3](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/ee59a6/32.png) [@pedrorib3](https://discourse.vtk.org/u/pedrorib3)
#### Post date: [June 15, 2022, 10:43am UTC](https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734/3 "2022-06-15T10:43:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [June 15, 2022, 12:33pm UTC](https://discourse.vtk.org/t/what-is-the-best-way-to-cut-a-polydata-with-a-sphere-and-fill-it/8734/4 "2022-06-15T12:33:34Z")

</div>

Please try vtkbool package to do your boolean difference
