SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Circle Generation Algorithm
Total Slide (14)
Circle Generation Algorithm
• Circle Generation is a tricky task for computer because
we have to choose pixels along a circular path.
• Selection of right pixel for illumination requires more
computation time as compare to Line drawing
algorithm.
• Selection of appropriate pixels is based on decision
parameter which is same as line drawing algorithm but
computation is different.
• Two algorithm for Circle generation are:
• Breshenham’s Circle Generation Algorithm
• Mid Point Circle generation Algorithm.
Circle generation algorithm
Breshenham’s Circle Generation Algorithm
1. Set x=0; y=10 here y contains value for radius of circle
2. p=3-(2*r) calculate first decision parameter which calculate which pixel will glow on
the circumference of the circle.
3. Repeat setp 3 until (i<y), set always set i=x initially
4. If p<0
calculate x=x+1, Y=Y and next decision parameter by p=p+4*x+6;
Otherwise
Calculate y=y-1 and x=x+1;
Calculate next decision parameter by p=p+4*x-4*y+10;
calculte points for all octants of circle by using and paint corresponding points with
color
putpixel(xc+x,yc-y,4); putpixel(xc-x,yc-y,4);
putpixel(xc+x,yc+y,4); putpixel(xc-x,yc+y,4);
putpixel(xc+y,yc-x,4); putpixel(xc-y,yc-x,4);
putpixel(xc+y,yc+x,4); putpixel(xc-y,yc+x,4);
5. Stop algorithm when (i>y) or (i==y)
Code section from circle Program
• x=0;y=100;
• p=3-(2*r);
• for(int i=0;i<y;i++)
• {
• if(p<0)
• { x=x+1; p=p+4*x+6; }
• else
{ y=y-1; x=x+1; p=p+4*x-4*y+10; }
• putpixel(xc+x,yc-y,4); putpixel(xc-x,yc-y,4);
• putpixel(xc+x,yc+y,4); putpixel(xc-x,yc+y,4);
• putpixel(xc+y,yc-x,4); putpixel(xc-y,yc-x,4);
• putpixel(xc+y,yc+x,4); putpixel(xc-y,yc+x,4);
• delay(40);
• }
Numerical based on Breshenham’s Circle generation algorithm
(x,y) (y,x) (-x,y) (-y,x) (-x,-y) (-y,-x) (x,-y) (y,-x) (p<0)
P=p+4x+6; x=x+1
(p>=0)
P=p+4(x-y)+10
x=x+1, y=y-1
(0,10) (10,0) (-0,10) (-10,0) (-0,-10) (-10,-0) (0,-10) (10,-0) P=-17
(1,10) (10,1) (-1,10) (-10,1) (-1,-10) (-10,-1) (1,-10) (10,-1) P= -7
(2,10) (10,2) (-2,10) (-10,2) (-2,-10) (-10,-2) (2,-10) (10,-2) P=7
(3,9) (9,3) (-3,9) (-9,3) (-3,-9) (-9,-3) (3,-9) (9,-3) P=-7
(4,9) (9,4) (-4,9) (-9,4) (-4,-9) (-9,-4) (4,-9) (9,-4) P=15
(5,8) (8,5) (-5,8) (-8,5) (-5,-8) (-8,-5) (5,-8) (8,-5) P=13
(6,7) (7,6) (-6,7) (-7,6) (-6,-7) (-7,-6) (6,-7) (7-6) P=19
(7,6) (6,7) (-7,6) (-6,7) (-7,-6) (-6,-7) (7,-6) (6-7) don’t Draw These Points
Because (x>y). Stop
Algorithm when X>=Y.
Generate Circle when radius is 10 using breshenham’s circle generation algorithm
Let Circle radius is 10 X=0 and y=r or y=10 P=3-2*10; p=-17
Question
• Generate Circle using breshenham’s Circle generation algorithm when
radius is 5.
(x,y) (y,x) (-x,y) (-y,x) (-x,-y) (-y,-x) (x,-y) (y,-x) (p<0)
P=p+4x+6; x=x+1
(p>=0)
P=p+4(x-y)+10
x=x+1, y=y-1
(0,5) (5,0) (-0,5) (-5,0) (-0,-5) (-5-0) (0,-5) (5,-0) P=--7
(1,5) (5,1) (-1,5) (-5,1) (-1,-5) (-5,-1) (1,-5) (5,-1) P= 3
(2,4) (4,2) (-2,4) (-4,2) (-2,-4) (-4,-2) (2,-4) (4,-2) P=5
(3,3) (3,3) (-3,3) (-3,3) (-3,-3) (-3,-3) (3,-3) (3,-3) Algorithm will stop when
x==y or x>y (don’t
calculate next points )
Draw all the calculated
points
THANK YOU!!

More Related Content

What's hot (20)

PPTX
Output primitives in Computer Graphics
Kamal Acharya
 
PPTX
Mid point circle algorithm
Mani Kanth
 
PPTX
Computer graphics basic transformation
Selvakumar Gna
 
PPTX
Random scan displays and raster scan displays
Somya Bagai
 
PPTX
Raster scan systems with video controller and display processor
hemanth kumar
 
PPT
Visible surface detection in computer graphic
anku2266
 
PPTX
Projections.pptx
jyoti_lakhani
 
PPT
2D transformation (Computer Graphics)
Timbal Mayank
 
PPT
fractals
Yogesh jatin Gupta
 
PPTX
Line Drawing Algorithms - Computer Graphics - Notes
Omprakash Chauhan
 
PPTX
Raster scan system & random scan system
shalinikarunakaran1
 
PPTX
Dda algorithm
Mani Kanth
 
PPTX
Color Models Computer Graphics
dhruv141293
 
PPT
Raster scan system
Mohd Arif
 
PPT
Line drawing algo.
Mohd Arif
 
PPTX
3 d viewing projection
Pooja Dixit
 
PPTX
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
 
PPTX
Back face detection
Pooja Dixit
 
PPTX
Computer graphics chapter 4
PrathimaBaliga
 
PPTX
Homogeneous Representation: rotating, shearing
Manthan Kanani
 
Output primitives in Computer Graphics
Kamal Acharya
 
Mid point circle algorithm
Mani Kanth
 
Computer graphics basic transformation
Selvakumar Gna
 
Random scan displays and raster scan displays
Somya Bagai
 
Raster scan systems with video controller and display processor
hemanth kumar
 
Visible surface detection in computer graphic
anku2266
 
Projections.pptx
jyoti_lakhani
 
2D transformation (Computer Graphics)
Timbal Mayank
 
Line Drawing Algorithms - Computer Graphics - Notes
Omprakash Chauhan
 
Raster scan system & random scan system
shalinikarunakaran1
 
Dda algorithm
Mani Kanth
 
Color Models Computer Graphics
dhruv141293
 
Raster scan system
Mohd Arif
 
Line drawing algo.
Mohd Arif
 
3 d viewing projection
Pooja Dixit
 
BRESENHAM’S LINE DRAWING ALGORITHM
St Mary's College,Thrissur,Kerala
 
Back face detection
Pooja Dixit
 
Computer graphics chapter 4
PrathimaBaliga
 
Homogeneous Representation: rotating, shearing
Manthan Kanani
 

Similar to Circle generation algorithm (20)

PPTX
L-6 (Circle Drawing Algorithm Computer graphics).pptx
JatinSareen6
 
PPT
Unit 3
Siddhant Goyal
 
PPTX
Chapter 3 - Part 1 [Autosaved].pptx
Kokebe2
 
PPT
2.circle
SakshiNailwal
 
PPTX
Lec05 circle ellipse
Maaz Rizwan
 
PPTX
Computer graphics
Nanhen Verma
 
PDF
Computer graphics 2
Prabin Gautam
 
PPTX
CG-Lecture3.pptx
lakshitasarika2014
 
PDF
Unit-2 raster scan graphics,line,circle and polygon algorithms
Amol Gaikwad
 
PDF
module 1.pdf
KimTaehyung188352
 
PPT
2.Line,circle drawing.ppt line circlw drawing algorith
SwatiChauhan63735
 
PPT
Output Primitives in Computer Graphics and Multimedia
saranyan75
 
PPT
Computer Graphics and Multimedia Output primitives
saranyan75
 
PPTX
PPT_14.pptx
SanandMishra
 
PDF
mid point algorithm.pdf
MehulMunshi3
 
PPT
Cs580
Chellamuthu K
 
PPT
10994479.ppt
ALIZAIB KHAN
 
PPTX
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
ghosharkoprabho
 
PPT
Graphics6 bresenham circlesandpolygons
Ketan Jani
 
PPT
Graphics6 bresenham circlesandpolygons
Thirunavukarasu Mani
 
L-6 (Circle Drawing Algorithm Computer graphics).pptx
JatinSareen6
 
Chapter 3 - Part 1 [Autosaved].pptx
Kokebe2
 
2.circle
SakshiNailwal
 
Lec05 circle ellipse
Maaz Rizwan
 
Computer graphics
Nanhen Verma
 
Computer graphics 2
Prabin Gautam
 
CG-Lecture3.pptx
lakshitasarika2014
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Amol Gaikwad
 
module 1.pdf
KimTaehyung188352
 
2.Line,circle drawing.ppt line circlw drawing algorith
SwatiChauhan63735
 
Output Primitives in Computer Graphics and Multimedia
saranyan75
 
Computer Graphics and Multimedia Output primitives
saranyan75
 
PPT_14.pptx
SanandMishra
 
mid point algorithm.pdf
MehulMunshi3
 
10994479.ppt
ALIZAIB KHAN
 
7. Bresenharms Circle Generation Algo_c8503330f911dd9ec76af8508bc0728d.pptx
ghosharkoprabho
 
Graphics6 bresenham circlesandpolygons
Ketan Jani
 
Graphics6 bresenham circlesandpolygons
Thirunavukarasu Mani
 
Ad

More from Ankit Garg (20)

PPT
Introduction to computer graphics part 2
Ankit Garg
 
PPT
Introduction to computer graphics part 1
Ankit Garg
 
DOCX
Curve clipping
Ankit Garg
 
PPT
Window to viewport transformation
Ankit Garg
 
PPT
Unit 1
Ankit Garg
 
PPT
Projection ppt
Ankit Garg
 
PPT
Polygon filling
Ankit Garg
 
PPT
Polygon clipping
Ankit Garg
 
PPTX
Numerical unit 1
Ankit Garg
 
PPT
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
PPT
Line clipping
Ankit Garg
 
PPTX
Hidden surface removal
Ankit Garg
 
PPTX
Graphics software standards
Ankit Garg
 
PPTX
Fractal introduction and applications modified version
Ankit Garg
 
PPTX
Digital image processing &amp; computer graphics
Ankit Garg
 
PPTX
Concept of basic illumination model
Ankit Garg
 
PPT
Character generation
Ankit Garg
 
PPT
Applications of cg
Ankit Garg
 
PPT
2 d transformation
Ankit Garg
 
PPT
3 d transformations
Ankit Garg
 
Introduction to computer graphics part 2
Ankit Garg
 
Introduction to computer graphics part 1
Ankit Garg
 
Curve clipping
Ankit Garg
 
Window to viewport transformation
Ankit Garg
 
Unit 1
Ankit Garg
 
Projection ppt
Ankit Garg
 
Polygon filling
Ankit Garg
 
Polygon clipping
Ankit Garg
 
Numerical unit 1
Ankit Garg
 
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
Line clipping
Ankit Garg
 
Hidden surface removal
Ankit Garg
 
Graphics software standards
Ankit Garg
 
Fractal introduction and applications modified version
Ankit Garg
 
Digital image processing &amp; computer graphics
Ankit Garg
 
Concept of basic illumination model
Ankit Garg
 
Character generation
Ankit Garg
 
Applications of cg
Ankit Garg
 
2 d transformation
Ankit Garg
 
3 d transformations
Ankit Garg
 
Ad

Recently uploaded (20)

PDF
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
PPTX
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
PDF
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
PDF
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
PDF
PRIZ Academy - Process functional modelling
PRIZ Guru
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PPTX
Functions in Python Programming Language
BeulahS2
 
PDF
01-introduction to the ProcessDesign.pdf
StiveBrack
 
PPTX
WHO And BIS std- for water quality .pptx
dhanashree78
 
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
PPTX
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
PDF
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
PPTX
Mobile database systems 20254545645.pptx
herosh1968
 
PDF
Designing for Tomorrow – Architecture’s Role in the Sustainability Movement
BIM Services
 
PDF
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
PDF
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
PPT
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
PPTX
Introduction to Python Programming Language
merlinjohnsy
 
CLIP_Internals_and_Architecture.pdf sdvsdv sdv
JoseLuisCahuanaRamos3
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
PRIZ Academy - Process functional modelling
PRIZ Guru
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Functions in Python Programming Language
BeulahS2
 
01-introduction to the ProcessDesign.pdf
StiveBrack
 
WHO And BIS std- for water quality .pptx
dhanashree78
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Mobile database systems 20254545645.pptx
herosh1968
 
Designing for Tomorrow – Architecture’s Role in the Sustainability Movement
BIM Services
 
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
Introduction to Python Programming Language
merlinjohnsy
 

Circle generation algorithm

  • 2. Circle Generation Algorithm • Circle Generation is a tricky task for computer because we have to choose pixels along a circular path. • Selection of right pixel for illumination requires more computation time as compare to Line drawing algorithm. • Selection of appropriate pixels is based on decision parameter which is same as line drawing algorithm but computation is different. • Two algorithm for Circle generation are: • Breshenham’s Circle Generation Algorithm • Mid Point Circle generation Algorithm.
  • 4. Breshenham’s Circle Generation Algorithm 1. Set x=0; y=10 here y contains value for radius of circle 2. p=3-(2*r) calculate first decision parameter which calculate which pixel will glow on the circumference of the circle. 3. Repeat setp 3 until (i<y), set always set i=x initially 4. If p<0 calculate x=x+1, Y=Y and next decision parameter by p=p+4*x+6; Otherwise Calculate y=y-1 and x=x+1; Calculate next decision parameter by p=p+4*x-4*y+10; calculte points for all octants of circle by using and paint corresponding points with color putpixel(xc+x,yc-y,4); putpixel(xc-x,yc-y,4); putpixel(xc+x,yc+y,4); putpixel(xc-x,yc+y,4); putpixel(xc+y,yc-x,4); putpixel(xc-y,yc-x,4); putpixel(xc+y,yc+x,4); putpixel(xc-y,yc+x,4); 5. Stop algorithm when (i>y) or (i==y)
  • 5. Code section from circle Program • x=0;y=100; • p=3-(2*r); • for(int i=0;i<y;i++) • { • if(p<0) • { x=x+1; p=p+4*x+6; } • else { y=y-1; x=x+1; p=p+4*x-4*y+10; } • putpixel(xc+x,yc-y,4); putpixel(xc-x,yc-y,4); • putpixel(xc+x,yc+y,4); putpixel(xc-x,yc+y,4); • putpixel(xc+y,yc-x,4); putpixel(xc-y,yc-x,4); • putpixel(xc+y,yc+x,4); putpixel(xc-y,yc+x,4); • delay(40); • }
  • 6. Numerical based on Breshenham’s Circle generation algorithm (x,y) (y,x) (-x,y) (-y,x) (-x,-y) (-y,-x) (x,-y) (y,-x) (p<0) P=p+4x+6; x=x+1 (p>=0) P=p+4(x-y)+10 x=x+1, y=y-1 (0,10) (10,0) (-0,10) (-10,0) (-0,-10) (-10,-0) (0,-10) (10,-0) P=-17 (1,10) (10,1) (-1,10) (-10,1) (-1,-10) (-10,-1) (1,-10) (10,-1) P= -7 (2,10) (10,2) (-2,10) (-10,2) (-2,-10) (-10,-2) (2,-10) (10,-2) P=7 (3,9) (9,3) (-3,9) (-9,3) (-3,-9) (-9,-3) (3,-9) (9,-3) P=-7 (4,9) (9,4) (-4,9) (-9,4) (-4,-9) (-9,-4) (4,-9) (9,-4) P=15 (5,8) (8,5) (-5,8) (-8,5) (-5,-8) (-8,-5) (5,-8) (8,-5) P=13 (6,7) (7,6) (-6,7) (-7,6) (-6,-7) (-7,-6) (6,-7) (7-6) P=19 (7,6) (6,7) (-7,6) (-6,7) (-7,-6) (-6,-7) (7,-6) (6-7) don’t Draw These Points Because (x>y). Stop Algorithm when X>=Y. Generate Circle when radius is 10 using breshenham’s circle generation algorithm Let Circle radius is 10 X=0 and y=r or y=10 P=3-2*10; p=-17
  • 7. Question • Generate Circle using breshenham’s Circle generation algorithm when radius is 5. (x,y) (y,x) (-x,y) (-y,x) (-x,-y) (-y,-x) (x,-y) (y,-x) (p<0) P=p+4x+6; x=x+1 (p>=0) P=p+4(x-y)+10 x=x+1, y=y-1 (0,5) (5,0) (-0,5) (-5,0) (-0,-5) (-5-0) (0,-5) (5,-0) P=--7 (1,5) (5,1) (-1,5) (-5,1) (-1,-5) (-5,-1) (1,-5) (5,-1) P= 3 (2,4) (4,2) (-2,4) (-4,2) (-2,-4) (-4,-2) (2,-4) (4,-2) P=5 (3,3) (3,3) (-3,3) (-3,3) (-3,-3) (-3,-3) (3,-3) (3,-3) Algorithm will stop when x==y or x>y (don’t calculate next points ) Draw all the calculated points