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

What's hot

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
Β 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
Β 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithmMani Kanth
Β 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
Β 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.Mohd Arif
Β 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithmPooja Dixit
Β 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniquesMani Kanth
Β 
Spline representations
Spline representationsSpline representations
Spline representationsNikhil krishnan
Β 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmMrinmoy Dalal
Β 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsNanhen Verma
Β 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithmMani Kanth
Β 
Clipping
ClippingClipping
ClippingMohd Arif
Β 
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm Aparna Joshi
Β 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitivesvinay arora
Β 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projectionPooja Dixit
Β 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNANDINI SHARMA
Β 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)shalinikarunakaran1
Β 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLahiru Danushka
Β 

What's hot (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...
Β 
Clipping
ClippingClipping
Clipping
Β 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
Β 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
Β 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
Β 
Bresenham's line algo.
Bresenham's line algo.Bresenham's line algo.
Bresenham's line algo.
Β 
Bresenham's line algorithm
Bresenham's line algorithmBresenham's line algorithm
Bresenham's line algorithm
Β 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
Β 
Spline representations
Spline representationsSpline representations
Spline representations
Β 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
Β 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Β 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
Β 
Clipping
ClippingClipping
Clipping
Β 
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
Β 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
Β 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
Β 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
Β 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
Β 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
Β 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Β 

Similar to Computer graphics - bresenham line drawing algorithm

Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsAmol Gaikwad
Β 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
Β 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi54MahakBansal
Β 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic  matlab  uygulamalar ali abdullahnumericai matmatic  matlab  uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullahAli Abdullah
Β 
Linear regression, costs & gradient descent
Linear regression, costs & gradient descentLinear regression, costs & gradient descent
Linear regression, costs & gradient descentRevanth Kumar
Β 
DIFFERENTAL CALCULUS DERIVATIVES FIRST PART
DIFFERENTAL CALCULUS DERIVATIVES FIRST PARTDIFFERENTAL CALCULUS DERIVATIVES FIRST PART
DIFFERENTAL CALCULUS DERIVATIVES FIRST PARTteacherlablidas
Β 
GraphTransformations.pptx
GraphTransformations.pptxGraphTransformations.pptx
GraphTransformations.pptxSrideviNagarjuna
Β 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygonsaa11bb11
Β 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
Β 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq Bahtiar
Β 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2SanthiNivas
Β 
07-Convolution.pptx signal spectra and signal processing
07-Convolution.pptx signal spectra and signal processing07-Convolution.pptx signal spectra and signal processing
07-Convolution.pptx signal spectra and signal processingJordanJohmMallillin
Β 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
Β 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdfMattupallipardhu
Β 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxKokebe2
Β 
The derivatives module03
The derivatives module03The derivatives module03
The derivatives module03REYEMMANUELILUMBA
Β 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
Β 

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

Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
Β 
CG-Lecture3.pptx
CG-Lecture3.pptxCG-Lecture3.pptx
CG-Lecture3.pptx
Β 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Β 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
Β 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic  matlab  uygulamalar ali abdullahnumericai matmatic  matlab  uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullah
Β 
Linear regression, costs & gradient descent
Linear regression, costs & gradient descentLinear regression, costs & gradient descent
Linear regression, costs & gradient descent
Β 
DIFFERENTAL CALCULUS DERIVATIVES FIRST PART
DIFFERENTAL CALCULUS DERIVATIVES FIRST PARTDIFFERENTAL CALCULUS DERIVATIVES FIRST PART
DIFFERENTAL CALCULUS DERIVATIVES FIRST PART
Β 
GraphTransformations.pptx
GraphTransformations.pptxGraphTransformations.pptx
GraphTransformations.pptx
Β 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
Β 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
Β 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
Β 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
Β 
07-Convolution.pptx signal spectra and signal processing
07-Convolution.pptx signal spectra and signal processing07-Convolution.pptx signal spectra and signal processing
07-Convolution.pptx signal spectra and signal processing
Β 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
Β 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
Β 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Β 
Cs580
Cs580Cs580
Cs580
Β 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
Β 
The derivatives module03
The derivatives module03The derivatives module03
The derivatives module03
Β 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
Β 

More from Ruchi Maurya

SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithmRuchi Maurya
Β 
Java- Datagram Socket class & Datagram Packet class
Java- Datagram Socket class  & Datagram Packet classJava- Datagram Socket class  & Datagram Packet class
Java- Datagram Socket class & Datagram Packet classRuchi Maurya
Β 
Nams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsNams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsRuchi Maurya
Β 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COARuchi Maurya
Β 
Social networking
Social networkingSocial networking
Social networkingRuchi Maurya
Β 
Random access memory
Random access memoryRandom access memory
Random access memoryRuchi Maurya
Β 
open system interconnection
open system interconnectionopen system interconnection
open system interconnectionRuchi Maurya
Β 

More from Ruchi Maurya (7)

SHA- Secure hashing algorithm
SHA- Secure hashing algorithmSHA- Secure hashing algorithm
SHA- Secure hashing algorithm
Β 
Java- Datagram Socket class & Datagram Packet class
Java- Datagram Socket class  & Datagram Packet classJava- Datagram Socket class  & Datagram Packet class
Java- Datagram Socket class & Datagram Packet class
Β 
Nams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsNams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methods
Β 
Types of Addressing modes- COA
Types of Addressing modes- COATypes of Addressing modes- COA
Types of Addressing modes- COA
Β 
Social networking
Social networkingSocial networking
Social networking
Β 
Random access memory
Random access memoryRandom access memory
Random access memory
Β 
open system interconnection
open system interconnectionopen system interconnection
open system interconnection
Β 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdfssuser54595a
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
Β 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
Β 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Β 
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
Β 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
Β 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
Β 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
Β 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
Β 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
Β 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
Β 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Β 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
Β 
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Tilak Nagar Delhi reach out to us at πŸ”9953056974πŸ”
Β 
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
β€œOh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
Β 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
Β 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
Β 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Β 
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Β 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Β 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
Β 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
Β 

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