0% found this document useful (0 votes)
43 views1 page

Bresenham'S Algorithm For Drawing A Circle

Bresenham's algorithm for drawing a circle starts by declaring variables like x, y, and p and initializing the graphics mode. It then inputs the radius r and loads the initial point (0,r) with decision parameter p=1-r. It repeatedly increments x while x<y, updating p based on whether it is greater than or less than 0, and decrementing y if needed. It calculates and plots the circle points (x,y) shifted over 300 units on both axes before ending the graphics mode.

Uploaded by

Jaisson K Simon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Bresenham'S Algorithm For Drawing A Circle

Bresenham's algorithm for drawing a circle starts by declaring variables like x, y, and p and initializing the graphics mode. It then inputs the radius r and loads the initial point (0,r) with decision parameter p=1-r. It repeatedly increments x while x<y, updating p based on whether it is greater than or less than 0, and decrementing y if needed. It calculates and plots the circle points (x,y) shifted over 300 units on both axes before ending the graphics mode.

Uploaded by

Jaisson K Simon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

BRESENHAMS ALGORITHM FOR DRAWING A CIRCLE

1.Start
2.Declare variables x,y,p & also declare gdriver=DETECT,gmode
3Initialis the graphic mode with the path location in TC folder.
4.Input the radius of circle r
5.Load x=0, y=r & initial decision parameter p=1-r so the first point is (0,r)
6.Repeat step 7 while (x<y) and increment x value simultaneously
7.If (p>0) do p=p+2*(x-y)+1
8. Otherwise p=p+2*x+1 & y is decremented simultaneously.
9.Then calculate value of function circlepoints() with parameters (x,y)
10.Place pixels using putpixel at points (x+300,y+300) in specified color in circlepoints()
function shifting the origin to 300 on bothx & y axis.
11.Closegraph
12.Stop

You might also like