%
% approximation.tex -- Approximation einer Abbildung durch eine simpliziale
%
% (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
%
\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{times}
\usepackage{txfonts}
\usepackage{pgfplots}
\usepackage{csvsimple}
\usetikzlibrary{arrows,intersections,math}
\begin{document}
\def\skala{1.3}
\begin{tikzpicture}[>=latex,thick,scale=\skala]

\definecolor{darkred}{rgb}{0.8,0,0}
\definecolor{darkred}{rgb}{0,0,0}

\def\gitter{
	\foreach \x in {1,1.5,...,6}{
		\draw[color=gray] (\x,1) -- (\x,6);
		\draw[color=gray] (1,\x) -- (6,\x);
	}
}

\def\s{1.05}

\def\colorsector{
	\foreach \r in {3,3.2,...,5.8}{
		\foreach \a in {20,...,69}{
			\pgfmathparse{(\a-20)/50}
			\xdef\rot{\pgfmathresult}
			\pgfmathparse{(\r-3)/3}
			\xdef\blau{\pgfmathresult}
			\definecolor{mycolor}{rgb}{\rot,0.8,\blau}
			\fill[color=mycolor]
				(\a:{\s*\r}) -- (\a:{\s*(\r+0.21)}) -- ({\a+1.02}:{\s*(\r+0.21)}) -- ({\a+1.02}:{\s*\r}) -- cycle;
		}
	}
}

\begin{scope}[xshift=0cm]
\colorsector
\gitter
\foreach \r in {3,3.5,...,6.0}{
	\draw[color=black,line width=0.4pt] (20:{\s*\r}) arc (20:70:{\s*\r});
}
\foreach \a in {20,28.3333,...,70}{
	\draw[color=black,line width=0.4pt] (\a:{\s*3}) -- (\a:{\s*6});
}
\begin{scope}
\clip (20:{\s*3}) -- (20:{\s*6}) arc (20:70:{\s*6}) -- (70:{\s*3});
\foreach \a in {-5,...,5}{
	\draw[color=black,line width=0.4pt]
		plot[domain={20+8.33333*\a}:{70+8.3333*\a},samples=100]
			(\x:{\s*(3+3*(\x-(20+8.3333*\a))/50)});
}
\end{scope}

\end{scope}

\begin{scope}[xshift=5.5cm]
\input{approx.tex}
\end{scope}

\end{tikzpicture}
\end{document}

