RE: 1. Input of screen coordinates; 2. Fast graphics

• To: mathgroup at smc.vnet.net
• Subject: [mg26958] RE: [mg26953] 1. Input of screen coordinates; 2. Fast graphics
• From: "David Park" <djmp at earthlink.net>
• Date: Tue, 30 Jan 2001 03:38:12 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Manuel,

You can click off points from a plot and copy them.
1) Click on the plot to select it.
2) Hold down Ctrl and then click of the series of points that you want to
copy.
3) Then copy by any of the usual methods: right click and use the context
4) Paste into any Mathematica Input cell expression, again using the usual
methods.

For your second question, these are the timings I got for creating an array
and then plotting it on a 800 Mhz PC. I designed the table so the Hue values
would run from 0 to 1. It was necessary to include the decimal points in the
iterators to avoid exact expressions and do machine precision calculations.
Otherwise it takes much longer.

(mat = Table[(1 + Cos[x]*Sin[y])/2, {x, 0., Pi, Pi/600.}, {y, 0., Pi,
Pi/600.}];)//Timing
{0.83 Second, Null}

Timing[Show[Graphics[{Raster[mat, ColorFunction -> Hue]}],
AspectRatio -> Automatic, Frame -> True]; ]
{3.51 Second, Null}

Is that too slow?

David Park

> From: Manuel Arala Chaves [mailto:machaves at fc.up.pt]
To: mathgroup at smc.vnet.net
>
> 	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?
>