%CIRCLE      Draws a circle at given location with desired radius.
%   CIRCLE( X0, Y0, R, LINESTYLE, N ) draws a circle of radius R
%   centered at (X0,Y0) using the specified linestyle.  N is an
%   optional argument (default 128) used to control the number of
%   segments.
%   [XX,YY] = CIRCLE( ... ) suppresses the plot but returns values
%   such that PLOT(XX,YY) produces the desired circle.
%
%   See also PLOT.

%    Copyright (C) 1995-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id: circle.m,v 1.1 2000/01/10 19:07:47 rob Exp $

function [xx,yy] = circle( x0, y0, r, color, linestyle, n )

if nargin < 6, n = 128; end;
if nargin < 5, linestyle = '-'; end
if nargin < 4, color = 'b'; end

phi = linspace( 0, 2*pi, n );

x = r*cos( phi );
y = r*sin( phi );

if nargout > 0
    xx = x;
    if nargout > 1, yy = y; end
else

    plot( x0 + x, y0 + y, 'LineStyle', linestyle, 'Color', color );

end
