\documentclass[12pt]{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,a4}

\title{\textsc{Computer Graphics I \\ \large Assignment 7 \\ \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 7}
\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}{7}

\exercise{Transformations}
To transform, we use the following Operations:
\begin{align*}
T_1 &= \m{\+1 & \+0 & -\f12\\ \+0 & \+1 & -\f12\\ \+0 & \+0 & \+1} &&\mbox{Translation}\\
S_1 &= \m{\+4 & \+0 & \+0\\ \+0 & \+5 & \+0\\ \+0 & \+0 & \+1} && \mbox{Scaling}\\
H_1 &= \m{\+1 & \+1 & \+0\\ \+0 & \+1 & \+0\\ \+0 & \+0 & \+1} && \mbox{Shearing}\\
R_1 &= \m{\+\cos(-45) & -\sin(-45)\\ \+\sin(-45) & \+\cos(-45)} = \m{\+\cos(45) & \+\sin(45)\\ -\sin(45) & -\cos(45)} && \mbox{Rotation}\\
T_2 &= \m{\+1 & \+0 & \+5\\ \+0 & \+1 & \+4\\ \+0 & \+0 & \+1} && \mbox{Translation}
\end{align*}
Hence, the overall transformation matrix is given by
$$M = T_2 \cdot R_1 \cdot H_1 \cdot S_1 \cdot T_1.$$

\exercise{Affine Spaces}
Let $V = \{(x, y, z) \in \mathbb{R}^3\}$ be the associated vector space.\\
\textbf{Claim:} $A = \{(x, y, z, w) \in \mathbb{R}^4 | w = 1\}$ is an affine space.\\
\textbf{Proof:}
\begin{itemize}
\item Let $+ \in P \times V \to P$ given by
$$p + v = \m{x_p\\y_p\\z_p\\1} + \m{x_v\\y_v\\z_v} := \m{x_p + x_v\\ y_p + y_v\\ z_p + z_v\\ 1}\quad\quad\mathbf{(*)},$$
with $p = (x_p, y_p, z_p, 1) \in A$ and $v = (x_v, y_v, z_v) \in V$.

\item Proof of axioms:
\begin{enumerate}
\item[(1)] Let $p \in P$ and $v, w \in V$:
\begin{align*}
(p + v) + w &\overset{(*)}= \m{x_p + x_v\\y_p + y_v\\z_p + z_v\\1} + \m{x_w\\y_w\\z_w} &&\overset{(*)}= \m{(x_p + x_v) + x_w\\ (y_p + y_v) + y_w\\ (z_p + z_v) + z_w\\ 1}\\
&\overset{\mathrm{A}_\mathbb{R}}= \m{x_p + (x_v + x_w)\\ y_p + (y_v + y_w)\\ z_p + (z_v + z_w)\\ 1} &&\overset{(*)}= \m{x_p\\ y_p\\ z_p\\ 1} + \m{x_v + x_w\\ y_v + y_w\\ z_v + z_w}\\
&\overset{\mathrm{D}+}= p + (w + v), &&\blacksquare
\end{align*}
where A$_\mathbb{R}$ denotes associativity in $\mathbb{R}$ and D$+$ stands for the definition of $+$ in $V$.
\end{enumerate}
\item[(2)]
Let $p, q \in P$ and $v, v' \in V$. Assume it holds that $v \neq v', p + v = q$ and $p + v' = q$. Then:
\begin{align*}
\m{x_p + x_v\\ y_p + y_v\\ z_p + z_v\\ 1} &\overset{(*)}= p + v\\
&= q\\
&= p + v'\\
&\overset{(*)}= \m{x_p + x_{v'}\\ y_p + y_{v'}\\ z_p + z_{v'}\\ 1}
\end{align*}
Therefore,
\begin{align*}
&&x_p + x_v &= x_p +x_{v'}\\
\Leftrightarrow&&x_v &= x_{v'}
\end{align*}
by the computation laws in $\mathbf{R}$. Analogously, the same holds for $y_v = y_{v'}$ and $z_v = z_{v'}$. Hence,
$$v = v'.\quad\lightning\quad\quad\blacksquare$$
%
%\begin{center}
%\centering \Huge WRONG!!!
%\end{center}
% Let $p,q \in P$: Assume there exists $v \neq v' \in V$ with $p + v = q$ and $p + v' = q$. Then:
%\begin{align*}
%&& q &= q\\
%\Leftrightarrow&& p + v &= p + v'\\
%\Leftrightarrow&& (p + v) + (-v) &= (p + v') + (-v)\\
%\Leftrightarrow&& p + (v - v) &= p + (v' - v)\\
%\Leftrightarrow&& p + 0 &= p + (v' - v)\\
%\Leftrightarrow&& p &= p + (v' - v)\\
%\Leftrightarrow&& 0 &= v'- v\\
%\Leftrightarrow&& v &= v'
%\end{align*}
\end{itemize}

The literal difference between points and vectors is that in this setting, points consist of four components where the one with highest dimension is fixed to 1, while vectors only include three components. Here, the essential logical difference lies in points only describing coordinates in 3D space, while vectors always represent transformations of points in direction and length.

\exercise{Rotations}
\textbf{Claim:} $$T = H_x \cdot S \cdot H_y$$
\textbf{Proof:}\\
Given
$$H_x = \m{1 & -\f{\sin\phi}{\cos\phi} \\ 0 & 1}, \quad S = \m{\f1{\cos\phi} & 0 \\ 0 & \cos\phi}, \quad H_y = \m{1 & 0 \\\f{\sin\phi}{\cos\phi} & 1},$$
we calculate
$$S \cdot H_y = \m{\f1{\cos\phi} & 0 \\ 0 & \cos\phi} \cdot \m{1 & 0 \\ \f{\sin\phi}{\cos\phi} & 1} = \m{\f1{\cos\phi} & 0 \\ \sin\phi & \cos\phi}$$
and
\begin{align*}
H_x \cdot S \cdot H_y &= \m{1 & -\f{\sin\phi}{\cos\phi} \\ 0 & 1} \cdot \m{\f1{\cos\phi} & 0 \\ \sin\phi & \cos\phi}\\
&= \m{\f1{\cos\phi} - \f{\sin^2\phi}{\cos\phi} &-\sin\phi \\ \sin\phi & \+\cos\phi} &&= \m{\f{1-\sin^2\phi}{\cos\phi} &-\sin\phi \\ \sin\phi & \+\cos\phi} \\
&= \m{\f{\cos^2\phi}{\cos\phi} & -\sin\phi \\ \sin\phi & \+\cos\phi} &&= \m{\+\cos\phi & -\sin\phi \\ \+\sin\phi & \+\cos\phi} \quad\quad\blacksquare
\end{align*}

\exercise{Affine Spaces*}
\begin{enumerate}
\item \textbf{Claim:} $$p + 0 = p$$
      \textbf{Proof:}
\begin{align*}
p + 0 &\overset{(2)}= (q + V) + 0 &&\overset{(1)}= p + (V + 0)&&\\
&\overset{\textsf{dV}}= q + V &&\overset{(2)}= p &&\quad\quad\blacksquare
\end{align*}
\item In conformity with axiom 2 and $p,q \in P$, we set $q - p$ as the unique vector $v \in V$, such that $p + v = q$.\\\\
Using the Choice operator $C_V \in (V \to \mathbb{B}) \to V$,
$$-: \lambda p \in P.\ \lambda q \in P.\ C_V(\lambda v \in V.\ p + v \overset{\cdot}= q)$$
is an alternative, equivalent notation.
\end{enumerate}

\end{document}
