<div dir="ltr">Bill,<div>For display_to_world, the picker picks up only what is visible (closes to the camera). You might have several objects (several values in world coordinates) that end up over the same display coordinate. This might explain why adding those text actors changes what you pick.</div><div><br></div><div>Dan</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 21, 2017 at 5:25 AM, Bill Q <span dir="ltr"><<a href="mailto:bill.q.hdp@gmail.com" target="_blank">bill.q.hdp@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can anybody help? Many thanks.</div><div class="gmail_extra"><br clear="all"><div><div class="m_1248160547709933159gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<span class="HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div>
<br><div class="gmail_quote"><span class="">On Fri, May 19, 2017 at 11:20 PM, Bill Q <span dir="ltr"><<a href="mailto:bill.q.hdp@gmail.com" target="_blank">bill.q.hdp@gmail.com</a>></span> wrote:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello Everyone,</div><div>I encountered a weird problem in coordinate conversion.</div><div><br></div><div>In order to check the accuracy, I converted from display to world, and from world back to display. Using the following ways:</div><div>







<p class="m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>self.world_picker = vtk.vtkWorldPointPicker()<br></b></span></p><p class="m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>display_to_world(<span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.Pick(pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_1248160547709933159m_8102450165141326187gmail-s3">0</span>, <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren)<br>
    picker_pt = <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.world_picker.GetPickPosit<wbr>ion()<br>
    picker_pt = (picker_pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], picker_pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">1</span>], <span class="m_1248160547709933159m_8102450165141326187gmail-s3">0</span>)<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>picker_pt</p><p class="m_1248160547709933159m_8102450165141326187gmail-p1">







</p><p class="m_1248160547709933159m_8102450165141326187gmail-p1"><span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>def </b></span>world_to_display(<span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>if </b>len</span>(pt) == <span class="m_1248160547709933159m_8102450165141326187gmail-s3">3</span>:<br>
        pt = pt + (<span class="m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>,)<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>elif </b>len</span>(pt) == <span class="m_1248160547709933159m_8102450165141326187gmail-s3">2</span>:<br>
        pt = pt + (<span class="m_1248160547709933159m_8102450165141326187gmail-s3">0.0</span>, <span class="m_1248160547709933159m_8102450165141326187gmail-s3">1.0</span>)<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.SetWorldPoint(pt)<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.WorldToDisplay()<br>
    pt = <span class="m_1248160547709933159m_8102450165141326187gmail-s2">self</span>.ren.GetDisplayPoint()<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s4">pt </span>= (pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_1248160547709933159m_8102450165141326187gmail-s3">1</span>])<br>
    <span class="m_1248160547709933159m_8102450165141326187gmail-s1"><b>return </b></span>pt</p><p class="m_1248160547709933159m_8102450165141326187gmail-p1">pt = [5, 5]</p><p class="m_1248160547709933159m_8102450165141326187gmail-p1">world_pt = self. world_to_display(pt)</p><p class="m_1248160547709933159m_8102450165141326187gmail-p1">display_pt = self. world_to_display(world_pt)</p></div><div>In some cases, it's quite accurate, which means pt equals display_pt. But, in some cases, the result is simply wrong. For example, for (5, 5), after conversions back to display, the coordinate becomes (20.89, 20.89).</div><div><br></div><div>Any ideas?</div><div><br></div><div><br></div><div><div class="m_1248160547709933159m_8102450165141326187gmail_signature"><div dir="ltr"><div>Many thanks.<span class="m_1248160547709933159HOEnZb"><font color="#888888"><br><br><br></font></span></div><span class="m_1248160547709933159HOEnZb"><font color="#888888">Bill<br></font></span></div></div></div>
</div>
</blockquote></div></div></div><br></div>
<br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>