1 \section{The \Index{prism}}
3 A prism is determined by two parameters:
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
9 \item the direction of the prism axis (the components of the shearing vector).
13 \subsubsection{Example 1: a right and \Index{oblique prisms} with polygonal section}
17 \psset{lightsrc=10 5 50,viewpoint=50 20 30 rtp2xyz,,Decran=50}
19 \begin{pspicture*}(-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)
26 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 1 -1 0 0 -2 1 -1 0 0}},h=6]}
31 \begin{pspicture*}(-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)
41 \psline[linecolor=blue]{->}(O)(V)
42 \psline[linestyle=dashed](Vz)(V)(Vy)
45 \small\texttt{[base=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 -2 1 -1 0 0 0 1 -1 0}},}%
47 \texttt{ axe=\psframebox[fillstyle=solid,fillcolor=black]{\textcolor{white}{0 4 8}},h=8]}
53 \subsubsection{Example 2: a \Index{right prism} with cross-section a rounded square}
55 \begin{LTXexample}[width=6.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,
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)
71 \subsubsection{Example 4: a prism with an elliptic section}
74 \begin{LTXexample}[width=6.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,
87 \axesIIID(6,4,8)(8,6,10)
93 \subsubsection{Example 3: a right prism with a star-shaped section}
95 \begin{LTXexample}[width=6.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,
103 base=0 350 {F} CourbeR2+
111 \subsubsection{Example 5: a \Index{roof gutter} with a semi-circular section}
113 \begin{LTXexample}[width=7cm]
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,
126 base=0 pi {F} CourbeR2+
127 pi 0 {G} CourbeR2+](0,-6,3)
128 \axesIIID(6,6,2)(8,8,8)
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+!
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.
141 \subsubsection{The parameter \texttt{\Index{decal}}}
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$.
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.
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]
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,
168 base=0 180 {F} CourbeR2+
173 We see that the vertex with index~$0$ is not where we expect to find it.
175 We start again, but this time suppressing the renumbering: \par
177 \psset{lightsrc=10 20 30,viewpoint=50 80 35 rtp2xyz,Decran=50}
178 \begin{LTXexample}[width=6cm]
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,
188 base=0 180 {F} CourbeR2+