MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / boxes_overlap

Function boxes_overlap

utils/wei_utils.py:632–650  ·  view source on GitHub ↗
(box_a, box_b)

Source from the content-addressed store, hash-verified

630
631 # Helper function to check overlap between two boxes
632 def boxes_overlap(box_a, box_b):
633 # Unpack bounding-box data
634 name_a, left_a, top_a, width_a, height_a = box_a
635 name_b, left_b, top_b, width_b, height_b = box_b
636
637 # Compute right and bottom coordinates
638 right_a = left_a + width_a
639 bottom_a = top_a + height_a
640 right_b = left_b + width_b
641 bottom_b = top_b + height_b
642
643 # Rectangles overlap if not separated along either x or y axis
644 # If one box is completely to the left or right or above or below the other,
645 # there's no overlap.
646 no_overlap = (right_a <= left_b or # A is completely left of B
647 right_b <= left_a or # B is completely left of A
648 bottom_a <= top_b or # A is completely above B
649 bottom_b <= top_a) # B is completely above A
650 return not no_overlap
651
652 # 1) Check for overlap first
653 n = len(box_list)

Callers 1

check_bounding_boxesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected