diff options
Diffstat (limited to 'kue/circle.h')
-rw-r--r-- | kue/circle.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/kue/circle.h b/kue/circle.h new file mode 100644 index 00000000..d412b41d --- /dev/null +++ b/kue/circle.h @@ -0,0 +1,27 @@ +#ifndef _CIRCLE_H +#define _CIRCLE_H + +#include "point.h" + +// Billards and pockets are both circles +// The collison detection code likes to deal with circles, not billards and pockets + +class circle : public point { + public: + circle(double x, double y, double r) : point(x, y) { _radius = r; } + ~circle() {} + + // Accessors + double radius() { return _radius; } + void setRadius(double radius) { _radius = radius; } + + // Returns true if we intersect the other circle + double intersects(const circle &other_circle) { return (distance(other_circle) - other_circle._radius) <= _radius; } + // Returns the distance from the edge of this circle to the edge of the other + double edgeDistance(const circle &other_circle) { return distance(other_circle) - _radius - other_circle._radius; } + + protected: + double _radius; +}; + +#endif |