I've got a tile that I need to rotate or to symmetrize a certain amount of times to make a pattern. I defined the pic itself and made the pattern manually.
I failed to automatize the process.
Is there a clever and shorter way to make this? A very nice answer would be one that lets me just use maybe a matrix where four letters could be used to say A: the initial tile, B: the symmetric, C: the rotated one, D: the symmetric rotated one.
I hope I'm clear enough.
\documentclass[tikz,border=3.14mm]{standalone}
\tikzset{
tile/.pic={
\draw (0,0) --++ (0.8*\lmot,0) --++ (0,0.2*\lmot) --++ (-0.3*\lmot,0) --++ (0,0.6*\lmot) --++ (-0.3*\lmot,0) --++ (0,0.2*\lmot) --++ (-0.2*\lmot,0) -- cycle;%
},
num/.style={line width=.5pt,circle,draw,inner sep=0pt,minimum size=11pt,font=\footnotesize}
}
\newcommand{\num}[1]{\raisebox{-2.5pt}{\tikz \node[num]{#1};}}
\newcommand{\lmot}{2} % Tile size
\begin{document}
\begin{sffamily}
\begin{tikzpicture}
\path pic {tile} pic [xscale=-1] {tile} --++ (\lmot,\lmot) pic[rotate=180] {tile} pic[rotate=180,xscale=-1] {tile} --++ (\lmot,-\lmot) pic {tile} pic [xscale=-1] {tile};
\begin{scope}[yshift=-\lmot cm, xshift=-\lmot cm]
\path pic {tile} --++ (\lmot,\lmot) pic[rotate=180] {tile} pic[rotate=180,xscale=-1] {tile} --++ (\lmot,-\lmot) pic {tile} pic [xscale=-1] {tile} --++ (\lmot,\lmot) pic[rotate=180] {tile} pic[rotate=180,xscale=-1] {tile};
\end{scope}
\begin{scope}[yshift=-\lmot cm, xshift=-\lmot cm]
\path pic[rotate=180,xscale=-1] {tile} --++ (\lmot,-\lmot) pic {tile} pic [xscale=-1] {tile} --++ (\lmot,\lmot) pic[rotate=180] {tile} pic[rotate=180,xscale=-1] {tile} --++ (\lmot,-\lmot) pic {tile} pic [xscale=-1] {tile} --++ (\lmot,\lmot);
\end{scope}
\foreach \i in {1,2,...,6}
{
\pgfmathsetmacro{\j}{\i*0.5*\lmot-0.75*\lmot}
\node at (\j,0.5*\lmot) {\num{\i}};
}
\foreach \i in {7,...,13}
{
\pgfmathsetmacro{\j}{(\i-8)*0.5*\lmot-0.25*\lmot}
\node at (\j,-0.5*\lmot) {\num{\i}};
}
\foreach \i in {14,...,20}
{
\pgfmathsetmacro{\j}{(\i-15)*0.5*\lmot-0.25*\lmot}
\node at (\j,-1.5*\lmot) {\num{\i}};
}
\begin{scope}[font=\small]
\node[above left] at (-\lmot,0) {A};
\node[above left] at (0,0) {B};
\node[below left] at (\lmot,\lmot) {C};
\node[above left] at (\lmot,0) {D};
\node[above left] at (2*\lmot,0) {E};
\node[above left] at (-\lmot,-\lmot) {F};
\node[above left] at (\lmot,-\lmot) {G};
\end{scope}
\end{tikzpicture}
\end{sffamily}
\end{document}
[tilings
library](ctan.org/pkg/tilings) is of help.texdoc xcoffins
.)rotate = 180, xscale = -1
is the same asyscale=-1
. And justrotate=180
is the same asscale = -1
.