def outer(self): """ The smallest rectangle circumscribed by the trapezoid. Returns: tuple[int]: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y). """ return trapezoid2area(self.corner, pad=-5)
def inner(self): """ The largest rectangle inscribed in trapezoid. Returns: tuple[int]: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y). """ return trapezoid2area(self.corner, pad=5)
def local_to_area(local_grid, pad=0): result = [] for local in local_grid: # Predict the position of grid after swipe. # Swipe should ends there, to prevent treating swipe as click. area = area_offset((0, 0, 1, 1), offset=-map_vector) corner = local.grid2screen(area2corner(area)) area = trapezoid2area(corner, pad=pad) result.append(area) return result