Skip to content

Instantly share code, notes, and snippets.

@scmbradley
Created October 28, 2021 20:14
Show Gist options
  • Save scmbradley/7a036ecfe50c97fac91ef5c9374ff511 to your computer and use it in GitHub Desktop.
Save scmbradley/7a036ecfe50c97fac91ef5c9374ff511 to your computer and use it in GitHub Desktop.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Give three nodes names
\coordinate (a) at (90:3cm);
\coordinate (b) at (210:3cm);
\coordinate (c) at (-30:3cm);
% Label those nodes
\node [above] at (a) {$a$};
\node [below left] at (b) {$b$};
\node [below right] at (c) {$c$};
% The below transform canvas shenanigans require the following explicit
% instruction about the bounding box of the figure
\path[use as bounding box] (210:4cm) rectangle (7cm,7cm);
% Within the scope, the x,y,z components are treated like barycentric coordinates
\begin{scope}[x=(a),y=(b),z=(c)]
% Draw outer triangle
\draw (a) -- (b) -- (c) --cycle;
% Draw dashed line
\draw [dashed] (1,0,0) -- (0.4,0.3,0.3);
% Draw red filled shape
\fill[fill=red, opacity=0.5] (0.4,0.3,0.3) -- (0,0.3,0.7) -- (0,0.7,0.3)--cycle;
% Use a copy of the same coordinate system but shifted up and to the right
\begin{scope}[transform canvas={xshift=4cm,yshift=3.5cm}]
\draw[blue] (a) -- (b) -- (c) --cycle;
\end{scope}
\end{scope}
% Draw the curved arrow
% `tips=proper' is required for some reason...
% I had to sort of just guess the arrow start and end points...
\draw [-stealth,line width = 5pt,tips=proper](75:3cm) edge [bend left] ($(75:3cm) + (1cm,1cm)$);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment