Tikz 和 3 空間中的圖形

Tikz 和 3 空間中的圖形

在此輸入影像描述

我怎麼能在 LaTeX 中繪製這個?我可以處理很多部分,但我認為還有其他簡單的方法可以做到。我怎麼才能將這個灰色背景添加到提供空間視圖的圖像中。

答案1

您可以在 3-D 座標中進行繪圖。這應該可以幫助您開始:

在此輸入影像描述

請注意,繪製圖表不同部分的順序很重要:我首先繪製了陰影部分,以便它位於其他線條「後面」。

\documentclass[border=5mm,tikz]{standalone}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}

  \begin{tikzpicture}[every node/.style={font=\tiny}]
    \draw[dashed,fill=blue!20](1,0,-1) -- (-1,0,-1) -- (-1,0,0) -- (1,0,0) -- cycle;
    \draw(-1,-1,0)node[anchor=south west]{$P_1$} -- (1,-1,0) -- (1,1,0) -- (-1,1,0) -- cycle;
    \draw(1,0,1)node[anchor=south east]{$P_2$} -- (-1,0,1) -- (-1,0,0) -- (1,0,0) -- cycle;
  \end{tikzpicture}

\end{document}

相關內容