<div>I have voxels stored in vtkUnstructuredGrid. On mousemove I want to determine whether point selected by mouse is inside voxel. I have tried this (please see code below), but the program behaves like it had infinite loop on the line: <b><font color="#7f0055">
<p>double</p></font></b> <u>z</u> = ren.GetZ((<b><font color="#7f0055">int</font></b>)mouse.getX(), (<b><font color="#7f0055">int</font></b>)mouse.getY()). How can I determine: 1. the world coordinate position of selected point by mouse, 2. whether point is inside a voxel grid. Does VTK support detection whether point is inside a voxel or do I have to write my own code?</div>
<div> </div>
<div><b><font color="#7f0055">
<p>private</p></font></b> vtkUnstructuredGrid <font color="#0000c0">voxelGrid;</font>
<p>vtkPanel <font color="#0000c0">sculpturePanel</font>;</p>
<p><font color="#0000c0"></font> </p><font color="#0000c0"><b><font color="#7f0055">
<p align="left">this</p></font></b></font><font color="#000000">.</font><font color="#0000c0">sculpturePanel</font><font color="#000000">.addMouseMotionListener(</font><b><font color="#7f0055">new</font></b><font color="#000000"> MouseMotionListener() {</font>
<p align="left"><font color="#000000"></font></p>
<p align="left"><font color="#646464">@Override</font></p>
<p align="left"><b><font color="#7f0055">public</font></b> <b><font color="#7f0055">void</font></b> mouseMoved(MouseEvent arg0) {</p>
<p align="left"><font color="#3f7f5f">// </font><b><font color="#7f9fbf">TODO</font></b><font color="#3f7f5f"> Auto-generated method stub</font></p>
<p align="left">Point mouse = arg0.getLocationOnScreen();</p>
<p align="left">vtkRenderer ren = <font color="#0000c0">sculpturePanel</font>.GetRenderer();</p>
<p align="left"><b><font color="#7f0055">double</font></b> <u>z</u> = ren.GetZ((<b><font color="#7f0055">int</font></b>)mouse.getX(), (<b><font color="#7f0055">int</font></b>)mouse.getY()); ///?????!!!!!!!!</p>
<p align="left">ren.SetDisplayPoint(mouse.getX(), mouse.getY(), ren.GetZ((<b><font color="#7f0055">int</font></b>)mouse.getX(), (<b><font color="#7f0055">int</font></b>)mouse.getY()));</p>
<p align="left">ren.DisplayToWorld();</p>
<p align="left">
</p><p align="left"><font color="#3f7f5f"></font></p>}
<p></p>
<p align="left"></p>
<p align="left"><font color="#646464">@Override</font></p>
<p align="left"><b><font color="#7f0055">public</font></b> <b><font color="#7f0055">void</font></b> mouseDragged(MouseEvent arg0) {</p>
<p align="left"><font color="#3f7f5f">// </font><b><font color="#7f9fbf">TODO</font></b><font color="#3f7f5f"> Auto-generated method stub</font></p>
<p align="left"></p>
<p align="left">}</p>
<p>});</p>
<p> </p>
<p>Thanks in advance,</p>
<p>Gregory</p><p></p></div>