1

I am looking for help creating the attached image in Tikz. The exact coloration of the shapes and borders can be changed, but any help with creating this shape would be appreciated.

enter image description here

  • 1
  • My answer at the link that @Werner points to includes a link to a package on CTAN that has the capability to define tiles with matching rules. This looks like an equilateral triangle with specific matching rules which, in my package, would be something like a A 1 (so a matches with A, and 1 with itself). I'm not sure how easy the documentation is to follow, but that's where I'd start. – Andrew Stacey Nov 28 '22 at 21:14
  • Thanks for your suggestions. I'll try to figure out how to modify your Penrose tiling code (though, as a Tikz newby, I think it will be too much for me). – Hello_world Nov 29 '22 at 12:25

1 Answers1

5

tiling

Each elementary figure is created through the pic element bird; it is based on an equilateral triangle as @Andrew Stacey explained. Then, there are two more pic elements: flock composed of six birds and flocks composed of seven flocks. The drawing consists of seven flocks.

The constants are there to define the points forming a bird, in the trigonometric order.

The code

\documentclass[border=1cm, 11pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{math, calc}
\begin{document}

\tikzmath{ real \r, \a1, \d1, \a2, \d2, \a3, \d3, \a4, \d4, \b, \e; \r = 1; \b = 5; \e = .75\r; \a1 = 40; \a2 = 15; \a3 = 17; \a4 = \a1; \d1 = .4\r; \d2 = .37\r; \d3 = .65\r; \d4 = \d3; } \tikzset{ pics/bird/.style 2 args={% color, fill color code={% \draw[#1, fill=#2!20] (0, 0) -- +(-\a1: \d1) -- +(-\a2: \d2) -- +(-\a3: \d3) -- +(-\a4: \d4) -- +(-30: \r) {[rounded corners=2pt] -- +(\b: \e) -- +($(0: 1.732\r) -(\b: \e)$)} -- +(60 -30: \r) -- +(60 -\a4: \d4) -- +(60 -\a3: \d3) -- +(60 -\a2: \d2) -- +(60 -\a1: \d1) -- cycle; } }, pics/flock/.style 2 args={% color, fill color code={% \foreach \i in {0, 2, 4}{% \path (0, 0) pic[rotate={60\i}] {bird={#1}{#1}}; \path (0, 0) pic[rotate={60(\i +1)}] {bird={#1}{#2}}; } } }, pics/flocks/.style 2 args={% color, fill color code={% \path (0, 0) pic {flock={#1}{#2}}; \foreach \i in {0, 1, ..., 5}{%
\path (\i
60: 1.732*\r) pic {flock={#1}{#2}}; } } }
}

\begin{tikzpicture} \path (0, 0) pic {flocks={violet}{white}}; \foreach \i in {0, 2, 4}{%
\path[rotate={\i60}] ($(0: 1.732\r) +(30: 3\r)$) pic {flocks={red}{white}}; } \foreach \i in {1, 3, 5}{%
\path[rotate={\i
60}] ($(0: 1.732\r) +(30: 3\r)$) pic {flocks={green!50!blue}{white}}; } \end{tikzpicture} \end{document}

Daniel N
  • 5,687