\documentclass[12pt,a4paper]{article}

\usepackage{amstext}
%\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{enumerate}
\usepackage{alltt}
\usepackage[latin1]{inputenc}
\usepackage{cancel}
\usepackage{fancyhdr}
\usepackage{pstricks}
%\usepackage{pst-plot}
\usepackage{ngerman}

\title{\textsc{Computer Graphics I \\ \large Assignment 10 \\ \small Group III (Yavor Kaloyanov)}}
\author{\shortstack[c]{Jan Hendrik Dithmar\\ \footnotesize 2031259} \and \shortstack[c]{Pascal Gwosdek\\ \footnotesize 2505221}}
\date{}

\pagestyle{fancy}

\lhead{Assignment 10}
\chead{}
\rhead{Dithmar (2031259), Gwosdek (2505221)}
\lfoot{Computer Graphics 1}
\cfoot{Page \thepage}
\rfoot{WS 2006/2007}

\begin{document}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\newcommand{\exercise}[1]{\subsection{#1}}
\renewcommand{\theenumi}{\textbf{\alph{enumi}}}

\newcommand{\AND}{\ensuremath{\wedge}}
\newcommand{\OR}{\ensuremath{\vee}}
\newcommand{\SetR}{\ensuremath{\mathbb{R}}}
\newcommand{\SetN}{\ensuremath{\mathbb{N}}}
\newcommand{\SetC}{\ensuremath{\mathbb{C}}}
\newcommand{\SetZ}{\ensuremath{\mathbb{Z}}}
\newcommand{\SetQ}{\ensuremath{\mathbb{Q}}}
\newcommand{\SetB}{\ensuremath{\mathbb{B}}}
\newcommand{\QED}{\ensuremath{\hspace*{\fill}\square}}
\newcommand{\FLASH}{\ensuremath{\hspace*{\fill}\lightning}}
\newcommand{\OnotO}{\ensuremath{\mathcal{O}}}
\newcommand{\bild}[4]{
	\begin{figure}[htpb]
		\centering
			\includegraphics[width=#1cm]{#2}\\[0.2cm]
			\caption{#3}
			\label{#4}
	\end{figure}
	}

\newcommand{\m}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\+}{\phantom{-}}
\newcommand{\f}{\frac}

\maketitle

\thispagestyle{empty}

\newpage
\setcounter{page}{1}
\setcounter{section}{10}

\exercise{Clipping}
\begin{center}
% erstes tolles bild
%\begin{pspicture}(-7.5,-5.5)(16.5,21.5)
\begin{pspicture}(-1.9,-1.1)(3.5,4.5) %(0,0)(5,5)
\psset{xunit=0.2cm,yunit=0.2cm}
\psdot[dotsize=2pt](0,0)
\rput(0.5,-1.3){$C_1$}
\psdot[dotsize=2pt](0,6)
\rput(0.5,7){$C_2$}
\psdot[dotsize=2pt](12,6)
\rput(12.5,7){$C_3$}
\psdot[dotsize=2pt](12,0)
\rput(12.5,-1.3){$C_4$}
\pspolygon[linewidth=0.5pt](0,0)(0,6)(12,6)(12,0)

\psline[linewidth=0.5pt, linestyle=dashed](-7,6)(16,6)

\psdot[dotsize=2pt](9,8)
\rput(10,9){$P_1$}
\psdot[dotsize=2pt](-6,3)
\rput(-7,4){$P_2$}
\psdot[dotsize=2pt](14,20)
\rput(15,21){$P_3$}
\psdot[dotsize=2pt](15,-4)
\rput(16,-5){$P_4$}

\pspolygon[linewidth=0.5pt](9,8)(-6,3)(14,20)(15,-4)
\end{pspicture}
\end{center}
Given:
$$C_1 = (0,0), C_2 = (0,6), C_3 = (12,6), C_4 = (12,0)$$
and
$$P_1 = (9,8), P_2 = (-6,3), P_3 = (14,20), P_4 = (15,-4)$$
Clipping against top edge: we start with $P_1$ and $P_2$
\begin{itemize}
	\item $P_1$ and $P_2$: \\
		$P_1$ outside, $P_2$ inside \\
		$P_5 =$ intersection at $\overline{P_1 P_2}$ with straight through $C_2, C_3$ polygon points $\{P_5, P_2\}$.
	\item $P_2$ and $P_3$: \\
		$P_2$ inside, $P_3$ outside \\
		$P_6 =$ intersection at $\overline{P_2 P_3}$ with straight through $C_2, C_3$ polygon points $\{P_5, P_2, P_6\}$.
	\item $P_3$ and $P_4$: \\
		$P_3$ outside, $P_4$ inside \\
		$P_7 =$ intersection at $\overline{P_3 P_4}$ with straight through $C_2, C_3$ polygon points $\{P_5, P_2, P_6, P_7, P_4\}$.
	\item $P_4$ and $P_1$: \\
		$P_4$ inside, $P_1$ outside \\
		$P_8 =$ intersection at $\overline{P_4 P_1}$ with straight through $C_2, C_3$ polygon points $\{P_5, P_2, P_6, P_7, P_4, P_8\}$.
\end{itemize}
\begin{center}
% zweites tolles bild
%\begin{pspicture}(-7.5,-5.5)(16.5,21.5)
\begin{pspicture}(-1.9,-1.1)(3.5,4.5) %(0,0)(5,5)
\psset{xunit=0.2cm,yunit=0.2cm}
\psdot[dotsize=2pt](0,0)
\rput(0.5,-1.3){$C_1$}
\psdot[dotsize=2pt](0,6)
\rput(0.5,7){$C_2$}
\psdot[dotsize=2pt](12,6)
\rput(12.5,7){$C_3$}
\psdot[dotsize=2pt](12,0)
\rput(12.5,-1.3){$C_4$}
\pspolygon[linewidth=0.5pt](0,0)(0,6)(12,6)(12,0)

\psline[linewidth=0.5pt, linestyle=dashed](-7,6)(16,6)

\psdot[dotsize=2pt](9,8)
\rput(10,9){$P_1$}
\psdot[dotsize=2pt](-6,3)
\rput(-7,4){$P_2$}
\psdot[dotsize=2pt](14,20)
\rput(15,21){$P_3$}
\psdot[dotsize=2pt](15,-4)
\rput(16,-5){$P_4$}
\pspolygon[linewidth=0.5pt](9,8)(-6,3)(14,20)(15,-4)

\psdot[dotsize=2pt](3,6)
\rput(3,4.7){$P_5$}
\psdot[dotsize=2pt](-2.45,6)
\rput(-3.3,7){$P_6$}
\psdot[dotsize=2pt](10,6)
\rput(9.2,4.7){$P_8$}
\psdot[dotsize=2pt](14.6,6)
\rput(15.6,7){$P_7$}
\pspolygon[linewidth=0.7pt](-2.45,6)(3,6)(-6,3)
\pspolygon[linewidth=0.7pt](10,6)(14.6,6)(15,-4)

\end{pspicture}
\end{center}

%\exercise{Rasterization}

%\exercise{Triangle Order for Rasterization}

\end{document}
