%!TEX root = ../pmdraw.tex

% *------------------------------*
% |9````````````````````````````1|
% |`````____````____`````````````|
% |````|MFMF\  /MFMF|````````````|
% |````|MF|MF\/MF|MF|````````````|
% |````|MF|\MFMF/|MF|_______`````|
% |````|MF|``````|MFMFMFMFMF|````|
% |````|MF|``````|MF|````````````|
% |````|MF|``````|MF|___`````````|
% |``````````````|MFMFMF|````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |``````````````|MF|````````````|
% |9````````````````````````````0|
% *------------------------------*

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                        %
% Licence                                                %
%                                                        %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Copyright 2023-10-16 (original release) -- 2025, Matthias Fresacher
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is found via
% http://www.latex-project.org/lppl.txt.

\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}
        }
    }
}
