I have a line segment defined by two pointF
s, along with a 2D bounding rectangle. I want to extend the line segment as much as possible in both directions so t
Define the rectangle as four lines.
Find the intersection between your line and each of the four lines. (How's your highschool geometry?)
Of these four intersection points, determine which points are within the bounds of the rectangle. (find the intersection points where both the x and y values are within the rectangles range).
Your algorithm must also allow for the following edge cases: