\section {Solide anneau} Cette partie traite des anneaux cylindriques. Dans la commande \verb+\psSolid+, cet objet est tracé avec l'option : \verb+[object=anneau]+, dont il faut fixer 3 paramètres : \begin{itemize} \item le rayon intérieur \verb+[r=1.5]+ (valeur par défaut) ; \item le rayon extérieur \verb+[R=4]+ (valeur par défaut) \item la hauteur \verb+[h=6]+ (valeur par défaut). \end{itemize} En option, l'argument \verb+ngrid+ permet de définir le nombre de sections utilisées pour faire une rotation complète de $360$~degrés. Sa valeur par défaut est $24$. La section de l'anneau dont la forme \texttt{rectangulaire} a été choisie par défaut, peut être redessinée par l'utilisateur. Nous allons détailler différents exemples de section. \subsection{Commande pré-définie~: l'anneau à section rectangulaire.} Cette section est définie dans le plan $Oyz$, elle est paramétrée par le triplet $(r, R, h)$. Les valeurs du rayon extérieur $R$, du rayon intérieur $r$ et de la hauteur $h$ sont passées dans les options de \verb+\psSolid+. Par défaut, on a donc un anneau à section rectangulaire variable, et la définition se fait au moment de la transmission des valeurs pour $(r, R, h)$ dans les options de \verb+\psSolid+. Si l'utilisateur redéfinit la macro \TeX{} \verb+\Section+ avec des valeurs numériques plutôt que les paramètres $r$, $R$ et $h$, alors l'anneau n'est plus variable et il n'est plus besoin de transmettre des valeurs pour $r$, $R$, et $h$ dans les options de \verb+\psSolid+. %\begin{minipage}{0.45\linewidth} \begin{lstlisting}[basicstyle=\footnotesize\ttfamily] \def\Section{% y z Rad1 height 2 div neg % S1 (R,-h/2) sommet 1 Rad1 height 2 div % S2 (r,h/2) sommet 2 rad2 height 2 div % S3 (r,h/2) sommet 3 rad2 height 2 div neg }% S4 (r,-h/2) sommet 4 \end{lstlisting} \begin{LTXexample}[width=5cm] \psset{unit=0.5}\begin{pspicture}(-5,-3)(5,3) \pstVerb{/Rad1 4 def /rad2 2 def /height 2 def}% \def\RectangularSection{% \pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]% (!Rad1 height 2 div neg)(!Rad1 height 2 div)% (!rad2 height 2 div)(!rad2 height 2 div neg)} \rput(0,0){\RectangularSection}\rput(-6,0){\RectangularSection} \psline(-2,1)(2,1)\psline(-2,-1)(2,-1) \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3) \psline[linestyle=dashed]{->}(-4,0)(4.2,0) \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$} \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$} \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$} \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$} \uput[dr](!Rad1 height 2 div neg){1}\uput[ur](!Rad1 height 2 div ){2} \uput[ul](!rad2 height 2 div ){3} \uput[dl](!rad2 height 2 div neg){4} \end{pspicture} \end{LTXexample} \begin{center} \begingroup \psset{unit=0.5cm} \begin{pspicture}(-5,-4)(5,4) \psframe(-5,-4)(5,4) \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20} \psSolid[object=anneau,fillcolor=cyan,h=3,R=8,r=6,ngrid=4,RotX=10](0,0,0) \end{pspicture} \qquad \begin{pspicture}(-5,-4)(5,4) \psframe(-5,-4)(5,4) \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20} \psSolid[object=anneau,fillcolor=yellow,h=3,R=8,r=6,RotX=90,RotZ=10](0,0,0) \end{pspicture} \endgroup \end{center} \begin{lstlisting}[basicstyle=\footnotesize\ttfamily] \psSolid[object=anneau,fillcolor=cyan,h=3,R=8,r=6,ngrid=4,RotX=10](0,0,0) \psSolid[object=anneau,fillcolor=yellow,h=3,R=8,r=6,RotX=90,RotZ=10](0,0,0) \end{lstlisting} \subsection{Un simple anneau à section triangulaire} Ci-dessous un anneau très simple, à section triangulaire fixe. La section est définie par la donnée des $3$~points $(6, -2)$, (10, 0) et $(6, 2)$ dans l'option \texttt{section} de \verb+\psSolid+. \begin{LTXexample}[width=5cm] \psset{unit=0.5cm} \begin{pspicture}(-5,-4)(5,4) \psframe(-5,-4)(5,4) \psset{viewpoint=50 20 40 rtp2xyz,Decran=25, lightsrc=10 20 20} \psSolid[object=anneau,section=6 -2 10 0 6 2, fillcolor=cyan,RotX=10] \end{pspicture} \end{LTXexample} \subsection{Un anneau variable à section triangulaire} \begin{lstlisting}[basicstyle=\footnotesize\ttfamily] \newcommand\SectionTriangulaire{% y <----z----> Rad1 height 2 div neg % S1 (R,-h/2) Rad1 rad2 add 2 div height 2 div % S2 ((R+r)/2,h/2) rad2 height 2 div neg } % S3 (r,-h/2) \end{lstlisting} \def\TriangularSection{% \pspolygon[fillstyle=vlines,linewidth=1.5pt](!Rad1 height 2 div neg)% (!Rad1 rad2 add 2 div height 2 div)(!rad2 height 2 div neg)} \begin{LTXexample}[width=5cm] \psset{unit=0.5cm}\pstVerb{/Rad1 4 def /rad2 2 def /height 2 def }% \begin{pspicture}(-5,-3)(5,3) \rput(0,0){\TriangularSection}\rput(-6,0){\TriangularSection} \psline(-3,1)(3,1)\psline(-4,-1)(4,-1) \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3) \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$} \psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$} \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$} \psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$} \uput[dr](! Rad1 height 2 div neg){1} \uput[u](! Rad1 rad2 add 2 div height 2 div){2} \uput[dl](! rad2 height 2 div neg){3}\psset{linestyle=dashed} \psline(2,-1)(2,1.5)\psline(4,-1)(4,2.5)\psline{->}(-4,0)(4.2,0) \end{pspicture} \end{LTXexample} \begin{center} \psset{unit=0.5cm} \def\SectionTriangulaire{ R h 2 div neg % sommet 1 R r add 2 div h 2 div % sommet 2 r h 2 div neg } % sommet 3 \begin{pspicture}(-5,-6)(5,6) \psframe(-5,-4)(5,4) \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20} \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=cyan,h=3,R=8,r=4,RotX=10]% \end{pspicture} \qquad \begin{pspicture}(-5,-6)(5,5) \psframe(-5,-4)(5,4) \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20} \psSolid[object=anneau,section=\SectionTriangulaire,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]% \end{pspicture} \end{center} \begin{lstlisting}[basicstyle=\footnotesize\ttfamily] \psSolid[object=anneau,section=\SectionTriangulaire, fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0) \psSolid[object=anneau,section=\SectionTriangulaire, fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10](0,0,0) \end{lstlisting} \clearpage \subsection[L'anneau à section ``pneu'']% {L'anneau à section ``pneu'' : anneau cylindrique à arêtes chanfreinées.} \begin{minipage}{0.45\linewidth} \begin{lstlisting}[basicstyle=\footnotesize\ttfamily] \def\SectionPneu{ /MM { 90 4 div} bind def /Scos {MM cos 2 MM mul cos add 3 MM mul cos add} bind def /Z0 {h 4 div} bind def /c {Z0 Scos div} bind def /Z1 {Z0 c MM cos mul add} bind def /Z2 {Z1 c MM 2 mul cos mul add} bind def /R1 {R c MM sin mul sub} bind def /R2 {R1 c MM 2 mul sin mul sub} bind def /R3 {R2 c MM 3 mul sin mul sub} bind def R h 4 div neg % 1 R h 4 div % 2 R1 Z1 % 3 R2 Z2 % 4 R3 h 2 div % 5 r h 2 div % 6 r h 2 div neg % 7 R3 h 2 div neg % 8 R2 Z2 neg % 9 R1 Z1 neg % 10 } \end{lstlisting} \end{minipage} \hfill \begin{minipage}{0.45\linewidth} \psset{unit=0.7cm} \begin{pspicture}(-2,-3)(5,6) \pstVerb{/Rad1 4 def /rad2 2 def /height 2 def /MM {90 4 div} bind def /Scos {MM cos 2 MM mul cos add 3 MM mul cos add} bind def /Z0 {height 4 div} bind def /c {Z0 Scos div} bind def /Z1 {Z0 c MM cos mul add} bind def /Z2 {Z1 c MM 2 mul cos mul add} bind def /R1 {Rad1 c MM sin mul sub} bind def /R2 {R1 c MM 2 mul sin mul sub} bind def /R3 {R2 c MM 3 mul sin mul sub} bind def}% \pnode(!Rad1 height 4 div neg){S1}\pnode(!Rad1 height 4 div){S2} \pnode(!R1 Z1){S3} \pnode(!R2 Z2){S4} \pnode(!R3 height 2 div){S5} \pnode(!rad2 height 2 div){S6} \pnode(!rad2 height 2 div neg){S7}\pnode(!R3 height 2 div neg){S8} \pnode(!R2 Z2 neg){S9} \pnode(!R1 Z1 neg){S10} \newcommand\pneuSection{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]% (S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10)} \rput(0,0){\pneuSection}\rput{180}{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth]% (!Rad1 height 4 div neg)(!Rad1 height 4 div)(!R1 Z1)(!R2 Z2)% (!R3 height 2 div)(!rad2 height 2 div)(!rad2 height 2 div neg)(!R3 height 2 div neg)(!R2 Z2 neg)(!R1 Z1 neg)} \psline(-3,1)(3,1)\psline(-3,-1)(3,-1) \psline[linestyle=dashed,dash=1 0.2 0.05 0.2]{->}(0,-3)(0,3) \uput[u](0,3){$z$}\uput[r](4.1,0){$y$}\uput[dl](0,0){$O$} \psline[linestyle=dashed](2,-1)(2,1.5)\psline[linestyle=dashed](4,-1)(4,2.5) \psline[linestyle=dashed]{->}(-4,0)(4.2,0)\psline{->}(0,1.5)(2,1.5)\uput[u](1,1.5){$r$} \psline{->}(0,2.5)(4,2.5)\uput[u](2,2.5){$R$}\psline{<->}(5,-1)(5,1)\uput[r](5,0){$h$} \uput[r](S1){1}\uput[r](S2){2}\uput[u](S3){3}\uput[u](S4){4} \uput[u](S5){5}\uput[ul](S6){6}\uput[dl](S7){7}\uput[dl](S8){8} \uput[dr](S9){9}\uput[r](S10){10} \psdots[linecolor=red](S1)(S2)(S3)(S4)(S5)(S6)(S7)(S8)(S9)(S10) \end{pspicture} \end{minipage} \begin{center} \def\SectionPneu{ /MM { 90 4 div } def /Scos { MM cos 2 MM mul cos add 3 MM mul cos add } def /Z0 { h 4 div } def /c {Z0 Scos div} def /Z1 { Z0 c MM cos mul add } def /Z2 { Z1 c MM 2 mul cos mul add } def /R1 { R c MM sin mul sub } def /R2 { R1 c MM 2 mul sin mul sub } def /R3 { R2 c MM 3 mul sin mul sub } def R h 4 div neg % 1 R h 4 div % 2 R1 Z1 % 3 R2 Z2 % 4 R3 h 2 div % 5 r h 2 div % 6 r h 2 div neg % 7 R3 h 2 div neg % 8 R2 Z2 neg % 9 R1 Z1 neg % 10 } \psset{unit=0.7cm} \begin{pspicture}(-5,-5)(5,4) \psframe(-5,-4)(5,4) \psset{viewpoint=50 20 40 rtp2xyz,Decran=25,lightsrc=10 20 20} \psSolid[object=anneau,section=\SectionPneu,fillcolor=cyan,h=3,R=8,r=4,RotX=10]% \end{pspicture} \qquad \begin{pspicture}(-5,-5)(5,4) \psframe(-5,-4)(5,4) \psset{viewpoint=50 -20 -40 rtp2xyz,Decran=25,lightsrc=-10 -20 -20} \psSolid[object=anneau,section=\SectionPneu,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10]% \end{pspicture} \end{center} \begin{verbatim} \psSolid[object=anneau,section=\SectionPneu,fillcolor=cyan,h=3,R=8,r=4,RotX=10](0,0,0) \psSolid[object=anneau,section=\SectionPneu,fillcolor=yellow,h=3,R=8,r=4,RotX=-90,RotZ=10] \end{verbatim} \endinput