Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!uunet!mcsun!unido!majestix!olm From: olm@informatik.uni-kiel.dbp.de (Olaf Mehlberg) Newsgroups: comp.lang.c Subject: Re: Help w/Plotting a circle... Message-ID: <4218@snoopy.informatik.uni-kiel.dbp.de> Date: 14 Jun 91 10:21:15 GMT References: <1991Jun11.154335.130@sugaree.uu.net> <8433@awdprime.UUCP> <1667@seq.uncwil.edu> Organization: Universitaet Kiel, Germany Lines: 41 In <1667@seq.uncwil.edu> session@seq.uncwil.edu (Zack C. Sessions) writes: >sjb@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@informatik.uni-kiel.dbp.de --------------------------------------------------------------------