# File talk:Affine transformations.pdf

%%% affine_transformations.tex %%% \documentclass[a4paper,11pt]{article} \usepackage[utf8x]{inputenc} \usepackage{graphicx} \usepackage{type1cm} \usepackage{eso-pic} \usepackage{color} \usepackage{pstricks} \usepackage{amsmath, amssymb, textcomp, mathrsfs} \usepackage{boxdims} \usepackage{bbm} \usepackage{colortbl} \usepackage{fancyhdr} \usepackage[a4paper, left=2.5cm, right=2.5cm, top=2.5cm, bottom=5cm]{geometry} \usepackage{soul} \usepackage{multirow} \usepackage{listings} \usepackage{tensor} \usepackage{verbatim} \usepackage{wasysym} \usepackage{marvosym} \usepackage[pdftex, colorlinks=true]{hyperref}

\newtheorem{postulate}{Postulate}
\newtheorem{corollary}{Corollary}
\newtheorem{theorem}{Theorem}

\newenvironment{proof}[1][Proof]{\noindent{}\textbf{#1 } }{\ \rule{0.4em}{0.7em}\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following will put the MS-Word style table
% on the top of each page.
%
% You need to fill in the information for each new
% document / revision!
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{fancy}

\fancyhf{} \renewcommand{\headrulewidth}{0pt}

\lhead{\begin{tabular}{|p{0.26\linewidth}|p{0.17\linewidth}|p{0.17\linewidth}|p{0.11\linewidth}|p{0.19\linewidth}|}

\hline \multirow{4}{*}{\includegraphics[width=4cm]{pictures/GCI.png}}

&\multicolumn{4}{|l|}{\cellcolor[gray]{.8}{ }}\\ &\multicolumn{4}{|l|}{\cellcolor[gray]{.8}\Large{Google Code-In 2012--BRL-CAD:}}\\ &\multicolumn{4}{|l|}{\cellcolor[gray]{.8}\Large{Some Basic Affine Transformations}}\\ &\multicolumn{4}{|l|}{\cellcolor[gray]{.8}{ }}\\

\cline{2-5}

&Document No. &N/A &Author &Matt S.\\

\cline{2-5}

&Revision &0.1 &Date &Dec. 2012\\

\hline \end{tabular}}

\chead{} \rhead{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The NDA reminder is then inserted as a % persistent footnote as well. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\lfoot{}%{\tiny{Inser NDA as persistent footer here if required.}} \cfoot{} \rfoot{\thepage} \renewcommand{\footrulewidth}{0.4pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Rather than going to the trouble of creating a % new .cls file--which should be done--this hack is % inserted to satisfy the article.cls requirements. % Without it, the first page is a mess. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document} \thispagestyle{fancy} \section*{} \vspace{2cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Document control / revision history table. Do not % forget to update; check to make sure the file name % matches the rev. no; there should be a way to % automate this. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{tabular}{|p{0.18\linewidth}|p{0.18\linewidth}|p{0.18\linewidth}|p{0.39\linewidth}|} \hline \rowcolor[gray]{.8}\textbf{Rev.} &\textbf{Author} &\textbf{Date} &\textbf{Summary of Changes}\\ \hline 0.0 &Matt S. &01/12/2012 &Document created.\\ \hline 0.1 &Matt S. &08/12/2012 &Typos fixed.\\ \hline \end{tabular}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Start document here % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tableofcontents

\newpage

\section{Some Basic Affine Transformations} A lot more well-written information is available on the Internet, so I won't go into any real detail here. Instead, the interested reader may refer to \href{http://www.cis.upenn.edu/~cis610/geombchap2.pdf}{this primer}, among many others.\\

This article will simply provide formulae to accomplish specific tasks.

\subsection{Affine Translation of Points} Assume we have a collection of discreet points $\left\lbrace x_i \right\rbrace\subset\mathbbm{R}^3$ that we want to rigidly translate in such a way that a specific point $x_0$ is translated to the origin, thus preserving the relative placement of all points.\\

To do this, create a vector % \begin{equation*} b = \left[\begin{array}{c}

x^1\\ x^2\\ x^3\end{array}\right]

\end{equation*} % and then create the augmented matrix % \begin{equation*} A_T = \left[\begin{array}{cr}

I_3 &-b\\ 0 &1\end{array}\right]

\end{equation*} % so that for each $x_i$, we compute % \begin{equation*} \left[\begin{array}{c}

y_i\\ 1\end{array}\right] =

\left[\begin{array}{cr}

I_3 &-b\\ 0 &1\end{array}\right]

\left[\begin{array}{cr}

x_i\\ 1\end{array}\right]

\end{equation*} % where the $y_i$ represent the translated $x_i$.

\subsection{Affine Rotation About an Axis} The cheat that we have performed here is that by first translating all points of interest to the origin, we may now rotate about an axis to make all our points coincident to a Cartesian plane; let's say the $x^1 - x^2$ plane.\\

First, we take three points $\left\lbrace y_0, y_1, y_2 \right\rbrace\subseteq\left\lbrace y_i \right\rbrace$ and determine the normal via % \begin{equation*} n = y_1\times y_2 \end{equation*} % since $y_0 = 0$ now, thus allowing us treat the coordinates $y_1$ and $y_2$ as vector elements in the computation of $n$. This allows us to determine the angle $\varphi$ between $n$ and $y^3$ via % \begin{equation*} \cos\left( \varphi \right) = \frac{n\cdot y^3}{\left\|n\right\|} \end{equation*} % where we treat $y^3$ as a unit vector $\left(0,0,1\right)$. Then, compute a unit normal vector to the plane defined by $\text{span}\left(n,y^3\right)$ via % \begin{align} u =& n\times y^3\notag\\ \Rightarrow u_{\mu} =& \frac{1}{\left\| u \right\|} u \notag \end{align} % so that we may align $n$ and $y^3$ via the \href{http://en.wikipedia.org/wiki/Rotation_matrix}{rotation} % \begin{equation*} R = I_3 \cos\varphi +

\sin\varphi\left[u_{\mu}\right]_{\times} + \left(1-\cos\varphi\right)u_{\mu}\otimes u_{\mu}

\end{equation*} % where % \begin{align} \left[u_{\mu}\right]_{\times} =&

\left[\begin{array}{rrr} 0 &-u_{\mu}^3 &u_{\mu}^2\\ u_{\mu}^3 &0 &-u_{\mu}^1\\ -u_{\mu}^2 &u_{\mu}^1 &0\end{array}\right]\notag\\

u_{\mu}\otimes u_{\mu} =&

\left[\begin{array}{lll} \left( u_{\mu}^1 \right)^2 &u_{\mu}^1 u_{\mu}^2 &u_{\mu}^1 u_{\mu}^3\\ u_{\mu}^1 u_{\mu}^2 &\left( u_{\mu}^2 \right)^2 &u_{\mu}^2 u_{\mu}^3\\ u_{\mu}^1 u_{\mu}^3 &u_{\mu}^2 u_{\mu}^3 &\left( u_{\mu}^3 \right)^2 \end{array}\right]\notag

\end{align} % Finally, this allows us to then define an augmented (rotation) matrix % \begin{equation*} A_R = \left[\begin{array}{cl}

R &0\\ 0 &1\end{array}\right]

\end{equation*} % allowing us to rotate our collection of points $\left\lbrace y_i \right\rbrace$ into the $y^1-y^2$ plane via % \begin{equation*} \left[\begin{array}{c}

z_i\\ 1\end{array}\right] =

\left[\begin{array}{cr}

R &0\\ 0 &1\end{array}\right]

\left[\begin{array}{cr}

y_i\\ 1\end{array}\right]

\end{equation*} % and we may now very easily compute the area of the polygon defined by the points $z_i$ via Green's Theorem.

\end{document}

\begin{equation*} \left[\begin{array}{c}

y_i^1\\ y_i^2\\ y_i^3\\ 1\end{array}\right] =

\left[\begin{array}{cccc}

1 &0 &0 &-5\\ 0 &1 &0 &-6\\ 0 &0 &1 &8\\ 0 &0 &0 &1\end{array}\right]

\left[\begin{array}{c}

x_i^1\\ x_i^2\\ x_i^3\\ 1\end{array}\right]

\end{equation*}

\end{document}