答案1
这是用 3d 制作的一个例子。我在其中加入了一些参数,但它不太灵活。这是为了避免太长的三角函数计算。可以使用canvas
和rotate around
选项绘制圆,然后剪切它们。
这是代码:
\documentclass[border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{3d}
\usetikzlibrary{calc}
\def\xx{0.5} % reduction x axis, cavalier perspective
\def\aa{30} % angles AOB=BOC
\def\r {3} % radius
\def\l {4.5} % distance AD=AE
\pgfmathsetmacro\ay{\r*cos(\aa)} % Coordinates A
\pgfmathsetmacro\az{\r*sin(\aa)}
\pgfmathsetmacro\cx{\r*sin(\aa)} % Coordinates C
\pgfmathsetmacro\cy{\r*cos(\aa)}
\pgfmathsetmacro\nx{-sin(\aa)*cos(\aa)} % normal vector OAC plane
\pgfmathsetmacro\ny{ sin(\aa)*sin(\aa)}
\pgfmathsetmacro\nn{sqrt(2*\nx*\nx+\ny*\ny)} % modulus
\pgfmathsetmacro\ap{acos(abs(\nx)/\nn)} % angle between planes XY and OAC
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x={(-\xx cm,-\xx cm)},y={(1 cm,0 cm)},z={(0 cm,1 cm)}]
% coordinates
\coordinate (O) at (0,0,0);
\coordinate (A) at (0,\ay,\az);
\coordinate (B) at (0,\r,0);
\coordinate (C) at (\cx,\cy,0);
\coordinate (D) at (0,\l,0);
\coordinate (E) at ({\l*sin(\aa)},{\l*cos(\aa)},0);
% labels
\node at (O) [left] {$O$};
\node at (A) [above] {$A$};
\node at (B) [below] {$B$};
\node at (C) [below] {$C$};
\node at (D) [below] {$D$};
\node at (E) [below] {$E$};
\node[red] at ($(B)!0.5!(C)$) [below] {$a$};
\node[red] at ($(A)!0.5!(C)$) {$b$};
\node[red] at ($(A)!0.5!(B)$) [right] {$c$};
% spheric triangle
\begin{scope} [canvas is xy plane at z=0]
\clip (O) -- (D) -- (E) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
\begin{scope}[canvas is yz plane at x=0]
\clip (O) -- (A) -- (D) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
\begin{scope}[rotate around z=-\aa, rotate around y=\ap-90,canvas is yz plane at x=0]
\clip (O) -- (A) -- (E) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
% lines
\draw (O) -- (A) -- (D) -- (E) -- cycle;
\draw[dashed] (O) -- (D);
\draw (A) -- (E);
\end{tikzpicture}
\end{document}
答案2
您可以使用tikz-3dplot
。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{35}
\begin{tikzpicture}[tdplot_main_coords,line cap=round,line join=round,
declare function={Px=0.2;Py=0.4;Pz=0.6;}]
\draw (0,0,0) coordinate[label=left:{$O$}] (O)
(2,0,0) coordinate[label=below:{$A$}] (A) edge (O)
-- (2,2,0) coordinate[label=below:{$B$}] (B) edge (O)
-- (2,1,2) coordinate[label=above:{$C$}] (C) edge (O)
-- (A)
-- (3,0,0) coordinate[label=below:{$E$}] (E) edge (C)
-- (3,3,0) coordinate[label=right:{$D$}] (D) edge (C)
-- (B);
\end{tikzpicture}
\end{document}