Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!udel!sbcs!libserv1.ic.sunysb.edu!clane From: clane@libserv1.ic.sunysb.edu (Charles F Lane) Newsgroups: comp.lang.pascal Subject: Circle algorithm Message-ID: <1991May8.153016.19558@sbcs.sunysb.edu> Date: 8 May 91 15:30:16 GMT Sender: usenet@sbcs.sunysb.edu (Usenet poster) Organization: State University of New York at Stony Brook Lines: 32 Originator: clane@libserv1.ic.sunysb.edu I recently bought Turbo Pascal v6.0 and I am just starting to learn how to program with it. I am interested in graphics and was disappointed to find out that there is no support for 320x200 w/256colors in VGA (mode 19) in the BGI driver. I have been able to invoke mode 19 through BIOS Video Interrupt 10H and use Function Request 0CH to write dots to the screen. I will have to make my own graphics unit that includes circles, rectangles, ellipses, etc. What I need to know is what algorithm to use to draw circles. I am using the following equations currently: X = r * COS(w) Y = r * SIN(w) where r is the radius, w is the angle (0-360 plugged in to the equation), and x and y are the coordinates of the points to be plotted to form the circle. There are two problems with this equation, though. First, it is too slooooooow! Second, the larger the radius of the circle, the farther apart the points are. Thus, the circle is made of dots in the form of a circular array is the result. If anyone knows the circle algorithm that GRAPH.TPU uses, I'll use that. I want to be sure that if concentric circles are drawn that there are no pixels missing in between, so keep that in mind when providing a solution. Thank you so much in advance! P.S. I hate to be a nag, but please respond directly via E-mail as I may not be able to read all postings before the older ones get periodically deleted. Sometimes rn says, "6500 unread messages" and only 150 of them are available! -- Charles F. Lane clane@csserv1.ic.sunysb.edu