Transformation grid lines often don't get drawn
Closed this issue · 0 comments
With the way the transformed grid lines are currently drawn, we often end up with grid lines that should be drawn, not getting drawn. This means that we get some grid lines in the centre, but they don't continue out far enough and the corners look pretty sparse. I'm not entirely sure how, but I need to draw all the possible grid lines within the canvas.
I think I could use a technique like this. Use y = mx + c
and find m for the grid lines. Check if this line intersects the line y = max_y
between -max_x
and max_x
. If it does, then draw as many parallel grid lines as possible. For a mostly vertical grid line to fit within the canvas, it must intersect y = max_y
or y = -max_y
between -max_x
and max_x
, so we continue to increment multiples of c until we no longer meet this requirement.
A very similar technique can be used if the grid line doesn't intersect y = max_y
between the limits. Instead, we look at intersections with x = max_x
or x = -max_x
.