为了好玩,我尝试在 TikZ 中重现下图:
到目前为止我已经能够获得:
但在我看来,我得到的结果相当糟糕,而且我开始构建三角形的方式似乎不太好(而且我在球体上失败了):
LaTeX 代码在这里:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepackage{tikz,tikz-3dplot}
\usepackage{xcolor}
\usetikzlibrary{calc,3d,intersections, positioning,intersections,shapes}
\begin{document}
%hyperboloid
\begin{tikzpicture}
%triangle definition
\tikzset{declare function={%
fx(\x)=ifthenelse(\x<0,0.75*(\x+1),0.75*(-\x+1));
fy(\y)=ifthenelse(\y<0,0,ifthenelse(\y>1,-2+\y,-\y));
}}
\begin{axis}[hide axis,view={-20}{45},scale=0.8]
\addplot3 [surf,draw=black,domain=-1.2:1.2,domain y=-1.5:1.5,opacity=0.5] {x^2-y^2};
\addplot3 [domain=-2:2,samples=81,smooth,fill=green,fill opacity=0.1] ({fx(x)},{fy(x)},{fx(x)^2-fy(x)^2});
\end{axis}
\end{tikzpicture}
%sphere
\begin{tikzpicture}
\begin{axis}[hide axis,axis equal,width=8cm,height=8cm,domain=-1:1,domain y=-1:1 ]
\addplot3[%
opacity = 0.5,
surf,draw=black,
z buffer = sort,
variable = \u,
variable y = \v,
domain = 0:180,
y domain = 0:360,
]
({cos(u)*sin(v)}, {sin(u)*sin(v)}, {cos(v)});
\end{axis}
\newcommand{\InterSec}[3]{%
\path[name intersections={of=#1 and #2, by=#3, sort by=#1,total=\t}]
\pgfextra{\xdef\InterNb{\t}}; }
\pgfmathsetmacro\R{2}
\foreach \angle[count=\n from 1] in {-5,225,290} {
\begin{scope}[rotate=\angle,transform canvas={xshift = 3.2cm,yshift=3.4cm}]
\path[draw,dashed,name path global=d\n] (2,0) arc [start angle=0,
end angle=180,
x radius=2cm,
y radius=1cm] ;
\path[draw,name path global=s\n] (-2,0) arc [start angle=180,
end angle=360,
x radius=2cm,
y radius=1cm] ;
\end{scope}
}
\begin{scope}[transform canvas={xshift = 3.2cm,yshift=3.4cm}]
\InterSec{s1}{s2}{I3} ;
\InterSec{s1}{s3}{I2} ;
\InterSec{s3}{s2}{I1} ;
%
\fill[fill=green,opacity=0.5] (I1) to [bend right=8.5] (I2) to [bend left=7]
(I3) to [bend left=6] (I1);
\end{scope}
\end{tikzpicture}
%plane
\begin{tikzpicture}
\begin{axis}[hide axis,
xlabel=$x$, ylabel=$y$, zlabel = $z$,,scale=0.8
]
\addplot3[
surf,draw=black, shader=flat,
domain=-5:5,
domain y=-5:5,
samples =10,
opacity = 0.5
] {x + 2*y -1};
\draw[black, very thick,fill=green,fill opacity=0.1] (-2, -3, -8) -- (2, 2, 5) -- (-1, 4, 7) -- cycle;
\end{axis}
\end{tikzpicture}
\end{document}
感谢您的帮助!