# vtkIncrementalCellLocator

**URL:** https://discourse.vtk.org/t/vtkincrementalcelllocator/14832
**Category:** Development
**Created:** [November 6, 2024, 4:05pm UTC](https://discourse.vtk.org/t/vtkincrementalcelllocator/14832 "2024-11-06T16:05:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [November 6, 2024, 4:05pm UTC](https://discourse.vtk.org/t/vtkincrementalcelllocator/14832/1 "2024-11-06T16:05:32Z")

</div>

Hi Developers

I am currently developing an incremental cell locator for fast removal and insertion of cells. So far I have a prototype, where I have used NanoFlann and a restriction to triangles. Considering that it should also hold and maintain vtkCellLink’s (this part is not so elegant). Is this something that would be of general interest, e.g. if I make an implementation without using NanoFlann using only raw and unique\_ptr’s?

Do we have any feature branch where such attempt is already made?

---

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [November 7, 2024, 12:03am UTC](https://discourse.vtk.org/t/vtkincrementalcelllocator/14832/2 "2024-11-07T00:03:53Z")

</div>

Can you give me a case in which an incremental cell locator makes sense?

---

<div class="post-metadata">

### Author: ![Jens\_Munk\_Hansen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jens_munk_hansen/32/1215_2.png) [@Jens\_Munk\_Hansen](https://discourse.vtk.org/u/Jens_Munk_Hansen)
#### Post date: [November 20, 2024, 9:48pm UTC](https://discourse.vtk.org/t/vtkincrementalcelllocator/14832/3 "2024-11-20T21:48:11Z")

</div>

Sure. Sorry for the delay. I am currently developing sculpting tools, where I dynamically add and remove cells.

The not so elegant thing is that I am maintaining a duplicate of the cell-links… It is really ugly…

It is a work-in-progress (the incremental cell locator). Currently, I am only focusing on triangles, but a feature complete one, must support any cell.

I did a full-blown point-locator using NanoFlann. It is about 50 times faster if the points are ordered according to their distance and twice as slow if no ordering is required. It sort of makes sense, since it is a KDTree under the hood. It is templated and takes into account of whether points are double/float and whether the cell indices are 32 or 64-bit.

---

<div class="post-metadata">

### Author: ![spyridon97](https://discourse.vtk.org/user_avatar/discourse.vtk.org/spyridon97/32/7069_2.png) [@spyridon97](https://discourse.vtk.org/u/spyridon97)
#### Post date: [November 20, 2024, 10:19pm UTC](https://discourse.vtk.org/t/vtkincrementalcelllocator/14832/4 "2024-11-20T22:19:51Z")

</div>

@will.schroeder what do you think?
