SlideShare a Scribd company logo
5
Most read
12
Most read
13
Most read
COMPUTER GRAPHICS
PREPARED BY:
RUCHI MAURYA
BRESENHAM’S LINE
DRAWING ALGORITHM
INDEX
 INTRODUCTION
 DERIVATION
 EXAMPLE
 ADVANTAGES
 DISADVANTAGES
 REFERENCES
INTRODUCTION
• Raster line-generating algorithm
• Developed by Bresenham
• Scan conversion takes place
using only incremental integer
calculations
• Accurate and efficient than DDA
DERIVATION
• Starting from the left endpoint (x0, y0) of a given line,
we step to each successive column (x position) and plot
the pixel whose scan-line y value is closest to the line
path.
• At sample positions 𝑥 𝑘 + 1 the vertical separations
from the line are labelled 𝑑 𝑢𝑝𝑝𝑒𝑟 and 𝑑𝑙𝑜𝑤𝑒𝑟
• y coordinate on the line at 𝑥 𝑘 + 1 is,
𝑦 = 𝑚 𝑥 𝑘 + 1 + 𝑏
• so,
𝑑 𝑢𝑝𝑝𝑒𝑟 = 𝑦 − 𝑦 𝑘 = 𝑚 𝑥 𝑘 + 1 + 𝑏 − 𝑦 𝑘
𝑑𝑙𝑜𝑤𝑒𝑟 = 𝑦 𝑘 + 1 − 𝑦 = 𝑦 𝑘 + 1 − 𝑚 𝑥 𝑘 + 1 + 𝑏
𝑑𝑙𝑜𝑤𝑒𝑟
𝑑 𝑢𝑝𝑝𝑒𝑟
𝑥 𝑘 + 1
𝑦 𝑘 + 1
𝑦
𝑦 𝑘
DERIVATION
• It can be used to make decision about which pixel is closer to the line
• This decision is based on the difference between the two pixel positions,
𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 = 2𝑚 𝑥 𝑘 + 1 − 2𝑦 𝑘 + 2𝑏 − 1
• By substituting 𝑚 = ∆𝑦/∆𝑥 and both are differences of end points,
∆𝑥 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 = ∆𝑥 2
∆𝑦
∆𝑥
𝑥 𝑘 + 1 − 2𝑦 𝑘 + 2𝑏 − 1
= 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 2∆𝑦 + ∆𝑥(2𝑏 − 1)
= 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 𝐶
DERIVATION
• Now, a decision parameter 𝑃𝑘 for the 𝑘th step along a line,
𝑃𝑘 = ∆𝑥 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟
= 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 𝐶
• The sign of 𝑃𝑘 is same as that of 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟
• If 𝑃𝑘 is –ve then we choose the lower pixel i.e. 𝑦 𝑘 only, otherwise we choose the upper
pixel i.e. 𝑦 𝑘 + 1
• So, for 𝑃𝑘 + 1 at step 𝑘 + 1,
𝑃𝑘+1 = 2∆𝑦. 𝑥 𝑘+1 − 2∆𝑥. 𝑦 𝑘+1 + 𝐶
• Subtracting 𝑃𝑘,
𝑃𝑘+1 − 𝑃𝑘 = 2∆𝑦(𝑥 𝑘+1 − 𝑥 𝑘) − 2∆𝑥(𝑦 𝑘+1 − 𝑦 𝑘) + 𝐶
DERIVATION
• 𝑥 𝑘+1 is same as 𝑥 𝑘 + 1 so,
𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦 − 2∆𝑥(𝑦 𝑘+1 − 𝑦 𝑘)
• Here, 𝑦 𝑘+1 − 𝑦 𝑘 is either 0 or 1 depending on the sign of 𝑃𝑘
• If 𝑃𝑘 < 0, the next point to plot is (𝑥 𝑘 + 1, 𝑦 𝑘) and new value of 𝑃 is,
𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦
• If 𝑃𝑘 > 0, the next point to plot is (𝑥 𝑘 + 1, 𝑦 𝑘 + 1) and new value of 𝑃 is,
𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦 − 2∆𝑥
• The first decision parameter 𝑃0 is evaluated at (𝑥0, 𝑦0) is,
𝑃0 = 2∆𝑦 − ∆𝑥
EXAMPLE
• End points (20,10) and (30,18)
• ∆𝑥=x2-x1 =30-20 =10
• ∆𝑦=y2-y1 =18-10 =8
• m= ∆𝑦/∆𝑥=8/10=0.8
𝑘 𝑃𝑘 (𝑥 𝑘+1, 𝑦 𝑘+1)
0 6 > 0 (21,11)
1 2 > 0 (22,12)
2 −2 < 0 (23,12)
3 14 > 0 (24,13)
4 10 > 0 (25,14)
𝑘 𝑃𝑘 (𝑥 𝑘+1, 𝑦 𝑘+1)
5 6 > 0 (26,15)
6 2 > 0 (27,16)
7 −2 < 0 (28,16)
8 14 > 0 (29,17)
9 10 > 0 (30,18)
EXAMPLE
21, 11
22, 12
23, 12
24, 13
25, 14 26, 15
27, 16
28, 16
29, 17
30, 18
10
11
12
13
14
15
16
17
18
19
20 21 22 23 24 25 26 27 28 29 30 31
ADVANTAGES
•Uses fixed points
•Easy to calculate (only addition & subtraction)
•Fast execution compare to DDA
•More accurate and efficient
DISADVANTAGES
• Drift away from actual line path
• Causes stair-case pattern
REFERENCES
•http://freefeast.info/
•http://www.expertsmind.com/
•http://www.answers.com/
THANKS A LOT….!!

More Related Content

PPTX
Dda line algorithm presentatiion
PPTX
Chapter 3 Output Primitives
PPTX
Computer graphics LINE DRAWING algorithm.pptx
PPTX
Computer graphics chapter 4
PPTX
Bresenham's line drawing algorithm
PPTX
Dda algorithm
PPT
Line drawing algo.
PPTX
BRESENHAM’S LINE DRAWING ALGORITHM
Dda line algorithm presentatiion
Chapter 3 Output Primitives
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics chapter 4
Bresenham's line drawing algorithm
Dda algorithm
Line drawing algo.
BRESENHAM’S LINE DRAWING ALGORITHM

What's hot (20)

PPTX
Composite transformation
PPTX
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
PPTX
Mid point circle algorithm
PPTX
Bresenham circle
PPT
Midpoint circle algo
PPTX
3D Transformation in Computer Graphics
PPTX
Bresenham's line algorithm
PPTX
Polygon filling algorithm
PPT
Circle drawing algo.
PPT
2D transformation (Computer Graphics)
PPTX
Line Drawing Algorithms - Computer Graphics - Notes
PDF
Computer graphics notes
PPTX
Window to Viewport Transformation in Computer Graphics with.pptx
PPT
Random and raster scan
PPTX
Mid point line Algorithm - Computer Graphics
PPT
03.Scan Conversion.ppt
PPTX
Projection In Computer Graphics
PPTX
Output primitives in Computer Graphics
PPTX
PPTX
Character Attribute in computer graphics
Composite transformation
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
Mid point circle algorithm
Bresenham circle
Midpoint circle algo
3D Transformation in Computer Graphics
Bresenham's line algorithm
Polygon filling algorithm
Circle drawing algo.
2D transformation (Computer Graphics)
Line Drawing Algorithms - Computer Graphics - Notes
Computer graphics notes
Window to Viewport Transformation in Computer Graphics with.pptx
Random and raster scan
Mid point line Algorithm - Computer Graphics
03.Scan Conversion.ppt
Projection In Computer Graphics
Output primitives in Computer Graphics
Character Attribute in computer graphics
Ad

Similar to Computer graphics - bresenham line drawing algorithm (20)

PDF
Computer Graphics Unit 2
PPTX
Output Primitive and Brenshamas Line.pptx
DOCX
Dda algo notes
PDF
Chapter 2 Computer graphics by Kushal Bhattarai
PPTX
Computer Graphics
PPT
1 linedrawing
PPT
Bresenham circles and polygons derication
PPT
Bresenham circlesandpolygons
PDF
CG08 - Bresenham’s Line Algorithm Data structure.pdf
PDF
Computer Graphics_Module 2_Output Primitives.pdf
DOC
Computer Aided Manufacturing Design
PPTX
Study on Fundamentals of Raster Scan Graphics
PDF
Computer graphics notes 2 tutorials duniya
PPT
computer_graphics_line_algorithm in Computer Graphics
PDF
Computer graphics 2
PPT
Lab lecture 2 bresenham
PPT
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
PPTX
dddddddddddddddddddddddddddddddddddddddddddddddddddddAlgorithm.pptx
PDF
Unit-2 raster scan graphics,line,circle and polygon algorithms
PDF
UNIT 4-geometry of which and line drawing.pdf
Computer Graphics Unit 2
Output Primitive and Brenshamas Line.pptx
Dda algo notes
Chapter 2 Computer graphics by Kushal Bhattarai
Computer Graphics
1 linedrawing
Bresenham circles and polygons derication
Bresenham circlesandpolygons
CG08 - Bresenham’s Line Algorithm Data structure.pdf
Computer Graphics_Module 2_Output Primitives.pdf
Computer Aided Manufacturing Design
Study on Fundamentals of Raster Scan Graphics
Computer graphics notes 2 tutorials duniya
computer_graphics_line_algorithm in Computer Graphics
Computer graphics 2
Lab lecture 2 bresenham
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
dddddddddddddddddddddddddddddddddddddddddddddddddddddAlgorithm.pptx
Unit-2 raster scan graphics,line,circle and polygon algorithms
UNIT 4-geometry of which and line drawing.pdf
Ad

More from Ruchi Maurya (7)

PPTX
SHA- Secure hashing algorithm
PDF
Java- Datagram Socket class & Datagram Packet class
PPTX
Nams- Roots of equations by numerical methods
PPTX
Types of Addressing modes- COA
PPTX
Social networking
PPTX
Random access memory
PPTX
open system interconnection
SHA- Secure hashing algorithm
Java- Datagram Socket class & Datagram Packet class
Nams- Roots of equations by numerical methods
Types of Addressing modes- COA
Social networking
Random access memory
open system interconnection

Recently uploaded (20)

PPTX
Institutional Correction lecture only . . .
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
Presentation on HIE in infants and its manifestations
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Pharma ospi slides which help in ospi learning
PDF
A systematic review of self-coping strategies used by university students to ...
Institutional Correction lecture only . . .
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
VCE English Exam - Section C Student Revision Booklet
102 student loan defaulters named and shamed – Is someone you know on the list?
STATICS OF THE RIGID BODIES Hibbelers.pdf
Anesthesia in Laparoscopic Surgery in India
Module 4: Burden of Disease Tutorial Slides S2 2025
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
GDM (1) (1).pptx small presentation for students
2.FourierTransform-ShortQuestionswithAnswers.pdf
Classroom Observation Tools for Teachers
Presentation on HIE in infants and its manifestations
202450812 BayCHI UCSC-SV 20250812 v17.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Supply Chain Operations Speaking Notes -ICLT Program
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Pharma ospi slides which help in ospi learning
A systematic review of self-coping strategies used by university students to ...

Computer graphics - bresenham line drawing algorithm

  • 3. INDEX  INTRODUCTION  DERIVATION  EXAMPLE  ADVANTAGES  DISADVANTAGES  REFERENCES
  • 4. INTRODUCTION • Raster line-generating algorithm • Developed by Bresenham • Scan conversion takes place using only incremental integer calculations • Accurate and efficient than DDA
  • 5. DERIVATION • Starting from the left endpoint (x0, y0) of a given line, we step to each successive column (x position) and plot the pixel whose scan-line y value is closest to the line path. • At sample positions 𝑥 𝑘 + 1 the vertical separations from the line are labelled 𝑑 𝑢𝑝𝑝𝑒𝑟 and 𝑑𝑙𝑜𝑤𝑒𝑟 • y coordinate on the line at 𝑥 𝑘 + 1 is, 𝑦 = 𝑚 𝑥 𝑘 + 1 + 𝑏 • so, 𝑑 𝑢𝑝𝑝𝑒𝑟 = 𝑦 − 𝑦 𝑘 = 𝑚 𝑥 𝑘 + 1 + 𝑏 − 𝑦 𝑘 𝑑𝑙𝑜𝑤𝑒𝑟 = 𝑦 𝑘 + 1 − 𝑦 = 𝑦 𝑘 + 1 − 𝑚 𝑥 𝑘 + 1 + 𝑏 𝑑𝑙𝑜𝑤𝑒𝑟 𝑑 𝑢𝑝𝑝𝑒𝑟 𝑥 𝑘 + 1 𝑦 𝑘 + 1 𝑦 𝑦 𝑘
  • 6. DERIVATION • It can be used to make decision about which pixel is closer to the line • This decision is based on the difference between the two pixel positions, 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 = 2𝑚 𝑥 𝑘 + 1 − 2𝑦 𝑘 + 2𝑏 − 1 • By substituting 𝑚 = ∆𝑦/∆𝑥 and both are differences of end points, ∆𝑥 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 = ∆𝑥 2 ∆𝑦 ∆𝑥 𝑥 𝑘 + 1 − 2𝑦 𝑘 + 2𝑏 − 1 = 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 2∆𝑦 + ∆𝑥(2𝑏 − 1) = 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 𝐶
  • 7. DERIVATION • Now, a decision parameter 𝑃𝑘 for the 𝑘th step along a line, 𝑃𝑘 = ∆𝑥 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 = 2∆𝑦. 𝑥 𝑘 − 2∆𝑥. 𝑦 𝑘 + 𝐶 • The sign of 𝑃𝑘 is same as that of 𝑑 𝑢𝑝𝑝𝑒𝑟 − 𝑑𝑙𝑜𝑤𝑒𝑟 • If 𝑃𝑘 is –ve then we choose the lower pixel i.e. 𝑦 𝑘 only, otherwise we choose the upper pixel i.e. 𝑦 𝑘 + 1 • So, for 𝑃𝑘 + 1 at step 𝑘 + 1, 𝑃𝑘+1 = 2∆𝑦. 𝑥 𝑘+1 − 2∆𝑥. 𝑦 𝑘+1 + 𝐶 • Subtracting 𝑃𝑘, 𝑃𝑘+1 − 𝑃𝑘 = 2∆𝑦(𝑥 𝑘+1 − 𝑥 𝑘) − 2∆𝑥(𝑦 𝑘+1 − 𝑦 𝑘) + 𝐶
  • 8. DERIVATION • 𝑥 𝑘+1 is same as 𝑥 𝑘 + 1 so, 𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦 − 2∆𝑥(𝑦 𝑘+1 − 𝑦 𝑘) • Here, 𝑦 𝑘+1 − 𝑦 𝑘 is either 0 or 1 depending on the sign of 𝑃𝑘 • If 𝑃𝑘 < 0, the next point to plot is (𝑥 𝑘 + 1, 𝑦 𝑘) and new value of 𝑃 is, 𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦 • If 𝑃𝑘 > 0, the next point to plot is (𝑥 𝑘 + 1, 𝑦 𝑘 + 1) and new value of 𝑃 is, 𝑃𝑘+1 = 𝑃𝑘 + 2∆𝑦 − 2∆𝑥 • The first decision parameter 𝑃0 is evaluated at (𝑥0, 𝑦0) is, 𝑃0 = 2∆𝑦 − ∆𝑥
  • 9. EXAMPLE • End points (20,10) and (30,18) • ∆𝑥=x2-x1 =30-20 =10 • ∆𝑦=y2-y1 =18-10 =8 • m= ∆𝑦/∆𝑥=8/10=0.8 𝑘 𝑃𝑘 (𝑥 𝑘+1, 𝑦 𝑘+1) 0 6 > 0 (21,11) 1 2 > 0 (22,12) 2 −2 < 0 (23,12) 3 14 > 0 (24,13) 4 10 > 0 (25,14) 𝑘 𝑃𝑘 (𝑥 𝑘+1, 𝑦 𝑘+1) 5 6 > 0 (26,15) 6 2 > 0 (27,16) 7 −2 < 0 (28,16) 8 14 > 0 (29,17) 9 10 > 0 (30,18)
  • 10. EXAMPLE 21, 11 22, 12 23, 12 24, 13 25, 14 26, 15 27, 16 28, 16 29, 17 30, 18 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  • 11. ADVANTAGES •Uses fixed points •Easy to calculate (only addition & subtraction) •Fast execution compare to DDA •More accurate and efficient
  • 12. DISADVANTAGES • Drift away from actual line path • Causes stair-case pattern