50 lines
1.7 KiB
TeX
50 lines
1.7 KiB
TeX
% square lattice (width #1, height #2, origin #3)
|
|
\def\grid#1#2#3{
|
|
\foreach\i in {0,...,#2}{
|
|
\draw#3++(0,\i)--++(#1,0);
|
|
}
|
|
\foreach\i in {0,...,#1}{
|
|
\draw#3++(\i,0)--++(0,#2);
|
|
}
|
|
}
|
|
|
|
|
|
% cross (color #1, position #2)
|
|
\def\cross#1#2{
|
|
\fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0);
|
|
\begin{scope}
|
|
\clip#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0);
|
|
\grid44{[color=white]#2++(-2,-2)}
|
|
\end{scope}
|
|
\draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0);
|
|
}
|
|
|
|
% 1x1 square (color #1, position #2)
|
|
\def\square#1#2{
|
|
\fill[color=#1]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle;
|
|
\draw[color=black]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle;
|
|
\draw[color=white]#2++(-0.5,0)--++(1,0);
|
|
\draw[color=white]#2++(0,-0.5)--++(0,1);
|
|
}
|
|
|
|
% 2x2 square (color #1, position #2)
|
|
\def\ttsquare#1#2{
|
|
\fill[color=#1]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle;
|
|
\draw[color=black]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle;
|
|
\draw[color=white]#2++(-1,0)--++(2,0);
|
|
\draw[color=white]#2++(0,-1)--++(0,2);
|
|
}
|
|
\def\ttsquareempty#1{
|
|
\draw[color=black]#1++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle;
|
|
}
|
|
|
|
% diamond (color #1, position #2)
|
|
\def\diamond#1#2{
|
|
\fill[color=#1]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle;
|
|
\begin{scope}
|
|
\clip#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle;
|
|
\grid22{[color=white]#2++(-1,-1)}
|
|
\end{scope}
|
|
\draw[color=black]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle;
|
|
}
|