classdef Circle < handle
% A Circle object has a center and a radius.
% The center is a Point object.

properties
center = Point();
r
end

methods
function C = Circle(x,y,r)
% Creates a circle object
if nargin>0
C.center = Point(x,y);
C.r = r;
end
end

function d = Dist(ThisCircle,P)
% The distance from ThisCircle to Point P
d = abs(P.Dist(ThisCircle.center) - ThisCircle.r);
end

function Show(ThisCircle,c)
% Display ThisCircle in the current figure window with
% color c. The value of c is one of the characters in
% 'kwrgbmcy'.
theta = linspace(0,2*pi);
xc = ThisCircle.center.x;
yc = ThisCircle.center.y;
r = ThisCircle.r;
plot(xc+r*cos(theta),yc+r*sin(theta),c)
end
end

end