@@ -5,36 +5,36 @@ def digital_differential_analyzer_line(
55 p1 : tuple [int , int ], p2 : tuple [int , int ]
66) -> list [tuple [int , int ]]:
77 """
8-
9- Digital Differential Analyzer (DDA) Line Drawing Algorithm.
108
11- This algorithm draws a straight line between two points by calculating
12- the difference in x (dx) and y (dy) coordinates and incrementally stepping
13- through the dominant axis while updating the other axis using fractional
14- increments.
9+ Digital Differential Analyzer (DDA) Line Drawing Algorithm.
1510
16- One of the main disadvantages of the DDA algorithm is its reliance on
17- floating-point arithmetic, which can introduce rounding errors at each step.
18- Because of this, it is generally slower and less accurate than the
19- Bresenham line drawing algorithm, which uses only integer arithmetic .
11+ This algorithm draws a straight line between two points by calculating
12+ the difference in x (dx) and y (dy) coordinates and incrementally stepping
13+ through the dominant axis while updating the other axis using fractional
14+ increments .
2015
21- Despite this, DDA is useful for educational purposes as it is simple
22- to understand and demonstrates the basic idea of incremental line generation.
16+ One of the main disadvantages of the DDA algorithm is its reliance on
17+ floating-point arithmetic, which can introduce rounding errors at each step.
18+ Because of this, it is generally slower and less accurate than the
19+ Bresenham line drawing algorithm, which uses only integer arithmetic.
2320
24- For more details, see:
25- https://en.wikipedia.org/wiki/Digital_differential_analyzer_(graphics_algorithm)
21+ Despite this, DDA is useful for educational purposes as it is simple
22+ to understand and demonstrates the basic idea of incremental line generation.
2623
24+ For more details, see:
25+ https://en.wikipedia.org/wiki/Digital_differential_analyzer_(graphics_algorithm)
2726
2827
2928
30- Args:
31- - p1: Coordinates of the starting point.
32- - p2: Coordinates of the ending point.
33- Returns:
34- - List of coordinate points that form the line.
3529
36- >>> digital_differential_analyzer_line((1, 1), (4, 4))
37- [(2, 2), (3, 3), (4, 4)]
30+ Args:
31+ - p1: Coordinates of the starting point.
32+ - p2: Coordinates of the ending point.
33+ Returns:
34+ - List of coordinate points that form the line.
35+
36+ >>> digital_differential_analyzer_line((1, 1), (4, 4))
37+ [(2, 2), (3, 3), (4, 4)]
3838 """
3939 x1 , y1 = p1
4040 x2 , y2 = p2
0 commit comments