0% found this document useful (0 votes)
132 views

Circle Drawing Algorithm

This document discusses circle drawing algorithms, specifically the midpoint circle algorithm. It begins with an introduction explaining that a circle generation algorithm is used to create circles for computer graphics. It then provides the general circle equation and midpoint circle equation. The bulk of the document focuses on explaining the midpoint circle algorithm in detail - including the midpoint theorem, boundary condition, pseudocode, and providing an example of applying it to digitize a circle.

Uploaded by

Bipin Masal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Circle Drawing Algorithm

This document discusses circle drawing algorithms, specifically the midpoint circle algorithm. It begins with an introduction explaining that a circle generation algorithm is used to create circles for computer graphics. It then provides the general circle equation and midpoint circle equation. The bulk of the document focuses on explaining the midpoint circle algorithm in detail - including the midpoint theorem, boundary condition, pseudocode, and providing an example of applying it to digitize a circle.

Uploaded by

Bipin Masal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

TRIBHUVAN UNIVERSITY

Faculty of Management
National College of Computer Studies
Paknajol, Kathmandu

Computer Graphics
Circle Drawing Algorithm
Submitted by: Submitted to:
Mani K.P. Mr. Dinesh Maharjan
Roll no.= 8 Miss Kajol Ramtel
Programme = BIM (5th Semester)
Submission Date:
Abstract
A circle generation algorithm is an algorithm used to create a circle on a
computer screen. It is used in various applications such as computer-aided
design (CAD) software, animation software, games, and scientific visualization.

Here two topics are discussed they are os follows:

 General circle equation


 Mid-point circle equation

These equations are used to determine the points or the vertices to be used to
draw a circle by intersecting those points.

The midpoint circle algorithm is the most commonly used analytical algorithm
for circle generation. It is based on the midpoint theorem which states that if the
points along the circumference of a circle are equidistant from the center of the
circle, then the points will lie on the circle. The algorithm uses this theorem to
generate a circle by calculating the points which are equidistant from the center
of the circle and then connecting the points to form a circle.
Table of content

Contents
Introduction...........................................................................................................................................1
General Circle Equations.......................................................................................................................2
Mid-Point Circle Equation......................................................................................................................2
Boundary Condition...............................................................................................................................2
Mid-Point Algorithm..............................................................................................................................3
Mid Point Pseudocode...........................................................................................................................3
Example.................................................................................................................................................4
Introduction
A circle is one of the fundamental shapes used in computer graphics and it is
generated through a circle generation algorithm. A circle generation algorithm
is an algorithm used to create a circle on a computer screen. It is used in various
applications such as computer-aided design (CAD) software, animation
software, games, and scientific visualization.

Drawing a circle on the screen is a little complex than drawing a line. There are
two popular algorithms for generating a circle − Bresenham’s
Algorithm and Midpoint Circle Algorithm. These algorithms are based on the
idea of determining the subsequent points required to draw the circle.

Here two topics are discussed they are os follows:

 General circle equation


 Mid-point circle equation

These equations are used to determine the points or the vertices to be used to
draw a circle by intersecting those points.

1
General Circle Equations
There are two equations to determine or draw a circle. They are as follows:

Explicit Equation: y=+/-sqrt(R^2-X^2)

Implicit Equation: F(x.y)=x^2-y^2-R^2=0

Mid-Point Circle Equation


The midpoint circle algorithm is the most commonly used analytical algorithm
for circle generation. It is based on the midpoint theorem which states that if the
points along the circumference of a circle are equidistant from the center of the
circle, then the points will lie on the circle. The algorithm uses this theorem to
generate a circle by calculating the points which are equidistant from the center
of the circle and then connecting the points to form a circle.

Boundary Condition
Whether the mid-point lies inside or outside the circle can be decided by using
the formula:-

Given a circle centered at (0,0) and radius r and a point p(x,y)


F(p) = x2 + y2 – r2
if F(p)<0, the point is inside the circle
F(p)=0, the point is on the perimeter
F(p)>0, the point is outside the circle

2
Mid-Point Algorithm
● drawpixel(xc,yc,x,y)

● putpixel(x+xc,y+yc)

● putpixel(x+xc,-y+yc)

● putpixel(-x+xc,y+yc)

● putpixel(-x+xc,-y+yc)

● putpixel(y+xc,x+yc)

● putpixel(y+xc,-x+yc)

● putpixel(-y+xc,x+yc)

● putpixel(-y+xc,-x+yc)

Mid Point Pseudocode


1. Start(0,r)

2. Calculate p=1-r

3. X=0, y=r, xc,yc

4. drawCircle(xc,yc,x,y)

5. While x<=y

6. X=x+1

If(p<=0),p=p+2x+3

Else y=y-1,p=p+2x-2y+5

8. drawCircle(xc,yc,x,y)

3
Example
Digitize circle with radius 4 units and center at (3,3) using mid point circle algorithm.

x y p (x+xc,y+yc)

0 4 1-4=-3 (0+3,4+3)=(3,7)

1 4 -3+2*1+3=2 (1+3,4+3)=(3,7)

2 3 2+2*2-2*3+5=5 (2+3,3+3)=(5,6)

3 2 5+2*3-2*2+5=12 (3+3,2+3)=(6,5)

You might also like