Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-anneaux-en.tex.svn-base
1
2 \section{Solid rings}
3
4 This paragraph discusses the cylindric \Index{rings}. Within the macro
5 \Lcs{psSolid}, this object is passed with the option:
6 \texttt{\Lkeyword{object}=\Lkeyval{anneau}}, that comes with 3 parameters:
7 \begin{compactitem}
8   \item the inner radius \texttt{\Lkeyword{r}=1.5} (value by default);
9   \item the outer radius \texttt{\Lkeyword{R}=4} (value by default);
10   \item the height \texttt{\Lkeyword{h}=6} (value by default).
11 \end{compactitem}
12
13 The argument \Lkeyword{ngrid} defines the number of sections used to make a complete
14 rotation of $360$~degrees. Its default value is $24$.
15
16 The section of the ring, whose shape is \textit{rectangular} was chosen as default,
17 and can be redesigned by the user.
18 We will discuss different examples of sections for rings.
19
20 \subsection{Predefined command: the ring with a rectangular section}
21
22 This section is defined in the plane $Oyz$, it is parameterized with the
23 triple $(r, R, h)$. The values of the outer radius $R$, inner radius $r$ and the
24 height $h$ are passed in the macro \Lcs{psSolid}. By default, one has a ring with
25 a variable rectangular section, and the definition takes place at the time
26 of the transmission of the values $(r, R, h)$ into the options of \Lcs{psSolid}.
27
28 If the user redefines the \TeX {} macro \verb+\Section+ with some numeric values
29 instead of the  parameters $r$, $R$ and $h$, then
30 the ring won't be variable anymore  and it is not necessary to transmit the
31 values  $r$, $R$, and $h$ into the options of \Lcs{psSolid}.
32
33 \begin{minipage}{0.45\linewidth}
34 \begin{verbatim}
35 \newcommand\Section{%
36 % y z
37   R h 2 div neg % sommet 1
38   % S1 (R,-h/2)
39   R h 2 div     % sommet 2
40   % S2 (r,h/2)
41   r h 2 div     % sommet 3
42   % S3 (r,h/2)
43   r h 2 div neg % sommet 4
44   % S4 (r,-h/2)
45             }
46 \end{verbatim}
47 \end{minipage}
48 \hfill
49 \begin{minipage}{0.45\linewidth}
50 \psset{unit=0.5}
51 \begin{pspicture}(-5,-3)(5,3)
52 \pstVerb{/R 4 def /r 2 def /h 2 def}%
53 \newcommand\RectangularSection{%
54    \pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
55    (!R h 2 div neg)(!R h 2 div)(!r h 2 div)(!r h 2 div neg)}
56 \rput(0,0){\RectangularSection}\rput(-6,0){\RectangularSection}
57 \psline(-2,1)(2,1)\psline(-2,-1)(2,-1)
58 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
59 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)
60 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
61 \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
62 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
63 \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
64 \uput[dr](!R h 2 div neg){1}
65 \uput[ur](!R h 2 div ){2}
66 \uput[ul](!r h 2 div ){3}
67 \uput[dl](!r h 2 div neg){4}
68 \end{pspicture}
69 \end{minipage}
70 \newpage
71 \begin{LTXexample}[width=6cm]
72 \psset{unit=0.5}
73 \begin{pspicture}(-5,-4)(5,4)
74 \psset[pst-solides3d]{viewpoint=50 20 40 rtp2xyz,
75   Decran=25,lightsrc=10 20 20}
76 \psSolid[object=anneau,fillcolor=cyan,
77   h=3,R=8,r=6,ngrid=4,RotX=10](0,0,0)
78 \end{pspicture}\\
79 \begin{pspicture}(-5,-4)(5,4)
80 \psset[pst-solides3d]{viewpoint=50 -20 -40 rtp2xyz,
81   Decran=25,lightsrc=-10 -20 -20}
82 \psSolid[object=anneau,
83 fillcolor=yellow,h=3,R=8,r=6,
84 RotX=90,RotZ=10](0,0,0)
85 \end{pspicture}
86 \end{LTXexample}
87
88
89
90 \subsection{Example 1: a simple ring with a triangular section}
91
92 Below is a very simple ring with a fixed triangular section.
93  The section is defined by $3$~points $(6, -2)$, $(10, 0)$
94 and $(6, 2)$ within the option \Lkeyword{section} of \Lcs{psSolid}.
95
96 \begin{LTXexample}[width=6cm]
97 \psset{unit=0.5}
98 \begin{pspicture}(-5,-6)(5,6)
99 \psset[pst-solides3d]{viewpoint=50 20 40 rtp2xyz,Decran=25,
100    lightsrc=10 20 20}
101 \psSolid[object=anneau,
102    section=6 -2 10 0 6 2,
103    fillcolor=cyan,RotX=10]%
104 \end{pspicture}
105 \end{LTXexample}
106
107 %\newpage
108
109 \subsection{Example 2: a ring with a variable triangular section}
110
111 \newcommand\SectionTriangulaire{
112          R h 2 div neg % sommet 1
113          R r add 2 div h 2 div % sommet 2
114          r h 2 div neg % sommet 3
115 }
116
117 \begin{minipage}{0.45\linewidth}
118 \begin{verbatim}
119 \newcommand\SectionTriangulaire{
120 % y <----z---->
121   R h 2 div neg
122   % S1 (R,-h/2)
123   R r add 2 div h 2 div
124   % S2 ((R+r)/2,h/2)
125   r h 2 div neg
126   % S3 (r,-h/2)
127 }
128 \end{verbatim}
129 \end{minipage}
130 \hfill
131 \begin{minipage}{0.45\linewidth}
132 \psset{unit=0.5}
133 \begin{pspicture}(-5,-3)(5,3)
134 %\psgrid
135 \pstVerb{/R 4 def /r 2 def /h 2 def}%
136 \newcommand\TriangularSection{%
137    \pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
138    (!R h 2 div neg)(!R r add 2 div h 2 div)(!r h 2 div neg)}
139 \rput(0,0){\TriangularSection}\rput(-6,0){\TriangularSection}
140 \psline(-3,1)(3,1)\psline(-4,-1)(4,-1)
141 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
142 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
143 \psline[linestyle=dashed](2,-1)(2,1.5)
144 \psline[linestyle=dashed](4,-1)(4,2.5)
145 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)
146 \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
147 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
148 \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
149 \uput[dr](!R h 2 div neg){1}
150 \uput[u](!R r add 2 div h 2 div){2}
151 \uput[dl](!r h 2 div neg){3}
152 \end{pspicture}
153 \end{minipage}
154 \begin{center}
155 %%
156 \psset{unit=0.5}
157 \begin{pspicture}(-5,-6)(5,6)
158 \psframe(-5,-4)(5,4)
159 \psset[pst-solides3d]{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20}
160 \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=cyan,h=3,R=8,r=4,RotX=10]%
161 \end{pspicture}
162 %%
163 \begin{pspicture}(-5,-6)(5,5)
164 \psframe(-5,-4)(5,4)
165 \psset[pst-solides3d]{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20}
166 \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]%
167 \end{pspicture}
168 \end{center}
169
170 \begin{verbatim}
171 \psSolid[object=anneau,section=\SectionTriangulaire,%
172          fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0)
173 \psSolid[object=anneau,section=\SectionTriangulaire,%
174          fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10](0,0,0)
175 \end{verbatim}
176
177 %%\newpage
178
179 \newcommand\SectionPneu{
180    /m {90 4 div} bind def
181    /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
182    /Z0 {h 4 div} bind def
183    /c {Z0 Scos div} bind def
184    /Z1 {Z0 c m cos mul add} bind def
185    /Z2 {Z1 c m 2 mul cos mul add} bind def
186    /R1 {R c m sin mul sub} bind def
187    /R2 {R1 c m 2 mul sin mul sub} bind def
188    /R3 {R2 c m 3 mul sin mul sub} bind def
189    R h 4 div neg % 1
190    R h 4 div % 2
191    R1 Z1 % 3
192    R2 Z2 % 4
193    R3 h 2 div % 5
194    r h 2 div  % 6
195    r h 2 div neg  % 7
196    R3 h 2 div neg % 8
197    R2 Z2 neg % 9
198    R1 Z1 neg % 10
199    }
200
201 \subsection{Example 3: a ring with a``tyre''-like section: cylindric ring with chamfered edges}
202
203 \begin{minipage}{0.45\linewidth}
204 {\small
205 \begin{verbatim}
206 \renewcommand\SectionPneu{
207    /m {90 4 div} bind def
208    /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
209    /Z0 {h 4 div} bind def
210    /c {Z0 Scos div} bind def
211    /Z1 {Z0 c m cos mul add} bind def
212    /Z2 {Z1 c m 2 mul cos mul add} bind def
213    /R1 {R c m sin mul sub} bind def
214    /R2 {R1 c m 2 mul sin mul sub} bind def
215    /R3 {R2 c m 3 mul sin mul sub} bind def
216    R h 4 div neg % 1
217    R h 4 div % 2
218    R1 Z1 % 3
219    R2 Z2 % 4
220    R3 h 2 div % 5
221    r h 2 div  % 6
222    r h 2 div neg  % 7
223    R3 h 2 div neg % 8
224    R2 Z2 neg % 9
225    R1 Z1 neg % 10
226    }
227 \end{verbatim}}
228 \end{minipage}
229 \hfill
230 \begin{minipage}{0.45\linewidth}
231 %\psset{unit=0.65}
232 \begin{pspicture}(-2,-3)(5,6)
233 %\psgrid
234 \pstVerb{/R 4 def /r 2 def /h 2 def}%
235 \pstVerb{/m {90 4 div} bind def
236    /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
237    /Z0 {h 4 div} bind def
238    /c {Z0 Scos div} bind def
239    /Z1 {Z0 c m cos mul add} bind def
240    /Z2 {Z1 c m 2 mul cos mul add} bind def
241    /R1 {R c m sin mul sub} bind def
242    /R2 {R1 c m 2 mul sin mul sub} bind def
243    /R3 {R2 c m 3 mul sin mul sub} bind def}%
244 \pnode(!R h 4 div neg){S1}
245 \pnode(!R h 4 div){S2}
246 \pnode(!R1 Z1){S3}
247 \pnode(!R2 Z2){S4}
248 \pnode(!R3 h 2 div){S5}
249 \pnode(!r h 2 div){S6}
250 \pnode(!r h 2 div neg){S7}
251 \pnode(!R3 h 2 div neg){S8}
252 \pnode(!R2 Z2 neg){S9}
253 \pnode(!R1 Z1 neg){S10}
254 \newcommand\pneuSection{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
255  (S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10)}
256 \rput(0,0){\pneuSection}\rput{180}{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
257  (!R h 4 div neg)(!R h 4 div)(!R1 Z1)(!R2 Z2)(!R3 h 2 div)(!r h 2 div)(!r h 2 div neg)(!R3 h 2 div neg)(!R2 Z2 neg)(!R1 Z1 neg)}
258 \psline(-3,1)(3,1)\psline(-3,-1)(3,-1)
259 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
260 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
261 \psline[linestyle=dashed](2,-1)(2,1.5)
262 \psline[linestyle=dashed](4,-1)(4,2.5)
263 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)
264 \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
265 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
266 \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
267 \uput[r](S1){1}
268 \uput[r](S2){2}
269 \uput[u](S3){3}
270 \uput[u](S4){4}
271 \uput[u](S5){5}
272 \uput[ul](S6){6}
273 \uput[dl](S7){7}
274 \uput[dl](S8){8}
275 \uput[dr](S9){9}
276 \uput[r](S10){10}
277 \psdots[linecolor=red](S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10)
278 \end{pspicture}
279 \end{minipage}
280
281 %\iffalse
282 \begin{center}
283 \psset{unit=0.7}
284 \begin{pspicture}(-5,-5)(5,4)
285 \psframe(-5,-4)(5,4)
286 \psset[pst-solides3d]{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20}
287 \psSolid[object=anneau,section=\SectionPneu,fillcolor=cyan,h=3,R=8,r=4,RotX=10]%
288 \end{pspicture}
289 %%
290 \begin{pspicture}(-5,-5)(5,4)
291 \psframe(-5,-4)(5,4)
292 \psset[pst-solides3d]{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20}
293 \psSolid[object=anneau,section=\SectionPneu,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]%
294 \end{pspicture}
295 \end{center}
296 %%
297
298 \begin{verbatim}
299 \psSolid[object=anneau,section=\SectionPneu,%
300          fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0)
301 \psSolid[object=anneau,section=\SectionPneu,%
302          fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]%
303 \end{verbatim}
304
305 %\fi
306 \newpage
307
308 \subsection{Example 4: an empty bobbin}
309
310 \newcommand\SectionBobine{
311    r h 2 div % 1
312    r h 2 div neg % 2
313    R h 2 div neg % 3
314    R h 3 div neg % 4
315    R h 4 div sub h 3 div neg % 5
316    R h 4 div sub h 3 div % 6
317    R h 3 div % 7
318    R h 2 div % 8
319    }
320
321 \begin{minipage}{0.45\linewidth}
322 \begin{verbatim}
323 \newcommand\SectionBobine{
324    r h 2 div % 1
325    r h 2 div neg % 2
326    R h 2 div neg % 3
327    R h 3 div neg % 4
328    R h 4 div sub h 3 div neg % 5
329    R h 4 div sub h 3 div % 6
330    R h 3 div % 7
331    R h 2 div % 8
332    }
333 \end{verbatim}
334 \end{minipage}
335 \hfill
336 \begin{minipage}{0.45\linewidth}
337 \begin{pspicture}(-2,-2)(5,2)
338 \pstVerb{/RB 4 def /rB 2 def /hB 3 def}%
339 \pnode(!rB hB 2 div){S1}
340 \pnode(!rB hB 2 div neg){S2}
341 \pnode(!RB hB 2 div neg){S3}
342 \pnode(!RB hB 3 div neg){S4}
343 \pnode(!RB hB 4 div sub hB 3 div neg){S5}
344 \pnode(!RB hB 4 div sub hB 3 div){S6}
345 \pnode(!RB hB 3 div){S7}
346 \pnode(!RB hB 2 div){S8}
347 \newcommand\pneuSection{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
348  (S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)}
349 \rput(0,0){\pneuSection}\rput{180}{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
350  (!rB hB 2 div)(!rB hB 2 div neg)(!RB hB 2 div neg)(!RB hB 3 div neg)(!RB hB 4 div sub hB 3 div neg)(!RB hB 4 div sub hB 3 div)(!RB hB 3 div)(!RB hB 2 div)}
351 \psline(-3,1.5)(3,1.5)\psline(-3,-1.5)(3,-1.5)
352 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
353 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
354 \psline[linestyle=dashed](2,-1)(2,1.5)
355 \psline[linestyle=dashed](4,-1)(4,2.5)
356 \psline[linestyle=dashed](-4,-1)(4,-1)
357 \psline[linestyle=dashed](-4,1)(4,1)
358 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)
359 \psline{->}(0,1.8)(2,1.8)\uput[u](1,1.8){$r$}
360 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
361 \psline{<->}(5,-1.5)(5,1.5)\uput[r](5,0){$h$}
362 \uput[u](S1){1}
363 \uput[d](S2){2}
364 \uput[d](S3){3}
365 \uput[r](S4){4}
366 \uput[ur](S5){5}
367 \uput[dr](S6){6}
368 \uput[r](S7){7}
369 \uput[r](S8){8}
370 \psdots[linecolor=red](S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)
371 \end{pspicture}
372 \end{minipage}
373 \begin{center}
374 \begin{pspicture}(-5,-6)(5,5)
375 \psframe*[linecolor=blue!50](-5,-5)(5,4)
376 \psset[pst-solides3d]{viewpoint=70 40 10 rtp2xyz,Decran=25,lightsrc=0 30 100}
377 \psSolid[object=grille,base=-15 15 -15 15,fillcolor=yellow!30!black!10](0,0,-8)
378 %\psSolid[object=prisme,h=2,base=-15 1 -15 -1 15 -1 15 1](0,0,-8)
379 \psSolid[object=anneau,section=\SectionBobine,fillcolor=gray!50,h=6,R=8,r=4,RotX=90,linecolor=gray]%
380 \end{pspicture}
381 \end{center}
382 \begin{verbatim}
383 \psSolid[object=grille,base=-15 15 -15 15,fillcolor=yellow!30](0,0,-8)
384 \psSolid[object=anneau,section=\SectionBobine,%
385          fillcolor=gray!50,h=6,R=8,r=4,RotX=90,linecolor=gray]%
386 \end{verbatim}
387
388
389
390 \subsection{Some other rings}
391
392 Three other examples are available on the website:
393
394 \centerline{\url{http://syracuse.eu.org/lab/bpst/pst-solides3d/anneaux}}
395
396
397 \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.