| 489 | } |
| 490 | |
| 491 | float overlap(float x1, float w1, float x2, float w2) |
| 492 | { |
| 493 | float l1 = x1 - w1 / 2; |
| 494 | float l2 = x2 - w2 / 2; |
| 495 | float left = l1 > l2 ? l1 : l2; |
| 496 | float r1 = x1 + w1 / 2; |
| 497 | float r2 = x2 + w2 / 2; |
| 498 | float right = r1 < r2 ? r1 : r2; |
| 499 | return right - left; |
| 500 | } |
| 501 | |
| 502 | float box_intersection(box a, box b) |
| 503 | { |