我想要一个类似以下的数字:
\documentclass[tikz,margin=10pt]{standalone}
\usepackage{mathtools,amssymb}
\begin{document}
\begin{tikzpicture}[scale=2,transform shape]
\draw (1,0) arc (0:90:1);
\draw (-1,0) arc (180:270:1);
\draw[fill=gray!30] (-1,0) -- (-2,0) arc (180:90:2) -- (0,1) arc (90:180:1);
\draw[fill=gray!30] (1,0) -- (2,0) arc (0:-90:2) -- (0,-1) arc (-90:0:1);
\node at (0.2,0.75) {\tiny $\phi^2$};
\node[rotate=50] at (-0.7,0.5) {\tiny $t=0$};
\node[rotate=50] at (0.7,-0.5) {\tiny $t=0$};
\node[rotate=50] at (-1.45,1.2) {\tiny $t=1$};
\node[rotate=50] at (1.45,-1.2) {\tiny $t=1$};
\node[rotate=50] at (-1.6,1.4) {\tiny $\partial \varphi (1)$};
\node[rotate=50] at (1.6,-1.4) {\tiny $\partial \varphi (1)$};
\node at (-2,2) {\tiny $\Omega_1$};
\node at (2,-2) {\tiny $\Omega_2$};
\node at (-1,1) {\tiny $\Delta \mathfrak{M}^2$};
\node at (1,-1) {\tiny $\Delta \mathfrak{M}^2$};
\end{tikzpicture}
\end{document}
已发展这里。
然而,这次我想要的数字应该是这样的:
考虑一个半径为 1 的圆。将圆分成 60 个对称圆弧。对于每个圆弧,从 0-6 度圆弧开始,将半径增加 ,$.05n$
n 在 1 到 60 之间。因此 354-360 圆弧的半径应为.05(60) + 1 =4
。就像上图一样,每个面积变化都应加阴影。以下是分成 12 个圆弧的类似物体的草图:
您可以看到,每个圆弧的半径都比前一个圆弧大,其中的波浪线表示阴影,标签为和$\{ \Omega \}_{i=1}^{n}$
。如能得到任何帮助,我们将不胜感激。$\phi^2$
$\partial \varphi$
答案1
这个答案展示了两到三种方法:
这第一的其中一个版本展示了预先评估几个常用值并将其保存在宏中的版本。此外,和\startAngle
被\endRadius
初始化为\foreach
循环仅添加\deltaAngle
角度和.05
半径。
然后使用循环\foreach
迭代各个段,但\iN
甚至不使用它们的数量 ( )。然后使用简单的数学运算来放置节点。
这第二解决方案使用我的 TikZ 库qrr.misc
其中包含一些“修复”和对 PGF 的补充。
使用的添加物是use int
钥匙允许\foreach
我们使用任意 PGFmath 进行循环\foreach
和full arc
键以及R
来自 PGFmath 的前缀。full arc
键类似于来自 PSTricks 的宏。它允许我们在 PGFmath 感知环境中指定,而不是计算元素的第个元素的\degrees[<n>]
角度(就像第三个解决方案的函数一样) 。我还添加了一个替代输出。这些解决方案可能比第一个解决方案慢,因为它们使用了更多的 PGfmath 并反复重新评估某些值(但当然我们也可以在 的键中使用它们)。<i>
<n>
arcAngle
<i> R
\foreach
evaluate
这第三解决方案显示了仅 PGmath 的解决方案,该解决方案也full arc
通过arcAngle
函数实现了密钥。
代码 1
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={bigR(\n)=\smallR+.05*\n;}]
\newcommand*\smallR{1}
\newcommand*\segments{60}
\pgfmathsetmacro\deltaAngle{360/\segments}
\newcommand*\startAngle{-\deltaAngle}
\newcommand*\endRadius{\smallR}
\foreach \iN[evaluate={
\startAngle=\startAngle+\deltaAngle;
\endRadius=\endRadius+.05;},% or bigR \iN
remember=\endRadius,
remember=\startAngle] in {1,...,\segments}
\filldraw[fill=gray!50] (\startAngle:\endRadius)
arc [radius=\endRadius, start angle=\startAngle, delta angle=\deltaAngle]
-- (\startAngle+\deltaAngle:\smallR)
arc [radius=\smallR, end angle=\startAngle, delta angle=-\deltaAngle] -- cycle;
\node {$\phi^2$};
\node at (north west:{sqrt 2 * bigR(\segments/2)}) {$\{\Omega\}_{i=1}^n$};
\node[rotate=-\deltaAngle/2, right] at (-\deltaAngle/2:bigR \segments) {$\partial \varphi$};
\end{tikzpicture}
\end{document}
输出 1
代码 2
\documentclass[tikz]{standalone}
\usetikzlibrary{qrr.misc}
\begin{document}
\begin{tikzpicture}[
declare function={smallR=1; bigR(\n)=smallR+.05*\n; segments=20;},
full arc=segments]% same as \degrees[segments] in PSTricks
\foreach \iN[evaluate={\endRadius=bigR(\iN+1);}, use int=0 to segments-1]
\filldraw[fill=gray!50] (\iN R:\endRadius)
arc [radius=\endRadius, start angle=+\iN R, delta angle=+1R]
-- (\iN R+1R:smallR)
arc [radius=smallR, end angle=\iN R, delta angle=-1R] -- cycle;
\node {$\phi^2$};
\node at (north west:{sqrt 2 * bigR(segments/2)}) {$\{\Omega\}_{i=1}^n$};
\node[rotate=-.5R, right] at (-.5R: bigR segments) {$\partial \varphi$};
\end{tikzpicture}
\begin{tikzpicture}[
declare function={smallR=1; bigR(\n)=smallR+.05*\n; segments=20;},
full arc=segments]
\filldraw[fill=gray!50] (right:smallR)
\foreach \iN[evaluate={\endRadius=bigR(\iN+1);}, use int=0 to segments-1] {
-- (\iN R:\endRadius) arc[radius=\endRadius, start angle=\iN R, delta angle=1R]}
-- (right:smallR) arc[radius=smallR, start angle=0, delta angle=-360];
\node {$\phi^2$};
\node at (north west:{sqrt 2 * bigR(segments/2)}) {$\{\Omega\}_{i=1}^n$};
\node[rotate=-.5R, right] at (-.5R: bigR segments) {$\partial \varphi$};
\end{tikzpicture}
\end{document}
输出 2
代码 3
\documentclass[tikz]{standalone}
\begin{document}
\foreach \segments in {1,...,60}{
\begin{tikzpicture}[declare function={smallR=1; bigR(\n)=smallR+.05*\n; segments=\segments;
arcAngle(\i,\n)=360/\n*\i;}]
\useasboundingbox (-bigR 45,-bigR 50) rectangle (bigR 60,bigR 45) ++ (right:1.7em);
\foreach \iN[evaluate={
\startAngle=arcAngle(\iN-1, segments);
\endAngle=arcAngle(\iN, segments);
\endRadius=bigR(\iN);}] in {1, ..., \segments}
\filldraw[fill=gray!50] (\startAngle:\endRadius)
arc [radius=\endRadius, start angle=\startAngle, end angle=\endAngle]
-- (\endAngle:smallR)
arc [radius=smallR, start angle=\endAngle, end angle=\startAngle] -- cycle;
\node {$\phi^2$};
\node at (-{bigR(segments/2)}, {bigR(segments/2)}) {$\{\Omega\}_{i=1}^n$};
\node at ({bigR(segments/2)}, {bigR(segments/2)}) {$n = \segments$};
\node at ({-arcAngle(1, segments)/2}: {bigR(segments)})
[rotate={-arcAngle(1, segments)/2}, right] {$\partial \varphi$};
\end{tikzpicture}}
\end{document}
输出 3
答案2
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\def\N{60}
\def\R#1#2{1 3 #1 div #2 mul add}
\begin{document}
\makeatletter
\begin{pspicture}(-2.5,-3.5)(4,2)
\degrees[\N]
\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N}{\R{\N}{t} t \pst@angleunit PtoC}{A}
\multido{\ia=0+1,\ib=1+1}{\N}{\pscustom{\psarc(0,0){!\R{\N}{\ia}}{(A\ia)}{(A\ib)}\psarcn(0,0){1}{(A\ib)}{(A\ia)}\closepath}}
\end{pspicture}
\makeatother
\end{document}
动画版
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\def\R#1#2{1 3 #1 div #2 mul add}
\begin{document}
\makeatletter
\multido{\i=1+1}{61}{%
\def\N{\i}
\begin{pspicture}(-2.5,-3.5)(4,2)
\degrees[\N]
\curvepnodes[plotpoints=\numexpr\N+1]{0}{\N}{\R{\N}{t} t \pst@angleunit PtoC}{A}
\multido{\ia=0+1,\ib=1+1}{\N}{\pscustom{\psarc(0,0){!\R{\N}{\ia}}{(A\ia)}{(A\ib)}\psarcn(0,0){1}{(A\ib)}{(A\ia)}\closepath}}
\end{pspicture}}
\makeatother
\end{document}
答案3
这是你想要的吗?使用\foreach
:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\foreach \start in {0, 6, 12, ..., 354}
\draw (\start:1+\start/300) arc (\start:\start+6:1+\start/300);
\foreach \start in {0, 6, 12, ..., 354}
\draw[fill=black!20] (\start:1) -- (\start:1+\start/300) -- (\start+6:1+\start/300) -- (\start+6:1)--cycle;
\draw (357:2.5) node {$\partial \varphi$};
\draw (345:0.5) node {$\varphi^2$};
\draw (150:2) node {$\{ \Omega \}_{i=1}^n$};
\end{tikzpicture}
\end{document}
答案4
要求似乎非常具体,因此使其可定制似乎不是什么问题:
\documentclass[tikz,border=0.125cm]{standalone}
\begin{document}
\tikz{
\foreach \a in {0,6,...,354}
\draw [fill=gray!50]
(\a:1) arc (\a:\a+6:1) -- (\a+6:1.05+\a/120) arc (\a+6:\a:1.05+\a/120) -- cycle;
\node {$\phi^2$};
\node at (-3,3) {$\{ \Omega \}_{i=1}^{n}$};
\node [anchor=171] at (357:1.05+357/120) {$\partial \varphi$};
}
\end{document}
如果需要进行一些定制,以下操作仍然有效:
\documentclass[tikz,border=0.125cm]{standalone}
\begin{document}
\tikz{
\def\n{60}
\def\r{1}
\def\f{0.05}
\foreach \i [evaluate={\s=360/\n; \a=\s*\i;}]in {1,2,...,\n}
\draw [fill=gray!50]
(\a:\r) arc (\a:\a-\s:\r) -- (\a-\s:\r+\f*\i) arc (\a-\s:\a:\r+\f*\i) -- cycle;
\node {$\phi^2$};
\node at (135:sqrt 2*1.5*\r+\f*\n/sqrt 2) {$\{ \Omega \}_{i=1}^{n}$};
\node [anchor=180-180/\n] at (-180/\n:\r+\f*\n) {$\partial \varphi$};
}
\end{document}
结果和之前一样(Ok,节点\Omega
更0.00012pt
靠近原点了)。
或者借助以下帮助gimp
:
\documentclass[tikz,border=0.125cm]{standalone}
\def\m{100}
\def\r{1}
\def\f{0.05}
\begin{document}
\foreach\n in {5,...,\m}{
\tikz{
\foreach \i [evaluate={\s=360/\n; \a=\s*\i;}]in {1,2,...,\n}
\draw [fill=gray!50]
(\a:\r) arc (\a:\a-\s:\r) -- (\a-\s:\r+\f*\i) arc (\a-\s:\a:\r+\f*\i) -- cycle;
\node {$\phi^2$};
\node at (135:sqrt 2*\r+sqrt 2*\m*3/8*\f) {$\{ \Omega \}_{i=1}^{\n}$};
\node [anchor=180-180/\n] at (-180/\n:\r+\f*\n) {$\partial \varphi$};
\useasboundingbox (-\r-\m/2*\f,-\r-\m*3/4*\f) rectangle (\r+\m*\f+1,\r+1);
}}
\end{document}