<div>Hi everyone,</div>
<div> </div>
<div>I'm the new one to use the vtk, and there is a problem trobling me several days so that I could not continue my research working. This problem is how to get the mouse position in an actor for 3D rendering?</div>
<div> </div>
<div>To get the event position is very available now, however the position of the actor is wrong when I get the pickerposition of vtkpointvtk by the event postion.</div>
<div> </div>
<div>For example when getting the mouse position in the actor:</div>
<div>********************************************************************************************************</div>
<div>
<p> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::SafeDownCast(obj);<br> int x = 0, y = 0;<br> iren->GetEventPosition(x, y);</p>
<p> //get the picker handle from the interactor<br> vtkPointPicker *pointpicker = (vtkPointPicker *)(iren->GetPicker());<br> <br> double position[3];<br> //start the picking process<br> if (pointpicker->Pick((double)position[0], (double)position[1],
0.0, ren) != 0)<br> {<br> //get the list of picked point<br> vtkPoints* thePointList = pointpicker->GetPickedPositions();</p>
<p> //get the number of picked points<br> int nbrpoints = thePointList->GetNumberOfPoints();</p>
<p> if (nbrpoints<=0)<br> return;</p>
<p><br> pointpicker->GetPickPosition(position); // The position is wrong in the actor.</p>
<p> }</p>
<p>********************************************************************************************************</p></div>
<div>I tested it many times, and tried severl ways, but failed finally. The position I got is not the position for the actor, and there is "small error" for x-y, but "big error" for z. </div>
<div>I guess: Is this problem related with the camera viewpoint?</div>
<div> </div>
<div>Any body knows it, please tell me or give me some example codes.</div>
<div>I'm appreciate you very much.<br clear="all"><br>-- <br>Thanks<br>Feifeng </div>