Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / par-cylindres-cones-en.tex
1 \section{Generalization of the notion of a cylinder and a cone}
2
3 \subsection{Cylinder or \Index{cylindric area}}
4
5 This paragraph generalizes the notion of a cylinder, or a cylindric
6 area\footnote{This was written by
7 Maxime \textsc{Chupin}, as a result of a question on the list
8 \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}.
9 A \textit{routing} curve has to be defined by a function and the
10 direction of the \textit{cylinder} axis needs to be arranged. In
11 the example below the routing curve is sinusoidal, situated in the plane $z=-2$:
12 \begin{verbatim}
13 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
14 \end{verbatim}
15 The direction of the cylinder is defined by the components of a vector
16 \texttt{\Lkeyword{axe}=0 1 1}. The drawing calls \Lkeyword{object}=\Lkeyval{cylindre} which
17 in addition to the usual parameters---which is the height \texttt{\Lkeyword{h}=4}---
18 is about the \textbf{length of the generator} and not of the distance
19 between the two base planes, and needs to define the routing curve
20 \texttt{\Lkeyword{function}=G1} and the interval of the variable $t$ \texttt{\Lkeyword{range}=-3 3}.
21
22 \begin{verbatim}
23 \psSolid[object=cylindre,
24 h=4,function=G1,
25 range=-3 3,
26 ngrid=3 16,
27 axe=0 1 1,
28 incolor=green!50,
29 fillcolor=yellow!50]
30 \end{verbatim}
31
32
33 \begin{center}
34 \psset{unit=0.75}
35 \begin{pspicture}(-5,-4)(5,4)
36 \psset{lightsrc=viewpoint,viewpoint=100 10 20 rtp2xyz,Decran=100}
37 \psSolid[object=grille,base=-4 4 -6 6,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
38 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
39 \defFunction[algebraic]{G2}(t){t}{2*sin(t)+4}{2}
40 \psSolid[object=courbe,function=G1,
41 range=-3 3,r=0,
42 linecolor=blue,
43 linewidth=2pt]
44 \psSolid[object=cylindre,
45 h=5.65685,function=G1,
46 range=-3 3,
47 ngrid=3 16,
48 axe=0 1 1,
49 incolor=green!50,
50 fillcolor=yellow!50]
51 \psSolid[object=courbe,function=G2,
52 range=-3 3,r=0,
53 linecolor=blue,
54 linewidth=2pt]
55 \psSolid[object=parallelepiped,
56 a=8,b=12,c=4,action=draw](0,0,0)
57 \psSolid[object=plan,action=draw,
58 definition=equation,
59 args={[0 0 1 -2] 90},
60 base=-6 6 -4 4,planmarks,showBase]
61 \psSolid[object=plan,action=draw,
62 definition=equation,
63 args={[0 1 0 -6] 180},
64 base=-4 4 -2 2,planmarks,showBase]
65 \psSolid[object=plan,action=draw,
66 definition=equation,
67 args={[1 0 0 -4] 90},
68 base=-6 6 -2 2,planmarks,showBase]
69 \psSolid[object=vecteur,
70 linecolor=red,
71 args=0 3 3]
72 \end{pspicture}
73 \end{center}
74
75 In the following example, before drawing the horizontal planes, we calculate the
76 distance between these two planes.
77
78 \begin{verbatim}
79 \pstVerb{/ladistance 2 sqrt 2 mul def}
80 \end{verbatim}
81
82 {\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
83 \begin{LTXexample}[pos=t]
84 \begin{pspicture}(-1.5,-3)(6.5,6)
85 \psSolid[object=grille,base=-3 3 -1 8,action=draw]
86 \pstVerb{/ladistance 2 sqrt 2 mul def}
87 \defFunction[algebraic]{G3}(t){6*(cos(t))^3*sin(t)}{4*(cos(t))^2}{0}
88 \defFunction[algebraic]{G4}(t){6*(cos(t))^3*sin(t)}{4*(cos(t))^2+ladistance}{ladistance}
89 \psSolid[object=courbe,function=G3,range=0 6.28,r=0,linecolor=blue,linewidth=2pt]
90 \psSolid[object=cylindre,range=0 -6.28,h=4,function=G3,axe=0 1 1,ngrid=3 36,
91 fillcolor=green!50,incolor=yellow!50]
92 \psSolid[object=courbe,function=G4,range=0 6.28,r=0,linecolor=blue,linewidth=2pt]
93 \psSolid[object=vecteur,linecolor=red,args=0 ladistance dup]
94 \psSolid[object=plan,action=draw,definition=equation,args={[0 0 1 ladistance neg] 90},
95 base=-1 8 -3 3,planmarks,showBase]
96 \axesIIID(0,4.5,0)(4,8,5)
97 \rput(0,-3){\texttt{axe=0 1 1}}
98 \end{pspicture}
99 \end{LTXexample}}
100
101
102 \begin{LTXexample}[width=8cm]
103 \psset{unit=0.75,lightsrc=viewpoint,
104 viewpoint=100 -10 20 rtp2xyz,Decran=100}
105 \begin{pspicture}(-1.5,-3)(6.5,6)
106 \psSolid[object=grille,base=-3 3 -1 6,action=draw]
107 \defFunction[algebraic]{G5}(t)
108 {t}{0.5*t^2}{0}
109 \defFunction[algebraic]{G6}(t)
110 {t}{0.5*t^2}{4}
111 \psSolid[object=courbe,function=G5,
112 range=-3 2,r=0,linecolor=blue,
113 linewidth=2pt]
114 \psSolid[object=cylindre,
115 range=-3 2,h=4,
116 function=G5,
117 axe=0 0 1, %% valeur par d\'{e}faut
118 incolor=green!50,
119 fillcolor=yellow!50,
120 ngrid=3 8]
121 \psSolid[object=courbe,function=G6,
122 range=-3 2,r=0,linecolor=blue,
123 linewidth=2pt]
124 \axesIIID(0,4.5,0)(4,6,5)
125 \psSolid[object=vecteur,
126 linecolor=red,args=0 0 4]
127 \psSolid[object=plan,action=draw,
128 definition=equation,
129 args={[0 0 1 -4] 90},
130 base=-1 6 -3 3,planmarks,showBase]
131 \end{pspicture}
132 \end{LTXexample}
133
134 \begin{LTXexample}[width=8cm]
135 \psset{unit=0.75,lightsrc=viewpoint,
136 viewpoint=100 -10 20 rtp2xyz,Decran=100}
137 \begin{pspicture}(-3.5,-3)(6.5,6)
138 \psset{lightsrc=viewpoint,viewpoint=100 45 45,Decran=100}
139 \psSolid[object=grille,base=-3 3 -2 7,fillcolor=gray!30]
140 \defFunction[algebraic]{G7}(t)
141 {2*cos(t)}{2*sin(t)}{0}
142 \defFunction[algebraic]{G8}(t)
143 {2*cos(t)}{2*sin(t)+4}{4}
144 \psSolid[object=courbe,function=G7,
145 range=0 6.28,r=0,
146 linecolor=blue,linewidth=2pt]
147 \psSolid[object=cylindre,
148 range=0 6.28,h=5.65685,
149 function=G7,axe=0 1 1,
150 incolor=green!20,
151 fillcolor=yellow!50,
152 ngrid=3 36]
153 \psSolid[object=courbe,function=G8,
154 range=0 6.28,r=0,linecolor=blue,
155 linewidth=2pt]
156 \axesIIID(2,4.5,2)(4,8,5)
157 \psSolid[object=vecteur,
158 linecolor=red,args=0 1 1](0,4,4)
159 \psSolid[object=plan,action=draw,
160 definition=equation,
161 args={[0 0 1 -4] 90},
162 base=-2 7 -3 3,planmarks,showBase]
163 \end{pspicture}
164 \end{LTXexample}
165
166
167 \encadre{The routing curve can be any curve and need not necessarily be a plane horizontal.}
168
169 \begin{LTXexample}[width=8cm]
170 \begin{pspicture}(-3.5,-2)(4,5)
171 \psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -5 10 rtp2xyz,Decran=100}
172 \psSolid[object=grille,base=-4 4 -4 4,ngrid=8. 8.](0,0,-1)
173 \defFunction[algebraic]{G9}(t)
174 {3*cos(t)}{3*sin(t)}{1*cos(5*t)}
175 \psSolid[object=cylindre,
176 range=0 6.28,h=5,function=G9,
177 axe=0 0 1,incolor=green!50,
178 fillcolor=yellow!50,
179 ngrid=4 72,grid]
180 \end{pspicture}
181 \end{LTXexample}
182
183 \subsection{Cone or \Index{conic area}}
184 This paragraph generalizes the notion of a cone, or a conic
185 area\footnote{This was written by
186 Maxime \textsc{Chupin}, as the result of a question on the list
187 \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}.
188 A \textit{routing} curve needs to be defined by a function which
189 defines the base of the cone, and the vertex of the \textit{cone}
190 which is by default \texttt{\Lkeyword{origine}=0 0 0}. The parts above and
191 below the cone are symmetric concerning the vertice. In the example
192 below, the routing curve is a parabolic arc, situated in the plane $z=-2$.
193
194 \begin{LTXexample}[width=7.5cm]
195 \begin{pspicture}(-3,-4)(4.5,6)
196 \psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 10 10 rtp2xyz,Decran=100}
197 \psSolid[object=grille,base=-4 4 -3 3,action=draw](0,0,-2)
198 \defFunction[algebraic]{G1}(t){t}{0.25*t^2}{-2}
199 \defFunction[algebraic]{G2}(t){-t}{-0.25*t^2}{2}
200 \psSolid[object=courbe,function=G1,
201 range=-3.46 3,r=0,
202 linecolor=blue,linewidth=2pt]
203 \psSolid[object=cone,function=G1,
204 range=-3.46 3,ngrid=3 16,
205 incolor=green!50,
206 fillcolor=yellow!50,
207 origine=0 0 0]
208 \psSolid[object=courbe,
209 function=G2,range=-3.46 3,
210 r=0,linecolor=blue,
211 linewidth=2pt]
212 \psPoint(0,0,0){I}
213 \uput[l](I){\red$(0,0,0)$}
214 \psdot[linecolor=red](I)
215 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3)
216 \end{pspicture}
217 \end{LTXexample}
218
219 \begin{LTXexample}[width=7.5cm]
220 \begin{pspicture}(-3,-4)(4.5,6)
221 \psset{unit=0.7,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
222 \psSolid[object=grille,base=-4 4 -3 3,
223 linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
224 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
225 \defFunction[algebraic]{G2}(t){-t}{-2*sin(t)}{2}
226 \psSolid[object=courbe,function=G1,
227 range=-3.14 3.14,r=0,
228 linecolor=blue,
229 linewidth=2pt]
230 \psSolid[object=cone,function=G1,
231 range=-3.14 3.14,ngrid=3 16,
232 incolor=green!50,
233 fillcolor=yellow!50,
234 origine=0 0 0]
235 \psSolid[object=courbe,
236 function=G2,range=-3.14 3.14,
237 r=0,linecolor=blue,
238 linewidth=2pt]
239 \psPoint(0,0,0){I} \uput[l](I){\red$(0,0,0)$}
240 \psdot[linecolor=red](I)
241 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-3,3)
242 \end{pspicture}
243 \end{LTXexample}
244
245 \begin{LTXexample}[width=7.5cm]
246 \begin{pspicture}(-3,-4)(4.5,6)
247 \psset{unit=0.7,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
248 \psSolid[object=grille,base=-4 4 -4 4,linecolor={[rgb]{0.72 0.72 0.5}},action=draw](0,0,-2)
249 \defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
250 \defFunction[algebraic]{G2}(t){-t}{-2*sin(t)-2}{2}
251 \psSolid[object=courbe,function=G1,
252 range=-3.14 3.14,r=0,
253 linecolor=blue,
254 linewidth=2pt]
255 \psSolid[object=cone,
256 function=G1,range=-3.14 3.14,
257 ngrid=3 16,incolor=green!50,
258 fillcolor=yellow!50,
259 origine=0 -1 0]
260 \psSolid[object=courbe,
261 function=G2,range=-3.14 3.14,
262 r=0,linecolor=blue,
263 linewidth=2pt]
264 \psPoint(0,-1,0){I}\uput[l](I){\red$(0,-1,0)$}
265 \psdot[linecolor=red](I)
266 \gridIIID[Zmin=-2,Zmax=2,spotX=r](-4,4)(-4,4)
267 \end{pspicture}
268 \end{LTXexample}
269
270 \encadre{For the cones as well, the routing curve can be any curve and need not necessarily
271 be a plane horizontal curve, as the following example, written by Maxime
272 \textsc{Chupin}, will show.}
273
274 \centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/cone/cone-dir_02.pst}}
275
276 \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.