summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pmdraw/examples/example-12.tex
blob: f21946849fba1d45a2f665a5739da30f30ace2a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%!TEX root = ../pmdraw.tex

% *------------------------------*
% |6````````````````````````````7|
% |`````____````____`````````````|
% |````|MFMF\  /MFMF|````````````|
% |````|MF|MF\/MF|MF|````````````|
% |````|MF|\MFMF/|MF|_______`````|
% |````|MF|``````|MFMFMFMFMF|````|
% |````|MF|``````|MF|````````````|
% |````|MF|``````|MF|___`````````|
% |``````````````|MFMFMF|````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |2````````````````````````````4|
% *------------------------------*

\pmdDiagram{
    { % Brick 1
        [ % Options
            degree=16,
            row sep=3, % Must be before levels key
            levels=3,
            vertices options={
                \fill[red] (#1,#2) circle (.5);
            },
            edges upper={very thick},
            edges transversal={red,very thick},
            brace={
                left=1,
                right=4,
                label={4},
                options={
                    \draw [
                        red,
                        very thick,
                        decorate,
                        decoration={calligraphic brace,mirror,amplitude=6pt}
                    ] (#1-0.17,-0.5) -- (#2+0.17,-0.5) node[pos=0.5,below=6pt]{\(#3\)};
                }
            }
        ]{ % Upper non transversal edges
            {4}{5}
            [ % Options
                options={
                    \draw[blue] (#1,3) arc (180:270:\pmdraw{edgeHeight}); % Draw left arch
                    \draw[blue] (#1+\pmdraw{edgeHeight},3-\pmdraw{edgeHeight}) -- (#2-\pmdraw{edgeHeight},3-\pmdraw{edgeHeight}); % Draw straight line
                    \draw[blue] (#2-\pmdraw{edgeHeight},3-\pmdraw{edgeHeight}) arc (270:360:\pmdraw{edgeHeight}); % Draw right arc
                }
            ]{4}{6}
            [level=2]{4}{7}
            [level=3]{4}{8}
        }{ % Lower non transversal edges
            {4}{5}
            [
                options={
                    \draw[green] (#1,0) arc (180:90:\pmdraw{edgeHeight}); % Draw left arch
                    \draw[green] (#1+\pmdraw{edgeHeight},\pmdraw{edgeHeight}) -- (#2-\pmdraw{edgeHeight},\pmdraw{edgeHeight}); % Draw straight line
                    \draw[green] (#2-\pmdraw{edgeHeight},\pmdraw{edgeHeight}) arc (90:0:\pmdraw{edgeHeight}); % Draw right arc
                }
            ]{4}{6}
            [level=2]{4}{7}
            [level=3]{4}{8}
        }
        { % Transversal edges
            [height=1.75]{11}{1}
            [height=1.25]{12}{2}
            [height=0.75]{13}{3}
            [height=0.25]{14}{4}
            [height=0.5]{1}{11}
            [height=1]{2}{12}
            [height=1.5]{3}{13}
            [
                options={
                    \draw[dashed] (#1, 3) -- (#2, 0); % Draw straight line
                }
            ]{16}{16}
            {15}{15}
        }
    }
    { % Brick 2
        [ % Options
            degree=14,
            row sep=3, % Must be before levels key
            levels=3
        ]{ % Upper non transversal edges
            \pmdEmpty
        }{ % Lower non transversal edges
            \pmdEmpty
        }{ % Transversal edges
            [height=1.75]{11}{1}
            [height=1.25]{12}{2}
            [height=0.75]{13}{3}
            [height=0.25]{14}{4}
            [height=0.5]{1}{11}
            [height=1]{2}{12}
            [height=1.5]{3}{13}
        }
    }
}