[pstricks] Volumes/Solids of Revolution Examples?

Hubert Lam hubert at lamfamily.info
Tue Nov 22 00:32:21 CET 2016


Hi Michael/all,

Here is the code for the cone that I showed in a previous post. It does use \psVolume but with an opacity setting :)


\newcommand{\pstEllipse}[5][]{%
\psset{#1}
\parametricplot{#4}{#5}{#2\space t cos mul #3\space t sin mul}}

\begin{center} \psset{PointName=none,PointSymbol=none,unit=1cm,arrowscale=1.55}
        \begin{pspicture}(-2,-3)(5,4)
        \pstGeonode(0,0){O}(4,0){A}(-2,0){B}(0,2.4){T}(0,-2.4){B}
        \psaxes[arrows=->,labels=none,ticks=none](0,0)(-2.5,-3)(4.75,3.5)
        \psVolume[fillcolor=blue!30,fillstyle=solid,opacity=0.4,linecolor=gray,linestyle=solid](0.6,1){4}{-0.6 x mul 2.4 add}
        \psVolume[fillcolor=green!30,fillstyle=solid,opacity=0.4,linecolor=gray,linestyle=solid](2.4,2.8){4}{-0.6 x mul 2.4 add}
        \uput{\pslabelsep}[135](T){$(0,r)$}
        \uput{\pslabelsep}[90](A){$(h,0)$}
        \pstLineAB[linewidth=1.15pt]{A}{T}
        \uput{4.9\psxunit}[0](0,0){$x$}
        \uput{3.75\psyunit}[90](0,0){$y$}
        \rput(-1,0){\pstEllipse[arrows=->,arrowscale=1]{0.2}{0.5}{165}{-165}}
        \pcline[arrows=|<*->|*,offset=-0.5em](B)(A|B)
            \ncput*[fillcolor=magenta!10]{$h$}
            \pcline[linestyle=dashed,linecolor=gray](A|B)(A)
        \pcline[arrows=|<*->|*,offset=2](O)(T)
            \ncput*[fillcolor=magenta!10]{$r$}
        \pstEllipse[linecolor=gray,linestyle=dashed,arrowscale=1.55]{0.4}{2.4}{0}{360}
        \pstLineAB[linecolor=gray]{B}{A}
        \end{pspicture}
        \end{center}


-----Original Message-----
From: PSTricks [mailto:pstricks-bounces at tug.org] On Behalf Of Dougherty, Michael
Sent: Sunday, November 20, 2016 10:48 AM
To: Graphics with PSTricks <pstricks at tug.org>
Subject: Re: [pstricks] Volumes/Solids of Revolution Examples?

Thank you all for the responses.  Those are all useful.  

To answer Hubert's question:  While I wouldn't mind having "smooth" solids, with gradient effects and all of that, I do like all of the suggestions I've seen so far.  I've been so far keeping my graphics simple, and trying to do everything on PSTricks instead of importing pictures generated elsewhere.  I should also mention that I've been assuming my book would be in black and white (and gray).  I want it to be inexpensive and easily LaTeX-able.

I'm happy to see ANY examples, and appreciate them all.  

Herbert, yours has appeal, and I appreciate you pointing out \psVolume, which I now see in your book.  For limited applications (rotations around the x-axis) it looks really useful and I probably will use it in an example or two.

Hubert, I like yours very much too.  If you want to share some code I'd appreciate it.  Trying to get those discs into good perspective has been a challenge.  I thought I'd try ellipses but those aren't obviously ellipses.

Randy, I might bug you for some of your code.  I especially like the big curly braces, and should investigate those!

It's funny that the volume of a cone came up a couple times already.  Without making it a "solid of revolution" problem I already did just that for my book project, and recently (like two days ago):

\documentclass{article}
\usepackage{pst-func,multicol,fouriernc,amsmath}

\begin{document}
\begin{multicols}{2}

\underline{Solution}:
Our illustration is on the right.  
We note that at each height $y\in[0,h]$, the cross sectional area is $\pi(\text{rad})^2$, where the radius ``rad'' is a function of $y$.  If we give such a circle a ``thickness,''
or ``height'' $dy$, then it forms an infinitesimally thin cylinder of volume  $dV=\pi(\text{rad})^2\,dy$.

What is left to do is to find the radius, labeled ``rad,''
as a function of $y$, and
then set up and compute the resulting integral.  From the diagram we can see that by a similar triangles argument, $(h-y)/h=(\text{rad})/r$---or equivalently $\text{rad}/(h-y)=r/h$.  
>From this we get
$\text{rad}=(h-y)\frac{r}h$, and so

\begin{center}
\begin{pspicture}(-2,-.4)(2,5.5)
\psset{xunit=1.2cm}
\parametricplot[linestyle=dashed]{0}{180}{t cos 2 mul t sin .5 mul} \parametricplot{180}{360}{t cos 2 mul t sin .5 mul}
\psline(-2,0)(0,5)(2,0)
\psline{*-}(0,0)(2,0)
\rput(1,0.2){$r$}
\psline(0,0)(0,5)
%\parametricplot{0}{180}%
%   {t cos 2 mul 3 div 5 2 3 div mul t sin 3 div sub}
%\parametricplot{180}{360}{t cos 2 mul t sin .5 mul} \parametricplot[linestyle=dashed]{0}{180}%
   {t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2 add} \parametricplot{180}{360}%
   {t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2 add} \parametricplot[linestyle=dashed]{0}{180}%
   {t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2.1 add} \parametricplot{180}{360}%
   {t cos 3 mul 5 div 2 mul t sin .5 mul 3 mul 5 div 2.1 add}
\psline[linewidth=1.5pt]{*-}(0,2)(0,5)
\rput[l]{270}(.2,3.5){$h-y$}
\psline[linewidth=1.5pt]{*-}(0,2)(1.2,2)
\rput(.625,2.2){rad}
\psline{<->}(2.2,0)(2.2,5)
\rput[l](2.4,2.5){$h$}
\rput[l](.2,1){$y$}
\psline(-2.3,2)(-1.7,2)
\psline(-2.3,2.1)(-1.7,2.1)
\psline{->}(-2,2.4)(-2,2.1)
\psline{<-}(-2,2.0)(-2,1.7)
\rput(-2,2.6){$dy$}
\psline(0,0)(.2,0)(.2,.2)(0,.2)
\end{pspicture}
\end{center}
\end{multicols}
\begin{align*}V&=\int_0^h
\pi\left[(h-y)\frac{r}h\right]^2\,dy
=\pi\cdot\frac{r^2}{h^2}\int_0^h
(h^2-2hy+y^2)\,dy
=\pi\cdot\frac{r^2}{h^2}\left.\left[h^2y-hy^2+\frac13y^3\right]\right|_0^h\\
&=\pi\cdot\frac{r^2}{h^2}\left[h^3-h^3+\frac13h^3\right]-0
=\pi\cdot\frac{r^2}{h^2}\cdot\frac13h^3=\frac13\pi r^2h.
\end{align*}
\end{document}




_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/



More information about the PSTricks mailing list