array_square_cell.intersection_rect

array_square_cell.intersection_rect

Compute the rectangle formed by the intersection of two rectangles.

Each rectangle is formed by an array-like structure of the form [[ll_x, ll_y], [ur_x, ur_y]] where the lower left (ll) corner has coordinates (ll_x, ll_y) and the upper right (ur) corner has coordinates (ur_x, ur_y).

If the two rectangles do not overlap then the function returns an array filled with zeros.

Parameters:
  • p_r1 (array-like structured as [[ll_x, ll_y], [ur_x, ur_y]]) – first rectangle
  • p_r2 (array-like structured as [[ll_x, ll_y], [ur_x, ur_y]]) – second rectangle
Returns:

intersection of the two input rectangles

Return type:

array-like structured as [[ll_x, ll_y], [ur_x, ur_y]]