Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
517 B
3
Indexable
Never
def do_rectangles_intersect(brush_polygon, exclusion_polygon):
    x1_min = brush_polygon[0]
    x1_max = brush_polygon[1]
    y1_min = brush_polygon[2]
    y1_max = brush_polygon[3]

    x2_min = exclusion_polygon[0]
    x2_max = exclusion_polygon[1]
    y2_min = exclusion_polygon[2]
    y2_max = exclusion_polygon[3]

    if x1_max < x2_min or x2_max < x1_min:
        return False

        # Check if one rectangle is above the other
    if y1_max < y2_min or y2_max < y1_min:
        return False
    return True
Leave a Comment