intersection between a line and square
问题 I have a square in 2d space (width = height). The square is currently defined by two points: BottomLeft(X1,Y1) and TopRight(X2,Y2). The square is axis-aligned, so finding the other two corners is as easy as (X1, Y2) and (X2, Y1). I also have two points - one is always inside the square, and the other is definitely outside. They aren't necessarily at the centre of the square - they can be wherever. I know their coordinates too. What I need is to find the intersection point between the line