我正在尝试绘制一对所谓的 Rømer 轮子:
这是两个相互滚动的对数螺旋,一个顺时针,另一个逆时针,但是我给出的第二个轮子的旋转角度乘以第一个轮子的给定角度的方程似乎是错误的(我使用的是极坐标)。
以下是 TikZ 代码:
\documentclass[12pt, border=0.5mm]{standalone}
\usepackage{tikz}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\begin{document}
\begin{tikzpicture}[x=1mm, y=1mm]
\draw[line cap=round, line width=0.2mm, domain=0:2*pi, variable=\t, samples=100, yshift=8.0072mm, rotate around={-100:(0,0)}]
plot[fixed point arithmetic] ({\t r}:{1.2*exp(0.4*\t)}) -- cycle;
\draw[line cap=round, line width=0.2mm, domain=0:2*pi, variable=\t, samples=100, yshift=-8.0072mm, rotate around={90.6709:(0,0)}]
plot[fixed point arithmetic] ({\t r}:{1.2*exp(0.4*\t)}) -- cycle;
\end{tikzpicture}
\end{document}
输出:
答案1
使用长度作为参数。然后ln
它。
\documentclass[border=9,tikz]{standalone}
\begin{document}
\def\n{30}\def\.{.71828}
\foreach\r in{1,...,\n}{
\pgfmathsetmacro\s{1+\r*1\./\n}
\tikz{
\fill[black](-3,-3)rectangle(3,6\.);
\draw[white,line cap=round,domain=1:2\.,variable=\t,samples=100]
plot[shift={(0,3\.)},rotate={-360*ln( \s)-90}]({360*ln( \t)}:{ \t})--cycle
plot[shift={(0, 0)},rotate={-360*ln(3\.-\s)+90}]({360*ln(3\.-\t)}:{3\.-\t})--cycle;
}
}
\end{document}
答案2
以下是我的解决方案:
\begin{tikzpicture}[x=1mm, y=1mm]
% Largest radius
\def\l{3.25};
% Rotation angle in radians
\def\a{1.2*pi};
% Second parameter of the spiral
\def\b{0.25}
\begin{scope}[rotate=-90]
\pgfmathsetmacro{\shift}{{\l*exp(\b*2*pi)+\l}}
\pgfmathsetmacro{\angle}{ln((\shift - \l*exp(\b*\a))/\l)/\b}
% Spiral (bottom)
\begin{scope}[rotate around={{180-deg(\angle)}:(0, 0)}]
\draw[line width=0.075mm, domain=0:2*pi, variable=\t, samples=500]
plot[fixed point arithmetic] ({\l*exp(\b*\t)*cos(deg(\t))}, {\l*exp(\b*\t)*sin(deg(\t))}) -- cycle;
\end{scope}
% Spiral (top)
\begin{scope}[rotate around={{-deg(\a)}:(-\shift, 0)}]
\draw[line width=0.075mm, domain=0:2*pi, variable=\t, samples=500]
plot[fixed point arithmetic] ({-\shift + \l*exp(\b*\t)*cos(deg(\t))}, {\l*exp(\b*\t)*sin(deg(\t))}) -- cycle;
\end{scope}
\end{scope}
\end{tikzpicture}