Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-fusionjps-en.tex.svn-base
1 \def\grille{% quadrillage du plan Oxy
2     \psPoint(-5,-5,0){S1}
3     \psPoint(-5,5,0){S2}
4     \psPoint(5,5,0){S3}
5     \psPoint(5,-5,0){S4}
6 \pspolygon*[linecolor=gray!20](S1)(S2)(S3)(S4)
7 \multido{\ix=-5+1}{11}{%
8     \psPoint(\ix\space,-5,0){A}
9     \psPoint(\ix\space,5,0){B}
10     \psline(A)(B)}
11 \multido{\iy=-5+1}{11}{%
12     \psPoint(-5,\iy\space,0){A}
13     \psPoint(5,\iy\space,0){B}
14     \psline(A)(B)}
15     \psPoint(0,0,0){O}
16     \psPoint(5,0,0){X}
17     \psPoint(0,5,0){Y}
18     \psPoint(0,0,8){Z}
19     \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(X)
20     \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(Y)
21     \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(O)(Z)
22     \uput[r](X){\textcolor{blue}{$x$}}\uput[u](Y){\textcolor{blue}{$y$}}%
23     \uput[r](Z){\textcolor{blue}{$z$}}\uput[u](O){\textcolor{blue}{$O$}}}
24
25
26 \section{Fusing with \textit{jps code}}
27
28 We can also \Index{fuse solids} by passing the code directly using
29 \textit{jps code}. The calculation of the hidden parts is carried
30 out by the PostScript routines of the \texttt{solides.pro} file,
31 but the lines of code are ``encapsulated'' within a
32 \texttt{pspicture} environment thanks to the command
33 \verb+\codejps{ps code}+.
34
35 \subsection{Using \textit{jps code}}
36
37 \subsubsection{The choice of object}
38
39 \begin{compactitem}
40   \item \texttt{[section] n newanneau}: choice of a cylindrical ring defined by
41   the coordinates of the vertices of its intersection with the plane $Oyz$.
42   \item \texttt{2  1.5  6 [4  16]  newcylindre}: choice of a vertical cylinder
43 with the following parameters:
44   \begin{compactitem}
45     \item \texttt{z0=2}: the position of the base centre on the axis $Oz$;
46     \item \texttt{radius=1.5}: radius of the cylinder;
47     \item \texttt{z1=6}: the position of the top centre on the
48     axis $Oz$;
49     \item \texttt{[4 16]}: the cylinder is sliced horizontally into 4 pieces and
50 vertically into 16 sectors.
51   \end{compactitem}
52   \end{compactitem}
53
54 \subsubsection{The transformations}
55
56 \begin{compactitem}
57   \item \texttt{\{-1  2  5  translatepoint3d\} solidtransform}: the object
58 previously chosen is translated to the point with the
59 coordinates $(x=-1,y=2,z=5)$.
60   \item \texttt{\{90  0  45  rotateOpoint3d\} solidtransform}: the object
61 previously chosen is rotated around the axes $(Ox,Oy,Oz)$, in
62 this order: rotation of 90$^\mathsf{o}$ about $(Ox)$ followed
63 by a rotation of 45$^\mathsf{o}$ about $(Oz)$.
64 \end{compactitem}
65
66 \subsubsection{The choice of object colour}
67
68 \begin{compactitem}
69   \item dup (yellow) outputcolors: a yellow object illuminated in
70   white light.
71 \end{compactitem}
72
73 \subsubsection{Fusing objects}
74
75 \begin{compactitem}
76   \item The \Index{fusion} is finally made with the instruction \texttt{solidfuz}.
77 \end{compactitem}
78
79 \subsubsection{Designing objects}
80
81 \begin{compactitem}
82   \item There are three drawing options:
83   \begin{compactitem}
84     \item \texttt{drawsolid}: only draw edges; hidden edges are drawn dashed;
85     \item \texttt{drawsolid*}: draw and fill solids in their coded order (not
86     a very interesting option at first glance); hidden edges are drawn dashed;
87     \item \texttt{drawsolid**}: draw and fill solids with the
88     painting algorithm; only those parts seen by the observer are
89     drawn.
90   \end{compactitem}
91 \end{compactitem}
92 \begin{center}
93 \psset{lightsrc=50 -50 50,viewpoint=40 16 32 rtp2xyz,Decran=40}
94 \psset{unit=0.4}
95 \begin{minipage}{0.3\linewidth}
96 \begin{pspicture}(-6,-5)(6,7)
97 \psframe*[linecolor=gray!40](-6,-5)(6,7)
98 \codejps{
99 % solide 1
100  /tour {
101     -6 1.5 6 [4 16] newcylindre
102     dup (jaune) outputcolors
103     } def
104 % solide 2
105  /anneau {
106     [4 -1 4 1 3 1 3 -1] 24 newanneau
107    {0 0 -1 translatepoint3d} solidtransform
108     dup (orange) outputcolors
109     } def
110 % fusion
111     tour anneau solidfuz
112     drawsolid}
113 \end{pspicture}
114 \end{minipage}
115 \hfill
116 \begin{minipage}{0.3\linewidth}
117 \begin{pspicture}(-6,-5)(6,7)
118 \psframe*[linecolor=gray!40](-6,-5)(6,7)
119 \codejps{
120 % solide 1
121  /tour {
122     -6 1.5 6 [4 16] newcylindre
123     dup (jaune) outputcolors
124     } def
125 % solide 2
126  /anneau {
127     [4 -1 4 1 3 1 3 -1] 24 newanneau
128    {0 0 -1 translatepoint3d} solidtransform
129     dup (orange) outputcolors
130     } def
131 % fusion
132     tour anneau solidfuz
133     drawsolid*}
134 \end{pspicture}
135 \end{minipage}
136 \hfill
137 \begin{minipage}{0.3\linewidth}
138 \begin{pspicture}(-6,-5)(6,7)
139 \psframe*[linecolor=gray!40](-6,-5)(6,7)
140 \codejps{
141 % solide 1
142  /tour {
143     -6 1.5 6 [4 16] newcylindre
144     dup (jaune) outputcolors
145     } def
146 % solide 2
147  /anneau {
148     [4 -1 4 1 3 1 3 -1] 24 newanneau
149    {0 0 -1 translatepoint3d} solidtransform
150     dup (orange) outputcolors
151     } def
152 % fusion
153     tour anneau solidfuz
154     drawsolid**}
155 \psPoint(0,0,8){Z}
156 \psPoint(0,0,6){Z'}
157 \psline[arrowsize=0.3,arrowinset=0.2]{->}(Z')(Z)
158 \uput[u](Z){$z$}
159 \end{pspicture}
160 \end{minipage}
161 \end{center}
162
163 \begin{verbatim}
164 \psset{lightsrc=50 -50 50,viewpoint=50 20 50 rtp2xyz,Decran=50}
165 \begin{pspicture}(-6,-2)(6,8)
166 \psframe(-6,-2)(6,8)
167 \codejps{
168 % solide 1
169     /tour{
170       -6 1.5 6 [4 16] newcylindre
171       dup (jaune) outputcolors
172     } def
173 % solide 2
174     /anneau{
175       [4 -1 4 1 3 1 3 -1] 24 newanneau
176       {0 0 -1 translatepoint3d} solidtransform
177       dup (orange) outputcolors
178     } def
179 % fusion
180     tour anneau solidfuz
181     drawsolid**}
182 \end{pspicture}
183 \end{verbatim}
184
185 \newpage
186
187 \subsection{A \Index{chloride ion}}
188 \begin{LTXexample}[width=6cm]
189 \begin{pspicture}(-3,-4)(3,4)
190 \psset{lightsrc=100 -50 -10,lightintensity=3,viewpoint=200 20 10 rtp2xyz,Decran=20}
191 {\psset{linewidth=0.5\pslinewidth}
192 \codejps{/Cl {9.02  [18 16] newsphere
193 {-90 0 0 rotateOpoint3d} solidtransform
194  dup (Green) outputcolors} def
195 /Cl1 { Cl {10.25 10.25 10.25 translatepoint3d} solidtransform } def
196 /Cl2 { Cl {10.25 -10.25 10.25 translatepoint3d} solidtransform } def
197 /Cl3 { Cl {-10.25 -10.25 10.25 translatepoint3d} solidtransform } def
198 /Cl4 { Cl {-10.25 10.25 10.25 translatepoint3d} solidtransform } def
199 /Cl5 { Cl {10.25 10.25 -10.25 translatepoint3d} solidtransform } def
200 /Cl6 { Cl {10.25 -10.25 -10.25 translatepoint3d} solidtransform } def
201 /Cl7 { Cl {-10.25 -10.25 -10.25 translatepoint3d} solidtransform } def
202 /Cl8 { Cl {-10.25 10.25 -10.25 translatepoint3d} solidtransform } def
203 /Cs {8.38  [18 16] newsphere
204  dup (White) outputcolors} def
205 /Cl12{ Cl1 Cl2 solidfuz} def
206 /Cl123{ Cl12 Cl3 solidfuz} def
207 /Cl1234{ Cl123 Cl4 solidfuz} def
208 /Cl12345{ Cl1234 Cl5 solidfuz} def
209 /Cl123456{ Cl12345 Cl6 solidfuz} def
210 /Cl1234567{ Cl123456 Cl7 solidfuz} def
211 /Cl12345678{ Cl1234567 Cl8 solidfuz} def
212 /C_Cs { Cl12345678 Cs solidfuz} def
213 C_Cs  drawsolid**}}%
214 \psPoint(0,0,0){P}
215 \psPoint(10.25,10.25,10.25){Cl1}
216 \psPoint(10.25,-10.25,10.25){Cl2}
217 \psPoint(-10.25,-10.25,10.25){Cl3}
218 \psPoint(-10.25,10.25,10.25){Cl4}
219 \psPoint(10.25,10.25,-10.25){Cl5}
220 \psPoint(10.25,-10.25,-10.25){Cl6}
221 \psPoint(-10.25,-10.25,-10.25){Cl7}
222 \psPoint(-10.25,10.25,-10.25){Cl8}
223 \pspolygon[linestyle=dashed](Cl1)(Cl2)(Cl3)(Cl4)
224 \pspolygon[linestyle=dashed](Cl5)(Cl6)(Cl7)(Cl8)
225 \psline[linestyle=dashed](Cl2)(Cl6)
226 \psline[linestyle=dashed](Cl3)(Cl7)
227 \psline[linestyle=dashed](Cl1)(Cl5)
228 \psline[linestyle=dashed](Cl4)(Cl8)
229 \pcline[offset=0.5]{<->}(Cl2)(Cl1)
230 \aput{:U}{a}
231 \pcline[offset=0.5]{<->}(Cl6)(Cl2)
232 \aput{:U}{a}
233 \end{pspicture}
234 \end{LTXexample}
235
236 We define the chloride ion $\mathrm{Cl^-}$:
237 \begin{verbatim}
238 /Cl {9.02  [12 8] newsphere
239  {-90 0 0 rotateOpoint3d} solidtransform
240  dup (Green) outputcolors} def
241 \end{verbatim}
242 which we shift to each vertex of a cube:
243 \begin{verbatim}
244 /Cl1 { Cl {10.25 10.25 10.25 translatepoint3d} solidtransform } def
245 /Cl2 { Cl {10.25 -10.25 10.25 translatepoint3d} solidtransform } def
246 /Cl3 { Cl {-10.25 -10.25 10.25 translatepoint3d} solidtransform } def
247 /Cl4 { Cl {-10.25 10.25 10.25 translatepoint3d} solidtransform } def
248 /Cl5 { Cl {10.25 10.25 -10.25 translatepoint3d} solidtransform } def
249 /Cl6 { Cl {10.25 -10.25 -10.25 translatepoint3d} solidtransform } def
250 /Cl7 { Cl {-10.25 -10.25 -10.25 translatepoint3d} solidtransform } def
251 /Cl8 { Cl {-10.25 10.25 -10.25 translatepoint3d} solidtransform } def
252 \end{verbatim}
253 Then a caesium ion $\mathrm{Cs^+}$ is placed in the center:
254 \begin{verbatim}
255 /Cs {8.38  [12 8] newsphere
256  dup (White) outputcolors} def
257 \end{verbatim}
258 Finally we fuse the separate spheres in pairs.
259
260 \vfill
261
262
263 \subsection{A prototype of a \Index{vehicle}}
264 \begin{center}
265 \psset{lightsrc=100 0 100,viewpoint=25 10 10,Decran=30}
266 \begin{pspicture}(-6,-4)(6,8)
267 \pstVerb{/Pneu {
268    /m {90 4 div} bind def
269    /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
270    /Z0 {h 4 div} bind def
271    /c {Z0 Scos div} bind def
272    /Z1 {Z0 c m cos mul add} bind def
273    /Z2 {Z1 c m 2 mul cos mul add} bind def
274    /R1 {R c m sin mul sub} bind def
275    /R2 {R1 c m 2 mul sin mul sub} bind def
276    /R3 {R2 c m 3 mul sin mul sub} bind def
277    R h 4 div neg % 1
278    R h 4 div % 2
279    R1 Z1 % 3
280    R2 Z2 % 4
281    R3 h 2 div % 5
282    r h 2 div  % 6
283    r h 2 div neg  % 7
284    R3 h 2 div neg % 8
285    R2 Z2 neg % 9
286    R1 Z1 neg % 10
287    } def}%
288 \grille
289 \codejps{
290 /roue12 {
291 % solide 1
292     /R 2 def /r 1 def /h 1 def
293     [Pneu] 36 newanneau
294      {90 0 90 rotateOpoint3d} solidtransform
295      {3 4 2 translatepoint3d} solidtransform
296      dup (White) outputcolors
297 % solide 2
298     [Pneu] 36 newanneau
299     {90 0 90 rotateOpoint3d} solidtransform
300    {-3 4 2 translatepoint3d} solidtransform
301     dup (White) outputcolors
302 % fusion
303     solidfuz } def
304 /axe12{
305 0 0.1 6 [4 16] newcylindre
306 {90 0 90 rotateOpoint3d} solidtransform
307 {-3 4 2  translatepoint3d} solidtransform
308 dup (White) outputcolors
309 } def
310 /roue12axes {
311 roue12 axe12 solidfuz } def
312 /roue34 {
313 % solide 3
314    /R 1.5 def /r 1 def /h 1 def
315     [Pneu] 36 newanneau
316     {90 0 110 rotateOpoint3d} solidtransform
317    {3 -4 1.5 translatepoint3d} solidtransform
318     dup (White) outputcolors
319 % solide 4
320     [Pneu] 36 newanneau
321    {90 0 110 rotateOpoint3d} solidtransform
322    {-3 -4 1.5 translatepoint3d} solidtransform
323     dup (White) outputcolors
324 % fusion
325     solidfuz } def
326 /axe34{
327 0 0.1 6  [16 16] newcylindre
328 {90 0 90 rotateOpoint3d} solidtransform
329 {-3 -4 1.5  translatepoint3d} solidtransform
330 dup (White) outputcolors
331 } def
332 /roue34axes34 {
333 roue34 axe34 solidfuz } def
334 /roues {roue34axes34 roue12axes solidfuz} def
335 /chassis {
336 0 1 8  [4 16] newcylindre
337 {100 0 0 rotateOpoint3d} solidtransform
338 {0 4 2.5  translatepoint3d} solidtransform
339 dup (White) outputcolors
340 } def
341 roues chassis solidfuz
342     drawsolid**}
343 \psPoint(0,0,2.7){Z'}
344 \psline[arrowsize=0.3,arrowinset=0.2,linecolor=blue]{->}(Z')(Z)
345 \end{pspicture}
346 \end{center}
347 We have to operate in several steps to fuse the solids in pairs:
348 \begin{compactitem}
349   \item We first fuse the two front wheels \texttt{roue12}:
350   \begin{verbatim}
351 /roue12 {
352 % solide 1
353     /R 2 def /r 1 def /h 1 def
354     [Pneu] 36 newanneau
355      {90 0 90 rotateOpoint3d} solidtransform
356      {3 4 2 translatepoint3d} solidtransform
357      dup (White) outputcolors
358 % solide 2
359     [Pneu] 36 newanneau
360     {90 0 90 rotateOpoint3d} solidtransform
361    {-3 4 2 translatepoint3d} solidtransform
362     dup (White) outputcolors
363 % fusion
364     solidfuz } def
365   \end{verbatim}
366   \item Then the two wheels and their axis:
367   \begin{verbatim}
368 /axe12{
369 0 0.1 6  [4 16] newcylindre
370 {90 0 90 rotateOpoint3d} solidtransform
371 {-3 4 2  translatepoint3d} solidtransform
372 dup (White) outputcolors
373 } def
374 /roue12axes {
375 roue12 axe12 solidfuz } def
376 \end{verbatim}
377   \item After that the rear wheels and their axis:
378   \begin{verbatim}
379 /roue34 {
380 % solide 3
381    /R 1.5 def /r 1 def /h 1 def
382     [Pneu] 36 newanneau
383     {90 0 110 rotateOpoint3d} solidtransform
384    {3 -4 1.5 translatepoint3d} solidtransform
385     dup (White) outputcolors
386 % solide 4
387     [Pneu] 36 newanneau
388    {90 0 110 rotateOpoint3d} solidtransform
389    {-3 -4 1.5 translatepoint3d} solidtransform
390     dup (White) outputcolors
391 % fusion
392     solidfuz } def
393 /axe34{
394 0 0.1 6 [16 16] newcylindre
395 {90 0 90 rotateOpoint3d} solidtransform
396 {-3 -4 1.5  translatepoint3d} solidtransform
397 dup (White) outputcolors
398 } def
399 /roue34axes34 {
400 roue34 axe34 solidfuz } def
401 \end{verbatim}
402
403 \item Then fuse the two wheel assemblies:
404 \begin{verbatim}
405 /roues {roue34axes34 roue12axes solidfuz} def
406 \end{verbatim}
407
408 \item The final step is to fuse the previously generated solid with
409 the chassis:
410 \begin{verbatim}
411 /chassis {
412 0 1 8  [4 16] newcylindre
413 {100 0 0 rotateOpoint3d} solidtransform
414 {0 4 2.5  translatepoint3d} solidtransform
415 dup (White) outputcolors
416 } def
417 roues chassis solidfuz
418     drawsolid**}
419 \end{verbatim}
420 \end{compactitem}
421
422
423 \subsection{A \Index{wheel} -- or a space station}
424
425 \begin{center}
426 \begin{pspicture}(-6,-5)(6,6)
427 \psset{lightsrc=50 -50 50,viewpoint=40 50 60,Decran=60,linewidth=0.5\pslinewidth}
428 %\psframe*[linecolor=black](-6,-5)(6,5)
429 \codejps{
430  /rayon0 {
431      1 0.2 6 [4 16] newcylindre
432      {90 0 0 rotateOpoint3d} solidtransform
433       dup (White) outputcolors
434    } def
435 36 36 360 {
436     /angle exch def
437   /rayon1 {
438      1 0.2 6  [4 16] newcylindre
439      {90 0 angle rotateOpoint3d} solidtransform
440       dup (White) outputcolors
441    } def
442   /rayons {rayon0 rayon1 solidfuz} def
443   /rayon0 rayons def
444   } for
445  /moyeu { -2 1 2  [4 10] newcylindre dup (jaune) outputcolors} def
446  /rayonsmoyeu {rayons  moyeu solidfuz} def
447  /pneu {2 7 [18 36] newtore dup (White) outputcolors} def
448  /ROUE {pneu rayonsmoyeu solidfuz} def
449   ROUE  drawsolid**}
450 \end{pspicture}
451 \end{center}
452 We define the first spoke:
453 \begin{verbatim}
454  /rayon0 {
455      1 0.2 6 [4 16] newcylindre
456      {90 0 0 rotateOpoint3d} solidtransform
457       dup (White) outputcolors
458    } def
459 \end{verbatim}
460 Then, with a loop, we fuse all the spokes of the wheel:
461 \begin{verbatim}
462 36 36 360 {
463     /angle exch def
464   /rayon1 {
465      1 0.2 6  [4 16] newcylindre
466      {90 0 angle rotateOpoint3d} solidtransform
467       dup (White) outputcolors
468    } def
469   /rayons {rayon0 rayon1 solidfuz} def
470   /rayon0 rayons def
471   } for
472 \end{verbatim}
473 After that, we draw the hub and the tyre of the wheel, and finally
474 fuse all of them:
475 \begin{verbatim}
476  /moyeu { -0.5 1 0.5  [4 10] newcylindre dup (White) outputcolors} def
477  /rayonsmoyeu {rayons  moyeu solidfuz} def
478  /pneu {2 7 [18 36] newtore dup (jaune) outputcolors} def
479  /ROUE {pneu rayonsmoyeu solidfuz} def
480   ROUE  drawsolid**
481 \end{verbatim}
482
483
484 \subsection{Intersection of two cylinders}
485
486 \begin{LTXexample}[width=8cm]
487 \begin{pspicture}(-4,-3)(6,3)
488 \psset{lightsrc=50 -50 50,viewpoint=100 -30
489 40,Decran=100,linewidth=0.5\pslinewidth, unit=0.5}
490 \codejps{
491  /cylindre1 {
492      -6 2 6 [36 36] newcylindrecreux %newcylindre
493      {90 0 0 rotateOpoint3d} solidtransform
494       dup (Yellow) (White) inoutputcolors
495    } def
496  /cylindre2 {
497      -6 2 6 [36 36] newcylindrecreux %newcylindre
498      {90 0 90 rotateOpoint3d} solidtransform
499       dup (Yellow) (White) inoutputcolors
500    } def
501  /UnionCylindres {cylindre1 cylindre2 solidfuz} def
502   UnionCylindres  drawsolid**}
503 \end{pspicture}
504 \end{LTXexample}
505
506
507 \subsection{Intersection between a sphere and a cylinder}
508
509 This time we draw the curve of intersection using
510 \verb+\psSolid[object=courbe]+.
511
512 \begin{LTXexample}[width=8cm]
513 \psset{unit=0.5,lightsrc=50 -50 50,viewpoint=100 0 0 rtp2xyz,Decran=110,linewidth=0.5\pslinewidth}
514 \begin{pspicture}(-7,-6)(5,6)
515 \defFunction{F}(t){t cos dup mul 5 mul}{t cos t sin mul 5 mul}{t sin 5 mul}
516 \codejps{%
517    /cylindre1 {
518        -5 2.5 5 [36 36] newcylindre
519        {2.5 0 0 translatepoint3d} solidtransform
520         dup (White) outputcolors
521    } def
522    /sphere1 {
523         5 [36 72] newsphere
524         dup (White) outputcolors
525    } def
526    /CS {cylindre1 sphere1 solidfuz} def
527    CS drawsolid**}
528 \psPoint(0,0,0){O}
529 \psSolid[object=courbe,r=0,
530    function=F,
531    range=0 360,
532    linecolor=red,linewidth=4\pslinewidth]
533 \end{pspicture}
534 \end{LTXexample}
535
536
537 \subsection{Two linked \Index{rings}}
538
539 \begin{LTXexample}[width=8cm]
540 \begin{pspicture}(-5,-4)(3,3)
541 \psset{lightsrc=50 50 50,viewpoint=40 50 60,Decran=30,unit=0.85}
542 \codejps{
543  /anneau1 {1 7 [12 36] newtore
544  {0 0 0 translatepoint3d} solidtransform
545  dup (Yellow) outputcolors} def
546  /anneau2 {1 7 [12 36] newtore
547  {90 0 0 rotateOpoint3d} solidtransform
548  {7 0 0 translatepoint3d} solidtransform
549  dup (White) outputcolors} def
550  /collier {anneau1 anneau2 solidfuz} def
551   collier  drawsolid**}
552 \end{pspicture}
553 \end{LTXexample}
554
555
556
557 \subsection{The \Index{methane molecule}: wooden model}
558
559 \begin{LTXexample}[width=8cm]
560 \begin{pspicture}(-4.5,-4)(3.2,5)
561 \psset{lightsrc=50 50 10,lightintensity=2,viewpoint=100 50 20 rtp2xyz,
562 Decran=30}
563 \psset{linecolor={[cmyk]{0,0.72,1,0.45}},linewidth=0.5\pslinewidth,
564   unit=1}
565 %\psframe[fillstyle=solid,fillcolor=green!20](-4,-4)(3.2,5)
566 \pstVerb{/hetre {0.764 0.6 0.204 setrgbcolor} def
567          /chene {0.568 0.427 0.086 setrgbcolor} def
568          /bois {0.956 0.921 0.65 setrgbcolor} def
569          }%
570 \codejps{
571  /H1 {
572  2  [18 16] newsphere
573  {-90 0 0 rotateOpoint3d} solidtransform
574  {0 10.93 0 translatepoint3d} solidtransform
575  dup (hetre) outputcolors} def
576   /L1 {
577      0 0.25 10  [12 10] newcylindre
578      {-90 0 0 rotateOpoint3d} solidtransform
579       dup (bois) outputcolors
580    } def
581 /HL1{ H1 L1  solidfuz} def
582 /HL2 { HL1 {0 0 -109.5 rotateOpoint3d} solidtransform } def
583 /HL3 { HL2 {0 -120 0 rotateOpoint3d} solidtransform } def
584 /HL4 { HL2 {0 120 0 rotateOpoint3d} solidtransform } def
585  /C {3  [18 16] newsphere
586   {90 0 0 rotateOpoint3d} solidtransform
587    dup (chene) outputcolors} def
588 /HL12 { HL1 HL2 solidfuz} def
589 /HL123 { HL12 HL3 solidfuz} def
590 /HL1234 { HL123 HL4 solidfuz} def
591 /methane { HL1234 C solidfuz} def
592   methane  drawsolid**}
593 \end{pspicture}
594 \end{LTXexample}
595
596
597 \subsection{The \Index{thiosulphate ion}}
598
599 \begin{center}
600 \begin{pspicture}(-4,-3)(4.5,5.5)
601 \psset{lightsrc=100 10 -20,lightintensity=3,viewpoint=200 30
602 20 rtp2xyz,Decran=40}
603 %\psframe(-4,-3)(4.5,5.5)
604 {\psset{linewidth=0.5\pslinewidth}
605 \codejps{
606 /Soufre1 {3.56  [20 16] newsphere
607  dup (Yellow) outputcolors} def
608 /Soufre2 {3.56  [20 16] newsphere
609  {0 0.000 20.10 translatepoint3d} solidtransform
610  dup (Yellow) outputcolors} def
611 % Liaison simple
612 /LiaisonR {
613      7.5 0.5 15  [10 10] newcylindre
614       dup (Red) outputcolors
615    } def
616 /LiaisonY {
617      0 0.5 7.5  [10 10] newcylindre
618       dup (Yellow) outputcolors
619    } def
620 % fin Liaison simple
621 /Liaison{LiaisonR LiaisonY solidfuz} def
622 /Ox {2.17  [20 16] newsphere
623      {0 0 15 translatepoint3d} solidtransform
624      dup (Red) outputcolors} def
625 /LO { Liaison Ox solidfuz} def
626 /LO1 { LO  {0 -109.5 0 rotateOpoint3d} solidtransform } def
627 /LOx1 { LO1  {0 0 120 rotateOpoint3d} solidtransform } def
628 % fin liaison simple S-O
629 % Liaison double S=O
630 /LiaisonD1 {Liaison {-0.75 0 0 translatepoint3d} solidtransform} def
631 /LiaisonD2 {Liaison {0.75 0 0 translatepoint3d} solidtransform} def
632 /LiaisonDD { LiaisonD1 LiaisonD2 solidfuz} def
633 /LiaisonDOx {LiaisonDD Ox solidfuz} def
634 /LiaisonDOx1 {LiaisonDOx {0 -109.5 0 rotateOpoint3d} solidtransform } def
635 /LiaisonDOx2 {LiaisonDOx1 {0  0 -120 rotateOpoint3d} solidtransform } def
636 /LO12 { LiaisonDOx1 LiaisonDOx2 solidfuz} def
637 /LO123 {LO12 LOx1 solidfuz} def
638 % liaison simple S-S
639 /L4 { 0 0.5 20.10  [16 10] newcylindre
640       dup (Yellow) outputcolors
641     } def
642 /S1L4{ Soufre1 L4 solidfuz} def
643 /S1S2L4{ S1L4 Soufre2 solidfuz} def
644 /S2O3 { S1S2L4 LO123 solidfuz} def
645 S2O3  drawsolid**}
646 \axesIIID(0,0,0)(25,20,25)}
647 \psPoint(0,0,20.1){S2}
648 \psPoint(-14.14,0,-5){O1}
649 \psPoint(7.07,-12.24,-5 ){O2}
650 \psPoint(7.07,12.24,-5 ){O3}
651 \pcline[linestyle=dotted]{<->}(O2)(O)
652 \aput{:U}{15 pm}
653 \pcline[linestyle=dotted]{<->}(O)(S2)
654 \aput{:U}{\small 20,1 pm}
655 \pcline[linestyle=dotted]{<->}(O2)(O3)
656 \lput*{:U}{\small 24,5 pm}
657 \pcline[linestyle=dotted]{<->}(O2)(S2)
658 \lput*{:U}{\small 28,8 pm}
659 \pstMarkAngle[arrows=<->,MarkAngleRadius=0.8,linestyle=dotted]{O2}{O}{O3}{\footnotesize 109,4$^{\mathrm{o}}$}
660 \pstMarkAngle[arrows=<->,MarkAngleRadius=0.8,linestyle=dotted]{O1}{O}{S2}{\footnotesize 109,5$^{\mathrm{o}}$}
661 \rput(0,-2.5){$\mathrm{S_2^{\phantom{2}}O_3^{2-}}$}
662 \end{pspicture}
663 \end{center}
664
665 We first define the two sulphur atoms and place them on the $Oz$
666 axis. $\mathrm{S_1}$ is placed at the origin $O$.
667 \begin{verbatim}
668 \codejps{
669 /Soufre1 {3.56  [20 16] newsphere
670  dup (Yellow) outputcolors} def
671 /Soufre2 {3.56  [20 16] newsphere
672  {0 0.000 20.10 translatepoint3d} solidtransform
673  dup (Yellow) outputcolors} def
674 \end{verbatim}
675 Then the single bond \textsf{S-O} using the following convention:
676 half red---the half connected to \textsf{O}, and half yellow---the half connected to \textsf{S}.
677 \begin{verbatim}
678 /LiaisonR {
679      7.5 0.5 15  [10 10] newcylindre
680       dup (Red) outputcolors
681    } def
682 /LiaisonY {
683      0 0.5 7.5  [10 10] newcylindre
684       dup (Yellow) outputcolors
685    } def
686 /Liaison{LiaisonR LiaisonY solidfuz} def
687 \end{verbatim}
688 The oxygen atom, its bond, and the setting of the combined unit:
689 \begin{verbatim}
690 /Ox {2.17  [20 16] newsphere
691      {0 0 15 translatepoint3d} solidtransform
692      dup (Red) outputcolors} def
693 /LO { Liaison Ox solidfuz} def
694 /LO1 { LO  {0 -109.5 0 rotateOpoint3d} solidtransform } def
695 /LOx1 { LO1  {0 0 120 rotateOpoint3d} solidtransform } def
696 % fin liaison simple S-O
697 \end{verbatim}
698 For the double bond \textsf{S=O}, we take the single bond above
699 and duplicate it with shifts of 0.75~cm along the $Ox$ axis.
700 \begin{verbatim}
701 % Liaison double S=O
702 /LiaisonD1 {Liaison {-0.75 0 0 translatepoint3d} solidtransform} def
703 /LiaisonD2 {Liaison {0.75 0 0 translatepoint3d} solidtransform} def
704 /LiaisonDD { LiaisonD1 LiaisonD2 solidfuz} def
705 \end{verbatim}
706 Connecting it to the \textsf{O} atom:
707 \begin{verbatim}
708 /LiaisonDOx {LiaisonDD Ox solidfuz} def
709 \end{verbatim}
710 and with two successive rotations we position the two bonds
711 \textsf{=O}:
712 \begin{verbatim}
713 /LiaisonDOx1 {LiaisonDOx {0 -109.5 0 rotateOpoint3d} solidtransform } def
714 /LiaisonDOx2 {LiaisonDOx1 {0  0 -120 rotateOpoint3d} solidtransform } def
715 \end{verbatim}
716 The following step consists of fusing the two connections:
717 \begin{verbatim}
718 /LO12 { LiaisonDOx1 LiaisonDOx2 solidfuz} def
719 /LO123 {LO12 LOx1 solidfuz} def
720 \end{verbatim}
721 Then the single bond \textsf{S-S} is created:
722 \begin{verbatim}
723 % liaison simple S-S
724 /L4 { 0 0.5 20.10  [16 10] newcylindre
725       dup (Yellow) outputcolors
726     } def
727 \end{verbatim}
728 and fused with the two atoms \textsf{S-S}:
729 \begin{verbatim}
730 /S1L4{ Soufre1 L4 solidfuz} def
731 /S1S2L4{ S1L4 Soufre2 solidfuz} def
732 \end{verbatim}
733 The last step will be to fuse the two \textsf{S-S} and the three
734 \textsf{O} already equipped with their bonds:
735 \begin{verbatim}
736 /S2O3 { S1S2L4 LO123 solidfuz} def
737 S2O3  drawsolid**}
738 \end{verbatim}
739
740 \endinput

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.