\section{Généralisation de la notion de cylindre et de cône} \subsection{Cylindre ou nappe cylindrique quelconque} Cette partie généralise la notion de cylindre, ou de nappe cylindrique\footnote{Cette partie a été écrite à l'initiative de Maxime Chupin, suite à une question sur la liste de diffusion de \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}. Il faut définir une courbe \textit{directrice} par une fonction et la direction de l'axe du \textit{cylindre}. Dans l'exemple ci-dessous la directrice est une sinusoïde, située dans le plan $z=-2$~: \begin{gbar} \begin{verbatim} \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2} \end{verbatim} \end{gbar} La direction du cylindre est définie par les coordonnées d'un vecteur dans le paramètre \Cadre{axe=0 1 1}. Le dessin fait appel à \Cadre{object=cylindre} qui en plus de ses paramètres usuels dont la hauteur \Cadre{h=4} -- il s'agit de la \textbf{longueur de la génératrice} et non de la distance entre les deux plans passant par les bases, est affecté de ceux définissant la directrice \Cadre{function=G1} et la plage de la variable $t$ \Cadre{range=-3 3}. \begin{gbar} \begin{verbatim} \psSolid[object=cylindre, h=4,function=G1, range=-3 3, ngrid=3 16, axe=0 1 1, incolor=green!50, fillcolor=yellow!50] \end{verbatim} \end{gbar} \begin{center} \psset{unit=0.75} \begin{pspicture}(-5,-4)(5,4) \psset{lightsrc=viewpoint,viewpoint=100 10 20 rtp2xyz,Decran=100} \psSolid[object=grille,base=-4 4 -6 6,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2) \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2} \defFunction[algebraic]{G2}(t){t}{2*sin(t)+4}{2} \psSolid[object=courbe,function=G1, range=-3 3,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cylindre, h=5.65685,function=G1, range=-3 3, ngrid=3 16, axe=0 1 1, incolor=green!50, fillcolor=yellow!50] \psSolid[object=courbe,function=G2, range=-3 3,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=parallelepiped, a=8,b=12,c=4,action=draw](0,0,0) \psSolid[object=plan,action=draw, definition=equation, args={[0 0 1 -2] 90}, base=-6 6 -4 4,planmarks,showBase] \psSolid[object=plan,action=draw, definition=equation, args={[0 1 0 -6] 180}, base=-4 4 -2 2,planmarks,showBase] \psSolid[object=plan,action=draw, definition=equation, args={[1 0 0 -4] 90}, base=-6 6 -2 2,planmarks,showBase] \psSolid[object=vecteur, linecolor=red, args=0 3 3] \end{pspicture} \end{center} Dans cet exemple suivant, afin de représenter les deux plans horizontaux passant par les bases, on fait le calcul de la distance entre ces deux plans. \begin{gbar} \begin{verbatim} \pstVerb{/ladistance 2 sqrt 2 mul def} \end{verbatim} \end{gbar} {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100} \begin{LTXexample}[width=8cm] \begin{pspicture}(-1.5,-3)(6.5,6) \psSolid[object=grille,base=-3 3 -1 8,action=draw] \pstVerb{/ladistance 2 sqrt 2 mul def} \defFunction[algebraic]{G3}(t) {6*(cos(t))^3*sin(t)} {4*(cos(t))^2} {0} \defFunction[algebraic]{G4}(t) {6*(cos(t))^3*sin(t)} {4*(cos(t))^2+ladistance} {ladistance} \psSolid[object=courbe,function=G3, range=0 6.28,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cylindre, range=0 -6.28, h=4, function=G3, axe=0 1 1, ngrid=3 36, fillcolor=green!50, incolor=yellow!50] \psSolid[object=courbe,function=G4, range=0 6.28,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=vecteur, linecolor=red, args=0 ladistance dup] \psSolid[object=plan,action=draw, definition=equation, args={[0 0 1 ladistance neg] 90}, base=-1 8 -3 3,planmarks,showBase] \axesIIID(0,4.5,0)(4,8,5) \rput(0,-3){\texttt{axe=0 1 1}} \end{pspicture} \end{LTXexample}} {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100} \begin{LTXexample}[width=8cm] \begin{pspicture}(-1.5,-3)(6.5,6) \psSolid[object=grille,base=-3 3 -1 6,action=draw] \defFunction[algebraic]{G5}(t) {t}{0.5*t^2}{0} \defFunction[algebraic]{G6}(t) {t}{0.5*t^2}{4} \psSolid[object=courbe,function=G5, range=-3 2,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cylindre, range=-3 2, h=4, function=G5, axe=0 0 1, %% valeur par défaut incolor=green!50, fillcolor=yellow!50, ngrid=3 8] \psSolid[object=courbe,function=G6, range=-3 2,r=0, linecolor=blue, linewidth=2pt] \axesIIID(0,4.5,0)(4,6,5) \psSolid[object=vecteur, linecolor=red, args=0 0 4] \psSolid[object=plan,action=draw, definition=equation, args={[0 0 1 -4] 90}, base=-1 6 -3 3,planmarks,showBase] \end{pspicture} \end{LTXexample}} {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100} \begin{LTXexample}[width=8cm] \begin{pspicture}(-1.5,-3)(6.5,6) \psset{lightsrc=viewpoint,viewpoint=100 45 45,Decran=100} \psSolid[object=grille,base=-3 3 -2 7,fillcolor=gray!30] \defFunction[algebraic]{G7}(t) {2*cos(t)}{2*sin(t)}{0} \defFunction[algebraic]{G8}(t) {2*cos(t)}{2*sin(t)+4}{4} \psSolid[object=courbe,function=G7, range=0 6.28,r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cylindre, range=0 6.28, h=5.65685, function=G7, axe=0 1 1, incolor=green!20, fillcolor=yellow!50, ngrid=3 36] \psSolid[object=courbe,function=G8, range=0 6.28,r=0, linecolor=blue, linewidth=2pt] \axesIIID(2,4.5,2)(4,8,5) \psSolid[object=vecteur, linecolor=red, args=0 1 1](0,4,4) \psSolid[object=plan,action=draw, definition=equation, args={[0 0 1 -4] 90}, base=-2 7 -3 3,planmarks,showBase] \end{pspicture} \end{LTXexample}} \encadre{La directrice peut être une courbe quelconque et n'est pas obligatoirement une courbe plane et horizontale.} \begin{LTXexample}[width=8cm] \begin{pspicture}(-1.5,-4)(4,6) \psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -5 10 rtp2xyz,Decran=100} \psSolid[object=grille,base=-4 4 -4 4,ngrid=8. 8.](0,0,-1) \defFunction[algebraic]{G9}(t) {3*cos(t)} {3*sin(t)} {1*cos(5*t)} \psSolid[object=cylindre, range=0 6.28, h=5, function=G9, axe=0 0 1, incolor=green!50, fillcolor=yellow!50, ngrid=4 72,grid] \end{pspicture} \end{LTXexample} \subsection{Cône ou nappe conique quelconque} Cette partie généralise la notion de cône et de nappe conique\footnote{Cette partie, comme la précédente, a été écrite à l'initiative de Maxime Chupin, suite à une question sur la liste de diffusion de \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}. Il faut définir une courbe \textit{directrice} par une fonction qui dessinera la base du cône, puis le sommet du \textit{cône} qui par défaut est \Cadre{origine=0 0 0}. Les parties supérieure et inférieure du cône sont symétriques par rapport au sommet. Dans l'exemple ci-dessous la directrice est un arc de parabole, situé dans le plan $z=-2$. \begin{LTXexample}[width=7.5cm] \begin{pspicture}(-3,-3)(4.5,5) \psset{lightsrc=viewpoint,viewpoint=100 10 10 rtp2xyz,Decran=100} \psSolid[object=grille,base=-4 4 -3 3,action=draw](0,0,-2) \defFunction[algebraic]{G1}(t) {t} {0.25*t^2} {-2} \defFunction[algebraic]{G2}(t) {-t} {-0.25*t^2} {2} \psSolid[object=courbe, function=G1, range=-3.46 3, r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cone, function=G1, range=-3.46 3, ngrid=3 16, incolor=green!50, fillcolor=yellow!50, origine=0 0 0] \psSolid[object=courbe, function=G2, range=-3.46 3, r=0, linecolor=blue, linewidth=2pt] \psPoint(0,0,0){I} \uput[l](I){\red$(0,0,0)$} \psdot[linecolor=red](I) \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3) \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=7.5cm] \begin{pspicture}(-3,-3)(4.5,5) \psset{lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100} \psSolid[object=grille,base=-4 4 -3 3,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2) \defFunction[algebraic]{G1}(t) {t} {2*sin(t)} {-2} \defFunction[algebraic]{G2}(t) {-t} {-2*sin(t)} {2} \psSolid[object=courbe, function=G1, range=-3.14 3.14, r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cone, function=G1, range=-3.14 3.14, ngrid=3 16, incolor=green!50, fillcolor=yellow!50, origine=0 0 0] \psSolid[object=courbe, function=G2, range=-3.14 3.14, r=0, linecolor=blue, linewidth=2pt] \psPoint(0,0,0){I} \uput[l](I){\red$(0,0,0)$} \psdot[linecolor=red](I) \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3) \end{pspicture} \end{LTXexample} \begin{LTXexample}[width=7.5cm] \begin{pspicture}(-3,-3)(4.5,5) \psset{lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100} \psSolid[object=grille,base=-4 4 -4 4,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2) \defFunction[algebraic]{G1}(t) {t} {2*sin(t)} {-2} \defFunction[algebraic]{G2}(t) {-t}{-2*sin(t)-2} {2} \psSolid[object=courbe, function=G1, range=-3.14 3.14, r=0, linecolor=blue, linewidth=2pt] \psSolid[object=cone, function=G1, range=-3.14 3.14, ngrid=3 16, incolor=green!50, fillcolor=yellow!50, origine=0 -1 0] \psSolid[object=courbe, function=G2, range=-3.14 3.14, r=0, linecolor=blue, linewidth=2pt] \psPoint(0,-1,0){I} \uput[l](I){\red$(0,-1,0)$} \psdot[linecolor=red](I) \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-4,4) \end{pspicture} \end{LTXexample} \encadre{Pour les cônes aussi, la directrice peut être une courbe quelconque et n'est pas obligatoirement une courbe plane et horizontale, comme dans l'exemple suivant écrit par Maxime Chupin. \newline \centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/cone/cone-dir_02.pst}}} \endinput