Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc / par-prisme.tex
1 \section {Le prisme}
2
3 Deux paramètres sont propres au prisme :
4 \begin{itemize}
5 \item La base du prisme peut-être définie librement par les
6 coordonnées des sommets dans le plan $Oxy$. Attention, il est
7 nécessaire que les quatres premiers sommets soient rangés dans le
8 sens trigonométrique par rapport à l'isobarycentre des sommets de
9 cette base ;
10 \item la direction de l'axe du prime par les coordonnées du vecteur
11 directeur.
12 \end{itemize}
13
14 \subsubsection {Exemple 1 : prisme droit et prisme oblique à section
15 polygonale}
16
17 \begin{center}
18 \psset{unit=0.5}
19 \psset{lightsrc=10 5 50,viewpoint=50 20 30 rtp2xyz,Decran=50}
20 \begin{minipage}{5cm}
21 \begin{pspicture*}(-4,-4)(6,9)
22 \psframe(-4,-4)(6,9)
23 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
24 \psSolid[object=prisme,h=6,base=0 1 -1 0 0 -2 1 -1 0 0]%
25 \axesIIID(4,4,6)(4.5,4.5,8)
26 \end{pspicture*}
27
28 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 1 -1 0 0 -2 1 -1 0 0}},h=6]}
29 \\
30 \end{minipage}
31 \hspace{2cm}
32 \begin{minipage}{5cm}
33 \begin{pspicture*}(-4,-4)(6,9)
34 \psframe(-4,-4)(6,9)
35 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
36 \psSolid[object=prisme,axe=0 1 2,h=8,base=0 -2 1 -1 0 0 0 1 -1 0]%
37 \axesIIID(4,4,4)(4.5,4.5,8)
38 \psPoint(0,4,8){V}
39 \psPoint(0,4,0){Vy}
40 \psPoint(0,0,8){Vz}
41 \uput[l](Vz){8}
42 \uput[ur](Vy){4}
43 \psline[linecolor=blue]{->}(O)(V)
44 \psline[linestyle=dashed](Vz)(V)(Vy)
45 \end{pspicture*}
46
47 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 -2 1 -1 0 0 0 1 -1 0}},}%
48 \\
49 \texttt{ axe=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 4 8}},h=8]}
50 \end{minipage}
51 \end{center}
52
53 \subsubsection{Exemple 2 : prisme droit à section carrée arrondie}
54
55 \begin{minipage}{4cm}
56 \psset{unit=0.5}
57 \psset{lightsrc=10 -20 50,viewpoint=50 -20 30 rtp2xyz,Decran=50}
58 \begin{pspicture}(-5,-4)(3,9)
59 %\psframe(-5,-4)(6,9)
60 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
61 \psSolid[object=prisme,h=6,fillcolor=yellow,%
62 base=%
63 0 10 90 {/i exch def i cos 1 add i sin 1 add } for
64 %
65 90 10 180 {/i exch def i cos 1 sub i sin 1 add} for
66 %
67 180 10 270 {/i exch def i cos 1 sub i sin 1 sub} for
68 %
69 270 10 360 {/i exch def i cos 1 add i sin 1 sub} for
70 ]%
71 \axesIIID(4,4,6)(6,6,8)
72 \end{pspicture}
73 \end{minipage}
74 \hfill
75 \begin{minipage}{10cm}
76 \small
77 \begin{verbatim}
78 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
79 \psSolid[
80 object=prisme,h=6,fillcolor=yellow,%
81 base=%
82 0 10 90 {/i exch def i cos 1 add i sin 1 add } for
83 %
84 90 10 180 {/i exch def i cos 1 sub i sin 1 add} for
85 %
86 180 10 270 {/i exch def i cos 1 sub i sin 1 sub} for
87 %
88 270 10 360 {/i exch def i cos 1 add i sin 1 sub} for
89 ]%
90 \axesIIID(4,4,6)(6,6,8)
91 \end{verbatim}
92 \end{minipage}
93 %\newpage
94
95 \subsubsection{Exemple 3 : prisme droit creux à section astroïdale}
96
97 \begin{minipage}{5.5cm}
98 \psset{unit=0.5}
99 \psset{lightsrc=10 -20 50,viewpoint=50 -20 30 rtp2xyz,Decran=50}
100 \begin{pspicture*}(-5,-4)(6,9)
101 \psframe(-5,-4)(6,9)
102 \defFunction{F}(t){3 t cos 3 exp mul}{3 t sin 3 exp mul}{}
103 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
104 \psSolid[object=prismecreux,h=8,fillcolor=red!50,
105 resolution=36,
106 base=0 350 {F} CourbeR2+
107 ]%
108 \end{pspicture*}
109 \end{minipage}
110 \hfill
111 \begin{minipage}{9cm}
112 \small
113 \begin{verbatim}
114 \defFunction{F}(t)
115 {3 t cos 3 exp mul}{3 t sin 3 exp mul}{}
116 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
117 \psSolid[object=prismecreux,h=8,fillcolor=red!50,
118 resolution=36,
119 base=0 350 {F} CourbeR2+
120 ]%
121 \end{verbatim}
122 \end{minipage}
123
124 \subsubsection{Exemple 4 : prisme à section elliptique}
125
126 \begin{minipage}{5cm}
127 \psset{unit=0.5}
128 \psset{lightsrc=10 20 30,viewpoint=50 20 25 rtp2xyz,Decran=50}
129 \begin{pspicture}(-6,-3)(4,10)
130 %\psframe(-6,-3)(6,8)
131 \defFunction{F}(t){t cos 4 mul}{t sin 2 mul}{}
132 \psSolid[object=grille,base=-6 6 -4 4,action=draw]%
133 \psSolid[object=prisme,h=8,fillcolor=green!20,%
134 base=0 350 {F} CourbeR2+]%
135 \defFunction{F}(t){t cos 4 mul}{t sin 2 mul}{8}
136 \psSolid[object=courbe,
137 r=0,
138 function=F,range=0 360,
139 linewidth=2\pslinewidth,
140 linecolor=green]
141 %% \makeatletter
142 %% \parametricplot[linecolor=green,linewidth=2\pslinewidth]{0}{360}{%
143 %% \tx@optionssolides
144 %% SolidesDict begin
145 %% 4 t cos mul
146 %% 2 t sin mul
147 %% 8 % z
148 %% 3dto2d cm_1 exch cm_1 exch
149 %% end}
150 %% \makeatother
151 \axesIIID(6,4,8)(8,6,10)
152 \end{pspicture}
153 \end{minipage}
154 \hfill
155 \begin{minipage}{9cm}
156 \small
157 \begin{verbatim}
158 \defFunction{F}(t){t cos 4 mul}{t sin 2 mul}{}
159 \psSolid[object=grille,base=-6 6 -4 4,action=draw]%
160 \psSolid[object=prisme,h=8,fillcolor=green!20,%
161 base=0 350 {F} CourbeR2+]%
162 \defFunction{F}(t){t cos 4 mul}{t sin 2 mul}{8}
163 \psSolid[object=courbe,
164 r=0,
165 function=F,range=0 360,
166 linewidth=2\pslinewidth,
167 linecolor=green]
168 \end{verbatim}
169 \end{minipage}
170 %\newpage
171
172 \subsubsection{Exemple 5 : une gouttière, section semi-circulaire à plat}
173
174 \begin{minipage}{6cm}
175 \psset{unit=0.5}
176 \psset{lightsrc=10 20 30,viewpoint=50 30 25 rtp2xyz,Decran=50}
177 \begin{pspicture}(-8,-5)(6,10)
178 %\psframe(-6,-3)(6,8)
179 \defFunction[algebraic]{F}(t)
180 {3*cos(t)}{3*sin(t)}{}
181 \defFunction[algebraic]{G}(t)
182 {2.5*cos(t)}{2.5*sin(t)}{}
183 \psSolid[object=grille,
184 base=-6 6 -6 6,action=draw]%
185 \psSolid[object=prisme,h=12,
186 fillcolor=blue!30,RotX=-90,
187 resolution=19,
188 base=0 pi {F} CourbeR2+
189 pi 0 {G} CourbeR2+
190 ](0,-6,3)
191 \axesIIID(6,6,2)(8,8,8)
192 \end{pspicture}
193 \end{minipage}
194 \hfill
195 \begin{minipage}{6cm}
196 \small
197 \begin{verbatim}
198 \defFunction[algebraic]{F}(t)
199 {3*cos(t)}{3*sin(t)}{}
200 \defFunction[algebraic]{G}(t)
201 {2.5*cos(t)}{2.5*sin(t)}{}
202 \psSolid[object=grille,
203 base=-6 6 -6 6,action=draw]%
204 \psSolid[object=prisme,h=12,
205 fillcolor=blue!30,RotX=-90,
206 resolution=19,
207 base=0 pi {F} CourbeR2+
208 pi 0 {G} CourbeR2+
209 ](0,-6,3)
210 \axesIIID(6,6,2)(8,8,10)
211 \end{verbatim}
212 \end{minipage}
213
214 On dessine d'abord la face extérieure (demi-cercle de rayon 3~cm), en
215 tournant dans le sens trigonométrique~: \texttt{0 pi {F} CourbeR2+}
216
217 Puis la face intérieure (demi-cercle de rayon 2{,}5~cm), en tournant
218 cette fois dans le sens inverse du sens trigonométrique :
219 \texttt{pi 0 {G} CourbeR2+}
220
221 On fait tourner le solide de $-90^{\mathrm{o}}$ en le plaçant au point $(0,-6,3)$.
222
223 \textdbend{} Comme on a utilisé l'option \verb+algebraic+ pour la
224 définition des fontions $F$ et $G$, les fonctions $\sin $ et $\cos $
225 utilisées fonctionnent en radian.
226
227 \subsubsection{Le paramètre \texttt {decal}}
228
229 Nous avons écrit plus haut qu'il était nécessaire que les quatres
230 premiers sommets soient rangés dans le sens trigonométrique par
231 rapport à l'isobarycentre des sommets de cette base. En fait, c'est la
232 règle du comportement par défaut car la règle véritable est celle-ci~:
233 Si la base comporte $n+1$ sommets $(s_0, s_1, s_2, \dots , s_{n-1},
234 s_n)$, et si $G$ est l'isobarycentre des sommets, alors $(s_0, s_1)$
235 d'une part, et $(s_{n-1}, s_n)$ d'autre part, doivent être rangés dans
236 le sens trigonométrique par rapport à $G$.
237
238 Cette règle induit des contraintes sur le codage de la base du prisme,
239 rendant parfois ce dernier inesthétique. C'est pourquoi nous avons
240 introduit l'argument \texttt{[decal]} (valeur par défaut$=-2$) qui
241 permet de considérer la liste des sommets de la base comme une file
242 circulaire que l'on décalera au besoin.
243
244 Un exemple~: comportement par défaut avec $decal=-2$~:\par
245 \begin{minipage}{6cm}
246 \psset{unit=0.5}
247 \psset{lightsrc=10 20 30,viewpoint=50 80 35 rtp2xyz,Decran=50}
248 \begin{pspicture}(-6,-4)(6,7)
249 \psframe(-7,-3)(6,6)
250 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
251 \psSolid[object=prisme,h=8,
252 fillcolor=yellow,RotX=-90,
253 num=0 1 2 3 4 5 6,
254 show=0 1 2 3 4 5 6,
255 resolution=7,
256 base=0 180 {F} CourbeR2+
257 ](0,-10,0)
258 \end{pspicture}
259 \end{minipage}
260 \hfill
261 \begin{minipage}{8cm}
262 \small
263 \begin{verbatim}
264 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
265 \psSolid[object=prisme,h=8,
266 fillcolor=yellow,RotX=-90,
267 num=0 1 2 3 4 5 6,
268 show=0 1 2 3 4 5 6,
269 resolution=7,
270 base=0 180 {F} CourbeR2+
271 ](0,-10,0)
272 \end{verbatim}
273 \end{minipage}
274
275 On voit que le sommet d'indice~$0$ n'est pas là où on s'attendrait à
276 le trouver.
277
278 Recommençons, mais cette fois-ci en supprimant le décalage~:\par
279 \begin{minipage}{6cm}
280 \psset{unit=0.5}
281 \psset{lightsrc=10 20 30,viewpoint=50 80 35 rtp2xyz,Decran=50}
282 \begin{pspicture}(-6,-4)(6,7)
283 \psframe(-7,-3)(6,6)
284 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
285 \psSolid[object=prisme,h=8,
286 fillcolor=yellow,RotX=-90,
287 decal=0,
288 num=0 1 2 3 4 5 6,
289 show=0 1 2 3 4 5 6,
290 resolution=7,
291 base=0 180 {F} CourbeR2+
292 ](0,-10,0)
293 \end{pspicture}
294 \end{minipage}
295 \hfill
296 \begin{minipage}{8cm}
297 \small
298 \begin{verbatim}
299 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
300 \psSolid[object=prisme,h=8,
301 fillcolor=yellow,RotX=-90,
302 decal=0,
303 num=0 1 2 3 4 5 6,
304 show=0 1 2 3 4 5 6,
305 resolution=7,
306 base=0 180 {F} CourbeR2+
307 ](0,-10,0)
308 \end{verbatim}
309 \end{minipage}
310

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.