我需要组合一个渐开线(https://en.wikipedia.org/wiki/Involute) 在一个 TikZ 绘图中绘制了一个圆和一条阿基米德螺线,但在绘制渐开线时遇到了问题。
我需要这样的东西:
这是我的代码:
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\begin{tikzpicture}[x=1mm, y=1mm]
\draw[] (0, 0) circle (7mm);
\draw[rotate=-90, blue, domain=0:2*pi, variable=\a, samples=500]
plot[fixed point arithmetic] ({\a r}:{7*sqrt(1+pow(\a, 2))});
\draw[rotate=-90, red, domain=0:2*pi, variable=\a, samples=500]
plot[fixed point arithmetic] ({\a r}:{(7*\a)});
\end{tikzpicture}
输出为:
发现我的错误,这里是渐开线和圆的代码:
\def\r{7}
% Circle
\draw[line width=0.1mm, domain=0:2*pi, variable=\t, samples=500]
plot[fixed point arithmetic] ({\r*cos(deg(\t))}, {\r*sin(deg(\t))});
% Involute
\draw[blue, line width=0.1mm, domain=0:2*pi, variable=\t, samples=500]
plot[fixed point arithmetic] ({\r*(cos(deg(\t))+\t*sin(deg(\t)))}, {\r*(sin(deg(\t))-\t*cos(deg(\t)))});
% Spiral
\draw[red, rotate=-90, line width=0.1mm, domain=0:2*pi, variable=\t, samples=500]
plot[fixed point arithmetic] ({\t r}:{(7*\t)});
固定输出为:
答案1
我将为此使用 PGFPlots:
\documentclass{article} \usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
trig format plots=rad,
samples=300,
axis equal image,
xtick=\empty, ytick=\empty,
axis lines=middle, enlargelimits=true
]
\addplot [
no markers,
black,
thick,
domain=0:6.4844*pi
] ( {cos(x) + x*sin(x)}, { sin(x) - x*cos(x)} );
\addplot [
no markers,
red,
thick,
domain=0:6*pi
] ( {x * cos(x)}, { x* sin(x) } );
\end{axis}
\end{tikzpicture}
\end{document}