summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/src/text/par-eclairageponctuel-en.tex
blob: 2a7423a41248a8dcbd4d65a6c54ee772615c4a33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
\newpage
\section{Lighting by a point light source}

Two parameters, the first one positions the \Index{light source}, the second one sets the \Index{light intensity}:
\begin{compactitem}
    \item \Lkeyword{lightsrc}=20 30 50 in Cartesian coordinates, or
\texttt{\Lkeyword{lightsrc}=\Lkeyval{viewpoint}} to put the light source at the view point.
    \item \texttt{\Lkeyword{lightintensity}=2} (default value).
\end{compactitem}
\begin{center}
\newcommand\LIGHTSRC[3]{%
\pstVerb{
         /xLIGHTSRC #1 def
         /yLIGHTSRC #2 def
         /zLIGHTSRC #3 def
         /RADIUS 4 def
         /THETA yLIGHTSRC xLIGHTSRC atan def
         /DISTANCE xLIGHTSRC dup mul  yLIGHTSRC dup mul add zLIGHTSRC dup mul add sqrt def
         /PHI zLIGHTSRC DISTANCE div arcsin def
         /ALPHA RADIUS DISTANCE div arccos def
         /OH ALPHA cos RADIUS mul def
         /radius_cone ALPHA sin RADIUS mul def
         /Hauteur_cone DISTANCE OH sub def
         /X_C xLIGHTSRC OH mul DISTANCE div def
         /Y_C yLIGHTSRC OH mul DISTANCE div def
         /Z_C zLIGHTSRC OH mul DISTANCE div def
         /rotX_axe_cone PHI 90 sub def
         /rotZ_axe_cone THETA 90 sub def
         }
\psset{Decran=50,viewpoint=50 10 15}
\psSolid[object=sphere,r=RADIUS,fillcolor=blue,ngrid=18 36,
        lightsrc=xLIGHTSRC yLIGHTSRC zLIGHTSRC](0,0,0)
\psPoint(xLIGHTSRC,yLIGHTSRC,zLIGHTSRC){LS}
\psset{lightsrc=}
\psSolid[object=cone,r=radius_cone,h=Hauteur_cone,fillcolor=yellow!50,
       ngrid=1 36,RotX=rotX_axe_cone,RotZ=rotZ_axe_cone,opacity=0.5,
       linecolor=yellow](X_C,Y_C,Z_C)
\psdot(LS)}

\begin{pspicture}(-2,-2.5)(5,5)
\psset{unit=0.5}
\LIGHTSRC{0}{8}{8}
\uput[45](LS){Light Source}
\axesIIID(4,4,4)(6,6,6)
\end{pspicture}
\begin{pspicture}(-4,-2.5)(5,2.5)
\psset{unit=0.5}
\LIGHTSRC{2}{-5}{0}
\uput[l](LS){Light Source}
\axesIIID(4,4,4)(6,6,6)
\end{pspicture}

\begin{pspicture}(-1,-2.5)(9,2.5)
\psset{unit=0.5}
\LIGHTSRC{0}{20}{0}
\uput[r](LS){Light Source}
\axesIIID(4,4,4)(6,6,6)
\end{pspicture}
\end{center}

As you can see, the intersecting \Index{plane} (section of the sphere with the cone of
\Index{light}) divides the object into two half spaces: the first half space
(the one on the side of the \Index{light source}) is illuminated and the other half space is the shadow region referring to this light source position.

Now it is clear, that if the view point is setup with the same coordiates as the light source, the object is illuminated uniquely.

\encadre{In order to get some shadow regions to appear in the graphic---which emphasises the 3D character---we would suggest choosing the light source and the view point differently.}

\newpage
Here follow a few examples:

\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=10 20 30,mode=3}
\psSolid[object=sphere,r=5,fillcolor=blue](0,0,8)
\rput(0,-3.5){\texttt{lightsrc=10 20 30}}
\end{pspicture}
\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=-10 -20 30,mode=3}
\psSolid[object=sphere,r=5,fillcolor=blue](0,0,8)
\rput(0,-3.5){\texttt{lightsrc=-10 -20 30}}
\end{pspicture}
\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=30 -20 30,mode=3}
\psSolid[object=sphere,r=5,fillcolor=blue](0,0,8)
\rput(0,-3.5){\texttt{lightsrc=30 -20 30}}
\end{pspicture}

When the option \verb+[lightsrc=value1 value2 value3]+
is not specified, the object is uniformly illuminated.

\begin{center}
 \begin{pspicture}(-6,-2)(6,2)
%\psframe(-6,-4)(6,4)
\psset{viewpoint=50 50 30 rtp2xyz,Decran=40,unit=0.6}
\psSolid[object=datfile,file=data/tore1836,deactivatecolor]
 %\psSolid[r1=3.5,r0=1,object=tore,ngrid=18 36,fillcolor={[rgb]{.372 .62 .628}}]%
 \axesIIID(0,4.5,0)(6,6,4)
 \end{pspicture}
\end{center}



Here are some examples, where we always keep the same object, the same view point, the same light
source coordinates and just vary the \Lkeyword{lightintensity} value:

\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=-10 -20 30,mode=4,lightintensity=1}
\psSolid[object=sphere,r=5,fillcolor=green](0,0,8)
\rput(0,-3.5){\texttt{lightintensity=2}}
\end{pspicture}
\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=-10 -20 30,mode=4,lightintensity=3}
\psSolid[object=sphere,r=5,fillcolor=green](0,0,8)
\rput(0,-3.5){\texttt{lightintensity=3}}
\end{pspicture}
\begin{pspicture}(-3,-2)(3,3)
\psset{unit=0.3}
\psset{Decran=1e3,
    viewpoint=500 0 1000,
    lightsrc=-10 -20 30,mode=4,lightintensity=8}
\psSolid[object=sphere,r=5,fillcolor=green](0,0,8)
\rput(0,-3.5){\texttt{lightintensity=8}}
\end{pspicture}

Here we can see, that by increasing the \Lkeyword{lightintensity} value, the shading nuances of the solid are decreasing.



\endinput