function data=s_circle(xy,r)

% data=function s_circle(xy,r)
%
% This function is used in conjunction with FD3.  If the function is called
% with two arguments, 'xy' is the vector containing the [x, y] coordinate
% of the center and 'r' is the radius.  If the function is called with one
% argument 'xy', 'xy' will represent the [x, y] coordinate of the center the
% first time the function is called and the [x, y] coordinate of a point on
% circumference the second time the function is called.  The former method
% of sending information to s_circle is employed when loading flow
% diagrams while the latter method is employed when an FD3 user creates a
% circle by clicking on the window two times.  See 'user-def' for a complete
% explanation of the information contained in 'data'.
%
% ACP

% Last update:  July 12, 1993
% Author:       Adrian C. Penisson

global FD3FUNCLEVEL FD3LASTPOS FD3MESSAGE FD3AXES

if nargin==1

   if FD3FUNCLEVEL==0

      str='Point and|click on the|circumference|of the circle.';
      FD3MESSAGE=di_mssg(str);
      FD3LASTPOS=xy;   
      FD3FUNCLEVEL=1;

      return

   elseif FD3FUNCLEVEL==1

      z1=FD3LASTPOS(1,1)+i*FD3LASTPOS(1,2);
      z2=xy(1,1)+i*xy(1,2);

      r=abs(z1-z2);

   end

elseif nargin>1

   z1=xy(1,1)+i*xy(1,2);

end

data=circ(z1,r,40);

axes(FD3AXES(3))

h=line(real(data),imag(data));

FD3FUNCLEVEL=0;
FD3LASTPOS=[];

data=[h 0 0 real(z1) imag(z1) 2 r 0 0 pi/4 3*pi/4 5*pi/4 7*pi/4 1 1];
