On 10/20/06, Ashley M. Kirchner <ashley pcraft.com> wrote:
>
> I'm trying to draw a circle with a red indicator
(line) that
> represents wind direction. I can draw a circle, but
what I can't figure
> out is how to draw the indicator. The data I get
reports the direction
> in degrees. For example, right now our wind direction
is 320 (degrees),
> or in text format it reports it as Northwest.
>
> How can I translate that 320 degrees and have it
draw a red line
> starting in the middle of the circle to it's edge?
OK, let's say that your center point is (cx, cy) and you're
drawing a
line of length L at angle A, your origin (0, 0) is in the
upper-left
corner of the image, and North is 0 degrees, East is 90,
etc. You
would draw a line from (cx, cy) to (cx + L * sin(A), cy - L
* cos(A)).
Of course, that assumes your trig functions operate on
degrees. Odds
are they use radians, so you would convert with something
like sin(A *
pi / 180).
GNS
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
|