Debian Codegraph @

texmf-dist/doc/generic/pst-solides3d/text/par-surfaces-en.tex

raw
1 \section{Presentation}
2
3 The command has the following form:
4 \begin{verbatim}
5 \psSurface[options](xmin,ymin)(xmax,ymax){equation of the surface z=f(x,y)}
6 \psSurface*[options,r=...,xytranslate](xmin,ymin)(xmax,ymax){equation of the surface z=f(x,y)}
7 \end{verbatim}
8 with the same options which apply to solids, and these additional
9 ones:
10 \begin{itemize}
11 \item The surface grid is defined by the parameter
12 \texttt{\Lkeyword{ngrid}=n1 n2}, which has these specifics:
13
14 \begin{minipage}{1\linewidth}
15 \begin{itemize}
16 \item If \texttt{n1} and/or \texttt{n2} are integers, the
17 number(s) represent(s) the number of grids following $Ox$ and/or
18 $Oy$.
19 \item If \texttt{n1} and/or \texttt{n2 } are decimals, the
20 number(s) represent(s) the incrementing steps following $Ox$
21 and/or $Oy$.
22 \item If \texttt{\Lkeyword{ngrid}=n}, with only one parameter value,
23 the number of grids, or the incrementing steps,
24 are identical on both axes.
25 \item \Lkeyword{r} defines the length of an origin vector (radius) which controls
26 the calculated points which must be inside the sphere, defined by the vector $\vec{r}$.
27 \item \Lkeyword{xytranslate}\verb|= x y| defines the translation of the vector in the
28 $x-y$-plane.
29
30 \end{itemize}
31 \end{minipage}
32
33 \item \Lkeyword{algebraic}: this option allows you to write the function in
34 algebraic notation; \texttt{pstricks.pro} meanwhile contains
35 the code \texttt{AlgToPs}
36 from Dominique \textsc{Rodriguez}, which allows this notation and which is
37 included in the \texttt{pstricks-add.pro} file. This version
38 of \texttt{pstricks} %%%% should this be pstricks-add(.pro) ??
39 is provided with \texttt{pst-solides3d}. If necessary, you must load the
40 \texttt{pstricks-add} package in the document preamble.
41 \item \Lkeyword{grid}: by default the grid is activated. If the
42 option \Lkeyword{grid} is used, the grid will be deactivated! %%%% this seems perverse; would [nogrid] be better?
43 \item \Lkeyword{axesboxed}: this option allows you to draw the 3D
44 coordinate axes
45 in a semi-automatic way, but because of the need to specify
46 the limits of $z$ by hand this option is deactivated by
47 default:
48 \begin{itemize}
49 \item \Lkeyword{Zmin}: minimum value;
50 \item \Lkeyword{Zmax}: maximum value;
51 \item \Lkeyword{QZ}: allows a vertical shift of the coordinate axes
52 with the value \texttt{\Lkeyword{QZ}=value};
53 \item \Lkeyword{spotX}: alters the placing of the $x$-axis tick values
54 at the end of ticks, if the default behaviour is unsatisfactory.
55 The positioning can be altered with the command
56 \verb+\uput[angle](x,y){ticklabel}+;
57 \item \Lkeyword{spotY}: is similar;
58 \item \Lkeyword{spotZ}: likewise.
59 \end{itemize}
60 \end{itemize}
61 If the option \Lkeyword{axesboxed} doesn't meet your needs, it is
62 possible to adapt the following command, which is appropriate for
63 the first example:
64
65
66
67 \small
68 \begin{verbatim}
69 \psSolid[object=parallelepiped,a=8,b=8,c=8,action=draw](0,0,0)
70 \multido{\ix=-4+1}{9}{%
71 \psPoint(\ix\space,4,-4){X1}
72 \psPoint(\ix\space,4.2,-4){X2}
73 \psline(X1)(X2)\uput[dr](X1){\ix}}
74 \multido{\iy=-4+1}{9}{%
75 \psPoint(4,\iy\space,-4){Y1}
76 \psPoint(4.2,\iy\space,-4){Y2}
77 \psline(Y1)(Y2)\uput[dl](Y1){\iy}}
78 \multido{\iz=-4+1}{9}{%
79 \psPoint(4,-4,\iz\space){Z1}
80 \psPoint(4,-4.2,\iz\space){Z2}
81 \psline(Z1)(Z2)\uput[l](Z1){\iz}}
82 \end{verbatim}
83
84 %L'option \Cadre{[hue=0 1]} permet de remplir les facettes avec des d\'{e}grad\'{e}s
85 %de couleur.
86 \section{Example 1: a \Index{saddle}}
87 \begin{LTXexample}[width=7.5cm]
88 \psset{unit=0.45}
89 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
90 \psset{lightsrc=viewpoint}
91 \begin{pspicture}(-7,-8)(7,8)
92 \psSurface[ngrid=.25 .25,incolor=yellow,
93 linewidth=0.5\pslinewidth,axesboxed,
94 algebraic,hue=0 1](-4,-4)(4,4){%
95 ((y^2)-(x^2))/4 }
96 \end{pspicture}
97 \end{LTXexample}
98
99 \newpage
100 \section{Example 2: a saddle without a grid}
101
102 The grid lines are suppressed, when using in the option:
103 \Lkeyword{grid}.
104 \begin{LTXexample}[width=7.5cm]
105 \psset{unit=0.5}
106 \psset{lightsrc=30 30 25}
107 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
108 \begin{pspicture}(-7,-8)(7,8)
109 \psSurface[fillcolor=red!50,ngrid=.25 .25,
110 incolor=yellow,linewidth=0.5\pslinewidth,
111 grid,axesboxed](-4,-4)(4,4){%
112 y dup mul x dup mul sub 4 div }
113 \end{pspicture}
114 \end{LTXexample}
115
116 %\newpage
117
118 \section{Example 3: a \Index{paraboloid}}
119
120 \begin{LTXexample}[width=7.5cm]
121 \psset{unit=0.5}
122 \psset{lightsrc=30 -10 10,linewidth=0.5\pslinewidth}
123 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
124 \begin{pspicture}(-7,-4)(7,12)
125 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
126 \psSurface[
127 fillcolor=cyan!50,
128 intersectionplan={[0 0 1 -5]},
129 intersectioncolor=(bleu),
130 intersectionlinewidth=3,
131 intersectiontype=0,
132 ngrid=.25 .25,incolor=yellow,
133 axesboxed,Zmin=0,Zmax=8,QZ=4](-4,-4)(4,4){%
134 y dup mul x dup mul add 4 div }
135 \end{pspicture}
136 \end{LTXexample}
137
138 \newpage
139
140 \section{Star version of \texttt{\textbackslash pstSurface}}
141
142 \begin{verbatim}
143 \psset{viewpoint=50 20 20 rtp2xyz,Decran=100,lightsrc=viewpoint}
144 \begin{pspicture}(-5,-4)(6,6)
145 \psSolid[object=grille,base=-2 2 -2 2,action=draw]%
146 \axesIIID(0,0,0)(2,2,1)
147 \psSurface*[
148 fillcolor=cyan,r=1,
149 ngrid=.25 .25,incolor=yellow,grid,
150 algebraic](-1,-1)(1,1){ e^(x*y) }
151 \psSolid[object=cylindre,r=1,h=2,action=draw,ngrid=1 18]
152 \psPoint(0,0,1){O}
153 \psPoint(0,0,3){Z}
154 \psline{->}(O)(Z)
155 \uput[r](Z){$z$}
156 \psPoint(0.5,0.5,0){C}
157 \psdot[linecolor=red,dotstyle=x,dotscale=2](C)
158 \end{pspicture}
159
160 \begin{pspicture}(-5,-4)(6,10)
161 \psSolid[object=grille,base=-2 2 -2 2,action=draw]%
162 \axesIIID(0,0,0)(2,2,1)
163 \psSurface*[
164 fillcolor=cyan,r=1,xytranslate=0.5 0.5,
165 ngrid=.25 .25,incolor=yellow,grid,
166 algebraic](-1,-1)(1,1){ e^(x*y) }
167 \psSolid[object=cylindre,r=1,h=4,action=draw,ngrid=1 18](0.5,0.5,0)
168 \psPoint(0,0,1){O}
169 \psPoint(0,0,5){Z}
170 \psline{->}(O)(Z)
171 \uput[r](Z){$z$}
172 \psPoint(0.5,0.5,0){C}
173 \psdot[linecolor=red,dotstyle=x,dotscale=2](C)
174 \end{pspicture}
175 \end{verbatim}
176
177 \iffalse
178 %\begin{landscape}
179 \psset{viewpoint=50 20 20 rtp2xyz,Decran=100,lightsrc=viewpoint}
180 \begin{pspicture}(-5,-4)(6,6)
181 \psSolid[object=grille,base=-2 2 -2 2,action=draw]%
182 \axesIIID(0,0,0)(2,2,1)
183 \psSurface*[
184 fillcolor=cyan,r=1,
185 ngrid=.25 .25,incolor=yellow,grid,
186 algebraic](-1,-1)(1,1){ e^(x*y) }
187 \psSolid[object=cylindre,r=1,h=2,action=draw,ngrid=1 18]
188 \psPoint(0,0,1){O}
189 \psPoint(0,0,3){Z}
190 \psline{->}(O)(Z)
191 \uput[r](Z){$z$}
192 \psPoint(0.5,0.5,0){C}
193 \psdot[linecolor=red,dotstyle=x,dotscale=2](C)
194 \end{pspicture}
195
196 \begin{pspicture}(-5,-4)(6,10)
197 \psSolid[object=grille,base=-2 2 -2 2,action=draw]%
198 \axesIIID(0,0,0)(2,2,1)
199 \psSurface*[
200 fillcolor=cyan,r=1,xytranslate=0.5 0.5,
201 ngrid=.25 .25,incolor=yellow,grid,
202 algebraic](-1,-1)(1,1){ e^(x*y) }
203 \psSolid[object=cylindre,r=1,h=4,action=draw,ngrid=1 18](0.5,0.5,0)
204 \psPoint(0,0,1){O}
205 \psPoint(0,0,5){Z}
206 \psline{->}(O)(Z)
207 \uput[r](Z){$z$}
208 \psPoint(0.5,0.5,0){C}
209 \psdot[linecolor=red,dotstyle=x,dotscale=2](C)
210 \end{pspicture}
211 %\end{landscape}
212
213 \fi
214
215 \section{Example 4: a \Index{sinusoidal wave}}
216 \begin{LTXexample}[width=7.5cm]
217 \psset{unit=0.35}
218 \psset{lightsrc=30 -10 10}
219 \psset{viewpoint=50 20 30 rtp2xyz,Decran=70}
220 \begin{pspicture}(-11,-8)(7,8)
221 \psSurface[ngrid=.2 .2,algebraic,Zmin=-1,Zmax=1,
222 linewidth=0.5\pslinewidth,spotX=r,spotY=d,spotZ=l,
223 hue=0 1](-5,-5)(5,5){%
224 sin((x^2+y^2)/3) }
225 \end{pspicture}
226 \end{LTXexample}
227
228 %\newpage
229
230 \section{Example 5: another \Index{sinusoidal wave}}
231
232 In this example we show how to colour the faces, each with a
233 different coloration, directly using PostScript code.
234
235 \begin{LTXexample}[width=7.5cm]
236 \psset{unit=0.25}
237 \psset{lightsrc=30 -10 10}
238 \psset{viewpoint=100 20 20 rtp2xyz,Decran=80}
239 \begin{pspicture}(-15,-10)(7,12)
240 \psSurface[ngrid=0.4 0.4,algebraic,Zmin=-2,Zmax=10,QZ=4,
241 linewidth=0.25\pslinewidth,
242 fcol=0 1 4225
243 {/iF ED iF [iF 4225 div 0.75 1] (sethsbcolor) astr2str} for
244 ](-13,-13)(13,13){%
245 10*sin(sqrt((x^2+y^2)))/(sqrt(x^2+y^2)) }
246 \end{pspicture}
247 \end{LTXexample}
248
249 %\newpage
250
251 \section{Example 6: a \Index{hyperbolic paraboloid} with the equation $z = xy$}
252
253 In this example we combine the graph of the surface and the curves
254 of intersection of the paraboloid with the planes $z=4$ and
255 $z=-4$. In this case we use \verb+\psSolid[object=courbe]+.
256 \begin{verbatim}
257 \defFunction{F}(t){t}{4 t div 4 min}{4}
258 \psSolid[object=courbe,range=1 4,
259 linecolor=red,linewidth=2\pslinewidth,
260 function=F]
261 \end{verbatim}
262 You will note the use of the functions \texttt{min} and
263 \texttt{max}, which return the minimum and the maximum,
264 respectively, of two values.
265
266
267 \begin{LTXexample}[width=7.5cm]
268 \psset{unit=0.5}
269 \psset{viewpoint=50 20 30 rtp2xyz,Decran=50}
270 \psset{lightsrc=viewpoint,linewidth=0.5\pslinewidth}
271 \begin{pspicture}(-7,-8)(7,8)
272 \psSolid[object=datfile,filename=data/paraboloid,hue=0 1 0.5 1,incolor=yellow]
273 \gridIIID[Zmin=-4,Zmax=4,spotX=r](-4,4)(-4,4)
274 \defFunction{F}(t){t}{4 t div 4 min}{4}
275 \psSolid[object=courbe,range=1 4,r=0,
276 linecolor=red,linewidth=2\pslinewidth,
277 function=F]
278 \defFunction{G}(t){t}{4 t div -4 max}{4}
279 \psSolid[object=courbe,range=-1 -4,r=0,
280 linecolor=red,linewidth=2\pslinewidth,
281 function=G]
282 \defFunction{H}(t){t neg}{4 t div -4 max}{-4}
283 \psSolid[object=courbe,range=-1 -4,r=0,
284 linecolor=red,linewidth=2\pslinewidth,
285 function=H]
286 \end{pspicture}
287 \end{LTXexample}
288 %\newpage
289
290 \section{Example 7: a surface with the equation $z = xy(x^2+y^2)$}
291
292 \begin{LTXexample}[width=7.5cm]
293 \psset{unit=0.35}
294 \psset{lightsrc=10 12 20,linewidth=0.5\pslinewidth}
295 \psset{viewpoint=30 50 60 rtp2xyz,Decran=50}
296 \begin{pspicture}(-10,-10)(12,10)
297 \psSurface[
298 fillcolor=cyan!50,algebraic,
299 ngrid=.25 .25,incolor=yellow,hue=0 1,
300 Zmin=-3,Zmax=3](-3,-3)(3,3){%
301 x*y*(x^2-y^2)*0.1}
302 \end{pspicture}
303 \end{LTXexample}
304
305
306 \newpage
307
308
309 \section{Example 8: a surface with the equation $z = \left(1-\frac{x^2+y^2}{2}\right)^2$}% $
310
311 \begin{LTXexample}[width=7.5cm]
312 \psset{unit=0.5cm,viewpoint=50 60 30 rtp2xyz,Decran=50}
313 \psset{lightsrc=viewpoint}
314 \begin{pspicture}(-4,-5)(6,8)
315 \psSurface[ngrid=.25 .25,incolor=yellow,linewidth=0.5\pslinewidth,
316 base= -2 2 -2 2, axesboxed, Zmin=-5,Zmax=2,hue=0 1](-5,-5)(5,5){%
317 1 0.5 x dup mul y dup mul add mul sub dup -5 lt { pop -5 }if }
318 \end{pspicture}
319 \end{LTXexample}
320
321 \begin{LTXexample}[width=7.5cm]
322 \psset{unit=0.5cm,viewpoint=50 60 30 rtp2xyz,Decran=50,
323 lightsrc=viewpoint}
324 \begin{pspicture}(-4,-5)(6,8)
325 \psSurface*[ngrid=.25 .25,incolor=yellow,
326 linewidth=0.5\pslinewidth,
327 r = 3 sqrt 2 mul, axesboxed, Zmin=-5,Zmax=2,hue=0 1](-5,-5)(5,5){%
328 1 0.5 x dup mul y dup mul add mul sub dup -5 lt { pop -5 }if }
329 \end{pspicture}
330 \end{LTXexample}
331
332
333
334 \endinput