Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-definitionmaillage-en.tex.svn-base
1 \section{Definition of grating}
2
3 The user can specify the \Index{grating} of the solid with the option
4 \Lkeyword{ngrid} within the command \Lcs{psSolid}.
5
6 For the objects
7 \Lkeyval{cube},
8 \Lkeyval{prisme},
9 \Lkeyval{prismecreux},
10 the syntax is \Lkeyword{ngrid}=$n_1$ where $n_1$ represents the number of vertical \Index{gridlines}.
11
12 For the objects
13 \Lkeyval{cylindre},
14 \Lkeyval{cylindrecreux},
15 \Lkeyval{cone},
16 \Lkeyval{conecreux},
17 \Lkeyval{tronccone},
18 \Lkeyval{troncconecreux},
19 %%\verb+tore+,
20 the syntax is \texttt{\Lkeyword{ngrid}=$n_1$~$n_2$} where $n_1$ is an integer greater or equal
21 to  1 ($2$ for \Lkeyval{tore}) representing the number of the vertical gridlines, and $n_2$ is an integer
22 representing the number of divisions on the circle.
23
24 For the object
25 \Lkeyval{sphere},
26 the syntax is \texttt{\Lkeyword{ngrid}=$n_1$~$n_2$} where $n_1$ is an integer, representing the number of divisions on the vertical axis, and
27 $n_2$ is an integer representing the number of divisions on the circle
28 horizontally.
29
30 For the object
31 \Lkeyval{tore},
32 the syntax is \texttt{\Lkeyword{ngrid}=$n_1$~$n_2$} where $n_1$ and $n_2$
33 are integers.
34
35 Here are some examples:
36
37 \subsection{The cube}
38
39 \begin{center}
40 \psset{unit=0.4}
41 \begin{pspicture}(-7,-7)(7,7)
42 %\psframe(-7,-7)(7,7)
43 \psset[pst-solides3d]{viewpoint=50 40 20,Decran=50,lightsrc=10 10 10}
44 \psSolid[a=8,object=cube,ngrid=4,fillcolor=yellow]%
45 %\psSolid[a=8,object=cube,linewidth=2pt,action=draw]%
46 \psPoint(0,0,0){O}
47 %\uput[r](O){$O$}
48 \psPoint(0,0,4){Ak}
49 \psPoint(0,0,8){Az}
50 \uput[u](Az){$z$}
51 \psPoint(4,0,0){Ai}
52 \psPoint(8,0,0){Ax}
53 \uput[u](Ax){$x$}
54 \psPoint(0,4,0){Aj}
55 \psPoint(0,8,0){Ay}
56 \uput[dr](Ay){$y$}
57 \psPoint(4,-4,0){A1}
58 \psPoint(4,4,0){A2}
59 \psPoint(-4,4,0){A3}
60 \psPoint(-4,-4,0){A4}
61 \uput[dr](Ay){$y$}
62 %\psline[linestyle=dashed](O)(Ai)
63 %\psline[linestyle=dashed](O)(Aj)
64 %\psline[linestyle=dashed](O)(Ak)
65 \psline[linecolor=green,arrowsize=2mm,arrowinset=0.2]{->}(Aj)(Ay)
66 \psline[linecolor=blue,arrowsize=2mm,arrowinset=0.2]{->}(Ai)(Ax)
67 \psline[linecolor=red,arrowsize=2mm,arrowinset=0.2]{->}(Ak)(Az)
68 \psdot[linecolor=green](Aj)
69 \psdot[linecolor=blue](Ai)
70 \psdot[linecolor=red](Ak)
71 \end{pspicture}
72 \hfill
73 \begin{pspicture}(-7,-7)(7,7)
74 %\psframe(-7,-7)(7,7)
75 \psset[pst-solides3d]{viewpoint=50 45 10 rtp2xyz,Decran=40,lightsrc=30 45 0}
76 \psSolid[a=8,object=cube,ngrid=3,fcol=\colorfaces,RotY=45,RotX=30,RotZ=20]%
77 \end{pspicture}
78 \end{center}
79
80
81 For the first example, the grid is fixed to $4\times4$
82 facettes/faces and the command is the following:
83 \begin{verbatim}
84 \psSolid[a=8,object=cube,ngrid=4,fillcolor=yellow]%
85 \end{verbatim}
86 In the second example, the face grid is set to $3\times3$
87 and the colours of the faces are different.
88 We use the package
89 \texttt{arrayjob} to easily save the colours:
90 \begin{verbatim}
91 \newarray\colors
92 \readarray{colors}{%
93     Apricot&Aquamarine%
94     etc.}
95 \end{verbatim}
96 The list of the colours is given by the command:
97 \begin{verbatim}
98 \edef\colorfaces{}%
99 \multido{\i=0+1}{67}{%
100     \checkcolors(\i)
101     \xdef\colorfaces{%
102     \colorfaces\i\space(\cachedata)\space}
103      }
104 \end{verbatim}
105 One sets up:~\Lkeyword{fcol}\verb+=\colorfaces+.
106 The gridded cube now is called with:
107 \begin{verbatim}
108 \psSolid[a=8,object=cube,ngrid=3,%
109         fcol=\colorfaces,
110         RotY=45,RotX=30,RotZ=20]%
111 \end{verbatim}
112 The option \Lkeyword{grid} suppresses the drawing of the gridlines.
113
114
115 \subsection{Sphere}
116
117 \begin{LTXexample}[width=6cm]
118 \begin{pspicture}(-3,-3)(3,3)
119 \psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
120 \psset{color1=cyan,color2=red}
121 \psSolid[
122    fcol=251 (OliveGreen) 232 (color1) 214 (color2),
123    object=sphere,
124    ngrid=16 18,
125    RotX=180,RotZ=30]%
126 \end{pspicture}
127 \end{LTXexample}
128
129 \begin{LTXexample}[width=6cm]
130 \begin{pspicture}(-3,-3)(3,3)
131 \psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
132 \psset{color1=cyan,color2=red}
133 \psSolid[
134    action=draw*,
135    fcol=0 (OliveGreen) 2 (color1) 3 (color2),
136    object=sphere,
137    ngrid=4 4,
138    RotX=180,RotZ=30]%
139 \end{pspicture}
140 \end{LTXexample}
141
142 \subsection{Cylinders}
143
144 \begin{LTXexample}[width=6cm]
145
146 \begin{pspicture}(-3,-4)(3,4)
147 \psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
148 \psset{color1=cyan,color2=red}
149 \psSolid[
150    fcol=0 (OliveGreen) 2 (color1) 3 (color2),
151    h=5,r=2,
152    object=cylindrecreux,
153    ngrid=4 30,
154    RotZ=30
155 ](0,0,-2.5)
156 \end{pspicture}
157 \end{LTXexample}
158 %
159 \begin{LTXexample}[width=7cm]
160 \begin{pspicture}(-3,-4)(4,4)
161 \psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
162 \psset{color1=cyan,color2=red}
163 \psSolid[
164    action=draw*,
165    fcol=0 (OliveGreen) 2 (color1) 3 (color2),
166    h=5,r=2,
167    object=cylindre,
168    ngrid=2 12,
169    RotY=-20
170 ](0,0,-2.5)
171 \end{pspicture}
172 \end{LTXexample}
173
174
175
176 \subsection{Torus}
177
178 \begin{LTXexample}[width=6cm]
179 \begin{pspicture}(-3,-2)(3,2)
180 \psset{viewpoint=50 50 30 rtp2xyz,Decran=25,lightsrc=viewpoint}
181 \psSolid[r1=2.5,r0=1.5,
182     object=tore,
183     ngrid=4 36,
184     fillcolor=green!30,
185     action=draw**]%
186 \axesIIID(4,4,0)(5,5,4)
187 \end{pspicture}
188 \end{LTXexample}
189
190 \begin{LTXexample}[width=6cm]
191 \begin{pspicture}(-3,-2)(3,2)
192 \psset{viewpoint=50 50 30 rtp2xyz,Decran=25,lightsrc=viewpoint}
193 \psSolid[r1=3.5,r0=1,
194     object=tore,
195     ngrid=9 18,
196     fillcolor=magenta!30,
197     action=draw**]%
198 \axesIIID(4.5,4.5,0)(5,5,4)
199 \end{pspicture}
200 \end{LTXexample}
201
202 \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.