SlideShare une entreprise Scribd logo
1  sur  13
Computer Graphics Bresenham Circle Generation Algorithm Taher S. Vijay Computer Academy Taher S. Vijay Computer Academy
8- point symmetry in circles (x, y) (-x, y) (y, x) (-y, x) (y, -x) (-y, -x) (x, -y) (-x, -y) Taher S. Vijay Computer Academy
Concept Circles have the property of being highly symmetrical, which is handy when it comes to drawing them on a display screen. We know that there are 360 degrees in a circle. First we see that a circle is symmetrical about the x axis, so only the first 180 degrees need to be calculated.  Next, we see that it's also symmetrical about the y axis, so now we only need to calculate the first 90 degrees. Finally, we see that the circle is also symmetrical about the 45 degree diagonal axis, so we only need to calculate the first 45 degrees. Taher S. Vijay Computer Academy
Interpolation Bresenham'scircle algorithm calculates the locations of the pixels in the first 45 degrees. It assumes that the circle is centered on the origin shifting the original center coordinates (centerx,centery). So for every pixel (x,y) it calculates, we draw a pixel in each of the 8 octants of the circle :putpixel(centerx + x, center y + y)putpixel(centerx + x, center y - y) putpixel(centerx - x, center y + y)putpixel(centerx - x, center y - y)putpixel(centerx + y, center y + x)putpixel(centerx + y, center y - x)putpixel(centerx - y, center y + x)putpixel(centerx - y, center y - x) Taher S. Vijay Computer Academy
Derivation Now, consider a very small continuous arc of the circle interpolated below, passing by the discrete pixels as shown. At any point (x,y), we have two choices – to choose the pixel on east of it, i.e. N(x+1,y) or the south-east pixel S(x+1,y-1). To choose the pixel, we determine the errors involved with both N & S which are f(N) and f(S) respectively and whichever gives the lesser error, we choose that pixel. Taher S. Vijay Computer Academy
Let di = f(N) + f(S), where d can be called as "decision parameter", so that  if (di<=0),then, N(x+1,y) is to be chosen as next pixel  i.e. xi+1 = xi+1 and yi+1 = yi,and if (di>0),then, S(x+1,y-1) is to be chosen as next pixel  i.e. xi+1 = xi+1 and yi+1 = yi-1. Taher S. Vijay Computer Academy
We know that for a circle,                            x2 + y2 = r2,  where r represents the radius of the circle, an input to the algorithm.Errors can be represented asf(N) = (xi + 1)2 + yi2 - r2,        -(1)f(S) = (xi + 1)2 + (yi - 1)2 - r2        -(2)As di = f(N) + f(S),di = 2(xi+1)2 + yi2 + (yi-1)2 – 2r2        -(3) Taher S. Vijay Computer Academy
Calculating next decision parameter,_di+1 = 2(xi+2)2 + yi+12 + (yi+1-1)2 – 2r2    -(4)from (4)- (3), we get,di+1 – di = 2((xi+2)2-(xi+1)2) + (yi+12 – yi2) + ((yi+1-1)2 + (yi-1)2)_di+1 = di + 2((xi+2+xi+1)(xi+2-xi-1)) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi-1)(yi+1-1-yi+1))_di+1 = di + 2(2xi+3) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi-1)(yi+1-1-yi+1)) Taher S. Vijay Computer Academy
Now, if (di<=0),xi+1=xi+1 and yi+1=yi so that di+1 = di + 2(2xi + 3) + ((yi+1+yi)( yi-yi)) + ((yi-1+yi-1)(yi-1-yi+1))di+1 = di + 2(2xi + 3) + ((yi+1+yi)(0)) + ((yi-1+yi-1)(0))di+1 = di + 4xi + 6 Taher S. Vijay Computer Academy
Else (di >0)  di+1 = di + 2(2xi+3) + ((yi-1+yi)(yi-1-yi)) + ((yi-2+yi-1)(yi-2-yi+1))di+1 = di + 4xi+6 + ((2yi-1)(-1)) + ((2yi-3)(-1))di+1 = di + 4xi+6 - 2yi - 2yi + 1 + 3di+1 = di + 4(xi - yi) + 10 Taher S. Vijay Computer Academy
To know di+1, we have to know di first.  The initial value of di  can be obtained by replacing x=0 and y=r in (3).  Thus, we get, do = 2 + r2 + (r - 1)2 -2r2do = 2 + r2 + r2 + 1 -2r – 2r2do = 3 – 2r Taher S. Vijay Computer Academy
                                 BRESENHAM’S CIRCLE ALGORITHM Bresenham Circle ( Xc, Yc, R): Description: Here Xc and Yc denote the x – coordinate and y –coordinate of the center of the circle. R is the radius. 1. Set X = 0 and Y = R 2. Set D = 3 – 2R 3. Repeat While (X < Y) 4.	 Call Draw Circle(Xc, Yc, X, Y) 5.	 Set X = X + 1 6. 	If (D < 0) Then 7. 		D = D + 4X + 6 8. 	Else 9. 		Set Y = Y – 1 10.		 D = D + 4(X – Y) + 10 	[End of If]  Call Draw Circle(Xc, Yc, X, Y) 		X++ 	[End of While] 11. Exit Taher S. Vijay Computer Academy
Draw Circle (Xc, Yc, X, Y): 1. Call PutPixel(Xc + X, Yc, + Y) 2. Call PutPixel(Xc - X, Yc, + Y) 3. Call PutPixel(Xc + X, Yc, - Y) 4. Call PutPixel(Xc - X, Yc, - Y) 5. Call PutPixel(Xc + Y, Yc, + X) 6. Call PutPixel(Xc - Y, Yc, + X) 7. Call PutPixel(Xc + Y, Yc, - X) 8. Call PutPixel(Xc - Y, Yc, - X) 9. Exit Taher S. Vijay Computer Academy

Contenu connexe

Tendances

Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algoMohd Arif
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentationLOKENDRA PRAJAPATI
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphicsSafayet Hossain
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmNeha Kaurav
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithmAnkit Garg
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive SachiniGunawardana
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformationUdayan Gupta
 

Tendances (20)

Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing Algorithm
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 

Similaire à Bresenham circle

Bresenhamcircle derivation
Bresenhamcircle derivationBresenhamcircle derivation
Bresenhamcircle derivationMazharul Islam
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptAliZaib71
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq Bahtiar
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxKokebe2
 
Open GL 04 linealgos
Open GL 04 linealgosOpen GL 04 linealgos
Open GL 04 linealgosRoziq Bahtiar
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdfMehulMunshi3
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesAnkit Garg
 
10CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 610CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 6Vanishree Arun
 
Double_Integral.pdf
Double_Integral.pdfDouble_Integral.pdf
Double_Integral.pdfd00a7ece
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmKALAIRANJANI21
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmKALAIRANJANI21
 

Similaire à Bresenham circle (20)

Bresenhamcircle derivation
Bresenhamcircle derivationBresenhamcircle derivation
Bresenhamcircle derivation
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
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
 
Open GL 04 linealgos
Open GL 04 linealgosOpen GL 04 linealgos
Open GL 04 linealgos
 
Linear equations 2-2 a graphing and x-y intercepts
Linear equations   2-2 a graphing and x-y interceptsLinear equations   2-2 a graphing and x-y intercepts
Linear equations 2-2 a graphing and x-y intercepts
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
 
Presentation on calculus
Presentation on calculusPresentation on calculus
Presentation on calculus
 
Circle
CircleCircle
Circle
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
10CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 610CSL67 CG LAB PROGRAM 6
10CSL67 CG LAB PROGRAM 6
 
2D_line_circle.ppt
2D_line_circle.ppt2D_line_circle.ppt
2D_line_circle.ppt
 
Cs580
Cs580Cs580
Cs580
 
Double_Integral.pdf
Double_Integral.pdfDouble_Integral.pdf
Double_Integral.pdf
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithm
 
Rasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithmRasterisation of a circle by the bresenham algorithm
Rasterisation of a circle by the bresenham algorithm
 

Plus de Taher Barodawala

Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systemsTaher Barodawala
 
Module 3 Object Oriented Data Models Object Oriented notations
Module 3  Object Oriented Data Models Object Oriented notationsModule 3  Object Oriented Data Models Object Oriented notations
Module 3 Object Oriented Data Models Object Oriented notationsTaher Barodawala
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented RelationshipsTaher Barodawala
 
Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations   Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations Taher Barodawala
 

Plus de Taher Barodawala (6)

Module 5 oodb systems semantic db systems
Module 5 oodb systems  semantic db systemsModule 5 oodb systems  semantic db systems
Module 5 oodb systems semantic db systems
 
Module 3 Object Oriented Data Models Object Oriented notations
Module 3  Object Oriented Data Models Object Oriented notationsModule 3  Object Oriented Data Models Object Oriented notations
Module 3 Object Oriented Data Models Object Oriented notations
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Object representations
Object representationsObject representations
Object representations
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations   Hearn and Baker 2 D transformations
Hearn and Baker 2 D transformations
 

Dernier

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Dernier (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Bresenham circle

  • 1. Computer Graphics Bresenham Circle Generation Algorithm Taher S. Vijay Computer Academy Taher S. Vijay Computer Academy
  • 2. 8- point symmetry in circles (x, y) (-x, y) (y, x) (-y, x) (y, -x) (-y, -x) (x, -y) (-x, -y) Taher S. Vijay Computer Academy
  • 3. Concept Circles have the property of being highly symmetrical, which is handy when it comes to drawing them on a display screen. We know that there are 360 degrees in a circle. First we see that a circle is symmetrical about the x axis, so only the first 180 degrees need to be calculated. Next, we see that it's also symmetrical about the y axis, so now we only need to calculate the first 90 degrees. Finally, we see that the circle is also symmetrical about the 45 degree diagonal axis, so we only need to calculate the first 45 degrees. Taher S. Vijay Computer Academy
  • 4. Interpolation Bresenham'scircle algorithm calculates the locations of the pixels in the first 45 degrees. It assumes that the circle is centered on the origin shifting the original center coordinates (centerx,centery). So for every pixel (x,y) it calculates, we draw a pixel in each of the 8 octants of the circle :putpixel(centerx + x, center y + y)putpixel(centerx + x, center y - y) putpixel(centerx - x, center y + y)putpixel(centerx - x, center y - y)putpixel(centerx + y, center y + x)putpixel(centerx + y, center y - x)putpixel(centerx - y, center y + x)putpixel(centerx - y, center y - x) Taher S. Vijay Computer Academy
  • 5. Derivation Now, consider a very small continuous arc of the circle interpolated below, passing by the discrete pixels as shown. At any point (x,y), we have two choices – to choose the pixel on east of it, i.e. N(x+1,y) or the south-east pixel S(x+1,y-1). To choose the pixel, we determine the errors involved with both N & S which are f(N) and f(S) respectively and whichever gives the lesser error, we choose that pixel. Taher S. Vijay Computer Academy
  • 6. Let di = f(N) + f(S), where d can be called as "decision parameter", so that  if (di<=0),then, N(x+1,y) is to be chosen as next pixel i.e. xi+1 = xi+1 and yi+1 = yi,and if (di>0),then, S(x+1,y-1) is to be chosen as next pixel i.e. xi+1 = xi+1 and yi+1 = yi-1. Taher S. Vijay Computer Academy
  • 7. We know that for a circle, x2 + y2 = r2, where r represents the radius of the circle, an input to the algorithm.Errors can be represented asf(N) = (xi + 1)2 + yi2 - r2,        -(1)f(S) = (xi + 1)2 + (yi - 1)2 - r2        -(2)As di = f(N) + f(S),di = 2(xi+1)2 + yi2 + (yi-1)2 – 2r2        -(3) Taher S. Vijay Computer Academy
  • 8. Calculating next decision parameter,_di+1 = 2(xi+2)2 + yi+12 + (yi+1-1)2 – 2r2    -(4)from (4)- (3), we get,di+1 – di = 2((xi+2)2-(xi+1)2) + (yi+12 – yi2) + ((yi+1-1)2 + (yi-1)2)_di+1 = di + 2((xi+2+xi+1)(xi+2-xi-1)) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi-1)(yi+1-1-yi+1))_di+1 = di + 2(2xi+3) + ((yi+1+yi)(yi+1-yi)) + ((yi+1-1+yi-1)(yi+1-1-yi+1)) Taher S. Vijay Computer Academy
  • 9. Now, if (di<=0),xi+1=xi+1 and yi+1=yi so that di+1 = di + 2(2xi + 3) + ((yi+1+yi)( yi-yi)) + ((yi-1+yi-1)(yi-1-yi+1))di+1 = di + 2(2xi + 3) + ((yi+1+yi)(0)) + ((yi-1+yi-1)(0))di+1 = di + 4xi + 6 Taher S. Vijay Computer Academy
  • 10. Else (di >0) di+1 = di + 2(2xi+3) + ((yi-1+yi)(yi-1-yi)) + ((yi-2+yi-1)(yi-2-yi+1))di+1 = di + 4xi+6 + ((2yi-1)(-1)) + ((2yi-3)(-1))di+1 = di + 4xi+6 - 2yi - 2yi + 1 + 3di+1 = di + 4(xi - yi) + 10 Taher S. Vijay Computer Academy
  • 11. To know di+1, we have to know di first. The initial value of di can be obtained by replacing x=0 and y=r in (3). Thus, we get, do = 2 + r2 + (r - 1)2 -2r2do = 2 + r2 + r2 + 1 -2r – 2r2do = 3 – 2r Taher S. Vijay Computer Academy
  • 12. BRESENHAM’S CIRCLE ALGORITHM Bresenham Circle ( Xc, Yc, R): Description: Here Xc and Yc denote the x – coordinate and y –coordinate of the center of the circle. R is the radius. 1. Set X = 0 and Y = R 2. Set D = 3 – 2R 3. Repeat While (X < Y) 4. Call Draw Circle(Xc, Yc, X, Y) 5. Set X = X + 1 6. If (D < 0) Then 7. D = D + 4X + 6 8. Else 9. Set Y = Y – 1 10. D = D + 4(X – Y) + 10 [End of If] Call Draw Circle(Xc, Yc, X, Y) X++ [End of While] 11. Exit Taher S. Vijay Computer Academy
  • 13. Draw Circle (Xc, Yc, X, Y): 1. Call PutPixel(Xc + X, Yc, + Y) 2. Call PutPixel(Xc - X, Yc, + Y) 3. Call PutPixel(Xc + X, Yc, - Y) 4. Call PutPixel(Xc - X, Yc, - Y) 5. Call PutPixel(Xc + Y, Yc, + X) 6. Call PutPixel(Xc - Y, Yc, + X) 7. Call PutPixel(Xc + Y, Yc, - X) 8. Call PutPixel(Xc - Y, Yc, - X) 9. Exit Taher S. Vijay Computer Academy