feat: add more shape distances

This commit is contained in:
2021-11-30 18:01:07 +01:00
parent 8351c5d09f
commit 6a51638b7e
2 changed files with 32 additions and 8 deletions

View File

@@ -53,6 +53,10 @@ public:
bool collidesWith(const Point& point) const;
bool collidesWith(const Rectangle& rect) const;
bool collidesWith(const Circle& circle) const;
// distance from the closest side of the rectangle
float distance(const Circle& circle) const;
float distanceSquared(const Circle& circle) const;
};
class Circle {
@@ -78,6 +82,10 @@ public:
bool collidesWith(const Point& point) const;
bool collidesWith(const Rectangle& rect) const;
bool collidesWith(const Circle& circle) const;
// distance from the closest side of the rectangle
float distance(const Rectangle& rect) const;
float distanceSquared(const Rectangle& rect) const;
};
} // namespace shape