Hi Seb,<br>        I have a 3D box with the dimensions (0 200,0 200, 0 200) rendered through a class inherited from vtkCanvas.  My requirement is to pick a point from the mouse click and display a sphere at that point. I am checking about the vtkPointPicker.<br>
 And I am using the following code to pick the point.  It is not giving the correct position.  Is there any mistake in what I am doing.<br><br>@Override<br>public void mousePressed(MouseEvent e)<br>    {<br>        vtkPointPicker picker = new vtkPointPicker();<br>
        picker.SetTolerance(0.01);<br>        int result = picker.Pick(e.getX(), e.getY(), 0.0, this.GetRenderer());<br><br>        double[] pick;<br>        if(result!=0)<br>            pick = picker.GetPickPosition();<br>
<br>        System.out.println(pick[0] + &quot; &quot; + pick[1]+ &quot; &quot; + pick[2]);<br>        sphereActor.SetPosition(pick[0],pick[1],pick[2]);<br>        this.GetRenderer().AddActor(sphereActor);<br>}<br><br>Thanks for your time<br>
<br>-Satya.<br><div class="gmail_quote"><br>On Mon, Jun 11, 2012 at 1:16 PM, Sebastien Jourdain <span dir="ltr">&lt;<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I don&#39;t know what should be the Z value, but I guess that depend what<br>
you try to achieve.<br>
<br>
Seb<br>
<br>
On Mon, Jun 11, 2012 at 11:58 AM, satyanarayana reddy<br>
<div class="HOEnZb"><div class="h5">&lt;<a href="mailto:satyajanga@gmail.com">satyajanga@gmail.com</a>&gt; wrote:<br>
&gt; Hi Seb,<br>
&gt;        Thank you for the reply. what should be the value of Z?<br>
&gt;<br>
&gt; -Satya.<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Jun 11, 2012 at 11:56 AM, Sebastien Jourdain<br>
&gt; &lt;<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I guess it&#39;s because you said that the point is at z=0 so the z will<br>
&gt;&gt; still be wrong after your convert ion. On the other hand, point and<br>
&gt;&gt; cell picker do work in Java as I remember doing it a while ago.<br>
&gt;&gt; By default its the &quot;p&quot; key that you need to hit to trigger the picking...<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Jun 11, 2012 at 11:36 AM, satyanarayana reddy<br>
&gt;&gt; &lt;<a href="mailto:satyajanga@gmail.com">satyajanga@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Dear vtkusers,<br>
&gt;&gt; &gt;             I have a requirement in which I need to select a point( by<br>
&gt;&gt; &gt; mouse<br>
&gt;&gt; &gt; click) in Cube. I am not using vtkPointPicker/vtkCellPicker as they does<br>
&gt;&gt; &gt; not<br>
&gt;&gt; &gt; seem to compatible in Java.<br>
&gt;&gt; &gt;   I am creating a class which extends vtkCanvas to render the cube and I<br>
&gt;&gt; &gt; am<br>
&gt;&gt; &gt; overriding the mouse listeners in vtkCanvas  to pick the event position<br>
&gt;&gt; &gt; and<br>
&gt;&gt; &gt; converting it to World Coordinates using the following code as I am not<br>
&gt;&gt; &gt; sure<br>
&gt;&gt; &gt; how to use the static methods in vtkInteractorObserver(in Java wrapped<br>
&gt;&gt; &gt; vtk),<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;     double[] GetDisplayToWorldCoordinates(double x, double y)<br>
&gt;&gt; &gt;     {<br>
&gt;&gt; &gt; /* x,y represent the event position*/<br>
&gt;&gt; &gt;         double[] coordinates = new double[3];<br>
&gt;&gt; &gt;         coordinates[0]=(double)x;<br>
&gt;&gt; &gt;         coordinates[1]=(double)y;<br>
&gt;&gt; &gt;         coordinates[2]=0;<br>
&gt;&gt; &gt;         double[] worldCord = new double[3];<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;         this.GetRenderer().SetDisplayPoint(coordinates);<br>
&gt;&gt; &gt;         this.GetRenderer().DisplayToView();<br>
&gt;&gt; &gt;         this.GetRenderer().ViewToWorld();<br>
&gt;&gt; &gt;         worldCord=    this.GetRenderer().GetWorldPoint();<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;        return worldCord;<br>
&gt;&gt; &gt;    }<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; My box source is (0,200,0,200,0,200). But the worldCord returned from<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; function is not what I expected. They are not even coming in the<br>
&gt;&gt; &gt; extent.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Please check If I am doing anything wrong. Or suggest how to convert the<br>
&gt;&gt; &gt; event position in object coordinate system.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks in advance,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Best Regards,<br>
&gt;&gt; &gt; Satya.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>