summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/doc-en/par-surfaces_en_corr.tex
blob: abb3d72a6e18cb37bad79a16a467e8fb08acbc3d (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
\section{Presentation}

The command has the following form:
\begin{verbatim}
\psSurface[options](xmin,ymin)(xmax,ymax){equation of the surface z=f(x,y)}
\end{verbatim}
 with the same options which apply to solids, and these additional
ones:
\begin{itemize}
  \item The surface grid is defined by the parameter
    \verb+[ngrid=n1 n2]+, which has these specifics:

\begin{minipage}{1\linewidth}
  \begin{itemize}
    \item If \texttt{n1} and/or  \texttt{n2} are integers, the
      number(s) represent(s) the number of grids following $Ox$ and/or
      $Oy$.
    \item If \texttt{n1} and/or  \texttt{n2 } are decimals, the
      number(s) represent(s) the incrementing steps following $Ox$
      and/or $Oy$.
    \item If \texttt{[ngrid=n]}, with only one parameter value,
      the number of grids, or the incrementing steps,
      are identical on both axes.
  \end{itemize}
\end{minipage}

  \item \texttt{[algebraic]}: this option allows you to write the function in
algebraic notation; \texttt{pstricks.pro} meanwhile contains
the code \texttt{AlgToPs}
   from Dominique \textsc{Rodriguez}, which allows this notation and which is
included in the \texttt{pstricks-add.pro} file. This version
of \texttt{pstricks} %%%% should this be pstricks-add(.pro) ??
   is provided with \texttt{pst-solides3d}. If necessary, you must load the
\texttt{pstricks-add} package in the document preamble.
  \item \texttt{[grid]}: by default the grid is activated. If the
  option \texttt{[grid]} is used, the grid will be deactivated! %%%% this seems perverse; would [nogrid] be better?
  \item \texttt{[axesboxed]}: this option allows you to draw the 3D
  coordinate axes
in a semi-automatic way, but because of the need to specify
the limits of $z$ by hand this option is deactivated by
default:
   \begin{itemize}
     \item \texttt{[Zmin]}: minimum value;
     \item \texttt{[Zmax]}: maximum value;
     \item \texttt{[QZ]}: allows a vertical shift of the coordinate axes
with the value \texttt{[QZ=value]};
     \item \texttt{[spotX]}: alters the placing of the $x$-axis tick values
     at the end of ticks, if the default behaviour is unsatisfactory.
     The positioning can be altered with the command
\verb+\uput[angle](x,y){data}+;
     \item \texttt{[spotY]}: is similar;
     \item \texttt{[spotZ]}: likewise.
   \end{itemize}
\end{itemize}
If the option \verb+[axesboxed]+ doesn't meet your needs, it is
possible to adapt the following command, which is appropriate for
the first example:



\small
\begin{verbatim}
\psSolid[object=parallelepiped,a=8,b=8,c=8,action=draw](0,0,0)
\multido{\ix=-4+1}{9}{%
    \psPoint(\ix\space,4,-4){X1}
    \psPoint(\ix\space,4.2,-4){X2}
    \psline(X1)(X2)\uput[dr](X1){\ix}}
\multido{\iy=-4+1}{9}{%
    \psPoint(4,\iy\space,-4){Y1}
    \psPoint(4.2,\iy\space,-4){Y2}
    \psline(Y1)(Y2)\uput[dl](Y1){\iy}}
\multido{\iz=-4+1}{9}{%
    \psPoint(4,-4,\iz\space){Z1}
    \psPoint(4,-4.2,\iz\space){Z2}
    \psline(Z1)(Z2)\uput[l](Z1){\iz}}
\end{verbatim}

%L'option \Cadre{[hue=0 1]} permet de remplir les facettes avec des d\'{e}grad\'{e}s
%de couleur.
\section{Example 1: a saddle}
\begin{LTXexample}[width=7.5cm]
\psset{unit=0.45}
\psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
\psset{lightsrc=viewpoint}
\begin{pspicture}(-7,-8)(7,8)
\psSurface[ngrid=.25 .25,incolor=yellow,
   linewidth=0.5\pslinewidth,axesboxed,
   algebraic,hue=0 1](-4,-4)(4,4){%
   ((y^2)-(x^2))/4 }
\end{pspicture}
\end{LTXexample}
%\newpage
\section{Example 2: a saddle without a grid}

The grid lines are suppressed, when using in the option:
\verb+grid+.
\begin{LTXexample}[width=7.5cm]
\psset{unit=0.5}
\psset{lightsrc=30 30 25}
\psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
\begin{pspicture}(-7,-8)(7,8)
\psSurface[fillcolor=red!50,ngrid=.25 .25,
   incolor=yellow,linewidth=0.5\pslinewidth,
   grid,axesboxed](-4,-4)(4,4){%
   y dup mul x dup mul sub 4 div }
\end{pspicture}
\end{LTXexample}

%\newpage

\section{Example 3: a paraboloid}

\begin{LTXexample}[width=7.5cm]
\psset{unit=0.5}
\psset{lightsrc=30 -10 10,linewidth=0.5\pslinewidth}
\psset{viewpoint=50 40 30 rtp2xyz,Decran=50}
\begin{pspicture}(-7,-4)(7,12)
\psSolid[object=grille,base=-4 4 -4 4,action=draw]%
\psSurface[
   fillcolor=cyan!50,
   intersectionplan={[0 0 1 -5]},
   intersectioncolor=(bleu),
   intersectionlinewidth=3,
    intersectiontype=0,
     ngrid=.25 .25,incolor=yellow,
   axesboxed,Zmin=0,Zmax=8,QZ=4](-4,-4)(4,4){%
   y dup mul x dup mul add 4 div }
\end{pspicture}
\end{LTXexample}

\newpage

\section{Example 4: a sinusoidal wave}
\begin{LTXexample}[width=7.5cm]
\psset{unit=0.35}
\psset{lightsrc=30 -10 10}
\psset{viewpoint=50 20 30 rtp2xyz,Decran=70}
\begin{pspicture}(-11,-8)(7,8)
\psSurface[ngrid=.2 .2,algebraic,Zmin=-1,Zmax=1,
           linewidth=0.5\pslinewidth,spotX=r,spotY=d,spotZ=l,
           hue=0 1](-5,-5)(5,5){%
   sin((x^2+y^2)/3) }
\end{pspicture}
\end{LTXexample}

%\newpage

\section{Example 5: another sinusoidal wave }

In this example we show how to colour the faces, each with a
different coloration, directly using PostScript code.

\begin{LTXexample}[width=7.5cm]
\psset{unit=0.25}
\psset{lightsrc=30 -10 10}
\psset{viewpoint=100 20 20 rtp2xyz,Decran=80}
\begin{pspicture}(-15,-10)(7,12)
\psSurface[ngrid=0.4 0.4,algebraic,Zmin=-2,Zmax=10,QZ=4,
           linewidth=0.25\pslinewidth,
           fcol=0 1 4225
           {/iF ED iF [iF 4225 div 0.75 1] (sethsbcolor) astr2str} for
          ](-13,-13)(13,13){%
   10*sin(sqrt((x^2+y^2)))/(sqrt(x^2+y^2)) }
\end{pspicture}
\end{LTXexample}

%\newpage

\section{Example 6: a hyperbolic paraboloid with the equation $z = xy$}

In this example we combine the graph of the surface and the curves
of intersection of the paraboloid with the planes $z=4$ and
$z=-4$. In this case we use \verb+\psSolid[object=courbe]+.
\begin{verbatim}
\defFunction{F}(t){t}{4 t div 4 min}{4}
\psSolid[object=courbe,range=1 4,
   linecolor=red,linewidth=2\pslinewidth,
   function=F]
\end{verbatim}
You will note the use of the functions \texttt{min} and
\texttt{max}, which return the minimum and the maximum,
respectively, of two values.


\begin{LTXexample}[width=7.5cm]
\psset{unit=0.5}
\psset{viewpoint=50 20 30 rtp2xyz,Decran=50}
\psset{lightsrc=viewpoint,linewidth=0.5\pslinewidth}
\begin{pspicture}(-7,-8)(7,8)
\psSolid[object=datfile,file=paraboloid,hue=0 1 0.5 1,incolor=yellow]
\gridIIID[Zmin=-4,Zmax=4,spotX=r](-4,4)(-4,4)
\defFunction{F}(t){t}{4 t div 4 min}{4}
\psSolid[object=courbe,range=1 4,r=0,
   linecolor=red,linewidth=2\pslinewidth,
   function=F]
\defFunction{G}(t){t}{4 t div -4 max}{4}
\psSolid[object=courbe,range=-1 -4,r=0,
   linecolor=red,linewidth=2\pslinewidth,
   function=G]
\defFunction{H}(t){t neg}{4 t div -4 max}{-4}
\psSolid[object=courbe,range=-1 -4,r=0,
   linecolor=red,linewidth=2\pslinewidth,
   function=H]
\end{pspicture}
\end{LTXexample}
%\newpage

\section{Example 7: a surface with the equation $z = xy(x^2+y^2)$}

\begin{LTXexample}[width=7.5cm]
\psset{unit=0.35}
\psset{lightsrc=10 12 20,linewidth=0.5\pslinewidth}
\psset{viewpoint=30 50 60 rtp2xyz,Decran=50}
\begin{pspicture}(-10,-10)(12,10)
\psSurface[
   fillcolor=cyan!50,algebraic,
   ngrid=.25 .25,incolor=yellow,hue=0 1,
   Zmin=-3,Zmax=3](-3,-3)(3,3){%
   x*y*(x^2-y^2)*0.1}
\end{pspicture}
\end{LTXexample}

\endinput