[OS X TeX] Angular Vernier scale
Aaron Jackson
jackson at msrce.howard.edu
Sun Jun 2 12:42:48 EDT 2013
On Jun 2, 2013, at 12:37 PM, Aaron Jackson <jackson at msrce.howard.edu> wrote:
>
> On Jun 2, 2013, at 12:38 AM, Michael Sharpe <msharpe at ucsd.edu> wrote:
>
>>
>> On Jun 1, 2013, at 6:42 PM, Aaron Jackson <jackson at msrce.howard.edu> wrote:
>>
>>> On Jun 1, 2013, at 4:15 PM, Michael Sharpe <msharpe at ucsd.edu> wrote:
>>>
>>>>
>>>> On Jun 1, 2013, at 12:21 PM, Aaron Jackson <jackson at msrce.howard.edu> wrote:
>>>>
>>>>> I have to make some documentation for a piece of scientific equipment. This will entail making quite a few illustrations of different settings on an angular vernier scale, similar to the one show here
>>>>>
>>>>> http://www.craftsmanspace.com/sites/default/files/free-knowledge-articles/bevel_protractor_vernier_scale.jpg
>>>>>
>>>>> Does anybody know an easy way to draw this sort of scale?
>>>>>
>>>>> Thanks,
>>>>>
>>>>
>>>> The LaTeX packages pstricks and tikz/pgf would be suitable, as would a number of others. There is code on which you could base your drawing at
>>>>
>>>> http://tug.org/PSTricks/main.cgi?file=examples#compass
>>>>
>>>> or
>>>>
>>>> http://www.texample.net/tikz/examples/degree-wheel/
>>>>
>>>> Michael
>>>
>>> Thanks for the pointer. For completeness, this is what I came up with. It is a modified version of the tikz example:
>>>
>>> % A simple compass
>>> % Author: Dario Orescanin
>>>
>>> \documentclass{minimal}
>>> \usepackage{tikz}
>>> \begin{document}
>>>
>>> \begin{centering}
>>>
>>> % Define a few constants for easy configuration
>>> \def\radius{2cm}
>>> \def\onedegrad{1.8cm}
>>> \def\fivedegrad{1.75cm}
>>> \def\tendegrad{1.7cm}
>>> \def\labelrad{1.6cm}
>>>
>>> \def\minradius{2.3cm}
>>> \def\fifteenmin{2.2cm}
>>> \def\fivemin{2.1cm}
>>> \def\minlabel{2.25cm}
>>> \def\vernierunit{1.9}
>>> \def\verniercount{10}
>>> \def\rotation{31.6}
>>>
>>> \begin{tikzpicture}[scale=4]
>>>
>>> % adding a subtle gray tone to add a bit of "personality"
>>> \shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius);
>>>
>>> \draw (0,0) circle (\radius);
>>> \draw[fill=black] (0,0) circle (.02mm);
>>> \node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
>>>
>>> % helper lines
>>> \foreach \x in {0, 45, ..., 360} \draw[very thin, gray!40] (a) -- (\x+\rotation:\radius);
>>>
>>> % main lines
>>> \foreach \x in {0,...,359} \draw (\x+\rotation:\onedegrad) -- (\x+\rotation:\radius);
>>>
>>> % labels and longer lines at every 10 degrees
>>> \foreach \x in {0,10,...,350}
>>> {
>>> \node[scale=1.4] at (270-\x+\rotation:\labelrad) {\x};
>>> \draw (\x+\rotation:\tendegrad) -- (\x+\rotation:\radius);
>>> };
>>>
>>> % lines at every 5 degrees
>>> \foreach \x in {0,5,...,355} \draw (\x+\rotation:\fivedegrad) -- (\x+\rotation:\radius);
>>> \draw (0,0) circle (\minradius);
>>> \foreach \x in {0,...,20} \draw (270-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (270-\vernierunit*\verniercount+\x*\vernierunit:\fivemin);
>>> \foreach \x in {0,5,...,20} \draw (270-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (270-\vernierunit*\verniercount+\x*\vernierunit:\fifteenmin);
>>> \node at (270:\minlabel) {0'};
>>> \node at (270-\vernierunit*\verniercount:\minlabel) {60'};
>>> \node at (270+\vernierunit*\verniercount:\minlabel) {60'};
>>> \node at (270-\vernierunit*\verniercount+5*\vernierunit:\minlabel) {30'};
>>> \node at (270-\vernierunit*\verniercount+15*\vernierunit:\minlabel) {30'};
>>> \end{tikzpicture}
>>> \end{centering}
>>> \end{document}
>>>
>> My brief attempt using pstricks, with which I am more familiar:
>>
>> % !TEX TS-program = latex
>> \documentclass{article}
>> \usepackage{pstricks-add}
>> \pagestyle{empty}
>> \parindent=0pt
>> \def\ctr{(0,0)}
>> \def\orad{7}
>> \def\irad{6}
>> \def\irada{5.6}
>> \def\iradb{5.8}
>> \def\xx{3} % -3 to 3
>> \def\ymin{5}
>> \def\ymax{7.5}
>> \def\angoffset{24.5}
>> \def\lw{1.2pt}
>> \begin{document}
>> %
>> \psset{unit=1in}
>> \def\extscale{\multido{\iA=0+1}{360}{\psrline[linewidth=\lw](\irad;\iA)(.4;\iA)}
>> \multido{\iA=0+5,\iB=-90+10}{72}{\psrline[linewidth=\lw](\irad;\iA)(.5;\iA)}\multido{\iA=0+10,\iB=-90+10,\iC=90+-10}{36}{\psrline[linewidth=\lw](\irad;\iA)(.6;\iA)\rput{\iB}(6.75;\iA){\iC}}}%
>> \begin{pspicture*}(-\xx,\ymin)(\xx,\ymax)%
>> \pscircle{\orad}%
>> \pscircle{\irad}%
>> \rput{\angoffset}(0,0){\extscale}%
>> \multido{\rA=67+1.91667}{25}{\psrline[linewidth=\lw](\iradb;\rA)(.2;\rA)}%
>> \multido{\rA=67+5.75,\rB=-23+5.75,\iA=60+-15}{9}{\psrline[linewidth=\lw](\irada;\rA)(.4;\rA)%
>> \rput{\rB}(5.5;\rA){\iA}}%
>> \end{pspicture*}
>>
>> \vspace{1pc}
>> Angular Vernier scale
>> \end{document}
>>
>
>
> Interesting example, although your vernier scale is a little bit strange. The vernier gives accuracy to 0.0833... degrees. That is, you can only use it to measure angles whose decimal part is a multiple of 0.0833... in order for the vernier to line up properly i.e x.0, x.5, x.08333..., x.1666..., etc
>
> Usually, the angular vernier divisions are spaced 6 units apart, since there are 60 minutes in one degree. That way you can get an angular resolution of .1 degree. Also, the vernier scale usually spans 38 degrees, or 28 degrees or 18 degrees..., etc
>
> I would change your example and repost it, but pstricks confuses me.
>
> Aaron
>
BTW, this is an updated version of my previous code for posterity:
% A simple compass
% Author: Dario Orescanin
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{centering}
% Define a few constants for easy configuration
\def\radius{2cm}
\def\onedegrad{1.8cm}
\def\fivedegrad{1.75cm}
\def\tendegrad{1.7cm}
\def\labelrad{1.6cm}
\def\minradius{2.3cm}
\def\fifteenmin{2.2cm}
\def\fivemin{2.1cm}
\def\minlabel{2.25cm}
\def\vernierunit{1.9}
\def\verniercount{10}
\def\rotation{-26.7}
\def\zeroOffset{270}
\begin{tikzpicture}[scale=3.5]
\clip (-1.25,-2.4) rectangle (1.25,-1.25);
% adding a subtle gray tone to add a bit of "personality"
\shade[shading=radial, inner color=white, outer color=gray!15] (0,0) circle (\radius);
\draw (0,0) circle (\radius);
\draw[fill=black] (0,0) circle (.02mm);
\node[draw, circle, inner sep=.2mm] (a) at (0,0) {};
% helper lines
% \foreach \x in {0, 45, ..., 360} \draw[very thin, gray!40] (a) -- (\x+\rotation:\radius);
% main lines
\foreach \x in {0,...,359} \draw (\x+\rotation:\onedegrad) -- (\x+\rotation:\radius);
% labels and longer lines at every 10 degrees
\foreach \x in {0,10,...,350}
{
\node[scale=1.4] at (270-\x+\rotation:\labelrad) {\x};
\draw (\x+\rotation:\tendegrad) -- (\x+\rotation:\radius);
};
% lines at every 5 degrees
\foreach \x in {0,5,...,355} \draw (\x+\rotation:\fivedegrad) -- (\x+\rotation:\radius);
\draw (0,0) circle (\minradius);
\foreach \x in {0,...,20} \draw (\zeroOffset-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (\zeroOffset-\vernierunit*\verniercount+\x*\vernierunit:\fivemin);
\foreach \x in {0,5,...,20} \draw (\zeroOffset-\vernierunit*\verniercount+\x*\vernierunit:\radius) -- (\zeroOffset-\vernierunit*\verniercount+\x*\vernierunit:\fifteenmin);
\pgfmathsetmacro{\y}{round(mod(10*\rotation,10))? round(mod(10*\rotation,10)) : 10};
\node at (\zeroOffset:\minlabel) {0};
\node at (\zeroOffset-\vernierunit*\verniercount:\minlabel) {60'};
\node at (\zeroOffset+\vernierunit*\verniercount:\minlabel) {60'};
\node at (\zeroOffset-\vernierunit*\verniercount+5*\vernierunit:\minlabel) {30'};
\node at (\zeroOffset-\vernierunit*\verniercount+15*\vernierunit:\minlabel) {30'};
\draw[red] (\zeroOffset:2*\radius-\fivemin) -- (\zeroOffset:\fivemin);
\draw[red] (\zeroOffset-\vernierunit*\y:2*\radius-\fivemin) -- (\zeroOffset-\vernierunit*\y:\fivemin);
\pgfmathtruncatemacro{\z}{\y}
\pgfmathtruncatemacro{\a}{round(\rotation)};
\ifnum\a=0\ifnum\z=10\draw[red] (\zeroOffset-\vernierunit*-\y:2*\radius-\fivemin) -- (\zeroOffset-\vernierunit*-\y:\fivemin);\fi\fi
\end{tikzpicture}
\end{centering}
\end{document}
More information about the MacOSX-TeX
mailing list