# Surface of Revolution

Edit and compile if you like:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{math}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1pt}
%
% File name: surface-of-revolution.tex
% Description:
% A geometric representation of a surface of revolution is shown.
%
% Date of last modification: October, 9th, 2022.
% Author: Efraín Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% Source: page 450 of the
% Glosario Ilustrado de Matem\'aticas Escolares.
% https://tinyurl.com/5udm2ufy
%
% According to TikZ.net
%
\begin{document}
%
\tdplotsetmaincoords{60}{130}
\begin{tikzpicture}[tdplot_main_coords]
% The function that is rotated
\tikzmath{function f(\x) {return 1.5 - 0.35*sin(\x r);};}
\pgfmathsetmacro{\dominio}{2.0}
\pgfmathsetmacro{\xi}{-\dominio}
\pgfmathsetmacro{\step}{(\dominio-\xi)/70.0}
\pgfmathsetmacro{\xs}{\xi+\step}
\pgfmathsetmacro{\max}{3}
% Circumferences (behind the coordiante axis)
\foreach \x in {\xi,\xs,...,\dominio}{
}
% Part of the solid of revolution behind the coordinate axis
\foreach \angulo in {358,356,...,90}{
\draw[cyan,very thick,rotate around y=\angulo,opacity=0.35] plot[domain=-\dominio:\dominio,smooth,variable=\t] ({0},{\t},{f(\t)});
}
% Graph of the function rotated about the $y$ axis
\draw[red,ultra thick] plot[domain=-\dominio:\dominio,smooth,variable=\t] ({0},{\t},{f(\t)}) node [above right] {$z = f(y)$};
% Coordinate axis
\draw[thick,->] (0,0,0) -- (0,\max,0) node [right] {$y$};
\draw[thick,->] (0,0,0) -- (\max,0,0) node [left] {$x$};
\draw[thick,->] (0,0,0) -- (0,0,\max) node [above] {$z$};
% Circumferences (in front of the coordiante axis)
\foreach \x in {\xi,\xs,...,\dominio}{