Skip to main content

Square using Midpoint Circle Algorithm

Square using Midpoint Circle Algorithm

Drawing a Square 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 square. But we can draw many shapes from it with little modifications in the formula.


Below is the code written in C to draw a square 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\\bgiin initgraph with just ""(2 double quotes).

Comments

Post a Comment

Popular posts from this blog

Bresenham's Line Algorithm (THICK LINE)

Bresenham's Line Algorithm (THICK LINE) Bresenham's Line Algorithm (THICK LINE) The Bresenham algorithm is an incremental scan conversion algorithm.

Bresenham's Line Algorithm (DASHED LINE)

Bresenham's Line Algorithm (DASHED LINE) The Bresenham algorithm is an incremental scan conversion algorithm.

Bresenham's Line Algorithm (DOTTED LINE)

Bresenham's Line Algorithm (DOTTED LINE) Bresenham's Line Algorithm (DOTTED LINE) Bresenham's Line Algorithm (DOTTED LINE) The Bresenham algorithm is an incremental scan conversion algorithm.



Bestseller's in Electronics only at Amazon Best Selling Products on Amazon