1

I'd like to draw a cube in perspective with coordinate system and arrows for the definition of the Cauchy stress tensor in continuum mechanics. It's supposed to look like this:

Cube for definition of stresses

The example is drawn isometrically. I'd rather have it drawn in perspective.

Hope you guys can help me. Thanks!

Sincerely, Chris

1 Answers1

3

Here is an example of what you can achieve with the perspective and the 3d libraries. To change the perspective, just change the angles in the 3d view key.

\documentclass{standalone}

\usepackage{tikz} \usetikzlibrary{perspective} \usetikzlibrary{3d} \usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}[%
    3d view = {15}{15}
]

    \draw[-{Latex[scale = 0.7]}] (-4, -4, 0) -- (-3, -4, 0)
        node[below] {\footnotesize$x$};
    \draw[-{Latex[scale = 0.7]}] (-4, -4, 0) -- (-4, -3, 0)
        node[right] {\footnotesize$y$};
    \draw[-{Latex[scale = 0.7]}] (-4, -4, 0) -- (-4, -4, 1)
        node[above] {\footnotesize$z$};

    \begin{scope}[canvas is xz plane at y = -2]

        \draw[
            fill = lightgray
        ] (-2, -2) rectangle (2, 2);

        \draw[-Latex] (-1.75, 0) -- (1.75, 0)
            node[below left] {$\sigma_{xy}$};
        \draw[-Latex] (0, -1.75) -- (0, 1.75)
            node[below left] {$\sigma_{zy}$};

    \end{scope}     

    \draw[Latex-] (0, -2, 0) -- (0, -3.5, 0)
        node[left] {$\sigma_{yy}$};

    \begin{scope}[canvas is yz plane at x = 2]

        \draw[
            fill = lightgray
        ] (-2, -2) rectangle (2, 2);

        \draw[-Latex] (1.75, 0) -- (-1.75, 0)
            node[below right] {$\sigma_{yx}$};
        \draw[-Latex] (0, -1.75) -- (0, 1.75)
            node[below right] {$\sigma_{zx}$};

    \end{scope} 

    \draw[Latex-] (2, 0, 0) -- (3.5, 0, 0)
        node[right] {$\sigma_{xx}$};

    \begin{scope}[canvas is xy plane at z = 2]

        \draw[
            fill = lightgray
        ] (-2, -2) rectangle (2, 2);

        \draw[-Latex] (-1.75, 0) -- (1.75, 0)
            node[above]{$\sigma_{xz}$};
        \draw[-Latex] (0, 1.75) -- (0, -1.75)
            node[above left]{$\sigma_{yz}$};

    \end{scope} 

    \draw[Latex-] (0, 0, 2) -- (0, 0, 3.5)
        node[above] {$\sigma_{zz}$};

\end{tikzpicture}

\end{document}

which yields:

enter image description here

Then, you can look at the TikZ documentation to adapt it to specific needs.

KersouMan
  • 1,850
  • 3
  • 13
  • 15
  • Thank you very much! One more problem: Can you tell me how to install the library "perspective"? It seems I have not installed it, as it can't be found. – Chris M H Jul 17 '20 at 09:58
  • 1
    @ChrisMH It's one of the standard libraries of TikZ, so you probably need to update Pgf/TikZ. (It was added March 2019.) – Torbjørn T. Jul 17 '20 at 10:55