# how to expand a polydata?

**URL:** https://discourse.vtk.org/t/how-to-expand-a-polydata/11570
**Category:** Support
**Created:** [May 30, 2023, 2:40am UTC](https://discourse.vtk.org/t/how-to-expand-a-polydata/11570 "2023-05-30T02:40:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [May 30, 2023, 2:40am UTC](https://discourse.vtk.org/t/how-to-expand-a-polydata/11570/1 "2023-05-30T02:40:23Z")

</div>

For example, I have a polydata: the black object in the following figure.

![image](https://discourse.vtk.org/uploads/default/original/2X/d/d67fbad1362c9e593110e8b74823e84497cbb908.png)

Then, I hope to `expand` it, and I expect the result is the red object. The hole in the black object would disappear in the red object.

A possible indirectly solution is: firstly converting the black polydata into a binary mask image, then the image dilate/erode is used, finally extracting the boundary as the result.

Is there any method in `vtk` to directly implement it? Any suggestion is appreciated~~~

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 30, 2023, 4:04am UTC](https://discourse.vtk.org/t/how-to-expand-a-polydata/11570/2 "2023-05-30T04:04:02Z")

</div>

You can use implicit modeling with vtkImplicitPolyDataDistance.

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [May 30, 2023, 8:26am UTC](https://discourse.vtk.org/t/how-to-expand-a-polydata/11570/3 "2023-05-30T08:26:07Z")

</div>

@lassoan Thanks for your kindly reply.

In my understanding, your suggestion means: firstly calculate the distance map with `vtkImplicitPolyDataDistance`, then extract the iso-contour/iso-surface from the distance image. Am I correct?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 30, 2023, 1:08pm UTC](https://discourse.vtk.org/t/how-to-expand-a-polydata/11570/4 "2023-05-30T13:08:56Z")

</div>

Yes, that sounds right. VTK tests and examples show how exactly the filter can be used.
