Is there anyway that allows me to find all the intersection points between a line and a grid? ( The intersection circles are not drawn to scale with each other, I know)
A brute force way is to compute very intersection for the x-y
grid with the line, but this algorithm is awfully inefficient (O(m*n)
, where m
is the number of x
grid and n
is the number of y
grid).
I'm looking for a better algorithm on this.