summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/src/par-cylindres-cones-en.tex
blob: 2f5c695d14e63bfbbfa3b2e21a909bfcd9f06a62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
\section{Generalization of the notion of a cylinder and a cone}

\subsection{Cylinder or \Index{cylindric area}}

This paragraph generalizes the  notion of a cylinder, or a cylindric
area\footnote{This was written by
Maxime \textsc{Chupin}, as a result of a question on the list
\url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}.
A \textit{routing} curve has to be defined by a function and the
direction of the \textit{cylinder} axis needs to be arranged. In
the example below the routing curve is sinusoidal, situated in the plane $z=-2$:
\begin{verbatim}
\defFunction[algebraic]{G1}(t){t}{2*sin(t)}{-2}
\end{verbatim}
The direction of the cylinder is defined by the components of a vector
\texttt{\Lkeyword{axe}=0 1 1}. The drawing calls  \Lkeyword{object}=\Lkeyval{cylindre} which
in addition to the usual parameters---which is the height \texttt{\Lkeyword{h}=4}---
is about the \textbf{length of the generator} and not of the distance
between the two base planes, and needs to define the routing curve
\texttt{\Lkeyword{function}=G1} and the interval of the variable $t$ \texttt{\Lkeyword{range}=-3 3}.

\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}


\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}

In the following example, before drawing the horizontal planes, we calculate the
distance between these two planes.

 \begin{verbatim}
\pstVerb{/ladistance 2 sqrt 2 mul def}
 \end{verbatim}

{\psset{unit=0.75,lightsrc=viewpoint,viewpoint=100 -10 20 rtp2xyz,Decran=100}
\begin{LTXexample}[pos=t]
\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}}


\begin{LTXexample}[width=8cm]
\psset{unit=0.75,lightsrc=viewpoint,
  viewpoint=100 -10 20 rtp2xyz,Decran=100}
\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\'{e}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}

\begin{LTXexample}[width=8cm]
\psset{unit=0.75,lightsrc=viewpoint,
  viewpoint=100 -10 20 rtp2xyz,Decran=100}
\begin{pspicture}(-3.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{The routing curve can be any curve and need not necessarily be a plane horizontal.}

\begin{LTXexample}[width=8cm]
\begin{pspicture}(-3.5,-2)(4,5)
\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{Cone or \Index{conic area}}
This paragraph generalizes the  notion of a cone, or a conic
area\footnote{This was written by
Maxime \textsc{Chupin}, as the result of a question on the list
\url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse}}.
A \textit{routing} curve needs to be defined by a function which
defines the base of the cone, and the vertex of the \textit{cone}
which is by default \texttt{\Lkeyword{origine}=0 0 0}.  The parts above and
below the cone are symmetric concerning the vertice.  In the example
below, the routing curve is a parabolic arc, situated in the plane $z=-2$.

\begin{LTXexample}[width=7.5cm]
\begin{pspicture}(-3,-4)(4.5,6)
\psset{unit=0.75,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,-4)(4.5,6)
\psset{unit=0.7,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,-4)(4.5,6)
\psset{unit=0.7,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{For the cones as well, the routing curve can be any curve and need not necessarily
be a plane horizontal curve, as the following example, written by Maxime
\textsc{Chupin}, will show.}

\centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/cone/cone-dir_02.pst}}

\endinput