Dear vtkusers,<br> I have a requirement in which I need to select a point( by mouse click) in Cube. I am not using vtkPointPicker/vtkCellPicker as they does not seem to compatible in Java. <br> I am creating a class which extends vtkCanvas to render the cube and I am overriding the mouse listeners in vtkCanvas to pick the event position and converting it to World Coordinates using the following code as I am not sure how to use the static methods in vtkInteractorObserver(in Java wrapped vtk),<br>
<br> double[] GetDisplayToWorldCoordinates(double x, double y)<br> {<br>/* x,y represent the event position*/<br> double[] coordinates = new double[3];<br> coordinates[0]=(double)x;<br> coordinates[1]=(double)y;<br>
coordinates[2]=0;<br> double[] worldCord = new double[3];<br><br> this.GetRenderer().SetDisplayPoint(coordinates);<br> this.GetRenderer().DisplayToView();<br> this.GetRenderer().ViewToWorld();<br>
worldCord= this.GetRenderer().GetWorldPoint();<br><br> return worldCord;<br> }<br><br><br>My box source is (0,200,0,200,0,200). But the worldCord returned from the function is not what I expected. They are not even coming in the extent.<br>
<br>Please check If I am doing anything wrong. Or suggest how to convert the event position in object coordinate system. <br><br><br>Thanks in advance,<br><br>Best Regards,<br>Satya.<br><br><br> <br>