Debian Codegraph @

texmf-dist/source/latex/tilings/tilings_code.dtx

raw
1 % \iffalse meta-comment
2 %<*internal>
3 \iffalse
4 %</internal>
5 %<*readme>
6 ----------------------------------------------------------------
7 penrose --- TikZ library for producing tiling patterns
8 E-mail: [email protected]
9 Released under the LaTeX Project Public License v1.3c or later
10 See http://www.latex-project.org/lppl.txt
11 ----------------------------------------------------------------
12
13 This package is for the creation of Penrose and similar tilings.
14 %</readme>
15 %<*internal>
16 \fi
17 \def\nameofplainTeX{plain}
18 \ifx\fmtname\nameofplainTeX\else
19 \expandafter\begingroup
20 \fi
21 %</internal>
22 %<*install>
23 \input l3docstrip.tex
24 \keepsilent
25 \askforoverwritefalse
26 \preamble
27 ----------------------------------------------------------------
28 tilings --- TikZ library for producing tilings
29 E-mail: [email protected]
30 Released under the LaTeX Project Public License v1.3c or later
31 See http://www.latex-project.org/lppl.txt
32 ----------------------------------------------------------------
33
34 \endpreamble
35 \postamble
36
37 Copyright (C) 2014-2023 by Andrew Stacey <[email protected]>
38
39 This work may be distributed and/or modified under the
40 conditions of the LaTeX Project Public License (LPPL), either
41 version 1.3c of this license or (at your option) any later
42 version. The latest version of this license is in the file:
43
44 http://www.latex-project.org/lppl.txt
45
46 This work is "maintained" (as per LPPL maintenance status) by
47 Andrew Stacey.
48
49 This work consists of the files penrose_code.dtx
50 penrose.tex
51 and the derived files penrose.ins
52 penrose_code.pdf
53 penrose.pdf
54 tikzlibrarytilings.code.tex
55 tikzlibrarytilings.penrose.code.tex
56 tikzlibrarytilings.polykite.code.tex
57 tikzlibrarypenrose.code.tex
58 README.txt
59
60 \endpostamble
61 \usedir{tex/latex/penrose}
62 \generate{
63 \file{tikzlibrarytilings.code.tex}{\from{\jobname.dtx}{tilings}}
64 }
65 \generate{
66 \file{tikzlibrarytilings.penrose.code.tex}{\from{\jobname.dtx}{penrose}}
67 }
68 \generate{
69 \file{tikzlibrarytilings.polykite.code.tex}{\from{\jobname.dtx}{polykite}}
70 }
71 \generate{
72 \file{tikzlibrarypenrose.code.tex}{\from{\jobname.dtx}{penrosedep}}
73 }
74 %</install>
75 %<install>\endbatchfile
76 %<*internal>
77 \usedir{source/latex/penrose}
78 \generate{
79 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
80 }
81 \nopreamble\nopostamble
82 \usedir{doc/latex/penrose}
83 \generate{
84 \file{README.txt}{\from{\jobname.dtx}{readme}}
85 }
86 \ifx\fmtname\nameofplainTeX
87 \expandafter\endbatchfile
88 \else
89 \expandafter\endgroup
90 \fi
91 %</internal>
92 %<*driver>
93 \documentclass{l3doc}
94 \usepackage[scale=.8]{geometry}
95 \usepackage[T1]{fontenc}
96 \usepackage{lmodern}
97 \usepackage{tikz}
98 \usepackage{amsmath}
99 %\usepackage{trace}
100 \usetikzlibrary{penrose}
101 %\traceoff
102 %\usepackage[numbered]{hypdoc}
103 \definecolor{lstbgcolor}{rgb}{0.9,0.9,0.9}
104
105 \usepackage{listings}
106 \lstloadlanguages{[LaTeX]TeX}
107 \lstset{breakatwhitespace=true,breaklines=true,language=TeX}
108
109 \usepackage{fancyvrb}
110
111 \newenvironment{example}
112 {\VerbatimEnvironment
113 \begin{VerbatimOut}[gobble=2]{example.out}}
114 {\end{VerbatimOut}
115 \begin{center}
116 % \setlength{\parindent}{0pt}
117 \fbox{\begin{minipage}{.9\linewidth}
118 \lstset{breakatwhitespace=true,breaklines=true,language=TeX,basicstyle=\small}
119 \lstinputlisting[]{example.out}
120 \end{minipage}}
121
122 \fbox{\begin{minipage}{.9\linewidth}
123 \input{example.out}
124 \end{minipage}}
125 \end{center}
126 }
127 \EnableCrossrefs
128 \CodelineIndex
129 \RecordChanges
130 \begin{document}
131 \DocInput{\jobname.dtx}
132 \end{document}
133 %</driver>
134 % \fi
135 %
136 % \CheckSum{2944}
137 %
138 % \CharacterTable
139 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
140 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
141 % Digits \0\1\2\3\4\5\6\7\8\9
142 % Exclamation \! Double quote \" Hash (number) \#
143 % Dollar \$ Percent \% Ampersand \&
144 % Acute accent \' Left paren \( Right paren \)
145 % Asterisk \* Plus \+ Comma \,
146 % Minus \- Point \. Solidus \/
147 % Colon \: Semicolon \; Less than \<
148 % Equals \= Greater than \> Question mark \?
149 % Commercial at \@ Left bracket \[ Backslash \\
150 % Right bracket \] Circumflex \^ Underscore \_
151 % Grave accent \` Left brace \{ Vertical bar \|
152 % Right brace \} Tilde \~}
153 %
154 %
155 % \changes{1.0}{2014/05/07}{Converted to DTX file}
156 % \changes{1.2}{2019/02/23}{Added general tile creation code}
157 % \changes{1.4}{2021/01/22}{Adapted to latest version of spath3}
158 % \changes{1.6}{2023/03/22}{Included aperiodical hat}
159 % \changes{1.8}{2023/05/11}{LMS systems for aperiodical tiles}
160 % \changes{2.0}{2023/06/01}{Major version change for CTAN}
161 %
162 % \DoNotIndex
163 % {
164 % \begingroup,
165 % \catcode,
166 % \active,
167 % \csname,
168 % \endcsname,
169 % }%
170 %
171 %
172 % \providecommand*{\url}{\texttt}
173 % \GetFileInfo{tikzlibrarytilings.code.tex}
174 % \title{The \textsf{Tilings} package: code}
175 % \author{Andrew Stacey\texorpdfstring{\\ \url{[email protected]}}{}}
176 % \date{\fileversion~from \filedate}
177 %
178 %
179 % \maketitle
180 %
181 % \tableofcontents
182 %
183 % \begin{documentation}
184 %
185 % \section{Introduction}
186 %
187 % This is a TikZ library for drawing tiles, such as Penrose tiles (kite/dart, rhombus, and pentagon versions) and the aperiodical polykite tiles.
188 % It provides two methods of drawing: one in which an automatic pattern is built, and one where the tiles can be placed ``by hand''.
189 % The tiles can be shaped and (hopefully!) still fit together.
190 % For full user documentation, see the \Verb+tilings.pdf+ file.
191 %
192 %
193 % \end{documentation}
194 %
195 % \begin{implementation}
196 %
197 % \section{Implementation}
198 %
199 %
200 % \iffalse
201 %<*tilings>
202 % \fi
203 %
204 % \begin{macrocode}
205 %<@@=tilings>
206 % \end{macrocode}
207 %
208 % \subsection{Initialisation}
209 %
210 %
211 % We use the \Verb+spath3+ library for manipulating the paths that will make up the tiles.
212 %
213 % \begin{macrocode}
214 \ProvidesExplFile
215 {tikzlibrarytilings.code.tex}
216 {2023/06/01}
217 {2.0}
218 {TikZ pics for tilings such as Penrose tiles}
219 \RequirePackage{tikz}
220 \usetikzlibrary{spath3}
221 % \end{macrocode}
222 % Now we move in to the realm of \LaTeX3.
223 % \begin{macrocode}
224 \ExplSyntaxOn
225 % \end{macrocode}
226 %
227 % Start with some basic paths (lines) for the sides of the tiles so that we know that we have well-defined tiles at the outset.
228 % These are globally defined as we will frequently want to define them in one tikzpicture and use them in another.
229 %
230 % \begin{macrocode}
231 \tl_new:N \g_@@_side_a_tl
232 \tl_new:N \g_@@_side_b_tl
233 \tl_new:N \g_@@_side_c_tl
234 \tl_new:N \g_@@_side_d_tl
235 \tl_new:N \g_@@_side_e_tl
236 \tl_new:N \g_@@_side_A_tl
237 \tl_new:N \g_@@_side_B_tl
238 \tl_new:N \g_@@_side_C_tl
239 \tl_new:N \g_@@_side_D_tl
240 \tl_new:N \g_@@_side_E_tl
241 \tl_new:c {g_@@_side_1_tl}
242 \tl_new:c {g_@@_side_2_tl}
243 \tl_new:c {g_@@_side_3_tl}
244 \tl_gset:Nn \g_@@_side_a_tl
245 {
246 \pgfsyssoftpath@movetotoken{0pt}{0pt}
247 \pgfsyssoftpath@linetotoken{1pt}{0pt}
248 }
249 \tl_gset_eq:NN \g_@@_side_b_tl \g_@@_side_a_tl
250 \tl_gset_eq:NN \g_@@_side_c_tl \g_@@_side_a_tl
251 \tl_gset_eq:NN \g_@@_side_d_tl \g_@@_side_a_tl
252 \tl_gset_eq:NN \g_@@_side_e_tl \g_@@_side_a_tl
253 \tl_gset_eq:NN \g_@@_side_A_tl \g_@@_side_a_tl
254 \tl_gset_eq:NN \g_@@_side_B_tl \g_@@_side_a_tl
255 \tl_gset_eq:NN \g_@@_side_C_tl \g_@@_side_a_tl
256 \tl_gset_eq:NN \g_@@_side_D_tl \g_@@_side_a_tl
257 \tl_gset_eq:NN \g_@@_side_E_tl \g_@@_side_a_tl
258 \tl_gset_eq:cN {g_@@_side_1_tl} \g_@@_side_a_tl
259 \tl_gset_eq:cN {g_@@_side_2_tl} \g_@@_side_a_tl
260 \tl_gset_eq:cN {g_@@_side_3_tl} \g_@@_side_a_tl
261 % \end{macrocode}
262 %
263 % \begin{variable}{\l_@@_tmpa_fp, \l_@@_tmpb_fp, \l_@@_tmpc_fp, \l_@@_saved_x_fp, \l_@@_saved_y_fp, \l_@@_tmpa_str, \l_@@_tmpb_str, \l_@@_tmpa_seq, \l_@@_tmpa_tl, \l_@@_tmpb_tl, \l_@@_tmpc_tl, \l_@@_tmpd_tl, \l_@@_tmpa_int, \l_@@_tmpb_int, \l_@@_xa_dim, \l_@@_ya_dim, \l_@@_xb_dim, \l_@@_yb_dim, \g_@@_xa_dim, \g_@@_ya_dim, \g_@@_xb_dim, \g_@@_yb_dim, \l_@@_tmpa_prop, \l_@@_cw_bool, \l_@@_update_saved_bool, \l_@@_relative_bool, \g_@@_output_tl}
264 % We need a few temporary variables to hold intermediate calculations.
265 %
266 % \begin{macrocode}
267 \fp_new:N \l_@@_tmpa_fp
268 \fp_new:N \l_@@_tmpb_fp
269 \fp_new:N \l_@@_tmpc_fp
270 \fp_new:N \l_@@_saved_x_fp
271 \fp_new:N \l_@@_saved_y_fp
272 \str_new:N \l_@@_tmpa_str
273 \str_new:N \l_@@_tmpb_str
274 \seq_new:N \l_@@_tmpa_seq
275 \tl_new:N \l_@@_tmpa_tl
276 \tl_new:N \l_@@_tmpb_tl
277 \tl_new:N \l_@@_tmpc_tl
278 \tl_new:N \l_@@_tmpd_tl
279 \tl_new:N \l_@@_tmp_tile_path_tl
280 \tl_new:N \l_@@_action_lms_tl
281 \tl_new:N \l_@@_parameters_lms_tl
282 \int_new:N \l_@@_tmpa_int
283 \int_new:N \l_@@_tmpb_int
284 \fp_new:N \l_@@_xa_fp
285 \fp_new:N \l_@@_ya_fp
286 \fp_new:N \l_@@_xb_fp
287 \fp_new:N \l_@@_yb_fp
288 \dim_new:N \l_@@_xa_dim
289 \dim_new:N \l_@@_ya_dim
290 \dim_new:N \l_@@_xb_dim
291 \dim_new:N \l_@@_yb_dim
292 \dim_new:N \g_@@_xa_dim
293 \dim_new:N \g_@@_ya_dim
294 \dim_new:N \g_@@_xb_dim
295 \dim_new:N \g_@@_yb_dim
296 \prop_new:N \l_@@_tmpa_prop
297 \bool_new:N \l_@@_cw_bool
298 \bool_new:N \l_@@_update_saved_bool
299 \bool_new:N \l_@@_relative_bool
300 \bool_new:N \l_@@_edge_bool
301 \str_const:Nn \c_@@_colon_str {:}
302 \str_const:Nn \c_@@_comma_str {,}
303 \fp_const:Nn \c_@@_cm_fp {\dim_to_fp:n {1cm}}
304 \tl_new:N \g_@@_output_tl
305 \fp_new:N \g_@@_output_a_fp
306 \fp_new:N \g_@@_output_b_fp
307 \prop_new:N \g_@@_tilenames_prop
308 \regex_const:Nn \c_@@_anchor_regex {\s\w+\Z}
309 \cs_generate_variant:Nn \seq_set_split:Nnn {NVV}
310 \cs_generate_variant:Nn \regex_extract_once:NnNTF {NVNTF}
311 \cs_generate_variant:Nn \tl_if_eq:nnT {nVT}
312 \cs_generate_variant:Nn \tl_if_in:NnT {NVT}
313 \cs_generate_variant:Nn \prop_item:Nn {cV}
314 \cs_generate_variant:Nn \tl_if_head_is_group_p:n {V}
315 % \end{macrocode}
316 % \end{variable}
317 %
318 % \subsection{Helpful Error Messages}
319 %
320 % \begin{macrocode}
321 \msg_new:nnn { tilings }{ not baked }
322 { Tile~ #1~ has~ not~ been~ baked. }
323 \msg_new:nnn { tilings }{ no tile }
324 { Tile~ #1~ has~ not~ been~ defined. }
325 \msg_new:nnn { tilings }{ no side }
326 { Tile~ side~ #1~ has~ not~ been~ defined,~ using~ default. }
327 \msg_new:nnn { tilings }{ tile no edge }
328 { Tile~ #1~ doesn't~ have~ an~ edge~ labelled~ #2;
329 ~ available~ edges~ are~ #3.}
330 \msg_new:nnn { tilings }{ no edge }
331 { Either~ tile~ #1~ doesn't~ exist
332 ~ or~ it~ doesn't~ have~ an~ edge~ labelled~ #2.}
333 % \end{macrocode}
334 %
335 % \subsection{Creating the Tiles}
336 %
337 % \begin{macro}[internal]{\@@_normalise_path:Nn}
338 % When defining the path for a side, we normalise so that it starts at the origin and ends at \Verb+(1pt,0pt)+.
339 % \begin{macrocode}
340 \cs_new_nopar:Npn \@@_normalise_path:Nn #1#2
341 {
342 % \end{macrocode}
343 % Get the initial point of the path and convert to floating point.
344 % \begin{macrocode}
345 \group_begin:
346 \spath_initialpoint:Nn \l_@@_tmpa_tl {#2}
347 \fp_set:Nn \l_@@_tmpa_fp {\tl_head:N \l_@@_tmpa_tl}
348 \tl_set:Nx \l_@@_tmpa_tl {\tl_tail:N \l_@@_tmpa_tl}
349 \fp_set:Nn \l_@@_tmpb_fp {\tl_head:N \l_@@_tmpa_tl}
350 % \end{macrocode}
351 % Get the final point of the path, and compute the difference of the final and initial points.
352 %
353 % The resulting numbers, say \(a\) and \(b\), will be put into a matrix to rotate and scale the path.
354 % The formula for the matrix is:
355 %^^A
356 % \[
357 % \frac{1}{a^2 + b^2}
358 % \begin{bmatrix} a & b \\ -b & a \end{bmatrix}
359 % \]
360 %
361 % \begin{macrocode}
362 \spath_finalpoint:Nn \l_@@_tmpa_tl {#2}
363 \fp_set:Nn \l_@@_tmpa_fp
364 {\tl_head:N \l_@@_tmpa_tl - \l_@@_tmpa_fp}
365 \tl_set:Nx \l_@@_tmpa_tl {\tl_tail:N \l_@@_tmpa_tl}
366 \fp_set:Nn \l_@@_tmpb_fp
367 {\tl_head:N \l_@@_tmpa_tl - \l_@@_tmpb_fp}
368 % \end{macrocode}
369 % Now compute the square of the length of the path for scaling.
370 % \begin{macrocode}
371 \fp_set:Nn \l_@@_tmpc_fp
372 {\l_@@_tmpa_fp^2 + \l_@@_tmpb_fp^2}
373 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_tmpa_fp/\l_@@_tmpc_fp}
374 \fp_set:Nn \l_@@_tmpb_fp {\l_@@_tmpb_fp/\l_@@_tmpc_fp}
375 \fp_set:Nn \l_@@_tmpc_fp {-\l_@@_tmpb_fp}
376 % \end{macrocode}
377 % Now construct the matrix.
378 % \begin{macrocode}
379 \tl_set:Nx \l_@@_tmpb_tl
380 {
381 {\fp_use:N \l_@@_tmpa_fp}
382 {\fp_use:N \l_@@_tmpc_fp} % swapped
383 {\fp_use:N \l_@@_tmpb_fp} % swapped
384 {\fp_use:N \l_@@_tmpa_fp}
385 }
386 % \end{macrocode}
387 % Get the initial point back again for the translation part.
388 % \begin{macrocode}
389 \spath_initialpoint:Nn \l_@@_tmpa_tl {#2}
390 % \end{macrocode}
391 % But we need to premultiply by the matrix because of how the transformations are applied.
392 % \begin{macrocode}
393 \fp_set:Nn \l_@@_tmpa_fp
394 {
395 (-1) * \l_@@_tmpa_fp * \tl_head:N \l_@@_tmpa_tl
396 + (-1) * \l_@@_tmpb_fp * \tl_tail:N \l_@@_tmpa_tl
397 }
398 \fp_set:Nn \l_@@_tmpb_fp
399 {
400 (-1) * \l_@@_tmpa_fp * \tl_tail:N \l_@@_tmpa_tl
401 + \l_@@_tmpb_fp * \tl_head:N \l_@@_tmpa_tl
402 }
403 % \end{macrocode}
404 % Finally, we apply the transformation to the path.
405 % \begin{macrocode}
406 \tl_put_right:Nx \l_@@_tmpb_tl {
407 {\fp_to_dim:N \l_@@_tmpa_fp}
408 {\fp_to_dim:N \l_@@_tmpb_fp}
409 }
410 \spath_transform:NnV \l_@@_tmpa_tl {#2} \l_@@_tmpb_tl
411 \tl_gset_eq:NN \g_@@_output_tl \l_@@_tmpa_tl
412 \group_end:
413 \tl_set_eq:NN #1 \g_@@_output_tl
414 \tl_gclear:N \g_@@_output_tl
415 }
416 \cs_generate_variant:Nn \@@_normalise_path:Nn {NV, cn, cV}
417 \cs_new_protected_nopar:Npn \@@_normalise_path:N #1
418 {
419 \@@_normalise_path:NV #1#1
420 }
421 \cs_generate_variant:Nn \@@_normalise_path:N {c}
422 % \end{macrocode}
423 % \end{macro}
424 %
425 % \begin{function}{\SetTilingPath}
426 % This sets the path corresponding to a particular side to the current path, and normalises it.
427 % \begin{macrocode}
428 \cs_new_protected_nopar:Npn \@@_set_tiling_path:n #1
429 {
430 \group_begin:
431 \pgfsyssoftpath@getcurrentpath\l_@@_tmpa_tl
432 \@@_normalise_path:N \l_@@_tmpa_tl
433 \tl_gset_eq:cN {g_@@_side_#1_tl} \l_@@_tmpa_tl
434 \group_end:
435 }
436
437 \NewDocumentCommand \SetTilingPath { m }
438 {
439 \@@_set_tiling_path:n {#1}
440 }
441 % \end{macrocode}
442 % \end{function}
443 %
444 % \begin{macro}[internal]{\tikz_scan_point:n}
445 % This is a wrapper around \Verb+\tikz@scan@one@point+ to make it easier to use with \LaTeX3 variables.
446 % \begin{macrocode}
447 \cs_new_nopar:Npn \tikz_scan_point:n #1
448 {
449 \tikz@scan@one@point\pgfutil@firstofone#1\relax
450 }
451 \cs_generate_variant:Nn \tikz_scan_point:n {V}
452 % \end{macrocode}
453 % \end{macro}
454 %
455 % \begin{macro}[internal]{\tikz_node_if_defined:TF}
456 % This extracts the code that tests if a node is defined.
457 % \begin{macrocode}
458 \prg_new_conditional:Npnn \tikz_node_if_defined:n #1 {p,T,F,TF}
459 {
460 \tl_if_exist:cTF {pgf@sh@ns@\use:c{tikz@pp@name}{#1}}
461 {
462 \prg_return_true:
463 }{
464 \tl_if_exist:cTF
465 {pgf@sh@ns@not yet positionedPGFINTERNAL\use:c{tikz@pp@name}{#1}}
466 {
467 \pgf_return_true:
468 }
469 {
470 \prg_return_false:
471 }
472 }
473 }
474 % \end{macrocode}
475 % \end{macro}
476 %
477 % \begin{macro}[internal]{\@@_keys_get:Nn,\pgfkeys_get:n}
478 % This is a wrapper around \Verb+\pgfkeysgetvalue+ to make it easier to use with \LaTeX3 variables.
479 % \begin{macrocode}
480 \cs_new_nopar:Npn \@@_keys_get:Nn #1#2
481 {
482 \pgfkeysgetvalue{/tikz/tiling/#2}{#1}
483 }
484 \cs_new_nopar:Npn \@@_keys_get:n #1
485 {
486 \pgfkeysvalueof{/tikz/tiling/#1}
487 }
488 \cs_new_nopar:Npn \@@_tikz_keys_get:Nn #1#2
489 {
490 \pgfkeysgetvalue{/tikz/#2}{#1}
491 }
492 \cs_new_nopar:Npn \@@_tikz_keys_get:n #1
493 {
494 \pgfkeysvalueof{/tikz/#1}
495 }
496 \cs_new_nopar:Npn \@@_pgf_keys_get:Nn #1#2
497 {
498 \pgfkeysgetvalue{#2}{#1}
499 }
500 \cs_new_nopar:Npn \@@_pgf_keys_get:n #1
501 {
502 \pgfkeysvalueof{#1}
503 }
504 % \end{macrocode}
505 % \end{macro}
506 %
507 % \begin{macro}[internal]{\@@_make_tile:nnn}
508 % This builds the tile path from its pieces.
509 % The arguments are the name of the tile, the descriptions of the sides, and a token list of the coordinates.
510 % \begin{macrocode}
511 \cs_new_nopar:Npn \@@_make_tile:nnn #1#2#3
512 {
513 % \end{macrocode}
514 % Get the first coordinate and initialise the path with a move to this point.
515 % \begin{macrocode}
516 \group_begin:
517 \tl_set:Nn \l_@@_tmpa_tl {#3}
518 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
519 \tl_set:Nn \l_@@_tmpa_tl {\pgfsyssoftpath@movetotoken}
520 \tl_put_right:Nx \l_@@_tmpa_tl
521 {
522 {
523 \fp_to_dim:n
524 {(\tl_item:Nn \l_@@_tmpb_tl {1}) * \c_@@_cm_fp}
525 }
526 {
527 \fp_to_dim:n
528 {(\tl_item:Nn \l_@@_tmpb_tl {2}) * \c_@@_cm_fp}
529 }
530 }
531 \tl_set_eq:NN \l_@@_tmp_tile_path_tl \l_@@_tmpa_tl
532 % \end{macrocode}
533 % Now we have our path initialised, we can start appending the side paths according to the specification in the second argument.
534 %
535 % We append the initial coordinate to the end of the list to make a closed cycle.
536 % \begin{macrocode}
537 \tl_set:Nn \l_@@_tmpa_tl {#3}
538 \tl_put_right:Nx \l_@@_tmpa_tl {{\tl_head:N \l_@@_tmpa_tl}}
539 % \end{macrocode}
540 % Now we walk through the description of the sides, adding the specified paths to our tile path.
541 % \begin{macrocode}
542 \tl_map_inline:nn {#2} {
543 % \end{macrocode}
544 % Clone the path for this side.
545 % \begin{macrocode}
546 \tl_set:Nx \l_@@_tmpc_tl {\tl_head:n {##1}}
547 \tl_if_exist:cF {g_@@_side_ \tl_use:N \l_@@_tmpc_tl _tl}
548 {
549 \msg_error:nnx { tilings }{ no side } { \tl_use:N \l_@@_tmpc_tl }
550 \tl_gset_eq:cc
551 {g_@@_side_ \tl_use:N \l_@@_tmpc_tl _tl}
552 {g_@@_side_a_tl}
553 }
554 \tl_set_eq:Nc \l_@@_tmpd_tl
555 {g_@@_side_ \tl_use:N \l_@@_tmpc_tl _tl}
556 % \end{macrocode}
557 % Strip off the next coordinate, and convert it to a point.
558 % \begin{macrocode}
559 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
560 \tl_set:Nx \l_@@_tmpa_tl {\tl_tail:N \l_@@_tmpa_tl}
561 % \end{macrocode}
562 % Store the resulting coordinate.
563 % \begin{macrocode}
564 \fp_set:Nn \l_@@_tmpa_fp
565 { \tl_item:Nn \l_@@_tmpb_tl {1} }
566 \fp_set:Nn \l_@@_tmpb_fp
567 { \tl_item:Nn \l_@@_tmpb_tl {2} }
568 % \end{macrocode}
569 % Now get the next coordinate.
570 % \begin{macrocode}
571 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
572 % \end{macrocode}
573 % We want the difference between the two coordinates.
574 % \begin{macrocode}
575 \fp_set:Nn \l_@@_tmpa_fp
576 {\tl_item:Nn \l_@@_tmpb_tl {1} - \l_@@_tmpa_fp}
577 \fp_set:Nn \l_@@_tmpb_fp
578 {\tl_item:Nn \l_@@_tmpb_tl {2} - \l_@@_tmpb_fp}
579 % \end{macrocode}
580 % This is converted into a transformation matrix.
581 % \begin{macrocode}
582 \fp_set:Nn \l_@@_tmpc_fp {-\l_@@_tmpb_fp}
583 \tl_set:Nx \l_@@_tmpb_tl
584 {
585 {\fp_to_dim:n { \l_@@_tmpa_fp * \c_@@_cm_fp }}
586 {\fp_to_dim:n { \l_@@_tmpb_fp * \c_@@_cm_fp }}% not swapped
587 {\fp_to_dim:n { \l_@@_tmpc_fp * \c_@@_cm_fp }}% not swapped
588 {\fp_to_dim:n { \l_@@_tmpa_fp * \c_@@_cm_fp }}
589 {0}
590 {0}
591 }
592 % \end{macrocode}
593 % The transformation is applied to the cloned path.
594 % \begin{macrocode}
595 \spath_transform:NV \l_@@_tmpd_tl \l_@@_tmpb_tl
596 % \end{macrocode}
597 % And this is welded to the tile path.
598 % \begin{macrocode}
599 \spath_weld:NV \l_@@_tmp_tile_path_tl \l_@@_tmpd_tl
600 }
601 % \end{macrocode}
602 % At the end we close the path.
603 % \begin{macrocode}
604 \spath_close:N \l_@@_tmp_tile_path_tl
605 \tl_gset_eq:NN \g_@@_output_tl \l_@@_tmp_tile_path_tl
606 \group_end:
607 \tl_gclear_new:c {g_@@_tile_#1_tl}
608 \tl_gset_eq:cN {g_@@_tile_#1_tl} \g_@@_output_tl
609 \tl_gclear:N \g_@@_output_tl
610 }
611 % \end{macrocode}
612 % \end{macro}
613 %
614 % \begin{macro}[internal]{\@@_make_tile:nn}
615 % A wrapper around the above which allows us to specify the second two arguments as two items in a token list.
616 % \begin{macrocode}
617 \cs_new_nopar:Npn \@@_make_tile:nn #1#2
618 {
619 \@@_make_tile:nnn {#1} #2
620 }
621 \cs_generate_variant:Nn \@@_make_tile:nn {nV}
622 % \end{macrocode}
623 % \end{macro}
624 %
625 % \subsection{Specifying the Tiles}
626 %
627 % The tile specifications are contained in a \Verb+prop+.
628 % \begin{macrocode}
629 \prop_new:N \g_@@_tiles_prop
630 % \end{macrocode}
631 %
632 % \begin{macro}[internal]{\@@_add_coordinate:Nnn, \@@_add_coordinate:w}
633 % Process a coordinate through \Verb+fp+ and adds it to a token list.
634 % \begin{macrocode}
635 \cs_new_nopar:Npn \@@_add_coordinate:Nnn #1#2#3 {
636 \group_begin:
637 \fp_set:Nn \l_@@_tmpa_fp {#2}
638 \fp_set:Nn \l_@@_tmpb_fp {#3}
639 \bool_if:NT \l_@@_relative_bool
640 {
641 \fp_add:Nn \l_@@_tmpa_fp {\l_@@_saved_x_fp}
642 \fp_add:Nn \l_@@_tmpb_fp {\l_@@_saved_y_fp}
643 }
644 \fp_gset_eq:NN \g_@@_output_a_fp \l_@@_tmpa_fp
645 \fp_gset_eq:NN \g_@@_output_b_fp \l_@@_tmpb_fp
646 \group_end:
647 \tl_put_right:Nx #1
648 {
649 {{\fp_use:N \g_@@_output_a_fp}{\fp_use:N \g_@@_output_b_fp}}
650 }
651 \bool_if:NT \l_@@_update_saved_bool
652 {
653 \fp_set_eq:NN \l_@@_saved_x_fp \g_@@_output_a_fp
654 \fp_set_eq:NN \l_@@_saved_y_fp \g_@@_output_b_fp
655 }
656 \fp_gzero:N \g_@@_output_a_fp
657 \fp_gzero:N \g_@@_output_b_fp
658 }
659 % \end{macrocode}
660 % Wrapper around the add coordinate command to split at a comma.
661 % \begin{macrocode}
662 \cs_new_nopar:Npn \@@_add_xy_coordinate:w #1#2,#3 \q_stop
663 {
664 \@@_add_coordinate:Nnn #1 {#2}{#3}
665 }
666 % \end{macrocode}
667 %
668 % Wrapper around the add coordinate command to split at a colon.
669 % \begin{macrocode}
670 \cs_new_nopar:Npn \@@_add_rth_coordinate:w #1#2:#3 \q_stop
671 {
672 \@@_add_coordinate:Nnn #1 {(#3) * cosd(#2)}{(#3) * sind(#2)}
673 }
674 % \end{macrocode}
675 % \end{macro}
676 %
677 % \begin{macro}[internal]{\@@_transform_side_to_axis:Nnn}
678 % Apply a transformation to make a given side lie on the x-axis.
679 % Second argument is the tile, third is the side, first is whether to reverse the side.
680 % \begin{macrocode}
681 \cs_new_nopar:Npn \@@_transform_side_to_axis:Nnn #1#2#3
682 {
683 % \end{macrocode}
684 % Get our tile data, checking if the tile exists.
685 % \begin{macrocode}
686 \group_begin:
687 \prop_get:NnNTF \g_@@_tiles_prop {#2} \l_@@_tmpa_tl
688 {
689 % \end{macrocode}
690 % Start with the edge list.
691 %
692 % Initialise the counter.
693 % \begin{macrocode}
694 \int_zero:N \l_@@_tmpb_int
695 \int_incr:N \l_@@_tmpb_int
696 % \end{macrocode}
697 % Get the path type list.
698 %
699 % \begin{macrocode}
700 \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
701 % \end{macrocode}
702 %
703 % Iterate through the path type list, looking for the requested path.
704 % \begin{macrocode}
705 \bool_set_false:N \l_@@_edge_bool
706 \tl_map_inline:Nn \l_@@_tmpc_tl {
707 \str_if_eq:nnT {##1} {#3} {
708 \bool_set_true:N \l_@@_edge_bool
709 \tl_map_break:
710 }
711 \int_incr:N \l_@@_tmpb_int
712 }
713 \bool_if:NTF \l_@@_edge_bool
714 {
715 % \end{macrocode}
716 % Get the coordinate list.
717 % \begin{macrocode}
718 \tl_set:Nx \l_@@_tmpc_tl {\tl_tail:N \l_@@_tmpa_tl}
719 % \end{macrocode}
720 % Strip off the outer braces.
721 % \begin{macrocode}
722 \tl_set:Nx \l_@@_tmpc_tl {\tl_item:Nn \l_@@_tmpc_tl {1}}
723 % \end{macrocode}
724 % Add the first coordinate at the end.
725 % \begin{macrocode}
726 \tl_put_right:Nx \l_@@_tmpc_tl
727 {{\tl_item:Nn \l_@@_tmpc_tl {1}}}
728 % \end{macrocode}
729 % Get the coordinates for this edge.
730 % \begin{macrocode}
731 \tl_set:Nx \l_@@_tmpa_tl
732 {\tl_item:Nn \l_@@_tmpc_tl {\int_use:N \l_@@_tmpb_int}}
733 \tl_set:Nx \l_@@_tmpb_tl
734 {\tl_item:Nn \l_@@_tmpc_tl {\int_use:N \l_@@_tmpb_int + 1}}
735 % \end{macrocode}
736 % Possibly swap the ends.
737 % \begin{macrocode}
738 \bool_if:NT #1
739 {
740 \tl_set:NV \l_@@_tmpc_tl \l_@@_tmpa_tl
741 \tl_set:NV \l_@@_tmpa_tl \l_@@_tmpb_tl
742 \tl_set:NV \l_@@_tmpb_tl \l_@@_tmpc_tl
743 }
744 % \end{macrocode}
745 % Get the coordinates of the first point, which will be the origin of the transformation.
746 % \begin{macrocode}
747 \fp_set:Nn \l_@@_xa_fp {\tl_item:Nn \l_@@_tmpb_tl {1}}
748 \fp_set:Nn \l_@@_ya_fp {\tl_item:Nn \l_@@_tmpb_tl {2}}
749 % \end{macrocode}
750 % Get the coordinates of the second point and adjust relative to the first.
751 % \begin{macrocode}
752 \fp_set:Nn \l_@@_xb_fp
753 {\tl_item:Nn \l_@@_tmpa_tl {1} - \l_@@_xa_fp}
754 \fp_set:Nn \l_@@_yb_fp
755 {\tl_item:Nn \l_@@_tmpa_tl {2} - \l_@@_ya_fp}
756 % \end{macrocode}
757 % And normalise the vector along it.
758 % \begin{macrocode}
759 % \fp_set:Nn \l_@@_xb_fp {\l_@@_xb_fp / \c_@@_cm_fp}
760 % \fp_set:Nn \l_@@_yb_fp {\l_@@_yb_fp / \c_@@_cm_fp}
761 \fp_set:Nn \l_@@_tmpa_fp
762 {(\l_@@_xb_fp)^2 + (\l_@@_yb_fp)^2}
763 \fp_set:Nn \l_@@_xb_fp { \l_@@_xb_fp / \l_@@_tmpa_fp}
764 \fp_set:Nn \l_@@_yb_fp { \l_@@_yb_fp / \l_@@_tmpa_fp}
765 % \end{macrocode}
766 % Now rotate so that the \(x\)--axis lies along the edge.
767 % \begin{macrocode}
768 \tl_gset:Nx \g_@@_output_tl
769 {
770 \exp_not:N \pgftransformtriangle
771 {
772 \exp_not:N \pgfpoint{0pt}{0pt}
773 }
774 {
775 \exp_not:N \pgfpoint
776 {\fp_to_dim:N \l_@@_xb_fp}{\fp_to_dim:n {-\l_@@_yb_fp}}
777 }
778 {
779 \exp_not:N \pgfpoint
780 {\fp_to_dim:N \l_@@_yb_fp}{\fp_to_dim:N \l_@@_xb_fp}
781 }
782 \exp_not:N \pgftransformshift
783 {
784 \exp_not:N \pgfpoint
785 {
786 \fp_to_dim:n {-\l_@@_xa_fp * \c_@@_cm_fp}
787 }
788 {
789 \fp_to_dim:n {-\l_@@_ya_fp * \c_@@_cm_fp}
790 }
791 }
792 }
793 }
794 {
795 \msg_error:nnxxx {tilings} {tile no edge} {#2} {#3}
796 {\tl_use:N \l_@@_tmpc_tl }
797 \tl_gclear:N \g_@@_output_tl
798 }
799 }
800 {
801 \msg_error:nnn {tilings} {no tile} {#2}
802 \tl_gclear:N \g_@@_output_tl
803 }
804 \group_end:
805 \tl_use:N \g_@@_output_tl
806 \tl_gclear:N \g_@@_output_tl
807 }
808 % \end{macrocode}
809 % \end{macro}
810 %
811 % \begin{macrocode}
812 \cs_generate_variant:Nn
813 \@@_transform_side_to_axis:Nnn {Nnx,NnV,NVV}
814 % \end{macrocode}
815 %
816 % \begin{macro}[internal]{\@@_translate_vertex_to_origin:Nnn}
817 % Apply a transformation to make a given vertex sit at the origin.
818 % Second argument is the tile, third is the side, first is a boolean to determine whether to use the start or end.
819 % \begin{macrocode}
820 \cs_new_nopar:Npn \@@_translate_vertex_to_origin:Nnn #1#2#3
821 {
822 % \end{macrocode}
823 % Get our tile data, checking if the tile exists.
824 % \begin{macrocode}
825 \group_begin:
826 \prop_get:NnNTF \g_@@_tiles_prop {#2} \l_@@_tmpa_tl
827 {
828 % \end{macrocode}
829 % Start with the edge list.
830 %
831 % Initialise the counter.
832 % \begin{macrocode}
833 \int_zero:N \l_@@_tmpb_int
834 \int_incr:N \l_@@_tmpb_int
835 % \end{macrocode}
836 % Get the path type list.
837 %
838 % \begin{macrocode}
839 \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
840 % \end{macrocode}
841 %
842 % Iterate through the path type list, looking for the requested path.
843 % \begin{macrocode}
844 \bool_set_false:N \l_@@_edge_bool
845 \tl_map_inline:Nn \l_@@_tmpc_tl {
846 \str_if_eq:nnT {##1} {#3} {
847 \bool_set_true:N \l_@@_edge_bool
848 \tl_map_break:
849 }
850 \int_incr:N \l_@@_tmpb_int
851 }
852 \bool_if:NTF \l_@@_edge_bool
853 {
854 % \end{macrocode}
855 % Get the coordinate list.
856 % \begin{macrocode}
857 \tl_set:Nx \l_@@_tmpc_tl {\tl_tail:N \l_@@_tmpa_tl}
858 % \end{macrocode}
859 % Strip off the outer braces.
860 % \begin{macrocode}
861 \tl_set:Nx \l_@@_tmpc_tl {\tl_item:Nn \l_@@_tmpc_tl {1}}
862 % \end{macrocode}
863 % Add the first coordinate at the end.
864 % \begin{macrocode}
865 \tl_put_right:Nx \l_@@_tmpc_tl
866 {{\tl_item:Nn \l_@@_tmpc_tl {1}}}
867 % \end{macrocode}
868 % Get the coordinates for this edge.
869 % \begin{macrocode}
870 \tl_set:Nx \l_@@_tmpa_tl
871 {\tl_item:Nn \l_@@_tmpc_tl {\int_use:N \l_@@_tmpb_int}}
872 \tl_set:Nx \l_@@_tmpb_tl
873 {\tl_item:Nn \l_@@_tmpc_tl {\int_use:N \l_@@_tmpb_int + 1}}
874 % \end{macrocode}
875 % Possibly swap the ends.
876 % \begin{macrocode}
877 \bool_if:NT #1
878 {
879 \tl_set:NV \l_@@_tmpc_tl \l_@@_tmpa_tl
880 \tl_set:NV \l_@@_tmpa_tl \l_@@_tmpb_tl
881 \tl_set:NV \l_@@_tmpb_tl \l_@@_tmpc_tl
882 }
883 % \end{macrocode}
884 % Get the coordinates of the first point, which will be the origin of the transformation.
885 % \begin{macrocode}
886 \fp_set:Nn \l_@@_xa_fp {\tl_item:Nn \l_@@_tmpb_tl {1}}
887 \fp_set:Nn \l_@@_ya_fp {\tl_item:Nn \l_@@_tmpb_tl {2}}
888 % \end{macrocode}
889 % Shift to place the selected vertex at the origin.
890 % \begin{macrocode}
891 \tl_gset:Nx \g_@@_output_tl
892 {
893 \exp_not:N \pgftransformshift
894 {
895 \exp_not:N \pgfpoint
896 {
897 \fp_to_dim:n {-\l_@@_xa_fp * \c_@@_cm_fp}
898 }
899 {
900 \fp_to_dim:n {-\l_@@_ya_fp * \c_@@_cm_fp}
901 }
902 }
903 }
904 }
905 {
906 \msg_error:nnxxx {tilings} {tile no edge} {#2} {#3}
907 {\tl_use:N \l_@@_tmpc_tl }
908 \tl_gclear:N \g_@@_output_tl
909 }
910 }
911 {
912 \msg_error:nnn {tilings} {no tile} {#2}
913 \tl_gclear:N \g_@@_output_tl
914 }
915 \group_end:
916 \tl_use:N \g_@@_output_tl
917 \tl_gclear:N \g_@@_output_tl
918 }
919 % \end{macrocode}
920 % \end{macro}
921 %
922 % \begin{macrocode}
923 \cs_generate_variant:Nn
924 \@@_translate_vertex_to_origin:Nnn {Nnx,NnV,NVV}
925 % \end{macrocode}
926 %
927 % \begin{macro}[internal]{\TransformAlongSide}
928 % Make this available outside the \LaTeX3 environment.
929 % The starred version allows for reversing the side.
930 % \begin{macrocode}
931 \DeclareDocumentCommand \TransformAlongSide {s m m}
932 {
933 % \end{macrocode}
934 % Store the star
935 % \begin{macrocode}
936 \IfBooleanTF {#1}
937 {
938 \bool_set_true:N \l_@@_cw_bool
939 }
940 {
941 \bool_set_false:N \l_@@_cw_bool
942 }
943 \@@_transform_side_to_axis:Nnx \l_@@_cw_bool {#2}{#3}
944 }
945 % \end{macrocode}
946 % \end{macro}
947 %
948 % \begin{macro}[internal]{\@@_coordinates_at_vertices:n}
949 % This places TikZ coordinates at the vertices of the tile.
950 % \begin{macrocode}
951 \cs_new_nopar:Npn \@@_coordinates_at_vertices:n #1
952 {
953 \group_begin:
954 % \end{macrocode}
955 % Get our tile data
956 % \begin{macrocode}
957 \prop_get:NnN \g_@@_tiles_prop {#1} \l_@@_tmpa_tl
958 % \end{macrocode}
959 % Start with the edge list
960 % \begin{macrocode}
961 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpa_tl}
962 % \end{macrocode}
963 % Get the coordinate list
964 % \begin{macrocode}
965 \tl_set:Nx \l_@@_tmpc_tl {\tl_tail:N \l_@@_tmpa_tl}
966 % \end{macrocode}
967 % Strip off the outer braces
968 % \begin{macrocode}
969 \tl_set:Nx \l_@@_tmpc_tl
970 {\tl_item:Nn \l_@@_tmpc_tl {1}}
971 % \end{macrocode}
972 % Add the first coordinate at the end
973 % \begin{macrocode}
974 \tl_put_right:Nx \l_@@_tmpc_tl
975 {{\tl_item:Nn \l_@@_tmpc_tl {1}}}
976 % \end{macrocode}
977 % Get the first coordinate
978 % \begin{macrocode}
979 \tl_set:Nx \l_@@_tmpa_tl {\tl_head:N \l_@@_tmpc_tl}
980 \tl_set:Nx \l_@@_tmpc_tl {\tl_tail:N \l_@@_tmpc_tl}
981 % \end{macrocode}
982 % Iterate through the edge list, placing coordinates
983 % \begin{macrocode}
984 \tl_map_inline:Nn \l_@@_tmpb_tl {
985 \tl_set:Nx \l_@@_tmpd_tl {
986 \exp_not:N \coordinate
987 (-edge~ ##1~ start)~
988 at (
989 \tl_item:Nn \l_@@_tmpa_tl {1},
990 \tl_item:Nn \l_@@_tmpa_tl {2}
991 );
992 }
993 \tl_use:N \l_@@_tmpd_tl
994 \tl_set:Nx \l_@@_tmpa_tl {\tl_head:N \l_@@_tmpc_tl}
995 \tl_set:Nx \l_@@_tmpc_tl {\tl_tail:N \l_@@_tmpc_tl}
996 \tl_set:Nx \l_@@_tmpd_tl {
997 \exp_not:N \coordinate
998 (-edge~ ##1~ end)~
999 at (
1000 \tl_item:Nn \l_@@_tmpa_tl {1},
1001 \tl_item:Nn \l_@@_tmpa_tl {2}
1002 );
1003 }
1004 \tl_use:N \l_@@_tmpd_tl
1005 }
1006 \group_end:
1007 }
1008 % \end{macrocode}
1009 % \end{macro}
1010 %
1011 % \begin{macro}[internal]{\CoordinatesAtVertices}
1012 % User-accessible wrapper around the above.
1013 % \begin{macrocode}
1014 \DeclareDocumentCommand \CoordinatesAtVertices {m}
1015 {
1016 \@@_coordinates_at_vertices:n {#1}
1017 }
1018 % \end{macrocode}
1019 % \end{macro}
1020 %
1021 %
1022 % \begin{macrocode}
1023 \tikzset{
1024 transform~ to~ tile/.code~ args={#1~ along~ #2}{%
1025 \group_begin:
1026 \tl_if_in:nnTF {#1} {back}
1027 {
1028 \tikzset{
1029 tiling/alignment~ set~ location=#1,
1030 tiling/alignment~ direction={backwards}
1031 }
1032 }
1033 {
1034 \tikzset{
1035 tiling/alignment~ location=#1,
1036 tiling/alignment~ direction={forewards}
1037 }
1038 }
1039 \tl_if_in:nnTF {#2} {using}
1040 {
1041 \tikzset{
1042 tiling/alignment~ set~ edges=#2,
1043 }
1044 }
1045 {
1046 \tikzset{
1047 tiling/alignment~ edge=#2,
1048 }
1049 }
1050 \tikz_scan_point:n {
1051 (\@@_keys_get:n {alignment~ location}
1052 -edge~ \@@_keys_get:n {alignment~ edge}~ start)
1053 }
1054 \dim_set_eq:Nc \l_@@_xa_dim {pgf@x}
1055 \dim_set_eq:Nc \l_@@_ya_dim {pgf@y}
1056 \tikz_scan_point:n {
1057 (\@@_keys_get:n {alignment~ location}
1058 -edge~ \@@_keys_get:n {alignment~ edge}~ end)
1059 }
1060 \dim_set_eq:Nc \l_@@_xb_dim {pgf@x}
1061 \dim_set_eq:Nc \l_@@_yb_dim {pgf@y}
1062 \@@_keys_get:Nn \l_@@_tmpb_tl {alignment~ direction}
1063 \tl_if_eq:NnTF \l_@@_tmpb_tl {forewards}
1064 {
1065 \dim_gset_eq:NN \g_@@_xa_dim \l_@@_xa_dim
1066 \dim_gset_eq:NN \g_@@_ya_dim \l_@@_ya_dim
1067 \dim_gset_eq:NN \g_@@_xb_dim \l_@@_xb_dim
1068 \dim_gset_eq:NN \g_@@_yb_dim \l_@@_yb_dim
1069 }
1070 {
1071 \dim_gset_eq:NN \g_@@_xa_dim \l_@@_xb_dim
1072 \dim_gset_eq:NN \g_@@_ya_dim \l_@@_yb_dim
1073 \dim_gset_eq:NN \g_@@_xb_dim \l_@@_xa_dim
1074 \dim_gset_eq:NN \g_@@_yb_dim \l_@@_ya_dim
1075 }
1076 \dim_gsub:Nn \g_@@_xb_dim {\g_@@_xa_dim}
1077 \dim_gsub:Nn \g_@@_yb_dim {\g_@@_ya_dim}
1078 \dim_gset:Nn \g_@@_xb_dim
1079 {\g_@@_xb_dim * \dim_ratio:nn {1pt}{1cm}}
1080 \dim_gset:Nn \g_@@_yb_dim
1081 {\g_@@_yb_dim * \dim_ratio:nn {1pt}{1cm}}
1082 \group_end:
1083 % \end{macrocode}
1084 % We store the initial points in \Verb+\pgf@xa+ and \Verb+\pgf@ya+ but we want \Verb+\pgf@xb+ and \Verb+\pgf@yb+ to be a vector along the edge.
1085 % \begin{macrocode}
1086 % \end{macrocode}
1087 % We shift to the start of the edge.
1088 % \begin{macrocode}
1089 \pgftransformshift{\pgfpoint{\g_@@_xa_dim}{\g_@@_ya_dim}}
1090 % \end{macrocode}
1091 % Now rotate so that the \(x\)--axis lies along the edge.
1092 % \begin{macrocode}
1093 \pgftransformtriangle
1094 {\pgfpoint{0pt}{0pt}}
1095 {\pgfpoint{\g_@@_xb_dim}{\g_@@_yb_dim}}
1096 {\pgfpoint{-\g_@@_yb_dim}{\g_@@_xb_dim}}
1097 },
1098 align~ with/.code~ args={#1~ along~ #2}{%
1099 \tl_if_in:nnTF {#1} {back}
1100 {
1101 \tikzset{
1102 tiling/alignment~ set~ location=#1,
1103 tiling/alignment~ direction={backwards}
1104 }
1105 }
1106 {
1107 \tikzset{
1108 tiling/alignment~ location=#1,
1109 tiling/alignment~ direction={forewards}
1110 }
1111 }
1112 \tl_if_in:nnTF {#2} {using}
1113 {
1114 \tikzset{
1115 tiling/alignment~ set~ edges=#2,
1116 }
1117 }
1118 {
1119 \tikzset{
1120 tiling/alignment~ edge=#2,
1121 }
1122 }
1123 \tikz_node_if_defined:nTF
1124 {
1125 \@@_keys_get:n {alignment~ location}
1126 -edge~ \@@_keys_get:n {alignment~ edge}~ start
1127 }
1128 {
1129 \tikzset{
1130 tiling/alignment~ start/.expanded={
1131 (\@@_keys_get:n {alignment~ location}
1132 -edge~ \@@_keys_get:n {alignment~ edge}~ start)
1133 },
1134 tiling/alignment~ end/.expanded={
1135 (\@@_keys_get:n {alignment~ location}
1136 -edge~ \@@_keys_get:n {alignment~ edge}~ end)
1137 },
1138 }
1139 }
1140 {
1141 \@@_keys_get:Nn \l_@@_tmpa_tl {alignment~ location}
1142 \tl_set:Nx \l_@@_tmpa_tl {\tl_use:N \l_@@_tmpa_tl}
1143 \prop_get:NVNTF \g_@@_tilenames_prop
1144 \l_@@_tmpa_tl \l_@@_tmpb_tl
1145 {
1146 \prop_get:NVN \g_@@_tiles_prop
1147 \l_@@_tmpb_tl \l_@@_tmpc_tl
1148 \msg_error:nnxxx { tilings }{ tile no edge }
1149 {
1150 \tl_use:N \l_@@_tmpa_tl \c_space_tl
1151 (type~ \tl_use:N \l_@@_tmpb_tl)
1152 }
1153 {\@@_keys_get:n {alignment~ edge} }
1154 { \tl_item:Nn \l_@@_tmpc_tl {1} }
1155 }
1156 {
1157 \msg_error:nnx { tilings }{ no tile }
1158 {\@@_keys_get:n {alignment~ location} }
1159 }
1160 }
1161 },
1162 tiling/.is~ family,
1163 tiling/alignment~ set~ location/.code~ args={#1~ back}{
1164 \tikzset{
1165 tiling/alignment~ location=#1,
1166 }
1167 },
1168 tiling/alignment~ set~ edges/.code~ args={#1~ using~ #2}{
1169 \tikzset{
1170 tiling/alignment~ edge=#1,
1171 tiling/alignment~ new~ edge=#2
1172 }
1173 },
1174 align~ between/.code~ args={#1~ and~ #2~ using~ #3}{
1175 \tikzset{
1176 tiling/alignment~ start={#1},
1177 tiling/alignment~ end={#2},
1178 }
1179 \str_set:Nn \l_@@_tmpa_str {#3}
1180 \str_set:Nx \l_@@_tmpb_str {\str_tail:N \l_@@_tmpa_str}
1181 \tikzset{
1182 tiling/alignment~ new~ edge/.expanded={\str_use:N \l_@@_tmpb_str}
1183 }
1184 \str_set:Nx \l_@@_tmpa_str {\str_head:N \l_@@_tmpa_str}
1185 \str_set:Nx \l_@@_tmpb_str {\str_lowercase:f { \l_@@_tmpa_str}}
1186 \str_if_eq:NNT \l_@@_tmpa_str \l_@@_tmpb_str
1187 {
1188 \str_set:Nx \l_@@_tmpb_str
1189 {\str_uppercase:f { \l_@@_tmpa_str}}
1190 }
1191 \tikzset{
1192 tiling/alignment~ edge/.expanded={\str_use:N \l_@@_tmpb_str},
1193 }
1194 },
1195 tiling/alignment~ location/.initial={},
1196 tiling/alignment~ edge/.initial=a,
1197 tiling/alignment~ new~ edge/.initial={},
1198 tiling/alignment~ direction/.initial={forewards},
1199 tiling/alignment~ start/.initial={},
1200 tiling/alignment~ end/.initial={},
1201 tiling/anchor/.initial={},
1202 % \end{macrocode}
1203 % Default clipping style.
1204 % \begin{macrocode}
1205 every~ tile~ clip/.style={clip}
1206 }
1207 % \end{macrocode}
1208 %
1209 % \begin{function}{\DefineTile}
1210 % This is the user function for defining a tile.
1211 % \begin{macrocode}
1212 \DeclareDocumentCommand \DefineTile { s m m m }
1213 {
1214 % \end{macrocode}
1215 % Clear the temporary variable.
1216 % \begin{macrocode}
1217 \tl_clear:N \l_@@_tmpa_tl
1218 % \end{macrocode}
1219 % The 3rd parameter is a list of coordinates at vertices, iterate through them and add them to the list.
1220 % \begin{macrocode}
1221 \int_zero:N \l_@@_tmpa_int
1222 \fp_zero:N \l_@@_saved_x_fp
1223 \fp_zero:N \l_@@_saved_y_fp
1224 \tl_map_inline:nn {#4} {
1225 \str_set:Nn \l_@@_tmpa_str {##1}
1226 \str_if_eq:VnTF \l_@@_tmpa_str {+}
1227 {
1228 \int_incr:N \l_@@_tmpa_int
1229 }
1230 {
1231 \int_case:nn {\l_@@_tmpa_int}
1232 {
1233 {0} {
1234 \bool_set_false:N \l_@@_relative_bool
1235 \bool_set_true:N \l_@@_update_saved_bool
1236 }
1237 {1} {
1238 \bool_set_true:N \l_@@_relative_bool
1239 \bool_set_false:N \l_@@_update_saved_bool
1240 }
1241 {2} {
1242 \bool_set_true:N \l_@@_relative_bool
1243 \bool_set_true:N \l_@@_update_saved_bool
1244 }
1245
1246 }
1247 \str_if_in:NnTF \l_@@_tmpa_str {:}
1248 {
1249 \seq_set_split:NVV \l_@@_tmpa_seq \c_@@_colon_str \l_@@_tmpa_str
1250 \@@_add_coordinate:Nnn \l_@@_tmpa_tl
1251 {
1252 (\seq_item:Nn \l_@@_tmpa_seq {2}) * cosd (\seq_item:Nn \l_@@_tmpa_seq {1})
1253 }
1254 {
1255 (\seq_item:Nn \l_@@_tmpa_seq {2}) * sind (\seq_item:Nn \l_@@_tmpa_seq {1})
1256 }
1257 }
1258 {
1259 \seq_set_split:NVV \l_@@_tmpa_seq \c_@@_comma_str \l_@@_tmpa_str
1260 \@@_add_coordinate:Nnn \l_@@_tmpa_tl
1261 {
1262 (\seq_item:Nn \l_@@_tmpa_seq {1})
1263 }
1264 {
1265 (\seq_item:Nn \l_@@_tmpa_seq {2})
1266 }
1267 }
1268 \int_zero:N \l_@@_tmpa_int
1269 }
1270 }
1271 % \end{macrocode}
1272 % Now we make a list of the edge types (from the 2nd parameter), using a prop to keep track of whether an edge is repeated.
1273 % \begin{macrocode}
1274 \prop_clear:N \l_@@_tmpa_prop
1275 \tl_map_inline:nn {#3} {
1276 \prop_if_in:NnTF \l_@@_tmpa_prop {##1}
1277 {
1278 \prop_put:Nnn \l_@@_tmpa_prop {##1} {1}
1279 }
1280 {
1281 \prop_put:Nnn \l_@@_tmpa_prop {##1} {0}
1282 }
1283 }
1284 % \end{macrocode}
1285 % Having established their multiplicity, we now create the edges with their names, appending numbers to their names if used more than once.
1286 % \begin{macrocode}
1287 \tl_clear:N \l_@@_tmpb_tl
1288 \tl_map_inline:nn {#3}
1289 {
1290 \tl_clear:N \l_@@_tmpc_tl
1291 \tl_put_right:Nn \l_@@_tmpc_tl {##1}
1292 \int_compare:nF {\prop_item:Nn \l_@@_tmpa_prop {##1} == 0} {
1293 \tl_put_right:Nx \l_@@_tmpc_tl
1294 {\prop_item:Nn \l_@@_tmpa_prop {##1}}
1295 \prop_put:Nnx \l_@@_tmpa_prop {##1}
1296 {\int_eval:n {\prop_item:Nn \l_@@_tmpa_prop {##1} + 1}}
1297 }
1298 \tl_put_right:Nx \l_@@_tmpb_tl {{ \l_@@_tmpc_tl }}
1299 }
1300 % \end{macrocode}
1301 % Finally, we can create our tile and add it to the global tile prop.
1302 % \begin{macrocode}
1303 \prop_gput:Nnx \g_@@_tiles_prop {#2}
1304 {{\tl_use:N \l_@@_tmpb_tl} {\tl_use:N \l_@@_tmpa_tl}}
1305 % \end{macrocode}
1306 % Having created the tile, we make a TikZ pic to place it on the page.
1307 % \begin{macrocode}
1308 \tikzset{
1309 #2/.pic={
1310 \begin{scope}[
1311 every~ tile~ scope/.try,
1312 every~ #2~ scope/.try,
1313 this~ tile~ scope/.try
1314 ]
1315 % \end{macrocode}
1316 % Save the name and tile type
1317 % \begin{macrocode}
1318 \tikz@fig@mustbenamed
1319 \prop_gput:NVn \g_@@_tilenames_prop \tikz@fig@name {#2}
1320 % \end{macrocode}
1321 % Were we given coordinates to align ourselves against?
1322 % \begin{macrocode}
1323 \@@_keys_get:Nn \l_@@_tmpa_tl {alignment~ start}
1324 \tl_if_empty:NTF \l_@@_tmpa_tl
1325 {
1326 % \end{macrocode}
1327 % No alignment information was given, was an anchor specified?
1328 % \begin{macrocode}
1329 \prop_get:NnN \g_@@_tiles_prop {#2} \l_@@_tmpa_tl
1330 \tl_set:Nx \l_@@_tmpc_tl {\tl_head:N \l_@@_tmpa_tl}
1331 \@@_keys_get:Nn \l_@@_tmpa_tl {anchor}
1332 \tl_if_empty:NTF \l_@@_tmpa_tl
1333 {
1334 % \end{macrocode}
1335 % No positioning information given, but we might have been asked to flip the tile
1336 % \begin{macrocode}
1337 \bool_if:NT \l_@@_cw_bool
1338 {
1339 \pgftransformxscale {-1}
1340 }
1341 }
1342 {
1343 \regex_extract_once:NVNTF
1344 \c_@@_anchor_regex \l_@@_tmpa_tl \l_@@_tmpb_tl
1345 {
1346 \regex_replace_once:NnN \c_@@_anchor_regex {} \l_@@_tmpa_tl
1347 \tl_if_eq:NnTF \l_@@_tmpb_tl {~end}
1348 {
1349 \bool_set_true:N \l_@@_cw_bool
1350 }
1351 {
1352 \bool_set_false:N \l_@@_cw_bool
1353 }
1354 }
1355 {
1356 \bool_set_false:N \l_@@_cw_bool
1357 }
1358 \tl_set:Nx \l_@@_tmpb_tl {{\tl_use:N \l_@@_tmpa_tl}}
1359 \tl_if_in:NVT \l_@@_tmpc_tl \l_@@_tmpb_tl
1360 {
1361 \@@_translate_vertex_to_origin:NnV
1362 \l_@@_cw_bool {#2} \l_@@_tmpa_tl
1363 }
1364 }
1365 }
1366 {
1367 % \end{macrocode}
1368 % Yes, we were.
1369 % So we adjust our position accordingly.
1370 % The first job is to transform so that we're aligned with the specified coordinates.
1371 % \begin{macrocode}
1372 \group_begin:
1373 % \end{macrocode}
1374 % We get the locations of the start and ending coordinates.
1375 % \begin{macrocode}
1376 \tikzset{
1377 name~ prefix~ ..
1378 }
1379 \tikz_scan_point:n {
1380 \@@_keys_get:n {alignment~ start}
1381 }
1382 \dim_set_eq:Nc \l_@@_xa_dim {pgf@x}
1383 \dim_set_eq:Nc \l_@@_ya_dim {pgf@y}
1384 \tikz_scan_point:n {
1385 \@@_keys_get:n {alignment~ end}
1386 }
1387 \dim_set_eq:Nc \l_@@_xb_dim {pgf@x}
1388 \dim_set_eq:Nc \l_@@_yb_dim {pgf@y}
1389 \@@_keys_get:Nn \l_@@_tmpb_tl {alignment~ direction}
1390 \tl_if_eq:NnTF \l_@@_tmpb_tl {forewards}
1391 {
1392 \dim_gset_eq:NN \g_@@_xa_dim \l_@@_xa_dim
1393 \dim_gset_eq:NN \g_@@_ya_dim \l_@@_ya_dim
1394 \dim_gset_eq:NN \g_@@_xb_dim \l_@@_xb_dim
1395 \dim_gset_eq:NN \g_@@_yb_dim \l_@@_yb_dim
1396 }
1397 {
1398 \dim_gset_eq:NN \g_@@_xa_dim \l_@@_xb_dim
1399 \dim_gset_eq:NN \g_@@_ya_dim \l_@@_yb_dim
1400 \dim_gset_eq:NN \g_@@_xb_dim \l_@@_xa_dim
1401 \dim_gset_eq:NN \g_@@_yb_dim \l_@@_ya_dim
1402 }
1403 \dim_gsub:Nn \g_@@_xb_dim {\g_@@_xa_dim}
1404 \dim_gsub:Nn \g_@@_yb_dim {\g_@@_ya_dim}
1405 \dim_gset:Nn \g_@@_xb_dim {\g_@@_xb_dim * \dim_ratio:nn {1pt}{1cm}}
1406 \dim_gset:Nn \g_@@_yb_dim {\g_@@_yb_dim * \dim_ratio:nn {1pt}{1cm}}
1407 \group_end:
1408 % \end{macrocode}
1409 % We shift to the start of the edge.
1410 % \begin{macrocode}
1411 \pgftransformshift{\pgfpoint{\g_@@_xa_dim}{\g_@@_ya_dim}}
1412 % \end{macrocode}
1413 % And normalise the vector along it.
1414 % \begin{macrocode}
1415 % \pgfpointnormalised{\pgfpoint{\g_@@_xb_dim}{\g_@@_yb_dim}}
1416 % \dim_gset_eq:Nc \g_@@_xb_dim {pgf@x}
1417 % \dim_gset_eq:Nc \g_@@_yb_dim {pgf@y}
1418 % \end{macrocode}
1419 % Now rotate so that the \(x\)--axis lies along the edge.
1420 % \begin{macrocode}
1421 \pgftransformtriangle
1422 {\pgfpoint{0pt}{0pt}}
1423 {\pgfpoint{\g_@@_xb_dim}{\g_@@_yb_dim}}
1424 {\pgfpoint{-\g_@@_yb_dim}{\g_@@_xb_dim}}
1425 % \end{macrocode}
1426 % The next job is to shift and rotate the current tile so that the correct edge ends up against the receiving tile.
1427 % \begin{macrocode}
1428 \str_set:Nx \l_@@_tmpa_str
1429 {\@@_keys_get:n {alignment~ edge}}
1430 \str_set:Nx \l_@@_tmpa_str {\str_head:N \l_@@_tmpa_str}
1431 \str_put_right:Nx \l_@@_tmpa_str
1432 {\@@_keys_get:n {alignment~ new~ edge}}
1433 \str_set:Nx \l_@@_tmpb_str {\str_lowercase:f { \l_@@_tmpa_str}}
1434 \str_if_eq:NNT \l_@@_tmpa_str \l_@@_tmpb_str
1435 {
1436 \str_set:Nx \l_@@_tmpb_str
1437 {\str_uppercase:f { \l_@@_tmpa_str}}
1438 }
1439
1440 \IfBooleanT {#1}
1441 {
1442 \bool_set:Nn \l_@@_cw_bool {!\l_@@_cw_bool}
1443 }
1444 \bool_if:NT \l_@@_cw_bool
1445 {
1446 \pgftransformyscale {-1}
1447 }
1448 \@@_transform_side_to_axis:NnV \l_@@_cw_bool {#2} \l_@@_tmpb_str
1449 }
1450 % \end{macrocode}
1451 % Now that the transformation is finalised, we can render the tile.
1452 % We clip against the tile path so that the tiles don't ``bleed''.
1453 % If we didn't do this, drawing the tile would result in overlaps which can look a bit ugly.
1454 % On the other hand, tight clipping can lead to ``gaps'' between the tiles so we make this optional by enclosing it in a style.
1455 %
1456 % We start by putting coordinates at each vertex, labelled by which edge they are.
1457 % \begin{macrocode}
1458 \@@_coordinates_at_vertices:n {#2}
1459 % \end{macrocode}
1460 % And one at the origin of the pic
1461 % \begin{macrocode}
1462 \coordinate[alias=-center] (-centre) at (0,0);
1463 % \end{macrocode}
1464 %
1465 % The first action is to clip against the tile path.
1466 % \begin{macrocode}
1467 \UseTile[
1468 every~ tile~ clip/.try,
1469 every~ #2~ clip/.try,
1470 this~ tile~ clip/.try
1471 ]{#2}
1472 % \end{macrocode}
1473 % Any pre-actions?
1474 % \begin{macrocode}
1475 \tikzset{
1476 every~ tile~ before~ path/.try,
1477 every~ #2~ before~ path/.try,
1478 this~ tile~ before~ path/.try
1479 }
1480 % \end{macrocode}
1481 % Now we render the tile path
1482 % \begin{macrocode}
1483 \UseTile[
1484 every~ tile/.try,
1485 every~ #2/.try,
1486 this~ tile/.try,
1487 pic~ actions
1488 ]{#2}
1489 % \end{macrocode}
1490 % After drawing the tile and placing the coordinates,
1491 % \begin{macrocode}
1492 \tikzset{
1493 every~ tile~ after~ path/.try,
1494 every~ #2~ after~ path/.try,
1495 this~ tile~ after~ path/.try
1496 }
1497 \end{scope}
1498 },
1499 % \end{macrocode}
1500 % This is a shortcut for installing the \Verb+pic+ type.
1501 % \begin{macrocode}
1502 #2/.style={
1503 every~ tile~ pic/.try,
1504 every~ #2~ pic/.try,
1505 pic~ type=#2,
1506 }
1507 }
1508 }
1509 % \end{macrocode}
1510 % \end{function}
1511 %
1512 % \begin{function}{\BakeTile}
1513 % This is the user wrapper around the tile creation macros.
1514 % \begin{macrocode}
1515 \cs_new_protected_nopar:Npn \@@_bake_tile:n #1
1516 {
1517 \prop_get:NnN \g_@@_tiles_prop {#1} \l_@@_tmpa_tl
1518 \@@_make_tile:nV {#1} \l_@@_tmpa_tl
1519 }
1520
1521 \NewDocumentCommand \BakeTile {m}
1522 {
1523 \@@_bake_tile:n {#1}
1524 }
1525 % \end{macrocode}
1526 % \end{function}
1527 %
1528 % \begin{function}{\UseTile}
1529 % This is the command that actually places a tile on the page.
1530 % The first argument is optional and is for styling.
1531 % \begin{macrocode}
1532 \cs_new_protected_nopar:Npn \@@_use_tile:nn #1#2
1533 {
1534 % \end{macrocode}
1535 % We need to transform the tile to correspond to the current transformation matrix.
1536 % To ensure that we only transform the current tile, we clone it first.
1537 % \begin{macrocode}
1538 \tl_if_exist:cTF {g_@@_tile_#2_tl}
1539 {
1540 \tl_set_eq:Nc \l_@@_tmp_tile_path_tl {g_@@_tile_#2_tl}
1541 % \end{macrocode}
1542 % We get the current transformation to apply to this path.
1543 % \begin{macrocode}
1544 \pgfgettransform \l_@@_tmpa_tl
1545 % \end{macrocode}
1546 % Apply the transformation, protocol the path, and render it.
1547 % \begin{macrocode}
1548 \spath_transform:NV \l_@@_tmp_tile_path_tl \l_@@_tmpa_tl
1549 \spath_tikz_path:nV {#1} \l_@@_tmp_tile_path_tl
1550 }
1551 {
1552 \msg_error:nnn { tilings }{ not baked }{#2}
1553 }
1554 }
1555
1556 \NewDocumentCommand \UseTile {O{} m}
1557 {
1558 \@@_use_tile:nn {#1}{#2}
1559 }
1560 % \end{macrocode}
1561 % \end{function}
1562 %
1563 % \begin{macro}{save tiling path}
1564 % This is a style for a user to take a path and make it into the path for one of the sides.
1565 % It needs to store both that side and the reverse.
1566 % \begin{macrocode}
1567 \tikzset{
1568 save~ tiling~ path/.code={
1569 \tikz@addmode{
1570 % \end{macrocode}
1571 % Get the current path.
1572 % \begin{macrocode}
1573 \pgfsyssoftpath@getcurrentpath\l_@@_tmpa_tl
1574 % \end{macrocode}
1575 % Normalise the path and save.
1576 % \begin{macrocode}
1577 \@@_normalise_path:N \l_@@_tmpa_tl
1578 \tl_gclear_new:c {g_@@_side_#1_tl}
1579 \tl_gset_eq:cN {g_@@_side_#1_tl} \l_@@_tmpa_tl
1580 % \end{macrocode}
1581 % Now create the reverse path.
1582 % The name is the upper case version.
1583 % \begin{macrocode}
1584 \tl_set:Nx \l_@@_tmpb_tl {\str_uppercase:n {#1}}
1585 % \end{macrocode}
1586 % Reverse the path, and relocate to the interval \([0,1]\).
1587 % \begin{macrocode}
1588 \spath_reverse:N \l_@@_tmpa_tl
1589 \spath_transform:Nnnnnnn \l_@@_tmpa_tl {-1} {0} {0} {-1} {1} {0}
1590 \tl_gclear_new:c {g_@@_side_ \tl_use:N \l_@@_tmpb_tl _tl}
1591 \tl_gset_eq:cN {g_@@_side_ \tl_use:N \l_@@_tmpb_tl _tl} \l_@@_tmpa_tl
1592 }
1593 },
1594 clone~ tiling~ side~ path/.style~ 2~ args={
1595 spath/set~ name=tiling~ side,
1596 spath/clone~ global={#1}{#2}
1597 },
1598 flip~ tile/.code={
1599 \tl_set:Nn \l_@@_tmpa_tl {#1}
1600 \tl_set:Nn \l_@@_tmpb_tl {true}
1601 \bool_set:Nn \l_@@_cw_bool {\tl_if_eq_p:NN \l_@@_tmpa_tl \l_@@_tmpb_tl}
1602 },
1603 flip~ tile/.default={true},
1604 spath/prefix/tiling~side/.style={
1605 spath/set~ prefix=g_@@_side_,
1606 },
1607 spath/suffix/tiling~side/.style={
1608 spath/set~ suffix=_tl,
1609 },
1610 clone~ tile~ path/.style~ 2~ args={
1611 spath/set~ name=tiling~tile,
1612 spath/clone~ global={#1}{#2}
1613 },
1614 spath/prefix/tiling~tile/.style={
1615 spath/set~ prefix=g_@@_tile_,
1616 },
1617 spath/suffix/tiling~tile/.style={
1618 spath/set~ suffix=_tl,
1619 },
1620 expand~ key/.code={
1621 \exp_args:NV \pgfkeysalso #1
1622 }
1623 }
1624 % \end{macrocode}
1625 % \end{macro}
1626 %
1627 % \subsection{Lindenmayer System}
1628 %
1629 % This is an implementation of the Lindenmayer System description of Penrose and other tilings as a way of generating tilings from a specific starting seed.
1630 %
1631 % The implementation uses \Verb+prop+s to store \emph{rules} and \emph{actions}.
1632 % The rules are used to expand the starting seed to a certain level, after which the actions are carried out.
1633 % The syntax is based on the PGF library, but as we're already using \LaTeX3 it is reimplemented in that.
1634 %
1635 % \begin{macro}[internal]{\@@_make_lms:Nnnn}
1636 % This creates the token list of actions, starting with the seed.
1637 % The arguments are: a token list to store the result in, the name of the system, the number of iterations, and the initial state.
1638 % \begin{macrocode}
1639 \cs_new_nopar:Npn \@@_make_lms:Nnnn #1#2#3#4
1640 {
1641 \group_begin:
1642 % \end{macrocode}
1643 % On the first time round, we start with the given seed.
1644 % \begin{macrocode}
1645 \tl_set:Nn \l_@@_tmpb_tl {#4}
1646 % \end{macrocode}
1647 % We repeat the specified number of times.
1648 % \begin{macrocode}
1649 \prg_replicate:nn {#3} {
1650 % \end{macrocode}
1651 % Duplicate the current state.
1652 % \begin{macrocode}
1653 \tl_set_eq:NN \l_@@_tmpa_tl \l_@@_tmpb_tl
1654 % \end{macrocode}
1655 % Clear the receiving token list.
1656 % \begin{macrocode}
1657 \tl_clear:N \l_@@_tmpb_tl
1658 % \end{macrocode}
1659 % Walk through the current list, appending to the receiving list according to the rules.
1660 % \begin{macrocode}
1661 \tl_map_inline:Nn \l_@@_tmpa_tl
1662 {
1663 % \end{macrocode}
1664 % If a rule exists, copy that.
1665 % \begin{macrocode}
1666 \tl_set:Nx \l_@@_action_lms_tl {\tl_head:n {##1}}
1667 \tl_set:Nx \l_@@_parameters_lms_tl {\tl_tail:n {##1}}
1668 \prop_if_in:cVTF {g_@@_#2_lms_rule_prop} \l_@@_action_lms_tl
1669 {
1670 \prop_get:cVN {g_@@_#2_lms_rule_prop} \l_@@_action_lms_tl \l_@@_tmpc_tl
1671 \tl_put_right:Nx \l_@@_tmpb_tl {\tl_use:N \l_@@_tmpc_tl}
1672 % {\prop_item:cn {g_@@_#2_lms_rule_prop} {##1} }
1673 }
1674 {
1675 % \end{macrocode}
1676 % Otherwise, just copy the token.
1677 % \begin{macrocode}
1678 \tl_if_single:nTF {##1}
1679 {
1680 \tl_put_right:Nn \l_@@_tmpb_tl {##1}
1681 }
1682 {
1683 \tl_put_right:Nn \l_@@_tmpb_tl {{##1}}
1684 }
1685 }
1686 }
1687 }
1688 % \end{macrocode}
1689 % We've done all this inside a group, now pass the result outside.
1690 % \begin{macrocode}
1691 \tl_set:Nn \l_@@_tmpa_tl {
1692 \group_end:
1693 \tl_set:Nn #1
1694 }
1695 \tl_put_right:Nx \l_@@_tmpa_tl {{\tl_use:N \l_@@_tmpb_tl}}
1696 \tl_use:N \l_@@_tmpa_tl
1697 }
1698 \cs_generate_variant:Nn \@@_make_lms:Nnnn {Nnnx}
1699 % \end{macrocode}
1700 % \end{macro}
1701 %
1702 % \begin{macro}[internal]{\@@_invoke_lms:nn}
1703 % This carries out the actions specified by the resulting rules.
1704 % \begin{macrocode}
1705 \cs_new_nopar:Npn \@@_invoke_lms:nn #1#2
1706 {
1707 \group_begin:
1708 % \end{macrocode}
1709 % Walk through the given list, carrying out the corresponding action if it exists.
1710 % If not, look at the default.
1711 % Otherwise, just do nothing.
1712 % \begin{macrocode}
1713 \tl_map_inline:nn {#1} {
1714 \tl_set:Nx \l_@@_action_lms_tl {\tl_head:n {##1}}
1715 \tl_set:Nx \l_@@_parameters_lms_tl {\tl_tail:n {##1}}
1716 \prop_if_in:cVTF {g_@@_#2_lms_action_prop} \l_@@_action_lms_tl
1717 {
1718 \prop_item:cV {g_@@_#2_lms_action_prop} \l_@@_action_lms_tl
1719 }
1720 {
1721 \prop_if_in:cVT {g_@@_default_lms_action_prop} \l_@@_action_lms_tl
1722 {
1723 \prop_item:cV {g_@@_default_lms_action_prop} \l_@@_action_lms_tl
1724 }
1725 }
1726 }
1727 \group_end:
1728 }
1729 \cs_generate_variant:Nn \@@_invoke_lms:nn {Vn}
1730 % \end{macrocode}
1731 % \end{macro}
1732 %
1733 %
1734 % We need some parameters.
1735 % \begin{macrocode}
1736 \dim_new:N \l_@@_step_dim
1737 \dim_set:Nn \l_@@_step_dim {1cm}
1738 % \end{macrocode}
1739 %
1740 % These are the defaults, which will be used in all the rule sets.
1741 % \begin{macrocode}
1742 \prop_new:N \g_@@_default_lms_action_prop
1743 \prop_gput:Nnn \g_@@_default_lms_action_prop {[} {\group_begin:}
1744 \prop_gput:Nnn \g_@@_default_lms_action_prop {]} {\group_end:}
1745 \prop_gput:Nnn \g_@@_default_lms_action_prop {f}
1746 {\pgftransformxshift{\l_@@_step_dim}}
1747 \prop_gput:Nnn \g_@@_default_lms_action_prop {b}
1748 {\pgftransformxshift{-\l_@@_step_dim}}
1749 % \end{macrocode}
1750 %
1751 % Holds a list of the tiles that actually draw for each tile set
1752 % \begin{macrocode}
1753 \prop_new:N \g_@@_drawables_lms_prop
1754 % \end{macrocode}
1755 %
1756 % We keep track of the number of tiles.
1757 % \begin{macrocode}
1758 \int_new:N \g_@@_tile_int
1759 \int_new:N \g_@@_tiles_int
1760 % \end{macrocode}
1761 %
1762 % \begin{function}{\TilingDecomposition}
1763 % This is the user macro to invoke the decomposition.
1764 % The arguments are: optional styles, the name, number of iterations, and starting seed.
1765 % \begin{macrocode}
1766 \cs_new_protected_nopar:Npn \@@_tiling_decomposition:nnnn #1#2#3#4
1767 {
1768 \group_begin:
1769 \tikzset{
1770 every~ #2~ decomposition/.try,
1771 #1
1772 }
1773 \@@_make_lms:Nnnx \l_@@_tmpa_tl {#2} {#3} {#4}
1774 \@@_count_lms:Vn \l_@@_tmpa_tl {#2}
1775 \int_gzero:N \g_@@_tile_int
1776 \@@_invoke_lms:Vn \l_@@_tmpa_tl {#2}
1777 \group_end:
1778 }
1779 \cs_new_protected_nopar:Npn \@@_tiling_decomposition:nnn #1#2#3
1780 {
1781 \@@_tiling_decomposition:nnnn {}{#1}{#2}{#3}
1782 }
1783 \cs_generate_variant:Nn \@@_tiling_decomposition:nnn {VVV}
1784
1785 \NewDocumentCommand \TilingDecomposition { O{} m m m }
1786 {
1787 \@@_tiling_decomposition:nnnn {#1}{#2}{#3}{#4}
1788 }
1789
1790 \tikzset{
1791 pics/decomposition/.style~ n~ args={3}{
1792 code={
1793 \@@_tiling_decomposition:nnn {#1}{#2}{#3}
1794 }
1795 }
1796 }
1797 % \end{macrocode}
1798 % \end{function}
1799 %
1800 % \begin{macro}[internal]{\@@_count_lms:nn}
1801 % This counts the number of tiles in the string.
1802 % \begin{macrocode}
1803 \cs_new_nopar:Npn \@@_count_lms:nn #1#2
1804 {
1805 \group_begin:
1806 \int_gzero:N \g_@@_tiles_int
1807 \prop_get:NnNT \g_@@_drawables_lms_prop {#2} \l_@@_tmpa_tl
1808 {
1809 \tl_map_variable:nNn {#1} \l_@@_tmpb_tl
1810 {
1811 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpb_tl}
1812 \bool_do_while:nn
1813 {
1814 !\tl_if_empty_p:N \l_@@_tmpb_tl
1815 &&
1816 \tl_if_head_is_group_p:V \l_@@_tmpb_tl
1817 }
1818 {
1819 \tl_set:Nx \l_@@_tmpb_tl {\tl_head:N \l_@@_tmpb_tl}
1820 }
1821 \tl_if_in:NVT \l_@@_tmpa_tl \l_@@_tmpb_tl
1822 {
1823 \int_gincr:N \g_@@_tiles_int
1824 }
1825 }
1826 }
1827 \group_end:
1828 }
1829 \cs_generate_variant:Nn \@@_count_lms:nn {Vn}
1830 % \end{macrocode}
1831 % \end{macro}
1832 %
1833 % This is a \Verb+\tikzset+ mechanism for setting the dimensions of the tiling.
1834 % \begin{macrocode}
1835 \tikzset{
1836 tiling~ step/.code={
1837 \dim_set:Nn \l_@@_step_dim {#1}
1838 }
1839 }
1840 % \end{macrocode}
1841 %
1842 % \begin{macrocode}
1843 \ExplSyntaxOff
1844 % \end{macrocode}
1845 %
1846 % \iffalse
1847 %</tilings>
1848 % \fi
1849 %
1850 %
1851 % \iffalse
1852 %<*penrose>
1853 % \fi
1854 %
1855 % \begin{macrocode}
1856 \RequirePackage{tikz}
1857 \usetikzlibrary{tilings}
1858 \ProvidesFile {tikzlibrarytilings.penrose.code.tex}
1859 [2023/06/01 v2.0 TikZ pics for Penrose tiles]
1860 % \end{macrocode}
1861 %
1862 %
1863 % Create the pre-defined tile shapes.
1864 %
1865 % \begin{itemize}
1866 % \item Thin Rhombus.
1867 % \begin{macrocode}
1868 \DefineTile{thin rhombus}{a A B b}
1869 {
1870 {0 , 0}
1871 {cosd(18) , sind(18)}
1872 {2*cosd(18) , 0}
1873 {cosd(18) , -sind(18)}
1874 }
1875 % \end{macrocode}
1876 %
1877 % \item Thick Rhombus.
1878 % \begin{macrocode}
1879 \DefineTile{thick rhombus}{B a A b}
1880 {
1881 {0 , 0}
1882 {cosd(36) , sind(36)}
1883 {2*cosd(36) , 0}
1884 {cosd(36) , -sind(36)}
1885 }
1886 % \end{macrocode}
1887 %
1888 % \item Dart.
1889 % \begin{macrocode}
1890 \DefineTile{dart}{c a A C}
1891 {
1892 {0 , 0}
1893 {2*sind(18)*cosd(108) , 2*sind(18)*sind(108)}
1894 {2*sind(18) , 0}
1895 {2*sind(18)*cosd(108) , -2*sind(18)*sind(108)}
1896 }
1897 % \end{macrocode}
1898 %
1899 % \item Kite.
1900 % \begin{macrocode}
1901 \DefineTile{kite}{a c C A}
1902 {
1903 {0 , 0}
1904 {cosd(36) , sind(36)}
1905 {1 , 0}
1906 {cosd(36) , -sind(36)}
1907 }
1908 % \end{macrocode}
1909 %
1910 % \item Golden Triangle.
1911 % \begin{macrocode}
1912 \DefineTile{golden triangle}{a c b}
1913 {
1914 {0 , 0}
1915 {cosd(18) , sind(18)}
1916 {cosd(18) , -sind(18)}
1917 }
1918 % \end{macrocode}
1919 %
1920 % \item Reverse Golden Triangle.
1921 % \begin{macrocode}
1922 \DefineTile {reverse golden triangle}{B C A}
1923 {
1924 {0 , 0}
1925 {cosd(18) , sind(18)}
1926 {cosd(18) , -sind(18)}
1927 }
1928 % \end{macrocode}
1929 %
1930 % \item Golden Gnomon
1931 % \begin{macrocode}
1932 \DefineTile {golden gnomon}{C b A}
1933 {
1934 {0 , 0}
1935 {cosd(36) , sind(36)}
1936 {2*cosd(36) , 0}
1937 }
1938 % \end{macrocode}
1939 %
1940 % \item Reverse Golden Gnomon
1941 % \begin{macrocode}
1942 \DefineTile {reverse golden gnomon}{a B c}
1943 {
1944 {0 , 0}
1945 {2*cosd(36) , 0}
1946 {cosd(36) , -sind(36)}
1947 }
1948 % \end{macrocode}
1949 %
1950 % \item Primary Pentagon (pentagon 5)
1951 % \begin{macrocode}
1952 \DefineTile {pentagon 5}{a a a a a}
1953 {
1954 {0 , 0}
1955 {cosd(108) , sind(108)}
1956 {1+cosd(72)+cosd(144) , sind(72)+sind(144)}
1957 {1+cosd(72) , sind(72)}
1958 {1 , 0}
1959 }
1960 % \end{macrocode}
1961 %
1962 % \item Secondary Pentagon (pentagon 3)
1963 % \begin{macrocode}
1964 \DefineTile {pentagon 3}{A b a a b}
1965 {
1966 {0 , 0}
1967 {cosd(108) , sind(108)}
1968 {1+cosd(72)+cosd(144) , sind(72)+sind(144)}
1969 {1+cosd(72) , sind(72)}
1970 {1 , 0}
1971 }
1972 % \end{macrocode}
1973 %
1974 % \item Tertiary Pentagon (pentagon 2)
1975 % \begin{macrocode}
1976 \DefineTile {pentagon 2}{d A e c A}
1977 {
1978 {0 , 0}
1979 {cosd(108) , sind(108)}
1980 {1+cosd(72)+cosd(144) , sind(72)+sind(144)}
1981 {1+cosd(72) , sind(72)}
1982 {1 , 0}
1983 }
1984 % \end{macrocode}
1985 %
1986 % \item Pentagram
1987 % \begin{macrocode}
1988 \DefineTile {pentagram}{C E C E C E C E C E}
1989 {
1990 {1 , 0}
1991 {1-cosd(36) , -sind(36)}
1992 {1-cosd(36)-cosd(108) , -sind(36)-sind(108)}
1993 {cosd(108) , -sind(108)}
1994 {-1+3*cosd(108)+cosd(36) , -sind(36)-sind(108)}
1995 {-1+2*cosd(108)+cosd(36) , -sind(36)}
1996 {-1+2*cosd(108) , 0}
1997 {2*cosd(108) , 0}
1998 {cosd(108) , sind(108)}
1999 {0 , 0}
2000 }
2001 % \end{macrocode}
2002 %
2003 % \item Boat
2004 % \begin{macrocode}
2005 \DefineTile {boat}{C E C E B D B}
2006 {
2007 {-1+2*cosd(108) , 0}
2008 {2*cosd(108) , 0}
2009 {cosd(108) , sind(108)}
2010 {0 , 0}
2011 {1 , 0}
2012 {1-cosd(36) , -sind(36)}
2013 {-1+2*cosd(108)+cosd(36) , -sind(36)}
2014 }
2015 % \end{macrocode}
2016 %
2017 % \item Diamond.
2018 % \begin{macrocode}
2019 \DefineTile {diamond}{D B B D}
2020 {
2021 {0 , 0}
2022 {cosd(18) , sind(18)}
2023 {2*cosd(18) , 0}
2024 {cosd(18) , -sind(18)}
2025 }
2026 % \end{macrocode}
2027 % \end{itemize}
2028 %
2029 %
2030 % Place the arcs
2031 % \begin{macrocode}
2032 \tikzset{
2033 every thin rhombus before path/.code={
2034 \path[every circle arc/.try] (-edge a end) circle[radius=1/4];
2035 \path[every long arc/.try] (-edge b start) circle[radius=1/4];
2036 },
2037 every thick rhombus before path/.code={
2038 \path[every circle arc/.try] (-edge a end) circle[radius=1/4];
2039 \path[every long arc/.try] (-edge B start) circle[radius=3/4];
2040 },
2041 every kite before path/.code={
2042 \path[every circle arc/.try] (-edge a start) circle[radius=2/(sqrt(5)+1)];
2043 \path[every long arc/.try] (-edge c end) circle[radius=2/(3+sqrt(5))];
2044 },
2045 every dart before path/.code={
2046 \path[every circle arc/.try] (-edge a end) circle[radius=1 - 2/(sqrt(5)+1)];
2047 \path[every long arc/.try] (-edge c start) circle[radius=2/(sqrt(5)+1) - 2/(3+sqrt(5))];
2048 }
2049 }
2050 % \end{macrocode}
2051 %
2052 % Now bake the tiles.
2053 %
2054 % \begin{macrocode}
2055 \BakeTile {thin rhombus}
2056 \BakeTile {thick rhombus}
2057 \BakeTile {dart}
2058 \BakeTile {kite}
2059 \BakeTile {golden triangle}
2060 \BakeTile {reverse golden triangle}
2061 \BakeTile {golden gnomon}
2062 \BakeTile {reverse golden gnomon}
2063 \BakeTile {pentagon 5}
2064 \BakeTile {pentagon 3}
2065 \BakeTile {pentagon 2}
2066 \BakeTile {pentagram}
2067 \BakeTile {boat}
2068 \BakeTile {diamond}
2069 % \end{macrocode}
2070 %
2071 %
2072 % \subsection{Lindenmayer System}
2073 %
2074 % \begin{macrocode}
2075 \ExplSyntaxOn
2076 % \end{macrocode}
2077 %
2078 % These are the rules for generating rhombus tilings with the Lindenmayer System procedure.
2079 %
2080 % \begin{macrocode}
2081 \prop_new:N \g_@@_rhombus_lms_rule_prop
2082 \prop_gput:Nnn \g_@@_rhombus_lms_rule_prop {T} {[f*sT][f>g]}
2083 \prop_gput:Nnn \g_@@_rhombus_lms_rule_prop {t} {[f_st][f>G]}
2084 \prop_gput:Nnn \g_@@_rhombus_lms_rule_prop {G} {[f+sG][sf>g][sf*sT]}
2085 \prop_gput:Nnn \g_@@_rhombus_lms_rule_prop {g} {[f-sg][sf>G][sf_st]}
2086 % \end{macrocode}
2087 %
2088 % These are the rules for generating kite and dart tilings.
2089 % \begin{macrocode}
2090 \prop_new:N \g_@@_kite_lms_rule_prop
2091 \prop_gput:Nnn \g_@@_kite_lms_rule_prop {T} {[f*sT][f>st][+sg]}
2092 \prop_gput:Nnn \g_@@_kite_lms_rule_prop {t} {[f_st][f>sT][-sG]}
2093 \prop_gput:Nnn \g_@@_kite_lms_rule_prop {G} {[f*+sG][sT]}
2094 \prop_gput:Nnn \g_@@_kite_lms_rule_prop {g} {[f-_sg][st]}
2095 % \end{macrocode}
2096 %
2097 % These are the rules for generating pentagon tilings.
2098 % \begin{macrocode}
2099 \prop_new:N \g_@@_pentagon_lms_rule_prop
2100 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {P}
2101 {[s>P][1sF+Q][1+sF+Q][1*sF+Q][1-sF+Q][1_sF+Q]} % pentagon 5
2102 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {Q}
2103 {[s>P][1+sFR][1*sF*R][1-sF+Q][1_sF+Q][1sF+Q][->fsD]} % pentagon 3
2104 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {R}
2105 {[s>P][1-sF+Q][1+sF*R][1*sFR][1_sF*R][1sFR][_>fsD][>fsD]} % pentagon 2
2106 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {G}
2107 {
2108 [s>G]
2109 [se[>d+R][e1B]]
2110 [+se[>d+R][e1B]]
2111 [-se[>d+R][e1B]]
2112 [*se[>d+R][e1B]]
2113 [_se[>d+R][e1B]]
2114 } % pentagram
2115 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {B}
2116 {
2117 [s>G]
2118 [se[>d+R][e1B]]
2119 [+se[>d+R][e1B]]
2120 [-se[>d+R][e1B]]
2121 } % boat
2122 \prop_gput:Nnn \g_@@_pentagon_lms_rule_prop {D}
2123 {[s>d+R][s>eG][se1B]} % diamond
2124 % \end{macrocode}
2125 %
2126 % Each of the standard tilings can also be drawn using triangles using the same rules.
2127 % \begin{macrocode}
2128 \prop_gset_eq:NN \g_@@_rtriangle_lms_rule_prop
2129 \g_@@_rhombus_lms_rule_prop
2130 \prop_gset_eq:NN \g_@@_ktriangle_lms_rule_prop
2131 \g_@@_kite_lms_rule_prop
2132 % \end{macrocode}
2133 %
2134 % These are the lists of tokens that actually draw things
2135 % \begin{macrocode}
2136 \prop_gput:Nnn \g_@@_drawables_lms_prop {rhombus} {TG}
2137 \prop_gput:Nnn \g_@@_drawables_lms_prop {kite} {Tg}
2138 \prop_gput:Nnn \g_@@_drawables_lms_prop {rtriangle} {TtGg}
2139 \prop_gput:Nnn \g_@@_drawables_lms_prop {ktriangle} {TtGg}
2140 \prop_gput:Nnn \g_@@_drawables_lms_prop {pentagon} {PQRGBD}
2141 % \end{macrocode}
2142 %
2143 %
2144 % These hold the various actions.
2145 % \begin{macrocode}
2146 \prop_new:N \g_@@_rhombus_lms_action_prop
2147 \prop_new:N \g_@@_kite_lms_action_prop
2148 \prop_new:N \g_@@_rtriangle_lms_action_prop
2149 \prop_new:N \g_@@_ktriangle_lms_action_prop
2150 \prop_new:N \g_@@_pentagon_lms_action_prop
2151 % \end{macrocode}
2152 %
2153 % The rhombus rules need a variety of turns.
2154 % \begin{macrocode}
2155 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {+}
2156 {\pgftransformrotate{144}}
2157 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {*}
2158 {\pgftransformrotate{108}}
2159 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {-}
2160 {\pgftransformrotate{216}}
2161 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {_}
2162 {\pgftransformrotate{252}}
2163 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {>}
2164 {\pgftransformrotate{180}}
2165 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {s} {
2166 \fp_set:Nn \l_@@_tmpa_fp { 2 * sind(18) * \l_@@_step_dim }
2167 \dim_set:Nn \l_@@_step_dim {\fp_to_dim:N \l_@@_tmpa_fp}
2168 }
2169 % \end{macrocode}
2170 %
2171 % Up to now, the actions for the rhombus and its triangle replacement are the same.
2172 % \begin{macrocode}
2173 \prop_gset_eq:NN \g_@@_rtriangle_lms_action_prop
2174 \g_@@_rhombus_lms_action_prop
2175 % \end{macrocode}
2176 %
2177 % Now we do the actions that actually draw something.
2178 % \begin{macrocode}
2179 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {T} {
2180 \group_begin:
2181 % \end{macrocode}
2182 % As we go through, we keep track of how many tiles we've drawn.
2183 % \begin{macrocode}
2184 \int_gincr:N \g_@@_tile_int
2185 % \end{macrocode}
2186 % Set up the position, size, and angle correctly.
2187 % \begin{macrocode}
2188 \pgftransformrotate{198}
2189 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*2*cosd(18)}
2190 \pgftransformxshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2191 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2192 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2193 % \end{macrocode}
2194 % Now we draw the thin rhombus, applying every style we can possibly imagine.
2195 % The \Verb+tile+ style gets the current tile and total tile numbers passed to it.
2196 % \begin{macrocode}
2197 \tl_set:Nx \l_@@_tmpc_tl
2198 {
2199 {\int_use:N \g_@@_tile_int}
2200 {\int_use:N \g_@@_tiles_int}
2201 }
2202 \UseTile[
2203 every~ tile/.try,
2204 every~ thin~ rhombus/.try,
2205 tile~ \int_use:N \g_@@_tile_int/.try,
2206 tile/.try/.expand~ once=\l_@@_tmpc_tl
2207 ]{thin~rhombus}
2208 \group_end:
2209 }
2210 % \end{macrocode}
2211 %
2212 % Same for the thick rhombus.
2213 % \begin{macrocode}
2214 \prop_gput:Nnn \g_@@_rhombus_lms_action_prop {G} {
2215 \group_begin:
2216 \int_gincr:N \g_@@_tile_int
2217 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)/(2*cosd(36))}
2218 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2219 \tl_set:Nx \l_@@_tmpc_tl
2220 {
2221 {\int_use:N \g_@@_tile_int}
2222 {\int_use:N \g_@@_tiles_int}
2223 }
2224 \UseTile[
2225 every~ tile/.try,
2226 every~ thick~ rhombus/.try,
2227 tile~ \int_use:N \g_@@_tile_int/.try,
2228 tile/.try/.expand~ once=\l_@@_tmpc_tl
2229 ]{thick~rhombus}
2230 \group_end:
2231 }
2232 % \end{macrocode}
2233 %
2234 % Now we do the same for the kite and dart tiling.
2235 % \begin{macrocode}
2236 \prop_gput:Nnn \g_@@_kite_lms_action_prop {+} {\pgftransformrotate{36}}
2237 \prop_gput:Nnn \g_@@_kite_lms_action_prop {*} {\pgftransformrotate{108}}
2238 \prop_gput:Nnn \g_@@_kite_lms_action_prop {-} {\pgftransformrotate{-36}}
2239 \prop_gput:Nnn \g_@@_kite_lms_action_prop {_}
2240 {\pgftransformrotate{-108}}
2241 \prop_gput:Nnn \g_@@_kite_lms_action_prop {>} {\pgftransformrotate{180}}
2242 \prop_gput:Nnn \g_@@_kite_lms_action_prop {s} {
2243 \fp_set:Nn \l_@@_tmpa_fp { 2 * sind(18) * \l_@@_step_dim }
2244 \dim_set:Nn \l_@@_step_dim {\fp_to_dim:N \l_@@_tmpa_fp}
2245 }
2246 % \end{macrocode}
2247 %
2248 % \begin{macrocode}
2249 \prop_gset_eq:NN \g_@@_ktriangle_lms_action_prop
2250 \g_@@_kite_lms_action_prop
2251 % \end{macrocode}
2252 %
2253 % \begin{macrocode}
2254 \prop_gput:Nnn \g_@@_kite_lms_action_prop {T} {
2255 \group_begin:
2256 \int_gincr:N \g_@@_tile_int
2257 \pgftransformrotate{36}
2258 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2259 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2260 \tl_set:Nx \l_@@_tmpc_tl
2261 {
2262 {\int_use:N \g_@@_tile_int}
2263 {\int_use:N \g_@@_tiles_int}
2264 }
2265 \UseTile[
2266 every~ tile/.try,
2267 every~ kite/.try,
2268 tile~ \int_use:N \g_@@_tile_int/.try,
2269 tile/.try/.expand~ once=\l_@@_tmpc_tl
2270 ]{kite}
2271 \group_end:
2272 }
2273 % \end{macrocode}
2274 %
2275 % \begin{macrocode}
2276 \prop_gput:Nnn \g_@@_kite_lms_action_prop {g} {
2277 \group_begin:
2278 \int_gincr:N \g_@@_tile_int
2279 \pgftransformrotate{144}
2280 \pgftransformxshift{-\l_@@_step_dim * 2 * sin(18)}
2281 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2282 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2283 \tl_set:Nx \l_@@_tmpc_tl
2284 {
2285 {\int_use:N \g_@@_tile_int}
2286 {\int_use:N \g_@@_tiles_int}
2287 }
2288 \UseTile[
2289 every~ tile/.try,
2290 every~ dart/.try,
2291 tile~ \int_use:N \g_@@_tile_int/.try,
2292 tile/.try/.expand~ once=\l_@@_tmpc_tl
2293 ]{dart}
2294 \group_end:
2295 }
2296 % \end{macrocode}
2297 %
2298 % Now we set up the actions for the triangle variations.
2299 % \begin{macrocode}
2300 \prop_gput:Nnn \g_@@_rtriangle_lms_action_prop {T} {
2301 \group_begin:
2302 \int_gincr:N \g_@@_tile_int
2303 \pgftransformrotate{18}
2304 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2305 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2306 \tl_set:Nx \l_@@_tmpc_tl
2307 {
2308 {\int_use:N \g_@@_tile_int}
2309 {\int_use:N \g_@@_tiles_int}
2310 }
2311 \UseTile[
2312 every~ tile/.try,
2313 every~ reverse~ golden~ triangle/.try,
2314 tile~ \int_use:N \g_@@_tile_int/.try,
2315 tile/.try/.expand~ once=\l_@@_tmpc_tl
2316 ]{reverse~ golden~ triangle}
2317 \group_end:
2318 }
2319 % \end{macrocode}
2320 %
2321 % \begin{macrocode}
2322 \prop_gput:Nnn \g_@@_rtriangle_lms_action_prop {t} {
2323 \group_begin:
2324 \int_gincr:N \g_@@_tile_int
2325 \pgftransformrotate{-18}
2326 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2327 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2328 \tl_set:Nx \l_@@_tmpc_tl
2329 {
2330 {\int_use:N \g_@@_tile_int}
2331 {\int_use:N \g_@@_tiles_int}
2332 }
2333 \tl_set:Nx \l_@@_tmpc_tl
2334 {
2335 {\int_use:N \g_@@_tile_int}
2336 {\int_use:N \g_@@_tiles_int}
2337 }
2338 \UseTile[
2339 every~ tile/.try,
2340 every~ golden~ triangle/.try,
2341 tile~ \int_use:N \g_@@_tile_int/.try,
2342 tile/.try/.expand~ once=\l_@@_tmpc_tl
2343 ]{golden~ triangle}
2344 \group_end:
2345 }
2346 % \end{macrocode}
2347 %
2348 % \begin{macrocode}
2349 \prop_gput:Nnn \g_@@_rtriangle_lms_action_prop {G} {
2350 \group_begin:
2351 \int_gincr:N \g_@@_tile_int
2352 \pgftransformrotate{180}
2353 \pgftransformxshift{-\l_@@_step_dim}
2354 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)/(2*cosd(36))}
2355 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2356 \tl_set:Nx \l_@@_tmpc_tl
2357 {
2358 {\int_use:N \g_@@_tile_int}
2359 {\int_use:N \g_@@_tiles_int}
2360 }
2361 \UseTile[
2362 every~ tile/.try,
2363 every~ reverse~ golden~ gnomon/.try,
2364 tile~ \int_use:N \g_@@_tile_int/.try,
2365 tile/.try/.expand~ once=\l_@@_tmpc_tl
2366 ]{reverse~ golden~ gnomon}
2367 \group_end:
2368 }
2369 % \end{macrocode}
2370 %
2371 % \begin{macrocode}
2372 \prop_gput:Nnn \g_@@_rtriangle_lms_action_prop {g} {
2373 \group_begin:
2374 \int_gincr:N \g_@@_tile_int
2375 \pgftransformrotate{180}
2376 \pgftransformxshift{-\l_@@_step_dim}
2377 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)/(2*cosd(36))}
2378 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2379 \tl_set:Nx \l_@@_tmpc_tl
2380 {
2381 {\int_use:N \g_@@_tile_int}
2382 {\int_use:N \g_@@_tiles_int}
2383 }
2384 \UseTile[
2385 every~ tile/.try,
2386 every~ golden~ gnomon/.try,
2387 tile~ \int_use:N \g_@@_tile_int/.try,
2388 tile/.try/.expand~ once=\l_@@_tmpc_tl
2389 ]{golden~ gnomon}
2390 \group_end:
2391 }
2392 % \end{macrocode}
2393 %
2394 % \begin{macrocode}
2395 \prop_gput:Nnn \g_@@_ktriangle_lms_action_prop {T} {
2396 \group_begin:
2397 \int_gincr:N \g_@@_tile_int
2398 \pgftransformrotate{18}
2399 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2400 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2401 \tl_set:Nx \l_@@_tmpc_tl
2402 {
2403 {\int_use:N \g_@@_tile_int}
2404 {\int_use:N \g_@@_tiles_int}
2405 }
2406 \UseTile[
2407 every~ tile/.try,
2408 every~ reverse~ golden~ triangle/.try,
2409 tile~ \int_use:N \g_@@_tile_int/.try,
2410 tile/.try/.expand~ once=\l_@@_tmpc_tl
2411 ]{reverse~ golden~ triangle}
2412 \group_end:
2413 }
2414 % \end{macrocode}
2415 %
2416 % \begin{macrocode}
2417 \prop_gput:Nnn \g_@@_ktriangle_lms_action_prop {t} {
2418 \group_begin:
2419 \int_gincr:N \g_@@_tile_int
2420 \pgftransformrotate{-18}
2421 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2422 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2423 \tl_set:Nx \l_@@_tmpc_tl
2424 {
2425 {\int_use:N \g_@@_tile_int}
2426 {\int_use:N \g_@@_tiles_int}
2427 }
2428 \UseTile[
2429 every~ tile/.try,
2430 every~ golden~ triangle/.try,
2431 tile~ \int_use:N \g_@@_tile_int/.try,
2432 tile/.try/.expand~ once=\l_@@_tmpc_tl
2433 ]{golden~ triangle}
2434 \group_end:
2435 }
2436 % \end{macrocode}
2437 %
2438 % \begin{macrocode}
2439 \prop_gput:Nnn \g_@@_ktriangle_lms_action_prop {G} {
2440 \group_begin:
2441 \int_gincr:N \g_@@_tile_int
2442 \pgftransformrotate{180}
2443 \pgftransformxshift{-\l_@@_step_dim}
2444 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)/(2*cosd(36))}
2445 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2446 \tl_set:Nx \l_@@_tmpc_tl
2447 {
2448 {\int_use:N \g_@@_tile_int}
2449 {\int_use:N \g_@@_tiles_int}
2450 }
2451 \UseTile[
2452 every~ tile/.try,
2453 every~ reverse~ golden~ gnomon/.try,
2454 tile~ \int_use:N \g_@@_tile_int/.try,
2455 tile/.try/.expand~ once=\l_@@_tmpc_tl
2456 ]{reverse~ golden~ gnomon}
2457 \group_end:
2458 }
2459 % \end{macrocode}
2460 %
2461 % \begin{macrocode}
2462 \prop_gput:Nnn \g_@@_ktriangle_lms_action_prop {g} {
2463 \group_begin:
2464 \int_gincr:N \g_@@_tile_int
2465 \pgftransformrotate{180}
2466 \pgftransformxshift{-\l_@@_step_dim}
2467 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)/(2*cosd(36))}
2468 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2469 \tl_set:Nx \l_@@_tmpc_tl
2470 {
2471 {\int_use:N \g_@@_tile_int}
2472 {\int_use:N \g_@@_tiles_int}
2473 }
2474 \UseTile[
2475 every~ tile/.try,
2476 every~ golden~ gnomon/.try,
2477 tile~ \int_use:N \g_@@_tile_int/.try,
2478 tile/.try/.expand~ once=\l_@@_tmpc_tl
2479 ]{golden~ gnomon}
2480 \group_end:
2481 }
2482 % \end{macrocode}
2483 %
2484 % Now we do the same for the pentagonal tilings.
2485 %
2486 % The rules need a variety of turns.
2487 % \begin{macrocode}
2488 \int_new:N \l_@@_pentagon_parity_int
2489 \seq_new:N \l_@@_pentagon_parity_seq
2490 \seq_set_from_clist:Nn \l_@@_pentagon_parity_seq {odd,even}
2491 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {1} {
2492 \int_set:Nn \l_@@_pentagon_parity_int
2493 {3 - \l_@@_pentagon_parity_int}
2494 }
2495 \tikzset{
2496 every~ pentagon~ decomposition/.code={%
2497 \int_set:Nn \l_@@_pentagon_parity_int {2}
2498 }
2499 }
2500 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {+}
2501 {\pgftransformrotate{72}}
2502 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {*}
2503 {\pgftransformrotate{144}}
2504 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {-}
2505 {\pgftransformrotate{288}}
2506 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {_}
2507 {\pgftransformrotate{216}}
2508 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {>}
2509 {\pgftransformrotate{180}}
2510 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {|}
2511 {\pgftransformxscale{-1}}
2512 % \end{macrocode}
2513 % The scale factor is different.
2514 % \begin{macrocode}
2515 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {s} {
2516 \fp_set:Nn \l_@@_tmpa_fp
2517 {
2518 1/(2 + 2 * cosd(72) ) * \l_@@_step_dim
2519 }
2520 \dim_set:Nn \l_@@_step_dim {\fp_to_dim:N \l_@@_tmpa_fp}
2521 }
2522 % \end{macrocode}
2523 % And we tend to work better vertically.
2524 % \begin{macrocode}
2525 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {f} {
2526 \fp_set:Nn \l_@@_tmpa_fp { tand(54)/2 * \l_@@_step_dim }
2527 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2528 }
2529 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {F} {
2530 \fp_set:Nn \l_@@_tmpa_fp { tand(54) * \l_@@_step_dim }
2531 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2532 }
2533 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {d} {
2534 \fp_set:Nn \l_@@_tmpa_fp
2535 {
2536 (tand(54)/2 - tand(72)/2 + sind(36) ) * \l_@@_step_dim
2537 }
2538 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2539 }
2540 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {e} {
2541 \fp_set:Nn \l_@@_tmpa_fp
2542 {
2543 tand(54) * cosd(36) * \l_@@_step_dim
2544 }
2545 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2546 }
2547 % \end{macrocode}
2548 %
2549 % \begin{macrocode}
2550 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {P} {
2551 \group_begin:
2552 \int_gincr:N \g_@@_tile_int
2553 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/2}
2554 \pgftransformxshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2555 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*tand(54)/2}
2556 \pgftransformyshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2557 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2558 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2559 \tl_set:Nx \l_@@_tmpc_tl
2560 {
2561 {\int_use:N \g_@@_tile_int}
2562 {\int_use:N \g_@@_tiles_int}
2563 }
2564 \UseTile[
2565 every~ tile/.try,
2566 every~ pentagon/.try,
2567 every~
2568 \seq_item:Nn \l_@@_pentagon_parity_seq
2569 {\l_@@_pentagon_parity_int}
2570 \space pentagon/.try,
2571 every~ pentagon~ 5/.try,
2572 tile~ \int_use:N \g_@@_tile_int/.try,
2573 tile/.try/.expand~ once=\l_@@_tmpc_tl
2574 ]{pentagon~5}
2575 \group_end:
2576 }
2577 % \end{macrocode}
2578 %
2579 % \begin{macrocode}
2580 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {Q} {
2581 \group_begin:
2582 \int_gincr:N \g_@@_tile_int
2583 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/2}
2584 \pgftransformxshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2585 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*tand(54)/2}
2586 \pgftransformyshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2587 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2588 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2589 \tl_set:Nx \l_@@_tmpc_tl
2590 {
2591 {\int_use:N \g_@@_tile_int}
2592 {\int_use:N \g_@@_tiles_int}
2593 }
2594 \UseTile[
2595 every~ tile/.try,
2596 every~ pentagon/.try,
2597 every~
2598 \seq_item:Nn \l_@@_pentagon_parity_seq
2599 {\l_@@_pentagon_parity_int}
2600 \space pentagon/.try,
2601 every~ pentagon~ 3/.try,
2602 tile~ \int_use:N \g_@@_tile_int/.try,
2603 tile/.try/.expand~ once=\l_@@_tmpc_tl
2604 ]{pentagon~3}
2605 \group_end:
2606 }
2607 % \end{macrocode}
2608 %
2609 % \begin{macrocode}
2610 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {R} {
2611 \group_begin:
2612 \int_gincr:N \g_@@_tile_int
2613 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/2}
2614 \pgftransformxshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2615 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*tand(54)/2}
2616 \pgftransformyshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2617 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2618 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2619 \tl_set:Nx \l_@@_tmpc_tl
2620 {
2621 {\int_use:N \g_@@_tile_int}
2622 {\int_use:N \g_@@_tiles_int}
2623 }
2624 \UseTile[
2625 every~ tile/.try,
2626 every~ pentagon/.try,
2627 every~
2628 \seq_item:Nn \l_@@_pentagon_parity_seq
2629 {\l_@@_pentagon_parity_int}
2630 \space pentagon/.try,
2631 every~ pentagon~ 2/.try,
2632 tile~ \int_use:N \g_@@_tile_int/.try,
2633 tile/.try/.expand~ once=\l_@@_tmpc_tl
2634 ]{pentagon~2}
2635 \group_end:
2636 }
2637 % \end{macrocode}
2638 %
2639 % \begin{macrocode}
2640 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {G} {
2641 \group_begin:
2642 \int_gincr:N \g_@@_tile_int
2643 % \pgftransformrotate{198}
2644 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*cosd(72)}
2645 \pgftransformxshift{\fp_to_dim:N \l_@@_tmpa_fp}
2646 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*tand(54)*cosd(72)}
2647 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2648 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2649 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2650 \tl_set:Nx \l_@@_tmpc_tl
2651 {
2652 {\int_use:N \g_@@_tile_int}
2653 {\int_use:N \g_@@_tiles_int}
2654 }
2655 \UseTile[
2656 every~ tile/.try,
2657 every~ pentagram/.try,
2658 tile~ \int_use:N \g_@@_tile_int/.try,
2659 tile/.try/.expand~ once=\l_@@_tmpc_tl
2660 ]{pentagram}
2661 \group_end:
2662 }
2663 % \end{macrocode}
2664 %
2665 % \begin{macrocode}
2666 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {B} {
2667 \group_begin:
2668 \int_gincr:N \g_@@_tile_int
2669 % \pgftransformrotate{198}
2670 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*cosd(72)}
2671 \pgftransformxshift{\fp_to_dim:N \l_@@_tmpa_fp}
2672 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*tand(54)*cosd(72)}
2673 \pgftransformyshift{\fp_to_dim:N \l_@@_tmpa_fp}
2674 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2675 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2676 \tl_set:Nx \l_@@_tmpc_tl
2677 {
2678 {\int_use:N \g_@@_tile_int}
2679 {\int_use:N \g_@@_tiles_int}
2680 }
2681 \UseTile[
2682 every~ tile/.try,
2683 every~ boat/.try,
2684 tile~ \int_use:N \g_@@_tile_int/.try,
2685 tile/.try/.expand~ once=\l_@@_tmpc_tl
2686 ]{boat}
2687 \group_end:
2688 }
2689 % \end{macrocode}
2690 %
2691 % \begin{macrocode}
2692 \prop_gput:Nnn \g_@@_pentagon_lms_action_prop {D} {
2693 \group_begin:
2694 \int_gincr:N \g_@@_tile_int
2695 \pgftransformrotate{90}
2696 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim*cosd(18)}
2697 \pgftransformxshift{-\fp_to_dim:N \l_@@_tmpa_fp}
2698 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
2699 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
2700 \tl_set:Nx \l_@@_tmpc_tl
2701 {
2702 {\int_use:N \g_@@_tile_int}
2703 {\int_use:N \g_@@_tiles_int}
2704 }
2705 \UseTile[
2706 every~ tile/.try,
2707 every~ diamond/.try,
2708 tile~ \int_use:N \g_@@_tile_int/.try,
2709 tile/.try/.expand~ once=\l_@@_tmpc_tl
2710 ]{diamond}
2711 \group_end:
2712 }
2713 % \end{macrocode}
2714 %
2715 % \begin{macrocode}
2716 \ExplSyntaxOff
2717 % \end{macrocode}
2718 %
2719 % \iffalse
2720 %</penrose>
2721 % \fi
2722 %
2723 % \iffalse
2724 %<*polykite>
2725 % \fi
2726 %
2727 % \begin{macrocode}
2728 \RequirePackage{tikz}
2729 \usetikzlibrary{tilings}
2730 \ProvidesFile {tikzlibrarytilings.polykite.code.tex}
2731 [2023/06/01 v2.0 TikZ pics for Aperiodical Polykite tiles]
2732 % \end{macrocode}
2733 %
2734 % \begin{function}{\DefinePolykiteTile}
2735 % Define one of the family of polykite tiles.
2736 % Needs a name and length parameters.
2737 % A star option switches the side labels to enable the hat-turtle pairing of a tile with its ``opposite''.
2738 % \begin{macrocode}
2739 \DeclareDocumentCommand \DefinePolykiteTile {s m m m}
2740 {
2741 \IfBooleanTF {#1}
2742 {
2743 \DefineTile {#2} {2 2 1 1 2 2 1 1 1 1 2 2 1 1}
2744 }
2745 {
2746 \DefineTile {#2} {1 1 2 2 1 1 2 2 2 2 1 1 2 2}
2747 }
2748 {
2749 {0 : #4}
2750 ++{90 : #3}
2751 ++{150 : #3}
2752 ++{240 : #4}
2753 ++{180 : #4}
2754 ++{-90 : #3}
2755 ++{210 : #3}
2756 ++{-60 : #4}
2757 ++{0 : #4}
2758 ++{0 : #4}
2759 ++{60 : #4}
2760 ++{-30 : #3}
2761 ++{30 : #3}
2762 ++{120 : #4}
2763 }
2764 }
2765 % \end{macrocode}
2766 % \end{function}
2767 %
2768 % Some predefined tiles.
2769 % The aperiodical hat and turtle can be swapped in for each other as they use the same edge definitions.
2770 % The spectral hat and turtle are designed to be used in the same diagram.
2771 % Technically, the spectral and aperiodical hats are the same, but I figured it better to have two names for the two uses.
2772 % The spectre uses the alternating edge scheme.
2773 %
2774 % \begin{itemize}
2775 % \item Aperiodical and Spectral Hat.
2776 % \begin{macrocode}
2777 \DefinePolykiteTile{aperiodical hat}{sqrt(3)/2}{1/2}
2778 \DefinePolykiteTile{spectral hat}{sqrt(3)/2}{1/2}
2779 % \end{macrocode}
2780 % \item Aperiodical and Spectral Turtles.
2781 % \begin{macrocode}
2782 \DefinePolykiteTile{aperiodical turtle}{1/2}{sqrt(3)/2}
2783 \DefinePolykiteTile*{spectral turtle}{1/2}{sqrt(3)/2}
2784 % \end{macrocode}
2785 % \item Aperiodical Spectre.
2786 % \begin{macrocode}
2787 \DefineTile {spectre} {a A a A a A a A a A a A a A}
2788 {
2789 {0 : .75}
2790 ++{90 : .75}
2791 ++{150 : .75}
2792 ++{240 : .75}
2793 ++{180 : .75}
2794 ++{-90 : .75}
2795 ++{210 : .75}
2796 ++{-60 : .75}
2797 ++{0 : .75}
2798 ++{0 : .75}
2799 ++{60 : .75}
2800 ++{-30 : .75}
2801 ++{30 : .75}
2802 ++{120 : .75}
2803 }
2804 % \end{macrocode}
2805 %
2806 % \item Meta Clusters
2807 %
2808 % The mapping between the notation in the \href{preprint}{https://arxiv.org/abs/2303.10798} is:
2809 %
2810 % \begin{align*}
2811 % A^+, A^- &\mapsto a, A \\
2812 % B^+, B^- &\mapsto b, B\\
2813 % F^+, F^- &\mapsto c, C\\
2814 % X^+, X^- &\mapsto d, D\\
2815 % L &\mapsto 1
2816 % \end{align*}
2817 %
2818 % \begin{macrocode}
2819 \DefineTile{meta cluster T}{A A b}
2820 {
2821 { -1.5 , -sqrt(3)/2 }
2822 { 1.5 , -sqrt(3)/2 }
2823 { 0 , sqrt(3) }
2824 }
2825 \DefineTile{meta cluster P}{1 D d A 1 D d b}
2826 {
2827 { -2.5, sqrt(3)/2 }
2828 { -2, 0 }
2829 { -1.5, -sqrt(3)/2 }
2830 { -0.5 , -sqrt(3)/2 }
2831 { 2.5 , -sqrt(3)/2 }
2832 { 2 , 0 }
2833 { 1.5 , sqrt(3)/2 }
2834 { .5 , sqrt(3)/2 }
2835 }
2836 \DefineTile{meta cluster F}{1 D d 1 D c C d b}
2837 {
2838 { -2.5, sqrt(3)/2 }
2839 { -2, 0 }
2840 { -1.5, -sqrt(3)/2 }
2841 { -0.5 , -sqrt(3)/2 }
2842 { .5 , -sqrt(3)/2 }
2843 { 1.5 , -sqrt(3)/2 }
2844 { 2 , 0 }
2845 { 1.5 , sqrt(3)/2 }
2846 { .5 , sqrt(3)/2 }
2847 }
2848 \DefineTile{meta cluster H}{B D d B D d a D d}
2849 {
2850 { -2, -sqrt(3) }
2851 { 1, -sqrt(3) }
2852 { 2, -sqrt(3) }
2853 { 2.5, -sqrt(3)/2 }
2854 { 1, sqrt(3)}
2855 { .5 , 3*sqrt(3)/2 }
2856 { -.5 , 3*sqrt(3)/2 }
2857 { -2, 0 }
2858 { -2.5, -sqrt(3)/2 }
2859 }
2860 % \end{macrocode}
2861 % \item Super Clusters
2862 %
2863 % \begin{macrocode}
2864 \DefineTile{super cluster T}{A A b}
2865 {
2866 { -30 : 3 * (1 + sqrt(5))/2 / sqrt(3) }
2867 { 90 : 3 * (1 + sqrt(5))/2 / sqrt(3) }
2868 { 210 : 3 * (1 + sqrt(5))/2 / sqrt(3) }
2869 }
2870 % 1 + 3phi, 1 + 2phi
2871 \DefineTile{super cluster P}{1 D d A 1 D d b}
2872 {
2873 { - 1.75 - sqrt(5), (sqrt(5)/2 + 1) * sqrt(3)/2 }
2874 ++{ -60 : 1 + sqrt(5) }
2875 ++{ -60 : 1}
2876 ++{ 1, 0}
2877 ++{ 3*(1 + sqrt(5))/2, 0 }
2878 ++{ 120 : 1 + sqrt(5) }
2879 ++{ 120 : 1 }
2880 ++{ -1, 0 }
2881 }
2882 \DefineTile{super cluster F}{1 D d 1 D c C d b}
2883 {
2884 { - 1.75 - sqrt(5), (sqrt(5)/2 + 1) * sqrt(3)/2 }
2885 ++{ -60 : 1 + sqrt(5) }
2886 ++{ -60 : 1}
2887 ++{ 1, 0}
2888 ++{ 1 + sqrt(5), 0 }
2889 ++{ 1, 0 }
2890 +{ -.75 + (2 + sqrt(5)) * sqrt(3)/4 * sqrt(3)/3,
2891 (2 + sqrt(5)) * sqrt(3)/4 + 3/4 * sqrt(3)/3 }
2892 ++{ -1.5, (2 + sqrt(5)) * sqrt(3)/2 }
2893 ++{ -1, 0 }
2894 }
2895 \DefineTile{super cluster H}{B D d B D d a D d}
2896 {
2897 {1.75 + 3*sqrt(5)/4, -(1 + sqrt(5))*sqrt(3)/4}
2898 ++{120 : 3*(1+sqrt(5))/2 }
2899 ++{120 : 1 }
2900 ++{-1,0}
2901 ++{240 : 3*(1+sqrt(5))/2}
2902 ++{240 : 1}
2903 ++{300 : 1}
2904 ++{ 3*(1+sqrt(5))/2, 0 }
2905 ++{1, 0}
2906 ++{60 : 1}
2907 }
2908 % \end{macrocode}
2909 % \item Subclusters
2910 %
2911 % \begin{macrocode}
2912 \DefineTile{subcluster H}{B B a}
2913 {
2914 { 0, 0 }
2915 { 3, 0 }
2916 { 60 : 3 }
2917 }
2918 \DefineTile{subcluster T}{A A b}
2919 {
2920 { 0, 0 }
2921 { 3, 0 }
2922 { 60 : 3 }
2923 }
2924 \DefineTile{subcluster P}{ 1 A 1 b }
2925 {
2926 { 0, 0 }
2927 { 1, 0 }
2928 { 4, 0 }
2929 { 3, 0 }
2930 }
2931 \DefineTile{subcluster F}{ 1 1 f F b }
2932 {
2933 { 0, 0 }
2934 { 1, 0 }
2935 +{ 60 : 1 }
2936 { 2, 0 }
2937 { 3, 0 }
2938 }
2939 % \end{macrocode}
2940 % \end{itemize}
2941 %
2942 % The P and F subclusters have no area, so clipping against them is not helpful.
2943 % \begin{macrocode}
2944 \tikzset{
2945 no clip/.code={%
2946 \tikz@addmode{\tikz@mode@clipfalse}%
2947 },
2948 every subcluster P clip/.style={no clip},
2949 every subcluster F clip/.style={no clip},
2950 }
2951 % \end{macrocode}
2952 %
2953 %
2954 % \begin{macrocode}
2955 \BakeTile {aperiodical hat}
2956 \BakeTile {aperiodical turtle}
2957 \BakeTile {spectral hat}
2958 \BakeTile {spectral turtle}
2959 \BakeTile {spectre}
2960 \BakeTile {meta cluster T}
2961 \BakeTile {meta cluster P}
2962 \BakeTile {meta cluster F}
2963 \BakeTile {meta cluster H}
2964 \BakeTile {super cluster T}
2965 \BakeTile {super cluster P}
2966 \BakeTile {super cluster F}
2967 \BakeTile {super cluster H}
2968 % \end{macrocode}
2969 %
2970 % The subclusters are deformed by default.
2971 %
2972 % \begin{macrocode}
2973 \ExplSyntaxOn
2974 \clist_map_inline:nn {a,A,b,B,f,F}
2975 {
2976 \tl_new:c {g_@@_side_polykite_#1_tl}
2977 \tl_if_exist:cF {g_@@_side_#1_tl}
2978 {
2979 \tl_new:c {g_@@_side_#1_tl}
2980 }
2981 }
2982
2983 \tl_gset:cn {g_@@_side_polykite_A_tl}
2984 {
2985 \pgfsyssoftpath@movetotoken {0pt}{-0.3333332942822268pt}
2986 \pgfsyssoftpath@linetotoken {0.0833331478405773pt}{-0.1889954840909892pt}
2987 \pgfsyssoftpath@linetotoken {0.3333332942822268pt}{-0.3333332942822268pt}
2988 \pgfsyssoftpath@linetotoken {0.5833333235705567pt}{-0.1889954840909892pt}
2989 \pgfsyssoftpath@linetotoken {0.6666667057177732pt}{-0.3333332942822268pt}
2990 \pgfsyssoftpath@linetotoken {1pt}{-0.3333332942822268pt}
2991 }
2992 \tl_gset:cn {g_@@_side_polykite_a_tl}
2993 {
2994 \pgfsyssoftpath@movetotoken {0pt}{0.33333pt}
2995 \pgfsyssoftpath@linetotoken {0.33333pt}{0.33333pt}
2996 \pgfsyssoftpath@linetotoken {0.41667pt}{0.189pt}
2997 \pgfsyssoftpath@linetotoken {0.66667pt}{0.33333pt}
2998 \pgfsyssoftpath@linetotoken {0.91667pt}{0.189pt}
2999 \pgfsyssoftpath@linetotoken {1pt}{0.33333pt}
3000 }
3001 \tl_gset:cn {g_@@_side_polykite_B_tl}
3002 {
3003 \pgfsyssoftpath@movetotoken {0pt}{0pt}
3004 \pgfsyssoftpath@linetotoken {0.3333332942822268pt}{0pt}
3005 \pgfsyssoftpath@linetotoken {0.4166665592761237pt}{0.1443378101912376pt}
3006 \pgfsyssoftpath@linetotoken {0.6666667057177732pt}{0pt}
3007 \pgfsyssoftpath@linetotoken {0.9166666178527835pt}{0.1443378101912376pt}
3008 \pgfsyssoftpath@linetotoken {1pt}{0pt}
3009 }
3010 \tl_gset:cn {g_@@_side_polykite_b_tl}
3011 {
3012 \pgfsyssoftpath@movetotoken {0pt}{0pt}
3013 \pgfsyssoftpath@linetotoken {0.08333pt}{-0.14433pt}
3014 \pgfsyssoftpath@linetotoken {0.33333pt}{0pt}
3015 \pgfsyssoftpath@linetotoken {0.58333pt}{-0.14433pt}
3016 \pgfsyssoftpath@linetotoken {0.66667pt}{0pt}
3017 \pgfsyssoftpath@linetotoken {1pt}{0pt}
3018 }
3019 \tl_gset:cn {g_@@_side_polykite_F_tl}
3020 {
3021 \pgfsyssoftpath@movetotoken {0pt}{-2.00000070292pt}
3022 \pgfsyssoftpath@linetotoken {0.74999982427pt}{-1.566987221617321pt}
3023 \pgfsyssoftpath@linetotoken {1pt}{-2.00000070292pt}
3024 }
3025 \tl_gset:cn {g_@@_side_polykite_f_tl}
3026 {
3027 \pgfsyssoftpath@movetotoken {0pt}{2pt}
3028 \pgfsyssoftpath@linetotoken {0.25pt}{1.56699pt}
3029 \pgfsyssoftpath@linetotoken {1pt}{2pt}
3030 }
3031
3032 \clist_map_inline:nn {a,A,b,B,f,F}
3033 {
3034 \tl_gclear_new:c {g_@@_side_backup_#1_tl}
3035 \tl_gset_eq:cc {g_@@_side_backup_#1_tl} {g_@@_side_#1_tl}
3036 \tl_gclear_new:c {g_@@_side_#1_tl}
3037 \tl_gset_eq:cc {g_@@_side_#1_tl}{g_@@_side_polykite_#1_tl}
3038 }
3039
3040 \BakeTile{subcluster~ H}
3041 \BakeTile{subcluster~ T}
3042 \BakeTile{subcluster~ P}
3043 \BakeTile{subcluster~ F}
3044
3045 \clist_map_inline:nn {a,A,b,B,f,F}
3046 {
3047 \tl_gset_eq:cc {g_@@_side_#1_tl} {g_@@_side_backup_#1_tl}
3048 }
3049 % \end{macrocode}
3050 %
3051 % \subsection{Lindenmayer System}
3052 %
3053 % These are the rules for generating the super cluster tilings with the Lindenmayer System procedure.
3054 %
3055 % \begin{macro}[internal]{\@@_place_cluster_tile:nn}
3056 % Useful auxiliary for placing a cluster tile from a particular set
3057 % \begin{macrocode}
3058 \cs_new_protected_nopar:Npn \@@_place_cluster_tile:nn #1#2
3059 {
3060 \group_begin:
3061 \int_gincr:N \g_@@_tile_int
3062 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
3063 \pgftransformscale{\fp_use:N \l_@@_tmpa_fp}
3064 \tl_set:Nx \l_@@_tmpc_tl
3065 {
3066 {\int_use:N \g_@@_tile_int}
3067 {\int_use:N \g_@@_tiles_int}
3068 }
3069 \UseTile[
3070 every~ tile/.try,
3071 every~ #1~#2/.try,
3072 tile~ \int_use:N \g_@@_tile_int/.try,
3073 tile/.try/.expand~ once=\l_@@_tmpc_tl
3074 ]{#1~ #2}
3075 \group_end:
3076 }
3077 \cs_generate_variant:Nn \@@_place_cluster_tile:nn {Vn}
3078 % \end{macrocode}
3079 % \end{macro}
3080 %
3081 %
3082 % \begin{macrocode}
3083 \prop_new:N \g_@@_supercluster_lms_rule_prop
3084 \prop_gput:Nnn \g_@@_supercluster_lms_rule_prop {T}
3085 {
3086 [s H]
3087 }
3088 \prop_gput:Nnn \g_@@_supercluster_lms_rule_prop {H}
3089 {
3090 [s {r{-60}} T]
3091 [s {x{\fp_to_decimal:n{1}}} {y{\fp_to_decimal:n{(1+2*\c_@@_phi_fp)}}} H]
3092 [s
3093 {x{\fp_to_decimal:n{-2-3*\c_@@_phi_fp}}}
3094 {y{\fp_to_decimal:n{-\c_@@_phi_fp}}}
3095 H]
3096 [s
3097 {x{\fp_to_decimal:n{1+3*\c_@@_phi_fp}}}
3098 {y{\fp_to_decimal:n{-1-\c_@@_phi_fp}}}
3099 {r{-120}}
3100 H]
3101 [s
3102 {x{\fp_to_decimal:n{-1.5-3.5*\c_@@_phi_fp}}}
3103 {y{\fp_to_decimal:n{2.5*\c_@@_phi_fp+1.5}}}
3104 {r{-120}}
3105 P]
3106 [s
3107 {x{\fp_to_decimal:n{-1.5-2*\c_@@_phi_fp}}}
3108 {y{\fp_to_decimal:n{-1.5-3*\c_@@_phi_fp}}}
3109 {r{180}}
3110 P]
3111 [s
3112 {x{\fp_to_decimal:n{3+5.5*\c_@@_phi_fp}}}
3113 {y{\fp_to_decimal:n{.5*\c_@@_phi_fp}}}
3114 {r{120}}
3115 P]
3116 [s
3117 {x{\fp_to_decimal:n{-4.5-6.5*\c_@@_phi_fp}}}
3118 {y{\fp_to_decimal:n{.5-.5*\c_@@_phi_fp}}}
3119 {r{-120}}
3120 F]
3121 [s
3122 {x{\fp_to_decimal:n{1.5+4*\c_@@_phi_fp}}}
3123 {y{\fp_to_decimal:n{-2.5-3*\c_@@_phi_fp}}}
3124 F]
3125 [s
3126 {x{\fp_to_decimal:n{3+2.5*\c_@@_phi_fp}}}
3127 {y{\fp_to_decimal:n{2+3.5*\c_@@_phi_fp}}}
3128 {r{120}}
3129 F]
3130 }
3131 \prop_gput:Nnn \g_@@_supercluster_lms_rule_prop {P}
3132 {
3133 [s {r{60}} P]
3134 [s
3135 {x{\fp_to_decimal:n{2.5+3.5*\c_@@_phi_fp}}}
3136 {y{\fp_to_decimal:n{-.5-.5*\c_@@_phi_fp}}}
3137 {r{-120}}
3138 H]
3139 [s
3140 {x{\fp_to_decimal:n{-2.5-3.5*\c_@@_phi_fp}}}
3141 {y{\fp_to_decimal:n{.5+.5*\c_@@_phi_fp}}}
3142 {r{180}}
3143 H]
3144 [s
3145 {x{\fp_to_decimal:n{4.5+6*\c_@@_phi_fp}}}
3146 {y{\fp_to_decimal:n{.5+\c_@@_phi_fp}}}
3147 {r{120}}
3148 F]
3149 [s
3150 {x{\fp_to_decimal:n{-4.5-6*\c_@@_phi_fp}}}
3151 {y{\fp_to_decimal:n{-.5-\c_@@_phi_fp}}}
3152 {r{-60}}
3153 F]
3154 }
3155 \prop_gput:Nnn \g_@@_supercluster_lms_rule_prop {F}
3156 {
3157 [s {r{60}} P]
3158 [s
3159 {x{\fp_to_decimal:n{2.5+3.5*\c_@@_phi_fp}}}
3160 {y{\fp_to_decimal:n{-.5-.5*\c_@@_phi_fp}}}
3161 {r{-120}}
3162 H]
3163 [s
3164 {x{\fp_to_decimal:n{-2.5-3.5*\c_@@_phi_fp}}}
3165 {y{\fp_to_decimal:n{.5+.5*\c_@@_phi_fp}}}
3166 {r{180}}
3167 H]
3168 [s
3169 {x{\fp_to_decimal:n{4.5+6*\c_@@_phi_fp}}}
3170 {y{\fp_to_decimal:n{.5+\c_@@_phi_fp}}}
3171 {r{120}}
3172 F]
3173 [s
3174 {x{\fp_to_decimal:n{-4.5-6*\c_@@_phi_fp}}}
3175 {y{\fp_to_decimal:n{-.5-\c_@@_phi_fp}}}
3176 {r{-60}}
3177 F]
3178 [s
3179 {x{\fp_to_decimal:n{3+4.5*\c_@@_phi_fp}}}
3180 {y{\fp_to_decimal:n{-2-2.5*\c_@@_phi_fp}}}
3181 F]
3182 }
3183 % \end{macrocode}
3184 %
3185 % \begin{macrocode}
3186 \prop_gput:Nnn \g_@@_drawables_lms_prop {supercluster} {HTPF}
3187 % \end{macrocode}
3188 %
3189 % \begin{macrocode}
3190 \fp_const:Nn \c_@@_phi_fp {(1 + sqrt(5))/2}
3191 \prop_new:N \g_@@_supercluster_lms_action_prop
3192
3193 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {r}
3194 {
3195 \pgftransformrotate{\l_@@_parameters_lms_tl}
3196 }
3197 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {x}
3198 {
3199 \pgftransformxshift{
3200 \fp_to_dim:n
3201 {.5 * (\l_@@_parameters_lms_tl) * \l_@@_step_dim}
3202 }
3203 }
3204 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {y}
3205 {
3206 \pgftransformyshift{
3207 \fp_to_dim:n
3208 {.5 * sqrt(3) * (\l_@@_parameters_lms_tl) * \l_@@_step_dim}
3209 }
3210 }
3211
3212 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {s}
3213 {
3214 \fp_set:Nn \l_@@_tmpa_fp {
3215 \l_@@_step_dim
3216 /
3217 \c_@@_phi_fp
3218 /
3219 \c_@@_phi_fp
3220 }
3221 \dim_set:Nn \l_@@_step_dim {\fp_to_dim:N \l_@@_tmpa_fp}
3222 }
3223 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {H}
3224 {
3225 \@@_place_cluster_tile:nn {super~ cluster}{H}
3226 }
3227 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {T}
3228 {
3229 \@@_place_cluster_tile:nn {super~ cluster}{T}
3230 }
3231 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {P}
3232 {
3233 \@@_place_cluster_tile:nn {super~ cluster}{P}
3234 }
3235 \prop_gput:Nnn \g_@@_supercluster_lms_action_prop {F}
3236 {
3237 \@@_place_cluster_tile:nn {super~ cluster}{F}
3238 }
3239 % \end{macrocode}
3240 %
3241 %
3242 % Parameters:
3243 % \begin{enumerate}
3244 % \item Cluster type (super cluster, meta cluster, subcluster)
3245 % \item This tile type (H, T, P, F)
3246 % \item This tile's name
3247 % \item Alignment tile's name
3248 % \item Edge to align along
3249 % \item Edge to align with
3250 % \end{enumerate}
3251 % \begin{macrocode}
3252 \cs_new_protected_nopar:Npn \@@_place_cluster_tile_as_pic:nnnnnn #1#2#3#4#5#6
3253 {
3254 \group_begin:
3255 \int_gincr:N \g_@@_tile_int
3256 \fp_set:Nn \l_@@_tmpa_fp {\l_@@_step_dim/(1cm)}
3257 \tl_set:Nx \l_@@_tmpc_tl
3258 {
3259 {\int_use:N \g_@@_tile_int}
3260 {\int_use:N \g_@@_tiles_int}
3261 }
3262 \tl_clear:N \l_@@_tmpa_tl
3263 \tl_put_right:Nn \l_@@_tmpa_tl
3264 {
3265 \pic[
3266 every~ tile/.try,
3267 every~ #1~#2/.try,
3268 }
3269 \tl_put_right:Nx \l_@@_tmpa_tl
3270 {
3271 tile~ \int_use:N \g_@@_tile_int/.try,
3272 tile/.try=\l_@@_tmpc_tl,
3273 scale=\fp_use:N \l_@@_tmpa_fp,
3274 }
3275 \tl_put_right:Nn \l_@@_tmpa_tl
3276 {
3277 name=#3,
3278 }
3279 \tl_if_empty:nTF {#4}
3280 {
3281 \tl_put_right:Nn \l_@@_tmpa_tl
3282 {
3283 first~ tile/.try,
3284 }
3285 }
3286 {
3287 \tl_put_right:Nn \l_@@_tmpa_tl
3288 {
3289 align~ with=#4~along~#5
3290 }
3291 \tl_if_single:nF {#6}
3292 {
3293 \tl_put_right:Nx \l_@@_tmpa_tl
3294 {
3295 \c_space_tl using~\tl_tail:n {#6}
3296 }
3297 }
3298 \tl_put_right:Nn \l_@@_tmpa_tl {,}
3299 }
3300 \tl_put_right:Nn \l_@@_tmpa_tl
3301 {
3302 #1~ #2
3303 ];
3304 }
3305 \tl_use:N \l_@@_tmpa_tl
3306 \group_end:
3307 }
3308 \cs_generate_variant:Nn \@@_place_cluster_tile_as_pic:nnnnnn {
3309 Vnnnnn, VnVnnn, VnVVnn
3310 }
3311 \tikzset{
3312 cluster~ type/.initial=super~ cluster,
3313 first~ file/.style={transform~ shape}
3314 }
3315 \prop_new:N \g_@@_cluster_lms_rule_prop
3316 % \end{macrocode}
3317 %
3318 % The first set of rules govern when the tile being replaced is a root tile, in which case one of the new tiles becomes the new root and all others are placed with respect to them.
3319 %
3320 % It's convenient for code readability to have aliases for the labels for the parent and adjoining tiles, which are stored in the \Verb!\l_@@_parameters_lms_tl! token list.
3321 % \begin{macrocode}
3322 \cs_new_nopar:Npn \@@_tile_label:
3323 {
3324 \tl_item:Nn \l_@@_parameters_lms_tl {1}
3325 }
3326 \cs_new_nopar:Npn \@@_adjoint_label:
3327 {
3328 \tl_item:Nn \l_@@_parameters_lms_tl {2}
3329 }
3330 % \end{macrocode}
3331 %
3332 % A single \(T\) tile is replaced by a single \(H\) tile
3333 % \begin{macrocode}
3334 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {T}
3335 {
3336 [s {H{\@@_tile_label:0}{}}]
3337 }
3338 % \end{macrocode}
3339 %
3340 % An \(H\) tile is replaced by \(10\) tiles, consisting of a \(T\) tile and \(3\) each of \(H\), \(P\), and \(F\).
3341 % \begin{macrocode}
3342 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {H}
3343 {
3344 [s {r{-60}} {T{\@@_tile_label:0}{}}]
3345 [{ {HTa{A1}} {\@@_tile_label:1} {\@@_tile_label:0} }]
3346 [{ {HTa{A2}} {\@@_tile_label:2} {\@@_tile_label:0} }]
3347 [{ {HT{B1}b} {\@@_tile_label:3} {\@@_tile_label:0} }]
3348 [{ {PHb{B2}} {\@@_tile_label:4} {\@@_tile_label:1} }]
3349 [{ {PHb{B2}} {\@@_tile_label:5} {\@@_tile_label:2} }]
3350 [{ {PHAa} {\@@_tile_label:6} {\@@_tile_label:3} }]
3351 [{ {FHb{B1}} {\@@_tile_label:7} {\@@_tile_label:1} }]
3352 [{ {FHb{B1}} {\@@_tile_label:8} {\@@_tile_label:2} }]
3353 [{ {FHb{B2}} {\@@_tile_label:9} {\@@_tile_label:3} }]
3354 }
3355 % \end{macrocode}
3356 %
3357 % Lastly, the \(P\) and \(F\) tile substitutions.
3358 % \begin{macrocode}
3359 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {P}
3360 {
3361 [s {r{60}} {P{\@@_tile_label:0}{}}]
3362 [{ {HPaA} {\@@_tile_label:1} {\@@_tile_label:0} }]
3363 [{ {HP{B2}b} {\@@_tile_label:2} {\@@_tile_label:0} }]
3364 [{ {FHb{B2}} {\@@_tile_label:3} {\@@_tile_label:1} }]
3365 [{ {FHb{B1}} {\@@_tile_label:4} {\@@_tile_label:2} }]
3366 }
3367 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {F}
3368 {
3369 [s {r{60}} {P{\@@_tile_label:0}{}}]
3370 [{ {HPaA} {\@@_tile_label:1} {\@@_tile_label:0} }]
3371 [{ {HP{B2}b} {\@@_tile_label:2} {\@@_tile_label:0} }]
3372 [{ {FHb{B2}} {\@@_tile_label:3} {\@@_tile_label:1} }]
3373 [{ {FHb{B1}} {\@@_tile_label:4} {\@@_tile_label:2} }]
3374 [{ {FHb{B1}} {\@@_tile_label:5} {\@@_tile_label:1} }]
3375 }
3376 % \end{macrocode}
3377 %
3378 % The rest of the rules are for when the tile being replaced was itself positioned by aligning it with another tile.
3379 % For these tiles, one of its edge tiles will be its root and positioned alongside one of the edge tiles of the replacement of the original tile's alignment tile.
3380 % Then all the other tiles are positioned out from that root.
3381 % The labelling has to be the same regardless of the order of drawing the tiles.
3382 %
3383 % Not every edge pairing is necessary to generate a pattern as the edges that can be created are all between \(A^\pm\) edges and between \(B^\pm\) edges.
3384 % However, to avoid errors in case they are part of the seed then for now we create blank substitution rules that will effectively remove any such rogue elements.
3385 % \begin{macrocode}
3386 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {TH{A1}a} {}
3387 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {TH{A2}a} {}
3388 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {THb{B1}} {}
3389 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {THb{B2}} {}
3390 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HTa{A1}} {}
3391 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HTa{A2}} {}
3392 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HT{B1}b} {}
3393 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HT{B2}b} {}
3394 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HPaA} {}
3395 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HP{B1}b} {}
3396 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HP{B2}b} {}
3397 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HF{B1}b} {}
3398 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {HF{B2}b} {}
3399 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PHAa} {}
3400 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PHb{B1}} {}
3401 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PHb{B2}} {}
3402 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PF{11}{11}} {}
3403 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PF{12}{11}} {}
3404 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PF{11}{12}} {}
3405 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {PF{12}{12}} {}
3406 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FHb{B1}} {}
3407 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FHb{B2}} {}
3408 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FP{11}{11}} {}
3409 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FP{12}{11}} {}
3410 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FP{11}{12}} {}
3411 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FP{12}{12}} {}
3412 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FFfF} {}
3413 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FFFf} {}
3414 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FF{11}{11}} {}
3415 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FF{12}{11}} {}
3416 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FF{11}{12}} {}
3417 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {FF{12}{12}} {}
3418 % \end{macrocode}
3419 %
3420 % To help create the rules then we start with some helper macros.
3421 % Each of these creates the substitution rule for a tile given certain information about where the parent tile is positioned.
3422 % Most of the substitution information consists of placing the tiles next to each other, so only the first tile needs to know about a tile from a different set.
3423 % This makes it relatively easy to set up some templates for the substitution rules.
3424 % \begin{macrocode}
3425 \cs_new_nopar:cpn {@@_T{A1}_creator:nnnnn} #1#2#3#4#5
3426 {
3427 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {T#1{A1}#2}
3428 {
3429 [{ {H#3{B1}#4} {\@@_tile_label:0} {\@@_adjoint_label:#5} }]
3430 }
3431 }
3432 \cs_new_nopar:cpn {@@_T{A2}_creator:nnnnn} #1#2#3#4#5
3433 {
3434 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {T#1{A2}#2}
3435 {
3436 [{ {H#3{B2}#4} {\@@_tile_label:0} {\@@_adjoint_label:#5} }]
3437 }
3438 }
3439 \cs_new_nopar:cpn {@@_Tb_creator:nnnnn} #1#2#3#4#5
3440 {
3441 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {T#1b#2}
3442 {
3443 [{ {H#3a#4} {\@@_tile_label:0} {\@@_adjoint_label:#5} }]
3444 }
3445 }
3446
3447 \cs_new_nopar:cpn {@@_H{B1}_creator:nnnnn} #1#2#3#4#5
3448 {
3449 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {H#1{B1}#2}
3450 {
3451 [{ {P#3A#4} {\@@_tile_label:4} {\@@_adjoint_label:#5} }]
3452
3453 [{ {HP{B2}b} {\@@_tile_label:1} {\@@_tile_label:4} }]
3454 [{ {TH{A1}a} {\@@_tile_label:0} {\@@_tile_label:1} }]
3455
3456 [{ {HTa{A2}} {\@@_tile_label:2} {\@@_tile_label:0} }]
3457 [{ {PHb{B2}} {\@@_tile_label:5} {\@@_tile_label:2} }]
3458
3459 [{ {HT{B1}b} {\@@_tile_label:3} {\@@_tile_label:0} }]
3460 [{ {PHAa} {\@@_tile_label:6} {\@@_tile_label:3} }]
3461
3462 [{ {FHb{B1}} {\@@_tile_label:7} {\@@_tile_label:1} }]
3463 [{ {FHb{B1}} {\@@_tile_label:8} {\@@_tile_label:2} }]
3464 [{ {FHb{B2}} {\@@_tile_label:9} {\@@_tile_label:3} }]
3465 }
3466 }
3467
3468 \cs_new_nopar:cpn {@@_H{B2}_creator:nnnnn} #1#2#3#4#5
3469 {
3470 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {H#1{B2}#2}
3471 {
3472 [{ {P#3A#4} {\@@_tile_label:5} {\@@_adjoint_label:#5} }]
3473
3474 [{ {HP{B2}b} {\@@_tile_label:2} {\@@_tile_label:5} }]
3475 [{ {TH{A2}a} {\@@_tile_label:0} {\@@_tile_label:2} }]
3476
3477 [{ {HTa{A1}} {\@@_tile_label:1} {\@@_tile_label:0} }]
3478 [{ {PHb{B2}} {\@@_tile_label:4} {\@@_tile_label:1} }]
3479
3480 [{ {HT{B1}b} {\@@_tile_label:3} {\@@_tile_label:0} }]
3481 [{ {PHAa} {\@@_tile_label:6} {\@@_tile_label:3} }]
3482
3483 [{ {FHb{B1}} {\@@_tile_label:7} {\@@_tile_label:1} }]
3484 [{ {FHb{B1}} {\@@_tile_label:8} {\@@_tile_label:2} }]
3485 [{ {FHb{B2}} {\@@_tile_label:9} {\@@_tile_label:3} }]
3486 }
3487 }
3488
3489 \cs_new_nopar:cpn {@@_Ha_creator:nnnnn} #1#2#3#4#5
3490 {
3491 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {H#1a#2}
3492 {
3493 [{ {P#3b#4} {\@@_tile_label:6} {\@@_adjoint_label:#5} }]
3494
3495 [{ {HPaA} {\@@_tile_label:3} {\@@_tile_label:6} }]
3496 [{ {THb{B1}} {\@@_tile_label:0} {\@@_tile_label:3} }]
3497
3498 [{ {HTa{A1}} {\@@_tile_label:1} {\@@_tile_label:0} }]
3499 [{ {PHb{B2}} {\@@_tile_label:4} {\@@_tile_label:1} }]
3500
3501 [{ {HTa{A2}} {\@@_tile_label:2} {\@@_tile_label:0} }]
3502 [{ {PHb{B2}} {\@@_tile_label:5} {\@@_tile_label:2} }]
3503
3504 [{ {FHb{B1}} {\@@_tile_label:7} {\@@_tile_label:1} }]
3505 [{ {FHb{B1}} {\@@_tile_label:8} {\@@_tile_label:2} }]
3506 [{ {FHb{B2}} {\@@_tile_label:9} {\@@_tile_label:3} }]
3507 }
3508 }
3509
3510 \cs_new_nopar:cpn {@@_PA_creator:nnnnn} #1#2#3#4#5
3511 {
3512 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {P#1A#2}
3513 {
3514 [{ {H#3{B1}#4} {\@@_tile_label:1} {\@@_adjoint_label:#5} }]
3515 [{ {PHAa} {\@@_tile_label:0} {\@@_tile_label:1} }]
3516 [{ {HP{B2}b} {\@@_tile_label:2} {\@@_tile_label:0} }]
3517
3518 [{ {FHb{B2}} {\@@_tile_label:3} {\@@_tile_label:1} }]
3519 [{ {FHb{B1}} {\@@_tile_label:4} {\@@_tile_label:2} }]
3520 }
3521 }
3522
3523 \cs_new_nopar:cpn {@@_Pb_creator:nnnnn} #1#2#3#4#5
3524 {
3525 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {P#1b#2}
3526 {
3527 [{ {H#3a#4} {\@@_tile_label:2} {\@@_adjoint_label:#5} }]
3528 [{ {PHb{B2}} {\@@_tile_label:0}{\@@_tile_label:2} }]
3529 [{ {HPaA} {\@@_tile_label:1} {\@@_tile_label:0} }]
3530
3531 [{ {FHb{B2}} {\@@_tile_label:3} {\@@_tile_label:1} }]
3532 [{ {FHb{B1}} {\@@_tile_label:4} {\@@_tile_label:2} }]
3533 }
3534 }
3535
3536 \cs_new_nopar:cpn {@@_Fb_creator:nnnnn} #1#2#3#4#5
3537 {
3538 \prop_gput:Nnn \g_@@_cluster_lms_rule_prop {F#1b#2}
3539 {
3540 [{ {H#3a#4} {\@@_tile_label:2} {\@@_adjoint_label:#5} }]
3541 [{ {PHb{B2}} {\@@_tile_label:0}{\@@_tile_label:2} }]
3542 [{ {HPaA} {\@@_tile_label:1} {\@@_tile_label:0} }]
3543
3544 [{ {FHb{B2}} {\@@_tile_label:3} {\@@_tile_label:1} }]
3545 [{ {FHb{B1}} {\@@_tile_label:4} {\@@_tile_label:2} }]
3546 [{ {FHb{B1}} {\@@_tile_label:5} {\@@_tile_label:1} }]
3547 }
3548 }
3549 % \end{macrocode}
3550 %
3551 % Now that the creators are set up it is time to invoke them.
3552 % \begin{macrocode}
3553 \clist_map_inline:nn
3554 {
3555 TH{{A1}}a HP{{{B1}}}b06,
3556 TH{{A2}}a HP{{{B2}}}b06,
3557 THb{{B1}} HPaA04,
3558 THb{{B2}} HPaA05,
3559 PHAa HP{{{B1}}}b16,
3560 PHb{{B1}} HPaA24,
3561 PHb{{B2}} HPaA25,
3562 FHb{{B1}} HPaA24,
3563 FHb{{B2}} HPaA25,
3564 }
3565 {
3566 \tl_clear:N \l_@@_tmpa_tl
3567 \tl_put_right:Nn \l_@@_tmpa_tl { \use:c }
3568 \tl_put_right:Nx \l_@@_tmpa_tl
3569 {
3570 {@@_ \tl_item:nn {#1}{2}\tl_item:nn {#1}{4} _creator:nnnnn}
3571 {\tl_item:nn {#1}{1}}{\tl_item:nn{#1}{3}}
3572 \tl_item:nn {#1}{5}\tl_item:nn{#1}{7}
3573 \tl_item:nn {#1}{9}
3574 }
3575 \tl_use:N \l_@@_tmpa_tl
3576 \tl_clear:N \l_@@_tmpa_tl
3577 \tl_put_right:Nn \l_@@_tmpa_tl { \use:c }
3578 \tl_put_right:Nx \l_@@_tmpa_tl
3579 {
3580 {@@_ \tl_item:nn {#1}{1}\tl_item:nn {#1}{3} _creator:nnnnn}
3581 {\tl_item:nn {#1}{2}}{\tl_item:nn{#1}{4}}
3582 \tl_item:nn {#1}{6}\tl_item:nn{#1}{8}
3583 \tl_item:nn {#1}{10}
3584 }
3585 \tl_use:N \l_@@_tmpa_tl
3586 }
3587
3588 % \end{macrocode}
3589 %
3590 % \begin{macrocode}
3591 \prop_new:N \g_@@_cluster_lms_action_prop
3592 % \end{macrocode}
3593 %
3594 % \begin{macrocode}
3595 \prop_gput:Nnn \g_@@_drawables_lms_prop {cluster} {HTPF}
3596 % \end{macrocode}
3597 %
3598 % \begin{macrocode}
3599 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {r}
3600 {
3601 \pgftransformrotate{\l_@@_parameters_lms_tl}
3602 }
3603 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {x}
3604 {
3605 \pgftransformxshift{
3606 \fp_to_dim:n
3607 {.5 * (\l_@@_parameters_lms_tl) * \l_@@_step_dim}
3608 }
3609 }
3610 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {y}
3611 {
3612 \pgftransformyshift{
3613 \fp_to_dim:n
3614 {.5 * sqrt(3) * (\l_@@_parameters_lms_tl) * \l_@@_step_dim}
3615 }
3616 }
3617
3618 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {s}
3619 {
3620 \fp_set:Nn \l_@@_tmpa_fp {
3621 \l_@@_step_dim
3622 /
3623 \c_@@_phi_fp
3624 /
3625 \c_@@_phi_fp
3626 }
3627 \dim_set:Nn \l_@@_step_dim {\fp_to_dim:N \l_@@_tmpa_fp}
3628 }
3629 % \end{macrocode}
3630 %
3631 % The first set of actions are for when this tile is the root so doesn't have a parent
3632 % \begin{macrocode}
3633 \clist_map_inline:nn {H,T,P,F}
3634 {
3635
3636 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {#1}
3637 {
3638 \@@_tikz_keys_get:Nn \l_@@_tmpa_tl {cluster~type}
3639 \tl_set:Nx \l_@@_tmpb_tl {\tl_item:Nn \l_@@_parameters_lms_tl {1}}
3640 \@@_place_cluster_tile_as_pic:VnVnnn
3641 \l_@@_tmpa_tl {#1} \l_@@_tmpb_tl {}{}{}
3642 }
3643 }
3644 % \end{macrocode}
3645 %
3646 % The second set is for when there is an adjoining edge
3647 % \begin{macrocode}
3648 \cs_new_protected_nopar:Npn \@@_place_cluster_tile_as_pic_aux:nnnn #1#2#3#4
3649 {
3650 \@@_tikz_keys_get:Nn \l_@@_tmpa_tl {cluster~type}
3651 \tl_set:Nx \l_@@_tmpb_tl {\@@_tile_label:}
3652 \tl_set:Nx \l_@@_tmpc_tl {\@@_adjoint_label:}
3653 \@@_place_cluster_tile_as_pic:VnVVnn
3654 \l_@@_tmpa_tl {#1} \l_@@_tmpb_tl \l_@@_tmpc_tl {#4}{#3}
3655 }
3656
3657 \clist_map_inline:nn {
3658 TH{A1}a,
3659 TH{A2}a,
3660 THb{B1},
3661 THb{B2},
3662 HTa{A1},
3663 HTa{A2},
3664 HT{B1}b,
3665 HT{B2}b,
3666 HPaA,
3667 HP{B1}b,
3668 HP{B2}b,
3669 HF{B1}b,
3670 HF{B2}b,
3671 PHAa,
3672 PHb{B1},
3673 PHb{B2},
3674 PF{11}{11},
3675 PF{12}{11},
3676 PF{11}{12},
3677 PF{12}{12},
3678 FHb{B1},
3679 FHb{B2},
3680 FP{11}{11},
3681 FP{12}{11},
3682 FP{11}{12},
3683 FP{12}{12},
3684 FFfF,
3685 FFFf,
3686 FF{11}{11},
3687 FF{12}{11},
3688 FF{11}{12},
3689 FF{12}{12}
3690 }
3691 {
3692 \prop_gput:Nnn \g_@@_cluster_lms_action_prop {#1}
3693 {
3694 \@@_place_cluster_tile_as_pic_aux:nnnn #1
3695 }
3696 }
3697
3698 \ExplSyntaxOff
3699 % \end{macrocode}
3700 %
3701 % \iffalse
3702 %</polykite>
3703 % \fi
3704 %
3705 % \iffalse
3706 %<*penrosedep>
3707 % \fi
3708 %
3709 % \begin{macrocode}
3710 \ProvidesFile {tikzlibrarypenrose.code.tex}
3711 [2023/06/01 v2.0 TikZ pics for Penrose tiles]
3712 \usetikzlibrary{tilings.penrose}
3713 % \end{macrocode}
3714 %
3715 % Backwards compatibility mode:
3716 %
3717 % \begin{itemize}
3718 % \item \Verb+\SetPenrosePath+ is \Verb+\SetTilingPath+
3719 % \item \Verb+\BakePenroseTile+ and \Verb+\MakePenroseTile+ are \Verb+\BakeTile+
3720 % \item \Verb+\UsePenroseTile+ is \Verb+\UseTile+
3721 % \item \Verb+\PenroseDecomposition+ is \Verb+\TilingDecomposition+
3722 % \end{itemize}
3723 % \begin{macrocode}
3724 \ExplSyntaxOn
3725 \NewDocumentCommand \SetPenrosePath { m }
3726 {
3727 \@@_set_tiling_path:n {#1}
3728 }
3729 \NewDocumentCommand \BakePenroseTile {m}
3730 {
3731 \@@_bake_tile:n {#1}
3732 }
3733 \NewDocumentCommand \MakePenroseTile {m}
3734 {
3735 \@@_bake_tile:n {#1}
3736 }
3737 \NewDocumentCommand \UsePenroseTile {O{} m}
3738 {
3739 \@@_use_tile:nn {#1}{#2}
3740 }
3741 \NewDocumentCommand \PenroseDecomposition { O{} m m m }
3742 {
3743 \@@_tiling_decomposition:nnnn {#1}{#2}{#3}{#4}
3744 }
3745 \ExplSyntaxOff
3746 % \end{macrocode}
3747 %
3748 % \begin{macrocode}
3749 \tikzset{
3750 save Penrose path/.forward to=/tikz/save tiling path,
3751 clone Penrose side path/.forward to=/tikz/clone tiling side path,
3752 spath/prefix/Penrose side/.forward to=/tikz/spath/prefix/tiling side,
3753 spath/suffix/Penrose side/.forward to=/tikz/spath/suffix/tiling side,
3754 clone Penrose tile path/.forward to=/tikz/clone tiling tile path,
3755 spath/prefix/Penrose tile/.forward to=/tikz/spath/prefix/tiling tile,
3756 spath/suffix/Penrose tile/.forward to=/tikz/spath/suffix/tiling tile,
3757 Penrose step/.forward to=/tikz/tiling step,
3758 every tile/.append style={
3759 every Penrose tile/.try
3760 },
3761 every tile clip/.append style={
3762 every Penrose tile clip/.try
3763 },
3764 every tile pic/.append style={
3765 every Penrose pic/.try
3766 },
3767 tile/.append style={
3768 Penrose tile #1/.try,
3769 Penrose tile/.try=#1
3770 }
3771 }
3772 % \end{macrocode}
3773 %
3774 % \iffalse
3775 %</penrosedep>
3776 % \fi
3777 %
3778 % \end{implementation}
3779 %\Finale
3780 \endinput