4

I faked a solid on the paper plane, but here

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[left=2.00cm, right=3.00cm, top=1.00cm, bottom=1.00cm]{geometry}
\usepackage{tikz}

\usetikzlibrary{angles, calc}

\begin{document}
    \begin{tikzpicture}[thick]
        \def \l{ 6.0 } % Defines the width  of the parallelepiped
        \def \d{ 5.0 } % Defines the depth  of the parallelepiped
        \def \h{ 7.0 } % Defines the heigth of the parallelepiped
        \def \s{ 3.0 } % Defines the shift from the parallelepiped to the edge of the trapezoid
        \coordinate (A) at (0,0); 
        \coordinate (B) at (\l,0);
        \coordinate (C) at ({\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))});
        \coordinate (D) at ({\d/(2*sqrt(2))},{\d/(2*sqrt(2))});
        \draw (A) -- node[midway, below] {$a$} (B);
        \draw[dashed, thin] (B) -- node[midway, right=2pt] {$b$} (C);
        \draw[dashed] (C) -- node[midway, below] {$c$} (D) -- node[midway, left=2pt] {$d$} (A);
        \coordinate (E) at (0,\h);
        \coordinate (F) at (\l,\h);
        \coordinate (G) at ({\l+\d/(2*sqrt(2))},{\h+\d/(2*sqrt(2))});
        \coordinate (H) at ({\d/(2*sqrt(2))},{\h+\d/(2*sqrt(2))});
        \coordinate (I) at ({\s+\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))});
        \coordinate (J) at ({\s+\l+\d/(2*sqrt(2))},{\h+\d/(2*sqrt(2))});
        \draw (E) -- node[midway, below] {$i$} (F) -- node[midway, below right=2pt] {$p$} (J) -- node[pos=0.2, below] {$o$} node[pos=0.65, below] {$k$} (H) -- node[midway, left=2pt] {$l$} cycle;
        \draw[thin] (F) -- node[midway, right=2pt] {$j$} (G);
        \draw (A) -- node[midway, left=2pt] {$e$} (E) (B) -- node[midway, left=2pt] {$f$} (F);
        \draw[dashed, thin] (C) -- node[pos=0.3, left=2pt] {$g$} (G);
        \draw[dashed] (D) -- node[pos=0.3, left=2pt] {$h$} (H);
        \draw[dashed] (C) -- node[midway, below] {$m$} (I);
        \draw (I) -- node[midway, below right=2pt] {$n$} (B);
        \draw (I) -- node[pos=0.3, right=2pt]  {$q$} (J);
        \draw pic[pic text=$\cdot$, draw, angle radius=10pt] {angle=B--C--I};
    \end{tikzpicture}
\end{document}

the (German) right angle symbol doesn't look like it belongs to the horizontal plane. Well, that's because it's not a right angle in the paper plane. But it is in the horizontal plane. It has been answered before how to do it with the square-ish symbol, but how can I "fix" it with this rounded symbol?

5
  • I think it would be a lot easier if you just worked in 3-dimensional coordinates. Then you could switch to drawin just int he x-y plane to achive the desired results. A simple example of using canvas is xy plane at z=0 is in Drawing Axis Grid in 3D with Custom Unit Vectors. Dec 4, 2020 at 6:54
  • @PeterGrill I like that solution. It still doesn't look right with the angle= from the angles library, but I have fixed that. Basically I just drew the arc in the right plane (which is an elliptic arc) and then put the dot in the middle. But I also like the feature of choosing the "point of view" given by the tikz-3dplot package: very intuitive just specifying the angles. Is there a way to do it with just the 3d library and no extra package?
    – Andyc
    Dec 5, 2020 at 10:37
  • You only realy need tikz and it's 3d library. The xparse package there was only use to define the \NewDocumentCommand. You of course can use \newcommand to define those -- xparse just make it easier. Dec 5, 2020 at 11:01
  • @PeterGrill My question is if there is an equivalent of \tdplotsetmaincoords in the 3d library. I found no trace of it in the pgfmanual. I find it very convenient in tikz-3dplot in order to change the orientation of the axes. I know I can achieve the same result with 3d if I just redefine the axes, but I need to compute them separately and still, it's three values that I have to change. Sure enough I could create a \newcommand for that, but I guess I'd still have to change the canvas every time I want to draw on a different plane.
    – Andyc
    Dec 5, 2020 at 15:22
  • I am not sure. I suggest you post a new question as I think that would be helpful to others as well. I have just always asjuted the x, y` and z to change the orientation. Dec 5, 2020 at 18:39

1 Answer 1

3

You can use \usepackage{tikz-3dplot}

    \documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[left=2.00cm, right=3.00cm, top=1.00cm, bottom=1.00cm]{geometry}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{angles, calc}

\begin{document}
\tdplotsetmaincoords{70}{60}
\begin{tikzpicture}[tdplot_main_coords,line join = round]
        \def \l{ 6.0 } % Defines the width  of the parallelepiped
        \def \d{ 5.0 } % Defines the depth  of the parallelepiped
        \def \h{ 7.0 } % Defines the heigth of the parallelepiped
        \def \s{ 3.0 } % Defines the shift from the parallelepiped to the edge of the trapezoid
        \coordinate (A) at (0,0,0); 
        \coordinate (B) at (\l,0,0);
        \coordinate (C) at ({\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))},0);
        \coordinate (D) at ({\d/(2*sqrt(2))},{\d/(2*sqrt(2))},0);
        \draw (A) -- node[midway, below] {$a$} (B);
        \draw[dashed, thin] (B) -- node[midway, right=2pt] {$b$} (C);
        \draw[dashed] (C) -- node[midway, below] {$c$} (D) -- node[midway, left=2pt] {$d$} (A);
        \coordinate (E) at (0,0,\h);
        \coordinate (F) at (\l,0,\h);
        \coordinate (G) at ({\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))},\h);
        \coordinate (H) at ({\d/(2*sqrt(2))},{\d/(2*sqrt(2))},\h);
        \coordinate (I) at ({\s+\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))},0);
        \coordinate (J) at ({\s+\l+\d/(2*sqrt(2))},{\d/(2*sqrt(2))},\h);
        \draw (E) -- node[midway, below] {$i$} (F) -- node[midway, below right=2pt] {$p$} (J) -- node[pos=0.2, below] {$o$} node[pos=0.65, below] {$k$} (H) -- node[midway, left=2pt] {$l$} cycle;
        \draw[thin] (F) -- node[midway, right=2pt] {$j$} (G);
        \draw (A) -- node[midway, left=2pt] {$e$} (E) (B) -- node[midway, left=2pt] {$f$} (F);
        \draw[dashed, thin] (C) -- node[pos=0.3, left=2pt] {$g$} (G);
        \draw[dashed] (D) -- node[pos=0.3, left=2pt] {$h$} (H);
        \draw[dashed] (C) -- node[midway, below] {$m$} (I);
        \draw (I) -- node[midway, below right=2pt] {$n$} (B);
        \draw (I) -- node[pos=0.3, right=2pt]  {$q$} (J);
        \draw pic[pic text=$\cdot$, draw, angle radius=10pt] {angle=B--C--I};
                \end{tikzpicture}

\end{document}

enter image description here

5
  • If I have to use the third coordinate, then I would expect to enter the full coordinate and the "renderer" (is this the correct name for it?) would take care of shortening the depth when drawing it. Furthermore that angle symbol still doesn't look right to me. It might be a consequence of the coordinate "problem".
    – Andyc
    Dec 5, 2020 at 0:07
  • @Andyc Yes. You must enter the full coordinates. I only add z - coordinates. I copied all your coordinates. You try to change at \tdplotsetmaincoords{70}{60} to view picture. Dec 5, 2020 at 0:20
  • Thank you. tikz-3dplot is a very nice package indeed, but it doesn't seem to have been maintained in a while. The last documentation is from 2012 (maybe the Maya put an end to it ;-)). I wonder if that is because most features are now in the 3d library of tikz!? Or maybe there is something newer?
    – Andyc
    Dec 5, 2020 at 10:30
  • @Andyc Yes. It does not update. You can join in topanswers.xyz/tex and find github.com/marmotghost/tikz-3dtools. It is very interesting. Dec 5, 2020 at 14:42
  • It is indeed. I wish at least some parts of tikz-3dplot and this 3dtools library made it in the main tikz package and made it more powerful, but I doubt that will happen. Thank you anyway for pointing it out.
    – Andyc
    Dec 5, 2020 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.