Geek Culture
Published in

Geek Culture

DDA Line Drawing Algorithm

Explanation of the DDA Line Drawing Algorithm with examples

  1. DDA algorithm (Digital Differential Analyzer)
  2. Midpoint algorithm
  3. Bresenham’s line algorithm

The Line Equation

Finding the next pixel to draw a line

DDA Algorithm

Case 1: When |m|<1

Case 2: When |m|>1

Examples

Note:

If X1 > X2, take (X2, Y2) as the starting point and (X1, Y1) as the end point, then continue the DDA algorithm as we learned today.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store