edugame-railway-operation/figures/sketch.tikz

92 lines
3.3 KiB
Plaintext

%!TEX TS-program = pdflatexmk
%!TEX root = sketch.tex
% Copyright 2018 Martin Scheidt (ISC license)
% Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
% dimensons for signal construction
\def\length{2.0}
\def\height{1.5}
\def\thick{0.4}
\def\gap{0.05}
\def\depth{2.0}
\tikzset{
block_signal/.pic={
% frame
\draw [thick] ( -1.5,-2.0) -- ( 1.5,-2.0) -- (1.5,-4.0) -- (-1.5,-4.0) --cycle;
};
}
\tikzset{
block_signal_cross_section/.pic={
% lever
\draw [thick] (0,0) -- ++( 0,\height) -- ++(\thick,0) -- ++(0,-\height)
-- ++(\length,0) -- ++(0,-\thick) -- ++(-\length,0) -- ++(-\thick,0) -- ++(-\length,0)
-- ++(0,\thick,0) -- cycle;
% frame
\draw [thick] (-\gap,\gap) -- ++(-\length,0)
-- ++(0,-\gap) -- ++(0,-\thick) -- ++(0,-\gap) % inner height
-- ++(\gap,0) -- ++(\length,0) -- ++(\length,0) -- ++(\length,0) -- ++(\gap,0) % inner bottom
-- ++(0,\gap) -- ++(0,\thick) -- ++(0,\gap) % inner height
-- ++(-\length,0)
-- ++(0,\thick)
-- ++(\length,0) -- ++(\thick,0)
-- ++(0,-\thick) -- ++(0,-\gap) -- ++(0,-\thick) -- ++(0,-\gap) -- ++(0,-\thick) % outer height
-- ++(-\thick,0) -- ++(-\gap,0) -- ++(-\length,0) -- ++(-\length,0) -- ++(-\length,0) -- ++(-\gap,0) -- ++(-\thick,0) % outer bottom
-- ++(0,\thick) -- ++(0,\gap) -- ++(0,\thick) -- ++(0,\gap) -- ++(0,\thick) % outer height
-- ++(\length,0) -- ++(\thick,0)
-- cycle;
};
}
\tikzset{
block_signal_top_view/.pic={
% lever
\draw [thick] (0,0) rectangle ++(\thick,\depth);
% frame
\draw [thick] (-\gap,0) -- ++(-\length,0) -- ++(-\thick,0)
-- ++(0,\depth)
-- ++(\length,0) -- ++(\thick,0)
-- cycle;
\draw [thick] (\length,0) -- ++(\length,0) -- ++(\thick,0)
-- ++(0,\depth)
-- ++(-\length,0) -- ++(-\thick,0)
-- cycle;
};
}
\tikzset{
track_straight/.pic={
% rails
\filldraw [base1!60] (0, 1.0) rectangle ++ (14.5, 0.5);
\filldraw [base1!60] (0,-1.0) rectangle ++ (14.5,-0.5);
% frame
\draw [thick] ( 0.0,-2.0) -- ( 0.0,-0.3) --
( 0.7,-0.3) arc[start angle=36.6, end angle=323.4, radius=-0.5] --
( 0.0,0.3) -- ( 0.0,2.0) --
(14.5,2.0) -- (14.5,0.3) --
(15.2,0.3) arc[start angle=323.4, end angle=36.6, radius=-0.5] --
(14.5,-0.3) -- (14.5,-2.0) -- cycle;
};
}
\tikzset{
track_curved/.pic={
% % rails
% \filldraw [base1!60] (0,3.0) rectangle ++ (14.5,0.5);
% \filldraw [base1!60] (0,0.5) rectangle ++ (14.5,0.5);
% % frame: radius (center) 20,5 cm
% \draw [thick] ( 0.0,0.0) -- ( 0.0,1.7) --
% ( 0.7,1.7) arc[start angle=36.6, end angle=323.4, radius=-0.5] --
% ( 0.0,2.3) -- ( 0.0,4.0) --
% (14.5,4.0) -- (14.5,2.3) --
% (15.2,2.3) arc[start angle=323.4, end angle=36.6, radius=-0.5] --
% (14.5,1.7) -- (14.5,0.0) -- cycle;
};
}
\begin{tikzpicture}
% \pic at ( 0.0,0) {track_straight};
% \pic at (14.5,0) {track_straight};
% \pic at (14.5,0) {block_signal};
\pic at (14.5,4) {block_signal_cross_section};
\pic at (14.5,0) {block_signal_top_view};
\end{tikzpicture}