四角錐の作り方は?

四角錐の作り方は?

八面体用の次のコードがあります。その下の部分を削除し、各頂点に 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}

ここに画像の説明を入力してください

関連情報