Help w/Plotting a circle...
Olaf Mehlberg
olm at informatik.uni-kiel.dbp.de
Fri Jun 14 20:21:15 AEST 1991
In <1667 at seq.uncwil.edu> session at seq.uncwil.edu (Zack C. Sessions) writes:
>sjb at piobe.austin.ibm.com (Scott J Brickner) writes:
>>In general, though, a quick optimization for any of the circle drawing
>>algorithms is to only COMPUTE 1/8th of the points, and use reflection
>>about the various axes x=0, y=0, y=x, and y= -x for the remainder.
>Umm, wouldn't that be compute 1/4 of the points and then use the
>reflection method to get the other points? Also, when using the
>reflection method to obtain the remaining points, you need to consider
>the coordinates of the center of the circle, if it isn't (0,0).
>The computation is also elementary trigonometry which I won't go
>into since any elememtary book on trig in your library should
>be all you need.
I agree, you have to look for the coordinates of the center, but
1/8th of the points is enough.
How to do assuming (0/0) as center: (* is the center c is a
computed point r a reflected point)
! c
! c
*-------c
! r
! r
compute the 1/8 c, reflect them at the --- line and you have 1/4
of the circle. reflect this at the ! line and you have 1/2 of the
circle. flip x/y coordinates and you get the missing 1/2 of the
circle. Then move all coordinates into the right center.
I hope this is correct, sounds bit too simple ;-0
Olaf Mehlberg
--------------------------------------------------------------------
Errare humanum est
--------------------------------------------------------------------
Christian-Albrechts-Universitaet Kiel, Institut fuer Informatik
Preusserstr. 1 - 9 , D - 2300 Kiel 1
Phone: ++49-431-5604-42 , Fax: ++49-431-566143
EMail: olm at informatik.uni-kiel.dbp.de
--------------------------------------------------------------------
More information about the Comp.lang.c
mailing list