Skip to content

Instantly share code, notes, and snippets.

@paulgessinger
Created May 8, 2020 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulgessinger/ce670af235ad7c0d2527389ffddddbe2 to your computer and use it in GitHub Desktop.
Save paulgessinger/ce670af235ad7c0d2527389ffddddbe2 to your computer and use it in GitHub Desktop.
\documentclass[dvipsnames,crop=true]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,external,3d}
\usepackage{svg}
\begin{document}
\tikzsetnextfilename{bounding_box}
\begin{tikzpicture}[scale=1.5,
line width=1pt,
% x={(1cm,0cm)},
% y={(0.2cm,0.25cm)},
% z={(0,1cm)}
]
\newcommand{\frontcube}[3]{
\def\fc{white}
\draw [fill=\fc,fill opacity=0.6] (0, 0, #3) -- (#1, 0, #3) -- (#1, #2, #3) -- (0, #2, #3) -- cycle;
\draw [fill=\fc,fill opacity=0.1] (0, 0, #3) -- (0, 0, 0) -- (#1, 0, 0) -- (#1, 0, #3);
\draw [fill=\fc,fill opacity=0.5] (#1, 0, 0) -- (#1, #2, 0) -- (#1, #2, #3) -- (#1, 0, #3);
}
\newcommand{\backcube}[3]{
\def\fc{LimeGreen}
\def\fo{0.2}
\draw[dashed] (0, 0, 0) -- (0, #2, 0) -- (#1, #2, 0);
\draw[dashed] (0, #2, 0) -- (0, #2, #3);
% \fill[fill=\fc,fill opacity=\fo] (0,0,0) -- (#1,0,0) -- (#1,#2,0) -- (#1,#2,#3) -- (0,#2,#3) -- (0,0,#3) -- cycle;
\fill[fill=\fc,fill opacity=0.2] (0,0,0) -- (#1,0,0) -- (#1,#2,0) -- (0,#2,0) -- cycle;
\fill[fill=\fc,fill opacity=0.4] (0,0,0) -- (0,#2,0) -- (0,#2,#3) -- (0,0,#3) -- cycle;
\fill[fill=\fc,fill opacity=0.6] (0,#2,0) -- (#1,#2,0) -- (#1,#2,#3) -- (0,#2,#3);
}
\begin{scope}[
shift={(-0.2, 1.4)},
x={({cos(0)*1cm},{sin(0)*1cm})},
y={({cos(30)*0.4cm},{sin(30)*0.4cm})},
z={({cos(90)*1cm}, {sin(90)*1cm})}
]
\draw [->] (0, 0, 0) -- (1, 0, 0) node [right] {$x$};
\draw [->] (0, 0, 0) -- (0, 1, 0) node [above right] {$y$};
\draw [->] (0, 0, 0) -- (0, 0, 1) node [above] {$z$};
\end{scope}
\begin{scope}[shift={(-2, 0)}]
\node at (0, -2.6) {(a)};
\begin{scope}[
x={({cos(0)*1cm},{sin(0)*1cm})},
y={({cos(30)*0.4cm},{sin(30)*0.4cm})},
z={({cos(90)*1cm}, {sin(90)*1cm})}
]
\begin{scope}[shift={(-1.2, -1, -1.7)}]
\backcube{2.3}{2}{3.5}
\end{scope}
\node at (0, 0) {\includegraphics[width=4cm]{../assets/calorimeter/rocket_rot.pdf}};
\begin{scope}[shift={(-1.2, -1, -1.7)}]
\frontcube{2.3}{2}{3.5}
\end{scope}
\end{scope}
\end{scope}
\begin{scope}[shift={(2, 0)}]
\node at (0, -2.6) {(b)};
\begin{scope}[
x={({cos(-20)*1cm},{sin(-20)*1cm})},
y={({cos(30)*0.4cm},{sin(30)*0.4cm})},
z={({cos(90-20)*1cm}, {sin(90-20)*1cm})}
]
\begin{scope}[shift={(-0.9, -1, -1.8)}]
\backcube{2.0}{2}{3.8}
\end{scope}
\node at (0, 0) {\includegraphics[width=4cm]{../assets/calorimeter/rocket_rot.pdf}};
\begin{scope}[shift={(-0.9, -1, -1.8)}]
\frontcube{2.0}{2}{3.8}
\end{scope}
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment