![绘制数学量角器](https://linux22.com/image/468463/%E7%BB%98%E5%88%B6%E6%95%B0%E5%AD%A6%E9%87%8F%E8%A7%92%E5%99%A8.png)
我怎样才能用 重现此图像TikZ
。
这是我尝试过的。
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pict2e}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\usetikzlibrary{fadings}
\usepackage{graphicx}
\usepackage{tikz,tkz-tab}
\usepackage[T1]{fontenc}
\usepackage{beton, euler}
\begin{document}
\begin{tikzpicture}[scale=1]
%simple flèche
\tikzstyle simple=[postaction={decorate,decoration={markings, mark=at position .5 with {\arrow[scale=1,>=stealth]{>}}}}]
%simple flèches inverse
\tikzstyle simpleinv=[postaction={decorate,decoration={markings, mark=at position .5 with {\arrow[scale=1,>=stealth]{<}}}}]
\def \rayon{2};
\def \i{40};
\def \r{25.4};
\draw (0,0) circle (\rayon);
\foreach \y in {10,20,...,360} \draw({\rayon*cos(\y)},{\rayon*sin(\y)})--++(\y:-0.2);
\foreach \y in {0,90,...,270} \draw[thick]({\rayon*cos(\y)},{\rayon*sin(\y)})--++(\y:-0.3);
\draw[dotted](0,\rayon)--++(0,-2*\rayon);
\draw[dotted](-\rayon,0)--++(2*\rayon,0);
\end{tikzpicture}
\end{document}
答案1
我强烈建议使用极坐标(θ:r)
。
\documentclass{article}
\usepackage{tikz}
\newcommand{\rayon}{2}
\begin{document}
\begin{tikzpicture}[every node/.style={scale=.4}]
\draw[thick] (0:\rayon) arc(0:180:\rayon);
\draw (0:\rayon-.1) arc(0:180:\rayon-.1);
\foreach \t in {0,...,180}{\draw[very thin](\t:\rayon)--(\t:\rayon-.1);}
\foreach \t in {0,5,...,180}{\draw(\t:\rayon)--(\t:\rayon-.2);}
\foreach \t in {0,10,...,180}{\draw(\t:\rayon)--(\t:\rayon-.3)node[pos=1.2, rotate=\t-90]{\t};}
\foreach \t[count=\n from 0] in {0,30,...,180}{\fill(\t:\rayon-.5)circle[radius=.4pt]--++(180+\t:.2)node{$M_\n$};}
\draw(180:\rayon-.9)--(0:\rayon-.9)(90:\rayon-.9)--(0,0)node[below]{0}node[above right]{$(\Delta)$}node{$\times$};
\end{tikzpicture}
\end{document}
答案2
这是我碰巧闲置的一个,它可能是一个合适的起点。
这个是在元帖子,包裹在luamplib
所以请使用 进行编译lualatex
。
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\usepackage{fontspec}
\setmainfont{TeX Gyre Heros}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
color plastic; plastic = 1/256(215,205,190);
path lower_base, upper_base, inner_arc, outer_arc;
upper_base = (left--right) scaled 5.2 cm;
lower_base = upper_base shifted (0,-1.6cm);
inner_arc = halfcircle scaled 5.4cm;
outer_arc = halfcircle scaled 8.8cm;
% make the plastic body
fill lower_base -- point 1 of upper_base -- outer_arc -- point 0 of upper_base -- cycle withcolor plastic;
unfill inner_arc -- cycle;
% draw the scale along the base
for t = 0 upto 100:
x := 50-t;
draw (origin -- if x mod 10 = 0: 8 elseif x mod 5 = 0: 6 else: 5 fi up) shifted (x*mm, ypart point 0 of lower_base);
if x mod 10 = 0:
label.top(decimal (t/10) infont defaultfont scaled 0.7
rotated 180, (x*mm,ypart point 0 of lower_base + 9));
fi
endfor
% and the scale around the arc
for t = 0 upto 180:
draw (origin -- if t mod 10=0: 16 elseif t mod 5=0: 12 else: 8 fi left)
shifted point 0 of outer_arc rotated t;
if t mod 10=0:
if t=90:
label("90" infont defaultfont scaled 1.4, 26 down shifted point 2 of outer_arc);
else:
label(decimal t infont defaultfont scaled 0.7 rotated (t-90), 22 left shifted point 0 of outer_arc rotated t);
label(decimal (180-t) infont defaultfont scaled 0.7 rotated (t-90), 30 left shifted point 0 of outer_arc rotated t)
withcolor .78 red;
fi
fi
endfor
% finally mark the middle
draw origin -- 4 down;
unfill fullcircle scaled 2;
endfig;
\end{mplibcode}
\end{document}
答案3
包裹工具GeomTikz提供了绘制保护器的命令。不过,软件包文档和命令都是法语的。我认为目前还没有该文档的英文翻译。
\documentclass{article}
\usepackage{OutilsGeomTikz}
\begin{document}
\begin{tikzpicture}
\tkzRapporteur
\end{tikzpicture}
\end{document}
答案4
碰巧有这个:
\documentclass{article}
\thispagestyle{empty}
\usepackage[landscape]{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw (-4,0) -- (4,0) arc[radius=4,start angle=0,delta angle=180];
\foreach \ang in {1,...,179}
{
\pgfmathsetmacro\len{mod(\ang,5) == 0 ? .5 : .2}
\pgfmathsetmacro\lbl{mod(\ang,5) == 0 ? \ang : ""}
\draw (\ang:4) -- (\ang:4-\len) node[circle,anchor=\ang] {\lbl};
\draw (\ang:2.5) -- (\ang:2.5+\len);
}
\draw (0,0) -- +(0,.5);
\draw (2.5,0) arc[radius=2.5, start angle=0, delta angle=180];
\draw (-2.45,.5) -- (2.45,.5);
\end{tikzpicture}
\end{document}