<div dir="ltr">Can anybody help? Many thanks.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Many thanks.<br><br><br></div>Bill<br></div></div></div>
<br><div class="gmail_quote">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><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_8102450165141326187gmail-p1"><span class="m_8102450165141326187gmail-s1"><b>self.world_picker = vtk.vtkWorldPointPicker()<br></b></span></p><p class="m_8102450165141326187gmail-p1"><span class="m_8102450165141326187gmail-s1"><b>def </b></span>display_to_world(<span class="m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_8102450165141326187gmail-s2">self</span>.world_picker.Pick(pt[<span class="m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_8102450165141326187gmail-s3">1</span>], <span class="m_8102450165141326187gmail-s3">0</span>, <span class="m_8102450165141326187gmail-s2">self</span>.ren)<br>
    picker_pt = <span class="m_8102450165141326187gmail-s2">self</span>.world_picker.<wbr>GetPickPosition()<br>
    picker_pt = (picker_pt[<span class="m_8102450165141326187gmail-s3">0</span>], picker_pt[<span class="m_8102450165141326187gmail-s3">1</span>], <span class="m_8102450165141326187gmail-s3">0</span>)<br>
    <span class="m_8102450165141326187gmail-s1"><b>return </b></span>picker_pt</p><p class="m_8102450165141326187gmail-p1">







</p><p class="m_8102450165141326187gmail-p1"><span class="m_8102450165141326187gmail-s1"><b>def </b></span>world_to_display(<span class="m_8102450165141326187gmail-s2">self</span>, pt):<br>
    <span class="m_8102450165141326187gmail-s1"><b>if </b>len</span>(pt) == <span class="m_8102450165141326187gmail-s3">3</span>:<br>
        pt = pt + (<span class="m_8102450165141326187gmail-s3">1.0</span>,)<br>
    <span class="m_8102450165141326187gmail-s1"><b>elif </b>len</span>(pt) == <span class="m_8102450165141326187gmail-s3">2</span>:<br>
        pt = pt + (<span class="m_8102450165141326187gmail-s3">0.0</span>, <span class="m_8102450165141326187gmail-s3">1.0</span>)<br>
    <span class="m_8102450165141326187gmail-s2">self</span>.ren.SetWorldPoint(pt)<br>
    <span class="m_8102450165141326187gmail-s2">self</span>.ren.WorldToDisplay()<br>
    pt = <span class="m_8102450165141326187gmail-s2">self</span>.ren.GetDisplayPoint()<br>
    <span class="m_8102450165141326187gmail-s4">pt </span>= (pt[<span class="m_8102450165141326187gmail-s3">0</span>], pt[<span class="m_8102450165141326187gmail-s3">1</span>])<br>
    <span class="m_8102450165141326187gmail-s1"><b>return </b></span>pt</p><p class="m_8102450165141326187gmail-p1">pt = [5, 5]</p><p class="m_8102450165141326187gmail-p1">world_pt = self. world_to_display(pt)</p><p class="m_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_8102450165141326187gmail_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>
</div>
</blockquote></div><br></div>