显示双曲抛物面的轨迹

显示双曲抛物面的轨迹

我无法让双曲抛物面的轨迹的阴影/分层看起来正确。我尝试将双曲抛物面和轨迹分成几部分,然后相应地对它们进行分层。参考图像:

在此处输入图片描述

这是我所得到的最接近的一次。

在此处输入图片描述

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}

% Customizations
\pgfplotsset{
        every non boxed x axis/.style={
            xtick align=center,
            tick style={line width=0.5pt, color=black},
            x axis line style={-{Latex[width=1.5mm]},black,line width=0.5pt},
            xlabel style={at={(ticklabel* cs:1.05)}, anchor=mid},
            xlabel=$x$
        },
         every non boxed y axis/.style={
            ytick align=center,
            tick style={line width=0.7pt, color=black},
            y axis line style={-{Latex[width=1.5mm]},black,line width=0.5pt},
            ylabel style={at={(ticklabel* cs:1.08)}, anchor=mid},
            ylabel=$y$
        },
        every non boxed z axis/.style={
            ztick align=center,
            tick style={line width=0.5pt, color=black},
            z axis line style={-{Latex[width=1.5mm]},black,line width=0.5pt},
            zlabel style={at={(ticklabel* cs:1.06)}, anchor=mid},
            zlabel=$z$
        },
        tick label style={
            font=\tiny,
        },
        compat=1.18
    }

    
\begin{document}

\begin{tikzpicture}
    \begin{axis}[xmin=-5,xmax=5,ymin=-5,ymax=5,zmax=10,zmin=-5,axis lines=center,ticks=none,axis lines=none,view/h=130,view/v=35]
        \draw[line width=0.5,black] (-5,0,0) -- (0,0,0);
        \draw[line width=0.5,black] (0,0,-10) -- (0,0,0);
        \draw[line width=0.5,black] (0,-5,0) -- (0,0,0);
        \addplot3[line width=1pt,black,domain=-0.25:-0.5,samples=21] (0,y,-y^2);
        \addplot3[line width=1pt,black,domain=-3:0,domain y=-3:0,samples=21,samples y=1] ({x},{-1*(sqrt((x*x)+3))},{-3});
        \addplot3[surf,domain=-3:0,domain y=-3:0,samples=15,opacity=0.75,shader=interp] (x,y,x*x-y*y);
        \addplot3[surf,shader=interp,domain=0:3,domain y=-3:0,samples=15,opacity=0.75] (x,y,x*x-y*y);
        \addplot3[line width=1pt,black,domain=0.25:1,samples=21,samples y=1] (x,0,x^2);
        \addplot3[surf,domain=-3:0,domain y=0:3,samples=15,opacity=0.75,shader=interp] (x,y,x*x-y*y);
        \draw[line width=0.5,-{Latex[width=3pt]},black] (0,0,0) -- (5,0,0) node[pos=1.1] {$x$};
        \addplot3[surf,domain=0:3,domain y=0:3,samples=15,opacity=0.75,shader=interp] (x,y,x*x-y*y);
        \draw[line width=0.5,-{Latex[width=3pt]},black] (0,0,0) -- (0,5,0) node[pos=1.1] {$y$};
        \draw[line width=0.5,-{Latex[width=3pt]},black] (0,0,0) -- (0,0,15) node[pos=1.1] {$z$};
        \addplot3[line width=1pt,black,domain=-3:0.25,samples=21,samples y=1] (x,0,x^2);
        \addplot3[line width=1pt,black,domain=1:3,samples=21,samples y=1] (x,0,x^2);
        \addplot3[line width=1pt,black,domain=-3:-0.5,samples=21] (0,y,-y^2);
        \addplot3[line width=1pt,black,domain=-0.25:3,samples=21] (0,y,-y^2);
        \addplot3[line width=1pt,black,domain=-3:3,domain y=-3:0,samples=21,samples y=1] ({x},{sqrt((x*x)+3)},{-3});
        \addplot3[line width=1pt,black,domain=0:3,domain y=-3:0,samples=21,samples y=1] ({x},{-1*(sqrt((x*x)+3))},{-3});
    \end{axis}
\end{tikzpicture}

\end{document}

答案1

表面

我认为将绘图分成两部分就足够了:一部分是负面的,以及正。(我太晚才注意到你的抛物面已经交换了X坐标。

评论

  • 我的印象是它没有透明度,shader=interp所以我使用flat它。
  • 处理与y=0我将曲线画得稍微粗一些,因为它属于图画的后部。

代码

\documentclass[11pt, margin=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{compat=1.17}
\begin{document}

\begin{tikzpicture}
  % \pgfplotsset{set layers}
  \begin{axis}[
    % axis on top=true,
    xlabel=$x$,
    ylabel=$y$,
    zlabel=$z$,
    view={150}{15},
    axis lines=none, % center
    zmin=-25, zmax=16,
    ]
    % surface back
    \addplot3[
    surf,
    colormap/PuBu-9,
    % shader=interp,
    shader=flat,
    opacity=.7,
    domain=-4:4,
    domain y=-5:0,
    samples=40,
    clip=false
    ] {x^2 -y^2};

    % intersection with x=0, back
    \addplot3[%
    draw=red, thick,
    domain=-5:5,
    samples y=0
    ] (0, x, {-x^2});

    % intersection with y=0
    \addplot3[%
    draw=red, very thick,
    domain=-4:4,
    samples y=0
    ] (x, 0, {x^2});    

    % intersection with z=9, back
    \addplot3[%
    draw=red, thick,
    domain=-4:4,
    samples y=0
    ] (x, {-pow(x^2 +9, .5)}, -9);

    \draw[ultra thin, ->] (0, 0, 0) -- (6, 0, 0)
    node[below, text=black, scale=.8] {$x$};

    % surface front 
    \addplot3[
    surf,
    colormap/PuBu-9,
    % shader=interp,
    shader=flat,
    opacity=.7,
    domain=-4:4,
    domain y=0:5,
    samples=40,
    clip=false
    ] {x^2 -y^2};

    % intersection with x=0, front
    \addplot3[%
    draw=red, thick,
    domain=0:5,
    samples y=0
    ] (0, x, {-x^2});

    % intersection with z=9, front
    \addplot3[%
    draw=red, thick,
    domain=-4:4,
    samples y=0
    ] (x, {pow(x^2 +9, .5)}, -9);
 
    \draw[ultra thin, ->] (0, 0, 0) -- (0, 0, 20)
    node[above, text=black, scale=.8] {$z$};
    \draw[ultra thin, ->] (0, 0, 0) -- (0, 7, 0)
    node[below, text=black, scale=.8] {$y$};
  \end{axis}
\end{tikzpicture}
\end{document}

相关内容