Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc / par-anneaux.tex
1 \section {Solide anneau}
2
3 Cette partie traite des anneaux cylindriques. Dans la commande
4 \verb+\psSolid+, cet objet est tracé avec l'option :
5 \verb+[object=anneau]+, dont il faut fixer 3 paramètres :
6 \begin{itemize}
7 \item le rayon intérieur \verb+[r=1.5]+ (valeur par défaut) ;
8 \item le rayon extérieur \verb+[R=4]+ (valeur par défaut)
9 \item la hauteur \verb+[h=6]+ (valeur par défaut).
10 \end{itemize}
11
12 En option, l'argument \verb+ngrid+ permet de définir le nombre de
13 sections utilisées pour faire une rotation complète de
14 $360$~degrés. Sa valeur par défaut est $24$.
15
16 La section de l'anneau dont la forme \texttt{rectangulaire} a été
17 choisie par défaut, peut être redessinée par l'utilisateur.
18 Nous allons détailler différents exemples de section.
19
20 \subsection{Commande pré-définie~: l'anneau à section rectangulaire.}
21
22 Cette section est définie dans le plan $Oyz$, elle est paramétrée par le
23 triplet $(r, R, h)$. Les valeurs du rayon
24 extérieur $R$, du rayon intérieur $r$ et de la hauteur $h$ sont
25 passées dans les options de \verb+\psSolid+. Par défaut, on a donc un
26 anneau à section rectangulaire variable, et la définition se fait au
27 moment de la transmission des valeurs pour $(r, R, h)$ dans les
28 options de \verb+\psSolid+.
29
30 Si l'utilisateur redéfinit la macro \TeX{} \verb+\Section+ avec des
31 valeurs numériques plutôt que les paramètres $r$, $R$ et $h$, alors
32 l'anneau n'est plus variable et il n'est plus besoin de transmettre
33 des valeurs pour $r$, $R$, et $h$ dans les options de \verb+\psSolid+.
34
35 %\begin{minipage}{0.45\linewidth}
36 \begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
37 \def\Section{% y z
38 Rad1 height 2 div neg % S1 (R,-h/2) sommet 1
39 Rad1 height 2 div % S2 (r,h/2) sommet 2
40 rad2 height 2 div % S3 (r,h/2) sommet 3
41 rad2 height 2 div neg }% S4 (r,-h/2) sommet 4
42 \end{lstlisting}
43
44 \begin{LTXexample}[width=5cm]
45 \psset{unit=0.5}\begin{pspicture}(-5,-3)(5,3)
46 \pstVerb{/Rad1 4 def /rad2 2 def /height 2 def}%
47 \def\RectangularSection{%
48 \pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
49 (!Rad1 height 2 div neg)(!Rad1 height 2 div)%
50 (!rad2 height 2 div)(!rad2 height 2 div neg)}
51 \rput(0,0){\RectangularSection}\rput(-6,0){\RectangularSection}
52 \psline(-2,1)(2,1)\psline(-2,-1)(2,-1)
53 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
54 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)
55 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
56 \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
57 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
58 \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
59 \uput[dr](!Rad1 height 2 div neg){1}\uput[ur](!Rad1 height 2 div ){2}
60 \uput[ul](!rad2 height 2 div ){3} \uput[dl](!rad2 height 2 div neg){4}
61 \end{pspicture}
62 \end{LTXexample}
63
64
65 \begin{center}
66 \begingroup
67 \psset{unit=0.5cm}
68 \begin{pspicture}(-5,-4)(5,4)
69 \psframe(-5,-4)(5,4)
70 \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20}
71 \psSolid[object=anneau,fillcolor=cyan,h=3,R=8,r=6,ngrid=4,RotX=10](0,0,0)
72 \end{pspicture}
73 \qquad
74 \begin{pspicture}(-5,-4)(5,4)
75 \psframe(-5,-4)(5,4)
76 \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20}
77 \psSolid[object=anneau,fillcolor=yellow,h=3,R=8,r=6,RotX=90,RotZ=10](0,0,0)
78 \end{pspicture}
79 \endgroup
80 \end{center}
81
82 \begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
83 \psSolid[object=anneau,fillcolor=cyan,h=3,R=8,r=6,ngrid=4,RotX=10](0,0,0)
84 \psSolid[object=anneau,fillcolor=yellow,h=3,R=8,r=6,RotX=90,RotZ=10](0,0,0)
85 \end{lstlisting}
86
87 \subsection{Un simple anneau à section triangulaire}
88
89 Ci-dessous un anneau très simple, à section triangulaire fixe. La
90 section est définie par la donnée des $3$~points $(6, -2)$, (10, 0)
91 et $(6, 2)$ dans l'option \texttt{section} de \verb+\psSolid+.
92
93 \begin{LTXexample}[width=5cm]
94 \psset{unit=0.5cm}
95 \begin{pspicture}(-5,-4)(5,4)
96 \psframe(-5,-4)(5,4)
97 \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,
98 lightsrc=10 20 20}
99 \psSolid[object=anneau,section=6 -2 10 0 6 2,
100 fillcolor=cyan,RotX=10]
101 \end{pspicture}
102 \end{LTXexample}
103
104
105 \subsection{Un anneau variable à section triangulaire}
106
107 \begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
108 \newcommand\SectionTriangulaire{% y <----z---->
109 Rad1 height 2 div neg % S1 (R,-h/2)
110 Rad1 rad2 add 2 div height 2 div % S2 ((R+r)/2,h/2)
111 rad2 height 2 div neg } % S3 (r,-h/2)
112 \end{lstlisting}
113
114 \def\TriangularSection{%
115 \pspolygon[fillstyle=vlines,linewidth=1.5pt](!Rad1 height 2 div neg)%
116 (!Rad1 rad2 add 2 div height 2 div)(!rad2 height 2 div neg)}
117 \begin{LTXexample}[width=5cm]
118 \psset{unit=0.5cm}\pstVerb{/Rad1 4 def /rad2 2 def /height 2 def }%
119 \begin{pspicture}(-5,-3)(5,3)
120 \rput(0,0){\TriangularSection}\rput(-6,0){\TriangularSection}
121 \psline(-3,1)(3,1)\psline(-4,-1)(4,-1)
122 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
123 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
124 \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
125 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}
126 \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
127 \uput[dr](! Rad1 height 2 div neg){1}
128 \uput[u](! Rad1 rad2 add 2 div height 2 div){2}
129 \uput[dl](! rad2 height 2 div neg){3}\psset{linestyle=dashed}
130 \psline(2,-1)(2,1.5)\psline(4,-1)(4,2.5)\psline{->}(-4,0)(4.2,0)
131 \end{pspicture}
132 \end{LTXexample}
133
134
135 \begin{center}
136 \psset{unit=0.5cm}
137 \def\SectionTriangulaire{
138 R h 2 div neg % sommet 1
139 R r add 2 div h 2 div % sommet 2
140 r h 2 div neg } % sommet 3
141 \begin{pspicture}(-5,-6)(5,6)
142 \psframe(-5,-4)(5,4)
143 \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20}
144 \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=cyan,h=3,R=8,r=4,RotX=10]%
145 \end{pspicture}
146 \qquad
147 \begin{pspicture}(-5,-6)(5,5)
148 \psframe(-5,-4)(5,4)
149 \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20}
150 \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]%
151 \end{pspicture}
152 \end{center}
153
154
155 \begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
156 \psSolid[object=anneau,section=\SectionTriangulaire,
157 fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0)
158 \psSolid[object=anneau,section=\SectionTriangulaire,
159 fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10](0,0,0)
160 \end{lstlisting}
161
162 \clearpage
163 \subsection[L'anneau à section ``pneu'']%
164 {L'anneau à section ``pneu'' : anneau cylindrique à arêtes chanfreinées.}
165
166
167 \begin{minipage}{0.45\linewidth}
168 \begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
169 \def\SectionPneu{
170 /MM { 90 4 div} bind def
171 /Scos {MM cos 2 MM mul cos add 3 MM mul cos add} bind def
172 /Z0 {h 4 div} bind def
173 /c {Z0 Scos div} bind def
174 /Z1 {Z0 c MM cos mul add} bind def
175 /Z2 {Z1 c MM 2 mul cos mul add} bind def
176 /R1 {R c MM sin mul sub} bind def
177 /R2 {R1 c MM 2 mul sin mul sub} bind def
178 /R3 {R2 c MM 3 mul sin mul sub} bind def
179 R h 4 div neg % 1
180 R h 4 div % 2
181 R1 Z1 % 3
182 R2 Z2 % 4
183 R3 h 2 div % 5
184 r h 2 div % 6
185 r h 2 div neg % 7
186 R3 h 2 div neg % 8
187 R2 Z2 neg % 9
188 R1 Z1 neg % 10
189 }
190 \end{lstlisting}
191 \end{minipage}
192 \hfill
193 \begin{minipage}{0.45\linewidth}
194 \psset{unit=0.7cm}
195 \begin{pspicture}(-2,-3)(5,6)
196 \pstVerb{/Rad1 4 def /rad2 2 def /height 2 def
197 /MM {90 4 div} bind def
198 /Scos {MM cos 2 MM mul cos add 3 MM mul cos add} bind def
199 /Z0 {height 4 div} bind def
200 /c {Z0 Scos div} bind def
201 /Z1 {Z0 c MM cos mul add} bind def
202 /Z2 {Z1 c MM 2 mul cos mul add} bind def
203 /R1 {Rad1 c MM sin mul sub} bind def
204 /R2 {R1 c MM 2 mul sin mul sub} bind def
205 /R3 {R2 c MM 3 mul sin mul sub} bind def}%
206 \pnode(!Rad1 height 4 div neg){S1}\pnode(!Rad1 height 4 div){S2}
207 \pnode(!R1 Z1){S3} \pnode(!R2 Z2){S4}
208 \pnode(!R3 height 2 div){S5} \pnode(!rad2 height 2 div){S6}
209 \pnode(!rad2 height 2 div neg){S7}\pnode(!R3 height 2 div neg){S8}
210 \pnode(!R2 Z2 neg){S9} \pnode(!R1 Z1 neg){S10}
211 \newcommand\pneuSection{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
212 (S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10)}
213 \rput(0,0){\pneuSection}\rput{180}{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]%
214 (!Rad1 height 4 div neg)(!Rad1 height 4 div)(!R1 Z1)(!R2 Z2)%
215 (!R3 height 2 div)(!rad2 height 2 div)(!rad2 height 2 div neg)(!R3 height 2 div neg)(!R2 Z2 neg)(!R1 Z1 neg)}
216 \psline(-3,1)(3,1)\psline(-3,-1)(3,-1)
217 \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3)
218 \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$}
219 \psline[linestyle=dashed](2,-1)(2,1.5)\psline[linestyle=dashed](4,-1)(4,2.5)
220 \psline[linestyle=dashed]{->}(-4,0)(4.2,0)\psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$}
221 \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}\psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$}
222 \uput[r](S1){1}\uput[r](S2){2}\uput[u](S3){3}\uput[u](S4){4}
223 \uput[u](S5){5}\uput[ul](S6){6}\uput[dl](S7){7}\uput[dl](S8){8}
224 \uput[dr](S9){9}\uput[r](S10){10}
225 \psdots[linecolor=red](S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10)
226 \end{pspicture}
227 \end{minipage}
228
229 \begin{center}
230 \def\SectionPneu{
231 /MM { 90 4 div } def
232 /Scos { MM cos 2 MM mul cos add 3 MM mul cos add } def
233 /Z0 { h 4 div } def
234 /c {Z0 Scos div} def
235 /Z1 { Z0 c MM cos mul add } def
236 /Z2 { Z1 c MM 2 mul cos mul add } def
237 /R1 { R c MM sin mul sub } def
238 /R2 { R1 c MM 2 mul sin mul sub } def
239 /R3 { R2 c MM 3 mul sin mul sub } def
240 R h 4 div neg % 1
241 R h 4 div % 2
242 R1 Z1 % 3
243 R2 Z2 % 4
244 R3 h 2 div % 5
245 r h 2 div % 6
246 r h 2 div neg % 7
247 R3 h 2 div neg % 8
248 R2 Z2 neg % 9
249 R1 Z1 neg % 10
250 }
251 \psset{unit=0.7cm}
252 \begin{pspicture}(-5,-5)(5,4)
253 \psframe(-5,-4)(5,4)
254 \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20}
255 \psSolid[object=anneau,section=\SectionPneu,fillcolor=cyan,h=3,R=8,r=4,RotX=10]%
256 \end{pspicture}
257 \qquad
258 \begin{pspicture}(-5,-5)(5,4)
259 \psframe(-5,-4)(5,4)
260 \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20}
261 \psSolid[object=anneau,section=\SectionPneu,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]%
262 \end{pspicture}
263 \end{center}
264
265
266 \begin{verbatim}
267 \psSolid[object=anneau,section=\SectionPneu,fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0)
268 \psSolid[object=anneau,section=\SectionPneu,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]
269 \end{verbatim}
270
271
272
273 \endinput
274

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.