Skip to content
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

"Draw Lines" function doesn't handle out of bounds areas correctly. #3

Closed
Tracked by #54
RobDavenport opened this issue Aug 2, 2022 · 3 comments
Closed
Tracked by #54
Labels
bug Something isn't working Console Related to the Console crate good first issue Good for newcomers help wanted Extra attention is needed

Comments

@RobDavenport
Copy link
Member

RobDavenport commented Aug 2, 2022

When trying to call draw_lines and passing bounds outside of the window, the line will sometimes appear or not, depending on start/end position.

We should draw lines across the screen regardless of the location, assuming it actually has pixels inside of the screen.

@RobDavenport RobDavenport added bug Something isn't working good first issue Good for newcomers labels Aug 2, 2022
@RobDavenport RobDavenport added the Console Related to the Console crate label Aug 22, 2022
@RobDavenport
Copy link
Member Author

For more clarity here, its mostly happening with non-horizontal and non-vertical lines.

This can be solved by finding the intersection point if the line with the clipping plane (where x or y equals 0 or width/height -1), and clamping the point to that value.

Its usually called "raster clipping" and there are articles about it for triangles (for 3d rendering), so it shouldn't be too hard to do the same with a single line.

@RobDavenport
Copy link
Member Author

For some more clarity on the issue at hand here:

image

The two images on the left is what should be seen, but it's not whats happening at the moment

@RobDavenport RobDavenport added the help wanted Extra attention is needed label Sep 18, 2022
@RobDavenport
Copy link
Member Author

Resolved in 4082bb4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Console Related to the Console crate good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant