[vtkusers] vtkXYPlotActor
Justin Giles
jtgiles at gmail.com
Thu Feb 26 11:54:21 EST 2009
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.
What I do when the mouse is clicked is the following:
(plot is my vtkXYPlotActor object, renderer is my vtkRenderer object)
-----------------------
vtkRenderWindowInteractor* iren =
vtkRenderWindowInteractor::SafeDownCast(obj);
int event_pos[2];
iren->GetEventPosition(event_pos); //generates X/Y coordinates based on
viewport where 0,0 is bottom left of window
plot->SetViewportCoordinate(event_pos[0], event_pos[1]);
double pos2[3];
plot->ViewportToPlotCoordinate(renderer, pos2[0], pos2[1]);
//cout always shows -25.8051 and -0.167051
cout << pos2[0] << " : " << pos2[1] << endl;
-------------------------------
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.
I've been stuck on this for quite a few days, so any help would be
appreciated.
Thanks,
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090226/ab58ed25/attachment.htm>
More information about the vtkusers
mailing list