SlideShare a Scribd company logo
DDA Line Drawing
Algorithm
Muhammad Hamza
157101
Bioinformatics 7th
Graphics andVisualization
Presented to: Sir Muhammad Rizwan
Govt Post Graduate College Mandian
Abbottabad
Talk Sequence:
• What is Line
• Line Equation
• Slope of Line
• Examples of Drawing Line
• DDA
DDA Line Drawing Algorithm
• DDA stands for Digital Differential Analyzer
• A line drawing algorithm is a graphical algorithm for approximating a line
segment on discrete graphical media.
• This algorithm is used to draw a line on computer pixels.
What is a Line?
• A line in Computer graphics typically refers to line segment, which is a
portion of straight line that extends indefinitely in opposite direction.
• It is defined by its two end points & the slope intercept equation for a line:
y = mx + b
where, m = Slope of the line
b = the y intercept of a line
• The two endpoints of a line segment are specified at positions (x1,y1) and
(x2,y2).
Slope Conditions for Algorithms
• 1. ∆ y/ ∆ x > 1 when 0 >45
• 2. ∆ y/ ∆ x < 1 when 0 <45
• 3. ∆ y /∆ x = 1 when 0 =45
1
2
3
9
8
7
6
5
4
3
2
1
(x1,y1)(x2,y2)
(2,2) (9,2)
∆ x=9-2=7
∆ y=2-2=0
m= ∆ y/ ∆ x=0/7=0
xinc=7/7=1
yinc=0/7=0
X Y
2 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
1 2 3 4 5 6 7 8 9 10
For Horizontal line
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10
(x1,y1)(x2,y2)
(2,2) (9,2)
∆ x=9-2=7
∆ y=2-2=0
m= ∆ y/ ∆ x=0/7=0
xinc=7/7=1
yinc=0/7=0
X Y
2 2
3 2
4 2
5 2
6 2
7 2
8 2
9 2
For Horizontal line
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10
(x1,y1)(x2,y2)
(2,3) (2,8)
∆ x=2-2=0
∆ y=8-2=6
m= ∆ y/ ∆ x=6/0=∞
xinc=0/6=0
yinc=6/6=1
X Y
2 3
2 4
2 5
2 6
2 7
2 8
For Vertical line
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10
(x1,y1)(x2,y2)
(2,3) (2,8)
∆ x=2-2=0
∆ y=8-2=6
m= ∆ y/ ∆ x=6/0=∞
xinc=0/6=0
yinc=6/6=1
X Y
2 3
2 4
2 5
2 6
2 7
2 8
For Vertical line
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10
(x1,y1)(x2,y2)
(1,2) (9,5)
∆ x=9-1=8
∆ y=5-2=3
m= ∆ y/ ∆ x=3/8=0.37
xinc=8/8=1
yinc=3/8=0.37
X Y
1 2
2 2.37=2
3 2.74=3
4 3.11=3
5 3.48=3
6 3.85=4
7 4.22=4
8 4.59=5
9 4.96=5
For any Diagonal line
9
8
7
6
5
4
3
2
1
1 2 3 4 5 6 7 8 9 10
(x1,y1)(x2,y2)
(1,2) (9,5)
∆ x=9-1=8
∆ y=5-2=3
m= ∆ y/ ∆ x=3/8=0.37
xinc=8/8=1
yinc=3/8=0.37
X Y
1 2
2 2.37=2
3 2.74=3
4 3.11=3
5 3.48=3
6 3.85=4
7 4.22=4
8 4.59=5
9 4.96=5
For any Diagnal line
DDA Algorithm
dx-=x2-x1;
dy=y2-y1;
If(abs(dx) > abs(dy))
Steps=abs(dx);
else
Steps=abs(dy);
xinc=dx/steps;
yinc=dy/steps;
For(i-1, i<=step, i++)
{
putpixel(x1,y1);
x1=x1+xinc;
y1=y1+yinc;
}
Limitation
• There are no decimal points in coordinate system
• Time consuming because algorithm may generate floating numbers
• Line generated will not be smooth.
References:
• https://www.tutorialspoint.com/computer_graphics/line_generation_algorit
hm.htm
• http://personales.unican.es/iglesias
• https://www.geeksforgeeks.org/dda-line-generation-algorithm
• https://www.tutorialspoint.com/.../line_generation_algorithm.htm
• www.codingalpha.com/dda-line-drawing-algorithm-c-program

More Related Content

What's hot

Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
Vivek Kumar Sinha
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
Vivek Kumar Sinha
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
Mani Kanth
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
2013901097
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
Ankit Kumar
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
PrathimaBaliga
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
Muhammed Afsal Villan
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
RobinAhmedSaikat
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
Ruchi Maurya
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
Ankit Garg
 
2.2. interactive computer graphics
2.2. interactive computer graphics2.2. interactive computer graphics
2.2. interactive computer graphics
Ratnadeepsinh Jadeja
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.Mohd Arif
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Ankit Garg
 

What's hot (20)

Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
COMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUALCOMPUTER GRAPHICS LAB MANUAL
COMPUTER GRAPHICS LAB MANUAL
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
Computer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and EllipseComputer Graphic - Lines, Circles and Ellipse
Computer Graphic - Lines, Circles and Ellipse
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
2.2. interactive computer graphics
2.2. interactive computer graphics2.2. interactive computer graphics
2.2. interactive computer graphics
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Ellipses drawing algo.
Ellipses drawing algo.Ellipses drawing algo.
Ellipses drawing algo.
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 

Similar to Dda line algorithm presentatiion

Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
Marwa Al-Rikaby
 
Study on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan GraphicsStudy on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan Graphics
Chandrakant Divate
 
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
ijiert bestjournal
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
AOUNHAIDER7
 
Rasterization.pptx
Rasterization.pptxRasterization.pptx
Rasterization.pptx
AhmadAbba6
 
Figure Eight Curve
Figure Eight CurveFigure Eight Curve
Figure Eight Curve
naifang
 
Eight Curve Final
Eight  Curve  FinalEight  Curve  Final
Eight Curve Final
johnnychang2010
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Mattupallipardhu
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
ssuser255bf1
 
UNIT-II
UNIT-IIUNIT-II
Lline Drawing Algorithm
Lline Drawing AlgorithmLline Drawing Algorithm
Lline Drawing Algorithm
nehrurevathy
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
IndhuMcamphil
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
Alamelu
 
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
Alex (Oleksiy) Varfolomiyev
 
Calculus 45S Slides May 14, 2008
Calculus 45S Slides May 14, 2008Calculus 45S Slides May 14, 2008
Calculus 45S Slides May 14, 2008
Darren Kuropatwa
 
2_1 Edit Distance.pptx
2_1 Edit Distance.pptx2_1 Edit Distance.pptx
2_1 Edit Distance.pptx
tanishamahajan11
 
1-0b-Ch-1-Rev.ppt
1-0b-Ch-1-Rev.ppt1-0b-Ch-1-Rev.ppt
1-0b-Ch-1-Rev.ppt
SubramaniN12
 
Eight Curve[1][1]
Eight  Curve[1][1]Eight  Curve[1][1]
Eight Curve[1][1]
johnnychang2010
 

Similar to Dda line algorithm presentatiion (20)

Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
 
Study on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan GraphicsStudy on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan Graphics
 
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
SINGLE‐PHASE TO THREE‐PHASE DRIVE SYSTEM USING TWO PARALLEL SINGLE‐PHASE RECT...
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
 
Rasterization.pptx
Rasterization.pptxRasterization.pptx
Rasterization.pptx
 
Figure Eight Curve
Figure Eight CurveFigure Eight Curve
Figure Eight Curve
 
Eight Curve Final
Eight  Curve  FinalEight  Curve  Final
Eight Curve Final
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
 
UNIT-II
UNIT-IIUNIT-II
UNIT-II
 
paper
paperpaper
paper
 
Lline Drawing Algorithm
Lline Drawing AlgorithmLline Drawing Algorithm
Lline Drawing Algorithm
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
A non-stiff numerical method for 3D interfacial flow of inviscid fluids.
 
Calculus 45S Slides May 14, 2008
Calculus 45S Slides May 14, 2008Calculus 45S Slides May 14, 2008
Calculus 45S Slides May 14, 2008
 
2_1 Edit Distance.pptx
2_1 Edit Distance.pptx2_1 Edit Distance.pptx
2_1 Edit Distance.pptx
 
1-0b-Ch-1-Rev.ppt
1-0b-Ch-1-Rev.ppt1-0b-Ch-1-Rev.ppt
1-0b-Ch-1-Rev.ppt
 
Eight Curve[1][1]
Eight  Curve[1][1]Eight  Curve[1][1]
Eight Curve[1][1]
 

Recently uploaded

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

Dda line algorithm presentatiion

  • 1. DDA Line Drawing Algorithm Muhammad Hamza 157101 Bioinformatics 7th Graphics andVisualization Presented to: Sir Muhammad Rizwan Govt Post Graduate College Mandian Abbottabad
  • 2. Talk Sequence: • What is Line • Line Equation • Slope of Line • Examples of Drawing Line • DDA
  • 3. DDA Line Drawing Algorithm • DDA stands for Digital Differential Analyzer • A line drawing algorithm is a graphical algorithm for approximating a line segment on discrete graphical media. • This algorithm is used to draw a line on computer pixels.
  • 4. What is a Line? • A line in Computer graphics typically refers to line segment, which is a portion of straight line that extends indefinitely in opposite direction. • It is defined by its two end points & the slope intercept equation for a line: y = mx + b where, m = Slope of the line b = the y intercept of a line
  • 5. • The two endpoints of a line segment are specified at positions (x1,y1) and (x2,y2).
  • 6. Slope Conditions for Algorithms • 1. ∆ y/ ∆ x > 1 when 0 >45 • 2. ∆ y/ ∆ x < 1 when 0 <45 • 3. ∆ y /∆ x = 1 when 0 =45 1 2 3
  • 7. 9 8 7 6 5 4 3 2 1 (x1,y1)(x2,y2) (2,2) (9,2) ∆ x=9-2=7 ∆ y=2-2=0 m= ∆ y/ ∆ x=0/7=0 xinc=7/7=1 yinc=0/7=0 X Y 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 1 2 3 4 5 6 7 8 9 10 For Horizontal line
  • 8. 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 (x1,y1)(x2,y2) (2,2) (9,2) ∆ x=9-2=7 ∆ y=2-2=0 m= ∆ y/ ∆ x=0/7=0 xinc=7/7=1 yinc=0/7=0 X Y 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 2 For Horizontal line
  • 9. 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 (x1,y1)(x2,y2) (2,3) (2,8) ∆ x=2-2=0 ∆ y=8-2=6 m= ∆ y/ ∆ x=6/0=∞ xinc=0/6=0 yinc=6/6=1 X Y 2 3 2 4 2 5 2 6 2 7 2 8 For Vertical line
  • 10. 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 (x1,y1)(x2,y2) (2,3) (2,8) ∆ x=2-2=0 ∆ y=8-2=6 m= ∆ y/ ∆ x=6/0=∞ xinc=0/6=0 yinc=6/6=1 X Y 2 3 2 4 2 5 2 6 2 7 2 8 For Vertical line
  • 11. 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 (x1,y1)(x2,y2) (1,2) (9,5) ∆ x=9-1=8 ∆ y=5-2=3 m= ∆ y/ ∆ x=3/8=0.37 xinc=8/8=1 yinc=3/8=0.37 X Y 1 2 2 2.37=2 3 2.74=3 4 3.11=3 5 3.48=3 6 3.85=4 7 4.22=4 8 4.59=5 9 4.96=5 For any Diagonal line
  • 12. 9 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8 9 10 (x1,y1)(x2,y2) (1,2) (9,5) ∆ x=9-1=8 ∆ y=5-2=3 m= ∆ y/ ∆ x=3/8=0.37 xinc=8/8=1 yinc=3/8=0.37 X Y 1 2 2 2.37=2 3 2.74=3 4 3.11=3 5 3.48=3 6 3.85=4 7 4.22=4 8 4.59=5 9 4.96=5 For any Diagnal line
  • 13. DDA Algorithm dx-=x2-x1; dy=y2-y1; If(abs(dx) > abs(dy)) Steps=abs(dx); else Steps=abs(dy); xinc=dx/steps; yinc=dy/steps; For(i-1, i<=step, i++) { putpixel(x1,y1); x1=x1+xinc; y1=y1+yinc; }
  • 14. Limitation • There are no decimal points in coordinate system • Time consuming because algorithm may generate floating numbers • Line generated will not be smooth.
  • 15. References: • https://www.tutorialspoint.com/computer_graphics/line_generation_algorit hm.htm • http://personales.unican.es/iglesias • https://www.geeksforgeeks.org/dda-line-generation-algorithm • https://www.tutorialspoint.com/.../line_generation_algorithm.htm • www.codingalpha.com/dda-line-drawing-algorithm-c-program