% make_tri4 construct spiral
n=6;
r=10;
%z=[.5];
z=[0];
z=[z,r*exp(pi*i*[0:n]/n)];
z=[z,-z-i-.25];
x=real(z);
y=imag(z);
%scatter(x,y);
tri4=zeros(2*n+4,3);
for k=1:n
tri4(k,:)=[1,k+1,k+2];
tri4(k+n,:)=[n+3,n+3+k,n+3+k+1];
end % for k
tri4(2*n+1,:)=[1,n+2,n+4];
tri4(2*n+2,:)=[n+4,n+3,1];
tri4(2*n+3,:)=[n+3, 2*n+4,1];
tri4(2*n+4,:)=[2,1,2*n+4];
tri=tri4;

% plot triangulation alone
figure
plot_tri(x,y,tri)
% plot triangulation and boundary
figure
plot_tri(x,y,tri)
M=make_adj_matrix(tri);
B=find_boundary(tri,M);
plot_tri_boundary(x,y,B);
% plot triangulation, boundary and central region
figure
plot_tri(x,y,tri)
plot_tri_boundary(x,y,B);
radii=find_radii(x,y,tri);
plot_central_regions2(x,y,tri,radii);
% plot triangulation, boundary, thin centrals and flows
figure
plot_tri(x,y,tri)
plot_tri_boundary(x,y,B);
radii=find_radii(x,y,tri);
plot_central_regions2(x,y,tri,radii);
propagate2(x,y,tri,radii,B)
% plot triangulation, boundary, thick centrals and flows
figure
plot_tri(x,y,tri)
plot_tri_boundary(x,y,B);
radii=find_radii2(x,y,tri);
plot_central_regions2(x,y,tri,radii);
propagate4(x,y,tri,radii,B)