Skip to content

Instantly share code, notes, and snippets.

@camilstaps camilstaps/top.tex
Last active Jan 18, 2019

Embed
What would you like to do?
Diagram explaining Task Oriented Programming
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\definecolor{ui}{HTML}{e64021}
\definecolor{tasks}{HTML}{7e63bc}
\definecolor{fp}{HTML}{076509}
\definecolor{sds}{HTML}{3d59ac}
\definecolor{types}{HTML}{f9bd1c}
\begin{document}
\begin{tikzpicture}[color=white]
\def\blocksize{2.5}
\def\blockcenterratio{0.7}
\newcount\outdegree\outdegree=45
\foreach \name/\fillcolor/\startx/\starty/\endx/\endy in
{UI (PL)/ui/1/1/-1/1%
,Tasks (BL)/tasks/-1/1/-1/-1%
,FP (UoD)/fp/-1/-1/1/-1%
,SDS (RL)/sds/1/-1/1/1}{
\edef\centerx{\ifx\startx\endx\startx\else0\fi pt}
\edef\centery{\ifx\starty\endy\starty\else0\fi pt}
\pgfmathparse{\startx*\blocksize}\let\startx\pgfmathresult
\pgfmathparse{\starty*\blocksize}\let\starty\pgfmathresult
\pgfmathparse{\endx*\blocksize}\let\endx\pgfmathresult
\pgfmathparse{\endy*\blocksize}\let\endy\pgfmathresult
\global\advance\outdegree by 90\relax
\newcount\indegree\indegree=\outdegree\advance\indegree by-90\relax
\draw[black,fill=\fillcolor]
($(\startx,\starty)+(\centerx,\centery)$)
to[out=\the\outdegree,in=\the\indegree] coordinate (fstmid)
($(\endx,\endy)+(\centerx,\centery)$)
-- ($(\endx,\endy)!\blockcenterratio!(0,0)+(\centerx,\centery)$)
to[out=\the\outdegree-90,in=\the\indegree+90] coordinate (sndmid)
($(\startx,\starty)!\blockcenterratio!(0,0)+(\centerx,\centery)$)
-- cycle;
\node at ($(fstmid)!0.5!(sndmid)$) {\name};
}
\pgfmathsetlengthmacro{\radius}{sqrt(2*((1-\blockcenterratio)*\blocksize cm)^2)-.5pt}
\draw[black,fill=types] (0,0) node {Types} circle (\radius);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.