怎样画出这样的图形?

怎样画出这样的图形?

我希望能够画出这样的图。我按照这个答案

pgfplots 二次函数但我无法绘制相交平面。任何见解都会有所帮助。提前致谢!

在此处输入图片描述

答案1

这是开始。您需要将图分解成几部分。为了用平面切割图,剪辑通常比过滤器产生更好的效果,或者restrict expr to domain因为后者往往会产生“像素化”边框。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[hide axis,shader=interp,fill opacity=0.6,
    axis equal image,scale=3,view/el=12,view/az=20,
    declare function={alpha=-25;}]
 \addplot3[surf,domain=-2:2,domain y=90:180+\pgfkeysvalueof{/pgfplots/view/az},colormap/viridis]
  ({sqrt(x*x+1)*cos(y)},{sqrt(x*x+1)*sin(y)},x); 
 \addplot3[surf,domain=0:1,domain y=90:270,colormap/hot]
  ({x*cos(y)},{x*sin(y)},x*x+1); 
 \addplot3[ultra thick,domain=-1:1,samples y=1]  ({0},{x},x*x+1);
 \begin{scope}  
  \clip[overlay] plot[variable=\x,domain=-2.1:2.2]
  ({\x*cos(alpha)+sin(alpha)},{-\x*sin(alpha)+cos(alpha)},{-sqrt(1.25+\x*\x)})
   -| (current axis.north east)  -- (current axis.north west) |- cycle;
  \addplot3[surf,domain=-2:2,domain y=180+\pgfkeysvalueof{/pgfplots/view/az}:270,colormap/viridis]
   ({sqrt(x*x+1)*cos(y)},{sqrt(x*x+1)*sin(y)},x); 
 \end{scope} 
 \fill[gray!40](0,{sqrt(5)},2) -- (0,{-sqrt(5)},2) -- (0,{-sqrt(5)},-2)
  -- (0,{sqrt(5)},-2) --cycle;
 \addplot3[surf,domain=-2:2,domain y=90:\pgfkeysvalueof{/pgfplots/view/az},colormap/viridis]
  ({sqrt(x*x+1)*cos(y)},{sqrt(x*x+1)*sin(y)},x);
 \path ({cos(\pgfkeysvalueof{/pgfplots/view/az})},{sin(\pgfkeysvalueof{/pgfplots/view/az})},0) coordinate (dot);  
 \draw[very thick,-latex] (0,0,0) -- (dot); 
 \addplot3[surf,domain=0:1,domain y=90:-90,colormap/hot]
  ({x*cos(y)},{x*sin(y)},x*x+1); 
 \begin{scope}  
  \clip[overlay] plot[variable=\x,domain=-2.1:2.2]
  ({\x*cos(alpha)+sin(alpha)},{-\x*sin(alpha)+cos(alpha)},{-sqrt(1.25+\x*\x)})
   -| (current axis.north east)  -- (current axis.north west) |- cycle;
  \addplot3[surf,domain=-2:2,domain y=\pgfkeysvalueof{/pgfplots/view/az}:-90,colormap/viridis]
   ({sqrt(x*x+1)*cos(y)},{sqrt(x*x+1)*sin(y)},x); 
 \end{scope}  
 \path (dot)  node[circle,fill,inner sep=1.2pt]{};
\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容