SlideShare a Scribd company logo
1 of 20
1.Input the two endpoints of the line segment, (x1,y1) and (x2,y2).
2.Calculate the difference between the x-coordinates and
y-coordinates of the endpoints as dx and dy respectively.
Calculate the slope of the line as m = dy/dx.
3.Set the initial point of the line as (x1,y1).
4.Loop through the x-coordinates of the line, incrementing by one
each time, and calculate the corresponding y-coordinate using the
equation y = y1 + m(x – x1).
5.Plot the pixel at the calculated (x,y) coordinate.
6.Repeat steps 5 and 6 until the endpoint (x2,y2) is reached.
1. DDAAlgorithm-
DDAAlgorithm is the simplest line drawing algorithm.
Procedure-
Given-
Starting coordinates = (X0, Y0)
Ending coordinates = (Xn, Yn)
The point’s generation using DDAAlgorithm involves the
following steps-
Step-01:
Calculate ΔX, ΔY and M from the given input.
These parameters are calculated as-
ΔX = Xn – X0
ΔY =Yn – Y0
M = ΔY / ΔX
Step-02:
Find the number of steps or points in between the starting
and ending coordinates.
if (absolute (ΔX) > absolute (ΔY))
Steps = absolute (ΔX);
Else
Steps = absolute (ΔY);
Step-03:
Suppose the current point is (Xp, Yp) and the next
point is (Xp+1, Yp+1).
Find the next point by following the below three cases-
Step-04:
Keep repeating Step-03 until the end point is reached or
the number of generated new points (including the
starting and ending points) equals to the steps count.
Problem- 01:
Calculate the points between the starting point (5, 6)
and ending point (8, 12).
Solution-
Given-
Starting coordinates = (X0, Y0) = (5, 6)
Ending coordinates = (Xn, Yn) = (8, 12)
Step-01:
Calculate ΔX, ΔY and M from the given input.
ΔX = Xn – X0 = 8 – 5 = 3
ΔY =Yn – Y0 = 12 – 6 = 6
M = ΔY / ΔX = 6 / 3 = 2
Step-02:
Calculate the number of steps.
As |ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6
Step-03:
As M > 1, so case-03 is satisfied.
Now, Step-03 is executed until Step-04 is satisfied.
Advantages of DDAAlgorithm
1. It is a simple algorithm.
2. It is easy to implement.
3. It avoids using the multiplication operation which is costly in
terms of time complexity.
Disadvantages of DDAAlgorithm-
1. There is an extra overhead of using round off ( ) function.
2. Using round off ( ) function increases time complexity of the
algorithm.
3. Resulted lines are not smooth because of round off ( ) function.
4. The points generated by this algorithm are not accurate.
Bresenham Line Drawing Algorithm-
Procedure:
Given
Starting coordinates = (X0, Y0)
Ending coordinates = (Xn, Yn)
The point’s generation using Bresenham Line Drawing Algorithm
involves the following steps-
Step-01:
Calculate ΔX and ΔY from the given input.
These parameters are calculated as-
ΔX = Xn – X0
ΔY =Yn – Y0
Step-02:
Calculate the decision parameter Pk.
It is calculated as-
Pk = 2ΔY – ΔX
Step-03:
Suppose the current point is (Xk, Yk) and the next
point is (Xk+1, Yk+1).
Find the next point depending on the value of decision
parameter Pk.
Follow the below two cases
Step-04:
Keep repeating Step-03 until the end point is reached or
number of iterations equals to (ΔX-1) times.
Problem-01:
Calculate the points between the starting coordinates (9, 18)
and ending coordinates (14, 22).
Solution-
Given-
Starting coordinates = (X0, Y0) = (9, 18)
Ending coordinates = (Xn, Yn) = (14, 22)
Step-01:
Calculate ΔX and ΔY from the given input.
ΔX = Xn – X0 = 14 – 9 = 5
ΔY =Yn – Y0 = 22 – 18 = 4
Step-02:
Calculate the decision parameter.
Pk = 2ΔY – ΔX
= 2 x 4 – 5 = 3
So, decision parameter Pk = 3
Step-03:
As Pk >= 0, so case-02 is satisfied.
Thus,
Pk+1 = Pk + 2ΔY – 2ΔX = 3 + (2 x 4) – (2 x 5) = 1
Xk+1 = Xk + 1 = 9 + 1 = 10
Yk+1 = Yk + 1 = 18 + 1 = 19
Similarly, Step-03 is executed until the end point is reached or number of
iterations equals to 4 times.
(Number of iterations = ΔX – 1 = 5 – 1 = 4)
Advantages of Bresenham Line Drawing Algorithm-
The advantages of Bresenham Line Drawing Algorithm are-
 It is easy to implement.
 It is fast and incremental.
 It executes fast but less fast than DDAAlgorithm.
 The points generated by this algorithm are more accurate
than DDAAlgorithm.
 It uses fixed points only.
Disadvantages of Bresenham Line Drawing Algorithm-
The disadvantages of Bresenham Line Drawing Algorithm are-
 Though it improves the accuracy of generated points but
still the resulted line is not smooth.
 This algorithm is for the basic line drawing.
 It cannot handle diminishing jaggies.

More Related Content

Similar to dddddddddddddddddddddddddddddddddddddddddddddddddddddAlgorithm.pptx

DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx
DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptxDDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx
DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptxhasibulhamim1
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxKokebe2
 
Working principle of dda and bresenham line drawing explaination with example
Working principle of dda and bresenham line drawing explaination with exampleWorking principle of dda and bresenham line drawing explaination with example
Working principle of dda and bresenham line drawing explaination with exampleAashish Adhikari
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxNaveenaKarthik3
 
Line drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdfLine drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdfRAJARATNAS
 
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.pptLecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.pptKhondokarMdMehediHas
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesAnkit Garg
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi54MahakBansal
 
Unit 2
Unit 2Unit 2
Unit 2ypnrao
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
cgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfcgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfmeenasp
 
Rasterization.pptx
Rasterization.pptxRasterization.pptx
Rasterization.pptxAhmadAbba6
 

Similar to dddddddddddddddddddddddddddddddddddddddddddddddddddddAlgorithm.pptx (20)

DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx
DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptxDDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx
DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
Algorithm.pptx
Algorithm.pptxAlgorithm.pptx
Algorithm.pptx
 
Working principle of dda and bresenham line drawing explaination with example
Working principle of dda and bresenham line drawing explaination with exampleWorking principle of dda and bresenham line drawing explaination with example
Working principle of dda and bresenham line drawing explaination with example
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
 
Line drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdfLine drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdf
 
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.pptLecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
Lecture-4-Scan_Conversion_Bresenhams_Algorithm.ppt
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
 
Unit 2
Unit 2Unit 2
Unit 2
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
99995320.ppt
99995320.ppt99995320.ppt
99995320.ppt
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
cgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfcgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdf
 
Rasterization.pptx
Rasterization.pptxRasterization.pptx
Rasterization.pptx
 

Recently uploaded

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
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
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
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
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
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
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
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
 

Recently uploaded (20)

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.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, ...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
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...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
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
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
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
 

dddddddddddddddddddddddddddddddddddddddddddddddddddddAlgorithm.pptx

  • 1.
  • 2. 1.Input the two endpoints of the line segment, (x1,y1) and (x2,y2). 2.Calculate the difference between the x-coordinates and y-coordinates of the endpoints as dx and dy respectively. Calculate the slope of the line as m = dy/dx. 3.Set the initial point of the line as (x1,y1). 4.Loop through the x-coordinates of the line, incrementing by one each time, and calculate the corresponding y-coordinate using the equation y = y1 + m(x – x1). 5.Plot the pixel at the calculated (x,y) coordinate. 6.Repeat steps 5 and 6 until the endpoint (x2,y2) is reached.
  • 3. 1. DDAAlgorithm- DDAAlgorithm is the simplest line drawing algorithm. Procedure- Given- Starting coordinates = (X0, Y0) Ending coordinates = (Xn, Yn) The point’s generation using DDAAlgorithm involves the following steps-
  • 4. Step-01: Calculate ΔX, ΔY and M from the given input. These parameters are calculated as- ΔX = Xn – X0 ΔY =Yn – Y0 M = ΔY / ΔX
  • 5. Step-02: Find the number of steps or points in between the starting and ending coordinates. if (absolute (ΔX) > absolute (ΔY)) Steps = absolute (ΔX); Else Steps = absolute (ΔY);
  • 6. Step-03: Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1). Find the next point by following the below three cases- Step-04: Keep repeating Step-03 until the end point is reached or the number of generated new points (including the starting and ending points) equals to the steps count.
  • 7.
  • 8. Problem- 01: Calculate the points between the starting point (5, 6) and ending point (8, 12). Solution- Given- Starting coordinates = (X0, Y0) = (5, 6) Ending coordinates = (Xn, Yn) = (8, 12)
  • 9. Step-01: Calculate ΔX, ΔY and M from the given input. ΔX = Xn – X0 = 8 – 5 = 3 ΔY =Yn – Y0 = 12 – 6 = 6 M = ΔY / ΔX = 6 / 3 = 2 Step-02: Calculate the number of steps. As |ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6 Step-03: As M > 1, so case-03 is satisfied. Now, Step-03 is executed until Step-04 is satisfied.
  • 10.
  • 11.
  • 12. Advantages of DDAAlgorithm 1. It is a simple algorithm. 2. It is easy to implement. 3. It avoids using the multiplication operation which is costly in terms of time complexity. Disadvantages of DDAAlgorithm- 1. There is an extra overhead of using round off ( ) function. 2. Using round off ( ) function increases time complexity of the algorithm. 3. Resulted lines are not smooth because of round off ( ) function. 4. The points generated by this algorithm are not accurate.
  • 13. Bresenham Line Drawing Algorithm- Procedure: Given Starting coordinates = (X0, Y0) Ending coordinates = (Xn, Yn) The point’s generation using Bresenham Line Drawing Algorithm involves the following steps- Step-01: Calculate ΔX and ΔY from the given input. These parameters are calculated as- ΔX = Xn – X0 ΔY =Yn – Y0
  • 14. Step-02: Calculate the decision parameter Pk. It is calculated as- Pk = 2ΔY – ΔX Step-03: Suppose the current point is (Xk, Yk) and the next point is (Xk+1, Yk+1). Find the next point depending on the value of decision parameter Pk. Follow the below two cases
  • 15. Step-04: Keep repeating Step-03 until the end point is reached or number of iterations equals to (ΔX-1) times.
  • 16. Problem-01: Calculate the points between the starting coordinates (9, 18) and ending coordinates (14, 22). Solution- Given- Starting coordinates = (X0, Y0) = (9, 18) Ending coordinates = (Xn, Yn) = (14, 22) Step-01: Calculate ΔX and ΔY from the given input. ΔX = Xn – X0 = 14 – 9 = 5 ΔY =Yn – Y0 = 22 – 18 = 4
  • 17. Step-02: Calculate the decision parameter. Pk = 2ΔY – ΔX = 2 x 4 – 5 = 3 So, decision parameter Pk = 3 Step-03: As Pk >= 0, so case-02 is satisfied. Thus, Pk+1 = Pk + 2ΔY – 2ΔX = 3 + (2 x 4) – (2 x 5) = 1 Xk+1 = Xk + 1 = 9 + 1 = 10 Yk+1 = Yk + 1 = 18 + 1 = 19 Similarly, Step-03 is executed until the end point is reached or number of iterations equals to 4 times. (Number of iterations = ΔX – 1 = 5 – 1 = 4)
  • 18.
  • 19.
  • 20. Advantages of Bresenham Line Drawing Algorithm- The advantages of Bresenham Line Drawing Algorithm are-  It is easy to implement.  It is fast and incremental.  It executes fast but less fast than DDAAlgorithm.  The points generated by this algorithm are more accurate than DDAAlgorithm.  It uses fixed points only. Disadvantages of Bresenham Line Drawing Algorithm- The disadvantages of Bresenham Line Drawing Algorithm are-  Though it improves the accuracy of generated points but still the resulted line is not smooth.  This algorithm is for the basic line drawing.  It cannot handle diminishing jaggies.