SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Saikrishna Tanguturu
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics University of Potsdam
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmRachana Marathe
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removalPunyajoy Saha
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniquesMani Kanth
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithmAnkit Garg
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfacesAnkur Kumar
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
2D Transformation
2D Transformation2D Transformation
2D TransformationShahDhruv21
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphicssabbirantor
 

Was ist angesagt? (20)

Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Back face detection
Back face detectionBack face detection
Back face detection
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithm
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Clipping
ClippingClipping
Clipping
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 

Ähnlich wie 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
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algoMohd Arif
 
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
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmNeha Kaurav
 
Double_Integral.pdf
Double_Integral.pdfDouble_Integral.pdf
Double_Integral.pdfd00a7ece
 

Ähnlich wie 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
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
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
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing Algorithm
 
Cs580
Cs580Cs580
Cs580
 
Double_Integral.pdf
Double_Integral.pdfDouble_Integral.pdf
Double_Integral.pdf
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Kürzlich hochgeladen (20)

SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

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