Docs: Improve docstring for DDA algorithm by jeanne-boussonniere · Pull Request #13906 · TheAlgorithms/Python · GitHub
Skip to content

Docs: Improve docstring for DDA algorithm - #13906

Open
jeanne-boussonniere wants to merge 2 commits into
TheAlgorithms:masterfrom
jeanne-boussonniere:patch-1
Open

jeanne-boussonniere wants to merge 2 commits into
TheAlgorithms:masterfrom
jeanne-boussonniere:patch-1

Conversation

@jeanne-boussonniere

Copy link
Copy Markdown

This resolves issue #13905.

@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Nov 13, 2025

@ayushHardeniya ayushHardeniya left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout these changes as mentioned on desired places below.

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 ($X_{inc}$ and $Y_{inc}$) ensures that the coordinate along the dominant axis (the one with the larger $\Delta$) is guaranteed to change by exactly 1 unit (or $-1$) in each step, while the coordinate along the non-dominant axis changes by a fractional amount (the slope). The algorithm doesn't "step along" just the dominant axis; it increments both $x$ and $y$ in every single step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants