[vtkusers] vtkXYPlotActor

Shakes Shekhar.Chandra at sci.monash.edu.au
Thu Feb 26 17:23:33 EST 2009


Hi Justin,

This link might help, not for XY Plot class but for picking values from 
the renderer by Mark Wyszomierski.

<http://devsample.org/index.php?option=com_content&task=view&id=48&Itemid=27>

Its got iren->GetEventPosition(event_pos) stuff, uses the Picker class. 
Let me know how u go.... I will probably need to do this later. ;)

HTH
Cheers
Shakes

Justin Giles wrote:
> 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
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shekhar_Chandra.vcf
Type: text/x-vcard
Size: 247 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090227/1ea10a07/attachment.vcf>


More information about the vtkusers mailing list