map regions in origin

This commit is contained in:
Fabien Freling 2022-02-16 19:16:17 +01:00
parent 38e9a97a85
commit 4447cd67d1
7 changed files with 82 additions and 12 deletions

View file

@ -5,6 +5,10 @@ namespace freling {
int BoundingBox::area() const {
return width * height;
}
bool BoundingBox::contains(int x, int y) const {
return this->x <= x and x <= this->x + this->width and this->y <= y and
y <= this->y + this->height;
}
bool BoundingBox::operator==(const BoundingBox& b) const {
return x == b.x and y == b.y and width == b.width and height == b.height;