Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / chapter-2-en.tex.svn-base
1 \section{Choice of the view point}
2
3 \begin{center}
4
5 \begin{pspicture}(-5,-5.7)(10,7)
6 \psset{lightsrc=10 20 30,viewpoint=50 30 20 rtp2xyz}
7 \definecolor{bleuciel}{rgb}{0.78,0.84,0.99}
8 \psSolid[object=cube,fillcolor=bleuciel,a=2,action=draw*]%%
9 %\psSolid[object=cubemaillage,fillcolor=bleuciel,a=2]%%
10 \psSolid[object=grille,base=0 8 0 10,action=draw]%%
11 \psSolid[object=grille,base=0 7 0 10,action=draw,RotY=90](0,0,7)%
12 \psSolid[object=grille,base=0 8 0 7,action=draw,RotX=-90](0,0,7)%
13 \psSolid[object=cube,fillcolor=bleuciel,a=1,action=draw*](0.5,0.5,0.5)%
14 \psSolid[object=grille,base=-1 1 -1 1,action=draw,linecolor=blue](0,0,1)%
15 \psSolid[object=grille,base=-1 1 -1 1,action=draw,RotY=90,linecolor=blue](1,0,0)%
16 \psSolid[object=grille,base=-1 1 -1 1,action=draw,RotX=-90,linecolor=blue](0,1,0)%
17 \axesIIID(1,1,1)(8,10,7)
18 \pstVerb{
19    /dV 12 def % distance V
20    /dE 6 def % distance \'{e}cran
21    /Theta 60 def
22    /Phi 30 def
23    dV Theta Phi rtp2xyz
24    /zV exch def
25    /yV exch def
26    /xV exch def
27    dE Theta Phi rtp2xyz
28    /zE exch def
29    /yE exch def
30    /xE exch def
31          }%
32 \psPoint(xV,yV,zV){V}
33 \psPoint(xE,yE,zE){E}
34 \psPoint(xV,yV,0){Vp}
35 %
36 % 5 distance \'{e}cran
37 %\psPoint(dE Theta  cos mul Phi cos div dE Theta  sin mul Phi cos div 0){Vq}
38 \psPoint(xV,0,0){Vx}
39 \psPoint(0,yV,0){Vy}
40 \psPoint(0,0,zV){Vz}
41 \psdot(V)
42 {\psset{linestyle=dashed,linecolor=red}
43 \psline(V)(Vp)\psline(Vx)(Vp)\psline(Vy)(Vp)\psline(V)(Vz)\psline(V)(O)\psline(Vp)(O)}
44 %\psSolid[object=grille,base=-5 5 -3 3,action=draw,RotX=-60,linecolor=red](xE,yE,zE)%
45 \psTransformPoint[RotX=-60](-5 -3 0)(xE,yE,zE){A}
46 \psTransformPoint[RotX=-60](-5 3 0)(xE,yE,zE){B}
47 \psTransformPoint[RotX=-60](5 3 0)(xE,yE,zE){C}
48 \psTransformPoint[RotX=-60](5 -3 0)(xE,yE,zE){D}
49 \pspolygon[fillstyle=vlines,hatchcolor=yellow!90,hatchwidth=0.02,hatchsep=0.04](A)(B)(C)(D)
50 %
51 %
52 \PointEcran(1,1,1){S1}
53 \psPoint(1,1,1){s1}
54 \psline(S1)(V)
55 \psline[linestyle=dashed](s1)(S1)
56 %
57 \PointEcran(1,1,-1){S2}
58 \psPoint(1,1,-1){s2}
59 \psline(S2)(V)
60 \psline[linestyle=dashed](s2)(S2)
61 %
62 \PointEcran(-1,1,-1){S3}
63 \psPoint(-1,1,-1){s3}
64 \psline(S3)(V)
65 \psline[linestyle=dashed](s3)(S3)
66 %
67 \PointEcran(-1,1,1){S4}
68 \psPoint(-1,1,1){s4}
69 \psline(S4)(V)
70 \psline[linestyle=dashed](s4)(S4)
71 %
72 \PointEcran(1,-1,-1){S5}
73 \psPoint(1,-1,-1){s5}
74 \psline(S5)(V)
75 \psline[linestyle=dashed](s5)(S5)
76 %
77 \PointEcran(1,-1,1){S6}
78 \psPoint(1,-1,1){s6}
79 \psline(S6)(V)
80 \psline[linestyle=dashed](s6)(S6)
81 %
82 \PointEcran(-1,-1,1){S7}
83 \psPoint(-1,-1,1){s7}
84 \psline(S7)(V)
85 \psline[linestyle=dashed](s7)(S7)
86 \psset{solidmemory}
87 \psSolid[object=plan,
88    definition=equation,
89    args={[0 0 1 0]},
90    base=-5 5 -3 3,
91    RotX=-60,
92 %   showBase,
93    action=none,
94    name=planbase,
95 ]
96 %% here, we define the plantype object "Ecran"
97 \codejps{
98    planbase
99    dup xE yE zE planputorigine
100    dup -180 rotateplan
101    /Ecran exch def
102 }%
103 %% uncomment follow line to draw "Ecran"
104 %\psSolid[object=plan,args=Ecran,showBase,planmarks]
105 \psProjection[object=texte,
106    plan=Ecran,
107    fontsize=20,
108    text=Projection Screen](-2,2)
109
110 %
111 \psset{linecolor=red,fillstyle=vlines,hatchsep=0.04,hatchwidth=0.02}
112 \pspolygon[hatchcolor=red!60](S1)(S2)(S3)(S4)
113 \pspolygon[,hatchcolor=red!60](S1)(S2)(S5)(S6)
114 \pspolygon[hatchcolor=red!10](S1)(S4)(S7)(S6)
115 \psdots(s1)(s2)(s3)(s4)(s5)(s6)(s7)(S1)(S2)(S3)(S4)(S5)(S6)(S7)
116 \psbrace[ref=lC,linecolor=black](V)(E){$D$}
117 \uput[45](V){View Point}
118 \end{pspicture}
119 \end{center}
120
121 The coordinates of the object, in this case the bluish cube, are setup in the axes of coordinates $Oxyz$.  The \Index{coordinates} of the \Index{view point} ($V$), are setup in the same axes of coordinates, either in \Index{spherical coordinates}---with the adding option \verb+[rtp2xyz]+, or in Cartesian coordinates---which is the default option.
122
123 Example: \verb+[viewpoint=50 30 20  rtp2xyz]+ \qquad (here the notation with spherical coordinates)
124
125
126 See some examples:
127
128 \def\decor{%
129 \psset{solidmemory}
130  \psSolid[object=plan,
131    definition=equation,
132    base=-5 5 -5 5,
133    args={[0 0 1 0] 180},
134    name=P1]%
135 \psset{fontsize=28.45,plan=P1}
136 \psSolid[object=plan,
137    args=P1,
138    plangrid,action=none]
139 \psProjection[object=texte,
140    linecolor=red,
141    text=pst-solides3d](0,3.5)
142  \psSolid[object=sphere,r=1,fillcolor=red!25,ngrid=18 36](4,4,1)
143  \psSolid[object=cone,h=3,r=1,fillcolor=cyan,mode=5](-4,4,0)
144  \psSolid[object=cube,a=2,fillcolor=magenta!20](-4,-4,1)
145  \psSolid[object=cylindre,r=1,h=4,fillcolor=blue!20,ngrid=4 16](4,-4,0)
146 \axesIIID(0,0,0)(6,6,6)
147 \psPoint(0,0,0){O}
148 \psdot(O)}
149
150 \begin{pspicture}(-3,-3)(3,3)
151 %\psframe(-5,-3)(4,4)
152  \psset{viewpoint=20 25 15,Decran=20,lightsrc=viewpoint,unit=0.9}
153 \decor
154 \rput(0,-4){\texttt{viewpoint=20 25 15}}
155  \end{pspicture}\qquad\qquad\qquad\qquad
156 \begin{pspicture}(-3,-3)(3,3)
157 %\psframe(-5,-3)(4,4)
158  \psset{viewpoint=-10 0 30,Decran=20,lightsrc=viewpoint,unit=0.9}
159 \decor
160 \rput(0,-4){\texttt{viewpoint=-10 0 30}}
161  \end{pspicture}
162
163
164 \begin{pspicture}(-3,-3)(3,4.5)
165 %\psframe(-5,-3)(4,4)
166  \psset{viewpoint=-20 0 10,Decran=10,lightsrc=viewpoint,unit=0.9}
167 \decor
168 \rput(0,-4){\texttt{viewpoint=-20 0 10}}
169  \end{pspicture}\qquad\qquad\qquad\qquad
170  \begin{pspicture}(-3,-3)(3,4.5)
171 %\psframe(-5,-3)(4,4)
172  \psset{viewpoint=-20 -10 25,Decran=20,lightsrc=viewpoint,unit=0.9}
173 \decor
174 \rput(0,-4){\texttt{viewpoint=-20 -10 25}}
175  \end{pspicture}
176
177 \section{The definition of the option \texttt{\Index{Decran}}}
178 The \Index{projection screen} is placed perpendicular to the direction $OV$---central
179 perspective, at a distance $D$ from the view point $V$: We call that distance
180 `Decran', with the default value of \texttt{\Lkeyword{Decran}=50}; this value can
181 either be positive or negative.
182
183
184
185 The following examples show the behaviour of the parameter \Lkeyword{Decran}.
186
187 \begin{center}
188 \begin{pspicture}(-2,-3)(2.5,3)
189 \psaxes[yAxis=false](-2,-2)(2,2)
190 \psset{viewpoint=0 0 5,Decran=5}
191 \psSolid[object=grille,base=-2 2 -2 2]
192 \psSolid[object=vecteur,args=0 0 0  2 2 0,linecolor=red,linewidth=2pt]
193 \axesIIID(3,3,3)\pnode(2,-2){B}\pnode(2,2){A}
194 \end{pspicture}
195 \qquad
196 \begin{pspicture}(-0.5,-3)(5,3)
197 \psaxes[yAxis=false](0,-2)(5,2)
198 \psset{viewpoint=5 0 5,Decran=5,RotX=-90}
199 \psSolid[object=grille,base=-2 2 -2 2,RotX=89.9]
200 \axesIIID[axisnames={x,z,y}](3,3,0)
201 \psdot(5,0)\uput[0](5,0){V}
202 \psline[tbarsize=3mm 5]{<->|}(0,-0.5)(5,-0.5)\rput*(2.5,-0.5){$D=V$}
203 \psline[linestyle=dashed](0,2)(5,0)\psline[linestyle=dashed](0,-2)(5,0)
204 \uput[-90](0,-2.5){Original}\uput[-90](0,-2.85){Image}
205 \psline[linestyle=dotted](A)(0,2)
206 \psline[linestyle=dotted](B)(0,-2)
207 \rput(-1,2.75){Rotation: }
208 \rput(-1,2.25){90$^\circ$ around $x$}
209 \psSolid[object=vecteur,args=0 0 0  2 2 0,linecolor=red,linewidth=2pt]
210 \end{pspicture}\\[\normalbaselineskip]
211 %
212 \begin{pspicture}(-2,-3)(2.5,3)
213 \psaxes[yAxis=false](-2,-2)(2,2)
214 \psset{viewpoint=0 0 5,Decran=2.5}
215 \psSolid[object=grille,base=-2 2 -2 2]
216 \psSolid[object=vecteur,args=0 0 0  2 2 0,linecolor=red,linewidth=2pt]
217 \axesIIID(3,3,3)\pnode(1,-1){B}\pnode(1,1){A}
218 \end{pspicture}
219 \qquad
220 \begin{pspicture}(-0.5,-3)(5,3)
221 \psaxes[yAxis=false](0,-2)(5,2)
222 \psset{viewpoint=5 0 5,Decran=2.5,RotX=-90}
223 \psline[linewidth=1pt](0,2)(0,-2)
224 \psline[linewidth=1.5pt,linecolor=red]{->}(0,0)(0,-2)
225 \psdot(5,0)\uput[0](5,0){V}
226 \psline[tbarsize=3mm 5]{<->|}(0,1.5)(5,1.5)\rput*(2.5,1.5){$V$}
227 \psline[linestyle=dashed](0,2)(5,0)\psline[linestyle=dashed](0,-2)(5,0)
228 \psline[tbarsize=3mm 5]{|<->|}(2.5,-1.5)(5,-1.5)\rput*(3.75,-1.5){$D$}
229 \psline[linewidth=1.5pt](2.5,1)(2.5,-1)
230 \psline[linewidth=1.5pt,linecolor=red]{->}(2.5,0)(2.5,-1)
231 \psline{->}(2.5,0)(3.5,0)\uput[0](3.5,0){$z$}
232 \uput[-90](0,-2.5){Original}\uput[-90](2.5,-2.5){Image}
233 \psline[linestyle=dotted](A)(2.5,1)
234 \psline[linestyle=dotted](B)(2.5,-1)
235 \rput(-1.5,1.75){Rotation:}
236 \rput(-1.5,1.25){90$^\circ$ around $x$}
237 \end{pspicture}
238 \end{center}
239
240
241 If you keep the view point and make the \Lkeyword{Decran} value smaller, then the
242 image gets smaller. If you make the \Lkeyword{Decran} value larger, then the image gets larger.
243
244 Here are some examples, where we keep the same object, the same view point
245 and just vary the \Lkeyword{Decran} value:
246
247 \begin{center}
248 \begin{pspicture}(-2,-2)(2,2)
249 %\psgrid
250 \psset{solidmemory}
251 \psset{viewpoint=0 50 0,Decran=50}
252 %\psSolid[object=sphere,r=2,ngrid=18 36]
253 \psSolid[object=plan,definition=normalpoint,plangrid,linecolor=red,
254          base=-2 2 -2 2,args={0 0 0 [0 1 0 180]},name=monplan]
255 \psset{plan=monplan}
256 \psProjection[object=texte,
257               linecolor=red,
258               fontsize=105.35,
259               text=PS]%
260 \composeSolid
261 \rput*(0,-1.75){\texttt{Decran=50}}
262 \end{pspicture}\qquad
263 \begin{pspicture}(-2,-2)(2,2)
264 %\psgrid
265 \psset{solidmemory}
266 \psset{viewpoint=0 50 0,Decran=25}
267 %\psSolid[object=sphere,r=2,ngrid=18 36]
268 \psSolid[object=plan,definition=normalpoint,plangrid,linecolor=red,
269          base=-2 2 -2 2,args={0 0 0 [0 1 0 180]},name=monplan]
270 \psset{plan=monplan}
271 \psProjection[object=texte,
272               linecolor=red,
273               fontsize=105.35,
274               text=PS]%
275 \composeSolid
276 \rput*(0,-1.75){\texttt{Decran=25}}
277 \end{pspicture}\qquad
278 \begin{pspicture}(-2,-2)(2,2)
279 %\psgrid
280 \psset{solidmemory}
281 \psset{viewpoint=0 50 0,Decran=-50}
282 \psSolid[object=plan,definition=normalpoint,plangrid,linecolor=red,
283          base=-2 2 -2 2,args={0 0 0 [0 1 0 180]},name=monplan]
284 \psset{plan=monplan}
285 \psProjection[object=texte,
286               linecolor=red,
287               fontsize=105.35,
288               text=PS]%
289 \composeSolid
290 \rput*(0,-1.75){\texttt{Decran=-50}}
291 \end{pspicture}
292 \end{center}
293
294
295 \endinput
296
297

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.