Debian Codegraph @

texmf-dist/doc/generic/pst-solides3d/text/chapter-2-en.tex

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