48 BBox(
int xmin,
int ymin,
int xmax,
int ymax) :
min(xmin,ymin),
max(xmax,ymax) {}
229 return (pt >=
min && pt <
max);
237 return (x >=
min.
x && x < max.x && y >=
min.
y && y <
max.
y);
void move_to(const Point &pos)
Move box to position without resizing.
Definition: bbox.h:195
int height
Height of size object.
Definition: size.h:58
BBox(const BBox &other)
Construct from another bounding box.
Definition: bbox.h:53
void move_to(int x, int y)
Move box to position without resizing.
Definition: bbox.h:182
Point bottom_right() const
Get bottom right of box.
Definition: bbox.h:106
bool contains(const Point &pt) const
Check if point is in rectangle.
Definition: bbox.h:227
Class to represent a two-dimensional size.
Definition: size.h:34
Size size() const
Return the width and height of the bounding box as a Size.
Definition: bbox.h:140
void size(int width, int height)
Resize the bounding box.
Definition: bbox.h:145
Point top_left() const
Get top left of box.
Definition: bbox.h:98
void top_right(const Point &pos)
Set the top right of the box.
Definition: bbox.h:93
int x
Definition: point.h:59
bool operator!=(const BBox &other) const
Check if two bounding boxes are not equal.
Definition: bbox.h:125
bool intersects(const BBox &other) const
Check if bounds intesect with another rect.
Definition: bbox.h:243
const Point & top_right() const
Get the top right of the box.
Definition: bbox.h:89
Class to represent a two dimensional bounding box.
Definition: bbox.h:37
void move_right(int bx)
Move box right.
Definition: bbox.h:159
void size(const Size &size)
Resize the bounding box.
Definition: bbox.h:149
int height() const
Return the height of the bounding box.
Definition: bbox.h:135
int width
Width of size object.
Definition: size.h:57
void move_down(int by)
Move box down.
Definition: bbox.h:174
BBox(int xmin, int ymin, int xmax, int ymax)
Construct from the x and y coordinates.
Definition: bbox.h:48
Point min
Minimum coordinate of the bounding box.
Definition: bbox.h:68
void cover(const BBox &to_cover)
Increase bounds to cover given box.
Definition: bbox.h:207
int y
Definition: point.h:60
void normalise()
Ensure min.x <= max.x and min.y <= max.y.
Definition: bbox.h:251
Class to represent a position in two dimensional space.
Definition: point.h:36
bool operator==(const BBox &other) const
Check if two bounding boxes are equal.
Definition: bbox.h:120
void top_left(const Point &pos)
Set top left of box.
Definition: bbox.h:102
Point max
Maximum coordinate of the bounding box.
Definition: bbox.h:72
BBox()
Uninitialised bounding box.
Definition: bbox.h:43
void bottom_left(const Point &pos)
Set the bottom left of the box.
Definition: bbox.h:83
void move_up(int by)
Move box up.
Definition: bbox.h:169
void bottom_right(const Point &pos)
Set bottom right of box.
Definition: bbox.h:110
void move(int bx, int by)
Move whole box by given amounts.
Definition: bbox.h:154
BBox & operator=(const BBox &other)
Assign value from another bounding box.
Definition: bbox.h:115
void move_left(int bx)
Move box left.
Definition: bbox.h:164
void inflate(int amount)
Inflate box by given amount on each side.
Definition: bbox.h:218
BBox(const Point &imin, const Size &size)
Construct from the minimum point and size of the box.
Definition: bbox.h:63
const Point & bottom_left() const
Get the bottom left of the box.
Definition: bbox.h:79
BBox(const Point &imin, const Point &imax)
Construct from the minimum and maximum points of the box.
Definition: bbox.h:58
bool contains(int x, int y) const
Check if point is in rectangle.
Definition: bbox.h:235
int width() const
Return the width of the bounding box.
Definition: bbox.h:130