Ok, it seems picking does not work with 2D actors!<br><br>The casting to vtkPointPicker was the one that was wrong...<br><br>// Problem line..<br><span class="q">vtkPointPicker *picker = (vtkPointPicker *)rwi-&gt;GetPicker();
<br><br>The picker is not an instance of vtkPointPicker... I found that out when I called it to print itself and see which member gets executed...<br><br>Anyways, if someone knows a way to do picking on 2D actors, PLEASE let me know!
<br><br>Thanks,<br><br>Anja<br></span><br><div><span class="gmail_quote">On 01/09/06, <b class="gmail_sendername">Anja Ende</b> &lt;<a href="mailto:anja.ende@googlemail.com">anja.ende@googlemail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>It seems that was not it! It still crashes!! The strange thing is that calling the picker-&gt;GetMapper() also crashes. Here is the updated code!</div><div><span class="q"><br><br>vtkRenderWindowInteractor *rwi = this-&gt;Interactor;
<br>&nbsp;if (rwi)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPointPicker *picker = (vtkPointPicker *)rwi-&gt;GetPicker();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; picker-&gt;Pick(x, y, m_viewer-&gt;GetCurrentSlice(), this-&gt;CurrentRenderer);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;PointId: &quot; &lt;&lt; picker-&gt;GetPointId() &lt;&lt; &quot;\n&quot;;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout.flush();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (picker-&gt;GetPointId() != -1)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br></span></div><div>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (picker-&gt;GetMapper()) // Also crashes<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double ptMapped[3];<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; double ptActual[3];
<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; picker-&gt;GetSelectionPoint(ptActual);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; picker-&gt;GetMapperPosition(ptMapped); // crashes<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ptActual[0] &lt;&lt; ptActual[1] &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; ptMapped[0] &lt;&lt; ptMapped[1] &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout.flush();</div><div><span class="e" id="q_10d68a04d12bc0e0_3">
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br><br><div><span class="gmail_quote">On 01/09/06, <b class="gmail_sendername">Obada Mahdi</b> &lt;<a href="mailto:omahdi@gmx.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
omahdi@gmx.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Anja!<br><br>On 31.08.2006, at 23:53, Anja Ende wrote:<br>&gt; Ahhhhhh...that must be it... I am so stupid! Thanks for pointing<br>&gt; that out to me! I have to wait till tomorrow to try it out...<br>&gt;<br>&gt; Wondering why
<br>&gt; picker-&gt;GetSelectionPoint(ptActual);<br>&gt; worked though...must have been an accident!<br><br>I would think so -- the trouble with unpredictable values is that<br>they are so<br>unpredictable, sometimes they even make sense.&nbsp;&nbsp;In C/C++, undefined
<br>local<br>variables sometimes resemble local/implicit variables or function call<br>parameters and such stuff, which were used before (like in &quot;std::cout<br>&lt;&lt; ...&quot;<br>or so).&nbsp;&nbsp;If you happen to accidentally use such a variable, hitting a
<br>valid<br>pointer and thus not get an immediate segfault, this can be really<br>hard to<br>track down, as the manifestation of the problem hardly gives you any<br>hint<br>about what went wrong in the first place.<br><br>

So, in some sense, you are lucky to have a segfault -- and it is<br>nothing to be<br>ashamed about, such things happen to all of us, I dare say :-)<br><br>&gt; Thanks,<br>&gt;<br>&gt; Anja<br><br>You're welcome!<br><br><br>

Obada<br></blockquote></div><br>

</span></div></blockquote></div><br>