我有以下八面体代码。我需要删除其下方部分,并为每个顶点写上 A、B、C、D、E。我不知道该怎么做。非常感谢您的帮助。
\[
\begin{tikzpicture}[z={(-.3cm,-.2cm)}, % direction z gets projected to; can also change x,y
% use cm to specify non-transformed coordinates
line join=round, line cap=round, % makes the corners look nicer
every node/.style = {inner sep=1pt, font=\scriptsize}
]
\draw ( 0,2,0) node[above] {} --
(-2,0,0) node [left] {} --
(0,-2,0) node[below] {} --
( 2,0,0) node[right] {} --
( 0,2,0) --
( 0,0,2) node[below left] {} --
(0,-2,0) (2,0,0) -- (0,0,2) -- (-2,0,0);
\draw[dashed] (0,2,0) -- (0,0,-2) -- (0,-2,0) (2,0,0) -- (0,0,-2) -- (-2,0,0);
\end{tikzpicture}
\]
实际上,我们有一个四面体,它的底部是一个三角形,但我需要的底部是一个矩形,一个四角金字塔,每个顶点都有字母。
答案1
像这样吗?
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
z={(-.3cm,-.2cm)},
line join=round,
line cap=round,
every node/.style={
inner sep=1pt,
font=\scriptsize
}
]
\draw
(0,2,0) node[above] {A} --
(-2,0,0) node[left] {B} --
(0,0,2) node[below] {C} --
(2,0,0) node[right] {D} -- cycle
(0,0,2) -- (0,2,0);
\draw[dashed]
(0,2,0) -- (0,0,-2) node[below] {E}
(2,0,0) -- (0,0,-2) -- (-2,0,0);
\end{tikzpicture}
\end{document}