Subversion Repositories wimsdev

Rev

Rev 18517 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18517 Rev 18529
Line 19... Line 19...
19
  h=mob_ori(a,d);\
19
  h=mob_ori(a,d);\
20
  mob_mul(h,mob_mul([1,0,1],mob_inv(h)))\
20
  mob_mul(h,mob_mul([1,0,1],mob_inv(h)))\
21
  };\
21
  };\
22
lft_fwd(g,beta,l)=my(e=exp(I*beta/2));mob_mul(g,[e,e*l,0]);\
22
lft_fwd(g,beta,l)=my(e=exp(I*beta/2));mob_mul(g,[e,e*l,0]);\
23
\
23
\
24
wims_export(pavage)={\
-
 
25
  my(res1,res2,res3,res4,[sommets,paves,aretes,daretes]=pavage,n=#paves[1]-1);\
-
 
26
  res1=matrix(#sommets,2,i,j,if(j==1,real(sommets[i]),imag(sommets[i])));\
-
 
27
  res2=matrix(#paves,n+2,i,j,if(j==1,n,if(j==n+2,paves[i][n+1][3],paves[i][j-1])));\
-
 
28
  [res1,res2]\
-
 
29
};\
-
 
30
\
-
 
31
hyp_pav(v,d,eps)={\
24
hyp_pav(v,d,z0,eps)={\
32
  my(n=#v,a,b,s,s1,s2,t,t1,t2,g,gg,cd0,cd1,cdd1,cd2,r2,f1,v1,w0,z,limit);\
25
  my(n=#v,a,b,s,s1,s2,t,t1,t2,g,gg,cd0,cd1,cdd1,cd2,r2,f1,v1,w0,z,limit,centres);\
33
  if(eps>=1,limit=eps;eps=0,limit=1000);\
26
  if(eps>=1,limit=eps;eps=0,limit=1000);\
34
  r2=(1-eps)^2;\
27
  r2=(1-eps)^2;\
35
  if(!v,return(0));\
28
  if(!v,return(0));\
36
\\ Les reflexions qui engendrent W\
29
\\ Les reflexions qui engendrent W\
37
  g=vector(n,i,mob_ref(v[i],v[i%n+1]));\
30
  g=vector(n,i,mob_ref(v[i],v[i%n+1]));\
38
\
31
\
39
\\ Creation du premier pave et de son squelette\
32
\\ Creation du premier pave et de son squelette\
40
  \\ Pour chaque sommet, [arite restante, derniere arete cree, affixe, dans le disque?]\
33
  \\ Pour chaque sommet, [arite restante, derniere arete cree, affixe, type, dans le disque?]\
41
  cd2=List(vector(n,s,[d[s]-2,if(s==1,n,s),v[s],norm(v[s])<r2]));\
34
  cd2=List(vector(n,s,[d[s]-2,if(s==1,n,s),v[s],s,norm(v[s])<r2]));\
42
  \\ Pour chaque arete, [origine, extremite, type, premier polygone borde, active]\
35
  \\ Pour chaque arete, [origine, extremite, type, premier polygone borde, active?]\
43
  cd1=List(vector(n,a,[a,a%n+1,a,1,cd2[a][4]||cd2[a%n+1][4]]));\
36
  cd1=List(vector(n,a,[a,a%n+1,a,1,cd2[a][4]||cd2[a%n+1][4]]));\
44
  \\ Pour chaque arete duale [pave origine, pave extremite, arete croisee]\
37
  \\ Pour chaque arete duale [pave origine, pave extremite, arete croisee]\
45
  cdd1=List();\
38
  cdd1=List();\
46
  \\ Pour chaque pave, ses aretes et l'élément du groupe\
39
  \\ Pour chaque pave, ses aretes et l'élément du groupe\
47
  cd0=List([vector(n+1,a,if(a>n,[1,0,0],a))]);\
40
  cd0=List([vector(n+1,a,if(a>n,[1,0,0],a))]);\
48
\
41
\
49
  while(#cd0<limit&&f1<#cd1, f1+=1; v1=cd1[f1]; if(v1[5],\
42
  while(#cd0<limit&&f1<#cd1, f1+=1; v1=cd1[f1]; if(v1[5],\
50
    s=v1[3]; \\ type de l'arete (ambigu)\
43
    s=v1[3]; \\ type de l'arete (ambigu)\
51
\\  Nouveau pave et ses aretes, manquantes ou pas\
44
\\  Nouveau pave et ses aretes, manquantes ou pas\
52
    w0=vector(n+1);\
45
    w0=vector(n+1);\
53
    w0[n+1]=gg=mob_mul(cd0[v1[4]][n+1],g[s]);\
46
    w0[n+1]=gg=mob_mul(cd0[v1[4]][n+1],g[s]);\
Line 64... Line 57...
64
      w0[t2]=a=cd2[s2][2]; cd1[a][5]=0; listput(cdd1,[cd1[a][4],#cd0+1,a]);\
57
      w0[t2]=a=cd2[s2][2]; cd1[a][5]=0; listput(cdd1,[cd1[a][4],#cd0+1,a]);\
65
      s2=cd1[a][1]+cd1[a][2]-s2; t2=t2%n+1);\
58
      s2=cd1[a][1]+cd1[a][2]-s2; t2=t2%n+1);\
66
    while(t1!=t2, \\ Il y a au moins deux aretes a creer\
59
    while(t1!=t2, \\ Il y a au moins deux aretes a creer\
67
      if(s1<s2,\
60
      if(s1<s2,\
68
        z=mob(gg,v[t1]);\
61
        z=mob(gg,v[t1]);\
69
        listput(cd2,[d[t1]-1,#cd1+1,z,norm(z)<r2]);\
62
        listput(cd2,[d[t1]-1,#cd1+1,z,t1,norm(z)<r2]);\
70
        listput(cd1,[s1,#cd2,t1,#cd0+1,cd2[s1][4]||cd2[#cd2][4]]); w0[t1]=#cd1;\
63
        listput(cd1,[s1,#cd2,t1,#cd0+1,cd2[s1][5]||cd2[#cd2][5]]); w0[t1]=#cd1;\
71
        cd2[s1][1]-=1; cd2[s1][2]=#cd1; s1=#cd2; t1=(t1-2)%n+1,\
64
        cd2[s1][1]-=1; cd2[s1][2]=#cd1; s1=#cd2; t1=(t1-2)%n+1,\
72
        z=mob(gg,v[t2%n+1]);\
65
        z=mob(gg,v[t2%n+1]);\
73
        listput(cd2,[d[t2%n+1]-1,#cd1+1,z,norm(z)<r2]);\
66
        listput(cd2,[d[t2%n+1]-1,#cd1+1,z,t2%n+1,norm(z)<r2]);\
74
        listput(cd1,[s2,#cd2,t2,#cd0+1,cd2[s2][4]||cd2[#cd2][4]]); w0[t2]=#cd1;\
67
        listput(cd1,[s2,#cd2,t2,#cd0+1,cd2[s2][5]||cd2[#cd2][5]]); w0[t2]=#cd1;\
75
        cd2[s2][1]-=1; cd2[s2][2]=#cd1; s2=#cd2; t2=t2%n+1));\
68
        cd2[s2][1]-=1; cd2[s2][2]=#cd1; s2=#cd2; t2=t2%n+1));\
76
      listput(cd1,[s1,s2,t1,#cd0+1,cd2[s1][4]||cd2[s2][4]]); w0[t1]=#cd1;\
69
      listput(cd1,[s1,s2,t1,#cd0+1,cd2[s1][5]||cd2[s2][5]]); w0[t1]=#cd1;\
77
      cd2[s1][1]-=1; cd2[s1][2]=#cd1; cd2[s2][1]-=1; cd2[s2][2]=#cd1;\
70
      cd2[s1][1]-=1; cd2[s1][2]=#cd1; cd2[s2][1]-=1; cd2[s2][2]=#cd1;\
78
      listput(cd0,w0)));\
71
      listput(cd0,w0)));\
-
 
72
  centres=vector(#cd0);\
79
  for(f=1,#cd0,\
73
  for(f=1,#cd0,\
-
 
74
    w=cd0[f]; g=w[#w]; centres[f]=mob(g,z0); w[#w]=g[3];\
80
    w=cd0[f];a=cd1[w[1]];b=cd1[w[n]];\
75
    a=cd1[w[1]];b=cd1[w[n]];\
81
    s=a[1];if(s!=b[1]&&s!=b[2],s=a[2]);\
76
    s=a[1];if(s!=b[1]&&s!=b[2],s=a[2]);\
82
    for(i=1,n,a=cd1[w[i]];w[i]=s;s=a[1]+a[2]-s);\
77
    for(i=1,n,a=cd1[w[i]];w[i]=s;s=a[1]+a[2]-s);\
83
    cd0[f]=w);\
78
    cd0[f]=w);\
84
  [vector(#cd2,i,cd2[i][3]),Vec(cd0),Vec(cd1),Vec(cdd1)]\
79
  [vector(#cd2,i,cd2[i][3..4]),Vec(cd0),Vec(cd1),centres,Vec(cdd1)]\
85
};\
80
};\
86
abc(A,B,C)={\
81
abc(A,B,C)={\
87
  if (A+B+C >= Pi, return(0));\
82
  if (A+B+C >= Pi, return(0));\
88
  my(cha=(cos(A)+cos(B)*cos(C))/(sin(B)*sin(C)),\
83
  my(cha=(cos(A)+cos(B)*cos(C))/(sin(B)*sin(C)),\
89
    chb=(cos(B)+cos(A)*cos(C))/(sin(A)*sin(C)),\
84
    chb=(cos(B)+cos(A)*cos(C))/(sin(A)*sin(C)),\
90
    chc=(cos(C)+cos(B)*cos(A))/(sin(B)*sin(A)));\
85
    chc=(cos(C)+cos(B)*cos(A))/(sin(B)*sin(A)));\
91
  [sqrt((cha-1)/(cha+1)),sqrt((chb-1)/(chb+1)),sqrt((chc-1)/(chc+1))]\
86
  [sqrt((cha-1)/(cha+1)),sqrt((chb-1)/(chb+1)),sqrt((chc-1)/(chc+1))]\
92
};\
87
};\
93
tangentiel(a,centre)={\
88
tangentiel(a,auCentre)={\
94
  my(l,cs=apply(x->cos(x/2),a),\
89
  my(l,cs=apply(x->cos(x/2),a),rays=vector(1+#a),\
95
    k=solve(t=0,1,vecsum(apply(x->asin(t*x),cs))-Pi),\
90
    k=solve(t=0,1,vecsum(apply(x->asin(t*x),cs))-Pi),\
96
    R=sqrt(2/(1+k)-1), g=[1,0,0], h, res=vector(#a));\
91
    R=sqrt(2/(1+k)-1), g=[1,0,0], h, res=vector(#a));\
97
  if(centre,g=lft_fwd(lft_fwd([1,0,0],-asin(k*cs[1]),R),Pi/2,0));\
92
  if(auCentre,g=lft_fwd(lft_fwd([1,0,0],-asin(k*cs[1]),R),Pi/2,0));\
98
  for(i=1,#a,\
93
  for(i=1,#a,\
99
    l=abc(Pi/2,a[i]/2,asin(k*cs[i]))[3];\
94
    rays[i]=l=abc(Pi/2,a[i]/2,asin(k*cs[i]))[3];\
100
    g=lft_fwd(g,0,l);\
95
    g=lft_fwd(g,0,l);\
101
    res[i]=mob(g,0);\
96
    res[i]=mob(g,0);\
102
    g=lft_fwd(g,Pi-a[i],l));\
97
    g=lft_fwd(g,Pi-a[i],l));\
-
 
98
  rays[#rays]=R;\
103
  [res,R]\
99
  [res,rays]\
104
};\
100
};\
105
\
101
\
106
catalan(d,limite,centre)={\
102
catalan(d,limite,auCentre)={\
107
  my([h,R]=tangentiel(apply(x->2*Pi/x,d),centre));\
103
  my([h,rays]=tangentiel(apply(x->2*Pi/x,d),auCentre));\
-
 
104
  [hyp_pav(h,d,if(auCentre,0,rays[#rays]*I),limite),rays];\
-
 
105
};\
-
 
106
\
108
  [hyp_pav(h,d,limite),R,if(centre,0,R*I)]\
107
wims_catalan(d,limite,auCentre,option)={\
-
 
108
  my([pavage,rays]=catalan(d,limite,auCentre));\
-
 
109
  my([sommets,paves,aretes,centres,daretes]=pavage,R,z,p1,p2);\
-
 
110
  my(res0,res1,res2,res3,res4,n=#paves[1]-1,temp);\
-
 
111
  if(option==1 || option==3 ,\
-
 
112
    res1=matrix(#sommets,2,i,j,if(j==1,real(sommets[i][1]),imag(sommets[i][1])));\
-
 
113
    res0=matrix(#paves,n+2,i,j,if(j==1,n,paves[i][j-1]));\
-
 
114
    res2=List(); for(i=1,#paves,listput(res2,Vec(res0[i,])));\
-
 
115
  );\
-
 
116
  if(option==2 || option==3,\
-
 
117
    res3=matrix(#paves,2,i,j,if(j==1,real(centres[i]),imag(centres[i])));\
-
 
118
    temp=vector(#paves,i,List());\
-
 
119
    foreach(daretes,x,listput(temp[x[1]],x[2]));\
-
 
120
    res4=List();\
-
 
121
    for(i=1,#paves,if(#temp[i],listinsert(temp[i],i,1);listput(res4,Vec(temp[i])))));\
-
 
122
  [res1,Vec(res2),res3,Vec(res4)];\
109
}\
123
};\