Initialisation du projet pst-solides3d.git (SVN revision 142)
[pst-solides3d.git] / doc-en / .svn / text-base / par-prisme-en.tex.svn-base
1 \section{The \Index{prism}}
2
3 A prism is determined by two parameters:
4 \begin{itemize}
5         \item The base of the prism can be defined by the coordinates of the vertices
6         in the $xy$-plane.  Note that it is necessary that the four
7         vertices be given in counterclockwise order with respect to the barycentre of
8         the base;
9         \item the direction of the prism axis (the components of the shearing vector).
10 \end{itemize}
11
12
13 \subsubsection{Example 1: a right and \Index{oblique prisms} with polygonal section}
14
15 \begin{center}
16 \psset{unit=0.5}
17 \psset{lightsrc=10 5 50,viewpoint=50 20 30 rtp2xyz,,Decran=50}
18 \begin{minipage}{5cm}
19 \begin{pspicture*}(-6,-4)(6,9)
20 \psframe(-6,-4)(6,9)
21 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
22 \psSolid[object=prisme,h=6,base=0 1 -1 0 0 -2 1 -1 0 0]%
23  \axesIIID(4,4,6)(4.5,4.5,8)
24 \end{pspicture*}
25
26 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 1 -1 0 0 -2 1 -1 0 0}},h=6]}
27 \\
28 \end{minipage}
29 \hspace{2cm}
30 \begin{minipage}{5cm}
31 \begin{pspicture*}(-6,-4)(6,9)
32 \psframe(-6,-4)(6,9)
33 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
34 \psSolid[object=prisme,axe=0 1 2,h=8,base=0 -2 1 -1 0 0 0 1 -1 0]%
35  \axesIIID(4,4,4)(4.5,4.5,8)
36 \psPoint(0,4,8){V}
37 \psPoint(0,4,0){Vy}
38 \psPoint(0,0,8){Vz}
39 \uput[l](Vz){8}
40 \uput[ur](Vy){4}
41 \psline[linecolor=blue]{->}(O)(V)
42 \psline[linestyle=dashed](Vz)(V)(Vy)
43 \end{pspicture*}
44
45 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 -2 1 -1 0 0 0 1 -1 0}},}%
46 \\
47  \texttt{ axe=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 4 8}},h=8]}
48 \end{minipage}
49 \end{center}
50
51
52
53 \subsubsection{Example 2: a \Index{right prism} with cross-section a rounded square}
54
55 \begin{LTXexample}[width=6.5cm]
56 \psset{unit=0.5cm}
57 \psset{lightsrc=10 -20 50,viewpoint=50 -20 30 rtp2xyz,Decran=50}
58 \begin{pspicture}(-5,-4)(3,9)
59 \psSolid[object=grille,base=-4 4 -4 4,action=draw]
60 \psSolid[object=prisme,h=6,fillcolor=yellow,
61  base=
62     0 10 90 {/i exch def i cos 1 add i sin 1 add } for
63    90 10 180 {/i exch def i cos 1 sub i sin 1 add} for
64   180 10 270 {/i exch def i cos 1 sub i sin 1 sub} for
65   270 10 360 {/i exch def i cos 1 add i sin 1 sub} for]
66 \axesIIID(4,4,6)(6,6,8)
67 \end{pspicture}
68 \end{LTXexample}
69
70
71 \subsubsection{Example 4: a prism with an elliptic section}
72
73 \psResetSolidKeys
74 \begin{LTXexample}[width=6.5cm]
75 \psset{unit=0.5cm}
76 \begin{pspicture}(-6,-5)(4,12)
77 \psset{lightsrc=10 20 30,viewpoint=50 20 25 rtp2xyz,Decran=50}
78 \psSolid[object=grille,base=-6 6 -4 4,action=draw]
79 \defFunction{FuncI}(t){t cos 4 mul}{t sin 2 mul}{}
80 \psSolid[object=prisme,h=8,fillcolor=green!20,
81        base=0 350 {FuncI} CourbeR2+]%
82 \defFunction{FuncII}(t){t cos 4 mul}{t sin 2 mul}{8}
83 \psSolid[object=courbe,r=0,
84    function=FuncII,range=0 360,
85    linewidth=2\pslinewidth,
86    linecolor=green]
87 \axesIIID(6,4,8)(8,6,10)
88 \end{pspicture}
89 \end{LTXexample}
90
91 \psset{unit=1cm}
92
93 \subsubsection{Example 3: a right prism with a star-shaped section}
94
95 \begin{LTXexample}[width=6.5cm]
96 \psset{unit=0.5cm}
97 \psset{lightsrc=10 -20 50,viewpoint=50 -20 30 rtp2xyz,Decran=50}
98 \begin{pspicture*}(-5,-4)(6,9)
99 \defFunction{F}(t){3 t cos 3 exp mul}{3 t sin 3 exp mul}{}
100 \psSolid[object=grille,base=-4 4 -4 4,action=draw]%
101 \psSolid[object=prismecreux,h=8,fillcolor=red!50,
102        resolution=36,
103        base=0 350 {F} CourbeR2+
104       ]%
105 \end{pspicture*}
106 \end{LTXexample}
107
108
109
110 \clearpage
111 \subsubsection{Example 5: a \Index{roof gutter} with a semi-circular section}
112
113 \begin{LTXexample}[width=7cm]
114 \psset{unit=0.35cm}
115 \psset{lightsrc=10 20 30,viewpoint=50 30 25 rtp2xyz,Decran=50}
116 \begin{pspicture}(-10,-5)(6,10)
117 \defFunction[algebraic]{F}(t)
118   {3*cos(t)}{3*sin(t)}{}
119 \defFunction[algebraic]{G}(t)
120   {2.5*cos(t)}{2.5*sin(t)}{}
121 \psSolid[object=grille,
122   base=-6 6 -6 6,action=draw]%
123 \psSolid[object=prisme,h=12,
124   fillcolor=blue!30,RotX=-90,
125   resolution=19,
126   base=0 pi {F} CourbeR2+
127   pi 0 {G} CourbeR2+](0,-6,3)
128 \axesIIID(6,6,2)(8,8,8)
129 \end{pspicture}
130 \end{LTXexample}
131
132 We draw the exterior face (semicircle of radius 3~cm) in counterclockwise
133 order: \verb!0 pi {F} CourbeR2+!
134 Then the interior face (semicircle of radius  2{.}5~cm), is drawn in clockwise order:
135 \verb!pi 0 {G} CourbeR2+!
136
137 We can turn the solid $-90^{\mathrm{o}}$ and place it at the point $(0,-6,3)$.
138 If we use the \verb+algebraic+ option to define the functions $F$
139 and $G$, the functions $\sin$ and $\cos$ are in radians.
140
141 \subsubsection{The parameter \texttt{\Index{decal}}}
142
143 We wrote above that the first four vertices must be given in counterclockwise order
144 with respect to the barycentre of the vertices of the base.  In fact, this is the
145 default version of the following rule: If the base has $n+1$ vertices,
146 and if $G$ is their barycentre,
147 then $(s_0,s_1)$ on one hand and $(s_{n-1},s_n)$ on the other, should be
148 in counterclockwise order with respect to $G$.
149
150
151 This rule puts constraints on the coding of the base of a prism which
152 sometimes renders the latter unaesthetically.
153 For this reason we have introduced the argument \Lkeyword{decal} (default value$=-2$)
154 which allows us to consider the list of vertices of the base as a circular file
155 which you will shift round if needed.
156
157 An example: default behavior with \texttt{\Lkeyword{decal}=-2}:\par
158 \psset{lightsrc=10 20 30,viewpoint=50 80 35 rtp2xyz,Decran=50}
159 \begin{LTXexample}[width=6cm]
160 \psset{unit=0.5}
161 \begin{pspicture}(-6,-4)(6,7)
162 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
163 \psSolid[object=prisme,h=8,
164       fillcolor=yellow,RotX=-90,
165       num=0 1 2 3 4 5 6,
166       show=0 1 2 3 4 5 6,
167       resolution=7,
168       base=0 180 {F} CourbeR2+
169       ](0,-10,0)
170 \end{pspicture}
171 \end{LTXexample}
172
173 We see that the vertex with index~$0$ is not where we expect to find it.
174
175 We start again, but this time suppressing the renumbering: \par
176 %
177 \psset{lightsrc=10 20 30,viewpoint=50 80 35 rtp2xyz,Decran=50}
178 \begin{LTXexample}[width=6cm]
179 \psset{unit=0.5}
180 \begin{pspicture}(-6,-4)(6,7)
181 \defFunction{F}(t){t cos 3 mul}{t sin 3 mul}{}
182 \psSolid[object=prisme,h=8,
183       fillcolor=yellow,RotX=-90,
184       decal=0,
185       num=0 1 2 3 4 5 6,
186       show=0 1 2 3 4 5 6,
187       resolution=7,
188       base=0 180 {F} CourbeR2+
189       ](0,-10,0)
190 \end{pspicture}
191 \end{LTXexample}
192
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.