summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pst-solides3d/src/text/par-definitionmaillage-en.tex
blob: 0649345a7a176ca125d5670203cd800bcf4fed4a (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
\section{Definition of grating}

The user can specify the \Index{grating} of the solid with the option
\Lkeyword{ngrid} within the command \Lcs{psSolid}.

For the objects
\Lkeyval{cube},
\Lkeyval{prisme},
\Lkeyval{prismecreux},
the syntax is \Lkeyword{ngrid}=$n_1$ where $n_1$ represents the number of vertical \Index{gridlines}.

For the objects
\Lkeyval{cylindre},
\Lkeyval{cylindrecreux},
\Lkeyval{cone},
\Lkeyval{conecreux},
\Lkeyval{tronccone},
\Lkeyval{troncconecreux},
%%\verb+tore+,
the syntax is \texttt{\Lkeyword{ngrid}=$n_1$~$n_2$} where $n_1$ is an integer greater or equal
to  1 ($2$ for \Lkeyval{tore}) representing the number of the vertical gridlines, and $n_2$ is an integer
representing the number of divisions on the circle.

For the object
\Lkeyval{sphere},
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
$n_2$ is an integer representing the number of divisions on the circle
horizontally.

For the object
\Lkeyval{tore},
the syntax is \texttt{\Lkeyword{ngrid}=$n_1$~$n_2$} where $n_1$ and $n_2$
are integers.

Here are some examples:

\subsection{The cube}

\begin{center}
\psset{unit=0.4}
\begin{pspicture}(-7,-7)(7,7)
%\psframe(-7,-7)(7,7)
\psset[pst-solides3d]{viewpoint=50 40 20,Decran=50,lightsrc=10 10 10}
\psSolid[a=8,object=cube,ngrid=4,fillcolor=yellow]%
%\psSolid[a=8,object=cube,linewidth=2pt,action=draw]%
\psPoint(0,0,0){O}
%\uput[r](O){$O$}
\psPoint(0,0,4){Ak}
\psPoint(0,0,8){Az}
\uput[u](Az){$z$}
\psPoint(4,0,0){Ai}
\psPoint(8,0,0){Ax}
\uput[u](Ax){$x$}
\psPoint(0,4,0){Aj}
\psPoint(0,8,0){Ay}
\uput[dr](Ay){$y$}
\psPoint(4,-4,0){A1}
\psPoint(4,4,0){A2}
\psPoint(-4,4,0){A3}
\psPoint(-4,-4,0){A4}
\uput[dr](Ay){$y$}
%\psline[linestyle=dashed](O)(Ai)
%\psline[linestyle=dashed](O)(Aj)
%\psline[linestyle=dashed](O)(Ak)
\psline[linecolor=green,arrowsize=2mm,arrowinset=0.2]{->}(Aj)(Ay)
\psline[linecolor=blue,arrowsize=2mm,arrowinset=0.2]{->}(Ai)(Ax)
\psline[linecolor=red,arrowsize=2mm,arrowinset=0.2]{->}(Ak)(Az)
\psdot[linecolor=green](Aj)
\psdot[linecolor=blue](Ai)
\psdot[linecolor=red](Ak)
\end{pspicture}
\hfill
\begin{pspicture}(-7,-7)(7,7)
%\psframe(-7,-7)(7,7)
\psset[pst-solides3d]{viewpoint=50 45 10 rtp2xyz,Decran=40,lightsrc=30 45 0}
\psSolid[a=8,object=cube,ngrid=3,fcol=\colorfaces,RotY=45,RotX=30,RotZ=20]%
\end{pspicture}
\end{center}


For the first example, the grid is fixed to $4\times4$
facettes/faces and the command is the following:
\begin{verbatim}
\psSolid[a=8,object=cube,ngrid=4,fillcolor=yellow]%
\end{verbatim}
In the second example, the face grid is set to $3\times3$
and the colours of the faces are different.
We use the package
\texttt{arrayjob} to easily save the colours:
\begin{verbatim}
\newarray\colors
\readarray{colors}{%
    Apricot&Aquamarine%
    etc.}
\end{verbatim}
The list of the colours is given by the command:
\begin{verbatim}
\edef\colorfaces{}%
\multido{\i=0+1}{67}{%
    \checkcolors(\i)
    \xdef\colorfaces{%
    \colorfaces\i\space(\cachedata)\space}
     }
\end{verbatim}
One sets up:~\Lkeyword{fcol}\verb+=\colorfaces+.
The gridded cube now is called with:
\begin{verbatim}
\psSolid[a=8,object=cube,ngrid=3,%
        fcol=\colorfaces,
        RotY=45,RotX=30,RotZ=20]%
\end{verbatim}
The option \Lkeyword{grid} suppresses the drawing of the gridlines.


\subsection{Sphere}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
\psset{color1=cyan,color2=red}
\psSolid[
   fcol=251 (OliveGreen) 232 (color1) 214 (color2),
   object=sphere,
   ngrid=16 18,
   RotX=180,RotZ=30]%
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-3)(3,3)
\psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
\psset{color1=cyan,color2=red}
\psSolid[
   action=draw*,
   fcol=0 (OliveGreen) 2 (color1) 3 (color2),
   object=sphere,
   ngrid=4 4,
   RotX=180,RotZ=30]%
\end{pspicture}
\end{LTXexample}

\subsection{Cylinders}

\begin{LTXexample}[width=6cm]

\begin{pspicture}(-3,-4)(3,4)
\psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
\psset{color1=cyan,color2=red}
\psSolid[
   fcol=0 (OliveGreen) 2 (color1) 3 (color2),
   h=5,r=2,
   object=cylindrecreux,
   ngrid=4 30,
   RotZ=30
](0,0,-2.5)
\end{pspicture}
\end{LTXexample}
%
\begin{LTXexample}[width=7cm]
\begin{pspicture}(-3,-4)(4,4)
\psset{viewpoint=50 50 20 rtp2xyz,Decran=50,lightsrc=viewpoint}
\psset{color1=cyan,color2=red}
\psSolid[
   action=draw*,
   fcol=0 (OliveGreen) 2 (color1) 3 (color2),
   h=5,r=2,
   object=cylindre,
   ngrid=2 12,
   RotY=-20
](0,0,-2.5)
\end{pspicture}
\end{LTXexample}



\subsection{Torus}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-2)(3,2)
\psset{viewpoint=50 50 30 rtp2xyz,Decran=25,lightsrc=viewpoint}
\psSolid[r1=2.5,r0=1.5,
    object=tore,
    ngrid=4 36,
    fillcolor=green!30,
    action=draw**]%
\axesIIID(4,4,0)(5,5,4)
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[width=6cm]
\begin{pspicture}(-3,-2)(3,2)
\psset{viewpoint=50 50 30 rtp2xyz,Decran=25,lightsrc=viewpoint}
\psSolid[r1=3.5,r0=1,
    object=tore,
    ngrid=9 18,
    fillcolor=magenta!30,
    action=draw**]%
\axesIIID(4.5,4.5,0)(5,5,4)
\end{pspicture}
\end{LTXexample}

\endinput