SlideShare a Scribd company logo
1 of 8
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.
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

Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer GraphicsUniversity of Potsdam
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan systemshalinikarunakaran1
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithmMani Kanth
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)shalinikarunakaran1
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithmPooja Dixit
 
Anti aliasing Computer Graphics
Anti aliasing Computer GraphicsAnti aliasing Computer Graphics
Anti aliasing Computer GraphicsUniversity of Potsdam
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversionMohd Arif
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)shalinikarunakaran1
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive SachiniGunawardana
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
Introduction to computer graphics
Introduction to computer graphics Introduction to computer graphics
Introduction to computer graphics Priyodarshini Dhar
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cppAlamgir Hossain
 

What's hot (20)

Bresenham circle
Bresenham circleBresenham circle
Bresenham circle
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
 
Anti aliasing Computer Graphics
Anti aliasing Computer GraphicsAnti aliasing Computer Graphics
Anti aliasing Computer Graphics
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Computer graphics realism
Computer graphics realismComputer graphics realism
Computer graphics realism
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Introduction to computer graphics
Introduction to computer graphics Introduction to computer graphics
Introduction to computer graphics
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
CRT (Cathode ray tube)
CRT (Cathode ray tube)CRT (Cathode ray tube)
CRT (Cathode ray tube)
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
 

Similar to Circle generation algorithm

Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxKokebe2
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipseMaaz Rizwan
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsNanhen Verma
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2Prabin Gautam
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsAmol Gaikwad
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimediasaranyan75
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivessaranyan75
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdfMehulMunshi3
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.pptALIZAIB KHAN
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsKetan Jani
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsThirunavukarasu Mani
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptAliZaib71
 

Similar to Circle generation algorithm (20)

Unit 3
Unit 3Unit 3
Unit 3
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
2.circle
2.circle2.circle
2.circle
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
CG-Lecture3.pptx
CG-Lecture3.pptxCG-Lecture3.pptx
CG-Lecture3.pptx
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitives
 
PPT_14.pptx
PPT_14.pptxPPT_14.pptx
PPT_14.pptx
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
Cs580
Cs580Cs580
Cs580
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
 
Graphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygonsGraphics6 bresenham circlesandpolygons
Graphics6 bresenham circlesandpolygons
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Computer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipseComputer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipse
 

More from Ankit Garg

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2Ankit Garg
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1Ankit Garg
 
Curve clipping
Curve clippingCurve clipping
Curve clippingAnkit Garg
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
Projection ppt
Projection pptProjection ppt
Projection pptAnkit Garg
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1Ankit Garg
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesAnkit Garg
 
Line clipping
Line clippingLine clipping
Line clippingAnkit Garg
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removalAnkit Garg
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standardsAnkit Garg
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified versionAnkit Garg
 
Digital image processing &amp; computer graphics
Digital image processing &amp; computer graphicsDigital image processing &amp; computer graphics
Digital image processing &amp; computer graphicsAnkit Garg
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination modelAnkit Garg
 
Character generation
Character generationCharacter generation
Character generationAnkit Garg
 
Applications of cg
Applications of cgApplications of cg
Applications of cgAnkit Garg
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
3 d transformations
3 d transformations3 d transformations
3 d transformationsAnkit Garg
 

More from Ankit Garg (20)

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Unit 1
Unit 1Unit 1
Unit 1
 
Projection ppt
Projection pptProjection ppt
Projection ppt
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
Line clipping
Line clippingLine clipping
Line clipping
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified version
 
Digital image processing &amp; computer graphics
Digital image processing &amp; computer graphicsDigital image processing &amp; computer graphics
Digital image processing &amp; computer graphics
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 
Character generation
Character generationCharacter generation
Character generation
 
Applications of cg
Applications of cgApplications of cg
Applications of cg
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 

Recently uploaded (20)

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 

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.
  • 3.
  • 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