1

I borrowed some code from this page and adapted it very slightly, producing this:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
\begin{document}
\begin{tikzpicture}


   \begin{scope}
   \clip (0,0) circle (3cm);
   \draw (0,0) circle (3cm);
   \end{scope}

   \coordinate (a) at (90:3);
   \coordinate (b) at (-30:3);
   \coordinate (c) at (210:3);
   \foreach \in in {1,2,...,4}
   {
     \node[circle through=(a),draw] {};
     \draw (a)--(b)--(c)--cycle;
     \coordinate(aux) at (a);
     \path (a)--(b) coordinate[pos=.5] (a);
     \path (b)--(c) coordinate[pos=.5] (b);
     \path (c)--(aux) coordinate[pos=.5] (c);
   }
\end{tikzpicture}

\end{document}

Which gives this result:

enter image description here

I was hoping to get rid of the outermost circle; hence the scoping and clipping. That didn't work, though. I also tried putting the clip command after the draw command and adding a clip option to the scope environment. Is there way to use clip to do what I want? (It looks like there's a way to start with the triangle and calculate from there, as in this discussion, but I'm hoping to avoid that level of complication.

3 Answers 3

1

This code overwrites nodes and redraws circles. A minimal surgery might be

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
\begin{document}
\begin{tikzpicture}



   \coordinate (a) at (90:3);
   \coordinate (b) at (-30:3);
   \coordinate (c) at (210:3);
   \foreach \in in {1,2,...,4}
   {
     \ifnum\in=1
     \else
     \node[circle through=(a),draw] {};
     \fi
     \draw (a)--(b)--(c)--cycle;
     \coordinate(aux) at (a);
     \path (a)--(b) coordinate[pos=.5] (a);
     \path (b)--(c) coordinate[pos=.5] (b);
     \path (c)--(aux) coordinate[pos=.5] (c);
   }
\end{tikzpicture}

\end{document}

enter image description here

0

cercles

In the loop, the circle is drawn first, (at the beginning of the loop) then the point (a) is redefined with \coordinate(aux) at (a);, so it is enough to draw the circle at the end of the loop and not at the beginning.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
\begin{document}
\begin{tikzpicture}

   \begin{scope}
   \clip (0,0) circle (3cm);
   %\draw (0,0) circle (3cm);
   \end{scope}

   \coordinate (a) at (90:3);
   \coordinate (b) at (-30:3);
   \coordinate (c) at (210:3);
   \foreach \in in {1,2,...,4}
   {
     %\node[circle through=(a),draw] {};
     \draw (a)--(b)--(c)--cycle;
     \coordinate(aux) at (a);
     \path (a)--(b) coordinate[pos=.5] (a);
     \path (b)--(c) coordinate[pos=.5] (b);
     \path (c)--(aux) coordinate[pos=.5] (c);
     \node[circle through=(a),draw] {};% draw the circle at the end
   }
\end{tikzpicture}

\end{document}
2
  • 1
    What is the purpose of begin{scope} \clip (0,0) circle (3cm); \end{scope}? And there is an additional circle in the center, which is not there in the OP's screen shot, and the reason why my answer as an \ifnum in.
    – user121799
    Jan 27, 2019 at 21:10
  • 1
    It's in the code of the question and it's useless. Yes, there is an extra circle (in a very small way) let's see if it bothers the OP.
    – AndréC
    Jan 27, 2019 at 21:11
0
  1. Put the outermost triangle out of the loop
  2. reduce the iteration number
  3. the loop starts by calculating the new coordinates (a), (b) and (c)

!

   \begin{document}
    \begin{tikzpicture}

   \coordinate (a) at (90:3);
   \coordinate (b) at (-30:3);
   \coordinate (c) at (210:3);
   \draw(a)--(b)--(c)--cycle;


   \foreach \in in {1,2,...,3}
   {
     \coordinate(aux) at (a);
     \path (a)--(b) coordinate[pos=.5] (a);
     \path (b)--(c) coordinate[pos=.5] (b);
     \path (c)--(aux) coordinate[pos=.5] (c);
     \node[circle through=(a),draw] {};
     \draw (a)--(b)--(c)--cycle;
   }
\end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .