Hi everyone <div><br></div><div>I am trying to have some interaction between a tracked pointer and vtkActors in a scene. </div><div><br></div><div>My actors are simple objects I call like vtkConeSource, vtkPolyDataMapper and vtkActor.</div>
<div><br></div><div>Basically I am building a line using vtkLineSource and testing if the line intersects any actors in my scene with vtkOBBTree using the code below. </div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>tBox = vtkOBBTree::New(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>iter = vtkCollectionIterator::New(); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iter->SetCollection(actrList); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iter->InitTraversal(); </div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>int c = 0;<span class="Apple-tab-span" style="white-space:pre">                        </span>// counter to change state</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>int poked = -1;<span class="Apple-tab-span" style="white-space:pre">                </span>// actor poked</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while ( !iter->IsDoneWithTraversal() )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>vtkActor* tmp_actr = (vtkActor*) iter->GetCurrentObject(); </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>tmp_actr->GetMapper()->GetInput()->Update();<span class="Apple-tab-span" style="white-space:pre">                                </span>// update the object</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>tBox->SetDataSet( tmp_actr->GetMapper()->GetInput() ); </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>tBox->BuildLocator(); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if( tBox->IntersectWithLine(lasserP1, lasserP2, NULL, NULL) != 0 )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>poked = c; </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>break;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>iter->GoToNextItem(); </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>c++;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div></div><div><br></div><div>However, because the vtkOBBTree tests against vtkDataSet (ie vtkConeSource) the new (translated or rotated) coordinates are not updated when I test the intersection again. </div>
<div><br></div><div>As far as I can tell I would need to update the 'center' of the vtkDataSet downstream from the vtkActor... </div><div><br></div><div>I hope anyone can share any suggestions. </div><div><br></div>
<div>Sergio </div>