| 1011 | } |
| 1012 | |
| 1013 | std::array<DPoint, 4> rectangle_corners(const DPoint& start, const DPoint& end, double width) { |
| 1014 | auto u = unit(end - start); |
| 1015 | if (u.squared_length() < 1.e-18) { |
| 1016 | u = {1., 0.}; |
| 1017 | } |
| 1018 | auto n = perpendicular(u); |
| 1019 | auto ext = width; |
| 1020 | auto p0 = start - u * ext; |
| 1021 | auto p1 = end + u * ext; |
| 1022 | auto w = n * (width / 2.); |
| 1023 | return {p0 + w, p1 + w, p1 - w, p0 - w}; |
| 1024 | } |
| 1025 | |
| 1026 | DBox aabb_from_points(const std::array<DPoint, 4>& corners) { |
| 1027 | DBox bbox{corners[0], corners[0]}; |
no test coverage detected