# Changing the geometry of an actor made the picker worked incorrectly

**URL:** https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030
**Category:** Support
**Created:** [November 3, 2019, 9:06am UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030 "2019-11-03T09:06:04Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![tdchen](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.vtk.org/u/tdchen)
#### Post date: [November 3, 2019, 9:06am UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/1 "2019-11-03T09:06:04Z")

</div>

After an actor were created, its geometry were changed.  
In fact I just changed its polydata by splitting 1 big triangle into 3.  
But I found when I picked the actor, the big triangle seemed become 1 small triangle and the other 2 small ones can’t be hitted, they became hollow!!  
But the actor was displayed correctly.  
That made me puzzle and I need you help.  
Thank you.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 4, 2019, 1:52pm UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/2 "2019-11-04T13:52:15Z")

</div>

What VTK version are you using?

---

<div class="post-metadata">

### Author: ![tdchen](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.vtk.org/u/tdchen)
#### Post date: [November 4, 2019, 2:15pm UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/3 "2019-11-04T14:15:47Z")

</div>

vtk7.1.1  
Perhaps, I need to tell the render that I had changed one actor.  
But I don’t know how to do it.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [November 4, 2019, 4:05pm UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/4 "2019-11-04T16:05:58Z")

</div>

Perhaps you could try something like this:

```
 unstructuredGrid->GetCellData()->Modified();

```

The method above supposedly notifies other algorithms of changes in geometry. That potentially includes the spatial index used by VTK to enable picking.

---

<div class="post-metadata">

### Author: ![tdchen](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.vtk.org/u/tdchen)
#### Post date: [November 6, 2019, 2:39am UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/5 "2019-11-06T02:39:03Z")

</div>

I have done that, and the actor is displayed correctly.  
The problem is only for the picker.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 17, 2019, 11:58pm UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/6 "2019-12-17T23:58:47Z")

</div>

Sorry for the late reply. Is it possible/viable to upgrade to latest version?

---

<div class="post-metadata">

### Author: ![tdchen](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.vtk.org/u/tdchen)
#### Post date: [December 18, 2019, 2:39am UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/7 "2019-12-18T02:39:10Z")

</div>

I have tried it in vtk8.2. It still doesn’t work.  
In fact, someone have told me to call the vtkPolyData::BuildCells(), and it does works in a simple test program.  
But in a more complicated program, it still failed.  
That make me confused.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 18, 2019, 11:17am UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/8 "2019-12-18T11:17:02Z")

</div>

Just checking: do you call that method on ALL instances? I mean, maybe you used some filter that spawned more `vtkPolyData`s that your code currently manages.

As you said the call works with simple examples, another approach is to tear down scene complexity until you obtain a working version of your code. That’s what I do when I face mysterious problems like that. I comment out most of the code and uncomment them bit-by-bit until I the issue kicks in.

---

<div class="post-metadata">

### Author: ![tdchen](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/858c86/32.png) [@tdchen](https://discourse.vtk.org/u/tdchen)
#### Post date: [September 15, 2021, 11:07pm UTC](https://discourse.vtk.org/t/changing-the-geometry-of-an-actor-made-the-picker-worked-incorrectly/2030/9 "2021-09-15T23:07:43Z")

</div>

good idea. Carvalho. I’ll try.  
sorry for my so late reply.
