-
-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Docs: Improve docstring for DDA algorithm #13906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,13 @@ def digital_differential_analyzer_line( | |
| """ | ||
| Draws a line between two points using the DDA algorithm. | ||
|
|
||
| This algorithm works by calculating the dx (change in x) and dy;(change in y) and then iteratively | ||
| steps along the dominant axis,incrementing the other axis by a fractional amount (the slope). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The algorithm actually steps along both axes simultaneously. The calculation of the increments ( |
||
| It is notable for its simplicity but also for its main disadvantage: | ||
| it relies on floating-point arithmetic at every step, which is computationally slow. | ||
| It is generally outperformed by Bresenham's algorithm, which achieves | ||
| the same result using only integer-based math. | ||
|
|
||
| Args: | ||
| - p1: Coordinates of the starting point. | ||
| - p2: Coordinates of the ending point. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After dy - ";" is put by mistake, maybe, so remove it or adjust accordingly.