Closed RobDavenport closed 1 year ago
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.
For some more clarity on the issue at hand here:
The two images on the left is what should be seen, but it's not whats happening at the moment
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.