Hi,

I'm stuck with the following problem.

I have a 2D grid of size 600x600.

If I draw a line from a specific point (say 250,400) in a specific direction (say 100 degrees), I want to calculate on which point this line will cross the border of the grid.

I've been struggling with tangens and more of this stuff, but I can't seem to find the right formula... Hopefully someone can help me :-)

(if it's not possible with one formula, that's no problem, multiple formulas are okay too)

Thanks in advance!