#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