# Fastest picking of closest actor?

**URL:** https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408
**Category:** Web
**Created:** [January 11, 2020, 5:42am UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408 "2020-01-11T05:42:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mhalle](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@mhalle](https://discourse.vtk.org/u/mhalle)
#### Post date: [January 11, 2020, 5:42am UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/1 "2020-01-11T05:42:46Z")

</div>

I’ve been looking over the different picking methods in vtk.js, but I haven’t been able to figure the best way to do fast actor-level picking. I don’t need point or cell picking, but I need more accurate picking than bounding box picking.

In lieu of this kind of picking, I’ve experimented with point picking where I update a text string as I move the mouse around. It looks like the points and actors aren’t sorted, which seems like the most useful choice. Is that right?

Thanks.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 11, 2020, 8:20am UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/2 "2020-01-11T08:20:51Z")

</div>

You need to use the hardware picker. Unfortunately that one does not have a good documentation or example. We use it heavily for the widgets so if you can’t wait you can look into the WidgetManager implementation. But I was planning to create an example in the coming days to ease its usage for the community. I’ll try to post back the link of the example once I’ve done it.

---

<div class="post-metadata">

### Author: ![mhalle](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@mhalle](https://discourse.vtk.org/u/mhalle)
#### Post date: [January 11, 2020, 1:40pm UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/3 "2020-01-11T13:40:21Z")

</div>

Thanks so much. I think such an example would be widely useful to the community.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 11, 2020, 4:22pm UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/4 "2020-01-11T16:22:56Z")

</div>

The example is available [here](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/OpenGL/HardwareSelector/example/index.js) and the website should naturally update thanks to Travis, but it will take another ~40 minutes.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 11, 2020, 4:47pm UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/5 "2020-01-11T16:47:28Z")

</div>

Live example available [here](https://kitware.github.io/vtk-js/examples/HardwareSelector.html)

---

<div class="post-metadata">

### Author: ![mhalle](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/50afbb/32.png) [@mhalle](https://discourse.vtk.org/u/mhalle)
#### Post date: [January 16, 2020, 10:26pm UTC](https://discourse.vtk.org/t/fastest-picking-of-closest-actor/2408/6 "2020-01-16T22:26:58Z")

</div>

Thanks, worked great.
