Rev 14219 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
981 | bpr | 1 | !if $wims_read_parm!=slib_header |
13593 | bpr | 2 | !goto proc |
356 | bpr | 3 | !endif |
4 | |||
4158 | bpr | 5 | |
4351 | bpr | 6 | slib_author=Bernadette, Perrin-Riou |
4158 | bpr | 7 | |
14219 | bpr | 8 | slib_example=cuboctahedron,300,300,show=[S,A,F,BA,BF] color=[black,green,yellow,blue,red] width=[6,2] id=0\ |
9 | cube,300,300,show=[S,A,,BA,BF] color=[,green,,red,red] width=[10,10] id=2\ |
||
10 | cube,300,300,show=[S,,,BA,BF] color=[green,,,red,red] width=[10,10] id=3\ |
||
11 | triangular_prism_dual,500,700, id=4 |
||
14152 | bpr | 12 | |
13 | |||
14 | ,[SS,AA,FF,BA,BF] par exemple, ne remplir que si on veut qu'apparaissent respectivement |
||
15 | les arêtes, les faces, des boutons des arêtes, des boutons sur les faces\ |
||
14219 | bpr | 16 | [blue,red,yellow,,,],couleur dans l'ordre : des sommets, bords, faces, bouton \ |
17 | des arêtes, boutons des faces |
||
14152 | bpr | 18 | |
19 | |||
3265 | bpr | 20 | slib_require=pari |
356 | bpr | 21 | !exit |
22 | |||
23 | :proc |
||
24 | |||
14219 | bpr | 25 | !distribute items $wims_read_parm into slib_polyedre,slib_sizex,slib_sizey,slib_options |
7692 | bpr | 26 | |
14152 | bpr | 27 | !reset slib_vertex slib_face slib_edge slib_out slib_show slib_color slib_width |
356 | bpr | 28 | !!********** Traitement des options |
29 | |||
30 | slib_name_vertex=!getopt name_vertex in $slib_options |
||
31 | slib_name_face=!getopt name_face in $slib_options |
||
32 | slib_name_edge=!getopt name_edge in $slib_options |
||
14219 | bpr | 33 | slib_id=!getopt id in $slib_options |
34 | !default slib_id=!randint 100,1000 |
||
356 | bpr | 35 | slib_angle=!getopt angle in $slib_options |
36 | slib_angle=!declosing $slib_angle |
||
37 | slib_angle=!text select uvw, in $slib_angle |
||
14152 | bpr | 38 | slib_show=!getopt show in $slib_options |
39 | !default slib_show=SS,A |
||
40 | slib_color=!getopt color in $slib_options |
||
41 | !default slib_color=red,blue,green |
||
14219 | bpr | 42 | slib_wire=!getopt width in $slib_options |
43 | !default slib_wire=[0.01,0.01,0.01] |
||
359 | bpr | 44 | slib_tool=!getopt tool in $slib_options |
45 | slib_tool=!declosing $slib_tool |
||
46 | |||
47 | !default slib_tool= |
||
48 | |||
7692 | bpr | 49 | ### option pour les couleurs des faces ? |
359 | bpr | 50 | |
14152 | bpr | 51 | !!********** Lecture des données polyedre |
356 | bpr | 52 | |
14152 | bpr | 53 | slib_polyedre=!record 0 of data/polyedre_off/$slib_polyedre.off |
356 | bpr | 54 | |
14152 | bpr | 55 | slib_fichier=$[$wims_nowseconds+1].jmol |
356 | bpr | 56 | |
14219 | bpr | 57 | !readproc slib/geo3D/off2jmol $slib_polyedre,[$slib_show],[$slib_color],[$slib_wire],url, |
58 | !readproc slib/chemistry/jmolshow $(slib_out[2]),$slib_sizex,$slib_sizey,white,script "$(slib_out[1])";zoom 180,$slib_id |
||
14152 | bpr | 59 | |
60 | !exit |
||
356 | bpr | 61 | slib_H=1 |
62 | slib_u=!line 1 of $slib_polyedre |
||
63 | slib_nom=!replace internal # by $empty in $slib_u |
||
64 | !while # isin $slib_u |
||
13593 | bpr | 65 | !advance slib_H |
66 | slib_u=!line $slib_H of $slib_polyedre |
||
356 | bpr | 67 | !endwhile |
68 | |||
69 | !distribute word $slib_u into slib_vertex_cnt, slib_face_cnt, slib_edge_cnt |
||
70 | |||
71 | slib_vertex=!line $[$slib_H+1] to $[$slib_H+$slib_vertex_cnt] of $slib_polyedre |
||
72 | slib_vertex=!nonempty lines $slib_vertex |
||
73 | |||
74 | slib_edge=!line $[$slib_H+$slib_vertex_cnt+$slib_face_cnt+1] to $[$slib_H+$slib_vertex_cnt+$slib_face_cnt+$slib_edge_cnt] of $slib_polyedre |
||
75 | slib_edge=!nonempty line $slib_edge |
||
76 | |||
77 | slib_face=!line $[$slib_H+$slib_vertex_cnt+1] to $[$slib_H+$slib_vertex_cnt+$slib_face_cnt] of $slib_polyedre |
||
78 | slib_face=!nonempty line $slib_face |
||
79 | |||
80 | !for slib_option in vertex,face,edge |
||
81 | !if $(slib_name_$slib_option)!=$empty |
||
82 | slib_show_$slib_option=showname="true" |
||
83 | slib_name_$slib_option =!declosing $(slib_name_$slib_option) |
||
84 | slib_name=$(slib_name_$slib_option) |
||
85 | slib_name1_$slib_option=!makelist alias="x" for x in $(slib_name) |
||
86 | slib_show_$slib_option=!makelist showname="true" for x=1 to $(slib_$(slib_option)_cnt) |
||
13593 | bpr | 87 | !for slib_a=1 to $(slib_$(slib_option)_cnt) |
356 | bpr | 88 | !if $(slib_name[$slib_a])=$empty |
89 | slib_show_$slib_option=!replace item number $slib_a by in $(slib_show_$(slib_option)) |
||
90 | !endif |
||
91 | !next |
||
92 | !else |
||
93 | slib_show_$slib_option= |
||
94 | !endif |
||
95 | !next |
||
96 | |||
97 | !!*************programme de calcul des coordonnées de projection |
||
98 | |||
99 | slib_M=[1,0,0;0,1,0;0,0,1] |
||
100 | !if u isin $slib_angle |
||
101 | slib_M=$slib_M*[1,0,0;0,cu,-su;0,su,cu] |
||
102 | !endif |
||
103 | !if v isin $slib_angle |
||
104 | slib_M=$slib_M*[cv,0,sv;0,1,0;-sv,0,cv] |
||
105 | !endif |
||
106 | !if w isin $slib_angle |
||
107 | slib_M=$slib_M*[cw,-sw,0;sw,cw,0;0,0,1] |
||
108 | !endif |
||
109 | |||
110 | slib_prog=!exec pari {slib_rot(slib_A) =print(slib_A*($slib_M)~);} |
||
111 | |||
112 | !!********** code de dessin des sommets |
||
113 | slib_compteur_init=50 |
||
114 | slib_compteur=$slib_compteur_init |
||
115 | slib_polyedre= |
||
116 | slib_vertex1=!singlespace $slib_vertex1 |
||
117 | slib_vertex1=!lines2rows $slib_vertex |
||
118 | |||
119 | slib_vertex1=!words2items $slib_vertex1 |
||
120 | slib_vertex1=!nonempty items $slib_vertex1 |
||
121 | slib_vertex1=!replace internal ;, by ; in $slib_vertex1 |
||
122 | |||
123 | slib_coordx=!sort numeric items $(slib_vertex1[;1]) |
||
124 | slib_coordx=!nonempty items $slib_coordx |
||
125 | slib_minx=$(slib_coordx[1]) |
||
126 | slib_maxx=$(slib_coordx[-1]) |
||
127 | slib_coordy=!sort numeric items $(slib_vertex1[;2]) |
||
128 | slib_coordy=!nonempty items $slib_coordy |
||
129 | slib_miny=$(slib_coordy[1]) |
||
130 | slib_maxy=$(slib_coordy[-1]) |
||
131 | |||
132 | !reset slib_vertex1 slib_coordx slib_coordy |
||
133 | |||
134 | slib_centrex=$[($slib_minx+$slib_maxx)/2+0.2] |
||
135 | slib_centrey=$[($slib_miny+$slib_maxy)/2+0.2] |
||
136 | slib_width=$[max($slib_maxx-($slib_minx),$slib_maxy-($slib_miny))] |
||
137 | |||
138 | |||
139 | slib_prelim=<?xml version="1.0" encoding="utf-8"?>\ |
||
140 | <CaR>\ |
||
141 | <Construction>\ |
||
17173 | bpr | 142 | <Window x="$slib_centrex" y="$slib_centrey" w="$slib_width">\ |
356 | bpr | 143 | <Objects>\ |
685 | bpr | 144 | <Point name="P0" n="1" x="0" y="1" hidden="true" fixed="true"></Point>\ |
145 | <Point name="Q0" n="2" x="360" y="1" hidden="true" fixed="true"></Point>\ |
||
146 | <Segment name="s0" n="3" from="P0" to="Q0" hidden="true"></Segment> |
||
356 | bpr | 147 | |
148 | |||
149 | slib_cercle=$[$slib_centrex+0.7*$slib_width],$[$slib_centrey+0.7*$slib_width] |
||
150 | slib_ray=$[0.05*$slib_width],$[0.1*$slib_width],$[0.15*$slib_width] |
||
151 | !if u isin $slib_angle |
||
152 | slib_prelim=$slib_prelim\ |
||
13593 | bpr | 153 | <Point name="C1" n="4" x="$(slib_cercle[1])" y="$(slib_cercle[2])" hidden="true" fixed="true"></Point>\ |
154 | <Circle name="c1" n="5" fixed="$(slib_ray[1])" midpoint="C1" acute="true" hidden="true"></Circle>\ |
||
155 | <PointOn name="R1" n="6" type="thick" on="c1"></PointOn>\ |
||
156 | <Parallel name="l1" n="7" color="5" point="C1" line="s0" hidden="true"></Parallel>\ |
||
157 | <Intersection name="I1" n="8" first="l1" second="c1" which="first" hidden="true"></Intersection>\ |
||
158 | <Angle name="u" n="9" alias="rx" color="1" first="I1" root="C1" second="R1" display="large" filled="true"></Angle>\ |
||
159 | <Segment name="s1" n="10" from="C1" to="I1"></Segment>\ |
||
160 | <Segment sname="t1" n="11" from="C1" to="R1"></Segment> |
||
356 | bpr | 161 | !endif |
162 | !if v isin $slib_angle |
||
13593 | bpr | 163 | slib_prelim=$slib_prelim\ |
164 | <Point name="C2" n="12" x="$(slib_cercle[1])" y="$(slib_cercle[2])" hidden="true" fixed="true"></Point>\ |
||
165 | <Circle name="c2" n="13" fixed="$(slib_ray[2])" midpoint="C2" acute="true" hidden="true"></Circle>\ |
||
166 | <PointOn name="R2" n="14" type="thick" on="c2"></PointOn>\ |
||
167 | <Parallel name="l2" n="15" point="C2" line="s0" hidden="true"></Parallel>\ |
||
168 | <Intersection name="I2" n="16" first="l2" second="c2" which="first" hidden="true"></Intersection>\ |
||
169 | <Angle name="v" alias="ry" n="17" color="2" first="I2" root="C2" second="R2" display="large" filled="true"></Angle>\ |
||
170 | <Segment name="s2" n="18" from="C2" to="I2"></Segment>\ |
||
171 | <Segment sname="t2" n="19" from="C2" to="R2"></Segment> |
||
356 | bpr | 172 | !endif |
173 | !if w isin $slib_angle |
||
13593 | bpr | 174 | slib_prelim=$slib_prelim\ |
175 | <Point name="C3" n="20" x="$(slib_cercle[1])" y="$(slib_cercle[2])" hidden="true" fixed="true"></Point>\ |
||
176 | <Circle name="c3" n="21" fixed="$(slib_ray[3])" midpoint="C3" acute="true" hidden="true"></Circle>\ |
||
177 | <PointOn name="R3" n="22" type="thick" on="c3"></PointOn>\ |
||
178 | <Parallel name="l3" n="23" point="C3" line="s0" hidden="true"></Parallel>\ |
||
179 | <Intersection name="I3" n="24" first="l3" second="c3" which="first" hidden="true"></Intersection>\ |
||
180 | <Angle name="w" alias="rz" n="25" color="3" first="I3" root="C3" second="R3" display="large" filled="true" actw="180"></Angle>\ |
||
181 | <Segment name="s3" n="26" from="C3" to="I3"></Segment>\ |
||
182 | <Segment sname="t3" n="27" from="C3" to="R3"></Segment> |
||
356 | bpr | 183 | !endif |
184 | |||
185 | !readproc oef/togetfile.proc $slib_fichier new\ |
||
186 | $slib_prelim |
||
685 | bpr | 187 | |
356 | bpr | 188 | slib_polyedre_vertex= |
13593 | bpr | 189 | !for slib_na=1 to $slib_vertex_cnt |
190 | slib_coord=!line $slib_na of $slib_vertex |
||
191 | slib_coord=!words2items $slib_coord |
||
192 | slib_liste=u,v,w |
||
193 | slib_xyz=!exec pari print(round(100*[$slib_coord]*$slib_M)/100.) |
||
194 | !for slib_c in $slib_liste |
||
195 | slib_xyz=!mathsubst c$slib_c=cos($slib_c) in $slib_xyz |
||
196 | slib_xyz=!mathsubst s$slib_c=sin($slib_c) in $slib_xyz |
||
197 | !next |
||
198 | slib_xy=$(slib_xyz[1])*(1-($(slib_xyz[3])-($slib_Z0))/($(slib_xyz[3])-($slib_Z1))),$(slib_xyz[2])*(1-($(slib_xyz[3])-($slib_Z0))/($(slib_xyz[3])-($slib_Z1))) |
||
199 | slib_polyedre_vertex=$slib_polyedre_vertex\ |
||
200 | <Point name="$slib_compteur" $(slib_name1_vertex[$slib_na]) n="$slib_compteur" $(slib_show_vertex[$slib_na]) x="($(slib_xy[1]))" y="($(slib_xy[2]))" fixed="true"></Point> |
||
356 | bpr | 201 | !advance slib_compteur |
202 | !if $slib_na iswordof 25 50 75 100 150 |
||
203 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
204 | $slib_polyedre_vertex |
||
205 | !reset slib_polyedre_vertex |
||
206 | !endif |
||
13593 | bpr | 207 | !next slib_na |
356 | bpr | 208 | |
209 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
210 | $slib_polyedre_vertex |
||
211 | |||
212 | !!********** code de dessin des arêtes |
||
213 | slib_polyedre_segments= |
||
214 | !if $slib_edge >0 |
||
215 | !for slib_nb=1 to $slib_edge_cnt |
||
216 | slib_r=!line $slib_nb of $slib_edge |
||
7692 | bpr | 217 | slib_lien1=!word 1 of $slib_r |
356 | bpr | 218 | slib_lien2=!word 2 of $slib_r |
219 | slib_polyedre_segments=$slib_polyedre_segments\ |
||
13593 | bpr | 220 | <Segment name="$slib_compteur" $(slib_name1_edge[$slib_nb]) n="$slib_compteur" $(slib_show_edge[$slib_nb]) from="$[$slib_compteur_init+$slib_lien1]" to="$[$slib_compteur_init+$slib_lien2]"></Segment> |
356 | bpr | 221 | !advance slib_compteur |
222 | !if $slib_nb iswordof 50 100 150 |
||
223 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
224 | $slib_polyedre_segments |
||
225 | !reset slib_polyedre_segments |
||
226 | !endif |
||
227 | !next slib_nb |
||
228 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
229 | $slib_polyedre_segments |
||
230 | !endif |
||
231 | |||
7692 | bpr | 232 | !!********** code de dessin des faces |
356 | bpr | 233 | slib_polyedre_face= |
234 | !if $slib_face>0 |
||
235 | !for slib_nc=1 to $slib_face_cnt |
||
236 | slib_r=!line $slib_nc of $slib_face |
||
7692 | bpr | 237 | slib_nbcotes=!word 1 of $slib_r |
356 | bpr | 238 | slib_sommetscote= |
239 | !for slib_ns=1 to $slib_nbcotes |
||
240 | slib_numerosommetscote=!word $[1+$slib_ns] of $slib_r |
||
241 | slib_sommetscote= $slib_sommetscote point$slib_ns="$[$slib_compteur_init+$slib_numerosommetscote]" |
||
242 | !next slib_ns |
||
243 | slib_sommetscote=!nonempty items $slib_sommetscote |
||
244 | slib_polyedre_face=$slib_polyedre_face\ |
||
4726 | bpr | 245 | <Polygon name="$slib_compteur" $(slib_name1_face[$slib_nc]) color="$[$slib_compteur%5+1]" n="$slib_compteur" $(slib_show_face[$slib_nc]) $slib_sommetscote></Polygon> |
356 | bpr | 246 | !advance slib_compteur |
247 | !if $slib_nb iswordof 50 100 150 |
||
248 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
249 | $slib_polyedre_face |
||
250 | !reset slib_polyedre_face |
||
251 | !endif |
||
252 | !next slib_nc |
||
253 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
254 | $slib_polyedre_face |
||
255 | !endif |
||
256 | |||
257 | slib_fin= </Objects>\ |
||
258 | </Construction>\ |
||
259 | </CaR> |
||
260 | |||
261 | !readproc oef/togetfile.proc $slib_fichier append\ |
||
262 | $slib_fin |
||
7692 | bpr | 263 | |
1049 | bpr | 264 | slib_out=$wims_ref_name?session=$session&+cmd=getfile&+special_parm=$slib_fichier |
356 | bpr | 265 | |
6274 | bpr | 266 | slib_out=<object id="CaR" type="application/x-java-applet;jpi-version=1.4" \ |
267 | classid="java:rene.zirkel.ZirkelApplet.class" width="420px" height="420px">\ |
||
17173 | bpr | 268 | <param name="java_codebase" value="java/zirkel">\ |
269 | <param name="java_archive" value="zirkel.jar">\ |
||
270 | <param name="java_code" value="rene.zirkel.ZirkelApplet.class">\ |
||
271 | <param name="file" value="$slib_out">\ |
||
272 | <param name="color" value="244,244,242">\ |
||
273 | <param name="tools" value="move $slib_tool">\ |
||
274 | <param name="options" value="">\ |
||
275 | <param name="style" value="full">\ |
||
276 | <param name="editdigits" value="6">\ |
||
277 | <param name="displaydigits" value="2">\ |
||
6274 | bpr | 278 | Votre navigateur ne supporte pas JAVA\ |
279 | </object> |