expoweb/documents/therionprotractors/therionpage.tex

361 lines
11 KiB
TeX

\documentclass[12pt,a4paper]{article}
%\documentclass[12pt,letter]{article}
% if using letter, make margin=5mm
% Change the scale using the value on line 24, and the size of the divisions on line 27
% The protractors are 4cm in radius
% packages
\usepackage{tikz}
\usepackage[outline]{contour}
\usepackage{standalone}
\usepackage[margin=10mm]{geometry}
\newcommand{\therionprotract}{
\begin{tikzpicture}[scale=1]
\contourlength{1.2pt}
% multiple styles
% Therionfalse generates table of cotangents
% Colourflase does what you'd expect
\newif\ifTherion
\newif\ifColour
%\Therionfalse
\Theriontrue
%\Colourfalse
\Colourtrue
% ********************************************************************************
% Set the coordinates and dimensions to draw from
% ********************************************************************************
% Origin
\coordinate (O) at (0,0);
% Scale of the protractor, change this to the desired scale
\pgfmathsetmacro{\scaleto}{250} % 1:scaleto
% Size of the major divisions on the linear scale
\pgfmathsetmacro{\majordivision}{1} % size in meters
% Size of the text numbers
\newcommand{\textsize}{\footnotesize}
% Intrinisc dimensions and conversion factors
\pgfmathsetmacro{\convert}{100} % conversion from meters to centimeters
\pgfmathsetmacro{\mintick}{0.1} % size in centimeters
\pgfmathsetmacro{\majtick}{0.2} % size in centimeters
\pgfmathsetmacro{\minradii}{0.5} % fractional radius where dotted radial lines start
\pgfmathsetmacro{\minradiiend}{1-\minradii} % remainder
% Size and scale of the drawing
\pgfmathsetmacro{\rad}{4} % size on page in cm
\pgfmathsetmacro{\majdiv}{\majordivision*\convert/\scaleto} % size on page in cm
\pgfmathsetmacro{\mindiv}{0.5*\majdiv} % size on page in cm
% Slightly reduced radii for the scale bar
\pgfmathsetmacro{\radscale}{\rad-\majdiv}
\pgfmathsetmacro{\linscale}{\rad-\mindiv}
% Numbers for labelling
\pgfmathsetmacro{\radius}{\rad*\scaleto/\convert} % size in meters
\pgfmathsetmacro{\minordivision}{0.5*\majordivision} % size in meters
% ********************************************************************************
% Draw the foreshortening lines
% ********************************************************************************
\ifTherion
% Vertical lines
\foreach \var in {0,\majdiv,...,\radscale}
{
\draw[gray] (O) ++ (\var,0) -- ++ (0,\rad);
\draw[gray] (O) ++ (-\var,0) -- ++ (0,\rad);
}
% White out the excess length
\draw[thick,white,fill=white] (O) ++ (\rad,0) arc(0:180:\rad) -- ++ (0,\rad) -- ++ (2*\rad,0) -- cycle;
% ********************************************************************************
% Draw the circumcircles
% ********************************************************************************
\foreach \var in {0,\majdiv,...,\rad}
{
\draw[gray] (O) ++ (\var,0) arc (0:180:\var);
}
\fi
% ********************************************************************************
% Draw the radii
% ********************************************************************************
%
% note these colours are duplicated from the Steve Wells and Joe Zokaties
% ``Cave Survey protractor'' previously sold % by american caving vendor IMO.
% Because of the black at 90, they are not evenly divided.
\ifColour
\foreach \theta in {10,50,100,140}
{
\draw[blue] (O) ++ (\theta:\majdiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {20,60,110,150}
{
\draw[pink] (O) ++ (\theta:\majdiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {30,70,120,160}
{
\draw[green] (O) ++ (\theta:\majdiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {40,80,130,170}
{
\draw[gray] (O) ++ (\theta:\majdiv) -- ++ (\theta:\radscale);
}
\else
\foreach \theta in {10,20,...,170}
{
\draw[black] (O) ++ (\theta:\majdiv) -- ++ (\theta:\radscale);
}
\fi
\ifTherion
\foreach \theta in {5,15,...,175}
{
\draw[black,dotted] (O) ++ (\theta:\minradii*\rad) -- ++ (\theta:\minradiiend*\rad);
}
\fi
\draw[black,thick] (O) ++ (90:0) -- ++ (90:\radscale);
% ********************************************************************************
% Draw the angular scale
% ***************************h*****************************************************
\foreach \theta in {1,2,...,179}
{
% draw ticks from slightly outside of circle
\draw[black] (O) ++ (\theta:\rad+\mintick) -- ++ (\theta:-2*\mintick);
}
\foreach \theta in {5,10,...,175}
{
\draw[black,thick] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick);
}
% ********************************************************************************
% Draw the linear scale
% ********************************************************************************
\foreach \var in {0,\mindiv,...,\linscale}
{
% draw ticks from slightly outside of circle
\ifColour
\draw[red,thick] (O) ++ (-\var,-\mintick) -- ++ (0,2*\mintick);
\else
\draw[black,thick] (O) ++ (-\var,-\mintick) -- ++ (0,2*\mintick);
\fi
\draw[black,thick] (O) ++ (\var,-\mintick) -- ++ (0,2*\mintick);
}
%this is done in the numeric section. very weird
%
%\foreach \var in {0,\majdiv,...,\linscale}
%{
% \draw[black,thick] (O) ++ (\var,0) -- ++ (0,\majtick);
% \draw[red,thick] (O) ++ (-\var,0) -- ++ (0,\majtick);
%}
% ********************************************************************************
% Draw the outline
% ********************************************************************************
\draw[black,thick] (O) ++ (\rad,0) arc (0:180:\rad) -- cycle;
%\draw[black,thick] (O) -- ++ (0,\majtick);
% ********************************************************************************
% Draw the angle numbers
% ********************************************************************************
%
% note: we offset these in order to use a larger font and maintain legibility
%
\foreach \theta in {10,30,...,70}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick) node[anchor=north,near start,sloped,rotate=-90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\ifColour
\contour{white}{\color{red}\pgfmathprintnumber{\thetaopposite}}
\else
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\fi
\end{tabular}
};
}
\foreach \theta in {20,40,...,80}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-5*\majtick) node[anchor=north,near start,sloped,rotate=-90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\ifColour
\contour{white}{\color{red}\pgfmathprintnumber{\thetaopposite}}
\else
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\fi
\end{tabular}
};
}
\foreach \theta in {90,110,...,170}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick) node[anchor=north,near start,sloped,rotate=90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\ifColour
\contour{white}{\color{red}\pgfmathprintnumber{\thetaopposite}}
\else
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\fi
\end{tabular}
};
};
\foreach \theta in {100,120,...,160}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-5*\majtick) node[anchor=north,near start,sloped,rotate=90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\ifColour
\contour{white}{\color{red}\pgfmathprintnumber{\thetaopposite}}
\else
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\fi
\end{tabular}
};
};
% ********************************************************************************
% Draw the linear numbers
% ********************************************************************************
%\pgfmathsetmacro{\labmax}{\radius-\majordivision}
% FIXME this should be computable. need to figure out height of table from above section!
\pgfmathsetmacro{\labmax}{7} %hardcode as 7 so things fit right
\pgfmathsetmacro{\labsecond}{\majordivision+\majordivision}
\foreach \var in {\majordivision,\labsecond,...,\labmax}
{
\pgfmathsetmacro{\varpos}{\var*\convert/\scaleto}
\draw[black,thick] (O) ++ (\varpos,0) -- ++ (0,\majtick) node [above=-2pt] {\contour{white}{\textsize\pgfmathprintnumber{\var}}};
\ifColour
\draw[red,thick] (O) ++ (-\varpos,0) -- ++ (0,\majtick) node [above=-2pt] {\contour{white}{\textsize\color{red}\pgfmathprintnumber{\var}}};
\else
\draw[black,thick] (O) ++ (-\varpos,0) -- ++ (0,\majtick) node [above=-2pt] {\contour{white}{\textsize\pgfmathprintnumber{\var}}};
\fi
}
\draw[black,thick] (O) ++ (0,0) -- ++ (0,\majtick) node [above=-2pt] {\contour{white}{\textsize\pgfmathprintnumber{0}}};
% ********************************************************************************
% Draw the scale number
% ********************************************************************************
\ifTherion
\draw[black] (O) ++ (0,\rad/3) -- ++ (0,\rad/3) node [midway,anchor=center,sloped,text=black] {\contour{white}{\tiny $1$:\pgfmathprintnumber{\scaleto}}};
\else
\draw[black] (O) ++ (0,\rad/8) -- ++ (0,\rad/8) node [midway,anchor=center,text=black] {\contour{white}{\tiny $1$:\pgfmathprintnumber{\scaleto}}};
% Draw a table of conversions for non-therion
\renewcommand{\arraystretch}{0.1}
\draw[black] (O) ++ (0,\rad/3) -- ++ (0,\rad/3) node [midway,anchor=center,sloped,rotate=180,text=black]
{
\tiny
\setlength{\tabcolsep}{1pt}
\begin{tabular}{cl}
\contour{white}{0} & --- \\
& \contour{white}{1.0} \\
\contour{white}{18} & --- \\
& \contour{white}{0.9} \\
\contour{white}{32} & --- \\
& \contour{white}{0.8} \\
\contour{white}{41} & --- \\
& \contour{white}{0.7} \\
\contour{white}{50} & --- \\
& \contour{white}{0.6} \\
\contour{white}{57} & ---\\
& \contour{white}{0.5} \\
\contour{white}{63} & ---\\
& \contour{white}{0.4} \\
\contour{white}{70} & --- \\
& \contour{white}{0.3} \\
\contour{white}{76} & ---\\
& \contour{white}{0.2} \\
\contour{white}{81} & ---\\
& \contour{white}{0.1} \\
\contour{white}{87} & ---
\end{tabular}
};
%\draw[clear] (O) ++ (0,\rad/3) -- ++ (0,\rad/3) node [midway,anchor=center,sloped,rotate=180,text=black]
\fi
\end{tikzpicture}
}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\pgfmathsetmacro{\xdist}{8.5}
\pgfmathsetmacro{\ydist}{4.5}
\foreach \xval in {1,2}
{
\foreach \yval in {1,2,...,6}
{
\node at (\xval*\xdist,\yval*\ydist) {\therionprotract};
}
}
\end{tikzpicture}
\end{figure}
\end{document}