\documentclass[a4paper]{article}
\usepackage{pst-solides3d}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\pagestyle{empty}
\date{29 septembre 2\,006}
\author{JPV}

\title{tests procédure des solides de révolution JPV}

\begin{document}
\maketitle

\section{ objet : cylindricalring, 3 exemples}
\begin{enumerate}
\item
Commande pré-définie, l'anneau à section rectangulaire :

\begin{minipage}{0.45\linewidth}
\begin{verbatim}
\newcommand\Section{%
  0 R h 2 div neg % sommet 1
  0 R h 2 div     % sommet 2
  0 r h 2 div     % sommet 3
  0 r h 2 div neg % sommet 4
            }
\end{verbatim}
\end{minipage}
\hfill
\begin{minipage}{0.45\linewidth}
\psset{unit=0.5}
\begin{pspicture}(-5,-3)(5,3)
\pstVerb{/R 4 def /r 2 def /h 2 def}%
\newcommand\RectangularSection{\pspolygon[fillstyle=vlines,linewidth=2\pslinewidth](!R h 2 div neg)(!R h 2 div)(!r h 2 div)(!r h 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,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[dr](!R h 2 div neg){1}
\uput[ur](!R h 2 div ){2}
\uput[ul](!r h 2 div ){3}
\uput[dl](!r h 2 div neg){4}
\end{pspicture}
\end{minipage}

\begin{center}
%%
\psset{unit=0.5}
\begin{pspicture}(-5,-6)(5,6)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 20 40,Decran=25,lightsrc=10 20 20}
\psSolid[object=cylindricalring,color=cyan,h=3,r1=8,r0=6,RotX=10](0,0,0)
\end{pspicture}
%%
\begin{pspicture}(-5,-6)(5,5)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 -20 -40,Decran=25,lightsrc=-10 -20 -20}
\psSolid[object=cylindricalring,color=yellow,h=3,r1=8,r0=6,RotX=90,RotZ=10](0,0,0)
\end{pspicture}
\end{center}
\renewcommand\Section{
         0 R h 2 div neg % sommet 1
         0 R r add 2 div h 2 div % sommet 2
         0 r h 2 div neg % sommet 3
}
\newpage
\item L'anneau à section triangulaire
\begin{verbatim}
\renewcommand\Section{
         0 R h 2 div neg % sommet 1
         0 R r add 2 div h 2 div % sommet 2
         0 r h 2 div neg % sommet 3
}
\end{verbatim}
\begin{center}
%%
\psset{unit=0.5}
\begin{pspicture}(-5,-6)(5,6)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 20 40,Decran=25,lightsrc=10 20 20}
\psSolid[object=cylindricalring,color=cyan,h=3,r1=8,r0=4,RotX=10](0,0,0)
\end{pspicture}
%%
\begin{pspicture}(-5,-6)(5,5)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 -20 -40,Decran=25,lightsrc=-10 -20 -20}
\psSolid[object=cylindricalring,color=yellow,h=3,r1=8,r0=4,RotX=-90,RotZ=10](0,0,0)
\end{pspicture}
\end{center}
\newpage
\renewcommand\Section{
   /m {90 4 div} bind def
   /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
   /Z0 {h 4 div} bind def
   /c {Z0 Scos div} bind def
   /Z1 {Z0 c m cos mul add} bind def
   /Z2 {Z1 c m 2 mul cos mul add} bind def
%  /Z3 {Z2 c m 3 mul cos mul add} bind def Z3= h/2
   /R1 {R c m sin mul sub} bind def
   /R2 {R1 c m 2 mul sin mul sub} bind def
   /R3 {R2 c m 3 mul sin mul sub} bind def
   0 R h 4 div neg % 1
   0 R h 4 div % 2
   0 R1 Z1 % 3
   0 R2 Z2 % 4
   0 R3 h 2 div % 5
   0 r h 2 div  % 6
   0 r h 2 div neg  % 7
   0 R3 h 2 div neg % 8
   0 R2 Z2 neg % 9
   0 R1 Z1 neg % 10
   }
\item L'anneau à section ``pneu'' : anneau cylindrique à arêtes chanfreinées.
\begin{verbatim}
\renewcommand\Section{
   /m {90 4 div} bind def
   /Scos {m cos 2 m mul cos add 3 m mul cos add} bind def
   /Z0 {h 4 div} bind def
   /c {Z0 Scos div} bind def
   /Z1 {Z0 c m cos mul add} bind def
   /Z2 {Z1 c m 2 mul cos mul add} bind def
%  /Z3 {Z2 c m 3 mul cos mul add} bind def Z3= h/2
   /R1 {R c m sin mul sub} bind def
   /R2 {R1 c m 2 mul sin mul sub} bind def
   /R3 {R2 c m 3 mul sin mul sub} bind def
   0 R h 4 div neg % 1
   0 R h 4 div % 2
   0 R1 Z1 % 3
   0 R2 Z2 % 4
   0 R3 h 2 div % 5
   0 r h 2 div  % 6
   0 r h 2 div neg  % 7
   0 R3 h 2 div neg % 8
   0 R2 Z2 neg % 9
   0 R1 Z1 neg % 10
   }
\end{verbatim}
\begin{center}
%%
\psset{unit=0.5}
\begin{pspicture}(-5,-6)(5,6)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 20 40,Decran=25,lightsrc=10 20 20}
\psSolid[object=cylindricalring,color=cyan,h=3,r1=8,r0=4,RotX=10](0,0,0)
\end{pspicture}
%%
\begin{pspicture}(-5,-6)(5,5)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 -20 -40,Decran=25,lightsrc=-10 -20 -20}
\psSolid[object=cylindricalring,color=yellow,h=3,r1=8,r0=4,RotX=-90,RotZ=10](0,0,0)
\end{pspicture}
\end{center}
\item pouf
\begin{center}
\begin{pspicture}(-5,-6)(5,5)
\psframe(-5,-4)(5,4)
\psset[pst-solides3d]{SphericalCoor=true,viewpoint=50 20 20,Decran=25,lightsrc=10 20 20}
\psSolid[object=cylindricalring,color=red!50!yellow!30,h=10,r1=6,r0=0.1](0,0,0)
\end{pspicture}
\end{center}
\end{enumerate}
\end{document}
