function d = p16_fd ( p )

%*****************************************************************************80
%
%% p16_fd() is a signed distance function for problem 16.
%
%  Modified:
%
%    13 March 2008
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real P, one or more points.
%
%  Output:
%
%    real D, the signed distance of each point to the boundary of the region.
%
  global R1
  global R2

  d1 = dcircle ( p, 0.0, 0.0, R2 );
  d2 = dcircle ( p, 0.0, 0.0, R1 );
  d3 = p(:,1);
  d4 = p(:,2);

  d  = max ( d1, -d2 );
  d = max ( d, -d3 );
  d = max ( d, -d4 );

  return
end
