% make_tri1 

z=[1,2,3,4,5];
w=exp(pi*i/3);
z1=[z,z+w,z+2*w,z+3*w,z+4*w];
figure 
axis equal
x=real(z1);
y=imag(z1);
%scatter(real(z1),imag(z1));
tri1=[2,3,7;
      3,8,7;
     3,4,8;
     4,9,8;
     4,5,9;
     5,10,9;
     9,10,14;
     10,15,14;
     14,15,19;
     19,15,20;
     19,20,24;
     19,24,23;
     18,19,23;
     18,23,22;
     17,18,22;
     17,22,21;
     17,21,16;
     16,12,17;
     11,12,16;
     7,12,11;
     6,7,11;
     2,7,6;
     12,18,17;
     7,18,12;
     7,8,18;
     8,19,18;
     8,14,19;
     8,9,14]  
 tri=tri1(1:22,:);
  M=make_adj_matrix(tri);
  B=find_boundary(tri,M);
  
  % plot triangulaton alone
  plot_tri(x,y,tri)
  
  % plot tiangulation and boundary
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  
  % plot tiangulation,boundary and insribed cicles
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_inscribed_circ(x,y,tri);
  
    % plot tiangulation,boundary and insribed cicles
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  %plot_inscribed_circ(x,y,tri);
  plot_central_regions(x,y,tri);
  
  % plot triangulation, boundary and flow
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_central_regions(x,y,tri);
  propagate2(x,y,tri,radii,B)

  
 tri=tri1;
   M=make_adj_matrix(tri);
  B=find_boundary(tri,M);
  
  % plot triangulaton alone
  plot_tri(x,y,tri)
  
  % plot tiangulation and boundary
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  
  % plot tiangulation,boundary and insribed cicles
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_inscribed_circ(x,y,tri);
  
    % plot tiangulation,boundary and insribed cicles
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  %plot_inscribed_circ(x,y,tri);
  plot_central_regions(x,y,tri);
  
  % plot triangulation, boundary and flow
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_central_regions(x,y,tri);
  propagate2(x,y,tri,radii,B)
 
tri2=[2,3,7;
      3,8,7;
     3,4,8;
     4,9,8;
     4,5,9;
     5,10,9;
     9,10,14;
     10,15,14;
     14,15,19;
     19,15,20;
     19,20,24;
     19,24,23;
     18,19,23;
     18,23,22;
     17,18,22;
     17,22,21;
     17,21,16;
     16,12,17;
     11,12,16;
     7,12,11;
     6,7,11;
     2,7,6;
     12,18,17;
     7,18,12;
     7,8,18;
     8,9,18;
     9,14,18;
     14,19,18] 

  % plot triangulation, boundary and flow
  tri=tri2;
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_central_regions(x,y,tri);
  propagate2(x,y,tri,radii,B)
  
    % plot triangulation, boundary and flow
  K=length(x);
  template=[0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0];
  x0=x;
  y0=y;
  x=x+template.*((.07)*randn(1,K));
  y=y+template.*((.07)*randn(1,K));

  figure; axis off; axis equal; 
  plot_tri(x,y,tri)
  plot_tri_boundary(x,y,B);
  radii=find_radii(x,y,tri);
  plot_central_regions(x,y,tri);
  propagate2(x,y,tri,radii,B)
  
