feat: add more shape distances
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user