SlideShare a Scribd company logo
SUBJECT : COMPUTER AIDED DESIGN
(2161903 )
Gandhinagar Institute of
Technology
Active Learning assignment on:-
“Digital Differential Analyzer (DDA)
Algorithm ”
Prepared by:- Patel Yash (150123119039)
Introduction
In computer graphics, a digital differential analyzer
(DDA) is hardware or software used for interpolation of
variables over an interval between start and end point.
DDAs are used for rasterization of lines, triangles and
polygons. They can be extended to non linear functions,
such as perspective correct texture mapping, quadratic
curves, and traversing voxels.
The DDA method can be implemented using floating-
point or integer arithmetic. The native floating-point
implementation requires one addition and one rounding
operation per interpolated value (e.g. coordinate x, y,
depth, color component etc.) and output result.
This process is only efficient when an FPU with fast
add and rounding operation will be available.
The fixed-point integer operation requires two additions
per output cycle, and in case of fractional part overflow,
one additional increment and subtraction. The probability
of fractional part overflows is proportional to the ratio m
of the interpolated start/end values.
DDAs are well suited for hardware implementation and
can be pipelined for maximized throughput.
Digital Differential Analyzer (DDA): Line
Drawing Algorithm
Walk through the line, starting at (x0,y0)
Constrain x, y increments to values in [0,1] range
Case a: x is incrementing faster (m < 1)
Step in x=1 increments, compute and round y
Case b: y is incrementing faster (m > 1)
Step in y=1 increments, compute and round x
(x0,y0)
(x1,y1)
dx
dy
DDA Line Drawing Algorithm (Case a: m < 1)
x = x0 y = y0x = x0 y = y0
Illuminate pixel (x,
round(y)
x = x0 + 1 y = y0 + 1 * m
Illuminate pixel (x,
round(y))x = x + 1 y = y + 1 * m
Illuminate pixel (x,
round(y))
Until x == x1
(x0, y0)
DDA Line Drawing Algorithm (Case b: m > 1)
y = y0 + 1 x = x0 + 1 * 1/m
Illuminate pixel (round(x), y)
y = y + 1 x = x + 1 /m
Illuminate pixel (round(x), y)
…
Until y == y1
x = x0 y = y0
Illuminate pixel (round(x), y)
(x1,y1)
(x0,y0)
DDA Line Drawing Algorithm Pseudocode
compute m;
if m < 1:
{
float y = y0; // initial value
for(int x = x0;x <= x1; x++, y += m)
setPixel(x, round(y));
}
else // m > 1
{
float x = x0; // initial value
for(int y = y0;y <= y1; y++, x += 1/m)
setPixel(round(x), y);
}
Note: setPixel(x, y) writes current color into pixel in column x and row y in frame buffer
DDA Line Drawing Algorithm Pseudocode
compute m;
if m < 1:
{
float y = y0; // initial value
for(int x = x0;x <= x1; x++, y += m)
setPixel(x, round(y));
}
else // m > 1
{
float x = x0; // initial value
for(int y = y0;y <= y1; y++, x += 1/m)
setPixel(round(x), y);
}
Note: setPixel(x, y) writes current color into pixel in column x and row y in frame buffer
Line Drawing Algorithm Drawbacks
DDA is the simplest line drawing algorithm
Not very efficient
Round operation is expensive
Optimized algorithms typically used.
Integer DDA
E.g.Bresenham algorithm (Hill, 10.4.1)
Bresenham algorithm
Incremental algorithm: current value uses previous
value
Integers only: avoid floating point arithmetic
Several versions of algorithm: we’ll describe midpoint
version of algorithm
DDA algorithm
Ad

More Related Content

What's hot (20)

Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
Mohd Arif
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
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
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
SHIVANI SONI
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
Udayan Gupta
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
Mrinmoy Dalal
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
Aparna Joshi
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
Arvind Kumar
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
MehulMunshi3
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
Mani Kanth
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 
Bezier curve computer graphics
Bezier curve computer graphics Bezier curve computer graphics
Bezier curve computer graphics
University of Potsdam
 
2d-transformation
2d-transformation2d-transformation
2d-transformation
Pooja Dixit
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
University of Potsdam
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)
AditiPatni3
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
nehrurevathy
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
Mohd Arif
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
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
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
SHIVANI SONI
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
Udayan Gupta
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
Mrinmoy Dalal
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
Arvind Kumar
 
Mid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer GraphicsMid point line Algorithm - Computer Graphics
Mid point line Algorithm - Computer Graphics
Drishti Bhalla
 
mid point algorithm.pdf
mid point algorithm.pdfmid point algorithm.pdf
mid point algorithm.pdf
MehulMunshi3
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
Mani Kanth
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 
2d-transformation
2d-transformation2d-transformation
2d-transformation
Pooja Dixit
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)
AditiPatni3
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 

Similar to DDA algorithm (20)

Lab lecture 1 line_algo
Lab lecture 1 line_algoLab lecture 1 line_algo
Lab lecture 1 line_algo
simpleok
 
dda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphicsdda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphics
SurjanSinghThakuri
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
saranyan75
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitives
saranyan75
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Mattupallipardhu
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1
ankuredkie
 
Digital Image Procesing
Digital Image ProcesingDigital Image Procesing
Digital Image Procesing
vepiga5005
 
Unit I-cg.ppt Introduction to Computer Graphics elements
Unit I-cg.ppt Introduction to Computer Graphics elementsUnit I-cg.ppt Introduction to Computer Graphics elements
Unit I-cg.ppt Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics elements
Introduction to Computer Graphics elementsIntroduction to Computer Graphics elements
Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics computer
Introduction to Computer Graphics computerIntroduction to Computer Graphics computer
Introduction to Computer Graphics computer
RajeshSukte1
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
Roziq Bahtiar
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
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
Amol Gaikwad
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
Oriental College of Technology,Bhopal
 
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
 
lecture 1.pptx
lecture 1.pptxlecture 1.pptx
lecture 1.pptx
MDRAKIB180107
 
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
Dr. Chandrakant Divate
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
Prianka Padmanaban
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
Prianka Padmanaban
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
RobinAhmedSaikat
 
Lab lecture 1 line_algo
Lab lecture 1 line_algoLab lecture 1 line_algo
Lab lecture 1 line_algo
simpleok
 
dda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphicsdda-line-algorithm.pptx of computer graphics
dda-line-algorithm.pptx of computer graphics
SurjanSinghThakuri
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
saranyan75
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitives
saranyan75
 
A Tutorial On Ip 1
A Tutorial On Ip 1A Tutorial On Ip 1
A Tutorial On Ip 1
ankuredkie
 
Digital Image Procesing
Digital Image ProcesingDigital Image Procesing
Digital Image Procesing
vepiga5005
 
Unit I-cg.ppt Introduction to Computer Graphics elements
Unit I-cg.ppt Introduction to Computer Graphics elementsUnit I-cg.ppt Introduction to Computer Graphics elements
Unit I-cg.ppt Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics elements
Introduction to Computer Graphics elementsIntroduction to Computer Graphics elements
Introduction to Computer Graphics elements
RajeshSukte1
 
Introduction to Computer Graphics computer
Introduction to Computer Graphics computerIntroduction to Computer Graphics computer
Introduction to Computer Graphics computer
RajeshSukte1
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
Roziq Bahtiar
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
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
Amol Gaikwad
 
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
 
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
Dr. Chandrakant Divate
 
Ad

More from Yash Patel (6)

MHD Power generation
MHD Power generationMHD Power generation
MHD Power generation
Yash Patel
 
marketing phase
marketing phasemarketing phase
marketing phase
Yash Patel
 
press operation
press operationpress operation
press operation
Yash Patel
 
evaporative cooling
evaporative coolingevaporative cooling
evaporative cooling
Yash Patel
 
travel chart for plant layout
travel chart for plant layouttravel chart for plant layout
travel chart for plant layout
Yash Patel
 
two degree of freddom system
two degree of freddom systemtwo degree of freddom system
two degree of freddom system
Yash Patel
 
MHD Power generation
MHD Power generationMHD Power generation
MHD Power generation
Yash Patel
 
marketing phase
marketing phasemarketing phase
marketing phase
Yash Patel
 
press operation
press operationpress operation
press operation
Yash Patel
 
evaporative cooling
evaporative coolingevaporative cooling
evaporative cooling
Yash Patel
 
travel chart for plant layout
travel chart for plant layouttravel chart for plant layout
travel chart for plant layout
Yash Patel
 
two degree of freddom system
two degree of freddom systemtwo degree of freddom system
two degree of freddom system
Yash Patel
 
Ad

Recently uploaded (20)

"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
Kasdorf "Accessibility Essentials: A 2025 NISO Training Series, Session 5, Ac...
National Information Standards Organization (NISO)
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdfIntroduction-to-Communication-and-Media-Studies-1736283331.pdf
Introduction-to-Communication-and-Media-Studies-1736283331.pdf
james5028
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Link your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRMLink your Lead Opportunities into Spreadsheet using odoo CRM
Link your Lead Opportunities into Spreadsheet using odoo CRM
Celine George
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 

DDA algorithm

  • 1. SUBJECT : COMPUTER AIDED DESIGN (2161903 ) Gandhinagar Institute of Technology Active Learning assignment on:- “Digital Differential Analyzer (DDA) Algorithm ” Prepared by:- Patel Yash (150123119039)
  • 2. Introduction In computer graphics, a digital differential analyzer (DDA) is hardware or software used for interpolation of variables over an interval between start and end point. DDAs are used for rasterization of lines, triangles and polygons. They can be extended to non linear functions, such as perspective correct texture mapping, quadratic curves, and traversing voxels.
  • 3. The DDA method can be implemented using floating- point or integer arithmetic. The native floating-point implementation requires one addition and one rounding operation per interpolated value (e.g. coordinate x, y, depth, color component etc.) and output result. This process is only efficient when an FPU with fast add and rounding operation will be available.
  • 4. The fixed-point integer operation requires two additions per output cycle, and in case of fractional part overflow, one additional increment and subtraction. The probability of fractional part overflows is proportional to the ratio m of the interpolated start/end values. DDAs are well suited for hardware implementation and can be pipelined for maximized throughput.
  • 5. Digital Differential Analyzer (DDA): Line Drawing Algorithm Walk through the line, starting at (x0,y0) Constrain x, y increments to values in [0,1] range Case a: x is incrementing faster (m < 1) Step in x=1 increments, compute and round y Case b: y is incrementing faster (m > 1) Step in y=1 increments, compute and round x (x0,y0) (x1,y1) dx dy
  • 6. DDA Line Drawing Algorithm (Case a: m < 1) x = x0 y = y0x = x0 y = y0 Illuminate pixel (x, round(y) x = x0 + 1 y = y0 + 1 * m Illuminate pixel (x, round(y))x = x + 1 y = y + 1 * m Illuminate pixel (x, round(y)) Until x == x1 (x0, y0)
  • 7. DDA Line Drawing Algorithm (Case b: m > 1) y = y0 + 1 x = x0 + 1 * 1/m Illuminate pixel (round(x), y) y = y + 1 x = x + 1 /m Illuminate pixel (round(x), y) … Until y == y1 x = x0 y = y0 Illuminate pixel (round(x), y) (x1,y1) (x0,y0)
  • 8. DDA Line Drawing Algorithm Pseudocode compute m; if m < 1: { float y = y0; // initial value for(int x = x0;x <= x1; x++, y += m) setPixel(x, round(y)); } else // m > 1 { float x = x0; // initial value for(int y = y0;y <= y1; y++, x += 1/m) setPixel(round(x), y); } Note: setPixel(x, y) writes current color into pixel in column x and row y in frame buffer
  • 9. DDA Line Drawing Algorithm Pseudocode compute m; if m < 1: { float y = y0; // initial value for(int x = x0;x <= x1; x++, y += m) setPixel(x, round(y)); } else // m > 1 { float x = x0; // initial value for(int y = y0;y <= y1; y++, x += 1/m) setPixel(round(x), y); } Note: setPixel(x, y) writes current color into pixel in column x and row y in frame buffer
  • 10. Line Drawing Algorithm Drawbacks DDA is the simplest line drawing algorithm Not very efficient Round operation is expensive Optimized algorithms typically used. Integer DDA E.g.Bresenham algorithm (Hill, 10.4.1) Bresenham algorithm Incremental algorithm: current value uses previous value Integers only: avoid floating point arithmetic Several versions of algorithm: we’ll describe midpoint version of algorithm