| 1024 | } |
| 1025 | |
| 1026 | DBox aabb_from_points(const std::array<DPoint, 4>& corners) { |
| 1027 | DBox bbox{corners[0], corners[0]}; |
| 1028 | for (auto& p : corners) { |
| 1029 | bbox[0] = {std::min(bbox[0].x(), p.x()), std::min(bbox[0].y(), p.y())}; |
| 1030 | bbox[1] = {std::max(bbox[1].x(), p.x()), std::max(bbox[1].y(), p.y())}; |
| 1031 | } |
| 1032 | return bbox; |
| 1033 | } |
| 1034 | |
| 1035 | bool aabb_overlap(const DBox& a, const DBox& b, double eps = 1.e-9) { |
| 1036 | return a[0].x() <= b[1].x() + eps && |
no outgoing calls
no test coverage detected