Debian Codegraph @

texmf-dist/doc/generic/pst-solides3d/text/par-section-en.tex

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