Skip to content

Commit 9a2fd24

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b8422c7 commit 9a2fd24

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

graphics/digital_differential_analyzer_line.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)