# Complex systems of spatial vectors

I want to learn how to build complex systems of spatial vectors in tikZ/PGF (i do not know how to do this, because a beginner). As an example, i use the figure on the right. did not find the most similar examples, and those that remotely resemble such a picture are too complicated for a beginner. How to build, for example, a vector e3 and x with a given angle between them, connect their ends with a red dashed line, create an angle designation (an arc between the vectors) and designate it with some Greek letter?

These things are fairly simple to obtain. You can install your own coordinate system, and use it to draw these vectors and objects. I recommend starting from an orthogonal system and then changing some basis vectors.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{amsmath}
\begin{document}
\tdplotsetmaincoords{110}{-20}
\begin{tikzpicture}[>=stealth,
pics/axis/.style={code={
\draw[->] (0,0,0) -- (4,0,0) node[pos=1.1] {$#1_1$};
\draw[->] (0,0,0) -- (0,4,0) node[pos=1.1] {$#1_2$};
\draw[->] (0,0,0) -- (0,0,4) node[pos=1.1] {$#1_3$};
}}]
\begin{scope}[tdplot_main_coords,z={(0,0.3,1)},thick]
\pic{axis=\mathbf{b}};
\draw[->] (0,0,0) -- (3,1.2,3) node[pos=1.1]{$x$};
\draw[dashed] (3,0,0) -- (3,1.2,0) -- (0,1.2,0)
(3,1.2,0) -- (3,1.2,3) -- (0,0,3);
\end{scope}
%
\begin{scope}[xshift=8cm,tdplot_main_coords,x={(1,-0.3,0)},thick,red]
\pic{axis=\mathbf{e}};
\draw[->,black] (0,0,0) -- (3,3,3) node[pos=1.1]{$x$};
\draw[dashed] (3,0,0) -- (3,3,0) -- (0,3,0)
(3,3,0) -- (3,3,3) -- (0,0,3) -- (3,0,3) -- (3,3,3) -- (0,3,3) -- (0,0,3)
(3,0,3) -- (3,0,0) (0,3,3) -- (0,3,0);
\end{scope}
%
\begin{scope}[xshift=8cm,tdplot_main_coords,y={(-0.3,1,0)},z={(0.21,-0.3,1)},thick,blue]
\pic{axis=\mathbf{u}};
\draw[->,black] (0,0,0) -- (3,3,3) node[pos=1.1]{$x$};
\draw[dashed] (3,0,0) -- (3,3,0) -- (0,3,0)
(3,3,0) -- (3,3,3) -- (0,0,3) -- (3,0,3) -- (3,3,3) -- (0,3,3) -- (0,0,3)
(3,0,3) -- (3,0,0) (0,3,3) -- (0,3,0);
\end{scope}
\end{tikzpicture}
\end{document}


If you want to be able to compute the projections of some vector on the coordinates with TikZ, you may be interested in the experimental 3dtools library. You'd need to download tikzlibrary3dtools.code.tex somewhere where LaTeX can find it (such as the same directory as the file that you compile). The library's manual gives you some idea what you can use it for.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{3dtools}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[>=stealth,
pics/axis/.style={code={
\draw[->] (0,0,0) -- (4,0,0) node[pos=1.1] {$#1_1$};
\draw[->] (0,0,0) -- (0,4,0) node[pos=1.1] {$#1_2$};
\draw[->] (0,0,0) -- (0,0,4) node[pos=1.1] {$#1_3$};
}},
pics/projections/.style={code={
\pgfmathsetmacro{\myx}{TD("(1,0,0)o#1")}
\pgfmathsetmacro{\myy}{TD("(0,1,0)o#1")}
\pgfmathsetmacro{\myz}{TD("(0,0,1)o#1")}
\draw[pic actions] #1 -- (\myx,\myy,0)  -- (0,\myy,0)
(\myx,\myy,0)  -- (\myx,0,0) -- (\myx,0,\myz)
(0,\myy,0) --  (0,\myy,\myz)
#1 -- (\myx,0,\myz) -- (0,0,\myz) -- (0,\myy,\myz) -- #1;
}},3d/install view={phi=-20,psi=0,theta=110}]
\begin{scope}[z={(0,0.3,1)},thick]
\pic{axis=\mathbf{b}};
\draw[->] (0,0,0) -- (3,1.2,3) node[pos=1.1]{$x$};
\draw[dashed] (3,0,0) -- (3,1.2,0) -- (0,1.2,0)
(3,1.2,0) -- (3,1.2,3) -- (0,0,3);
\end{scope}
%
\begin{scope}[xshift=8cm,x={(1,-0.3,0)},thick,red]
\pic{axis=\mathbf{e}};
\draw[->,black] (0,0,0) -- (3,3,3) coordinate (x) node[pos=1.1]{$x$};
\pic[dashed] {projections=(x)};
\end{scope}
%
\begin{scope}[xshift=8cm,y={(-0.3,1,0)},z={(0.21,-0.3,1)},thick,blue]
\pic{axis=\mathbf{u}};
\draw[->,black] (0,0,0) -- (3,3,3) coordinate (x') node[pos=1.1]{$x$};
\pic[dashed] {projections=(x')};
\end{scope}
\end{tikzpicture}
\end{document}


• Schrödinger's cat, thank you! It's very helpful! – dtn Nov 12 '19 at 4:41