What I am not getting in particular is the part with x_min, y_min, x_max, y_max. I get the program to go through 2 rectangles with lower left and upper right coordinate points. But where do the array indices come from? [0] [0], [1] [1], etc.
This comments section above this code is important for understanding this:
So, if rect is a rectangle, then rect[0] represents the lower left corner, and rect[1] represents the upper right corner. In addition, rect[0][0] represents the x-coordinate of the lower left corner, rect[0][1] is the y-coordinate of this angle, etc.
This comment section is also important:
If rect is a rectangle, the leftmost x-coordinate of this rectangle is the x-coordinate of the lower left corner. As I explained above, rect[0][0] represents the x coordinate of the lower left corner. So in this line:
x_min = [rect1[0][0], rect2[0][0]].max
rect1[0][0] and rect2[0][0] are the two leftmost x-coordinates of the rectangles, and this line of code indicates that the x-coordinate of the left-most side of the intersection of the two rectangles is equal to any of them larger.
source share