1. Input of screen coordinates; 2. Fast graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg26953] 1. Input of screen coordinates; 2. Fast graphics
- From: Manuel Arala Chaves <machaves at fc.up.pt>
- Date: Sat, 27 Jan 2001 20:00:16 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I have two questions: 1st question - Is there a way in Mathematica to input a couple of screen coordinates with the mouse? The closest thing I know is: in a graphic, CTR+ALT+mouse shows the coordinates in the graphic. Or (rather artificial), if you have a picture inserted into the Mathematica notebook, you can move (with the mouse) another graphics window over the picture and look at the successive screen coordinates of the top left corner. But in both cases you cannot "save" the coordinates you see into a variable. Is this possible in another way? (What I need is the following: imagine you have a picture with a curve, inserted in a Mathematica notebook; I would like to be able to mark with the mouse enough points of the curve and then to use the coordinates of those points to fit a curve in Mathematica - preferably in parametric form - which would approximate the curve in the image). Any suggestion? 2nd question - Suppose you have an array 600x600 of numbers (of colors) in Mathematica and you want to get an image of a square (600x600 pixels), each pixel having a color depending on the number in the corresponding position of the array. (If Color is the array and MaxColor the maximum element of the array, the color of pixel {x,y} could be given by Graphics[Hue[Color[[x,y]]/MaxColor]]). Of course it is very easy to do that by appending instructions Graphics[Hue[color[[x,y]]/MaxColor]], Graphics[Point[[x,y]]], ... and for economy, if the color did not change, you may even suppress the color instruction. This works for small arrays, but it takes a lot of computing time if the array is big, e.g. 600x600. Is there a fast way of getting the picture? If not, I would consider saving the corresponding array to a file and using another program to view the image. Any suggestion? Thanks in advance. Manuel Chaves