Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-colorierfacettes-en.tex.svn-base
1 \section{\Index{Colouring} some single faces}
2
3 The key value \texttt{\Lkeyword{fcol}=$i_0$~($c_0$) $i_1$~($c_1$) \dots $i_n$~($c_n$)},
4 where $i_k$ are integers and $c_k$ the names of the colours, permits to
5 specify a \Index{colour} for special \Index{faces}.
6 To the face with the index $i_k$ corresponds the colour $c_k$. The
7 integer $n$ must be lower than the maximum of the number of faces of the chosen solid.
8
9
10 %% L'option \texttt{[fcol=1 (OliveGreen) 0 (color1) 4 (color2) etc.]}
11 %% permet de sp\'{e}cifier dans l'ordre :
12 %% \begin{compactitem}
13 %%   \item le num\'{e}ro de la facette  de \texttt{0} \`{a} \texttt{n-1}, pour \texttt{n} facettes ;
14 %%   \item la couleur de la facette.
15 %% \end{compactitem}
16
17 The colour names $c_k$, there are $68$~predefined values, are defined names in the
18 \texttt{color.pro}. These values are:
19 \textsl{GreenYellow},
20 \textsl{Yellow},
21 \textsl{Goldenrod},
22 \textsl{Dandelion},
23 \textsl{Apricot},
24 \textsl{Peach},
25 \textsl{Melon},
26 \textsl{YellowOrange},
27 \textsl{Orange},
28 \textsl{BurntOrange},
29 \textsl{Bittersweet},
30 \textsl{RedOrange},
31 \textsl{Mahogany},
32 \textsl{Maroon},
33 \textsl{BrickRed},
34 \textsl{Red},
35 \textsl{OrangeRed},
36 \textsl{RubineRed},
37 \textsl{WildStrawberry},
38 \textsl{Salmon},
39 \textsl{CarnationPink},
40 \textsl{Magenta},
41 \textsl{VioletRed},
42 \textsl{Rhodamine},
43 \textsl{Mulberry},
44 \textsl{RedViolet},
45 \textsl{Fuchsia},
46 \textsl{Lavender},
47 \textsl{Thistle},
48 \textsl{Orchid},
49 \textsl{DarkOrchid},
50 \textsl{Purple},
51 \textsl{Plum},
52 \textsl{Violet},
53 \textsl{RoyalPurple},
54 \textsl{BlueViolet},
55 \textsl{Periwinkle},
56 \textsl{CadetBlue},
57 \textsl{CornflowerBlue},
58 \textsl{MidnightBlue},
59 \textsl{NavyBlue},
60 \textsl{RoyalBlue},
61 \textsl{Blue},
62 \textsl{Cerulean},
63 \textsl{Cyan},
64 \textsl{ProcessBlue},
65 \textsl{SkyBlue},
66 \textsl{Turquoise},
67 \textsl{TealBlue},
68 \textsl{Aquamarine},
69 \textsl{BlueGreen},
70 \textsl{Emerald},
71 \textsl{JungleGreen},
72 \textsl{SeaGreen},
73 \textsl{Green},
74 \textsl{ForestGreen},
75 \textsl{PineGreen},
76 \textsl{LimeGreen},
77 \textsl{YellowGreen},
78 \textsl{SpringGreen},
79 \textsl{OliveGreen},
80 \textsl{RawSienna},
81 \textsl{Sepia},
82 \textsl{Brown},
83 \textsl{Tan},
84 \textsl{Gray},
85 \textsl{Black},
86 \textsl{White}.
87 The list of these $68$ colours is available in the command
88 \verb+\colorfaces+ (see an example in the section about
89 the grating  of a cube).
90
91 Thinking on that case, the number of the faces
92 $\mathtt{n_1\times n_2}+2\texttt{(outer faces  inner faces)}$
93 must be lower than 68!
94
95 However users can define their own \Index{colours}. There are two methods:
96
97 \begin{compactitem}
98 \item They can use one of the $4$~optional arguments  \texttt{color1},
99   \texttt{color2}, \texttt{color3}, \texttt{color4} from
100   \Lcs{psSolid}, then transmit to \Lkeyword{fcol} a pair of the type
101   $i$~\verb+(color1)+, where $i$ is the index of the chosen face. The
102   arguments \texttt{color1}, etc.  are used in the same way as the
103   arguments from \Lkeyword{color} and \Lkeyword{incolor}.\hfill \break
104   A possible command could be the following:
105   \begin{verbatim}
106    \psSolid[a=1,object=cube,color1=red!60!yellow!20,fcol=0 (color1)]%
107   \end{verbatim}
108 \item They define their own colour names with the command
109   \verb+\pstVerb+, and then use these names with the argument
110   \Lkeyword{fcol}. For example:
111 \begin{verbatim}
112 \pstVerb{/hetre {0.764 0.6 0.204 setrgbcolor} def
113          /chene {0.568 0.427 0.086 setrgbcolor} def
114          /cheneclair {0.956 0.921 0.65 setrgbcolor} def
115          }%
116 \end{verbatim}
117 And therefore:
118 \begin{verbatim}
119 fcol=0 (hetre) 1 (chene)  2 (cheneclair)
120 \end{verbatim}
121 \end{compactitem}
122
123
124 The $4$~arguments
125 \verb+color1+,
126 \verb+color2+,
127 \verb+color3+,
128 \verb+color4+ have default values:
129 \begin{compactitem}
130     \item \textcolor{cyan!50}{color1=cyan!50}
131     \item \textcolor{magenta!60}{color2=magenta!60}
132     \item \textcolor{blue!30}{color3=blue!30}
133     \item \textcolor{red!50}{color4=red!50}
134 \end{compactitem}
135
136
137
138
139 \begin{LTXexample}[width=5cm]
140 \psset{Decran=20,viewpoint=10 5 10,unit=0.5}
141 \begin{pspicture}(-5,-5)(5,5)
142 \psSolid[
143    fcol=0 (Apricot) 1 (Aquamarine)  2 (Bittersweet)
144         3 (ForestGreen) 4 (Goldenrod)
145         13 (GreenYellow)
146         40 (Mulberry),
147    object=cube,mode=3]%
148 \end{pspicture}
149 \end{LTXexample}
150
151 \begin{LTXexample}[width=4.9cm]
152 \psset{Decran=20,viewpoint=10 5 10,unit=0.5}
153 \begin{pspicture}(-5,-5)(5,5)
154 \psSolid[
155    fcol=0 (Apricot) 2 (Lavender) 3 (SkyBlue)  11 (LimeGreen) 12 (OliveGreen),
156    object=cylindre,
157    h=4,
158    ngrid=4 10](0,0,-2)
159 \end{pspicture}
160 \end{LTXexample}
161
162 The choice of the faces to be coloured can be specified with some PostScript code,
163 \begin{verbatim}
164 fcol=48 {i (Black) i 1 add (LimeGreen) i 2 add (Yellow) /i i 3 add store} repeat
165 \end{verbatim}
166 which will alternately colour the faces in black, green and yellow.
167 \begin{center}
168 \begin{LTXexample}[width=6.5cm]
169 \begin{pspicture}(-3,-3)(3.5,2.5)
170 \psset{Decran=7.5,viewpoint=10 10 5}
171 \pstVerb{/iface 0 store}%
172 \psSolid[
173 fcol=48 {iface (Black)
174   iface 1 add (LimeGreen)
175   iface 2 add (Yellow) /iface
176   iface 3 add store} repeat,
177   r1=4,r0=1,
178   object=tore,
179   ngrid=8 18,
180   RotY=30]
181 \end{pspicture}
182 \end{LTXexample}
183 \end{center}
184
185 When the option \Lkeyword{hue} is activated, the faces of the solid are coloured with the nuance of the rainbow colours.
186
187 \begin{LTXexample}[width=5.9cm]
188 \begin{pspicture}(-3,-2.5)(3,2.5)
189 \psset[pst-solides3d]{viewpoint=50 50 50,Decran=40,lightsrc=50 20 1e2}
190 \psSolid[r1=5,r0=1,object=tore,ngrid=16 18,hue=0 1]%
191 \end{pspicture}
192 \end{LTXexample}
193
194 \endinput

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.