I want to find the (maximum 2) intersect points between a segment (a line that is of finite length defined by a starting and an ending points) and a rectangle. Both of them are "floating" in 2-D space without being bounded to the center (0,0) or to any of the axes.
Is there an easier way to find the intersection points except for continuing all the lines to be infinite, find the intersection points between the lines of the rectangle and the line of the segment and then check if the points are on the perimeter of the rectangle?
The rectangle is defined by 4 points.