如何在 TikZ 中绘制黑洞/近地平线几何图形?

如何在 TikZ 中绘制黑洞/近地平线几何图形?

在广义相对论和高能物理学中,人们经常使用黑洞或特殊几何图形(如黑洞的近视界几何图形)的可视化。如何使用 TikZ(或 Asymptote 或 InkScape,我不知道这里该选择什么)绘制这些图形。我很高兴能得到一些关于如何绘制“喉咙”形状、沿表面的线条和喉咙裂缝的提示。

黑洞源黑洞或者喉部几何形状源喉几何形状


编辑:因此,我使用了 BambOo 的基本解决方案,并尝试实现第二张图片中的间隙(请注意,该图未经过优化,但几乎未显示该图的思想)。代码如下:

\documentclass[border=3.14pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{shapes.geometric}
\pgfplotsset{compat=newest}
\begin{document}
    \begin{tikzpicture}[decoration={random steps,segment length=3pt,amplitude=2pt}]
        \begin{axis}[
            axis line style={draw=none},
            tick style={draw=none},
            colormap/Purples-3,
            %Purples, BuPu, blackwhite, Greys, Blues
            data cs=polar,
            samples=30, %50
            domain=0:360,
            y domain=1:15, %1:15
            declare function={darkhole(\r)={-exp(-0.01*(\r) + (1/ln(\r)))};
                % added functions to calculate cartesian coordinates from polar coordinates
                % + (1/ln(\r)))
                pol2cartX(\angle,\radius) = \radius * cos(\angle);
                pol2cartY(\angle,\radius) = \radius * sin(\angle);
            },
            xtick={\empty},
            ytick={\empty},
            ztick={\empty},
        ]   
            \addplot3 [surf,shader=flat,draw=black,z buffer=sort] {darkhole(y)};
        \end{axis}
        \filldraw[black, draw=black, decorate,rounded corners=1pt] (3.45,1.5) 
         ellipse (0.275cm and 0.115cm);
        \filldraw[black, draw=black, decorate,rounded corners=1pt] (3.45,1) 
         ellipse (0.275cm and 0.13cm);
          \node (a) at (3.45,0.7)[cylinder, shape border rotate=270, draw, 
           minimum height=10mm, minimum width=5.5mm] {};
         \filldraw[blue!20, draw=black] (3.45,0.2) ellipse (0.275cm and 
          0.115cm);
    \end{tikzpicture}
\end{document}

这得出下图但一些明显的东西仍然缺失:

  • 我不知道如何给底部的圆柱体上色,更重要的是
  • 我不知道如何将线条从顶部的表面图延伸到圆柱体。
  • 此外,如果有一个更像漏斗的功能就好了(见原帖中的第一张图片):开始时比较陡峭,但在喉咙处停滞。我已经尝试过这样做,但现在结果不太令人满意。

答案1

tikz窃取基础解决方案的基础解决方案https://tex.stackexchange.com/a/338689/141947

\documentclass[border=3.14pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{compat=newest}
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            axis line style={draw=none},
            tick style={draw=none},
            colormap/Blues,
            data cs=polar,
            samples=50,
            domain=0:360,
            y domain=1:10,
            declare function={darkhole(\r)={-exp(-\r)};
                % added functions to calculate cartesian coordinates from polar coordinates
                pol2cartX(\angle,\radius) = \radius * cos(\angle);
                pol2cartY(\angle,\radius) = \radius * sin(\angle);
            },
            xtick={\empty},
            ytick={\empty},
            ztick={\empty},
        ]
            \addplot3 [surf,shader=flat,draw=black,z buffer=sort] {darkhole(y)};
        \end{axis}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

编辑:包含圆柱体和线条

我不完全确定你想要什么,但这里有一个建议

\documentclass[border=3.14pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{shapes.geometric}
\pgfplotsset{compat=newest}
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            axis line style={draw=none},
            tick style={draw=none},
            xtick={\empty},
            ytick={\empty},
            ztick={\empty},
            colormap/Purples-3,
            %Purples, BuPu, blackwhite, Greys, Blues
            data cs=polar,
            samples=30,
            domain=0:360,
            y domain=1:15, 
            line join=round,
            declare function={
             darkhole(\r)={-exp(-2*\r)+0.05*\r};
                % added functions to calculate cartesian coordinates from polar coordinates
                % + (1/ln(\r)))
                pol2cartX(\angle,\radius) = \radius * cos(\angle);
                pol2cartY(\angle,\radius) = \radius * sin(\angle);
            },
        ]   
            \addplot3 [surf,shader=flat,draw=black,z buffer=sort,samples=30,domain=0:360,y domain=0.1:0.3   ,samples y =2] ({x},{0.6},{darkhole(y)});
            \addplot3 [draw=red,z buffer=sort,samples=2,domain=0.3:0.6,variable=y] ({0},{0.6},{darkhole(y)});
            \addplot3 [draw=red,z buffer=sort,samples=2,domain=0.3:0.6,variable=y] ({180},{0.6},{darkhole(y)});
            \addplot3 [surf,shader=flat,draw=black,z buffer=sort,samples=30,domain=0:360,y domain=0.6:10] {darkhole(y)};

        \end{axis}
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容