Drawing a Circle using Midpoint Circle Algorithm
In computer graphics, the midpoint circle algorithm is an algorithm used to determine the points needed for rasterizing a circle. Bresenham's circle algorithm is derived from the midpoint circle algorithm.
This algorithm is used to draw circle. But we can draw many shapes from it with little modifications in the formula.
Below is the code written in C to draw a circle using midpoint algorithm.
Code:
If you can't see the code, then Enable JavaScript in you browser
Output:
Note: Just copy the files "CGA.bgi" & "EGAVGA.bgi" from bgi folder to bin. So, if you have copied these 2 files then you can skip writing "C:\\tc\\bgi" in initgraph with just ""(2 double quotes).
Comments
Post a Comment