expoweb/documents/therionprotractors/therionpage.tex

221 lines
6.7 KiB
TeX
Raw Normal View History

\documentclass[12pt,a4paper]{article}
2016-05-02 16:32:43 +01:00
2016-07-27 21:46:38 +01:00
% Change the scale using the value on line 24, and the size of the divisions on line 27
% The protractors are 4cm in radius
2016-05-02 16:32:43 +01:00
% packages
\usepackage{tikz}
\usepackage[outline]{contour}
\usepackage{standalone}
\usepackage[margin=10mm]{geometry}
2016-05-02 16:32:43 +01:00
2016-07-27 21:46:38 +01:00
\newcommand{\therionprotract}{
\begin{tikzpicture}[scale=1]
\contourlength{1.2pt}
% ********************************************************************************
% 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
2016-07-27 21:46:38 +01:00
% Size of the major divisions on the linear scale
\pgfmathsetmacro{\majordivision}{1} % size in meters
% Size of the text numbers
\newcommand{\textsize}{\tiny}
% 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-\mindiv}
% Numbers for labelling
\pgfmathsetmacro{\radius}{\rad*\scaleto/\convert} % size in meters
\pgfmathsetmacro{\minordivision}{0.5*\majordivision} % size in meters
% ********************************************************************************
% Draw the foreshortening lines
% ********************************************************************************
% Vertical lines
\foreach \var in {0,\mindiv,...,\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,\mindiv,...,\rad}
{
\draw[gray] (O) ++ (\var,0) arc (0:180:\var);
}
% ********************************************************************************
% Draw the radii
% ********************************************************************************
\foreach \theta in {10,40,...,160}
{
\draw[red] (O) ++ (\theta:\mindiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {20,50,...,170}
{
\draw[blue] (O) ++ (\theta:\mindiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {30,60,...,150}
{
\draw[black] (O) ++ (\theta:\mindiv) -- ++ (\theta:\radscale);
}
\foreach \theta in {5,15,...,175}
{
\draw[black,dotted] (O) ++ (\theta:\minradii*\rad) -- ++ (\theta:\minradiiend*\rad);
}
% ********************************************************************************
% Draw the angular scale
% ***************************h*****************************************************
2016-07-27 21:46:38 +01:00
\foreach \theta in {1,2,...,179}
{
\draw[black,thick] (O) ++ (\theta:\rad) -- ++ (\theta:-\mintick);
}
\foreach \theta in {5,10,...,175}
{
\draw[black,thick] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick);
}
% ********************************************************************************
% Draw the linear scale
% ********************************************************************************
\foreach \var in {0,\mindiv,...,\radscale}
{
\draw[black,thick] (O) ++ (\var,0) -- ++ (0,\mintick);
\draw[black,thick] (O) ++ (-\var,0) -- ++ (0,\mintick);
}
\foreach \var in {0,\majdiv,...,\radscale}
{
\draw[black,thick] (O) ++ (\var,0) -- ++ (0,\majtick);
\draw[black,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
% ********************************************************************************
\foreach \theta in {10,20,...,80}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick) node[anchor=south,near start,sloped,rotate=90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\end{tabular}
};
}
\foreach \theta in {90,100,...,170}
{
\pgfmathsetmacro{\thetaopposite}{\theta+180}
\draw[black] (O) ++ (\theta:\rad) -- ++ (\theta:-\majtick) node[anchor=south,near start,sloped,rotate=-90,text=black] {
\textsize
\begin{tabular}{c}
\contour{white}{\pgfmathprintnumber{\theta}}\\
\contour{white}{\pgfmathprintnumber{\thetaopposite}}
\end{tabular}
};
};
% ********************************************************************************
% Draw the linear numbers
% ********************************************************************************
\pgfmathsetmacro{\labmax}{\radius-\majordivision}
\pgfmathsetmacro{\labsecond}{\majordivision+\majordivision}
\foreach \var in {\majordivision,\labsecond,...,\labmax}
{
\pgfmathsetmacro{\varpos}{\var*\convert/\scaleto}
\draw[black,thick] (O) ++ (\varpos,0) -- ++ (0,\mintick) node [above=-2pt] {\contour{white}{\textsize\pgfmathprintnumber{\var}}};
\draw[black,thick] (O) ++ (-\varpos,0) -- ++ (0,\mintick) node [above=-2pt] {\contour{white}{\textsize\pgfmathprintnumber{\var}}};
}
% ********************************************************************************
% Draw the scale number
% ********************************************************************************
\draw[black] (O) ++ (0,\rad/3) -- ++ (0,\rad/3) node [midway,anchor=center,sloped,text=black] {\contour{white}{\textsize $1$:\pgfmathprintnumber{\scaleto}}};
\end{tikzpicture}
}
2016-05-02 16:32:43 +01:00
\begin{document}
\begin{figure}
\centering
2016-05-02 16:32:43 +01:00
\begin{tikzpicture}
\pgfmathsetmacro{\xdist}{8.5}
\pgfmathsetmacro{\ydist}{4.5}
\foreach \xval in {1,2}
{
\foreach \yval in {1,2,...,6}
2016-05-02 16:32:43 +01:00
{
2016-07-27 21:46:38 +01:00
\node at (\xval*\xdist,\yval*\ydist) {\therionprotract};
2016-05-02 16:32:43 +01:00
}
}
\end{tikzpicture}
\end{figure}
\end{document}