18dgj/figs/plates.fig/plates.tikz.tex
2018-05-18 22:53:34 +00:00

88 lines
2.4 KiB
TeX

\documentclass{standalone}
\usepackage{tikz}
% a global rescaling factor
\def\rescale{0.6}
% length of the axes
\def\axeslength{\rescale*3}
% width, length and height of a plate
\def\w{\rescale*2.5}
\def\l{\rescale*4}
\def\h{\rescale*0.2}
% space between figures
\def\interlen{\rescale*8}
% offset of the label of each figure
\def\labeloffsetx{\rescale*2}
\def\labeloffsety{\rescale*3}
% factor by which to multiply lengths to get depths
\def\rotx{0.5*0.5}
\def\roty{0.5*0.866}
% draw a plate at #1 of width #2, length #3 and height #4
\def\plate#1#2#3#4{
\def\width{#2}
\def\length{#3}
\def\height{#4}
% the center
\path#1coordinate(O);
% draw first half of axes
\draw(O)++(-\axeslength,0)--(O);
\path(O)++(\rotx*\axeslength,\roty*\axeslength)coordinate(t);
\draw[->](O)++(\rotx*0.5*\width,\roty*0.5*\width)--(t);
\draw(O)++(0,-\axeslength)--(O);
% define points
\path(O)++(-0.5*\length,-0.5*\height)++(-0.5*\rotx*\width,-0.5*\roty*\width)coordinate(A);
\path(A)++(\length,0)coordinate(B);
\path(B)++(\rotx*\width,\roty*\width)coordinate(C);
\path(C)++(-\length,0)coordinate(D);
\path(D)++(0,\height)coordinate(E);
\path(E)++(-\rotx*\width,-\roty*\width)coordinate(F);
\path(F)++(\length,0)coordinate(G);
\path(G)++(\rotx*\width,\roty*\width)coordinate(H);
% fill and stroke the plate (covers part of the axes)
\fill[color=white](A)--(B)--(C)--(H)--(E)--(F)--(A);
\draw(A)--(B)--(C)--(H)--(E)--(F)--(G)--(H);
\draw(A)--(F);
\draw(B)--(G);
% draw the second half of the axes after having filled the plate
\path(O)++(\axeslength,0)coordinate(t);
\draw[->](O)++(0.5*\length,0)--(t);
\path(O)++(-\rotx*0.5*\width,-\roty*0.5*\width)coordinate(t);
\draw(O)++(-\rotx*\axeslength,-\roty*\axeslength)--(t);
\path(O)++(0,\axeslength)coordinate(t);
\draw[->](O)++(0,0.5*\height)--(t);
}
\begin{document}
\begin{tikzpicture}
% 3a
\plate{(0,0)}{\w}{\l}{\h}
\path(-\labeloffsetx,\labeloffsety)node{$3_a$};
% 3b
\plate{(\interlen,0)}{\l}{\w}{\h}
\path(\interlen,0)++(-\labeloffsetx,\labeloffsety)node{$3_b$};
% 1a
\plate{(2*\interlen,0)}{\l}{\h}{\w}
\path(2*\interlen,0)++(-\labeloffsetx,\labeloffsety)node{$1_a$};
% 1b
\plate{(0,-\interlen)}{\w}{\h}{\l}
\path(0,-\interlen)++(-\labeloffsetx,\labeloffsety)node{$1_b$};
% 2a
\plate{(\interlen,-\interlen)}{\h}{\w}{\l}
\path(\interlen,-\interlen)++(-\labeloffsetx,\labeloffsety)node{$2_a$};
% 2b
\plate{(2*\interlen,-\interlen)}{\h}{\l}{\w}
\path(2*\interlen,-\interlen)++(-\labeloffsetx,\labeloffsety)node{$2_b$};
\end{tikzpicture}
\end{document}