Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc / .svn / text-base / par-cylindres-cones.tex.svn-base
1 \section{Généralisation de la notion de cylindre et de cône}
2 \subsection{Cylindre ou nappe cylindrique quelconque}
3 Cette partie généralise la notion de cylindre, ou de nappe cylindrique\footnote{Cette partie a été écrite à l'initiative de
4 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$~:
5 \begin{gbar}
6  \begin{verbatim}
7 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
8  \end{verbatim}
9 \end{gbar}
10 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}.
11 \begin{gbar}
12  \begin{verbatim}
13 \psSolid[object=cylindre,
14    h=4,function=G1,
15    range=-3 3,
16    ngrid=3 16,
17    axe=0 1 1,
18    incolor=green!50,
19    fillcolor=yellow!50]
20  \end{verbatim}
21 \end{gbar}
22
23 \begin{center}
24 \psset{unit=0.75}
25 \begin{pspicture}(-5,-4)(5,4)
26 \psset{lightsrc=viewpoint,viewpoint=100 10 20 rtp2xyz,Decran=100}
27 \psSolid[object=grille,base=-4 4 -6 6,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
28 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
29 \defFunction[algebraic]{G2}(t){t}{2*sin(t)+4}{2}
30 \psSolid[object=courbe,function=G1,
31    range=-3 3,r=0,
32    linecolor=blue,
33    linewidth=2pt]
34 \psSolid[object=cylindre,
35    h=5.65685,function=G1,
36    range=-3 3,
37    ngrid=3 16,
38    axe=0 1 1,
39    incolor=green!50,
40    fillcolor=yellow!50]
41 \psSolid[object=courbe,function=G2,
42    range=-3 3,r=0,
43    linecolor=blue,
44    linewidth=2pt]
45 \psSolid[object=parallelepiped,
46    a=8,b=12,c=4,action=draw](0,0,0)
47 \psSolid[object=plan,action=draw,
48    definition=equation,
49    args={[0 0 1 -2] 90},
50    base=-6 6 -4 4,planmarks,showBase]
51 \psSolid[object=plan,action=draw,
52    definition=equation,
53    args={[0 1 0 -6] 180},
54    base=-4 4 -2 2,planmarks,showBase]
55 \psSolid[object=plan,action=draw,
56    definition=equation,
57    args={[1 0 0 -4] 90},
58    base=-6 6 -2 2,planmarks,showBase]
59 \psSolid[object=vecteur,
60          linecolor=red,
61          args=0 3 3]
62 \end{pspicture}
63 \end{center}
64
65 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.
66 \begin{gbar}
67  \begin{verbatim}
68 \pstVerb{/ladistance 2 sqrt 2 mul def}
69  \end{verbatim}
70 \end{gbar}
71 {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
72 \begin{LTXexample}[width=8cm]
73 \begin{pspicture}(-1.5,-3)(6.5,6)
74 \psSolid[object=grille,base=-3 3 -1 8,action=draw]
75 \pstVerb{/ladistance 2 sqrt 2 mul def}
76 \defFunction[algebraic]{G3}(t)
77    {6*(cos(t))^3*sin(t)}
78    {4*(cos(t))^2}
79    {0}
80 \defFunction[algebraic]{G4}(t)
81    {6*(cos(t))^3*sin(t)}
82    {4*(cos(t))^2+ladistance}
83    {ladistance}
84 \psSolid[object=courbe,function=G3,
85    range=0 6.28,r=0,
86    linecolor=blue,
87    linewidth=2pt]
88 \psSolid[object=cylindre,
89    range=0 -6.28,
90    h=4,
91    function=G3,
92    axe=0 1 1,
93    ngrid=3 36,
94    fillcolor=green!50,
95    incolor=yellow!50]
96 \psSolid[object=courbe,function=G4,
97    range=0 6.28,r=0,
98    linecolor=blue,
99    linewidth=2pt]
100 \psSolid[object=vecteur,
101          linecolor=red,
102          args=0 ladistance dup]
103 \psSolid[object=plan,action=draw,
104    definition=equation,
105    args={[0 0 1 ladistance neg] 90},
106    base=-1 8 -3 3,planmarks,showBase]
107 \axesIIID(0,4.5,0)(4,8,5)
108 \rput(0,-3){\texttt{axe=0 1 1}}
109 \end{pspicture}
110 \end{LTXexample}}
111
112
113 {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
114 \begin{LTXexample}[width=8cm]
115 \begin{pspicture}(-1.5,-3)(6.5,6)
116 \psSolid[object=grille,base=-3 3 -1 6,action=draw]
117 \defFunction[algebraic]{G5}(t)
118    {t}{0.5*t^2}{0}
119 \defFunction[algebraic]{G6}(t)
120     {t}{0.5*t^2}{4}
121 \psSolid[object=courbe,function=G5,
122    range=-3 2,r=0,
123    linecolor=blue,
124    linewidth=2pt]
125 \psSolid[object=cylindre,
126    range=-3 2,
127    h=4,
128    function=G5,
129    axe=0 0 1, %% valeur par défaut
130    incolor=green!50,
131    fillcolor=yellow!50,
132    ngrid=3 8]
133 \psSolid[object=courbe,function=G6,
134    range=-3 2,r=0,
135    linecolor=blue,
136    linewidth=2pt]
137 \axesIIID(0,4.5,0)(4,6,5)
138 \psSolid[object=vecteur,
139          linecolor=red,
140          args=0 0 4]
141 \psSolid[object=plan,action=draw,
142    definition=equation,
143    args={[0 0 1 -4] 90},
144    base=-1 6 -3 3,planmarks,showBase]
145 \end{pspicture}
146 \end{LTXexample}}
147
148 {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
149 \begin{LTXexample}[width=8cm]
150 \begin{pspicture}(-1.5,-3)(6.5,6)
151 \psset{lightsrc=viewpoint,viewpoint=100 45 45,Decran=100}
152 \psSolid[object=grille,base=-3 3 -2 7,fillcolor=gray!30]
153 \defFunction[algebraic]{G7}(t)
154    {2*cos(t)}{2*sin(t)}{0}
155 \defFunction[algebraic]{G8}(t)
156     {2*cos(t)}{2*sin(t)+4}{4}
157 \psSolid[object=courbe,function=G7,
158    range=0 6.28,r=0,
159    linecolor=blue,
160    linewidth=2pt]
161 \psSolid[object=cylindre,
162    range=0 6.28,
163    h=5.65685,
164    function=G7,
165    axe=0 1 1,
166    incolor=green!20,
167    fillcolor=yellow!50,
168    ngrid=3 36]
169 \psSolid[object=courbe,function=G8,
170    range=0 6.28,r=0,
171    linecolor=blue,
172    linewidth=2pt]
173 \axesIIID(2,4.5,2)(4,8,5)
174 \psSolid[object=vecteur,
175          linecolor=red,
176          args=0 1 1](0,4,4)
177 \psSolid[object=plan,action=draw,
178    definition=equation,
179    args={[0 0 1 -4] 90},
180    base=-2 7 -3 3,planmarks,showBase]
181 \end{pspicture}
182 \end{LTXexample}}
183
184
185 \encadre{La directrice peut être une courbe quelconque et n'est pas obligatoirement une courbe plane et horizontale.}
186
187 \begin{LTXexample}[width=8cm]
188 \begin{pspicture}(-1.5,-4)(4,6)
189 \psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -5 10 rtp2xyz,Decran=100}
190 \psSolid[object=grille,base=-4 4 -4 4,ngrid=8. 8.](0,0,-1)
191 \defFunction[algebraic]{G9}(t)
192     {3*cos(t)}
193     {3*sin(t)}
194     {1*cos(5*t)}
195 \psSolid[object=cylindre,
196    range=0 6.28,
197    h=5,
198    function=G9,
199    axe=0 0 1,
200    incolor=green!50,
201    fillcolor=yellow!50,
202    ngrid=4 72,grid]
203 \end{pspicture}
204 \end{LTXexample}
205
206 \subsection{Cône ou nappe conique quelconque}
207 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
208 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$.
209
210 \begin{LTXexample}[width=7.5cm]
211 \begin{pspicture}(-3,-3)(4.5,5)
212 \psset{lightsrc=viewpoint,viewpoint=100 10 10 rtp2xyz,Decran=100}
213 \psSolid[object=grille,base=-4 4 -3 3,action=draw](0,0,-2)
214 \defFunction[algebraic]{G1}(t)
215     {t}
216     {0.25*t^2}
217     {-2}
218 \defFunction[algebraic]{G2}(t)
219     {-t}
220     {-0.25*t^2}
221     {2}
222 \psSolid[object=courbe,
223    function=G1,
224    range=-3.46 3,
225    r=0,
226    linecolor=blue,
227    linewidth=2pt]
228 \psSolid[object=cone,
229    function=G1,
230    range=-3.46 3,
231    ngrid=3 16,
232    incolor=green!50,
233    fillcolor=yellow!50,
234    origine=0 0 0]
235 \psSolid[object=courbe,
236    function=G2,
237    range=-3.46 3,
238    r=0,
239    linecolor=blue,
240    linewidth=2pt]
241 \psPoint(0,0,0){I}
242 \uput[l](I){\red$(0,0,0)$}
243 \psdot[linecolor=red](I)
244 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3)
245 \end{pspicture}
246 \end{LTXexample}
247
248 \begin{LTXexample}[width=7.5cm]
249 \begin{pspicture}(-3,-3)(4.5,5)
250 \psset{lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
251 \psSolid[object=grille,base=-4 4 -3 3,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
252 \defFunction[algebraic]{G1}(t)
253     {t}
254     {2*sin(t)}
255     {-2}
256 \defFunction[algebraic]{G2}(t)
257     {-t}
258     {-2*sin(t)}
259     {2}
260 \psSolid[object=courbe,
261    function=G1,
262    range=-3.14 3.14,
263    r=0,
264    linecolor=blue,
265    linewidth=2pt]
266 \psSolid[object=cone,
267    function=G1,
268    range=-3.14 3.14,
269    ngrid=3 16,
270    incolor=green!50,
271    fillcolor=yellow!50,
272    origine=0 0 0]
273 \psSolid[object=courbe,
274    function=G2,
275    range=-3.14 3.14,
276    r=0,
277    linecolor=blue,
278    linewidth=2pt]
279 \psPoint(0,0,0){I}
280 \uput[l](I){\red$(0,0,0)$}
281 \psdot[linecolor=red](I)
282 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3)
283 \end{pspicture}
284 \end{LTXexample}
285
286 \begin{LTXexample}[width=7.5cm]
287 \begin{pspicture}(-3,-3)(4.5,5)
288 \psset{lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
289 \psSolid[object=grille,base=-4 4 -4 4,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
290 \defFunction[algebraic]{G1}(t)
291     {t}
292     {2*sin(t)}
293     {-2}
294 \defFunction[algebraic]{G2}(t)
295     {-t}{-2*sin(t)-2}
296     {2}
297 \psSolid[object=courbe,
298    function=G1,
299    range=-3.14 3.14,
300    r=0,
301    linecolor=blue,
302    linewidth=2pt]
303 \psSolid[object=cone,
304    function=G1,
305    range=-3.14 3.14,
306    ngrid=3 16,
307    incolor=green!50,
308    fillcolor=yellow!50,
309    origine=0 -1 0]
310 \psSolid[object=courbe,
311    function=G2,
312    range=-3.14 3.14,
313    r=0,
314    linecolor=blue,
315    linewidth=2pt]
316 \psPoint(0,-1,0){I}
317 \uput[l](I){\red$(0,-1,0)$}
318 \psdot[linecolor=red](I)
319 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-4,4)
320 \end{pspicture}
321 \end{LTXexample}
322
323 \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
324 l'exemple suivant écrit par Maxime Chupin.
325 \newline
326 \centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/cone/cone-dir_02.pst}}} 
327
328 \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.