Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / par-section-en.tex
1 \section{Sectioning a solid with a plane}
2
3 \subsection{Drawing the \Index{intersection} between a plane and a solid}
4
5 \subsubsection{The parameters}
6
7 The option \texttt{intersectionplan=\{[a b c d]\}} allows the user
8 to draw the intersection between a plane and a solid. The numbers
9 between the braces are the coefficients of the affine plane with
10 equation: $ax+by+cz+d=0$. It is possible to draw the intersection
11 between a solid and more than one plane by placing the appropriate
12 parameters in order, as in the following example.
13
14 The drawing is activated with \texttt{\texttt{\Lkeyword{intersectiontype}=0}} or any
15 value $\geq0$.
16
17 The colour of the intersection line is chosen with the option
18 \texttt{\Lkeyword{intersectioncolor}=(bleu) (rouge) etc.}. In the same order,
19 the thickness of the appropriate line
20 \texttt{\Lkeyword{intersectionlinewidth}=1 2 etc.} (dimensions in picas) is
21 set up.
22
23
24 The hidden parts, drawn with dashed lines, will be shown with
25 \Lkeyword{action}=\Lkeyval{draw}.
26
27 \begin{LTXexample}[width=7cm]
28 \begin{pspicture}(-3,-2)(3,7.5)
29 \psset{viewpoint=50 20 20 rtp2xyz,Decran=50}
30 \psset{lightsrc=viewpoint} \psSolid[object=cylindre,
31 ngrid=1 24,
32 r=2,
33 fillcolor=yellow!25,
34 intersectiontype=0,
35 intersectionplan={
36 [0 0 1 -1]
37 [0 0 1 -2]
38 [0 0 1 -3]
39 [0.894 0 0.447 -1.8]},
40 intersectioncolor=(bleu) (rouge) (vert) (rose),
41 intersectionlinewidth=1 1.5 1.8 2.2]
42 \axesIIID(2,2,6)(3,3,7)
43 \end{pspicture}
44 \end{LTXexample}
45
46 \subsection{Slicing a solid}
47
48 \subsubsection{Slicing a filled solid}
49
50 The object under consideration is a cylinder. The plane that
51 slices the object is defined by:
52
53 \begin{verbatim}
54 plansepare={[a b c d]}
55 \end{verbatim}
56
57 The two parts are not drawn, but memorised with the name
58 \texttt{\Lkeyword{name}=partiescylindre}:
59
60 \begin{verbatim}
61 \psset{solidmemory}
62 \psSolid[object=cylindre,
63 r=2,h=6
64 ngrid=6 24,
65 plansepare={[0.707 0 0.707 0]},
66 name=partiescylindre,
67 action=none](0,0,-3)
68 \end{verbatim}
69
70
71 Then they are displayed separately using their respective index
72 numbers. The numbering of the two parts is determined by the
73 direction of the normal to the \Index{slicing} plane: 0 if above the
74 normal, 1 if below. For both parts, the sliced face carries the
75 number 0. If there are several sliced faces, as may happen in the
76 case of a torus, they are numbered 0, 1 etc.
77
78
79 \begin{verbatim}
80 \psSolid[object=load,
81 load=partiescylindre1,
82 fillcolor={[rgb]{0.7 1 0.7 }},
83 fcol=0 (1 1 0.7 setrgbcolor)]
84 \psSolid[object=load,
85 load=partiescylindre0,RotZ=60,
86 fillcolor={[rgb]{0.7 1 0.7 }},
87 fcol=0 (1 1 0.7 setrgbcolor)](0,4,0)
88 \end{verbatim}
89
90 \begin{center}
91 \begin{pspicture}(-4,-5)(7,4)
92 \psframe(-4,-5)(7,4)
93 \psset{viewpoint=50 -40 10 rtp2xyz,Decran=50,linecolor=darkgray}
94 %\lightsource
95 \psset{lightsrc=viewpoint}
96 \psSolid[object=grille,action=draw,
97 base=-3 5 -3 5,
98 linecolor=red](0,0,-3)
99 \psset{solidmemory}
100 \psSolid[object=cylindre,
101 r=2,h=6,
102 ngrid=6 24,
103 plansepare={[0.707 0 0.707 0]},
104 name=partiescylindre,
105 action=none](0,0,-3)
106 \psSolid[object=load,
107 load=partiescylindre1,
108 fillcolor={[rgb]{0.7 1 0.7 }},
109 fcol=0 (1 1 0.7 setrgbcolor)]
110 \psSolid[object=load,
111 load=partiescylindre0,RotZ=90,
112 fillcolor={[rgb]{0.7 1 0.7 }},
113 fcol=0 (1 1 0.7 setrgbcolor)](0,4,0)
114 \psSolid[object=plan,action=draw,
115 definition=equation,
116 args={[0.707 0 0.707 0] 90},
117 base=-2 2 -3 3,planmarks,showBase]
118 \axesIIID(0,0,0)(2.5,2.5,3.5)
119 \end{pspicture}
120 \end{center}
121
122 \subsubsection{Slicing a \Index{hollow solid}}
123
124 The options \verb+rm=0,hollow+ allow us to not only remove a
125 face \verb+rm=0+ but also to see inside it \Lkeyword{hollow}.
126
127 \begin{center}
128 \begin{pspicture}(-4,-5)(7,4)
129 \psframe(-4,-5)(7,4)
130 \psset{viewpoint=50 -40 10 rtp2xyz,Decran=50,linecolor=darkgray}
131 %\lightsource
132 \psset{lightsrc=viewpoint}
133 \psSolid[object=grille,action=draw,
134 base=-3 5 -3 5,
135 linecolor=red](0,0,-3)
136 \psset{solidmemory}
137 \psSolid[object=cylindre,
138 r=2,h=6,
139 ngrid=6 24,
140 plansepare={[0.707 0 0.707 0.5]},
141 name=partiescylindre,
142 action=none](0,0,-3)
143 \psSolid[object=load,
144 load=partiescylindre1,
145 fillcolor={[rgb]{0.7 1 0.7 }},
146 rm=0,hollow,
147 incolor={[rgb]{1 1 0.7}}]
148 \psSolid[object=load,
149 load=partiescylindre0,RotZ=90,
150 fillcolor={[rgb]{0.7 1 0.7 }},
151 rm=0,hollow,
152 incolor={[rgb]{1 1 0.7}}](0,4,0)
153 \psSolid[object=plan,action=draw,
154 definition=equation,
155 args={[0.707 0 0.707 0.5] 90},
156 base=-2 2 -3 3,planmarks,showBase]
157 \composeSolid
158 \end{pspicture}
159 \end{center}
160
161
162 \subsection{\Index{Slice} of a \Index{pyramid}}
163
164 \subsubsection{Highlighting the \Index{contour lines} and first slice}
165
166 This pyramid is generated as \texttt{\Lkeyword{object}=\Lkeyval{new}} by giving a list
167 of the coordinates of the vertices, and the vertices of each face.
168
169 \begin{verbatim}
170 sommets=
171 0 -2 0 %% 0
172 -2 0 0 %% 1
173 0 4 0 %% 2
174 4 0 0 %% 3
175 0 0 5, %% 4
176 faces={
177 [3 2 1 0]
178 [4 0 3]
179 [4 3 2]
180 [4 2 1]
181 [4 1 0]
182 }
183 \end{verbatim}
184
185 In the first diagram, the slicing lines are highlighted.
186
187 \begin{verbatim}
188 intersectiontype=0,
189 intersectionplan={[0 0 1 -1] [0 0 1 -2]},
190 intersectionlinewidth=1 2,
191 intersectioncolor=(bleu) (rouge)
192 \end{verbatim}
193
194 Then we cut off the upper part, and draw the slicing plane as
195 well.
196
197 \begin{verbatim}
198 \psSolid[object=new,
199 sommets=
200 0 -2 0 %% 0
201 -2 0 0 %% 1
202 0 4 0 %% 2
203 4 0 0 %% 3
204 0 0 5, %% 4
205 faces={
206 [3 2 1 0]
207 [4 0 3]
208 [4 3 2]
209 [4 2 1]
210 [4 1 0]},
211 plansepare={[0 0 1 -2]},
212 name=firstSlice,
213 action=none]
214 \psSolid[object=load,action=draw*,
215 load=firstSlice1]
216 \psSolid[object=plan,
217 definition=equation,
218 args={[0 0 1 -2]},
219 base=-3 5 -3 5,action=draw]
220 \end{verbatim}
221
222 To avoid having to repeatedly type the vertices and faces of the
223 pyramid, we save these data to the files:
224 \begin{itemize}
225 \item \texttt{Pyramid-couleurs.dat}
226 \item \texttt{Pyramid-faces.dat}
227 \item \texttt{Pyramid-sommets.dat}
228 \item \texttt{Pyramid-io.dat}
229 \end{itemize}
230 thanks to the command \Lkeyword{action}=\Lkeyval{writesolid}:
231
232 \begin{verbatim}
233 \psSolid[object=new,
234 sommets=
235 0 -2 0 %% 0
236 -2 0 0 %% 1
237 0 4 0 %% 2
238 4 0 0 %% 3
239 0 0 5, %% 4
240 faces={
241 [3 2 1 0]
242 [4 0 3]
243 [4 3 2]
244 [4 2 1]
245 [4 1 0]
246 },file=./Pyramid,fillcolor=yellow!50,
247 action=writesolid]
248 \end{verbatim}
249
250 All these lines of code could then be removed and, thereafter, we
251 would recall the data with the command:
252
253 \begin{verbatim}
254 \psSolid[object=datfile,
255 file=./Pyramid]
256 \end{verbatim}
257
258 \begin{center}
259 \psset{unit=0.75}
260 \begin{pspicture}(-5,-2)(5,7)
261 %\psframe(-5,-2)(5,7)
262 \psset{viewpoint=50 20 10 rtp2xyz,Decran=50}
263 %\lightsource
264 \psset{lightsrc=viewpoint}
265 \psSolid[object=grille,
266 base=-3 5 -3 5,
267 linecolor=gray]
268 %% create the pyramid with base area in xy-plane
269 \psSolid[object=new,
270 sommets=
271 0 -2 0 %% 0
272 -2 0 0 %% 1
273 0 4 0 %% 2
274 4 0 0 %% 3
275 0 0 5, %% 4
276 faces={
277 [3 2 1 0]
278 [4 0 3]
279 [4 3 2]
280 [4 2 1]
281 [4 1 0]
282 }, action=draw*,
283 intersectiontype=0,
284 intersectionplan={[0 0 1 -1]
285 [0 0 1 -2]},
286 intersectionlinewidth=1 2,
287 intersectioncolor=(bleu) (rouge)]
288 \axesIIID[linecolor=blue](4,4,5)(5,5,6)
289 \end{pspicture}
290 \hfill
291 \begin{pspicture}(-5,-2)(5,7)
292 %\psframe(-5,-2)(5,7)
293 \psset{viewpoint=50 20 10 rtp2xyz,Decran=50}
294 %\lightsource
295 \psset{lightsrc=viewpoint}
296 \psSolid[object=grille,
297 base=-3 5 -3 5,
298 linecolor=gray]
299 \psset{solidmemory}
300 %% create the pyramid with base area in xy-plane
301 \psSolid[object=new,
302 sommets=
303 0 -2 0 %% 0
304 -2 0 0 %% 1
305 0 4 0 %% 2
306 4 0 0 %% 3
307 0 0 5, %% 4
308 faces={
309 [3 2 1 0]
310 [4 0 3]
311 [4 3 2]
312 [4 2 1]
313 [4 1 0]
314 },
315 plansepare={[0 0 1 -2]},
316 name=firstSlice,
317 action=none]
318 \psSolid[object=load,action=draw*,
319 load=firstSlice1]
320 \psSolid[object=plan,
321 definition=equation,
322 args={[0 0 1 -2]},
323 base=-3 5 -3 5,action=draw]
324 \axesIIID[linecolor=blue](4,4,2)(5,5,6)
325 \end{pspicture}
326 \end{center}
327
328 \subsubsection{The second \Index{slice} and its insertion within the \Index{pyramid}}
329
330 Having removed the upper part \texttt{firstSlice0} (which no
331 longer appears), we slice the frustum of the pyramid
332 \texttt{firstSlice1}, and keep the upper part of this as
333 \texttt{secondSlice0}, then we record it and insert it into a wire
334 frame model of the pyramid:
335
336
337 \begin{verbatim}
338 \psset{solidmemory}
339 \psSolid[object=datfile,
340 file=./Pyramid,
341 plansepare={[0 0 1 -2]},
342 name=firstSlice,
343 action=none]
344 \psSolid[object=load,
345 load=firstSlice1,
346 action=none,
347 plansepare={[0 0 1 -1]},
348 name=secondSlice]
349 \psSolid[object=load,action=draw*,
350 load=secondSlice0]
351 \psSolid[object=load,
352 load=secondSlice0,
353 file=./slicePyramid,
354 action=writesolid]
355 \psSolid[object=datfile,fillcolor=yellow!50,
356 file=./slicePyramid]
357 \end{verbatim}
358
359
360 \begin{center}
361 \psset{unit=0.75}
362 \begin{pspicture}(-5,-2)(4,7)
363 %\psframe(-4,-2)(4,7)
364 \psset{viewpoint=50 20 10 rtp2xyz,Decran=50}
365 %\lightsource
366 \psset{lightsrc=viewpoint}
367 \psSolid[object=grille,
368 base=-3 5 -3 5,
369 linecolor=gray]
370 \psset{solidmemory}
371 %% create the pyramid with base area in xy-plane
372 %\psSolid[object=new,
373 % sommets=
374 % 0 -2 0 %% 0
375 % -2 0 0 %% 1
376 % 0 4 0 %% 2
377 % 4 0 0 %% 3
378 % 0 0 5, %% 4
379 % faces={
380 % [3 2 1 0]
381 % [4 0 3]
382 % [4 3 2]
383 % [4 2 1]
384 % [4 1 0]
385 %},file=./Pyramid,fillcolor=yellow!50,
386 % action=writesolid]
387 \psSolid[object=datfile,
388 file=./Pyramid,
389 plansepare={[0 0 1 -2]},
390 name=firstSlice,
391 action=none]
392 \psSolid[object=plan,
393 definition=equation,
394 args={[0 0 1 -1]},action=draw,
395 base=-3 5 -3 5]
396 \psSolid[object=load,
397 load=firstSlice1,
398 action=none,
399 plansepare={[0 0 1 -1]},
400 name=secondSlice]
401 %\psSolid[object=load,action=draw*,
402 % load=secondSlice0]
403 %\psSolid[object=load,
404 % load=secondSlice0,
405 % file=./slicePyramid,
406 % action=writesolid]
407 \psSolid[object=datfile,fillcolor=yellow!50,
408 file=./slicePyramid]
409 \psSolid[object=plan,
410 definition=equation,
411 args={[0 0 1 -2]},
412 base=-3 5 -3 5,action=draw]
413 \axesIIID[linecolor=blue](0,0,2)(5,5,6)
414 \end{pspicture}
415 \hfill
416 \begin{pspicture}(-4,-2)(6,7)
417 \psset{viewpoint=50 20 10 rtp2xyz,Decran=50}
418 %\lightsource
419 \psset{lightsrc=viewpoint}
420 \psSolid[object=grille,
421 base=-3 5 -3 5,
422 linecolor=gray]
423 \psSolid[object=datfile,fillcolor=yellow!50,
424 file=./slicePyramid]
425 \psSolid[object=datfile,
426 file=./Pyramid,action=draw]
427 \axesIIID[linecolor=blue](4,4,2)(5,5,6)
428 \end{pspicture}
429 \end{center}
430
431 \subsection{Slicing an \Index{octahedron} with a plane parallel to one of its faces}
432
433 \subsubsection{The view inside}
434
435 Recall that there are options \verb+rm=0,hollow+ that allow us,
436 on the one hand, to remove a face \verb+rm=0+ and, on the other,
437 to look inside \Lkeyword{hollow}.
438
439 In the following example, we shall start by generating the
440 required objects without drawing them (\texttt{\Lkeyword{action}=\Lkeyval{none}}).
441
442 We construct the octahedron, giving the center of the face with
443 index $1$ the name $G$, then define the point $H$ which satisfies
444 $\overrightarrow{OH} = 0.8\,\overrightarrow{OG}$. After that we
445 define $P$ to be the plane through $H$ parallel to the face of the
446 octahedron with index $1$. Finally, we slice the octahedron using
447 the plane $P$.
448
449 \begin{LTXexample}[width=7.5cm]
450 \begin{pspicture}(-3.5,-3)(4.5,5)
451 \psset{viewpoint=100 5 10 rtp2xyz,Decran=80,
452 lightsrc=viewpoint,solidmemory,action=none}
453 \psSolid[object=octahedron,
454 a=4,name=my_octahedron,]
455 \psSolid[object=point,
456 definition=solidcentreface,
457 args=my_octahedron 1,
458 name=G,]
459 \psSolid[object=point,
460 definition=mulv3d,
461 args=G .8,
462 name=H,]
463 \psSolid[object=plan,
464 definition=solidface,
465 args=my_octahedron 1,
466 base=-4 4 -4 4,
467 name=P,](H,,)
468 \psSolid[object=load,
469 load=my_octahedron,
470 plansepare=P,
471 name=part]
472 \psSolid[object=load,load=part1,
473 rm=0,hollow,action=draw**,
474 fillcolor={[rgb]{0.7 1 0.7}},
475 incolor={[rgb]{1 1 0.7}},]
476 \psSolid[object=plan,args=P,
477 action=draw,showBase]
478 \psSolid[object=line,
479 args=0 0 0 H,
480 linestyle=dashed,]
481 \psProjection[object=point,plan=P,args=0 0,
482 fontsize=20,pos=cl,text=H,phi=90,]
483 \axesIIID[linecolor=blue,linewidth=0.4pt](0,0,0)(4,4,4)
484 \end{pspicture}
485 \end{LTXexample}
486
487 \subsubsection{Regarding the solid as filled}
488
489 The option \verb+fcol=0 (YellowOrange)+ allows us to colour the
490 face with index 0.
491
492 \begin{LTXexample}[width=7.5cm]
493 \begin{pspicture}(-3.5,-3)(4.5,5)
494 \psset{viewpoint=100 5 10 rtp2xyz,Decran=80,
495 lightsrc=viewpoint,solidmemory,action=none}
496 \psSolid[object=octahedron,
497 a=4,name=my_octahedron,]
498 \psSolid[object=point,
499 definition=solidcentreface,
500 args=my_octahedron 1,
501 name=G,]
502 \psSolid[object=point,
503 definition=mulv3d,
504 args=G .8,
505 name=H,]
506 \psSolid[object=plan,
507 definition=solidface,
508 args=my_octahedron 1,
509 base=-4 4 -4 4,
510 name=P,](H,,)
511 \psSolid[object=load,
512 load=my_octahedron,
513 plansepare=P,
514 name=part]
515 \psSolid[object=load,
516 load=part1,
517 fcol=0 (YellowOrange),
518 action=draw**,
519 fillcolor={[rgb]{0.7 1 0.7}},]
520 \psSolid[object=plan,args=P,
521 action=draw,showBase]
522 \psSolid[object=line,
523 args=0 0 0 H,
524 linestyle=dashed,]
525 \psProjection[object=point,plan=P,args=0 0,
526 fontsize=20,pos=cl,text=H,phi=90,]
527 \axesIIID[linecolor=blue,linewidth=0.4pt](0,0,0)(4,4,4)
528 \end{pspicture}
529 \end{LTXexample}
530
531 \subsubsection{The two parts of a sliced solid}
532
533 You will recall that the direction of the normal of the slicing
534 plane determines the numbering of the two parts: 0 if above the
535 normal, 1 if below. For both parts, the sliced face carries the
536 number 0. If there are several sliced faces, as in the case of the
537 torus, they are numbered 0, 1 etc.
538
539 Using two steps, we memorise both parts of the sliced solid:
540
541 \begin{verbatim}
542 \psSolid[object=load,
543 load=my_octahedron,
544 plansepare=P,
545 name=part]
546 \end{verbatim}
547
548 Then we position and render each part:
549
550 \begin{verbatim}
551 \psSolid[object=load,
552 fcol=0 (YellowOrange),
553 fillcolor={[rgb]{0.7 1 0.7}},
554 load=part1]
555 \psSolid[object=load,
556 fillcolor={[rgb]{0.7 1 0.7}},
557 load=part0](H 2 mulv3d,,)
558 \composeSolid
559 \end{verbatim}
560
561
562 \begin{LTXexample}[width=7.5cm]
563 \begin{pspicture}(-3.5,-3)(4.5,5)
564 \psset{viewpoint=100 5 20 rtp2xyz,Decran=150,
565 lightsrc=viewpoint,solidmemory,action=none}
566 \psSolid[object=octahedron,
567 a=2,name=my_octahedron,]
568 \psSolid[object=point,
569 definition=solidcentreface,
570 args=my_octahedron 1,
571 name=G,]
572 \psSolid[object=point,
573 definition=mulv3d,
574 args=G .7,
575 name=H,]
576 \psSolid[object=plan,
577 definition=solidface,
578 args=my_octahedron 1,
579 base=-4 4 -4 4,
580 name=P,](H,,)
581 \psSolid[object=load,
582 load=my_octahedron,
583 plansepare=P,
584 name=part]
585 \psset{action=draw**}
586 \psSolid[object=load,
587 load=part1,
588 fcol=0 (YellowOrange),
589 fillcolor={[rgb]{0.7 1 0.7}},]
590 \psSolid[object=load,
591 fillcolor={[rgb]{0.7 1 0.7}},
592 load=part0](H 2 mulv3d,,)
593 \composeSolid
594 \end{pspicture}
595 \end{LTXexample}
596
597 \subsection{Slices of a cube}
598
599 \subsubsection{Highlighting the edges of the cut}
600
601 \begin{LTXexample}[width=8cm]
602 \psset{viewpoint=100 30 20 rtp2xyz,Decran=150}
603 \begin{pspicture}(-4,-3)(4,5)
604 \psset{solidmemory}
605 \psSolid[object=plan,definition=normalpoint,
606 args={1 1 1 [1 1 1]},action=none,name=P]
607 \psSolid[object=cube,a=2,action=draw,
608 intersectiontype=0,
609 intersectionplan=P,
610 intersectionlinewidth=2,
611 intersectioncolor=(rouge),
612 ](1,1,1)
613 \psProjection[object=point,
614 args=0 0,fontsize=10,pos=dc,
615 text=H,phi=-30,plan=P,
616 ]
617 \psSolid[object=line,
618 linestyle=dashed,
619 args=0 0 0 1 1 1]
620 \psSolid[object=vecteur,
621 linecolor=red,
622 args=1 1 1 .7 mulv3d](1,1,1)
623 \axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5)
624 \end{pspicture}
625 \end{LTXexample}
626
627 \subsubsection{Showing the sliced cube with its hexagonal cut face}
628
629 \begin{LTXexample}[width=8cm]
630 \psset{viewpoint=100 30 20 rtp2xyz,Decran=150}
631 \begin{pspicture}(-4,-3)(4,5)
632 \psset{solidmemory}
633 \psSolid[object=plan,action=none,definition=normalpoint,
634 args={1 1 1 [1 1 1]},name=P]
635 \psSolid[object=cube,a=2,
636 plansepare=P,
637 action=none,
638 name=parts_cube,
639 ](1,1,1)
640 \psSolid[object=load,
641 load=parts_cube1,
642 fcol=0 (Dandelion),
643 fillcolor={[rgb]{0.7 1 0.7}},
644 ]
645 \psProjection[object=point,
646 args=0 0,fontsize=10,pos=dc,
647 text=H,phi=-30,plan=P,
648 ]
649 \psSolid[object=vecteur,
650 linecolor=red,
651 args=1 1 1 .7 mulv3d](1,1,1)
652 \axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5)
653 \end{pspicture}
654 \end{LTXexample}
655
656 \subsubsection{The sliced cube in various positions}
657
658 Where we use the option that allows us to memorise a solid, in
659 order to put the truncated cube, after undergoing various
660 transformations, down on its cut face.
661
662 \begin{verbatim}
663 \psset{solidmemory}
664 \psSolid[object=datfile,
665 fcol=0 (Dandelion),
666 fillcolor={[rgb]{0.7 1 0.7}},
667 name=C1,
668 action=none,
669 file=./cubeHexagone]
670 \end{verbatim}
671
672
673 \begin{center}
674 \begin{pspicture}(-3,-3)(3,3)
675 \psframe(-3,-2)(3,3)
676 \psset{viewpoint=100 30 20 rtp2xyz,Decran=100}
677 %\lightsource
678 \psset{lightsrc=viewpoint}
679 \psSolid[object=grille,
680 base=-2 3 -2 3,
681 linecolor=gray]
682 \psSolid[object=datfile,
683 fcol=0 (Dandelion),
684 fillcolor={[rgb]{0.7 1 0.7}},
685 file=./cubeHexagone]
686 \axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5)
687 \end{pspicture}
688
689 \hfil
690
691 \begin{pspicture}(-2,-3)(4,3)
692 \psframe(-2,-2)(4,3)
693 \psset{viewpoint=100 -30 20 rtp2xyz,Decran=100}
694 %\lightsource
695 \psset{lightsrc=viewpoint}
696 \psSolid[object=grille,
697 base=-2 3 -2 3,
698 linecolor=gray]
699 \psSolid[object=datfile,
700 fcol=0 (Dandelion),
701 fillcolor={[rgb]{0.7 1 0.7}},
702 file=./cubeHexagone]
703 \axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5)
704 \end{pspicture}
705
706 \begin{pspicture}(-3,-2)(3,3)
707 \psframe(-3,-2)(3,3)
708 \psset{viewpoint=100 225 20 rtp2xyz,Decran=100}
709 %\lightsource
710 \psset{lightsrc=viewpoint}
711 \psSolid[object=grille,
712 base=-2 3 -2 3,
713 linecolor=gray]
714 \psSolid[object=datfile,
715 fcol=0 (Dandelion),
716 fillcolor={[rgb]{0.7 1 0.7}},
717 file=./cubeHexagone]
718 \axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5)
719 \end{pspicture}
720 \hfil
721 \begin{pspicture}(-3,-2)(3,3)
722 \psframe(-3,-2)(3,3)
723 \psset{viewpoint=100 30 20 rtp2xyz,Decran=100}
724 %\lightsource
725 \psset{lightsrc=viewpoint}
726 \psSolid[object=grille,
727 base=-2 3 -2 3,
728 linecolor=gray]
729 \psset{solidmemory}
730 \psSolid[object=datfile,
731 fcol=0 (Dandelion),
732 fillcolor={[rgb]{0.7 1 0.7}},
733 name=C1,
734 action=none,
735 file=./cubeHexagone]
736 \codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform
737 drawsolid**
738 }
739 \axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5)
740 \end{pspicture}
741
742 \begin{pspicture}(-3,-2)(3,4)
743 \psframe(-3,-2)(3,3)
744 \psset{viewpoint=100 30 20 rtp2xyz,Decran=100}
745 %\lightsource
746 \psset{lightsrc=viewpoint}
747 \psSolid[object=grille,
748 base=-2 3 -2 3,
749 linecolor=gray]
750 \psset{solidmemory}
751 \psSolid[object=datfile,
752 fcol=0 (Dandelion),
753 fillcolor={[rgb]{0.7 1 0.7}},
754 name=C1,
755 action=none,
756 file=./cubeHexagone]
757 \codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform
758 {0 0 45 rotateOpoint3d} solidtransform
759 drawsolid**
760 }
761 %\composeSolid
762 \axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5)
763 \end{pspicture}
764 \hfil
765 \begin{pspicture}(-3,-2)(3,4)
766 \psframe(-3,-2)(3,3)
767 \psset{viewpoint=100 30 20 rtp2xyz,Decran=100}
768 %\lightsource
769 \psset{lightsrc=viewpoint}
770 \psSolid[object=grille,
771 base=-2 3 -2 3,
772 linecolor=gray]
773 \psset{solidmemory}
774 \psSolid[object=datfile,
775 fcol=0 (Dandelion),
776 fillcolor={[rgb]{0.7 1 0.7}},
777 name=C1,
778 action=none,
779 file=./cubeHexagone]
780 \codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform
781 {0 0 45 rotateOpoint3d} solidtransform
782 {-35.2644 -90 add 0 0 rotateOpoint3d} solidtransform
783 drawsolid*
784 }
785 \axesIIID[linecolor=blue](1,2.5,0.5)(2.5,3,2.5)
786 \end{pspicture}
787 \end{center}
788
789
790 \subsection{Multiple sections}
791
792 \subsubsection{Slicing a sphere with PStricks}
793
794 \begin{LTXexample}[width=8cm]
795 \begin{pspicture}(-4,-4)(4,4)
796 \psset{viewpoint=100 20 20 rtp2xyz,Decran=75}
797 \psset{solidmemory,lightsrc=viewpoint}
798 \codejps{
799 /coeff 0.75 def /rO 4 def /OH coeff rO mul neg def}%
800 \psSolid[object=sphere,
801 r=rO,ngrid=9 18,
802 plansepare={[1 0 0 OH]},
803 name=part,
804 action=none]
805 \psSolid[object=load,
806 load=part1,plansepare={[-1 0 0 OH]},action=none,name=part]
807 \psSolid[object=load,
808 load=part1,plansepare={[0 1 0 OH]},action=none,name=part]
809 \psSolid[object=load,
810 load=part1,plansepare={[0 -1 0 OH]},action=none,name=part]
811 \psSolid[object=load,
812 load=part1,plansepare={[0 0 1 OH]},action=none,name=part]
813 \psSolid[object=load,
814 load=part1,plansepare={[0 0 -1 OH]},action=none,name=part]
815 \psSolid[object=load,hue=.1 .8 0.5 1,
816 load=part1](0,0,0)
817 \composeSolid
818 \end{pspicture}
819 \end{LTXexample}
820
821 \subsubsection{Multiple sections of a \Index{parallelepiped}}
822
823 Multiple sections are better carried out inside a PostScript loop,
824 within \verb+\codejps+; it's easier and quicker!
825
826 In this example, the original solid is a parallelepiped.
827 Truncations of the vertices and chamfering of the edges are
828 effected by means of slicing planes, starting off with the
829 vertices and finishing with the edges.
830
831 \begin{LTXexample}[width=7cm]
832 \begin{pspicture}(-3.5,-4)(3.5,4)
833 \psset{viewpoint=100 -20 10 rtp2xyz,Decran=100}
834 %\lightsource
835 \psset{lightsrc=viewpoint}
836 \codejps{
837 4 4 6 newparallelepiped
838 45 90 360 {
839 /iAngle exch def
840 /n_x iAngle cos 35.2644 cos mul def
841 /n_y iAngle sin 35.2644 cos mul def
842 /n_z 35.2644 sin def
843 /distance 2 3 add 3 sqrt div neg def
844 [ n_x n_y n_z distance]
845 solidplansepare
846 } for
847 45 90 360 {
848 /iAngle exch def
849 /n_x iAngle cos 35.2644 cos mul def
850 /n_y iAngle sin 35.2644 cos mul def
851 /n_z 35.2644 sin neg def
852 /distance 2 3 add 3 sqrt div neg def
853 [ n_x n_y n_z distance]
854 solidplansepare
855 } for
856 45 90 360 {
857 /iAngle exch def
858 % plan : ax+by+cz-d=0
859 [ iAngle cos % a
860 iAngle sin % b
861 0 % c
862 -2.5 % -d
863 ] solidplansepare
864 } for
865 dup [.5 .2] solidputhuecolors
866 solidlightOn
867 drawsolid*}
868 \end{pspicture}
869 \end{LTXexample}
870 \subsection{Sections of a torus}
871 %\begin{pspicture}(-6,-4)(6,4)
872 %\psSolid[r1=3,r0=1.5,
873 % object=tore,
874 %% ngrid=18 60,
875 % file=./tore1860,action=writesolid]
876 %\end{pspicture}
877
878 \begin{center}
879 \begin{pspicture}(-6,-4)(6,4)
880 \pstVerb{/Ampl 3 2 sqrt mul def}%
881 \psset{viewpoint=50 -10 30 rtp2xyz,Decran=50}
882 %\lightsource
883 \psset{lightsrc=viewpoint}
884 \psframe[fillstyle=solid,fillcolor=gray!50](-6,-4)(6,4)
885 %\psset{solidmemory}
886 %\psSolid[object=datfile,file=./tore1860,
887 % plansepare={[1 0 0 -1.5]},
888 % name=lemniscate,
889 % action=none](0,0,0)
890 %\psSolid[object=load,
891 % load=lemniscate1,
892 % file=./tore1860lemniscate,action=writesolid](0,0,0)
893 \defFunction[algebraic]{lemniscate}(t){1.5}{Ampl*sin(t)/(1+cos(t)*cos(t))}{Ampl*sin(t)*cos(t)/(1+cos(t)*cos(t))}
894 \psSolid[object=datfile,file=./tore1860lemniscate,
895 fcol=0 (0.5 0.72 0.5 setrgbcolor)
896 1 (0.5 0.72 0.5 setrgbcolor),
897 fillcolor=green!30,
898 intersectiontype=0,
899 intersectionplan={
900 [1 0 0 -1.5]},
901 intersectioncolor=(rouge),
902 intersectionlinewidth=2.2]
903 \psSolid[object=courbe,r=0,linewidth=2pt,
904 range=0 6.28,
905 linecolor=red,
906 function=lemniscate]%
907 \psSolid[object=plan,action=draw,
908 definition=equation,
909 args={[1 0 0 -1.5] 90},
910 base=-5 5 -2 2,planmarks,showBase]
911 %\composeSolid
912 \end{pspicture}
913 \end{center}
914 \begin{center}
915 \begin{pspicture}(-6,-4)(6,4)
916 \pstVerb{/Ampl 3 2 sqrt mul def}%
917 \psset{viewpoint=50 -10 30 rtp2xyz,Decran=50}
918 %\lightsource
919 \psset{lightsrc=viewpoint}
920 \psframe[fillstyle=solid,fillcolor=gray!50](-6,-4)(6,4)
921 \defFunction[algebraic]{lemniscate}(t){1.5}{Ampl*sin(t)/(1+cos(t)*cos(t))}{Ampl*sin(t)*cos(t)/(1+cos(t)*cos(t))}
922 \psSolid[object=datfile,file=./tore1860lemniscate,
923 hollow,
924 rm=0 1,
925 fillcolor=green!30,incolor=yellow!50]
926 \psSolid[object=courbe,r=0,linewidth=2pt,
927 range=0 6.28,
928 linecolor=red,
929 function=lemniscate]%
930 \psSolid[object=plan,action=draw,
931 definition=equation,
932 args={[1 0 0 -1.5] 90},
933 base=-5 5 -2 2,planmarks,showBase]
934 \end{pspicture}
935 \end{center}
936 \subsection{Some more examples}
937 \begin{enumerate}
938 \item
939 You will find a \textit{jps} coded version of this document
940 within the \verb+\codejps+ command in the following document:
941
942 \centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections}}
943 \item A lesson about conic sections on:
944
945 \centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/sections-cone}}
946 \item A lesson about cylindrical sections on:
947
948 \centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/section-cylindre}}
949 \item A lesson about sections of a torus on:
950
951 \centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/section-tore}}
952 \end{enumerate}
953
954
955 \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.