Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc / par-positionnersolide.tex
1 \newpage
2 \section {Positionner un solide}
3 \subsection{Translation}
4 La commande suivante
5 \verb+\psSolid[object=cube,+\textsl{options}\verb+](x,y,z)+ déplace le
6 centre du cube au point de coordonnées $\mathtt{(x,y,z)}$.
7
8 L'exemple suivant va recopier le cube d'arête 1 \begin{pspicture}(-0.5,-0.5)(.5,.5)
9 \psset{Decran=40,viewpoint=50 35 35,a=1,lightsrc=50 30 20}
10 \psset{fillcolor=yellow,mode=3,
11 fcol= 0 (Apricot)
12 1 (Lavender)
13 2 (SkyBlue)
14 3 (LimeGreen)
15 4 (OliveGreen)
16 5 (Yellow)
17 6 (GreenYellow)
18 7 (Cerulean)
19 8 (CarnationPink)}
20 \psSolid[object=cube](0.5,0.5,0.5)% c1
21 \end{pspicture}
22 aux points de coordonnées $\mathtt{(0.5,0.5,0.5)}$, $\mathtt{(4.5,0.5,0.5)}$ etc. afin que ces copies occupent les coins d'un cube d'arête 5.
23 \begin{center}
24 \begin{pspicture}(-4,-5)(5,5)
25 \psframe(-4,-5)(5,5)
26 %\psset{SphericalCoor,Decran=3,viewpoint=10 35 35,a=1,lightsrc=50 20 10}
27 \psset{Decran=40,viewpoint=50 35 35,a=1,lightsrc=50 30 20,
28 fcol= 0 (Apricot)
29 1 (Lavender)
30 2 (SkyBlue)
31 3 (LimeGreen)
32 4 (OliveGreen)
33 5 (Yellow)
34 6 (GreenYellow)
35 7 (Cerulean)
36 8 (CarnationPink)}
37 \psSolid[object=grille,base=0 6 0 6,fillcolor=blue!50]%%
38 \psSolid[object=grille,base=0 6 0 6,RotY=90,fillcolor=blue!40](0,0,6)%
39 \psSolid[object=grille,base=0 6 0 6,RotX=-90,fillcolor=blue!30](0,0,6)%
40 \psPoint(1,0.5,0.5){c11}
41 \psPoint(0.5,0.5,1){c12}
42 \psPoint(0.5,1,0.5){c13}
43 \psPoint(4.5,4.5,1){c21}
44 \psPoint(4,4.5,0.5){c22}
45 \psPoint(4.5,4,0.5){c23}
46 \psPoint(4,0.5,0.5){c41}
47 \psPoint(4.5,0.5,1){c42}
48 \psPoint(4.5,1,0.5){c43}
49 \psPoint(0.5,4,0.5){c51}
50 \psPoint(0.5,4.5,1){c52}
51 \psPoint(1,4.5,0.5){c53}
52 \psPoint(0.5,0.5,4){c61}
53 \psPoint(0.5,1,4.5){c62}
54 \psPoint(1,0.5,4.5){c63}
55 \psPoint(4,0.5,4.5){c71}
56 \psPoint(4.5,1,4.5){c72}
57 \psPoint(4.5,0.5,4){c73}
58 \axesIIID(1,1,1)(6,6,6)
59 {\psset{fillcolor=yellow,mode=3}
60 \psSolid[object=cube](0.5,0.5,0.5)% c1
61 \psline[linestyle=dashed,linecolor=red](c11)(c41)
62 \psline[linestyle=dashed,linecolor=red](c12)(c61)
63 \psline[linestyle=dashed,linecolor=red](c13)(c51)
64 \psSolid[object=cube](4.5,0.5,0.5)
65 \psSolid[object=cube](0.5,4.5,0.5)
66 \psSolid[object=cube](0.5,0.5,4.5)
67 \psSolid[object=cube](4.5,4.5,4.5)
68 \psSolid[object=cube](4.5,0.5,4.5)
69 \psSolid[object=cube](4.5,4.5,0.5)
70 \psSolid[object=cube](0.5,4.5,4.5)}
71 \psSolid[object=grille,base=0 5 0 5,action=draw,linecolor=gray!50](0,0,5)%
72 \psSolid[object=grille,base=0 5 0 5,action=draw,linecolor=gray!50,RotY=90](5,0,5)%
73 \psSolid[object=grille,base=0 5 0 5,action=draw,RotX=-90,linecolor=gray!50](0,5,5)%
74 \end{pspicture}
75 \end{center}
76 \begin{verbatim}
77 \psset{fillcolor=yellow,mode=3}
78 \psSolid[object=cube](0.5,0.5,0.5)
79 \psSolid[object=cube](4.5,0.5,0.5)
80 \psSolid[object=cube](0.5,4.5,0.5)
81 \psSolid[object=cube](0.5,0.5,4.5)
82 \psSolid[object=cube](4.5,4.5,4.5)
83 \psSolid[object=cube](4.5,0.5,4.5)
84 \psSolid[object=cube](4.5,4.5,0.5)
85 \psSolid[object=cube](0.5,4.5,4.5)
86 \end{verbatim}
87 \subsection{Rotation}
88 La rotation s'effectue dans l'ordre autour des axes $Ox$, $Oy$ et $Oz$. Prenons l'exemple d'un parallélépipède rectangle,
89 \begin{pspicture}(-1,-0.2)(1,.5)
90 \psset{Decran=40,viewpoint=50 35 35,a=2,b=3,c=1,lightsrc=50 30 30}
91 \psset{fillcolor=yellow,unit=0.5,
92 fcol= 0 (Apricot)
93 1 (Lavender)
94 2 (SkyBlue)
95 3 (LimeGreen)
96 4 (OliveGreen)
97 5 (Yellow)
98 6 (Bittersweet)}
99 \psSolid[object=parallelepiped](0.5,0.5,0.5)%
100 \end{pspicture}
101 que l'on va faire tourner
102 successivement autour des axes $Ox$, $Oy$ et $Oz$.
103
104 \begin{multicols}{4}
105 \psset{Decran=40,viewpoint=50 35 35,a=2,b=3,c=1}
106 \psset{unit=0.5,
107 fcol= 0 (Apricot)
108 1 (Lavender)
109 2 (SkyBlue)
110 3 (LimeGreen)
111 4 (OliveGreen)
112 5 (Yellow)
113 6 (Bittersweet),
114 object=parallelepiped}
115 \setlength{\columnseprule}{1pt}
116 \centerline{
117 \begin{pspicture}(-2.5,-2.5)(2.5,2.5)
118 \psframe(-2.5,-2.5)(2.5,2.5)
119 \psSolid%%
120 \axesIIID(1,1.5,1)(3,3,2)
121 \end{pspicture}}
122 \columnbreak
123 \centerline{
124 \begin{pspicture}(-2.5,-2.5)(2.5,2.5)
125 \psframe(-2.5,-2.5)(2.5,2.5)
126 \psSolid[RotZ=60]%%
127 \psSolid[action=draw,linewidth=0.5\pslinewidth]%%
128 \axesIIID(1,1.5,1)(2,3,2)
129 \end{pspicture}}
130
131 \centerline{\texttt{[RotZ=60]}}
132
133 \columnbreak
134 \centerline{
135 \begin{pspicture}(-2.5,-2.5)(2.5,2.5))
136 \psframe(-2.5,-2.5)(2.5,2.5)
137 \psSolid[RotX=30]%%
138 \psSolid[action=draw,linewidth=0.5\pslinewidth]%%
139 \axesIIID(1,1.5,1)(2,3,2)
140 \end{pspicture}}
141
142 \centerline{\texttt{[RotX=30]}}
143
144 \columnbreak
145 \centerline{
146 \begin{pspicture}(-2.5,-2.5)(2.5,2.5)
147 \psframe(-2.5,-2.5)(2.5,2.5)
148 \psSolid[RotY=45]%%
149 \psSolid[action=draw,linewidth=0.5\pslinewidth]%%
150 \axesIIID(1,1.5,1)(2,3,2)
151 \end{pspicture}}
152
153 \centerline{\texttt{[RotY=-45]}}
154 \end{multicols}

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.