Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / par-surfacesparametrees-en.tex
1 \section{Parameterised surfaces}
2
3 \subsection{The method}
4
5 The parameterised \Index{surfaces} are setup as $[x(u,v),y(u,v),z(u,v)]$ and administered thanks to the macro \Lcs{psSolid} by the option
6 \texttt{\Lkeyword{object}=\Lkeyval{surfaceparametree}} and defined either in \textit{Reverse Polish Notation}(\textit{RPN}):
7
8
9 \begin{verbatim}
10 \defFunction{shell}(u,v){1.2 v exp u Sin dup mul v Cos mul mul}% x(u,v)
11 {1.2 v exp u Sin dup mul v Sin mul mul}% y(u,v)
12 {1.2 v exp u Sin u Cos mul mul} % z(u,v)
13 \end{verbatim}
14
15 or in \textit{algebraic notation}:
16
17 \begin{verbatim}
18 \defFunction[algebraic]{shell}(u,v){1.2^v*(sin(u)^2*cos(v))}% x(u,v)
19 {1.2^v*(sin(u)^2*sin(v))}% y(u,v)
20 {1.2^v*(sin(u)*cos(u))} % z(u,v)
21 \end{verbatim}
22
23 The range for the values of $u$ and $v$ are defined within the option
24 \texttt{\Lkeyword{range}=$\mathtt{u_{min}}$ $\mathtt{u_{max}}$ $\mathtt{v_{min}}$ %$
25 $\mathtt{v_{max}}$}.
26
27 The drawing of the function is activated with
28 \texttt{\Lkeyword{function}=name}, this name is implied when the parametric equations are written:
29 \verb+\defFunction{name}...+
30
31 Any other choice of $u$ and $v$ are accepted. Let's remind that the argument of
32 \texttt{Sin} and \texttt{Cos} must be in radians those of \texttt{sin} and
33 \texttt{cos} in degrees if \textit{RPN} is used. Within the algebraic notation, the argument is in radians.
34
35
36 \subsection{Example 1: a \Index{sea shell}}
37 \newcommand\quadrillage{%
38 \psset{linecolor={[cmyk]{1,0,1,0.5}}}\green
39 \multido{\ix=-4+1}{9}{%
40 \psPoint(\ix\space,4,-3){X1}
41 \psPoint(\ix\space,4 .2 add,-3){X2}
42 \psline(X1)(X2)
43 \uput[-120](X1){\small\ix}}
44 \multido{\iy=-4+1}{9}{%
45 \psPoint(-4,\iy\space,-3){Y1}
46 \psPoint(-4 .2 sub,\iy\space,-3){Y2}
47 \psline(Y1)(Y2)
48 \uput[0](Y1){\small\iy}}
49 \multido{\iz=-3+1}{7}{%
50 \psPoint(4,4,\iz\space){Z1}
51 \psPoint(4,4 .2 add,\iz\space){Z2}
52 \psline(Z1)(Z2)
53 \uput[l](Z1){\small\iz}}
54 \psPoint(0,4 0.5 add,-3){X0}
55 \uput[-120](X0){$x$}
56 \psPoint(-4 .5 sub,0,-3){Y0}
57 \uput[0](Y0){$y$}}
58 \begin{LTXexample}[width=7.8cm]
59 \psset{unit=0.75}
60 \begin{pspicture}(-5.5,-6)(4.5,4)
61 \psframe*(-5.5,-6)(4.5,4)
62 \psset[pst-solides3d]{viewpoint=20 120 30 rtp2xyz,
63 Decran=15,lightsrc=-10 15 10}
64 % Parametric Surfaces
65 \psSolid[object=grille,base=-4 4 -4 4,
66 action=draw*,linecolor={[cmyk]{1,0,1,0.5}}]
67 (0,0,-3)
68 \defFunction{shell}(u,v)
69 {1.2 v exp u Sin dup mul v Cos mul mul}
70 {1.2 v exp u Sin dup mul v Sin mul mul}
71 {1.2 v exp u Sin u Cos mul mul}
72 \psSolid[object=surfaceparametree,
73 linecolor={[cmyk]{1,0,1,0.5}},
74 base=0 pi pi 4 div neg 5 pi mul 2 div,
75 fillcolor=yellow!50,incolor=green!50,
76 function=shell,linewidth=0.5\pslinewidth,ngrid=25]%
77 \psSolid[object=parallelepiped,a=8,b=8,c=6,
78 action=draw,linecolor={[cmyk]{1,0,1,0.5}}]%
79 \quadrillage
80 \end{pspicture}
81 \end{LTXexample}
82
83 \begin{LTXexample}[width=7.8cm]
84 \psset{unit=0.75}
85 \begin{pspicture}(-5,-4)(5,6)
86 \psframe*(-5,-4)(5,6)
87 \psset[pst-solides3d]{viewpoint=20 20 -10 rtp2xyz,
88 Decran=15,lightsrc=5 10 2}
89 % Parametric Surfaces
90 \psSolid[object=grille,base=-4 4 -4 4,
91 action=draw*,linecolor=red](0,0,-3)
92 \defFunction[algebraic]{shell}(u,v)
93 {1.21^v*(sin(u)*cos(u))}
94 {1.21^v*(sin(u)^2*sin(v))}
95 {1.21^v*(sin(u)^2*cos(v))}
96 %% \defFunction{shell}(u,v)
97 %% {1.2 v exp u Sin u Cos mul mul}
98 %% {1.2 v exp u Sin dup mul v Sin mul mul}
99 %% {1.2 v exp u Sin dup mul v Cos mul mul}
100 \psSolid[object=surfaceparametree,
101 linecolor={[cmyk]{1,0,1,0.5}},
102 base=0 pi pi 4 div neg 5 pi mul 2 div,
103 fillcolor=green!50,incolor=yellow!50,
104 function=shell,linewidth=0.5\pslinewidth,
105 ngrid=25]%
106 \white%
107 \gridIIID[Zmin=-3,Zmax=4,linecolor=white,
108 QZ=0.5](-4,4)(-4,4)
109 \end{pspicture}
110 \end{LTXexample}
111
112
113
114 \subsection{Example 2: a \Index{helix}}
115 \begin{LTXexample}[width=5.5cm]
116 \psset{unit=0.75}
117 \begin{pspicture}(-3,-4)(3,6)
118 \psset[pst-solides3d]{viewpoint=20 10 2,Decran=20,
119 lightsrc=20 10 10}
120 % Parametric Surfaces
121 \defFunction{helix}(u,v)
122 {1 .4 v Cos mul sub u Cos mul 2 mul}
123 {1 .4 v Cos mul sub u Sin mul 2 mul}
124 {.4 v Sin mul u .3 mul add}
125 \psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth,
126 base=-10 10 0 6.28,fillcolor=yellow!50,incolor=green!50,
127 function=helix,
128 ngrid=60 0.4]%
129 \gridIIID[Zmin=-3,Zmax=3](-2,2)(-2,2)
130 \end{pspicture}
131 \end{LTXexample}
132
133
134 \subsection{Example 3: a \Index{cone}}
135 \begin{LTXexample}[width=10cm]
136 \psset{unit=0.5}
137 \begin{pspicture}(-9,-7)(10,12)
138 \psframe*(-9,-7)(10,12)
139 \psset[pst-solides3d]{
140 viewpoint=20 5 10,
141 Decran=50,lightsrc=20 10 5}
142 \psSolid[
143 object=grille,base=-2 2 -2 2,
144 linecolor=white](0,0,-2)
145 % Parametric Surfaces
146 \defFunction{cone}(u,v)
147 {u v Cos mul}{u v Sin mul}{u}
148 \psSolid[object=surfaceparametree,
149 base=-2 2 0 2 pi mul,
150 fillcolor=yellow!50,
151 incolor=green!50,function=cone,
152 linewidth=0.5\pslinewidth,
153 ngrid=25 40]%
154 \psset{linecolor=white}\white
155 \gridIIID[Zmin=-2,Zmax=2]
156 (-2,2)(-2,2)
157 \end{pspicture}
158 \end{LTXexample}
159
160
161 \subsection{An advised website}
162 You will find on the website:
163
164 \centerline{\url{http://k3dsurf.sourceforge.net/}}
165
166 an excellent software to represent surfaces with numerous examples of parameterised surfaces and others.
167
168 \endinput
169

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.