How can I do the calculation to know if the line is passing through the rectangle (obstacle), since I only know the position of sta1 and sta2 and I also know the xmin, xmax and ymin, ymax of the rectangle?

sta1 position(x,y) = (1,5) sta2 position(x,y) = (5,1)
retangle xmin = 3 retangle xmax = 4 retangle ymin = 2 retangle ymax = 3