[Tex/LaTex] How to create horn torus in latex

diagrams

This is a horn torus. How can I use latex to generate it ?
This is a horn torus. How can I use latex to generate it ?

Best Answer

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{colormaps}
\begin{document}
\foreach \X in {0,...,14}
{\begin{tikzpicture}
     \begin{axis}[view/h=45,axis lines = none,colormap={fake}{
rgb255(0cm)=(255,255,255); rgb255(1cm)=(255,255,255); rgb255(2cm)=(255,0,0);
rgb255(3cm)=(255,0,0)},unit vector ratio=1 1 1]
        \addplot3[domain=0:360,domain y=0:360,point meta=x-y+z,mesh,
    z buffer=sort]
       ({(1+cos(x+\X))*cos(y+\X)}, 
        {(1+cos(x+\X))*sin(y+\X)}, 
        {sin(x+\X)});
      \end{axis}
      \path (1,1) rectangle (5.9,4.7); % <- Thanks to J Leon V. !
\end{tikzpicture}}
\end{document}

enter image description here

UPDATE: Removed the flickers, big thanks to J Leon V.! And removed the amsmath package and slightly changed the view.

Related Question