Draw two triangles intersect on a common triangle

tikz-pgf

I would like to draw in tikz the following image:

enter image description here

I want to draw two triangles intersecting in the common triangles with the dashed box. However, I am finding it difficult though, could anyone help me please?

This is my code:

\begin{tikzcd}
a \arrow[r, "\lambda"] & b \arrow[r, "\mu"] \arrow[d,"\pi"] & c \arrow[r,"\ell"] \arrow[d,"\rho" ]   & s \arrow[d,"\ell^\prime"]                 &                           \\
                  & d \arrow[r,"\sigma" ] \arrow[lu,  squiggly]      & e \arrow[r,"\mu^\prime"] \arrow[d, "\phi"]   & x \arrow[r,"\theta"] \arrow[d,"\rho^\prime" ]               & a[2] \arrow[d]               \\
                  &                             & p \arrow[r,"\sigma^{\prime}"] \arrow[lu, squiggly] & y \arrow[r,"\theta^\prime"] \arrow[d]          & b[2] \arrow[d]    \\
                  &                             &                             & z \arrow[r,"\nu"] \arrow[lu, squiggly] & c[2] \arrow[d,"\ell{[2]}"]      \\
                  &                             &                             &                                     & s[2] \arrow[lu,  squiggly]
\end{tikzcd}

Best Answer

I'm not quite sure whether the two triangles still should have their outline showing when they intersect or not, both options are shown in the picture.
Here I opted for the latter.

Code

\documentclass[tikz, border=1mm]{standalone}
%\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing, quotes}
\tikzset{
  above'/.style={above=\pgfdecorationsegmentamplitude},
  right'/.style={right=\pgfdecorationsegmentamplitude},
  brace settings/.style={amplitude=4pt},
  brace length/.initial=.75cm,
  pics/brace'/.style={/tikz/rotate=180, brace={#1}},
  pics/brace/.style={
    /tikz/sloped, /tikz/allow upside down,
    code={
      \draw[decorate, decoration={name=brace, /tikz/brace settings}]
      ({-(\pgfkeysvalueof{/tikz/brace length})},3pt)
      -- node[midway,style/.expand once=\tikzpictextoptions]{\tikzpictext}
      ({\pgfkeysvalueof{/tikz/brace length}},3pt);}}}
\begin{document}
\begin{tikzpicture}
\coordinate (tl) at (0,0);
\coordinate (br) at (5,-5);
\coordinate (tr) at (tl-|br);
\coordinate[shift={(-2,-1.5)}] (bl-rect) at (tr);
% or with calc library
% \coordinate(bl-rect) at ($(tr)+(-2,-1.5)$);

% bl-rect|-0,0 is just a point above or below of bl-rect
% bl-rect-|0,0 is just a point left or right of bl-rect
\coordinate (bl-rect-y) at (intersection of bl-rect--bl-rect|-0,0 and tl--br);
\coordinate (bl-rect-x) at (intersection of bl-rect--bl-rect-|0,0 and tl--br);

\filldraw[gray, fill=gray!50] (bl-rect) -- (bl-rect-y) -- (bl-rect-x) -- cycle;

\draw (bl-rect) |- pic[near end,  "$\Delta$"  above'] {brace'} (tl) -- (br)
                |- pic[near start,"$\Delta'$" right'] {brace'} cycle;
\draw[dash pattern=on 4\pgflinewidth off 1.5\pgflinewidth]
  (tr) rectangle ([shift={(3pt,3pt)}]bl-rect);
\end{tikzpicture}
\end{document}

Output

enter image description here

Related Question