Hi everyone ... <div><br></div><div>Just seems simpler to test for a point based on a boundingbox... </div><div><br></div><div>Sergio </div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkBoundingBox tBox; </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-&gt;SetCollection(actrList); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iter-&gt;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><span class="Apple-tab-span" style="white-space:pre">        </span>double bounds[6]; </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>while ( !iter-&gt;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-&gt;GetCurrentObject(); </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>tmp_actr-&gt;GetBounds(bounds); </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>tBox.SetBounds(bounds); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ( tBox.ContainsPoint(lasserP2) == 1 )</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-&gt;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><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iter-&gt;Delete(); </div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>return poked; </div>
<br><div class="gmail_quote">On Mon, Mar 21, 2011 at 1:11 PM, Sergio Aguirre <span dir="ltr">&lt;<a href="mailto:sergio.aguirre@gmail.com">sergio.aguirre@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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 style="white-space:pre-wrap">        </span>tBox = vtkOBBTree::New(); </div>

<div><span style="white-space:pre-wrap">        </span>iter = vtkCollectionIterator::New(); </div><div><span style="white-space:pre-wrap">        </span>iter-&gt;SetCollection(actrList); </div><div><span style="white-space:pre-wrap">        </span>iter-&gt;InitTraversal(); </div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>int c = 0;<span style="white-space:pre-wrap">                        </span>// counter to change state</div><div><span style="white-space:pre-wrap">        </span>int poked = -1;<span style="white-space:pre-wrap">                </span>// actor poked</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>while ( !iter-&gt;IsDoneWithTraversal() )</div><div><span style="white-space:pre-wrap">        </span>{</div><div><span style="white-space:pre-wrap">                </span>vtkActor* tmp_actr = (vtkActor*) iter-&gt;GetCurrentObject(); </div>

<div><span style="white-space:pre-wrap">                </span>tmp_actr-&gt;GetMapper()-&gt;GetInput()-&gt;Update();<span style="white-space:pre-wrap">                                </span>// update the object</div><div><span style="white-space:pre-wrap">                </span>tBox-&gt;SetDataSet( tmp_actr-&gt;GetMapper()-&gt;GetInput() ); </div>

<div><span style="white-space:pre-wrap">                </span>tBox-&gt;BuildLocator(); </div><div><br></div><div><span style="white-space:pre-wrap">                </span>if( tBox-&gt;IntersectWithLine(lasserP1, lasserP2, NULL, NULL) != 0 )</div>
<div><span style="white-space:pre-wrap">                </span>{</div><div><span style="white-space:pre-wrap">                        </span>poked = c; </div><div><span style="white-space:pre-wrap">                        </span>break;</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div><br></div><div><span style="white-space:pre-wrap">                </span>iter-&gt;GoToNextItem(); </div><div><span style="white-space:pre-wrap">                </span>c++;</div>
<div><span style="white-space:pre-wrap">        </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 &#39;center&#39; of the vtkDataSet downstream from the vtkActor... </div><div><br></div><div>I hope anyone can share any suggestions. </div><div><br></div>
<font color="#888888">
<div>Sergio </div>
</font></blockquote></div><br></div>