DDA LINE ALGORITHM
Digital Differential Analyzer (DDA) line algorithm is a simple incremental algorithm, which is mainly used in computer graphics to draw a straight line between any two given points. The main advantage of this algorithm is that it uses only integer addition and subtraction and avoids heavy operations such as multiplication and floating point division.\n\nHere are the steps involved in the DDA line algorithm:\n\n1. Start: The algorithm starts by reading the coordinates of the two end points (x1, y1) and (x2, y2), where (x1, y1) are the coordinates of the first point and (x2, y2) are the coordinates of the second point.\n\n2. Calculate the difference: Dx = x2 - x1 and Dy = y2 - y1.\n\n3. Calculate the number of steps: It's calculated by taking the absolute maximum difference max(|Dx|, |Dy|). \n\n4. Calculate x and y increment: Xinc = Dx / steps and Yinc = Dy / steps. \n\n5. Assign the starting point: Put the starting point in a buffer or send it directly to the screen.\n\n6. Update x and y coordinates: For each step from 1 to steps, increment x and y by Xinc and Yinc respectively, then draw the pixel at the new (x, y).\n\n7. End: The algorithm ends after plotting all the pixels.\n\nThe DDA line algorithm, however, has its limitation. It may cause round-off errors and arithmetic overflows. Despite this, it’s efficient and widely used for line generation in computer graphics.