25

I desire a figure similar to the following:

\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}

as developed here.

However, the figure I desire this time around should be something like the following:

Consider a circle of radius 1. Divide the circle into 60 symmetric arcs. For each arc, starting with the 0-6 degree arc, increase the radius by $.05n$ for n between 1 and 60. so the 354-360 arc should have a radius of .05(60) + 1 =4. Just as in the previous figure, each change in area should be shaded. Here is a sketch of a similar looking object split into 12 arcs:

enter image description here

You can see that each arc has a radius larger than the previous, with the sqwiggles indicating shading and labels $\{ \Omega \}_{i=1}^{n}$, $\phi^2$ and $\partial \varphi$. Any help would be greatly appreciated.

  • Apparently it wasn't so difficult, regarding to the fast answers :)

    (I'm always amazed how fast and comprehensive the answers here are.)

    – klingt.net Nov 11 '13 at 09:42

4 Answers4

34

This answer shows two to three approaches:

The first one shows a version where a few often used values are evaluated beforehand and are saved in a macro. Also, the \startAngle and the \endRadius are initialized as the \foreach loop only adds \deltaAngle for the angle and .05 for the radius.

The \foreach loop is then used to iterate over the segments but their number (\iN) is not even used. The nodes are then places using simple math.

The second solution uses my TikZ library qrr.misc which contains a few “fixes” and addition to PGF.

The used additions are the use int key for \foreach that allows us to use arbitrary PGFmath for the \foreach loop and the full arc key as well as the R prefix from PGFmath. The full arc key is similar to the \degrees[<n>] macro from PSTricks. Instead of calculating the angle for the <i>th element of <n> elements (like with the arcAngle function of the third solution) it allows us to specify <i> R in a PGFmath-aware environment. I also added an alternative output. These solutions are probably slower than the first solution because they use more PGfmath and re-evaluate certain values repeatedly (but of course we could use them in \foreach’s evaluate key, too).

The third solution shows an only-PGmath solution that also implements the full arc key via the arcAngle function.

Code 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}

Output 1

enter image description here

Code 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}

Output 2

enter image description hereenter image description here

Code 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}

Output 3

enter image description here

Qrrbrbirlbel
  • 119,821
18
\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}

enter image description here

Animated version

\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}

enter image description here

17

Is this something like what you want? Using \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}

enter image description here

16

The requirements seem quite specific, so making it customizable seems less of an issue:

\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}

enter image description here

And if some customization was required the following still works:

\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}

The result is the same as before (Ok, the \Omega node is 0.00012pt nearer the origin).

Or with a bit of help from 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}

enter image description here

Mark Wibrow
  • 70,437