33 #ifdef OGDF_INCLUDE_CGAL
44 # include <CGAL/Bbox_2.h>
45 # include <CGAL/Iso_rectangle_2.h>
52 template<
typename kernel>
53 using Rectangle_t = CGAL::Iso_rectangle_2<kernel>;
55 class Bbox :
public CGAL::Bbox_2 {
57 using Bbox_ = CGAL::Bbox_2;
66 Bbox(
const Bbox_& b) : Bbox_(b) {
70 inline double width()
const {
return Bbox::xmax() - Bbox::xmin(); }
72 inline double height()
const {
return Bbox::ymax() - Bbox::ymin(); }
74 inline double area()
const {
return width() * height(); }
76 template<
typename Kernel>
77 inline Point_t<Kernel> center()
const {
78 return {xmin() + width() / 2, ymin() + height() / 2};
82 inline Bbox equalize(
const Bbox& bb) {
83 double max = std::max(bb.width(), bb.height());
84 return {bb.xmin(), bb.ymin(), bb.xmin() + max, bb.ymin() + max};
87 template<
typename kernel>
88 inline Rectangle_t<kernel> scale_up(
const Rectangle_t<kernel>& rect,
const typename kernel::FT v) {
89 const typename kernel::FT s = std::min(rect.xmax() - rect.xmin(), rect.ymax() - rect.ymin()) * v;
90 const Vector_t<kernel> t(s, s);
91 return {rect.min() - t, rect.max() + t};