DPRG List  

[DPRG] math I once knew

Subject: [DPRG] math I once knew
From: Kipton Moravec kip at kdream.com
Date: Fri Dec 20 10:34:01 CST 2002

Actually you can do it with 90 degrees and reflect it to all 4 points.

There are a bunch of ways to do this and I will show the first one to pop in
my head.  I am assuming you have a sin() and cos() function.

sin() is the ratio of opposite side from the angle over hypotenuse
cos() is the ratio of adjacent side from the angle over the hypotenuse

>From the center point,

radius * sin(angle) = Y
radius * cos(angle) = X

If the angle goes through 0 through 90 degrees, then you reflect for the
other 3 quadrants.
(X,Y), (-X,Y), (X,-Y), (-X,-Y)

This assumes the center of the circle is at 0,0.
To have a different circle center, add the coordinates of the circle to the
final result.
(X+Xcenter,Y+Ycenter), (-X+Xcenter,Y+Ycenter), (X+Xcenter,-Y+Ycenter),

Now you have the answer you are looking for..


----- Original Message -----
>From: "Sluggy!" <slugmusk at linuxlegend.com>
To: "dprg" <dprglist at dprg.org>
Sent: Friday, December 20, 2002 9:49 AM
Subject: [DPRG] math I once knew

> Hey, folks...
> I have a question about some math I once knew but don't remember the
> details of.
> I need to be able to plot X and Y coordinates for points laying in a
> circle, in this case, the minute and hour points on a clock face.
> I used to do this all the time drawing circles and radar screens and the
> like on the Commodore 64 and even on my first IBM clone. Thus far,
> everything I have found online seems to be a tool to give you back the
> picture, not the coordinates for the points.
> As I recall, the algorithm was such that you plug in the coordinates of
> the center point, units of diameter and an an angle in degrees for a
> given point. To scribe a circle, you simply stepped through the range on
> 0 to 359 for the angle, drawing a line between each set of points.
> Actually, I think there were two steps, one for the X coordinate, one
> for the Y.
> Anyway, if anyone has a lead on this, it would be appreciated! :)
> Sluggy!
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at dprg.org
> http://nimon.ncc.com/mailman/listinfo/dprglist

More information about the DPRG mailing list