summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-truchet
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-02-13 22:23:27 +0000
committerKarl Berry <karl@freefriends.org>2019-02-13 22:23:27 +0000
commit78b5f268f886680c4ecfa3e30c59fa008055040e (patch)
tree6c40675a2506d1ea2741fe655f096568d7ff2687 /Master/texmf-dist/tex/latex/tikz-truchet
parenteac93b210672f2db87e738e4242d7c820898afae (diff)
tikz-truchet (13feb19)
git-svn-id: svn://tug.org/texlive/trunk@50020 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-truchet')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-truchet/tikz-truchet.sty215
1 files changed, 215 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-truchet/tikz-truchet.sty b/Master/texmf-dist/tex/latex/tikz-truchet/tikz-truchet.sty
new file mode 100644
index 00000000000..2305bdd66c4
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-truchet/tikz-truchet.sty
@@ -0,0 +1,215 @@
+%%
+%% This is file `tikz-truchet.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% tikz-truchet.dtx (with options: `truchet')
+%% Copyright (c) 2019 Matthew Scroggs
+%%
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%%
+%% The above copyright notice and this permission notice shall be included in all
+%% copies or substantial portions of the Software.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+%% SOFTWARE.
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tikz-truchet}[2019/02/12 tikz-truchet]
+
+\RequirePackage{tikz}
+\RequirePackage{ifthen}
+
+\tikzset{x=2cm,y=2cm,line cap=round,line join=round, every picture}
+\newcommand{\truchetsquare}[6][(0,0)]{
+ \begin{scope}[shift={#1}]
+ \ifthenelse{\equal{#2}{b}}{
+ \draw[black,fill=black] (0,0) rectangle (1,1);
+ }{
+ \draw[white,fill=white] (0,0) rectangle (1,1);
+ }
+ \ifthenelse{\equal{#3}{#2}}{}{
+ \ifthenelse{\equal{#3}{b}}{
+ \draw [black,fill=black,domain=0:90,line width=1pt] plot ({0.5*cos(\x)}, {1-0.5*sin(\x)}) -- (0,1) -- cycle;
+ }{
+ \draw [white,fill=white,domain=0:90,line width=1pt] plot ({0.5*cos(\x)}, {1-0.5*sin(\x)}) -- (0,1) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#4}{#2}}{}{
+ \ifthenelse{\equal{#4}{b}}{
+ \draw [black,fill=black,domain=0:90,line width=1pt] plot ({1-0.5*cos(\x)}, {1-0.5*sin(\x)}) -- (1,1) -- cycle;
+ }{
+ \draw [white,fill=white,domain=0:90,line width=1pt] plot ({1-0.5*cos(\x)}, {1-0.5*sin(\x)}) -- (1,1) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#5}{#2}}{}{
+ \ifthenelse{\equal{#5}{b}}{
+ \draw [black,fill=black,domain=0:90,line width=1pt] plot ({1-0.5*cos(\x)}, {0.5*sin(\x)}) -- (1,0) -- cycle;
+ }{
+ \draw [white,fill=white,domain=0:90,line width=1pt] plot ({1-0.5*cos(\x)}, {0.5*sin(\x)}) -- (1,0) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#6}{#2}}{}{
+ \ifthenelse{\equal{#6}{b}}{
+ \draw [black,fill=black,domain=0:90,line width=1pt] plot ({0.5*cos(\x)}, {0.5*sin(\x)}) -- (0,0) -- cycle;
+ }{
+ \draw [white,fill=white,domain=0:90,line width=1pt] plot ({0.5*cos(\x)}, {0.5*sin(\x)}) -- (0,0) -- cycle;
+ }
+ }
+ \draw[black,line width=1pt] (0,0) rectangle (1,1);
+ \end{scope}
+}
+\newcommand{\diagonalsquare}[5][(0,0)]{
+ \begin{scope}[shift={#1}]
+ \draw[white,fill=white] (0,0) rectangle (1,1);
+ \ifthenelse{\equal{#2}{b}}{
+ \draw [black,fill=black,line width=1pt] (0,0) -- (0,1) -- (1,1) -- cycle;
+ }{}
+ \ifthenelse{\equal{#3}{b}}{
+ \draw [black,fill=black,line width=1pt] (0,1) -- (1,1) -- (1,0) -- cycle;
+ }{}
+ \ifthenelse{\equal{#4}{b}}{
+ \draw [black,fill=black,line width=1pt] (1,1) -- (1,0) -- (0,0) -- cycle;
+ }{}
+ \ifthenelse{\equal{#5}{b}}{
+ \draw [black,fill=black,line width=1pt] (1,0) -- (0,0) -- (0,1) -- cycle;
+ }{}
+ \draw[black,line width=1pt] (0,0) rectangle (1,1);
+ \end{scope}
+}
+
+\newcommand{\tileA}[1][(0,0)]{\diagonalsquare[#1]{x}{w}{x}{b}}
+\newcommand{\tileB}[1][(0,0)]{\diagonalsquare[#1]{b}{x}{w}{x}}
+\newcommand{\tileC}[1][(0,0)]{\diagonalsquare[#1]{x}{b}{x}{w}}
+\newcommand{\tileD}[1][(0,0)]{\diagonalsquare[#1]{w}{x}{b}{x}}
+
+\newcommand{\truchetsplithex}[1][(0,0)]{
+ \begin{scope}[shift={#1}]
+ \draw[white,fill=white] (0,0) -- (1,0) -- (1.5,0.866) -- (1,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ \draw[black,fill=black] (0,0) -- (.5,0) -- (.5,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ \draw [black,fill=black,domain=120:240,line width=1pt] plot ({1.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (1.5,0.866) -- cycle;
+ \draw [white,fill=white,domain=-60:60,line width=1pt] plot ({-0.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (-0.5,0.866) -- cycle;
+ \draw[black,line width=1pt] (0,0) -- (1,0) -- (1.5,0.866) -- (1,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ \end{scope}
+}
+
+\newcommand{\truchethex}[8][(0,0)]{
+ \begin{scope}[shift={#1}]
+ \ifthenelse{\equal{#2}{b}}{
+ \draw[black,fill=black] (0,0) -- (1,0) -- (1.5,0.866) -- (1,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ }{
+ \draw[white,fill=white] (0,0) -- (1,0) -- (1.5,0.866) -- (1,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ }
+ \ifthenelse{\equal{#3}{#2}}{}{
+ \ifthenelse{\equal{#3}{b}}{
+ \draw [black,fill=black,domain=240:360,line width=1pt] plot ({0.5*cos(\x)}, {1.732+0.5*sin(\x)}) -- (0,1.732) -- cycle;
+ }{
+ \draw [white,fill=white,domain=240:360,line width=1pt] plot ({0.5*cos(\x)}, {1.732+0.5*sin(\x)}) -- (0,1.732) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#4}{#2}}{}{
+ \ifthenelse{\equal{#4}{b}}{
+ \draw [black,fill=black,domain=180:300,line width=1pt] plot ({1+0.5*cos(\x)}, {1.732+0.5*sin(\x)}) -- (1,1.732) -- cycle;
+ }{
+ \draw [white,fill=white,domain=180:300,line width=1pt] plot ({1+0.5*cos(\x)}, {1.732+0.5*sin(\x)}) -- (1,1.732) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#5}{#2}}{}{
+ \ifthenelse{\equal{#5}{b}}{
+ \draw [black,fill=black,domain=120:240,line width=1pt] plot ({1.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (1.5,0.866) -- cycle;
+ }{
+ \draw [white,fill=white,domain=120:240,line width=1pt] plot ({1.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (1.5,0.866) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#6}{#2}}{}{
+ \ifthenelse{\equal{#6}{b}}{
+ \draw [black,fill=black,domain=60:180,line width=1pt] plot ({1+0.5*cos(\x)}, {0.5*sin(\x)}) -- (1,0) -- cycle;
+ }{
+ \draw [white,fill=white,domain=60:180,line width=1pt] plot ({1+0.5*cos(\x)}, {0.5*sin(\x)}) -- (1,0) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#7}{#2}}{}{
+ \ifthenelse{\equal{#7}{b}}{
+ \draw [black,fill=black,domain=0:120,line width=1pt] plot ({0.5*cos(\x)}, {0.5*sin(\x)}) -- (0,0) -- cycle;
+ }{
+ \draw [white,fill=white,domain=0:120,line width=1pt] plot ({0.5*cos(\x)}, {0.5*sin(\x)}) -- (0,0) -- cycle;
+ }
+ }
+ \ifthenelse{\equal{#8}{#2}}{}{
+ \ifthenelse{\equal{#8}{b}}{
+ \draw [black,fill=black,domain=-60:60,line width=1pt] plot ({-0.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (-0.5,0.866) -- cycle;
+ }{
+ \draw [white,fill=white,domain=-60:60,line width=1pt] plot ({-0.5+0.5*cos(\x)}, {0.866+0.5*sin(\x)}) -- (-0.5,0.866) -- cycle;
+ }
+ }
+ \draw[black,line width=1pt] (0,0) -- (1,0) -- (1.5,0.866) -- (1,1.732) -- (0,1.732) -- (-0.5,0.866) -- cycle;
+ \end{scope}
+}
+
+\newenvironment{rotatehex}[1]{
+ \begin{scope}[shift={(0.5,0.866)}]
+ \begin{scope}[rotate=#1]
+ \begin{scope}[shift={(-0.5,-0.866)}]
+}{
+ \end{scope}
+ \end{scope}
+ \end{scope}
+}
+
+
+\newcommand{\truchetcube}[7][(0,0)]{
+ \begin{scope}[shift={#1}]
+ %1.17,0.22
+ %-0.38,0.67
+ \coordinate (A) at (0,0);
+ \coordinate (B) at (1.17,0.22);
+ \coordinate (C) at (0.57,0.84);
+ \coordinate (D) at (-0.6,0.62);
+ \coordinate (E) at (0,1);
+ \coordinate (F) at (1.17,1.22);
+ \coordinate (G) at (0.57,1.84);
+ \coordinate (H) at (-0.6,1.62);
+ %faces
+ \ifthenelse{\equal{#2}{b}}
+ {\fill[fill=black,fill opacity=0.6] (A) -- (B) -- (C) -- (D) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (A) -- (B) -- (C) -- (D) -- cycle;}
+ \ifthenelse{\equal{#3}{b}}
+ {\fill[fill=black,fill opacity=0.6] (A) -- (B) -- (F) -- (E) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (A) -- (B) -- (F) -- (E) -- cycle;}
+ \ifthenelse{\equal{#4}{b}}
+ {\fill[fill=black,fill opacity=0.6] (B) -- (C) -- (G) -- (F) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (B) -- (C) -- (G) -- (F) -- cycle;}
+ \ifthenelse{\equal{#5}{b}}
+ {\fill[fill=black,fill opacity=0.6] (C) -- (D) -- (H) -- (G) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (C) -- (D) -- (H) -- (G) -- cycle;}
+ \ifthenelse{\equal{#6}{b}}
+ {\fill[fill=black,fill opacity=0.6] (D) -- (A) -- (E) -- (H) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (D) -- (A) -- (E) -- (H) -- cycle;}
+ \ifthenelse{\equal{#7}{b}}
+ {\fill[fill=black,fill opacity=0.6] (E) -- (F) -- (G) -- (H) -- cycle;}
+ {\fill[fill=white,fill opacity=0.6] (E) -- (F) -- (G) -- (H) -- cycle;}
+ %edges
+ \draw[black,line width=1pt] (A) -- (B) -- (C) -- (D) -- cycle;
+ \draw[black,line width=1pt] (E) -- (F) -- (G) -- (H) -- cycle;
+ \draw[black,line width=1pt] (A) -- (E);
+ \draw[black,line width=1pt] (B) -- (F);
+ \draw[black,line width=1pt] (C) -- (G);
+ \draw[black,line width=1pt] (D) -- (H);
+ \end{scope}
+}
+
+\endinput
+%%
+%% End of file `tikz-truchet.sty'.