1

Using the following code from the answer to this question; how can circles be nested on each spike with colours match those of the individual drawings.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{spiro arcs}%Spirifankerln using scale Fractal solution simple-
\definecolor{camel}{rgb}{0.76, 0.6, 0.42}
\definecolor{apricot}{rgb}{0.98, 0.81, 0.69}
\definecolor{burlywood}{rgb}{0.87, 0.72, 0.53}
\definecolor{fawn}{rgb}{0.9, 0.67, 0.44}
\definecolor{lighttaupe}{rgb}{0.7, 0.55, 0.43}
\definecolor{palebrown}{rgb}{0.6, 0.46, 0.33}
\begin{tikzpicture}[pics/spiro/.style={code={
  \draw[line width=.04cm,looseness=1,pic actions]
    (0,-2) node [circle, draw, blue, fill=blue!40!white, scale=0.2]{} arc (180:90:2) arc (270:180:2) arc (360:270:2) arc (90:0:2);
  }
}]
  \foreach \i/\clr in {1/apricot, 3/apricot, 5/apricot, 7/apricot, 9/apricot, 11/apricot, 13/apricot, 15/apricot, 2/burlywood, 6/burlywood, 10/burlywood, 14/burlywood, 12/fawn, 4/fawn, 8/camel, 16/lighttaupe, 0/palebrown}
 {
    \pic[draw/.expanded=\clr!100,fill/.expanded=\clr!60,scale=2,rotate=\i*2.8125]{spiro};
    \pic[draw/.expanded=\clr!100,fill/.expanded=\clr!60,scale=2,rotate=-\i*2.8125]{spiro};
  }
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

Hany
  • 4,709

2 Answers2

2

You essentially have everything that you need already in place. The main issue is that you are putting the circles only after the first set of spikes in each quadrant. To get circles on every spike you need to add \node commands after each arc, except for the last one.

You can cater for the changing colours by passing the current colour \clr to the spiro pic as a parameter. With these changes your code produces:

enter image description here

As there are now many nodes I have separated the style for these nodes into a another dot/.style, which ultimately receives the current colour \clr as its #1 parameter. Here is the modified code:

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[fragile,t]
\frametitle{spiro arcs}%Spirifankerln using scale Fractal solution simple-
\definecolor{camel}{rgb}{0.76, 0.6, 0.42}
\definecolor{apricot}{rgb}{0.98, 0.81, 0.69}
\definecolor{burlywood}{rgb}{0.87, 0.72, 0.53}
\definecolor{fawn}{rgb}{0.9, 0.67, 0.44}
\definecolor{lighttaupe}{rgb}{0.7, 0.55, 0.43}
\definecolor{palebrown}{rgb}{0.6, 0.46, 0.33}
\begin{tikzpicture}[
  dot/.style={circle, draw=#1, fill=#1!60, scale=0.2},
  pics/spiro/.style={code={
  \draw[line width=.04cm,looseness=1,pic actions]
  (0,-2) node [dot=#1]{} arc (180:90:2) node[dot=#1]{}  arc (270:180:2) node[dot=#1]{}  arc (360:270:2) node[dot=#1]{} arc (90:0:2);
  }
}]
  \foreach \i/\clr in {1/apricot, 3/apricot, 5/apricot, 7/apricot, 9/apricot, 11/apricot, 13/apricot, 15/apricot, 2/burlywood, 6/burlywood, 10/burlywood, 14/burlywood, 12/fawn, 4/fawn, 8/camel, 16/lighttaupe, 0/palebrown}
 {
    \pic[draw=\clr!100,fill=\clr!60,scale=2,rotate=\i*2.8125]{spiro=\clr};
    \pic[draw=\clr!100,fill=\clr!60,scale=2,rotate=-\i*2.8125]{spiro=\clr};
  }
\end{tikzpicture}
\end{frame}
\end{document}

Finally, note that it is necessary to add fragile to the parameters for the frame environment, otherwise you will get compilation errors. I have also removed the .expanded handlers as they are not necessary. You could also simplify the \foreach command by removing the \i and calculating the rotation but as it works this is only of aesthetic coding value:)

2

A bit similar to Andrew's answer but making the circles part of the pic. That is, I replaced

(0,-2) node [circle, draw, blue, fill=blue!40!white, scale=0.2]{}

by

foreach \X in {0,90,180,270} {(\X:2) node [circle, draw, scale=0.2]{}} 

I agree with Andrew that /.expanded is not needed here.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{spiro arcs}%Spirifankerln using scale Fractal solution simple-
\definecolor{camel}{rgb}{0.76, 0.6, 0.42}
\definecolor{apricot}{rgb}{0.98, 0.81, 0.69}
\definecolor{burlywood}{rgb}{0.87, 0.72, 0.53}
\definecolor{fawn}{rgb}{0.9, 0.67, 0.44}
\definecolor{lighttaupe}{rgb}{0.7, 0.55, 0.43}
\definecolor{palebrown}{rgb}{0.6, 0.46, 0.33}
\begin{tikzpicture}[pics/spiro/.style={code={
  \draw[line width=.04cm,looseness=1,pic actions]
    foreach \X in {0,90,180,270} {(\X:2) node [circle, draw, scale=0.2]{}} 
    arc (180:90:2) arc (270:180:2) arc (360:270:2) arc (90:0:2);
  }
}]
  \foreach \i/\clr in {1/apricot, 3/apricot, 5/apricot, 7/apricot, 9/apricot, 11/apricot, 13/apricot, 15/apricot, 2/burlywood, 6/burlywood, 10/burlywood, 14/burlywood, 12/fawn, 4/fawn, 8/camel, 16/lighttaupe, 0/palebrown}
 {
    \pic[draw=\clr!100,fill=\clr!60,scale=2,rotate=\i*2.8125]{spiro};
    \pic[draw=\clr!100,fill=\clr!60,scale=2,rotate=-\i*2.8125]{spiro};
  }
\end{tikzpicture}
\end{frame}
\end{document}

enter image description here

  • Thank you very much for your answer. Unfortunately I can not accept both yours and Andrew's answers. – Hany Dec 24 '19 at 06:54