# Solids of revolution using tikz or pgf

I've been looking here on TEX Stackexchange for a solution to create Solids of Revolution but I could'n find anything. The analysis that I make on this problem is, first, draw a 2-D graph, second, draw the solid, and third, draw the slice (the disk).

Have you guys ever created something like that?

What I have so far is basically this:

\begin{figure}[h]
\centering
\begin{minipage}{.5\textwidth}
Analisando a região hachurada vemos que a integração deve ser feita com os limites $x = 1$ e $x = 2$. A equação da curva superior é $y = \left( 2 - \frac{x}{2} \right)$ e a curva inferior pode ser considerada o próprio eixo $x$ (ou seja, $y = 0$). O sólido obtido pela rotação da curva e sua unidade de volume estão representados abaixo.
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[axis lines=middle,
xlabel=$x$,
ylabel=$y$,
enlargelimits,
ytick={2},
yticklabels={2},
xtick={1,2,4},
xticklabels={1,2,4}]
\addplot[name path=F,black,domain={-.2:4.3}] {2-x/2} node[pos=.8, above]{$f$};
\addplot[pattern=north east lines, pattern color=red]fill between[of=F and G, soft clip={domain=1:2}];
\end{axis}
\end{tikzpicture}
\end{minipage}
\end{figure}

\centering
\begin{minipage}{.5\textwidth}
Revolution Solid code
\end{minipage}
\begin{minipage}{.2\textwidth}
\centering
\begin{center}
\begin{tikzpicture}
\node [cylinder, cylinder uses custom fill, cylinder body fill=red, cylinder end fill=red!50, rotate=0, draw,
minimum height=0.01 cm, minimum width=5cm, color=black] (c) {};
%   \draw[red, <->] (c.top)   -- (c.bottom)
%   node [at end, below, black]   {height};
\draw[black, <->] ([xshift=20pt]c.north) -- ([xshift=20pt]c.center)
node [at start, above, black, xshift=35pt, yshift=-40pt] {raio: $\left( 2 - \frac{x}{2} \right)$};
\draw[black, dashed] ([xshift=10pt]c.north) -- ([xshift=20pt]c.north);
\draw[black, dashed] ([xshift=8pt]c.center) -- ([xshift=20pt]c.center);
\end{tikzpicture}
\end{center}
\end{minipage}


Thank you.