48 BBox(
int xmin,
int ymin,
int xmax,
int ymax) :
min(xmin,ymin),
max(xmax,ymax) {}
249 min.
x -= amount_x;
max.
x += amount_x;
250 min.
y -= amount_y;
max.
y += amount_y;
258 return (pt >=
min && pt <
max);
266 return (x >=
min.
x && x < max.x && y >=
min.
y && y <
max.
y);
bool operator==(const BBox &other) const
Check if two bounding boxes are equal.
Definition: bbox.h:120
int x
Definition: point.h:59
bool contains(const Point &pt) const
Check if point is in rectangle.
Definition: bbox.h:256
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
void move_to(const Point &pos)
Move box to position without resizing.
Definition: bbox.h:195
void top_right(const Point &pos)
Set the top right of the box.
Definition: bbox.h:93
int height
Height of size object.
Definition: size.h:58
int width
Width of size object.
Definition: size.h:57
void move_down(int by)
Move box down.
Definition: bbox.h:174
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
void cover(const BBox &to_cover)
Increase bounds to cover given box.
Definition: bbox.h:207
BBox(int xmin, int ymin, int xmax, int ymax)
Construct from the x and y coordinates.
Definition: bbox.h:48
bool operator!=(const BBox &other) const
Check if two bounding boxes are not equal.
Definition: bbox.h:125
Point min
Minimum coordinate of the bounding box.
Definition: bbox.h:68
int y
Definition: point.h:60
const Point & bottom_left() const
Get the bottom left of the box.
Definition: bbox.h:79
int height() const
Return the height of the bounding box.
Definition: bbox.h:135
Class to represent a two dimensional bounding box.
Definition: bbox.h:38
BBox()
Uninitialised bounding box.
Definition: bbox.h:43
void bottom_right(const Point &pos)
Set bottom right of box.
Definition: bbox.h:110
void normalise()
Ensure min.x <= max.x and min.y <= max.y.
Definition: bbox.h:280
void inflate(int amount_x, int amount_y)
Inflate box by given amounts.
Definition: bbox.h:247
Class to represent a two-dimensional size.
Definition: size.h:35
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
void inflate(int amount)
Inflate box by given amount on each side.
Definition: bbox.h:238
const Point & top_right() const
Get the top right of the box.
Definition: bbox.h:89
Class to represent a position in two dimensional space.
Definition: point.h:37
bool intersect(const BBox &intersect_with)
Intersect this box with another.
Definition: bbox.h:225
void move_up(int by)
Move box up.
Definition: bbox.h:169
BBox(const Point &imin, const Size &size)
Construct from the minimum point and size of the box.
Definition: bbox.h:63
void move(int bx, int by)
Move whole box by given amounts.
Definition: bbox.h:154
bool intersects(const BBox &other) const
Check if bounds intesect with another rect.
Definition: bbox.h:272
Point top_left() const
Get top left of box.
Definition: bbox.h:98
void move_left(int bx)
Move box left.
Definition: bbox.h:164
void bottom_left(const Point &pos)
Set the bottom left of the box.
Definition: bbox.h:83
int width() const
Return the width of the bounding box.
Definition: bbox.h:130
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(int x, int y) const
Check if point is in rectangle.
Definition: bbox.h:264
BBox(const Point &imin, const Point &imax)
Construct from the minimum and maximum points of the box.
Definition: bbox.h:58
void size(int width, int height)
Resize the bounding box.
Definition: bbox.h:145
BBox & operator=(const BBox &other)
Assign value from another bounding box.
Definition: bbox.h:115
Size size() const
Return the width and height of the bounding box as a Size.
Definition: bbox.h:140