Rev 17225 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
16886 | bpr | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
4 | slib_title=Dessin d'un patron aléatoire du polyèdre |
||
5 | slib_author=Bernadette, Perrin-Riou |
||
6 | slib_parms=2\ |
||
16889 | bpr | 7 | ,nom d'un polyèdre (en anglais comme dans la base dans wims)\ |
17096 | bpr | 8 | size=200,option as words: size=(vertical size) keywords:vertex_legend face_legend color=[general_color;number:color;number:color2;...] raw tikz html |
16886 | bpr | 9 | |
10 | slib_out=dessin en canvasdraw |
||
11 | slib_comment=Preliminary version (syntaxe can change) |
||
12 | !!rajouter option couleur face et sommet ? size ? |
||
17166 | bpr | 13 | slib_example=cube,size=300 vertex_legend face_legend html\ |
16912 | bpr | 14 | cube,html\ |
15 | cube,raw\ |
||
17224 | bpr | 16 | cube,size=300 vertex_legend face_legend tikz\ |
16912 | bpr | 17 | dodecahedron,size=500 vertex_legend face_legend color=[red] html\ |
18 | enneagonal_antiprism_dual,size=400 color=[blue;5,red;7,yellow] html\ |
||
19 | j09_elongated_pentagonal_pyramid,size=300 html\ |
||
17085 | bpr | 20 | j45_gyroelongated_square_bicupola,size=500 html\ |
17224 | bpr | 21 | j45_gyroelongated_square_bicupola,html\ |
22 | [6 8 12;0 0 1;0 1 0;-1 0 0;1 0 0;0 -1 0;0 0 -1;3,0,1,3;3,1,5,3;3,0,3,4;3,3,5,4;3,0,2,1;3,1,2,5;3,0,4,2;3,2,4,5], tikz spanning_tree=[2,6,1,2,6,8,3,8] vertex_legend face_legend\ |
||
17166 | bpr | 23 | [6,8,12;0,0,1;0,1,0;-1,0,0;1,0,0;0,-1,0;0,0,-1;3,0,1,3;3,1,5,3;3,0,3,4;3,3,5,4;3,0,2,1;3,1,2,5;3,0,4,2;3,2,4,5], html spanning_tree=[2,6,1,2,6,8,3,8] vertex_legend face_legend\ |
16886 | bpr | 24 | |
25 | !exit |
||
26 | |||
27 | :proc |
||
17224 | bpr | 28 | !reset slib_xyz slib_sfa slib_ff slib_size slib_pat slib_out |
16886 | bpr | 29 | |
30 | !distribute items $wims_read_parm into slib_polname,slib_option,slib_color |
||
31 | !set wims_multiexec=$wims_multiexec pari |
||
32 | !set slib_size=!getopt size in $slib_option |
||
17222 | bpr | 33 | !set slib_maxwhile=!getopt pseudomax in $slib_option |
16886 | bpr | 34 | !default slib_size=200 |
35 | !set slib_color=!getopt color in $slib_option |
||
36 | !set slib_color=$(slib_color[1;]) |
||
37 | !default slib_color=black |
||
16889 | bpr | 38 | !if # isin $slib_polname or [ isin $slib_polname |
17096 | bpr | 39 | !set slib_pol=!declosing $slib_polname |
17166 | bpr | 40 | !set slib_pol=!rows2lines $slib_pol |
16889 | bpr | 41 | !else |
17096 | bpr | 42 | !set slib_pol=!record 0 of data/polyedre_off/$(slib_polname).off |
16889 | bpr | 43 | !endif |
17003 | bpr | 44 | |
45 | !readproc slib/geo2D/polyoff |
||
17646 | bpr | 46 | !if $slib_header_patron= |
47 | !readproc gp/spanning_tree.gp |
||
48 | slib_pr=!exec pari $slib_header_patron |
||
49 | !endif |
||
17189 | bpr | 50 | !! define slib_facecnt in particular in polyoff |
17166 | bpr | 51 | !set slib_pat=!getopt spanning_tree in $slib_option |
52 | slib_patron=0 |
||
17222 | bpr | 53 | !default slib_maxwhile=10 |
17166 | bpr | 54 | !if $slib_pat= |
17213 | bpr | 55 | slib_cntmp=0 |
17222 | bpr | 56 | !while ($slib_patron=0 or $slib_patron=$empty or pseudonet isin $slib_patron) and $slib_cntmp<$slib_maxwhile |
17166 | bpr | 57 | !set slib_patron=!exec pari m=adjacence(ff); f2=depl_standard(ff,xyz);couv=arbre_couvrant_aleatoire(m); W=etale(couv,ff,f2[1],matsize(xyz)[1]) |
17213 | bpr | 58 | !increase slib_cntmp |
17166 | bpr | 59 | !endwhile |
17183 | bpr | 60 | !set slib_pat=!exec pari couv |
17166 | bpr | 61 | !else |
62 | !set slib_patron=!exec pari m=adjacence(ff);f2=depl_standard(ff,xyz);couv=[$slib_pat]; W=etale(couv,ff,f2[1],matsize(xyz)[1]) |
||
63 | !set slib_pat=!declosing $slib_pat |
||
17213 | bpr | 64 | !if $slib_patron=$empty |
65 | slib_patron=1 |
||
66 | !endif |
||
67 | !if $slib_patron iswordof 0 1 |
||
68 | !set slib_out=$slib_patron |
||
17183 | bpr | 69 | !goto end |
70 | !endif |
||
17166 | bpr | 71 | !endif |
17096 | bpr | 72 | !set slib_W1=!exec pari W[1] |
73 | !set slib_W2=!exec pari W[2] |
||
74 | !set slib_W2_= |
||
16886 | bpr | 75 | !if face_legend iswordof $slib_option |
76 | !for slib_j=1 to $slib_facecnt |
||
77 | !set slib_tmp=!declosing $(slib_W2[$slib_j]) |
||
78 | !set slib_W2_=!append item [$slib_tmp,$slib_j] to $slib_W2_ |
||
79 | !next |
||
80 | slib_W2=$slib_W2_ |
||
81 | !endif |
||
17224 | bpr | 82 | !set slib_raw=[$slib_W1],[$slib_W2] |
16898 | bpr | 83 | |
17224 | bpr | 84 | !if raw notwordof $slib_option |
85 | !readproc slib/geo2D/offdraw $slib_raw, $slib_option |
||
17213 | bpr | 86 | !reset slib_cntmp |
17223 | bpr | 87 | !if pseudonet isin $slib_patron |
88 | !set slib_out=pseudonet $slib_out |
||
17213 | bpr | 89 | !endif |
16912 | bpr | 90 | !endif |
17225 | bpr | 91 | !if tikz iswordof $slib_option |
92 | slib_out=$slib_raw\ |
||
93 | $slib_out |
||
94 | !endif |
||
17224 | bpr | 95 | !if raw iswordof $slib_option |
96 | !set slib_out=$slib_raw |
||
17085 | bpr | 97 | !endif |
17224 | bpr | 98 | !!now in off2draw |
99 | !!!!if tikz iswordof $slib_option |
||
100 | !!! !set slib_W1_cnt=!rowcnt $slib_W1 |
||
101 | !!! !set slib_W2_cnt=!itemcnt $slib_W2 |
||
102 | !!! !set slib_tex=\begin{center}\ |
||
103 | !!! \begin{tikzpicture}[scale=1] |
||
104 | !!! !for slib_j=1 to $slib_W2_cnt |
||
105 | !!! !set slib_k=!declosing $(slib_W2[$slib_j]) |
||
106 | !!! !set slib_tex=$slib_tex\ |
||
107 | !!! \draw($(slib_W1[$(slib_k[2])+1;1,2])) |
||
108 | !!! !for slib_s=2 to $[$(slib_k[1])+1] |
||
109 | !!! !set slib_tex=$slib_tex --($(slib_W1[$(slib_k[$slib_s])+1;1,2])) |
||
110 | !!! !next |
||
111 | !!! !set slib_tex=$slib_tex --($(slib_W1[$(slib_k[2])+1;1,2])); |
||
112 | !!! !next |
||
113 | !!! !set slib_tex=$slib_tex\ |
||
114 | !!! \end{tikzpicture}\ |
||
115 | !!!\end{center} |
||
116 | !!! !set slib_out=$slib_out\ |
||
117 | !!!$slib_tex |
||
118 | !!!!endif |
||
17183 | bpr | 119 | :end |
16886 | bpr | 120 | $slib_out |