38 : minx(std::numeric_limits<double>::max()),
39 miny(std::numeric_limits<double>::max()),
40 maxx(std::numeric_limits<double>::min()),
41 maxy(std::numeric_limits<double>::min())
55 bounds_t(
double minx,
double miny,
double maxx,
double maxy)
56 : minx(minx), miny(miny), maxx(maxx), maxy(maxy)
71 minx = std::min(x, minx);
72 maxx = std::max(x, maxx);
73 miny = std::min(y, miny);
74 maxy = std::max(y, maxy);
89 minx = std::min(b.
minx, minx);
90 maxx = std::max(b.
maxx, maxx);
91 miny = std::min(b.
miny, miny);
92 maxy = std::max(b.
maxy, maxy);
101 std::tuple<double, double>
center()
const 103 return std::make_tuple((minx + maxx) / 2.0, (miny + maxy) / 2.0);
113 return std::make_tuple(minx, maxy);
123 return std::make_tuple(maxx, miny);
133 return std::make_tuple(minx, miny);
143 return std::make_tuple(maxx, maxy);
155 return (x >= minx) && (x <= maxx) && (y >=
miny) && (y <= maxy);
double minx
the minimum x-coordinate
double miny
the minimum y-coordinate
bool overlaps(const bounds_t &other)
std::tuple< double, double > bottom_left() const
bool contains(const bounds_t &other)
Represents an axis-aligned bounding box.
std::tuple< double, double > top_left() const
bounds_t & extend(double x, double y)
Extends the bounds to contain the given point.
std::tuple< double, double > top_right() const
bool contains(double x, double y) const
bounds_t(double minx, double miny, double maxx, double maxy)
Creates a bounds object from the given coordinates.
double maxx
the maximum x-coordinate
bool intersects(const bounds_t &other)
std::tuple< double, double > center() const
bounds_t()
Creates a bounds object.
std::tuple< double, double > bottom_right() const
bounds_t & extend(const bounds_t &b)
Extends the bounds to contain the given bounds.
double maxy
the maximum y-coordinate