# Filter vertices using a implicit function

**URL:** https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503
**Category:** Support
**Created:** [March 15, 2019, 10:31pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503 "2019-03-15T22:31:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![lmainguy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@lmainguy](https://discourse.vtk.org/u/lmainguy)
#### Post date: [March 15, 2019, 10:31pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/1 "2019-03-15T22:31:45Z")

</div>

Hi,  
I’d like to select the vertices of a polydata, and their associated triangles, based on a condition using an implicit function. So it would be something like select my vertice if its position satisfies an inequality corresponding to the implicit function.  
For example, I would define an ellipsoid and extract all the vertices of a polydata within that ellipsoid.  
I went through a lot of examples but I couldn’t find a way to achieve what I want.  
How could I do that?  
Thanks for your help  
Ludovic

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 15, 2019, 11:47pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/2 "2019-03-15T23:47:21Z")

</div>

vtkExtractPoints will extrrack points within an impliicut function:  
[https://lorensen.github.io/VTKExamples/site/Cxx/Points/ExtractPointsDemo/](https://lorensen.github.io/VTKExamples/site/Cxx/Points/ExtractPointsDemo/)

It does not extract the corresponding polydata.

Bill

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 16, 2019, 12:15am UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/3 "2019-03-16T00:15:11Z")

</div>

Another approach.

1)Use vtkSampleFunction to great a volume from an implicit function  
2) Probe that volume with your polydata  
3) Use vtkThreshold to extract cells that are less than the isovalue  
defining the surface on the implicit function.

Another, probably the best:  
Use vtkSelectEnclosedPoints

---

<div class="post-metadata">

### Author: ![lmainguy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@lmainguy](https://discourse.vtk.org/u/lmainguy)
#### Post date: [March 16, 2019, 1:03pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/4 "2019-03-16T13:03:14Z")

</div>

Hi Bill,  
Wow 3 different solutions thanks!  
By following linked filters, I found [https://vtk.org/doc/nightly/html/classvtkExtractPolyDataGeometry.html](https://vtk.org/doc/nightly/html/classvtkExtractPolyDataGeometry.html).  
I think this is probably what I’m looking for.  
What do you think?

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 16, 2019, 4:06pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/5 "2019-03-16T16:06:58Z")

</div>

That looks like the best approach.

---

<div class="post-metadata">

### Author: ![lorensen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lorensen/32/20_2.png) [@lorensen](https://discourse.vtk.org/u/lorensen)
#### Post date: [March 17, 2019, 6:30pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/6 "2019-03-17T18:30:55Z")

</div>

I just added an example: [https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/CellsInsideObject/](https://lorensen.github.io/VTKExamples/site/Cxx/PolyData/CellsInsideObject/)

that selects cells inside a closed surface (not an implicit function).

Bill

---

<div class="post-metadata">

### Author: ![lmainguy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@lmainguy](https://discourse.vtk.org/u/lmainguy)
#### Post date: [March 18, 2019, 3:33pm UTC](https://discourse.vtk.org/t/filter-vertices-using-a-implicit-function/503/7 "2019-03-18T15:33:09Z")

</div>

Thanks Bill,  
That’s definitively something useful to know how to do.
