[WIP] Refactoring meta-detection

This commit is contained in:
Matthias Bisping 2023-01-09 14:33:27 +01:00
parent 0e6cb495e8
commit 99af2943b5

View File

@ -182,9 +182,9 @@ def intersection_along_axis(alpha, beta, axis):
def overlap(alpha: Rectangle, beta: Rectangle):
x1, y1, w1, h1 = alpha
x2, y2, w2, h2 = beta
a_x1, a_y1, a_w1, a_h1 = alpha
b_x2, b_y2, b_w2, b_h2 = beta
dx = min(x1 + w1, x2 + w2) - max(x1, x2)
dy = min(y1 + h1, y2 + h2) - max(y1, y2)
dx = min(a_x1 + a_w1, b_x2 + b_w2) - max(a_x1, b_x2)
dy = min(a_y1 + a_h1, b_y2 + b_h2) - max(a_y1, b_y2)
return True if (dx >= 0) and (dy >= 0) else False