1 \section{Generalization of the notion of a cylinder and a cone
}
3 \subsection{Cylinder or
\Index{cylindric area
}}
5 This paragraph generalizes the notion of a cylinder, or a cylindric
6 area
\footnote{This was written by
7 Maxime
\textsc{Chupin
}, as a result of a question on the list
8 \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse
}}.
9 A
\textit{routing
} curve has to be defined by a function and the
10 direction of the
\textit{cylinder
} axis needs to be arranged. In
11 the example below the routing curve is sinusoidal, situated in the plane $z=-
2$:
13 \defFunction[algebraic
]{G1
}(t)
{t
}{2*sin(t)
}{-
2}
15 The direction of the cylinder is defined by the components of a vector
16 \texttt{\Lkeyword{axe
}=
0 1 1}. The drawing calls
\Lkeyword{object
}=
\Lkeyval{cylindre
} which
17 in addition to the usual parameters---which is the height
\texttt{\Lkeyword{h
}=
4}---
18 is about the
\textbf{length of the generator
} and not of the distance
19 between the two base planes, and needs to define the routing curve
20 \texttt{\Lkeyword{function
}=G1
} and the interval of the variable $t$
\texttt{\Lkeyword{range
}=-
3 3}.
23 \psSolid[object=cylindre,
35 \begin{pspicture
}(-
5,-
4)(
5,
4)
36 \psset{lightsrc=viewpoint,viewpoint=
100 10 20 rtp2xyz,Decran=
100}
37 \psSolid[object=grille,base=-
4 4 -
6 6,linecolor=
{[rgb
]{0.72 0.72 0.5}},action=draw
](
0,
0,-
2)
38 \defFunction[algebraic
]{G1
}(t)
{t
}{2*sin(t)
}{-
2}
39 \defFunction[algebraic
]{G2
}(t)
{t
}{2*sin(t)+
4}{2}
40 \psSolid[object=courbe,function=G1,
44 \psSolid[object=cylindre,
45 h=
5.65685,function=G1,
51 \psSolid[object=courbe,function=G2,
55 \psSolid[object=parallelepiped,
56 a=
8,b=
12,c=
4,action=draw
](
0,
0,
0)
57 \psSolid[object=plan,action=draw,
60 base=-
6 6 -
4 4,planmarks,showBase
]
61 \psSolid[object=plan,action=draw,
63 args=
{[0 1 0 -
6] 180},
64 base=-
4 4 -
2 2,planmarks,showBase
]
65 \psSolid[object=plan,action=draw,
68 base=-
6 6 -
2 2,planmarks,showBase
]
69 \psSolid[object=vecteur,
75 In the following example, before drawing the horizontal planes, we calculate the
76 distance between these two planes.
79 \pstVerb{/ladistance
2 sqrt
2 mul def
}
82 {\psset{unit=
0.75,lightsrc=viewpoint,viewpoint=
100 -
10 20 rtp2xyz,Decran=
100}
83 \begin{LTXexample
}[pos=t
]
84 \begin{pspicture
}(-
1.5,-
3)(
6.5,
6)
85 \psSolid[object=grille,base=-
3 3 -
1 8,action=draw
]
86 \pstVerb{/ladistance
2 sqrt
2 mul def
}
87 \defFunction[algebraic
]{G3
}(t)
{6*(cos(t))^
3*sin(t)
}{4*(cos(t))^
2}{0}
88 \defFunction[algebraic
]{G4
}(t)
{6*(cos(t))^
3*sin(t)
}{4*(cos(t))^
2+ladistance
}{ladistance
}
89 \psSolid[object=courbe,function=G3,range=
0 6.28,r=
0,linecolor=blue,linewidth=
2pt
]
90 \psSolid[object=cylindre,range=
0 -
6.28,h=
4,function=G3,axe=
0 1 1,ngrid=
3 36,
91 fillcolor=green!
50,incolor=yellow!
50]
92 \psSolid[object=courbe,function=G4,range=
0 6.28,r=
0,linecolor=blue,linewidth=
2pt
]
93 \psSolid[object=vecteur,linecolor=red,args=
0 ladistance dup
]
94 \psSolid[object=plan,action=draw,definition=equation,args=
{[0 0 1 ladistance neg
] 90},
95 base=-
1 8 -
3 3,planmarks,showBase
]
96 \axesIIID(
0,
4.5,
0)(
4,
8,
5)
97 \rput(
0,-
3)
{\texttt{axe=
0 1 1}}
102 \begin{LTXexample
}[width=
8cm
]
103 \psset{unit=
0.75,lightsrc=viewpoint,
104 viewpoint=
100 -
10 20 rtp2xyz,Decran=
100}
105 \begin{pspicture
}(-
1.5,-
3)(
6.5,
6)
106 \psSolid[object=grille,base=-
3 3 -
1 6,action=draw
]
107 \defFunction[algebraic
]{G5
}(t)
109 \defFunction[algebraic
]{G6
}(t)
111 \psSolid[object=courbe,function=G5,
112 range=-
3 2,r=
0,linecolor=blue,
114 \psSolid[object=cylindre,
117 axe=
0 0 1,
%% valeur par d\'{e}faut
121 \psSolid[object=courbe,function=G6,
122 range=-
3 2,r=
0,linecolor=blue,
124 \axesIIID(
0,
4.5,
0)(
4,
6,
5)
125 \psSolid[object=vecteur,
126 linecolor=red,args=
0 0 4]
127 \psSolid[object=plan,action=draw,
129 args=
{[0 0 1 -
4] 90},
130 base=-
1 6 -
3 3,planmarks,showBase
]
134 \begin{LTXexample
}[width=
8cm
]
135 \psset{unit=
0.75,lightsrc=viewpoint,
136 viewpoint=
100 -
10 20 rtp2xyz,Decran=
100}
137 \begin{pspicture
}(-
3.5,-
3)(
6.5,
6)
138 \psset{lightsrc=viewpoint,viewpoint=
100 45 45,Decran=
100}
139 \psSolid[object=grille,base=-
3 3 -
2 7,fillcolor=gray!
30]
140 \defFunction[algebraic
]{G7
}(t)
141 {2*cos(t)
}{2*sin(t)
}{0}
142 \defFunction[algebraic
]{G8
}(t)
143 {2*cos(t)
}{2*sin(t)+
4}{4}
144 \psSolid[object=courbe,function=G7,
146 linecolor=blue,linewidth=
2pt
]
147 \psSolid[object=cylindre,
148 range=
0 6.28,h=
5.65685,
149 function=G7,axe=
0 1 1,
153 \psSolid[object=courbe,function=G8,
154 range=
0 6.28,r=
0,linecolor=blue,
156 \axesIIID(
2,
4.5,
2)(
4,
8,
5)
157 \psSolid[object=vecteur,
158 linecolor=red,args=
0 1 1](
0,
4,
4)
159 \psSolid[object=plan,action=draw,
161 args=
{[0 0 1 -
4] 90},
162 base=-
2 7 -
3 3,planmarks,showBase
]
167 \encadre{The routing curve can be any curve and need not necessarily be a plane horizontal.
}
169 \begin{LTXexample
}[width=
8cm
]
170 \begin{pspicture
}(-
3.5,-
2)(
4,
5)
171 \psset{unit=
0.75,lightsrc=viewpoint,viewpoint=
100 -
5 10 rtp2xyz,Decran=
100}
172 \psSolid[object=grille,base=-
4 4 -
4 4,ngrid=
8.
8.
](
0,
0,-
1)
173 \defFunction[algebraic
]{G9
}(t)
174 {3*cos(t)
}{3*sin(t)
}{1*cos(
5*t)
}
175 \psSolid[object=cylindre,
176 range=
0 6.28,h=
5,function=G9,
177 axe=
0 0 1,incolor=green!
50,
183 \subsection{Cone or
\Index{conic area
}}
184 This paragraph generalizes the notion of a cone, or a conic
185 area
\footnote{This was written by
186 Maxime
\textsc{Chupin
}, as the result of a question on the list
187 \url{http://melusine.eu.org/cgi-bin/mailman/listinfo/syracuse
}}.
188 A
\textit{routing
} curve needs to be defined by a function which
189 defines the base of the cone, and the vertex of the
\textit{cone
}
190 which is by default
\texttt{\Lkeyword{origine
}=
0 0 0}. The parts above and
191 below the cone are symmetric concerning the vertice. In the example
192 below, the routing curve is a parabolic arc, situated in the plane $z=-
2$.
194 \begin{LTXexample
}[width=
7.5cm
]
195 \begin{pspicture
}(-
3,-
4)(
4.5,
6)
196 \psset{unit=
0.75,lightsrc=viewpoint,viewpoint=
100 10 10 rtp2xyz,Decran=
100}
197 \psSolid[object=grille,base=-
4 4 -
3 3,action=draw
](
0,
0,-
2)
198 \defFunction[algebraic
]{G1
}(t)
{t
}{0.25*t^
2}{-
2}
199 \defFunction[algebraic
]{G2
}(t)
{-t
}{-
0.25*t^
2}{2}
200 \psSolid[object=courbe,function=G1,
202 linecolor=blue,linewidth=
2pt
]
203 \psSolid[object=cone,function=G1,
204 range=-
3.46 3,ngrid=
3 16,
208 \psSolid[object=courbe,
209 function=G2,range=-
3.46 3,
213 \uput[l
](I)
{\red$(
0,
0,
0)$
}
214 \psdot[linecolor=red
](I)
215 \gridIIID[Zmin=-
2,Zmax=
2,spotX=r
](-
4,
4)(-
3,
3)
219 \begin{LTXexample
}[width=
7.5cm
]
220 \begin{pspicture
}(-
3,-
4)(
4.5,
6)
221 \psset{unit=
0.7,lightsrc=viewpoint,viewpoint=
100 -
10 20 rtp2xyz,Decran=
100}
222 \psSolid[object=grille,base=-
4 4 -
3 3,
223 linecolor=
{[rgb
]{0.72 0.72 0.5}},action=draw
](
0,
0,-
2)
224 \defFunction[algebraic
]{G1
}(t)
{t
}{2*sin(t)
}{-
2}
225 \defFunction[algebraic
]{G2
}(t)
{-t
}{-
2*sin(t)
}{2}
226 \psSolid[object=courbe,function=G1,
227 range=-
3.14 3.14,r=
0,
230 \psSolid[object=cone,function=G1,
231 range=-
3.14 3.14,ngrid=
3 16,
235 \psSolid[object=courbe,
236 function=G2,range=-
3.14 3.14,
239 \psPoint(
0,
0,
0)
{I
} \uput[l
](I)
{\red$(
0,
0,
0)$
}
240 \psdot[linecolor=red
](I)
241 \gridIIID[Zmin=-
2,Zmax=
2,spotX=r
](-
4,
4)(-
3,
3)
245 \begin{LTXexample
}[width=
7.5cm
]
246 \begin{pspicture
}(-
3,-
4)(
4.5,
6)
247 \psset{unit=
0.7,lightsrc=viewpoint,viewpoint=
100 -
10 20 rtp2xyz,Decran=
100}
248 \psSolid[object=grille,base=-
4 4 -
4 4,linecolor=
{[rgb
]{0.72 0.72 0.5}},action=draw
](
0,
0,-
2)
249 \defFunction[algebraic
]{G1
}(t)
{t
}{2*sin(t)
}{-
2}
250 \defFunction[algebraic
]{G2
}(t)
{-t
}{-
2*sin(t)-
2}{2}
251 \psSolid[object=courbe,function=G1,
252 range=-
3.14 3.14,r=
0,
255 \psSolid[object=cone,
256 function=G1,range=-
3.14 3.14,
257 ngrid=
3 16,incolor=green!
50,
260 \psSolid[object=courbe,
261 function=G2,range=-
3.14 3.14,
264 \psPoint(
0,-
1,
0)
{I
}\uput[l
](I)
{\red$(
0,-
1,
0)$
}
265 \psdot[linecolor=red
](I)
266 \gridIIID[Zmin=-
2,Zmax=
2,spotX=r
](-
4,
4)(-
4,
4)
270 \encadre{For the cones as well, the routing curve can be any curve and need not necessarily
271 be a plane horizontal curve, as the following example, written by Maxime
272 \textsc{Chupin
}, will show.
}
274 \centerline{\url{http://melusine.eu.org/lab/bpst/pst-solides3d/cone/cone-dir_02.pst
}}