3 The command has the following form:
5 \psSurface[options
](xmin,ymin)(xmax,ymax)
{equation of the surface z=f(x,y)
}
7 with the same options which apply to solids, and these additional
10 \item The surface grid is defined by the parameter
11 \texttt{\Lkeyword{ngrid
}=n1 n2
}, which has these specifics:
13 \begin{minipage
}{1\linewidth}
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
18 \item If
\texttt{n1
} and/or
\texttt{n2
} are decimals, the
19 number(s) represent(s) the incrementing steps following $Ox$
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.
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
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
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.
55 If the option
\Lkeyword{axesboxed
} doesn't meet your needs, it is
56 possible to adapt the following command, which is appropriate for
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}}
78 %L'option \Cadre{[hue=0 1]} permet de remplir les facettes avec des d\'{e}grad\'{e}s
80 \section{Example
1: a
\Index{saddle
}}
81 \begin{LTXexample
}[width=
7.5cm
]
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)
{%
93 \section{Example
2: a saddle without a grid
}
95 The grid lines are suppressed, when using in the option:
97 \begin{LTXexample
}[width=
7.5cm
]
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
}
111 \section{Example
3: a
\Index{paraboloid
}}
113 \begin{LTXexample
}[width=
7.5cm
]
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
]%
121 intersectionplan=
{[0 0 1 -
5]},
122 intersectioncolor=(bleu),
123 intersectionlinewidth=
3,
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
}
133 \section{Example
4: a
\Index{sinusoidal wave
}}
134 \begin{LTXexample
}[width=
7.5cm
]
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)
{%
148 \section{Example
5: another
\Index{sinusoidal wave
}}
150 In this example we show how to colour the faces, each with a
151 different coloration, directly using PostScript code.
153 \begin{LTXexample
}[width=
7.5cm
]
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,
161 {/iF ED iF
[iF
4225 div
0.75 1] (sethsbcolor) astr2str
} for
163 10*sin(sqrt((x^
2+y^
2)))/(sqrt(x^
2+y^
2))
}
169 \section{Example
6: a
\Index{hyperbolic paraboloid
} with the equation $z = xy$
}
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
]+.
175 \defFunction{F
}(t)
{t
}{4 t div
4 min
}{4}
176 \psSolid[object=courbe,range=
1 4,
177 linecolor=red,linewidth=
2\pslinewidth,
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.
185 \begin{LTXexample
}[width=
7.5cm
]
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,
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,
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,
208 \section{Example
7: a surface with the equation $z = xy(x^
2+y^
2)$
}
210 \begin{LTXexample
}[width=
7.5cm
]
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)
216 fillcolor=cyan!
50,algebraic,
217 ngrid=
.25 .25,incolor=yellow,hue=
0 1,
218 Zmin=-
3,Zmax=
3](-
3,-
3)(
3,
3)
{%
223 \section{Example
8: a surface with the equation $z =
\left(
1-
\frac{x^
2+y^
2}{2}\right)^
2$
}% $
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
}
235 \begin{LTXexample
}[width=
7.5cm
]
236 \psset{unit=
0.5cm,viewpoint=
50 60 30 rtp2xyz,Decran=
50,
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
}