
Antwort1
Die Verwendung von Tikz in 3D ist praktisch dieselbe wie in 2D – außer dass Sie 3D- statt 2D-Koordinaten verwenden müssen.
So können Sie eine 3D-Box zeichnen (wie Sie sehen, können Sie 2D- und 3D-Koordinaten mischen. In diesem Fall wird automatisch angenommen, dass die Z-Koordinate der 2D-Darstellung Null ist):
\beging{tikzpicture}
\draw (0,0) -- ++(8,0) -- ++(0,-4) -- ++(-8,0) -- ++(0,4) -- ++(0,0,-4) -- ++(8,0) -- ++(0,-4) -- ++(0,0,4) ++(0,4,0) -- ++(0,0,-4);
\draw[dashed] (0,-4) -- ++(0,0,-4) -- ++(8,0,0) ++(-8,0) -- ++(0,4);
\end{tikzpicture}
Und hier ist ein etwas komplizierteres Beispiel (elektromagnetische Welle):
\begin{tikzpicture}[x={(-10:1cm)},y={(90:1cm)},z={(210:1cm)}]
% Axes
\draw[->] (-1,0,0) node[above] {$x$} -- (5,0,0);
\draw[->] (0,0,0) -- (0,2,0) node[above] {$y$};
\draw[->] (0,0,0) -- (0,0,2) node[left] {$z$};
% Waves
\draw[red,thick] plot[domain=0:4.5,samples=200] (\x,{cos(deg(pi*\x))},0);
\draw[blue,thick] plot[domain=0:4.5,samples=200] (\x,0,{cos(deg(pi*\x))});
% Arrows
\foreach \x in {0.1,0.3,...,4.4} {
\draw[red] (\x,0,0) -- (\x,{cos(deg(pi*\x))},0);
\draw[blue] (\x,0,0) -- (\x,0,{cos(deg(pi*\x))});
}
% Labels
\node[red, above right] at (0,1,0) {$\vec{\bm{E}}$};
\node[below, blue] at (0,0,1) {$\vec{\bm{H}}$};
\end{tikzpicture}