\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{graphicx} %BIlder einbinden
\usepackage{amsmath} %erweiterte Mathe-Zeichen
\usepackage{amsfonts} %weitere fonts
\usepackage[utf8]{inputenc} %Umlaute & Co
\usepackage{hyperref} %Links
\usepackage{ifthen} %ifthenelse
\usepackage{enumerate}
\usepackage{pdfpages}
\usepackage{algpseudocode} %Pseudocode
\usepackage{dsfont} % schöne Zahlenräumezeichen
\usepackage{amssymb, amsthm} %noch stärker erweiterte Mathe-Zeichen
\usepackage{tikz} %TikZ ist kein Zeichenprogramm
\usetikzlibrary{trees,automata,arrows,shapes}
\usepackage{qtree}
\usepackage{listings}
\lstset{language=Matlab}

\pagestyle{empty}


\topmargin-50pt

\newcounter{aufgabe}
\def\tand{&}

\newcommand{\makeTableLine}[2][0]{%
  \setcounter{aufgabe}{1}%
  \whiledo{\value{aufgabe} < #1}%
  {%
    #2\tand\stepcounter{aufgabe}%
  }
}

\newcommand{\aufgTable}[1]{
  \def\spalten{\numexpr #1 + 1 \relax}
  \begin{tabular}{|*{\spalten}{p{1cm}|}}
    \makeTableLine[\spalten]{A\theaufgabe}$\Sigma$~~\\ \hline
    \rule{0pt}{15pt}\makeTableLine[\spalten]{}\\
  \end{tabular}
}

\def\header#1#2#3#4#5#6#7{\pagestyle{empty}
\begin{minipage}[t]{0.47\textwidth}
\begin{flushleft}
{\bf #4}\\
#5
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{flushright}
#6 \vspace{0.5cm}\\
%                 Number of Columns    Definition of Columns      second empty line
% \begin{tabular}{|*{5}{C{1cm}|}}\hline A1&A2&A3&A4&$\Sigma$\\\hline&&&&\\\hline\end{tabular}\\\vspace*{0.1cm}
\aufgTable{#7}
\end{flushright}
\end{minipage}
\vspace{1cm}
\begin{center}
{\Large\bf Assignment #1}

{(Hand-in date #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

%Kommando für Aufgaben
%\Aufgabe{AufgTitel}{Punktezahl}
\newcommand{\Aufgabe}[2]{\stepcounter{n}
\textbf{Exercise \arabic{n}: #1} (#2 Punkte)\\}

\newcommand{\Normal}[3]{\mathcal{N}\left(#1,#2,#3\right)}
\newcommand{\Normalf}[3]{\frac{\left|#3\right|^{-\frac{1}{2}}}{\sqrt{2\pi}}e^{-\frac{\left(#1 - #2 \right)^2\cdot \left(#3\right)^{-1}}{2}}}




\begin{document}
    %\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
    \header{10}{}{2015-07-07}{Mobile Robots}{
        \textit{Jan-Peter Hohloch}\\ \textit{Maximus Mutschler}
    }{SS 15}{2}
    \vspace{1cm}

    \Aufgabe{Convex Hull Algorithms}{10}
        \begin{enumerate}[(a)]
\item \includegraphics[width=0.7\linewidth]{A1a}
            \item \includegraphics[width=0.7\linewidth]{A1b}
             ~\\$ \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
            	1&2&3&4&5&6&7&8&9&10\\ 
            	\hline
            	2&3&4&5&6&7&8&9&10&9\\
            	1&2&2&4&4&6&7&8&9&8\\
            	& 1&1&2&2&4&6&7&8&7\\
            	&&   &1&1&2&4&6&7&6\\
            	&&&&     &1&2&4&6&4\\
            	&&&&&&      1&2&4&2\\
            	&&&&&&&       1&2&1\\
            	&&&&&&&&        1&\\
            	&&&&&&&&&\\
            \end{tabular}$\\
            S pushes the new point if it is on the left of the line through the two highest elements of the stack.\\
            S pops elements until the new point is on the right of the resultin line. 
            \item \pagebreak~
\includegraphics[width=0.48\textwidth]{A1c/step1}
\includegraphics[width=0.48\textwidth]{A1c/step2}
\includegraphics[width=0.48\textwidth]{A1c/step3}
\includegraphics[width=0.48\textwidth]{A1c/step4}
\includegraphics[width=0.48\textwidth]{A1c/step5}
\includegraphics[width=0.48\textwidth]{A1c/step6}


            \item Sklansky's algorithm runs in linear time, i.e. $\mathcal{O}(n)$
            \item QuickHull has a worst case runningtime of $\mathcal{O}(n^2)$, when there are no points that can be ignored. A geometric example of the worst case is a cylindric obstacle because a circle doesn't allow any point to be ignored because the drawn line is always nearer to the circles center then a point on the circle.
        \end{enumerate}
        \pagebreak
     \Aufgabe{Path Planning by dynamic programming}{10}   
	\begin{enumerate}[(a)]
		\item  $\left[ \begin{array}{cccccccccc}
		-1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 \\
		-1 & -1 & Inf & Inf & -1 & Inf & Inf & Inf & Inf & -1 \\
		-1 & Inf & Inf & Inf & -1 & Inf & Inf & Inf & Inf & -1 \\
		-1 & Inf & Inf & Inf & -1 & -1 & Inf & Inf & Inf & -1 \\
		-1 & Inf & -1 & Inf & Inf & -1 & -1 & Inf & -1 & -1 \\
		-1 & Inf & -1 & Inf & -1 & -1 & -1 & Inf & -1 & -1 \\
		-1 & Inf & -1 & Inf & Inf & Inf & Inf & Inf & Inf & -1 \\
		-1 & Inf & -1 & Inf & Inf & Inf & Inf & Inf & Inf & -1 \\
		-1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1
		\end{array} \right]$
		
		\item Point A:\\
		forward1:\\
		$\left[ \begin{array}{cccccccccc}
			-1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 & -1 \\
			-1 & -1 & 6.41421 & 6.82843 & -1 & - & - & - & - & -1 \\
			-1 & 5 & 5.41421 & 5.82843 & occ & - & - & - & - & occ \\
			occ & 4 & 4.41421 & 5.41421 & occ & occ & - & - & - & occ \\
			occ & 3 & occ & - & - & occ & occ & - & occ & occ \\
			occ & 2 & occ & - & occ & occ & occ & - & occ & occ \\
			occ & 1 & occ & - & - & - & - & - & - & occ \\
			occ & - & occ & - & - & - & - & - & - & occ \\
			occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$\\
		backward1:\\
		$\left[ \begin{array}{cccccccccc}
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		occ & occ & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & occ & - & - & - & occ \\
		occ & - & occ & 5.82843 & 6.82843 & occ & occ & - & occ & occ \\
		occ & - & occ & 6.82843 & occ & occ & occ & - & occ & occ \\
		occ & - & occ & 7.82843 & 8.24264 & - & - & - & - & occ \\
		occ & - & occ & 8.82843 & 9.24264 & 9.65685 & - & - & - & occ \\
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$\\
		forward2:\\
		$\left[ \begin{array}{cccccccccc}
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		occ & occ & - & - & occ & - & - & 15.6569 & 16.0711 & occ \\
		occ & - & - & - & occ & - & - & 14.6569 & 15.0711 & occ \\
		occ & - & - & - & occ & occ & - & 13.6569 & 14.0711 & occ \\
		occ & - & occ & - & - & occ & occ & 12.6569 & occ & occ \\
		occ & - & occ & - & occ & occ & occ & 11.6569 & occ & occ \\
		occ & - & occ & - & - & 9.24264 & 10.2426 & 11.2426 & 12.2426 & occ \\
		occ & - & occ & - & - & - & 10.6569 & 11.6569 & 12.6569 & occ \\
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$\\
		backward2:\\
		$\left[ \begin{array}{cccccccccc}
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		occ & occ & - & - & occ & 17.6569 & 16.6569 & - & - & occ \\
		occ & - & - & - & occ & 16.6569 & 15.6569 & - & - & occ \\
		occ & - & - & - & occ & occ & 14.6569 & - & - & occ \\
		occ & - & occ & - & - & occ & occ & - & occ & occ \\
		occ & - & occ & - & occ & occ & occ & - & occ & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$\\
		forward3\\
		$\left[ \begin{array}{cccccccccc}
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		occ & occ & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & occ & - & - & - & occ \\
		occ & - & occ & - & - & occ & occ & - & occ & occ \\
		occ & - & occ & - & occ & occ & occ & - & occ & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$\\
		backward3\\
		$\left[ \begin{array}{cccccccccc}
			occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
			occ & occ & - & - & occ & - & - & - & - & occ \\
			occ & - & - & - & occ & - & - & - & - & occ \\
			occ & - & - & - & occ & occ & - & - & - & occ \\
			occ & - & occ & - & - & occ & occ & - & occ & occ \\
			occ & - & occ & - & occ & occ & occ & - & occ & occ \\
			occ & - & occ & - & - & - & - & - & - & occ \\
			occ & - & occ & - & - & - & - & - & - & occ \\
			occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$		 
		 \\
		 Point B:\\
		 forward1:\\
		 $\left[ \begin{array}{cccccccccc}
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		 occ & occ & - & - & occ & 2.41421 & 1 & 1.41421 & 2.41421 & occ \\
		 occ & - & - & - & occ & 1.41421 & - & 1 & 2 & occ \\
		 occ & - & - & - & occ & occ & - & - & - & occ \\
		 occ & - & occ & - & - & occ & occ & - & occ & occ \\
		 occ & - & occ & - & occ & occ & occ & - & occ & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		 \end{array} \right]$\\
		 backward1:\\
		 $\left[ \begin{array}{cccccccccc}
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		 occ & occ & - & - & occ & 2 & - & - & - & occ \\
		 occ & - & - & - & occ & 1 & - & - & - & occ \\
		 occ & - & - & - & occ & occ & 1 & 1.41421 & 2.41421 & occ \\
		 occ & - & occ & - & - & occ & occ & 2.41421 & occ & occ \\
		 occ & - & occ & - & occ & occ & occ & 3.41421 & occ & occ \\
		 occ & - & occ & 7.82843 & 6.82843 & 5.82843 & 4.82843 & 4.41421 & 4.82843 & occ \\
		 occ & - & occ & 8.24264 & 7.24264 & 6.24264 & 5.82843 & 5.41421 & 5.82843 & occ \\
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		 \end{array} \right]$\\
		 forward2:\\
		 $\left[ \begin{array}{cccccccccc}
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		 occ & occ & - & 12.8284 & occ & - & - & - & - & occ \\
		 occ & - & - & 11.8284 & occ & - & - & - & - & occ \\
		 occ & - & - & 10.8284 & occ & occ & - & - & - & occ \\
		 occ & - & occ & 9.82843 & 10.2426 & occ & occ & - & occ & occ \\
		 occ & - & occ & 8.82843 & occ & occ & occ & - & occ & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		 \end{array} \right]$\\
		 backward2:\\
		 $\left[ \begin{array}{cccccccccc}
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		 occ & occ & 13.8284 & - & occ & - & - & - & - & occ \\
		 occ & 13.8284 & 12.8284 & - & occ & - & - & - & - & occ \\
		 occ & 12.8284 & 11.8284 & - & occ & occ & - & - & - & occ \\
		 occ & 13.2426 & occ & - & - & occ & occ & - & occ & occ \\
		 occ & 14.2426 & occ & - & occ & occ & occ & - & occ & occ \\
		 occ & 15.2426 & occ & - & - & - & - & - & - & occ \\
		 occ & 16.2426 & occ & - & - & - & - & - & - & occ \\
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		 \end{array} \right]$\\
		 
		 forward3\\
		 $\left[ \begin{array}{cccccccccc}
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		 occ & occ & - & - & occ & - & - & - & - & occ \\
		 occ & - & - & - & occ & - & - & - & - & occ \\
		 occ & - & - & - & occ & occ & - & - & - & occ \\
		 occ & - & occ & - & - & occ & occ & - & occ & occ \\
		 occ & - & occ & - & occ & occ & occ & - & occ & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & - & occ & - & - & - & - & - & - & occ \\
		 occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		 \end{array} \right]$\\
		 backward3\\
		$\left[ \begin{array}{cccccccccc}
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ \\
		occ & occ & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & - & - & - & - & occ \\
		occ & - & - & - & occ & occ & - & - & - & occ \\
		occ & - & occ & - & - & occ & occ & - & occ & occ \\
		occ & - & occ & - & occ & occ & occ & - & occ & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & - & occ & - & - & - & - & - & - & occ \\
		occ & occ & occ & occ & occ & occ & occ & occ & occ & occ
		\end{array} \right]$
		
\pagebreak	
	\item ~ 
Point A:\\
\includegraphics[width=0.7\linewidth]{A2/gradientAb}\\
Point B:\\
\includegraphics[width=0.7\linewidth]{A2/gradientBb}
\pagebreak
\item path a:\\
$\left[ \begin{array}{cc}
8 & 2 \\
7 & 2 \\
6 & 2 \\
5 & 2 \\
4 & 3 \\
5 & 4 \\
6 & 4 \\
7 & 5 \\
7 & 6 \\
7 & 7 \\
8 & 8
\end{array} \right]$\\
path b:\\
$\left[ \begin{array}{cc}
	3 & 7 \\
	4 & 7 \\
	5 & 8 \\
	6 & 8 \\
	7 & 8 \\
	8 & 8
\end{array} \right]$

\end{enumerate}	
\end{document}

