Skip to content

Conversation

@jeanne-boussonniere
Copy link

This resolves issue #13905.

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

@ayushHardeniya ayushHardeniya left a comment

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.

"""
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

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.

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).

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