% CE paper geom fig of Z(s) map; afterwards annotate with xfig. Barnett 5/3/12.
% needs newtzero from Matlab file exchange.
clear; N = 300; % for curve plotting smoothness
s = segment.smoothnonsym(N, 0.3, 0.3, 3);
M = 50; % grid lines on [0,2pi]
P = (-2:3); % vertical grid-pt range of strip to show
[tr ti] = meshgrid((0:N)/N, P/M); t = tr+1i*ti; % map plot horiz lines on [0,1)
[vr vi] = meshgrid((0:M)/M, (P(1):0.1:P(end))/M); v = vr+1i*vi; % vert lines
t0 = 0.6 + 0.04i; mm = 'b.'; ms=30; % map marker & plot type & size
ts = 0.4; sm = 'k.'; % segment marker & plot type
ss = newtzero(s.Zp,0); % Schwartz singularities of domain
ss = ss(find(real(ss)<=1 & real(ss)>=0 & imag(ss)<0.2));
sw = min(abs(imag(ss))); % 0.0225185400992232 gives strip width
w = [(0:N)/N+1i*sw, (N:-1:0)/N-1i*sw].';
figure; % s-plane side
axes('position', [0.05 0.25 .5 .5]); set(gca, 'fontsize',18); c = .6*[1 1 1];
fill(real(w), imag(w),.9*[1 1 1],'edgealpha',0); hold on;
plot(v,'-','color',c); plot(t.','-','color',c);
axis equal off; box off; plot([0 1], [0 0], 'k-','linewidth',2);
z0preims = s.invertZparam(s.Z(t0)); plot(z0preims, mm, 'markersize',ms); %was 5
plot(t0, mm, 'markersize',ms);
plot(real(ts), imag(ts), sm, 'markersize',15);
plot(ss,'r*');
%text(real(ts)-.01, imag(ts)+.03,'$$s$$','interpreter','latex');
text(-.04,0,'$$0$$','interpreter','latex');
text(1.02,0,'$$2\pi$$','interpreter','latex');
% z-plane side:
axes('position', [.55 0.25 .5 .5]); set(gca, 'fontsize',14);
fill(real(s.Z(w)), imag(s.Z(w)),.9*[1 1 1],'edgealpha',0); hold on;
plot(s.Z(v),'-','color',c); plot(s.Z(t.'),'-','color',c);
plot([s.x; s.x(1)], 'k-','linewidth',2);
plot(s.Z(t0), mm, 'markersize',ms);
plot(s.Z(ts), sm, 'markersize',15);
%text(real(s.Z(ts))-.35, imag(s.Z(ts)),'$$Z(s)$$', 'interpreter','latex');
axis equal off; box off; a = axis;
plot(s.Z(ss),'r*'); axis(a);

set(gcf,'paperposition', [0 0 8 6]); print -depsc2 geom_talk.eps


