![如何用 TikZ 绘制具有高度和斜高的金字塔?](https://linux22.com/image/347626/%E5%A6%82%E4%BD%95%E7%94%A8%20TikZ%20%E7%BB%98%E5%88%B6%E5%85%B7%E6%9C%89%E9%AB%98%E5%BA%A6%E5%92%8C%E6%96%9C%E9%AB%98%E7%9A%84%E9%87%91%E5%AD%97%E5%A1%94%EF%BC%9F.png)
答案1
您可以在链接中看到锥体的金字塔交换图或者你可以使用sketch-lib
**
http://alexdu.github.io/sketch-lib/
** 或者使用 TikZ 绘制具有半透明和阴影效果的多面体。
答案2
您可以使用 来执行此操作tikz-3dplot
。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{-20}
\begin{tikzpicture}[tdplot_main_coords,line cap=butt,line join=bevel]
\pgfmathsetmacro{\B}{4}
\pgfmathsetmacro{\H}{4}
\draw[blue,thick] (-\B/2,-\B/2,0) -- (\B/2,-\B/2,0) -- (\B/2,\B/2,0) -- (-\B/2,\B/2,0) -- cycle;
\draw[blue,thick] (\B/2,\B/2,0) -- (0,0,\H)
node[above,font=\large\bfseries]{Regular Pyramid};
\draw[dashed,blue] (0,0,0) -- (0,0,\H) coordinate[midway](aux1);
\draw[blue] (0,0,0.3) -- (0.3,0,0.3) -- (0.3,0,0);
\draw[dashed,blue] (-\B/2,0,0) -- (0,0,\H) coordinate[pos=0.3](aux2);
\draw[blue] ({-\B/2+0.15*(\H/\B)},0,0.3) -- ({-\B/2+0.15*(\H/\B)},-0.3,0.3) --
(-\B/2,-0.3,0);
\coordinate (aux3) at (1,0,0);
\draw[blue,thick,fill=cyan,fill opacity=0.3] (-\B/2,-\B/2,0) -- (0,0,\H) -- (\B/2,-\B/2,0) -- cycle;
\draw[blue,thick,fill=blue,fill opacity=0.3] (-\B/2,-\B/2,0) -- (0,0,\H) -- (-\B/2,\B/2,0) -- cycle;
\begin{scope}[tdplot_screen_coords]
\draw (aux1) -- ++ (2,0.1) node[right,font=\itshape] {Altitude};
\draw (aux2) -- ++ (-1.5,0.3) node[left,font=\itshape] {Slant Height};
\draw (aux3) -- ++ (1,-1) node[below right,font=\itshape] {Base};
\end{scope}
\end{tikzpicture}
\end{document}