Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-surfaces-en.tex.svn-base
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 \end{verbatim}
7  with the same options which apply to solids, and these additional
8 ones:
9 \begin{itemize}
10   \item The surface grid is defined by the parameter
11     \texttt{\Lkeyword{ngrid}=n1 n2}, which has these specifics:
12
13 \begin{minipage}{1\linewidth}
14   \begin{itemize}
15     \item If \texttt{n1} and/or  \texttt{n2} are integers, the
16       number(s) represent(s) the number of grids following $Ox$ and/or
17       $Oy$.
18     \item If \texttt{n1} and/or  \texttt{n2 } are decimals, the
19       number(s) represent(s) the incrementing steps following $Ox$
20       and/or $Oy$.
21     \item If \texttt{\Lkeyword{ngrid}=n}, with only one parameter value,
22       the number of grids, or the incrementing steps,
23       are identical on both axes.
24   \end{itemize}
25 \end{minipage}
26
27   \item \Lkeyword{algebraic}: this option allows you to write the function in
28 algebraic notation; \texttt{pstricks.pro} meanwhile contains
29 the code \texttt{AlgToPs}
30    from Dominique \textsc{Rodriguez}, which allows this notation and which is
31 included in the \texttt{pstricks-add.pro} file. This version
32 of \texttt{pstricks} %%%% should this be pstricks-add(.pro) ??
33    is provided with \texttt{pst-solides3d}. If necessary, you must load the
34 \texttt{pstricks-add} package in the document preamble.
35   \item \Lkeyword{grid}: by default the grid is activated. If the
36   option \Lkeyword{grid} is used, the grid will be deactivated! %%%% this seems perverse; would [nogrid] be better?
37   \item \Lkeyword{axesboxed}: this option allows you to draw the 3D
38   coordinate axes
39 in a semi-automatic way, but because of the need to specify
40 the limits of $z$ by hand this option is deactivated by
41 default:
42    \begin{itemize}
43      \item \Lkeyword{Zmin}: minimum value;
44      \item \Lkeyword{Zmax}: maximum value;
45      \item \Lkeyword{QZ}: allows a vertical shift of the coordinate axes
46 with the value \texttt{\Lkeyword{QZ}=value};
47      \item \Lkeyword{spotX}: alters the placing of the $x$-axis tick values
48      at the end of ticks, if the default behaviour is unsatisfactory.
49      The positioning can be altered with the command
50 \verb+\uput[angle](x,y){ticklabel}+;
51      \item \Lkeyword{spotY}: is similar;
52      \item \Lkeyword{spotZ}: likewise.
53    \end{itemize}
54 \end{itemize}
55 If the option \Lkeyword{axesboxed} doesn't meet your needs, it is
56 possible to adapt the following command, which is appropriate for
57 the first example:
58
59
60
61 \small
62 \begin{verbatim}
63 \psSolid[object=parallelepiped,a=8,b=8,c=8,action=draw](0,0,0)
64 \multido{\ix=-4+1}{9}{%
65     \psPoint(\ix\space,4,-4){X1}
66     \psPoint(\ix\space,4.2,-4){X2}
67     \psline(X1)(X2)\uput[dr](X1){\ix}}
68 \multido{\iy=-4+1}{9}{%
69     \psPoint(4,\iy\space,-4){Y1}
70     \psPoint(4.2,\iy\space,-4){Y2}
71     \psline(Y1)(Y2)\uput[dl](Y1){\iy}}
72 \multido{\iz=-4+1}{9}{%
73     \psPoint(4,-4,\iz\space){Z1}
74     \psPoint(4,-4.2,\iz\space){Z2}
75     \psline(Z1)(Z2)\uput[l](Z1){\iz}}
76 \end{verbatim}
77
78 %L'option \Cadre{[hue=0 1]} permet de remplir les facettes avec des d\'{e}grad\'{e}s
79 %de couleur.
80 \section{Example 1: a \Index{saddle}}
81 \begin{LTXexample}[width=7.5cm]
82 \psset{unit=0.45}
83 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
84 \psset{lightsrc=viewpoint}
85 \begin{pspicture}(-7,-8)(7,8)
86 \psSurface[ngrid=.25 .25,incolor=yellow,
87    linewidth=0.5\pslinewidth,axesboxed,
88    algebraic,hue=0 1](-4,-4)(4,4){%
89    ((y^2)-(x^2))/4 }
90 \end{pspicture}
91 \end{LTXexample}
92 %\newpage
93 \section{Example 2: a saddle without a grid}
94
95 The grid lines are suppressed, when using in the option:
96 \Lkeyword{grid}.
97 \begin{LTXexample}[width=7.5cm]
98 \psset{unit=0.5}
99 \psset{lightsrc=30 30 25}
100 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
101 \begin{pspicture}(-7,-8)(7,8)
102 \psSurface[fillcolor=red!50,ngrid=.25 .25,
103    incolor=yellow,linewidth=0.5\pslinewidth,
104    grid,axesboxed](-4,-4)(4,4){%
105    y dup mul x dup mul sub 4 div }
106 \end{pspicture}
107 \end{LTXexample}
108
109 %\newpage
110
111 \section{Example 3: a \Index{paraboloid}}
112
113 \begin{LTXexample}[width=7.5cm]
114 \psset{unit=0.5}
115 \psset{lightsrc=30 -10 10,linewidth=0.5\pslinewidth}
116 \psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
117 \begin{pspicture}(-7,-4)(7,12)
118 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
119 \psSurface[
120    fillcolor=cyan!50,
121    intersectionplan={[0 0 1 -5]},
122    intersectioncolor=(bleu),
123    intersectionlinewidth=3,
124     intersectiontype=0,
125      ngrid=.25 .25,incolor=yellow,
126    axesboxed,Zmin=0,Zmax=8,QZ=4](-4,-4)(4,4){%
127    y dup mul x dup mul add 4 div }
128 \end{pspicture}
129 \end{LTXexample}
130
131 \newpage
132
133 \section{Example 4: a \Index{sinusoidal wave}}
134 \begin{LTXexample}[width=7.5cm]
135 \psset{unit=0.35}
136 \psset{lightsrc=30 -10 10}
137 \psset{viewpoint=50 20 30 rtp2xyz,Decran=70}
138 \begin{pspicture}(-11,-8)(7,8)
139 \psSurface[ngrid=.2 .2,algebraic,Zmin=-1,Zmax=1,
140            linewidth=0.5\pslinewidth,spotX=r,spotY=d,spotZ=l,
141            hue=0 1](-5,-5)(5,5){%
142    sin((x^2+y^2)/3) }
143 \end{pspicture}
144 \end{LTXexample}
145
146 %\newpage
147
148 \section{Example 5: another \Index{sinusoidal wave}}
149
150 In this example we show how to colour the faces, each with a
151 different coloration, directly using PostScript code.
152
153 \begin{LTXexample}[width=7.5cm]
154 \psset{unit=0.25}
155 \psset{lightsrc=30 -10 10}
156 \psset{viewpoint=100 20 20 rtp2xyz,Decran=80}
157 \begin{pspicture}(-15,-10)(7,12)
158 \psSurface[ngrid=0.4 0.4,algebraic,Zmin=-2,Zmax=10,QZ=4,
159            linewidth=0.25\pslinewidth,
160            fcol=0 1 4225
161            {/iF ED iF [iF 4225 div 0.75 1] (sethsbcolor) astr2str} for
162           ](-13,-13)(13,13){%
163    10*sin(sqrt((x^2+y^2)))/(sqrt(x^2+y^2)) }
164 \end{pspicture}
165 \end{LTXexample}
166
167 %\newpage
168
169 \section{Example 6: a \Index{hyperbolic paraboloid} with the equation $z = xy$}
170
171 In this example we combine the graph of the surface and the curves
172 of intersection of the paraboloid with the planes $z=4$ and
173 $z=-4$. In this case we use \verb+\psSolid[object=courbe]+.
174 \begin{verbatim}
175 \defFunction{F}(t){t}{4 t div 4 min}{4}
176 \psSolid[object=courbe,range=1 4,
177    linecolor=red,linewidth=2\pslinewidth,
178    function=F]
179 \end{verbatim}
180 You will note the use of the functions \texttt{min} and
181 \texttt{max}, which return the minimum and the maximum,
182 respectively, of two values.
183
184
185 \begin{LTXexample}[width=7.5cm]
186 \psset{unit=0.5}
187 \psset{viewpoint=50 20 30 rtp2xyz,Decran=50}
188 \psset{lightsrc=viewpoint,linewidth=0.5\pslinewidth}
189 \begin{pspicture}(-7,-8)(7,8)
190 \psSolid[object=datfile,file=./paraboloid,hue=0 1 0.5 1,incolor=yellow]
191 \gridIIID[Zmin=-4,Zmax=4,spotX=r](-4,4)(-4,4)
192 \defFunction{F}(t){t}{4 t div 4 min}{4}
193 \psSolid[object=courbe,range=1 4,r=0,
194    linecolor=red,linewidth=2\pslinewidth,
195    function=F]
196 \defFunction{G}(t){t}{4 t div -4 max}{4}
197 \psSolid[object=courbe,range=-1 -4,r=0,
198    linecolor=red,linewidth=2\pslinewidth,
199    function=G]
200 \defFunction{H}(t){t neg}{4 t div -4 max}{-4}
201 \psSolid[object=courbe,range=-1 -4,r=0,
202    linecolor=red,linewidth=2\pslinewidth,
203    function=H]
204 \end{pspicture}
205 \end{LTXexample}
206 %\newpage
207
208 \section{Example 7: a surface with the equation $z = xy(x^2+y^2)$}
209
210 \begin{LTXexample}[width=7.5cm]
211 \psset{unit=0.35}
212 \psset{lightsrc=10 12 20,linewidth=0.5\pslinewidth}
213 \psset{viewpoint=30 50 60 rtp2xyz,Decran=50}
214 \begin{pspicture}(-10,-10)(12,10)
215 \psSurface[
216    fillcolor=cyan!50,algebraic,
217    ngrid=.25 .25,incolor=yellow,hue=0 1,
218    Zmin=-3,Zmax=3](-3,-3)(3,3){%
219    x*y*(x^2-y^2)*0.1}
220 \end{pspicture}
221 \end{LTXexample}
222
223 \section{Example 8: a surface with the equation $z = \left(1-\frac{x^2+y^2}{2}\right)^2$}% $
224
225 \begin{LTXexample}[width=7.5cm]
226 \psset{unit=0.5cm,viewpoint=50 60 30 rtp2xyz,Decran=50}
227 \psset{lightsrc=viewpoint}
228 \begin{pspicture}(-4,-5)(6,8)
229   \psSurface[ngrid=.25 .25,incolor=yellow,linewidth=0.5\pslinewidth,
230     base= -2 2 -2 2, axesboxed, Zmin=-5,Zmax=2,hue=0 1](-5,-5)(5,5){%
231     1 0.5 x dup mul y dup mul add mul sub dup -5 lt { pop -5 }if }
232 \end{pspicture}
233 \end{LTXexample}
234
235 \begin{LTXexample}[width=7.5cm]
236 \psset{unit=0.5cm,viewpoint=50 60 30 rtp2xyz,Decran=50,
237   lightsrc=viewpoint}
238 \begin{pspicture}(-4,-5)(6,8)
239   \psSurface*[ngrid=.25 .25,incolor=yellow,
240     linewidth=0.5\pslinewidth,
241     r = 3 sqrt 2 mul, axesboxed, Zmin=-5,Zmax=2,hue=0 1](-5,-5)(5,5){%
242     1 0.5 x dup mul y dup mul add mul sub dup -5 lt { pop -5 }if }
243 \end{pspicture}
244 \end{LTXexample}
245
246
247
248 \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.