NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Ricardo, > I have a simple question about coordinate systems conversion. I want > to know how to convert a window X coordinate into graphic display > coordinates. I spent some time looking for the answer but I couldn't > find it. Given window coordinates x and y, you can do something like this: DisplayImpl display = . . . DisplayRenderer dr = display.getDisplayRenderer(); MouseBehavior mouse = dr.getMouseBehavior(); VisADRay ray = mouse.findRay(x, y); In a 2-D display, the x and y graphics coordinates are just ray.position[0] and ray.position[1]. In a 3-D display it is more complex - the ray position and vector define a ray that generally runs obliquely through the 3-D graphics coordinate system. Note that you'll need a new copy of VisAD to use the DisplayRenderer.getMouseBehavior() method. Cheers, Bill ---------------------------------------------------------- Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706 hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738 http://www.ssec.wisc.edu/~billh/vis.html
visad
archives: