SlideShare une entreprise Scribd logo
1  sur  15
BRESSENHAM’S MIDPOINT
CIRCLE DRAWING ALGORITHM
(EXPLAINED)
WHAT IS A CIRCLE?
• A circle is the set of all points in a plane that are
at a given distance from a given point, the
centre.
• Equivalently it is the curve traced out by a point
that moves so that its distance from a given
point is constant.
• A circle may also be defined as a special ellipse
in which the two foci are coincident and the
eccentricity is 0.
GENERATING CIRCLES
Circle equation : f(x,y) = x2 + y2 – r2
Any point on the circumference of the circle will satisfy the above
equation.
Hence :
>0  Point is outside the boundary of the circle
f(x,y) =0  Point is on the boundary of the circle
<=  Point is inside the boundary of the circle
FIRST OCTANT
• For a pixel at (xk, yk) the next pixel (xk +1, yk) or at (xk+1,
yk–1) is closer to the circle.
• The pixel point Pk for a corresponding point on the circle
is given as:
Pk = f(xk + 1, yk – ½) = (xk + 1)2 + yk - ½)2 – r2
• The next pixel point Pk+1 is given as:
Pk+1 = f(xk+1 + 1, yk+1 - ½) = [(xk + 1) + 1]2 + (yk+1 - ½ )2 – r2
(xk +1, yk)
(xk+1, yk–1)
Expanding Pk and Pk+1 and subtracting them, the eq. obtained is:
Pk+1 = Pk + 2(xk+1) + (y2
k+1 – y2
k) – (yk+1 – yk) + 1
(where the next Y – coordinate (yk+1) is either yk or yk-1 depending on
the sign of Pk.)
Since xk+1 denotes the next point along the X – axis (going rightwards)
xk+1 = xk + 1  2(xk+1) = 2xk + 2
Since yk+1 denotes the next point along the Y – axis (going downwards)
yk+1 = yk - 1  2(yk+1) = 2yk - 2
We’ve have to begin somewhere. So let the
starting position be (x0,y0) = (0, r)
Substituting these values in the circle
equation, P0 = f(1, r – ½) = 𝟓
𝟒 - r
Since r is a integer, neglecting the small
value of ¼, we have P0 = 1 - r
(0, r)
(0, 0)
BRESSENHAM’S ALGORITHM
1. Input radius r and centre of the circle (xc, yc), and obtain the first
point on the circumference of a circle centred on the origin as
(x0, y0) = (0, r)
2. Calculate the initial value of the decision parameter as
P0 = 1 – r
where r is the radius of the circle
3. At each xk position, starting at k= 0, perform the following test:
If (Pk < 0), then the NEXT POINT along the circle centred on (0, 0) is
(xk+1, yk) and Pk+1 = Pk + 2xk+1 +1
 Pk+1 = Pk + 2xk + 3
Otherwise, the NEXT POINT along the circle is
(xk+1, yk–1) and Pk+1 = Pk + 2xk+1 + 1 – 2yk+1
 Pk+1 = Pk + 2xk – 2yk + 5
2xk+1 = 2xk + 2
2yk+1 = 2yk – 2
4. Determine the Symmetry Points on the other 7 Octants
5. Move each calculated pixel position (x,y) onto the circular path
centered at (xc,yc) and plot the coordinate values as
x = x + xc and y = y + yc
6. Repeat steps 3 to 5 until x >= y
FOR EXAMPLE
Consider a circle that has to be drawn with its center at (0, 0) and a
radius of 10:
Initial point on the circumference of the circle is (0, r) = (0 ,10)
Initial pixel P0 = 1 – r = 1 – 10 = -9
Therefore, x = 0, y = 10, 2x = 0, 2y = 20, P0 = -9
Applying Bressenham’s Algorithm, we tabulate the data into a table
Pk Formula Pk Xk Yk
Initial Values -9 0 10
<0  -9 + 2(0) + 3 = -6 1 10
<0  -6 + 2(1) + 3 = -1 2 10
<0  -1 + 2(2) + 3 = 6 3 10
>0  6 + 2(3) -2(10) + 5 = -3 4 9
<0  -3 + 2(4) + 3 = 8 5 9
>0  8 + 2(5) – 2(9) + 5 = 5 6 8
>0  5 + 2(6) – 2(8) + 5 = 6 7 7
>0  6 + 2(7) – 2(7) + 5 = 11 8 6
REMEMBER:
xk+1 and yk+1 is
derived based on
the sign of Pk
REMEMBER:
Pk+1 derived
from Pk,
xk and yk
First calculate xk+1 and yk+1 values from Pk and then Pk+1 from Pk, xk, yk
11
9
8
7
6
5
4
3
2
1
0 1 2 3 4 5 6 7 8 9 10 11
• This is what the output
would look like.
• Only the first Octant is
shown.
• The Remaining Octants can
be derived symmetrically by
changing the signs.
FINAL RENDER
Prepared by
Mrinmoy Dalal
13311A0506
S.N.I.S.T.

Contenu connexe

Tendances

2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer GraphicsA. S. M. Shafi
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithmAnkit Garg
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmNeha Kaurav
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmRachana Marathe
 
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
 
Video display devices
Video display devicesVideo display devices
Video display devicesMohd Arif
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Composite transformations
Composite transformationsComposite transformations
Composite transformationsMohd Arif
 
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiionMuhammadHamza401
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformationSelvakumar Gna
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 

Tendances (20)

2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer Graphics
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
Mid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing AlgorithmMid-Point Cirle Drawing Algorithm
Mid-Point Cirle Drawing Algorithm
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithm
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithm
 
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...
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiion
 
Bresenham circle
Bresenham circleBresenham circle
Bresenham circle
 
Bresenham algorithm
Bresenham algorithmBresenham algorithm
Bresenham algorithm
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 

Similaire à Bressenham’s Midpoint Circle Drawing Algorithm

mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdfMehulMunshi3
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptAliZaib71
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipseMaaz Rizwan
 
Circle algorithm
Circle algorithmCircle algorithm
Circle algorithmPooja Dixit
 
Geometry (Grid & section formula)
Geometry (Grid & section formula)Geometry (Grid & section formula)
Geometry (Grid & section formula)itutor
 
Coordinategeometry1 1
Coordinategeometry1 1Coordinategeometry1 1
Coordinategeometry1 1TGTMATH
 
Coordinategeometry1 1
Coordinategeometry1 1Coordinategeometry1 1
Coordinategeometry1 1TGTMATH
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq Bahtiar
 
Comuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithmComuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithmRachana Marathe
 
Kelompok 1
Kelompok 1Kelompok 1
Kelompok 1teddy
 

Similaire à Bressenham’s Midpoint Circle Drawing Algorithm (20)

mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
Computer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.pptComputer_Graphics_circle_drawing_techniq.ppt
Computer_Graphics_circle_drawing_techniq.ppt
 
Lec05 circle ellipse
Lec05 circle ellipseLec05 circle ellipse
Lec05 circle ellipse
 
10994479.ppt
10994479.ppt10994479.ppt
10994479.ppt
 
Computer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipseComputer Graphics - lines, Circles and ellipse
Computer Graphics - lines, Circles and ellipse
 
2.circle
2.circle2.circle
2.circle
 
Circle algorithm
Circle algorithmCircle algorithm
Circle algorithm
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Geometry (Grid & section formula)
Geometry (Grid & section formula)Geometry (Grid & section formula)
Geometry (Grid & section formula)
 
1513 circles
1513 circles1513 circles
1513 circles
 
Geometry Transformation
Geometry TransformationGeometry Transformation
Geometry Transformation
 
Circle
CircleCircle
Circle
 
Quadratic equation.pptx
Quadratic equation.pptxQuadratic equation.pptx
Quadratic equation.pptx
 
Coordinategeometry1 1
Coordinategeometry1 1Coordinategeometry1 1
Coordinategeometry1 1
 
Coordinategeometry1 1
Coordinategeometry1 1Coordinategeometry1 1
Coordinategeometry1 1
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
Comuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithmComuter graphics bresenhams circle drawing algorithm
Comuter graphics bresenhams circle drawing algorithm
 
Kelompok 1
Kelompok 1Kelompok 1
Kelompok 1
 

Dernier

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Dernier (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

Bressenham’s Midpoint Circle Drawing Algorithm

  • 2. WHAT IS A CIRCLE? • A circle is the set of all points in a plane that are at a given distance from a given point, the centre. • Equivalently it is the curve traced out by a point that moves so that its distance from a given point is constant. • A circle may also be defined as a special ellipse in which the two foci are coincident and the eccentricity is 0.
  • 3.
  • 4. GENERATING CIRCLES Circle equation : f(x,y) = x2 + y2 – r2 Any point on the circumference of the circle will satisfy the above equation. Hence : >0  Point is outside the boundary of the circle f(x,y) =0  Point is on the boundary of the circle <=  Point is inside the boundary of the circle
  • 5. FIRST OCTANT • For a pixel at (xk, yk) the next pixel (xk +1, yk) or at (xk+1, yk–1) is closer to the circle. • The pixel point Pk for a corresponding point on the circle is given as: Pk = f(xk + 1, yk – ½) = (xk + 1)2 + yk - ½)2 – r2 • The next pixel point Pk+1 is given as: Pk+1 = f(xk+1 + 1, yk+1 - ½) = [(xk + 1) + 1]2 + (yk+1 - ½ )2 – r2 (xk +1, yk) (xk+1, yk–1)
  • 6. Expanding Pk and Pk+1 and subtracting them, the eq. obtained is: Pk+1 = Pk + 2(xk+1) + (y2 k+1 – y2 k) – (yk+1 – yk) + 1 (where the next Y – coordinate (yk+1) is either yk or yk-1 depending on the sign of Pk.) Since xk+1 denotes the next point along the X – axis (going rightwards) xk+1 = xk + 1  2(xk+1) = 2xk + 2 Since yk+1 denotes the next point along the Y – axis (going downwards) yk+1 = yk - 1  2(yk+1) = 2yk - 2
  • 7. We’ve have to begin somewhere. So let the starting position be (x0,y0) = (0, r) Substituting these values in the circle equation, P0 = f(1, r – ½) = 𝟓 𝟒 - r Since r is a integer, neglecting the small value of ¼, we have P0 = 1 - r (0, r) (0, 0)
  • 8. BRESSENHAM’S ALGORITHM 1. Input radius r and centre of the circle (xc, yc), and obtain the first point on the circumference of a circle centred on the origin as (x0, y0) = (0, r) 2. Calculate the initial value of the decision parameter as P0 = 1 – r where r is the radius of the circle
  • 9. 3. At each xk position, starting at k= 0, perform the following test: If (Pk < 0), then the NEXT POINT along the circle centred on (0, 0) is (xk+1, yk) and Pk+1 = Pk + 2xk+1 +1  Pk+1 = Pk + 2xk + 3 Otherwise, the NEXT POINT along the circle is (xk+1, yk–1) and Pk+1 = Pk + 2xk+1 + 1 – 2yk+1  Pk+1 = Pk + 2xk – 2yk + 5 2xk+1 = 2xk + 2 2yk+1 = 2yk – 2
  • 10. 4. Determine the Symmetry Points on the other 7 Octants 5. Move each calculated pixel position (x,y) onto the circular path centered at (xc,yc) and plot the coordinate values as x = x + xc and y = y + yc 6. Repeat steps 3 to 5 until x >= y
  • 11. FOR EXAMPLE Consider a circle that has to be drawn with its center at (0, 0) and a radius of 10: Initial point on the circumference of the circle is (0, r) = (0 ,10) Initial pixel P0 = 1 – r = 1 – 10 = -9 Therefore, x = 0, y = 10, 2x = 0, 2y = 20, P0 = -9 Applying Bressenham’s Algorithm, we tabulate the data into a table
  • 12. Pk Formula Pk Xk Yk Initial Values -9 0 10 <0  -9 + 2(0) + 3 = -6 1 10 <0  -6 + 2(1) + 3 = -1 2 10 <0  -1 + 2(2) + 3 = 6 3 10 >0  6 + 2(3) -2(10) + 5 = -3 4 9 <0  -3 + 2(4) + 3 = 8 5 9 >0  8 + 2(5) – 2(9) + 5 = 5 6 8 >0  5 + 2(6) – 2(8) + 5 = 6 7 7 >0  6 + 2(7) – 2(7) + 5 = 11 8 6 REMEMBER: xk+1 and yk+1 is derived based on the sign of Pk REMEMBER: Pk+1 derived from Pk, xk and yk First calculate xk+1 and yk+1 values from Pk and then Pk+1 from Pk, xk, yk
  • 13. 11 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 • This is what the output would look like. • Only the first Octant is shown. • The Remaining Octants can be derived symmetrically by changing the signs.