Can anyone tell me how ViewportToPlotCoordinate is supposed to work? No matter what I do I keep getting X = -25.8051 and Y = -0.167051.<br><br>What I do when the mouse is clicked is the following:<br>(plot is my vtkXYPlotActor object, renderer is my vtkRenderer object)<br>
-----------------------<br> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::SafeDownCast(obj);<br> int event_pos[2];<br> iren->GetEventPosition(event_pos); //generates X/Y coordinates based on viewport where 0,0 is bottom left of window<br>
plot->SetViewportCoordinate(event_pos[0], event_pos[1]);<br> double pos2[3];<br> plot->ViewportToPlotCoordinate(renderer, pos2[0], pos2[1]);<br><br>//cout always shows -25.8051 and -0.167051<br> cout << pos2[0] << " : " << pos2[1] << endl;<br>
-------------------------------<br><br>Any thoughts on this? Am I doing something wrong? My assumption on how this should work is that I would get coordinates based on the X/Y axis of the actual 2D plot.<br><br>I've been stuck on this for quite a few days, so any help would be appreciated.<br>
<br>Thanks,<br><br>Justin<br><br>