function f = bdrytheo(region,phi)

% Test regions for Theodorsen's method.
% Boundary curves must contain the origin and
% be parametrized by polar angle, 
%     f = rho(phi)*exp(i*phi).

% n      = Number of points on boundary
% ratio  = The ratio of the minor to the major axis
% region = 1 ellipse (polar coordinates)
% region = 2 inverted ellipse (polar coordinates)
% f(n)  = f(phi(n)) n complex points along curve at phi

global ratio

n = length(phi);

if region == 1
% ellipse   
    ss = sin(phi);
    sc = cos(phi);
    rho = ratio ./ sqrt(1 - (1 - ratio ^ 2) * sc .^ 2);
    f = rho .* (sc + i*ss); 
elseif region == 2
% inverted ellipse    
    ss = sin(phi);
    sc = cos(phi);
    rho = sqrt(1 - (1 - ratio ^ 2) * ss .^ 2);
    f = rho .* (sc + i*ss);
end