namespace md { template std::ostream& operator<<(std::ostream& os, const Box& box) { os << "Box(lower_left = " << box.lower_left() << ", upper_right = " << box.upper_right() << ")"; return os; } template void Box::translate(Real a) { ll.x += a; ll.y += a; ur.x += a; ur.y += a; } template std::vector> Box::refine() const { std::vector> result; // 1 | 2 // 0 | 3 Point new_ll = lower_left(); Point new_ur = center(); result.emplace_back(new_ll, new_ur); new_ll.y = center().y; new_ur.y = ur.y; result.emplace_back(new_ll, new_ur); new_ll = center(); new_ur = upper_right(); result.emplace_back(new_ll, new_ur); new_ll.y = ll.y; new_ur.y = center().y; result.emplace_back(new_ll, new_ur); return result; } template std::vector> Box::corners() const { return {ll, Point(ll.x, ur.y), ur, Point(ur.x, ll.y)}; }; }