There are many types of neural networks and each of them perform differently according to the task. Considering the low vocabulary of our task and the large amount of data, we'll be looking to search for patterns through the identification of templates with neural networks. Therefore, CNN comes immediately to mind. But many works suggests the use of recurrent neural networks. Therefore we'll focus on those two types of networks that seems to be the most promising. Finally, MLPs are usually mentionned but not for their performances, mostly because they are easy to implement and it's always a nice comparison.

\vspace{5mm}

Keyword spotting task are extremely fit to CNNs according to many research \cite{CNN}, \cite{init}. A DNN cannot take advantage of the topology of the signal, however CNNs are extremely good at acoustic modeling which permits to give a good representation of a speech spectrum. The differences of frequencies between each speaker and also the timing differences between each examples are known to be easily handled by CNNs.

\vspace{5mm}

RNNs and especially LSTMs are also fit to this task because of their ability to take into account time sequences through feedback connections. They also benefits from the combination of lstm layers with deep or convolutionnal layers \cite{graves}. But one of the main problem encountered with RNNs, is that they are slow for many reasons (no parrellelization, slow learning, ...). Therefore the trend is to move away from recurrent structures.

\section{MLP}

Neural networks are used to approximate functions which solving a non linear optimization problem that tries to find the minimum "distance" between the approximation and the real function. To do so, training algorithms try to find the set of weights that minimize the "distance" represented by the loss function.

\vspace{5mm}

MLPs are one of the most simple form yet usually reliable of neural networks. They are composed of one input layer, one output layer and at least one hidden layer. They are feed forward that means that the flow of information goes in only one direction : from input layer to output layer.

\section{CNN}
CNNs are an evolution of MLPs. Indeed, usually they have an MLP base that is situated at the end of the network but they also have some convolutions layers. the role of those convolution layers will be to split the input in order to find interesting information in a small subset of it. This will make CNN be able space dependecies in 2-d data. In addition of that, CNNs are usually more effective than MLPs in term of computation.

\section{LSTM}

LSTM structures (Long short term memory) are a chain like network where you gives the output of a block as an input of the next one. The idea being similar to recurrent neural networks, it's about creating an artificial memory of how inputs evoluate over time. It is extremely interesting for tasks with temporal dependencies such as speech recognition. The improvement over the RNN structures is the forget gate that allows to manipulate weights of recurrents connections in order to face the vanishing gradient problem. Therefore

\begin{figure}[h!]
    \centering
    \includegraphics[width=1\textwidth]{chapters/pictures/lstm_unit.png}
    \caption{Inside of a LSTM unit}
    \label{fig:mlp}
\end{figure}


\subsection{Superdom}

Superdom is a turn based strategy game, where the aim is to defeat the computer
player by overpowering them using your army.

When the game starts the player is given roughly 50% of the tiles on the map,
two farms, and two factories. To overpower the enemy, you must place resources
in adjacent tiles (diagonals do not count), such that your strength is greater
than the computers, then attack the square.

Each ``year'' is broken up into three phases: purchasing, movement, and war.
During the purchasing phase you are allocated money and food, may purchase
units/buildings, and may access the bank.

During the movement phase you can move your units only to adjacent squares
(except planes, which may move anywhere), at a cost of 1 move per unit you move.
(Men are considered to be one unit, no matter how many you move). You can change
the number of moves you receive by default in the settings, and you may purchase
additional moves for \$100 each. You may also launch nuclear weapons if you have
purchased any.

During the war phase you can attack the enemy. This is where the strengths come
into play. Each tile has its own strength for both the computer, and the human
player. If you attack a square owned by the computer player where your strength
is greater than the computer's, you will win the tile - and take control of any
building that were on it. If the strengths are equal, a victor is chosen at
random.

The bank (in the purchasing phase) is a place where you can store your money
and earn interest (usually about 10% p.a.), however, while the money is in the
bank, it is not accessible until the next purchasing phase.

\subsubsection{Notes on food}
Each year you are allocated an amount of food based on the number of farms you
control. Food is used to feed your men, but if you do not have enough food to
feed your population of men, some will die of starvation.

\subsubsection{Summary of units}
\begin{table}
    \begin{rbtabular}{\textwidth}{lccX}%
        {\textbf{Unit} & \textbf{Cost} & \textbf{Individual strength}%
         & \textbf{Special abilities}}{}{}
        Men       & \$1 each & 1.33 per 100 & No square population limit, however %
                                              require 1 food each per year\\
        Tanks     & \$300    & 3 & None\\
        Planes    & \$600    & 4 & Can move to any human controlled point on the map\\
        Farms     & \$1150   & 3 & Generates additional food at start of year\\
        Factories & \$1300   & 3 & Generates additional food at start of year\\
        Nukes     & \$2000   & 2 & During the movement phase you may lauch a nuke %
                                   to destroy all units on a given tile\\
    \end{rbtabular}
\end{table}
Also note that the colour of the adjacent tiles also count towards your strength.


\documentclass[a4paper]{article}

% Language and Font Encoding
\usepackage[english]{babel}
%\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{float}
\usepackage{caption}         % For captions
\usepackage{fancyhdr}        % For header and footer
\usepackage{rotating}
\usepackage{amssymb}
%\usepackage{varwidth}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

% Page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=1.75cm]{geometry}

% Useful Packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{amsthm}
%\usepackage{bbm}
\usepackage{siunitx}
\usepackage{cite}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\DeclareMathOperator*{\softmax}{softmax}

\newcommand{\squeezeup}{\vspace{-2.5mm}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}

\pagestyle{fancy}
\lhead{Appendix: Topology}
\rhead{}

\begin{document}

\title{Optimization on Manifolds, Appendix: Topology}
\author{Ibrahim Akbar}
\maketitle

\section{Definitions}
This serves as a light introduction into the topic of topology, but is not sufficient to have a complete or deep understanding. For further information, I suggest reading James Munkres' \textit{Topology} text for a thorough introduction.\\

\noindent Just as an n-dimensional vector space is an abstraction of $\mathbb{R}^{n}$, a topology on a set $X$ is an abstraction of open sets in $\mathbb{R}^{n}$.\\

\noindent A \textbf{topology} on a set $X$ is a collection $\mathcal{T}$ of open subsets of $X$ such that:

\begin{enumerate}
\item $X,\{0\}\in\mathcal{T}$
\item Given a subcollection $\mathcal{S}$ of $\mathcal{T}$, $\cup_{i}S_{i}\in\mathcal{T}$
\item Given a finite subcollection $\mathcal{S}$ of $\mathcal{T}$, $\cap_{i}S_{i}\in\mathcal{T}$
\end{enumerate}

\noindent Thus a topology is the couple $(X,\mathcal{T})$, but when notation allows it will be abbreviated to $X$. Currently, the definition for topology is not well-defined as we do not know what "open" means.\\

\noindent Let $X$ be a topological space. Let $A$ be a subset of $X$. A \textbf{neighborhood} of a point $x$ on $X$ is a subset $\mathcal{V}$ that includes an open set, $\mathcal{U}$ containing $x$.
$$
x\in\mathcal{U}\subset\mathcal{V}\subseteq X
$$

\noindent A \textbf{limit point} or \textbf{accumulation point} of a subset $A$ of $X$ is a point $x$ of $X$ such that every neighborhood of $x$ intersects $A$ in some point \textit{other than} $x$. Note that it is important to distinguish between intersecting at $x$ and somewhere else. If the restriction of intersecting at points other than were to be removed $x$ would be a \textbf{point of closure}. Thus every point of closure is a limit point but not necessarily every limit point is a point of closure.\\

\noindent A subset is \textbf{closed} if and only if it contains all it's limit points. An open set is naturally one that does not contain all it's limit points.\\

\noindent A sequence of points $\{x_{k}\}_{k=1,2,\ldots}$ of $X$ \textbf{converges} to a point $x\in X$ if for every neighborhood $\mathcal{U}$ of $x$ there exists a positive integer $K$ such that $x_{k}$ belongs to $\mathcal{U}$ for all $k\geq K$.\\

\noindent Since topology needs to satisfy relatively few axioms it is natural that properties that may hold for $\mathbb{R}^{n}$ may not hold for $X$. As an example a \textbf{singleton} which is a set containing only one element may not be closed in the topological sense. Take for example the topology of $[-1,1]$. The open sets are $[-1, a)$ for $a > 0$,$(b,a)$ for $a < 0, b > 0$, and  $(b, 1]$ for $b < 0$ \textit{(Why?)}. To avoid such situations \textbf{separation axioms} have been introduced to make a distinction between topologies.\\

\noindent A topological space $X$ is $T_{1}$; \textbf{accessible} or \textbf{Fr\'{e}chet}, if for any distinct points $x$ and $y$ of $X$ there is an open set containing $x$ and not $y$. (Every singleton is closed.)\\

\noindent A topological space $X$ is $T_{2}$, \textbf{Hausdorff}, if any two distinct points of $X$ have disjoint neighborhoods. A Hausdorff topology means that any sequence of points on $X$ converges to at most one point of $X$.\textit{(Why?)}\\

\noindent Let $\mathcal{T}_{1}$ and $\mathcal{T}_{2}$ be topological spaces of $X$. If $\mathcal{T}_{1}\subseteq\mathcal{T}_{2}$ then $\mathcal{T}_{2}$ is said to be \textbf{finer}.\\

\newpage
\noindent A \textbf{base} or \textbf{basis} for a topology on set $X$ is a collection $\mathcal{B}$ of subsets of $X$ such that
\begin{enumerate}
\item each $x\in X$ belongs to at least one element in $\mathcal{B}$
\item if $x\in(B_{1}\cap B_{2})$ with $B_{1},B_{2}\in\mathcal{B}$, then there exists $B_{3}\in\mathcal{B}$ such that $x\in B_{3}\subseteq B_{1}\cap B_{2}$.
\end{enumerate}

\noindent If $\mathcal{B}$ is a base for topology $\mathcal{T}$ then $\cup_{i}\mathcal{B} = \mathcal{T}$ and a topology is denoted as \textbf{second-countable} if it's base is finite.\\

\noindent If $X$ and $Y$ are topological spaces then the \textbf{product topology} $X\times Y$ has the base $\mathcal{B}$ which is the collection of all sets of the form $U\times V$ where $U$ is an open set of $X$ and $V$ is an open set of $Y$.\\

\noindent If $Y$ is a subset of a topological space $(X,\mathcal{T})$. Then $\mathcal{T}_{Y} = \{Y\cap U\mid U\in\mathcal{T}\}$ is a topology on $Y$ called the \textbf{subspace topology}.\\

\noindent A collection $\mathcal{A}$ of subsets of $X$ \textbf{cover} or is a \textbf{covering} of $X$ if the union of the elements of $\mathcal{A}$ is equal to $X$.\\

\noindent \textbf{Heine-Borel Theorem}: A subset of $\mathbb{R}^{n}$ with the subspace topology is compact if and only if it is closed and bounded.\\

\end{document}


\subsection{Affine coordinate systems}\label{subsec:affine_coordinate_system}

\begin{remark}\label{rem:affine_coordinate_system_concept}
  Most humans possess a strong intuition for visual information like drawings or diagrams. A paper or a painting is only a medium for communicating information and emotions. \Fullref{def:euclidean_plane/figures} contains some highlighted curves that our mind maps to abstract geometric figures, without considering the size limitations of the page, the precision of the drawings or the thickness of the lines.

  \begin{figure}[b]
    \centering
    \text{\todo{Add diagram}}\iffalse\begin{mplibcode}
      u := 1cm;

      beginfig(1);
      draw (0, -1) * u -- (3, 0) * u;
      draw (-1, 2) * u -- (3, 1) * u -- (1, 3) * u -- cycle;
      draw fullcircle scaled 1.5u shifted ((0, 0.5) * u);
      endfig;
    \end{mplibcode}\fi
    \caption{A triangle, a circle and a line in the Euclidean plane.}\label{def:euclidean_plane/figures}
  \end{figure}

  Our goal is to map these visualizations to the concept of vector spaces. Formalisms at the level of formal \hyperref[def:first_order_language]{logic} will not be stated because we only want to sketch some high-level concepts. We only give definitions that are strictly necessary, plane geometry itself is described in \fullref{subsec:analytic_geometry_in_the_plane}. We will proceed as follows:

  \begin{itemize}
    \item Define an affine plane in \fullref{def:affine_plane} with auxiliary definitions.
    \item Describe the Euclidean plane \( A_2 \) in \fullref{def:euclidean_plane} as a very special affine plane.
    \item Give additional definitions for the Euclidean plane in \fullref{def:euclidean_plane_auxiliary_definitions}.
    \item Define the set \( F_2 \) of free vectors over \( A_2 \) in \fullref{def:euclidean_plane_free_vector}.
    \item Show that \( F_2 \) is a two-dimensional vector space over \( \BbbR \) in \fullref{thm:euclidean_plane_factorization}.
    \item Define coordinate systems that give explicit isomorphisms between \( A_2 \), \( F_2 \) and \( \BbbR^2 \) in \fullref{def:euclidean_plane_coordinate_system}.
    \item Generalize these notions in \fullref{rem:coordinate_systems}
  \end{itemize}
\end{remark}

\begin{definition}\label{def:affine_plane}\mcite[1]{Hartshorne1967}
  An \term{affine plane} consists of
  \begin{itemize}
    \item a set \( X \), whose elements are called \term{points},
    \item a family of subsets of \( X \), whose members are called \term{lines}
  \end{itemize}
  with the additional relations
  \begin{itemize}
    \item a \term{parallel} relation \( l \parallel g \) for lines that holds if either \( l = g \) or if they have no points in common,
    \item a \term{collinearity} relation for a set \( B \) of points that holds if \( B \) is a subset of some line,
  \end{itemize}
  such that
  \begin{thmenum}
    \thmitem[def:affine_plane/A1]{A1} Given two distinct points, there exists only one line that contains both.
    \thmitem[def:affine_plane/A2]{A2} Given a line \( l \) and a point \( P \not\in l \), there exists exactly one line \( g \parallel l \) that contains \( P \).
    \thmitem[def:affine_plane/A3]{A3} There exist three non-collinear points.
  \end{thmenum}
\end{definition}

\begin{definition}\label{def:euclidean_plane}
  The \term{Euclidean plane} \( A_2 \) is a formalization of a straight infinite surface. An axiomatic definition can be found in \cite{nLab:euclidean_geometry}. We will use that
  \begin{itemize}
    \item The Euclidean plane \( A_2 \) is an \hyperref[def:affine_plane]{affine plane}
    \item \( A_2 \) is a \hyperref[def:complete_metric_space]{complete metric space} with distance \( \op{dist} \).
    \item There is a \term{betweenness} relation for points that says if the point \( R \) is \term{between} \( P \) and \( Q \).
  \end{itemize}

  \begin{figure}
    \centering
    \text{\todo{Add diagram}}\iffalse\begin{mplibcode}
      input metapost/plotting;

      u := 1.5cm;

      beginfig(1);
      path l, g, h, P, Q, R;
      l = (0, -1) * u -- (3, 0) * u;
      draw l;
      label.top("$l$", midpoint of l);

      g = (0, -2) * u -- (3, -1) * u;
      draw g;
      label.bot("$g$", midpoint of g);

      h = (0, 0) * u -- (3, -2) * u;
      draw h;
      label.urt("$h$", midpoint of h);

      P = dot shifted point 0.2 of h;
      fill P;
      label.llft("$P$", midpoint of P);

      Q = dot shifted point 0.8 of h;
      fill Q;
      label.llft("$Q$", midpoint of Q);

      R = dot shifted point 0.4 of h;
      fill R;
      label.llft("$R$", midpoint of R);
      endfig;
    \end{mplibcode}\fi
    \caption{Three lines and three points in the Euclidean plane. The lines \( l \) and \( g \) are collinear, while the point \( R \) is between \( P \) and \( Q \)}\label{def:affine_plane/figure}
  \end{figure}
\end{definition}

\begin{definition}\label{def:euclidean_plane_auxiliary_definitions}
  We will also need the following definitions:
  \begin{thmenum}
    \thmitem{def:affine_plane/half_plane} Every line \( l \) gives rise to two (closed) \term{half-planes} \( H^+ \) and \( H^- \) as follows:
    \begin{itemize}
      \item \( H^+ \cap H^- = l \)
      \item \( H^+ \cup H^- = A_2 \)
      \item If \( P \in H^+ \setminus l \) and \( Q \in H^- \setminus l \), then there is a point \( R \in l \) between \( P \) and \( Q \)
    \end{itemize}

    Note that the superscripts \( + \) and \( - \) are only for distinguishing between the two half-planes and are not assigned based on some property of the half-planes. See \fullref{def:half_space} for a definition of a half-plane that actually has a concept of signs.

    \begin{figure}
      \centering
      \text{\todo{Add diagram}}\iffalse\begin{mplibcode}
        input metapost/plotting;

        u := 1cm;

        beginfig(1);
        input hatching;

        path l, Hp, Hm;
        l = (0, -1) * u -- (3, 0) * u;
        draw l;

        Hp = l -- (3, 0.5) * u -- (0, 0.5) * u -- cycle;
        hatchfill Hp withcolor (45, 1mm, -.5bp);
        label.ulft("$H^+$", startpoint of l);

        Hm = l -- (3, -1.5) * u -- (0, -1.5) * u -- cycle;
        hatchfill Hm withcolor (135, 1mm, -.5bp);
        label.lrt("$H^-$", endpoint of l);
        endfig;
      \end{mplibcode}\fi

      \caption{Differently hatched half-planes in the Euclidean plane.}\label{def:affine_plane/bound_vector/half_plane}
    \end{figure}

    \thmitem{def:affine_plane/ray} Every line \( l \) and every point \( R \) give rise to two (closed) \term{rays} \( l^+ \) and \( l^- \) as follows:
    \begin{itemize}
      \item \( l^+ \cap l^- = \{ R \} \) are disjoint
      \item \( l^+ \cup l^- = l \)
      \item If \( P \in l^+ \setminus \{ R \} \) and \( Q \in l^- \setminus \{ R \} \), then \( R \) is between \( P \) and \( Q \)
    \end{itemize}

    The rays \( l^+ \) and \( l^- \) are called \term{opposite} of each other.

    We say that \( R \) is the \term{vertex} of \( l^+ \) and \( l^- \).

    See \fullref{def:geometric_ray} for a definition of a ray that actually has a concept of signs.

    \begin{figure}
      \centering
      \text{\todo{Add diagram}}\iffalse\begin{mplibcode}
        input metapost/plotting;

        u := 1cm;

        beginfig(1);
        path l, R;

        l = (0, -1) * u -- (3, 0) * u;
        drawdblarrow l;
        label.lft("$l^-$", startpoint of l);
        label.rt("$l^+$", endpoint of l);

        R = dot shifted midpoint of l;
        fill R;
        label.bot("$R$", midpoint of R);
        endfig;
      \end{mplibcode}\fi

      \caption{Opposite rays in the Euclidean plane.}\label{def:affine_plane/day/figure}
    \end{figure}

    \thmitem{def:affine_plane/rays_unidirectional} Two rays are said to be \term{unidirectional} if there exists a line distinct from the lines containing the rays, such that both rays are contained in the same half-plane with respect to the line.

    \thmitem{def:affine_plane/bound_vector} An ordered pair \( \vect{PQ} \) of points is called a \term{bound vector}. The point \( P \) is called the \term{beginning} of \( \vect{PQ} \) and \( Q \) is called the \term{end} of \( \vect{PQ} \).

    \begin{figure}
      \centering
      \text{\todo{Add diagram}}\iffalse\begin{mplibcode}
        input metapost/plotting;

        u := 0.75cm;

        beginfig(1);
        path P, Q, R, PQ, PR;

        PQ = (0, -1) * u -- (3, 0) * u;
        drawarrow PQ;
        label.bot("$\vect{PQ}$", midpoint of PQ);

        P = dot shifted startpoint of PQ;
        fill P;
        label.bot("$P$", midpoint of P);

        Q = dot shifted endpoint of PQ;
        label.bot("$Q$", midpoint of Q);

        PR = (0, -1) * u -- (-2, 0.5) * u;
        drawarrow PR;
        label.llft("$\vect{PR}$", midpoint of PR);

        R = dot shifted endpoint of PR;
        label.llft("$R$", midpoint of R);
        endfig;
      \end{mplibcode}\fi

      \caption{Bound vectors in the Euclidean plane can be regarded as oriented line segment.}\label{def:affine_plane/bound_vector/figure}
    \end{figure}
  \end{thmenum}
\end{definition}

\begin{definition}\label{def:euclidean_plane_free_vector}
  We say that the bound vectors \( \vect{P_1 Q_1} \) and \( \vect{P_2 Q_2} \) in \( A_2 \) are \term{congruent} if \( \op{dist}(P_1, Q_1) = \op{dist}(P_2, Q_2) \) and if the rays \( r_i, i = 1, 2 \) beginning at \( P_i \) and containing \( Q_i \), are unidirectional.

  We define \term{free vectors} as \hyperref[thm:equivalence_partition]{equivalence classes} of bound vectors by this congruence relation. We denote the corresponding equivalence partition by \( F_2 \).
\end{definition}

\begin{theorem}\label{thm:euclidean_plane_factorization}
  The set \( F_2 \) of free vectors over \( A_2 \) is a two-dimensional \hyperref[def:vector_space]{vector space} over \( \BbbR \) with the following operations:
  \begin{thmenum}
    \thmitem{thm:euclidean_plane_factorization/sum} We define the \term{sum} of the cosets \( [\vect{PQ}] \) and \( [\vect{QR}] \) as the coset \( [\vect{PR}] \).

    \thmitem{thm:euclidean_plane_factorization/scalar_product} We define the \term{scalar multiplication} of \( \lambda \in \BbbR \) with the coset \( [\vect{PQ}] \) to be the coset \( [\vect{PR}] \), where \( \vect{PR} \) is the unique vector that is unidirectional with \( \vect{PQ} \) and \( \op{dist}(P, R) = \lambda \op{dist}(P, Q) \).
  \end{thmenum}
\end{theorem}
\begin{proof}
  Proving the well-definedness of the operations and verifying that \( F_2 \) is a two-dimensional vector space requires a lot of work and the proof is skipped.
\end{proof}

\begin{definition}\label{def:euclidean_plane_coordinate_system}
  Just because \fullref{thm:euclidean_plane_factorization} states that the set \( F_2 \) of free vectors is a vector space does not mean that we can work with it as with \( \BbbR^2 \). \Fullref{thm:finite_dimensional_spaces_are_isomorphic} says that \( F_2 \) is isomorphic to \( \BbbR^2 \), however the proof requires the \hyperref[def:zfc/choice]{axiom of choice}. The concrete way to select a basis in \( F_2 \) is through coordinate systems.

  Somewhat confusingly, we define coordinate systems over \( A_2 \) rather than over \( F_2 \), but this will, soon be justified.

  A \term{coordinate system} \( Oxy \) in \( A_2 \) is a choice of
  \begin{thmenum}
    \thmitem{def:euclidean_plane_coordinate_system/origin} A point \( O \in A_2 \), called the \term{origin} of the coordinate system.
    \thmitem{def:euclidean_plane_coordinate_system/basis} An \hyperref[def:partially_ordered_set]{ordered} \hyperref[def:hamel_basis]{basis} \( (x, y) \) of \( F_2 \), called the \term{basis} of \( Oxy \).
  \end{thmenum}

  What we achieve through the choice of \( O \) is that, for each point \( P \in A_2 \), we select the bound vector \( \vect{OP} \in V_2 \), called the \term{radius vector} of \( P \). This injects \( A_2 \) into \( V_2 \), however if we take the free vector \( [\vect{OP}] \), we instead obtain a bijection between \( A_2 \) and \( F_2 \).

  Now that we have a correspondence between \( A_2 \) and \( F_2 \), coordinates for the point \( P \) are defined simply as the \hyperref[def:module_basis_projection]{coordinates} of \( [\vect{OP}] \) with respect to the basis \( (x, y) \).

  Thus, the pair \( (A_2, Oxy) \) has an explicit isomorphism with \( \BbbR^2 \).

  The \term{coordinate axis} of \( x \) is the unique \hyperref[def:affine_plane/ray]{ray} starting at \( O \) and containing the end of \( x \). It is called the \term{abscissa}. The coordinate axis of \( y \) is called the \term{ordinate}.
\end{definition}

\begin{remark}\label{rem:coordinate_systems}
  We sketched how to embed mental images of planes into \( \BbbR^2 \), however in mathematics we are often interested in the opposite: given a set of points in \( \BbbR^2 \), visualize them on a screen or paper and then absorb the the resulting image in our brain.

  This is one of the most powerful constructions in mathematics, yet it is, so intuitive that it is not really given a lot of attention, at least until generalizations are required. Given any vector space \( V \) in the sense of \fullref{def:vector_space}, we want a way to assign a pair of numbers to each vector in \( V \). This is only possible if \( \dim V = 2 \), however we can generalize this to tuples of coordinates via bases - see \fullref{def:hamel_basis}. This well for finitely dimensional vector spaces, however we need to generalize these notion for infinitely dimensional vector spaces and general modules over \hyperref[def:module]{rings}. This allows us to generalize coordinates further to manifolds - see \fullref{def:topological_manifold}.

  See \fullref{subsec:vector_space_geometry} for immediate generalizations of the concepts introduced here.
\end{remark}


\subsection{Gradient computation, case of NewtonEuler with quaternion}

In the section, $q$ is the quaternion of the dynamical system.

\begin{figure}[h]
  \centering

  %\input{./Figures/NewtonEulerImpact.pstex_t}
  \input{./Figures/NewtonEulerImpact.pdf_t}

  \caption{Impact of one DS.}
  \label{figCase}
\end{figure}

The normal vector $N$ is view as a constant.
\[~\tilde h(q)=P_c(\frac{q}{\|q\|})\]
\[^t \nabla h(q)(\delta q) = \lim _{e \to 0}\frac{(\tilde h (q+e\delta q)-\tilde h (q)).N}{e}  \]

$\nabla _q h$ consist in computing $P_c(\frac{q+\delta q}{\|q+\delta q\|})-P_c(q)$.
\[GP(q)=qG_0P_0~^cq\]
\[GP(\frac{q+\delta q}{\|q+\delta q\|})=(q+\delta q)G_0P_0~^c(q+\delta q)\frac{1}{\|q+\delta q\|^2}\]
\[=(q+\delta q)~^cqGP(q)q~^c(q+\delta q)\frac{1}{\|q+\delta q\|^2}\]
\[=((1,0,0,0)+\delta q~^cq)GP(q)((1,0,0,0)+q~^c\delta q)\frac{1}{\|q+\delta q\|^2}\]
\[=GP(q)+\delta q~^cqGP(q) + GP(q)q~^c\delta q+0(\delta q)^2\frac{1}{\|q+\delta q\|^2}\]
So, because G is independant of $q$:
\[P(\frac{q+\delta q}{\|q+\delta q\|})-P(q)=qGP(\frac{q+\delta q}{\|q+\delta q\|})-GP(q)=\delta q~^cqGP(q) + GP(q)q~^c\delta q+0(\delta q)^2 + GP(q)\frac{1}{\|q+\delta q\|^2}\]
For the directional derivation, we chose $\delta q = \epsilon * (1,0,0,0)$. using a equivalent to $\frac{1}{1+\epsilon}$
\[\lim_{\epsilon \to 0}\frac{P(\frac{q+\delta q}{\|q+\delta q\|})-P(q)}{\epsilon}=~^cqGP(q) + GP(q)q-2q_iGP(q)\]
For the directional derivation, we chose $\delta q = \epsilon * (0,1,0,0)=\epsilon * e_i$
\[\lim_{\epsilon \to 0}\frac{P(\frac{q+\delta q}{\|q+\delta q\|})-P(q)}{\epsilon}=e_i~^cqGP(q) - GP(q)qe_i-2q_iGP(q)\]
Application to the NewtonEulerRImpact:
\[H:\mathbb{R}^7 \to \mathbb{R}\]
\[\nabla _q H \in \mathcal{M}^{1,7}\]
\[\nabla _q H =\left(\begin{array}{c} N_x\\N_y\\N_z\\
(~^cqGP(q) + GP(q)q-2q_0GP(q)).N\\
(e_2~^cqGP(q) - GP(q)qe_2-2q_1GP(q)).N\\
(e_3~^cqGP(q) - GP(q)qe_3-2q_2GP(q)).N\\
(e_4~^cqGP(q) - GP(q)qe_4-2q_3GP(q)).N\\
\end{array}\right)\]
\subsection{Ball case}
It is the case where $GP=-N$:
for $e2$:
\[(0,1,0,0).(q_0,-\underline p).(0,-N)=\]
\[\left(\left(\begin{array}{c}1\\0\\0\end{array}\right).\underline p,\left(\begin{array}{c}q_0\\0\\0\end{array}\right) -\left(\begin{array}{c}1\\0\\0\end{array}\right)*\underline p \right).(0,-N)=\]
\[\left(?, -\underline p_x~N-\left(\left(\begin{array}{c}q_0\\0\\0\end{array}\right)- \left(\begin{array}{c}1\\0\\0\end{array}\right)*\underline p \right)*N\right)=\]
and:
\[(0,-N).(q_0,\underline p).(0,1,0,0)=\]
\[(N.\underline p,-q_0N-N*\underline p).(0,1,0,0)=\]
\[\left(?,(N.\underline p)\left(\begin{array}{c}1\\0\\0\end{array}\right) + \left(\begin{array}{c}1\\0\\0\end{array}\right)*(q_0N+N*\underline p)\right)=\]
\[\left(?,(N.\underline p)\left(\begin{array}{c}1\\0\\0\end{array}\right)+q_0 \left(\begin{array}{c}1\\0\\0\end{array}\right)*N+\left(\begin{array}{c}1\\0\\0\end{array}\right)*(N*\underline p)\right)\]
sub then and get the resulting vector.N:
\[\left[ -\underline p_x~N -N.\underline p~\left(\begin{array}{c}1\\0\\0\end{array}\right)+()*N-\left(\begin{array}{c}1\\0\\0\end{array}\right)*(N*\underline p)\right].N=\]
\[-\underline p_x-N_xN.\underline p+0-(\left(\begin{array}{c}1\\0\\0\end{array}\right)*(N*\underline p)).N=\]
  using $a*(b*c)=b(a.c)-c(a.b)$ leads to
  \[-q_1-N_xN.\underline p-(q_1~N-N_x~\underline p).N=\]
\[-q_1-N_xN.\underline p-q_1+N_xN.\underline p=-2q_1\]
for $e1=(1,0,0,0)$:
\[(q_0,-\underline p).(0,-N)=(?,-q_0N+\underline p*N)\]
\[(0,-N).(q_0,\underline p)=(?,-q_0N-\underline p*N)\]
So
\[\nabla _q H =\left(\begin{array}{c} N_x\\N_y\\N_z\\
0\\
0\\
0\\
0\\
\end{array}\right)\]

\subsection{Case FC3D: using the local frame and momentum}

\[\left(\begin{array}{c}m \dot V\\I \dot \Omega + \Omega I \Omega \end{array}\right)= \left(\begin{array}{c}Fect+R\\Mext _{R_{obj}} + (R*PG) _{R_{obj}} \end{array}\right)\]
  with * vectoriel product, $R$ reaction in the globla frame. $P$ the point of contact.
  $r$ is the reaction in the local frame.  $M_{R_{obj}toR_{abs}}=M_{R_{abs}toR_{obj}}^t r=R$ with:
  \[M_{R_{C}toR_{abs}}=\left(\begin{array}{ccc} nx&t_1x&t_2x \\ny&t_1y&t_2y\\nz&t_1z&t_2z \end{array}\right)\]
  we have :
  \[\left(\begin{array}{c}R\\(R*PG) _{R_{obj}}\end{array}\right)=\left(\begin{array}{c} I_3\\M_{R_{abs}toR_{obj}}N_{PG}\end{array}\right).R\]
  \[=\left(\begin{array}{c} I_3\\M_{R_{abs}toR_{obj}}N_{PG}\end{array}\right).M_{R_{obj}toR_{abs}}r\]
  \[ N_{PG}=\left(\begin{array}{ccc} 0&PG_z&-PG_y\\-PG_z&0&PG_x\\PG_y&-PG_X&0\end{array}\right)\]
    that is:

\[\left(\begin{array}{c}m \dot V\\I \dot \Omega + \Omega I \Omega \end{array}\right)=
\left(\begin{array}{c} M_{R_{C}toR_{abs}} \\
  M_{R_{abs}toR_{obj}}N_{PG}M_{R_{C}toR_{abs}}
\end{array}\right) r\]
So $jachqt=MN$

\subsection{Case FC3D: using the local frame local velocities}
\begin{figure}[h!]
  \centering
   \scalebox{0.6}{
  \input{./Figures/SolideContact.pdf_t}
  %   \input{./Figures/SolideContact.pdf_t}
  }
  \caption{Two objects colliding.}
  \label{figCase}
\end{figure}

We are looking for an operator named $CT$ such that:

\[V_C=\left(\begin{array}{c} V_N \\ V_T \\ V_S \end{array}\right)_{R_{C}}=CT \left(\begin{array}{c} V_{G1}~_{R_{abs}} \\ \Omega_1~_{R_{obj1}} \\ V_{G2}~_{R_{abs}}\\ \Omega_2~_{R_{obj2}} \end{array}\right)\]

\[V_c=V_{G1}~_{R_{abs}} + w_1 * G_1P~_{R_{abs}} -(V_{G2}~_{R_{abs}} + w_2 * G_1P~_{R_{abs}})\]
where $w_1$ and $w_2$ are given in $R_{abs}$. We note $M_{R_{obj1}toR_{abs}}$ the matrice converting the object 1 coordinate to the absolute coordinate. We note $N_{GP}$ the matrice such that $w_1*G_1P~_{R_{abs}} = N_{GC} w_1$. Endly, we note $M_{R_{abs}toR_C}$ converting the absolute coordinate to the $R_C$ frame.
we get:
\[CT= M_{R_{abs}toR_C}   \left(\begin{array}{cccc} I_3 & N_{G_1C}M_{R_{obj1}toR_{abs}} & -I_3 & -N_{G_2C}M_{R_{obj2}toR_{abs}} \end{array}\right)\]

\subsubsection{Expression of $M_{R_{obj1}toR_{abs}}$}
Using quaternion, we get :
\begin{equation}
  \label{eq:newton_Mobjtoabs}
M_{R_{obj1}toR_{abs}} = \left(\begin{array}{ccc} q \left(\begin{array}{c}1\\0\\0 \end{array}\right)~^cq & q \left(\begin{array}{c}  0\\1\\0 \end{array}\right)~ ^cq & q \left(\begin{array}{c}  0\\0\\1 \end{array}\right)~ ^cq  \end{array}\right)
\end{equation}

\subsubsection{Expression of $N_1$}
\[N_{GC}=\left(\begin{array}{ccc} 0&G_1C_z&-G_1C_y\\-G_1C_z&0&G_1C_x\\G_1C_y&-G_1C_X&0\end{array}\right)\]

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "DevNotes"
%%% End:


\documentclass[11pt]{article}
\usepackage{fullpage}
\usepackage{amsmath, amssymb, bigints, graphicx}

\title{Classical Lamination Theory \\
      { \normalsize ~ \\ A note in support of \textit{Fiber Orientation Tools} \\
       \texttt{http://github.com/charlestucker3/Fiber-Orientation-Tools}}}

\author{Charles L.~Tucker III \\
       Department of Mechanical Science and Engineering \\
        University of Illinois at Urbana-Champaign \\
        1206 W.~Green St. \\
        Urbana, IL 61801 \\
        }
\include{defs}  % Macro definitions

\begin{document}
\maketitle

The function \texttt{Clayer2laminate} in \emph{Fiber Orientation Tools} uses classical lamination theory to find the stiffness properties of a composite where the fiber orientation, fiber volume fraction, and/or the fiber length distribution vary across the thickness.  Such structures are typical for injection molded composites.

This note explains the nomenclature used by \texttt{Clayer2laminate} and summarizes the underlying theory.  We develop the laminate properties in a notation  that is common in the structural mechanics of laminated composite materials\footnote{E.g., R. M. Jones, \emph{Mechanics of Composite Materials}. Taylor \& Francis, Philadelphia, 2nd edition, 1999.}.  Equation numbers with a period, e.g., Eqn.~(8.2), and section numbers refer to items from \emph{Fundamentals of Fiber Orientation}, C. L. Tucker, Hanser, Munich, 2022.

\subsection*{Coordinate System}

In the language of laminated composites, a \emph{laminate} is a plate-like structure consisting of multiple discrete layers, or \emph{lamina}, bonded together.  Choose $(x,y,z)$ coordinates so that $z = 0$ is the midplane of the laminate, and let the total thickness of the laminate be $H$.

\subsection*{Strains and Curvatures}

Let the components of the displacement vector be $(u, v, w)$.  The components of the strain tensor follow from the usual definitions, e.g., Eqns.~(8.2) and (8.3):
\begin{equation}
   \varepsilon_{xx} = \frac{\partial u}{\partial x}   \qquad  \qquad
   \varepsilon_{yy} = \frac{\partial v}{\partial y}   \qquad  \qquad
   \gamma_{xy} = \frac{\partial u}{\partial y} + \frac{\partial v}{\partial x}
   \label{epsilonDef}
\end{equation}
Note that we are using engineering shear strain here, rather than tensor shear strain.

Let $w_0$ be the $z$-direction displacement of the laminate midplane, $z = 0$.  The midplane curvatures of the laminate are then described by the second derivatives of $w_0$:
\begin{equation}
   \kappa_{xx} = -\frac{\partial^2 w_0}{\partial x^2}   \qquad  \qquad
   \kappa_{yy} = -\frac{\partial^2 w_0}{\partial y^2}   \qquad  \qquad
   \kappa_{xy} = -2\frac{\partial ^2 w_0}{\partial x \partial y}
   \label{kappaDef}
\end{equation}
The inclusion of a factor of 2 in $\kappa_{xy}$ is common, and parallels the use of the engineering shear strain.  These two choices are a departure from the notation in \emph{Fundamentals of Fiber Orientation}, where all tensors are contracted using a consistent procedure, but they are standard in laminate analysis.

\subsection*{Lamina Stress-Strain Equations}

The next task is to find the stress-strain relationships for a lamina in plane stress.  In our case we know (or can calculate) the 3-D stiffness tensor $\Cfour$ for each lamina, so we will start with that.  Using $[\Cfour]$ to represent the $6 \times 6$ matrix that is the contracted form of this tensor, the lamina stress-strain equation is
\begin{equation}
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\  \sigma_{zz} \\  \sigma_{yz} \\ \sigma_{zx} \\  \sigma_{xy}
           \end{array} \right\}
           =
              \left[ \begin{array}{cccccc}
     \Cfour_{11} &  \Cfour_{12} &  \Cfour_{13} &  \Cfour_{14} &  \Cfour_{15} &  \Cfour_{16} \\
     \Cfour_{21} &  \Cfour_{22} &  \Cfour_{23} &  \Cfour_{24} &  \Cfour_{25} &  \Cfour_{26} \\
     \Cfour_{31} &  \Cfour_{32} &  \Cfour_{33} &  \Cfour_{34} &  \Cfour_{35} &  \Cfour_{36} \\
     \Cfour_{41} &  \Cfour_{42} &  \Cfour_{43} &  \Cfour_{44} &  \Cfour_{45} &  \Cfour_{46} \\
     \Cfour_{51} &  \Cfour_{52} &  \Cfour_{53} &  \Cfour_{54} &  \Cfour_{55} &  \Cfour_{56} \\
     \Cfour_{61} &  \Cfour_{62} &  \Cfour_{63} &  \Cfour_{64} &  \Cfour_{65} &  \Cfour_{66}
    \end{array} \right]
        \left\{ \begin{array}{c}
           \varepsilon_{xx}  \\  \varepsilon_{yy}  \\  \varepsilon_{zz} \\  \gamma_{yz} \\ \gamma_{zx} \\  \gamma_{xy}
           \end{array} \right\}
     \label{stiffnessC}
 \end{equation}

The laminate is assumed to be thin relative to its in-plane dimensions, so each lamina is in a state of \emph{plane stress}:  $\sigma_{zz} = \sigma_{xz} = \sigma_{yz} = 0$.  We would like to specialize Eqn.~(\ref{stiffnessC}) for plane stress.  To do this, take the matrix inverse of $[ \Cfour ]$ to find $[ \tilde{\Sfour} ] = [ \Cfour ]^{-1}$.  In many books $[ \tilde{\Sfour} ]$  is called the compliance matrix.  This converts Eqn.~(\ref{stiffnessC}) to a strain-stress relationship:
\begin{equation}
        \left\{ \begin{array}{c}
           \varepsilon_{xx}  \\  \varepsilon_{yy}  \\  \varepsilon_{zz} \\  \gamma_{yz} \\ \gamma_{zx} \\  \gamma_{xy}
           \end{array} \right\}
           =
              \left[ \begin{array}{cccccc}
     \tilde{\Sfour}_{11} &  \tilde{\Sfour}_{12} &  \tilde{\Sfour}_{13} &  \tilde{\Sfour}_{14} &  \tilde{\Sfour}_{15} &  \tilde{\Sfour}_{16} \\
     \tilde{\Sfour}_{21} &  \tilde{\Sfour}_{22} &  \tilde{\Sfour}_{23} &  \tilde{\Sfour}_{24} &  \tilde{\Sfour}_{25} &  \tilde{\Sfour}_{26} \\
     \tilde{\Sfour}_{31} &  \tilde{\Sfour}_{32} &  \tilde{\Sfour}_{33} &  \tilde{\Sfour}_{34} &  \tilde{\Sfour}_{35} &  \tilde{\Sfour}_{36} \\
     \tilde{\Sfour}_{41} &  \tilde{\Sfour}_{42} &  \tilde{\Sfour}_{43} &  \tilde{\Sfour}_{44} &  \tilde{\Sfour}_{45} &  \tilde{\Sfour}_{46} \\
     \tilde{\Sfour}_{51} &  \tilde{\Sfour}_{52} &  \tilde{\Sfour}_{53} &  \tilde{\Sfour}_{54} &  \tilde{\Sfour}_{55} &  \tilde{\Sfour}_{56} \\
     \tilde{\Sfour}_{61} &  \tilde{\Sfour}_{62} &  \tilde{\Sfour}_{63} &  \tilde{\Sfour}_{64} &  \tilde{\Sfour}_{65} &  \tilde{\Sfour}_{66}
    \end{array} \right]
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\  \sigma_{zz} \\  \sigma_{yz} \\ \sigma_{zx} \\  \sigma_{xy}
           \end{array} \right\}
     \label{3Dcompliance}
 \end{equation}
Now we can write the in-plane strains as functions of the in-plane stresses by selecting the first, second, and sixth lines of Eqn.~(\ref{3Dcompliance}) and setting $\sigma_{zz}$, $\sigma_{xz}$, and $\sigma_{yz}$ to zero:
\begin{equation}
        \left\{ \begin{array}{c}
           \varepsilon_{xx}  \\  \varepsilon_{yy}  \\  \gamma_{xy}
           \end{array} \right\}
           =
              \left[ \begin{array}{ccc}
     \tilde{\Sfour}_{11} &  \tilde{\Sfour}_{12} &   \tilde{\Sfour}_{16} \\
     \tilde{\Sfour}_{21} &  \tilde{\Sfour}_{22} &   \tilde{\Sfour}_{26} \\
     \tilde{\Sfour}_{61} &  \tilde{\Sfour}_{62} &   \tilde{\Sfour}_{66}
    \end{array} \right]
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\   \sigma_{xy}
           \end{array} \right\}
     \label{2Dcompliance}
 \end{equation}
 This matrix simply uses selected components from the full $[ \tilde{\Sfour} ]$ matrix.

 To obtain stress-strain relationships we invert the matrix in Eqn.~(\ref{2Dcompliance}) to find the \emph{plane-stress lamina stiffness matrix} $[Q]$,
 \begin{equation}
   \left[ \begin{array}{ccc}
     Q_{11} &  Q_{12} &   Q_{16} \\
     Q_{21} &  Q_{22} &   Q_{26} \\
     Q_{61} &  Q_{62} &   Q_{66}
    \end{array} \right]
    =
              \left[ \begin{array}{ccc}
     \tilde{\Sfour}_{11} &  \tilde{\Sfour}_{12} &   \tilde{\Sfour}_{16} \\
     \tilde{\Sfour}_{21} &  \tilde{\Sfour}_{22} &   \tilde{\Sfour}_{26} \\
     \tilde{\Sfour}_{61} &  \tilde{\Sfour}_{62} &   \tilde{\Sfour}_{66}
    \end{array} \right]  ^{-1}
    \label{Qdef}
 \end{equation}
 Now the lamina stress-strain relationship for plane stress is
 \begin{equation}
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\   \sigma_{xy}
           \end{array} \right\}
           =
              \left[ \begin{array}{ccc}
     Q_{11} &  Q_{12} &   Q_{16} \\
     Q_{21} &  Q_{22} &   Q_{26} \\
     Q_{61} &  Q_{62} &   Q_{66}
    \end{array} \right]
        \left\{ \begin{array}{c}
           \varepsilon_{xx}  \\  \varepsilon_{yy}  \\  \gamma_{xy}
           \end{array} \right\}
     \label{laminaQ}
 \end{equation}
This numbering of the entries in $[Q]$ is standard.

This route to obtain $[Q]$ is different from the ones usually used in books on composite mechanics, but it starts from the lamina information that is available when analyzing discontinuous fiber composites, which is the lamina stiffness tensor $\mathbf{\Cfour}$.  In practice all of these calculations are carried out numerically.

\subsection*{Laminate Loads and Moments}

The standard way to describe the in-plane loads in a laminate is to define a vector of forces per unit width $\{ N \}$ whose components are
\begin{equation}
   \left\{ \begin{array}{c}
     N_x \\ N_y \\ N_{xy}
   \end{array} \right\}
   = \bigintss_{-H/2}^{H/2}
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\   \sigma_{xy}
           \end{array} \right\}
      \ud z
  \label{Ndef}
\end{equation}
Figure~\ref{Nfig} sketches these loads.
Note that $N_x$ is the $x$-direction force per unit width in the $y$ direction, acting on the entire thickness of the laminate.  The stress $\sigma_{xx}$ will vary across the laminate thickness because the stiffness varies with $z$, and possibly because the laminate is being bent.  The average value of $\sigma_{xx}$ across the thickness of the laminate is $N_x / H$.

\begin{figure}[tb]
  \centering
   \includegraphics[width = 0.48\textwidth, trim = 10  00 10 10, clip = true, keepaspectratio = true]{Nlaminate.png}
   \includegraphics[width = 0.50\textwidth, trim = 10  15 10 10, clip = true, keepaspectratio = true]{Mlaminate.png}
   \caption{The in-plane loads per unit width (left) and moments per unit width (right) on a laminate.}
   \label{Nfig}
\end{figure}

Similarly, the vector of moments per unit width $\{M\}$ is defined as
\begin{equation}
   \left\{ \begin{array}{c}
     M_x \\ M_y \\ M_{xy}
   \end{array} \right\}
   = \bigintss_{-H/2}^{H/2}
    \left\{ \begin{array}{c}
           \sigma_{xx}  \\  \sigma_{yy}  \\   \sigma_{xy}
           \end{array} \right\}
      z \ud z
  \label{Mdef}
\end{equation}
These are also sketched in Fig.~\ref{Nfig}, where you can see that $M_x$ and $M_y$ are bending moments, while $M_{xy}$ is a twisting moment in the $x$--$y$ coordinate system.

\subsection*{Kirchoff-Love Hypothesis}

We would like to relate $\{ N \}$ and $\{ M \}$ to the deformation of the laminate.  To do this, classical lamination theory uses the Kirchoff-Love hypothesis.  This states that any material line initially normal to the $x$--$y$ plane remains straight and normal during deformation.  This is the laminated-plate analogy of slender beam theory.  However, while both a plate and a beam can bend in response to $M_x$, a plate can also bend in response to $M_y$ and twist in response to $M_{xy}$.

With this hypothesis, the in-plane strains at any height $z$ are related to the strains on the midplane, which are $\varepsilon^0_{xx}$, $\varepsilon^0_{yy}$, and $\gamma^0_{xy}$, and to the midplane curvatures by
\begin{equation}
\renewcommand\arraystretch{1.2}
        \left\{ \begin{array}{c}
           \varepsilon_{xx}  \\  \varepsilon_{yy}  \\  \gamma_{xy}
           \end{array} \right\}
           =
        \left\{ \begin{array}{c}
           \varepsilon^0_{xx}  \\  \varepsilon^0_{yy}  \\  \gamma^0_{xy}
           \end{array} \right\}
           + z
        \left\{ \begin{array}{c}
           \kappa_{xx}  \\  \kappa_{yy}  \\  \kappa_{xy}
           \end{array} \right\}
     \label{Kirchoff}
\end{equation}
In the absence of curvature, every layer in a laminate has the same in-plane strain.  With curvature, strain increases linearly with $z$, in proportion to the corresponding component of curvature.  For example, a positive $\kappa_{xx}$ stretches the layers above the midplane, and compresses the layers below the midplane.

\subsection*{Laminate Stiffness Equations}

Equations~(\ref{laminaQ}--\ref{Kirchoff}) can be combined to write an overall relationship between the forces and moments on the laminate and its midplane strains and curvatures.  That equation is
\begin{equation}
\renewcommand\arraystretch{1.2}
   \left\{ \begin{array}{c}
     N_x \\ N_y \\ N_{xy} \\  M_x \\ M_y \\ M_{xy}
   \end{array} \right\}
   =
\renewcommand\arraystretch{2}
   \left[ \begin{array}{c|c}
            A & B \\
            \hline
            B & D
      \end{array} \right]
\renewcommand\arraystretch{1.2}
        \left\{ \begin{array}{c}
           \varepsilon^0_{xx}  \\  \varepsilon^0_{yy}  \\  \gamma^0_{xy}  \\ \kappa_{xx}  \\  \kappa_{yy}  \\  \kappa_{xy}
           \end{array} \right\}
     \label{laminateStiffness}
\end{equation}
The $6 \times 6$ matrix on the right-hand side of this equation contains several $3 \times 3$ sub-matrices, which are defined as
\begin{align}
     [A] &= \int_{-H/2}^{H/2} \: [Q(z)] \: \ud z  \label{Amatrix} \\
     [B] &= \int_{-H/2}^{H/2} \: [Q(z)] \: z \ud z \label{Bmatrix}  \\
     [D] &= \int_{-H/2}^{H/2}\: [Q(z)] \: z^2 \ud z  \label{Dmatrix}
\end{align}
The plane-strain stiffness matrix $[Q]$ is a function of $z$ because different layers have different fiber orientation.  We can see that $[A]$ relates the midplane strains to the in-plane loads $\{ N \}$, while $[D]$ relates the the midplane curvatures to the moments $\{ M \}$.  The $[B]$ matrix describes coupling, either between curvature and in-plane loads or between in-plane strains and moments.  If the laminate is symmetric about the midplane, i.e., if $[Q(z)] = [Q(-z)]$, then $[B] = 0$ and there is no coupling.

To compute these matrices in a practical situation (and in \texttt{Clayer2laminate}), divide the laminate into $n$ discrete layers, and treat each layer as having a uniform $[Q]$.  Number the layers $i = 1$ to $n$ from the bottom of the laminate to the top, and let $[Q_i]$ be the plane-strain stiffness matrix for layer $i$.  Define $z_i$ such that layer $i$ extends from $z_{i-1}$ to $z_{i}$, with $z_0 = -H/2$ and $z_n = H/2$.  Now Eqns.~(\ref{Amatrix}--\ref{Dmatrix}) can be integrated analytically for each layer, and the matrices computed as
\begin{align}
     [A] &= \sum_{i=1}^n \: [Q_i] \: \left( z_i - z_{i-1} \right)  \label{Asum} \\
     [B] &= \sum_{i=1}^n  \: [Q_i] \: \left( \frac{z^2_i - z^2_{i-1}}{2} \right)  \label{Bsum}  \\
     [D] &= \sum_{i=1}^n  \: [Q_i] \: \left( \frac{z^3_i - z^3_{i-1}}{3} \right)  \label{Dsum}
\end{align}
$[A]$, $[B]$ and $[D]$ fully describe the elastic behavior of the laminate, and they are returned by \texttt{Clayer2laminate}.

\subsection*{Extracting Tensile and Flexural Moduli}

As discussed in Section~8.1.5, any engineering constant like Young's modulus is defined in terms of a mechanical test where loads are applied and deformations are measured.  For the tensile modulus in the $x$ direction, a stress $\sigma_{xx}$ is applied, with all other stresses equal to zero, and the modulus is the ratio of the applied stress to $\varepsilon_{xx}$.  For a laminate we'll used the midplane strain, and also require that there be no moments applied.  Then, the $x$-direction tensile modulus is
\begin{equation}
    E^t_{xx} = \frac{\sigma_{xx}}{\varepsilon^0_{xx}}   = \frac{N_{x}/H}{\varepsilon^0_{xx}}
    \label{EtensileDef}
 \end{equation}
We have used a superscript $t$ to indicate that this is a tensile modulus, and the second expression replaces the average stress $\sigma_{xx}$ with the load per unit width $N_x$.  A similar expression gives the $y$-direction tensile modulus.

To find the flexural modulus in the $x$ direction, one subjects the sample to a bending test where a moment $M_x$ is applied, with no other loads or moments, and the curvature $\kappa_{xx}$ is determined by measuring the deflection.  If this test were performed on a homogeneous beam of width $b$ and thickness $H$, the moment-curvature relationship would be
\begin{equation}
   M_x b = E^f_{xx} I \, \kappa_{xx} = \frac{E^f_{xx} b H^3}{12} \kappa_{xx}
   \label{momentCurvature}
\end{equation}
Here $I = bH^3/12$ is the moment of inertia of the cross-section, and the superscript $f$ on $E$ indicates a flexural modulus.  Note that $M_x$ is a moment per unit width, so the total applied moment is $M_x b$.  We can cancel $b$ from both sides and rearrange this equation to get the effective flexural modulus,
\begin{equation}
   E^f_{xx} = \frac{12 M_x}{H^3 \kappa_{xx}}
   \label{EflexDef}
\end{equation}
Analogous equations apply in the $y$ direction.

To apply these results to a specific laminate, we need to find the midplane strain and the midplane curvature for the two load cases.  To do this numerically, invert the $6 \times 6$ matrix from the right-hand side of Eqn.~(\ref{laminateStiffness}).  The resulting matrix seems to have no official title, so we'll call it the laminate compliance matrix $[S^\mathrm{lam}]$:
\begin{equation}
    [S^\mathrm{lam}]
    =
   \left[ \begin{array}{c|c}
            A & B \\
            \hline
            B & D
      \end{array} \right] ^{-1}
   \label{SlamDef}
\end{equation}
Now the strain-stress relationship for the laminate is
\begin{equation}
\renewcommand\arraystretch{1.2}
        \left\{ \begin{array}{c}
           \varepsilon^0_{xx}  \\  \varepsilon^0_{yy}  \\  \gamma^0_{xy}  \\ \kappa_{xx}  \\  \kappa_{yy}  \\  \kappa_{xy}
           \end{array} \right\}
           = [S^\mathrm{lam}]
\renewcommand\arraystretch{1.2}
   \left\{ \begin{array}{c}
     N_x \\ N_y \\ N_{xy} \\  M_x \\ M_y \\ M_{xy}
   \end{array} \right\}
     \label{laminateCompliance}
\end{equation}
For a tensile test, with all loads and moments zero except $N_x$, the midplane strain is $\varepsilon^0_{xx} = S^\mathrm{lam}_{11} N_x$.  Using this in Eqn.~(\ref{EtensileDef}), we can calculate the laminate's tensile modulus in the $x$ direction as
\begin{equation}
     E^t_{xx} = \frac{1}{S^\mathrm{lam}_{11} H}
     \label{EtxxFinal}
 \end{equation}
 Similarly, the tensile modulus in the $y$ direction is
\begin{equation}
     E^t_{yy} = \frac{1}{S^\mathrm{lam}_{22} H}
     \label{EtyyFinal}
 \end{equation}
 For a bending test in the $x$ direction, the moment and curvature are related by $\kappa_{xx} = S^\mathrm{lam}_{44} M_x$.  Substituting this into Eqn.~(\ref{EflexDef}), we obtain an equation for the flexural modulus of the laminate in the $x$ direction,
 \begin{equation}
     E^f_{xx} = \frac{12}{S^\mathrm{lam}_{44} H^3}
     \label{EfxxFinal}
\end{equation}
The $y$-direction flexural modulus is found similarly,
 \begin{equation}
     E^f_{yy} = \frac{12}{S^\mathrm{lam}_{55} H^3}
     \label{EfyyFinal}
\end{equation}
 Equations~(\ref{EtxxFinal}--\ref{EfyyFinal}) are implemented in \texttt{Clayer2laminate}.
  For an example calculation, see \break \texttt{LaminatedPlateProperties.mlx}.

\end{document}


\pagenumbering{arabic}
\setcounter{page}{1}

\chapter{Introduction}

\section{Magnetohydrodynamics}

\subsection{Navier-Stokes}

\subsection{Maxwell}

\section{A model problem}

stationary incompressible and resistive magnetohydrodynamics (MHD) system:
\begin{subequations}
\label{eq:mhd}
\begin{alignat}2
\label{eq:mhd1} - \nu  \, \Delta\uu{u} + (\uu{u} \cdot \nabla)
\uu{u}+\nabla p - \kappa\,
(\nabla\times\uu{b})\times\uu{b} &= \uu{f} & \qquad &\mbox{in $\Omega$},\\[.1cm]
\label{eq:mhd2}
\nabla\cdot\uu{u} &= 0 & \qquad &\mbox{in $\Omega$},\\[.1cm]
\label{eq:mhd3}
\kappa\nu_m  \, \nabla\times( \nabla\times \uu{b})
+ \nabla r
- \kappa \, \nabla\times(\uu{u}\times \uu{b}) &= \uu{g} & \qquad &\mbox{in $\Omega$},\\[.1cm]
\label{eq:mhd4} \nabla\cdot\uu{b} &= 0 & \qquad &\mbox{in
$\Omega$}.
\end{alignat}
\end{subequations}

\begin{subequations}
\label{eq:bc}
\begin{alignat}2
\label{eq:bc1} \uu{u} &= \uu{u_D} & \qquad &\mbox{on $\partial\Omega$},\\[.1cm]
\label{eq:bc2}
   \uu{n}\times\uu{b} &= \uu{n} \times \uu{b_D} & \qquad &\mbox{on $\partial\Omega$},\\[.1cm]
\label{eq:bc3}      r &=0 &\qquad &\mbox{on $\partial\Omega$},
\end{alignat}
\end{subequations}

\section{Finite element methods}
${\mathcal P}_{k}$: the space of polynomials of total degree at most $k$
$ \uu{R}_k$: the space of homogeneous vector polynomials of total degree $k$ that are orthogonal to the position vector $\uu{x}$

\section{Iterative Methods}

\section{Objectives and contributions}

%{\bf [ changed order of equations to $(u,p,b,r)$] }
% Here, $\Omega$ is a bounded simply-connected Lipschitz polyhedron in~$\mathbb{R}^3$, with a connected boundary~$\partial\Omega$. The unknowns are the velocity~$\uu{u}$, the hydrodynamic pressure~$p$, the magnetic field $\uu{b}$, and the Lagrange multiplier $r$ associated with the divergence constraint on the magnetic field. The functions $\uu{f}$ and $\uu{g}$ represent
% external force terms.

% The equations \eqref{eq:mhd} are characterized by three dimensionless parameters: the hydrodynamic Reynolds number ${\rm Re}=\nu^{-1}$, the magnetic Reynolds number ${\rm Rm}~=~\nu_m^{-1}$, and the coupling number~$\kappa$. For further discussion of these parameters and their typical values, we refer the reader to~\cite{ArmeroSimo96, Gerbeau2006, Roberts67}. We consider the following homogeneous and inhomogeneous Dirichlet boundary conditions:
% with $\uu{n}$ being the unit outward normal on $\partial\Omega$. By taking the divergence of the magnetostatic equation~(\ref{eq:mhd3}), we obtain the Poisson problem
% \begin{equation}
% \label{eq:zero-r} \Delta r =\nabla \cdot \uu{g} \quad \mbox{in
% $\Omega$}, \qquad r=0 \quad\mbox{on $\partial\Omega$}.
% \end{equation}
% Since $\uu{g}$ is divergence-free in physically relevant applications, the multiplier $r$ is typically zero and its primary purpose is to ensure stability; see also~\cite{Greif10}.

% Our goal in this paper is to derive a scalable numerical solution procedure for solving \eqref{eq:mhd}-\eqref{eq:bc}. We first present in Section~\ref{sec:discretization} the finite element discretization and the structure of the matrices that arise throughout the nonlinear iterations. In Section~\ref{sec:preconditioning} we introduce the proposed preconditioners for the indefinite linear systems that arise; our ideas are based on combining preconditioners for the incompressible Navier-Stokes and Maxwell sub-systems appearing  in the MHD system~\eqref{eq:mhd1}--\eqref{eq:mhd4} while taking into account the presence of coupling terms. Spectral analysis is performed in Section~\ref{sec:mhd_eigenvalue}. {\bf [DS: More precise and quote earlier papers]}. In Section~\ref{sec:decoupling} we consider circumstances where the incompressible Navier-Stokes and the Maxwell systems can be decoupled; in such cases the preconditioning approach may be significantly simplified. In Section~\ref{sec:numerical_results_mhd_
% solver} we provide preliminary results in two dimensions that show that our numerical  solution techniques are feasible and reasonably scalable. Finally, we offer some concluding remarks in Section~\ref{sec:conclusions}.


\subsection{Double selection}


\subsection{Influence of Implementations}
\label{subsec:experiments-implementations}

We discuss the influence of implementation details on performance and runtime for
different implementations of \SEEDS, \SLIC and \FH. In particular, \reSEEDS and \reFH
are our revised implementations of \SEEDS and \FH, respectively.
Both implementations follow the algorithm as described in the corresponding publications,
provide exactly the same parameters and are also implemented in C/C++.
Still, we tried to optimize the implementations with respect to connectivity and
kept them as efficient as possible.
\reFH additionally uses a slightly different graph data structure -- we refer to the
implementations for details; these will be made publicly available together with the benchmark.
Furthermore, we include \vlSLIC, an implementation of \SLIC as part of the VLFeat library
\cite{VedaldiFulkerson:2008}, and \preSLIC \cite{NeubertProtzel:2014}, an accelerated version of \SLIC based on the
original implementation. Both \vlSLIC and \preSLIC are also implemented in C/C++ as
their original counterparts.

We find that revisiting implementation details may be beneficial for both performance and runtime.
We consider Figure \ref{fig:experiments-implementations-bsds500} showing \Rec, \UE
and runtime in seconds $t$ for the introduced implementations of \SLIC, \SEEDS and \FH on the \BSDS dataset.
For \reSEEDSr and \reFHr, we observe improved performance which can be related to
the improved connectivity. However, even very similar implementations such as \SLICr
and \vlSLICr differ slightly in performance; note the lower \Rec and higher \UE
of \vlSLICr compared to \SLICr. Overall, the difference in runtime is most striking, for example \reSEEDSr
and \preSLICr show significantly lower runtime compared to \SEEDSr and \SLICr.
\reFHr, in contrast, shows higher runtime compared to \FHr due to a more complex data structure.
%We conclude that revisiting implementation details may improve performance and reduce runtime.

As expected, implementation details effect runtime, however, in the presented cases,
\ie for \SLIC, \SEEDS and \FH, performance is also affected. Nevertheless, it
still needs to be examined whether this holds true for the remaining algorithms, as well.
Furthermore, the experiments suggest that improving connectivity helps
performance.


\input{docs/preamble}
\title{The Speed of Light}
\author{Max Bigras and David Frawley}

\begin{document}

\maketitle

\section{The speed of light}
\subsection{Light speed in air}
Using a pulse modulated diode laser and fast photodiode detector we measured the time lag between the laser pulse and detection. We adjusted the distance the laser pulse traveled in air using mirrors. By plotting distance vs. time, shown in Figure \ref{air}, we determined $c^{\mathrm{air}}_{\mathrm{exp}} = 3.02 \times 10^{8} \pm 0.03 $ m/s, which agrees with the accepted value, $c^{\mathrm{air}} = 2.99792458 \times 10^{8}$ m/s.
\begin{figure}[H]
  \includegraphics[totalheight=0.6\textwidth]{figs/air_final}
  \caption{Determining the speed of light in air}
  \label{air}
\end{figure}

\subsection{Light speed in an optical fiber}
Using a pulse modulated diode laser and fast photodiode detector we measured the time lag between the laser pulse and detection. We adjusted the distance the laser pulse traveled in an optical fiber by using different lengths of fiber. By plotting distance vs. time, shown in Figure \ref{fiber}, we determined $c^{\mathrm{fiber}}_{\mathrm{exp}} = 1.85 \times 10^{8} \pm 0.03 $ m/s. The refractive index for a material is given by the equation
\begin{equation}
n^{\mathrm{material}} = c^{\mathrm{vacuum}}/c^{\mathrm{material}}
\label{n}
\end{equation}

Applying Equation \ref{n} and using $c^{\mathrm{air}}_{\mathrm{exp}} \approx c^{\mathrm{vacuum}}$ we determined $n^{\mathrm{fiber}}_{\mathrm{exp}} = 1.63 \pm 0.01$ which agrees with the accepted value for the core of a optical fiber $n^{\mathrm{fiber}} \approx 1.62$ \cite{wiki}.

\begin{figure}[H]
  \includegraphics[totalheight=0.6\textwidth]{figs/fiber_final}
  \caption{Determining the speed of light in optical fiber}
  \label{fiber}
\end{figure}
\subsection{Light speed in a coaxial cable}
We propagated electromagnetic waves in a RG-6/U coaxial cable terminated by a resistor box. Depending on the resistance of the box we observed the signal at the end of the cable be: reflected, inverted and absorbed. We measured the speed of an electromagnetic wave in the cable, $c^{\mathrm{cable}} = 2.32 \times 10^{8}$. We determined the velocity factor = 0.79, which agrees with the accepted velocity factor for a RG-6/U coaxial cable = 0.82 \cite{cable}.

\begin{thebibliography}{99}

\bibitem{manual} Physics Dept., ``The Speed of Light'', Quantum Lab,
  California Polytechnic University, (2013).

\bibitem{wiki} ``Optical fiber.'' Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc., 05 December 2013. Web.

\bibitem{cable} C. R. Parashare, and R. F. Bradley, ``75 $\Omega$ Transmission System'', National Radio Astronomy Observatory Technology Center, Virginia, 2006.

\end{thebibliography}

\end{document}


%----------------------------------------------------------------------
\section[Pokem ipsum]{Pokem ipsum}
%----------------------------------------------------------------------

%----------------------------------------------------------------------
\paragraph{Pokem ipsum}
%----------------------------------------------------------------------

Pokem ipsum dolor sit amet Charizard anim id est laborum Sonic Boom Garchomp anim id est laborum Scraggy. Brock Hypno Tentacruel Luxray searching far and wide Abomasnow Turtwig. Sinnoh Giovanni Kingdra Golduck The Power Of One Leech Life Soda Pop. Bug Skarmory Garbodor Ralts but nothing happened Nidorino Archeops. Marsh Badge Wormadam Landorus Dunsparce Mystery Gift Shroomish Sinnoh.

Fire Petilil Celadon City Grovyle Arcanine Swanna Water Gun. Sed do eiusmod tempor incididunt Porygon2 Skorupi Glameow Mismagius Mareep Klang. Flamethrower Nidorina Walrein Aerodactyl Luxio Umbreon Barboach. Pokemon Heroes Luxio Magnemite Pokemon Fan Club Chairman Eevee Ursaring Blitzle. Swift Rare Candy Walrein Relicanth Gallade Golett Glaceon.
%
\begin{align}
\bm r &= x\bm i + y \bm j + z \bm k
\\
\bm v &= v_x\bm i + v_y \bm j + v_z \bm k
\\
\bm a &= a_x\bm i + a_y \bm j + a_z \bm k
\end{align}
%

\paragraph{Pokedex}

Pokem ipsum dolor sit amet Charizard anim id est laborum Sonic Boom Garchomp anim id est laborum Scraggy. Brock Hypno Tentacruel Luxray searching far and wide Abomasnow Turtwig. Sinnoh Giovanni Kingdra Golduck The Power Of One Leech Life Soda Pop. Bug Skarmory Garbodor Ralts but nothing happened Nidorino Archeops. Marsh Badge Wormadam Landorus Dunsparce Mystery Gift Shroomish Sinnoh.

Fire Petilil Celadon City Grovyle Arcanine Swanna Water Gun. Sed do eiusmod tempor incididunt Porygon2 Skorupi Glameow Mismagius Mareep Klang. Flamethrower Nidorina Walrein Aerodactyl Luxio Umbreon Barboach. Pokemon Heroes Luxio Magnemite Pokemon Fan Club Chairman Eevee Ursaring Blitzle. Swift Rare Candy Walrein Relicanth Gallade Golett Glaceon.

\begin{center}
\includegraphics{pokemon.png}
\end{center}


\documentclass[10pt]{article}
\usepackage{multicol, caption}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\newenvironment{Figure}
  {\par\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}
\graphicspath{ {images/} }
\title{\textbf{Real-time Mesh Deformation using Volumetric Graph Laplacian}}
\author{Elias Eberhardsson}
\date{}
\begin{document}
\maketitle

\textit{
This paper describes the implementation and testing of a mesh deformation method using volumetric graph laplacian for use in real-time. First a graph of nodes in a crystal structure inside the 3D mesh is constructed. The nodes are connected together and linked with the mesh. These nodes and their connections are used to preserve volumetric detail when deforming vertices contained in the mesh. The laplacian on vertices based on this graph is how volumetric details are preserved, coupled with the laplacian on the mesh, which preserves outer details. And such the deformed locations are calculated. This method should ideally be used together with quadratic minimization, but due to the time constraint this was left out in favour of a simple interpolation of new vertex position and the two laplacian values.
}
\begin{multicols}{2}
\section{Introduction}
Mesh deformation has been interesting to computer scientists for as long as we have been able to draw vertices on the screen. Much research has been done and many many methods have been created and put forth through scientific publications.

There are many applications for mesh deformation: animation, modelling and simulations are some of the more prominent ones.

The method showcased in this paper aims to in real-time deform a mesh while balancing volumetric and surface details and such prevent self-intersection and unnatural looking bends and twists.
The method builds on the Volumetric Graph Laplacian (VGL), used in [Zhou et al. 2005], which owes itself to differential domain techniques and graph theory. This represents detail as points differences from origo to be balanced between.
\section{Related work}

This project is an attempt at implementing the method described in the paper Large Mesh Deformation Using the Volumetric Graph Laplacian [Zhou et al. 2005] which was an attempt at much better preserve detail and volume when doing deformations such as bending and twisting parts of a mesh. This method used quadratic minimization on energy functions to as closely as possible simulate a real deformation.

Supposed to be used but cut due to time constraints are WIRE deformation [Singh and Fiume 1998] where a method of connecting vertices in a mesh on a curve and deforming with some constraints to how the curve may bend. This combined with volumetric graph laplacian is what is described in [Zhou et al. 2005].

As mentioned in the introduction this is also closely related to differential domain techniques [Yu et al. 2004] and spectral graph theory [Chung 1997].

\section{Deformation on Volumetric Graphs}

Given a mesh \textit{M = (V, K, N)}, where \textit{ \[ V = \{ p_i \in R^3|1\leq i \leq n \} \] } are the vertex positions as points in 3D-space and \textit{K} is the connective data to each of the adjacent volumetric nodes in the 3-dimensional array that is used to store them: \textit{ \[ K = \{ I_i \in R^3|1\leq i \leq m \} \] } And \textit{N} is similarily the conncetive data to adjacent vertices in the mesh: \textit{ \[ N = \{ N_i \in R|1\leq i \leq k \} \] } Using this as a starting point we can lay out the details of the deformation method.
\subsection{Volumetric graph}
\begin{Figure}
	\centering
	\includegraphics[width=\linewidth]{graph1.png}
	\captionof{figure}{Graph structure.}
\end{Figure}
\begin{Figure}
	\centering
	\includegraphics[width=\linewidth]{graph2.png}
	\captionof{figure}{Final volume graph.}
\end{Figure}
To construct the graph that is used to represent volume in the deformation we build two 3-dimensional fields of nodes. The distance, \textit{d}, between each node is set to the average edge-distance in the mesh. The fields are offset by half of \textit{d} in each direction to create a structually sound, crystal-like, volume, see figure 2.

When this is done all nodes which are not contained within the mesh are discarded. Finally each node in the resulting graph are connected to each of its neighbors and any mesh-vertices within \textit{d\textbackslash2} is connected and that vertex is also given information on which connections that have been made, see figure 3.

The method used to determine whether a node is contained within the mesh is to calculate triangle-ray intersections from the node in an arbitrary direction. Given an even number of intersections the node is outside of the mesh, and given an uneven number, the node is contained within the mesh.

\subsection{Laplacian of graph}
The laplacian of a graph is the same as the laplacian operator on manifolds [Chung 1997] and computes the difference of a point \textit{p} and all of its adjacencies. Given a weight \textit{w} for each neighbor that satisfies \[ \sum_{j\in N_i \cup K_i} w_{ij} = 1\] we linearly compute the difference of the graph adjacencies: \[ \bigtriangledown_G(p_i) = p_i - \sum_{j\in K_i}w_{ij}p_j \] Similarly we do this for mesh adjacencies: \[ \bigtriangledown_M(p_i) = p_i - \sum_{j\in N_i}w_{ij}p_j \] Here $\bigtriangledown$ is the laplacian operator and \textit{G} and \textit{M} is the volumetric graph and the 3D mesh respectivly.

This gives us two terms, one which encodes volumetric detail and one that contains surface detail.
\subsection{Deformation}
Given a point \textit{q\textsubscript{i}} that is the target deformation point for \textit{p\textsubscript{i}} we need to find the point \textit{p`\textsubscript{i}} that balances volume and detail but still deforms \textit{p\textsubscript{i}} satisfactorily.

We have the three terms a, b, and c:
\[ a = \bigtriangledown_G(h_{i}) - \bigtriangledown_G(p_i)\]
\[ b = h_i - q_i\]
\[ c = \bigtriangledown_M(h_{i}) - \bigtriangledown_M(p_i)\]
where \[ h_i = p_i + \gamma*(p_i - q_i)\]
$\gamma \in \{ 0..1 \}$ gives $h_i$ an approximate value of a deformed location. $\gamma$ is set to 0.6 in our implementation.

The final deformed location $p`_i$ is calculated:
\[ p`_i = a*(1 - \alpha - \beta) + b*\alpha + c*\beta \]
$\beta$ balances between surface and volume details. $\beta = n/N$ works well where n is the number of vertices on the mesh and N is the count of the volumetric nodes contained in the graph.

Experimenting with $\alpha$ is needed to achive good results based on the mesh that is to be deformed, but 0.4 seems like a good number, as used in [Zhout et al. 2005].

\subsection{Propagation}
When a new position has been calculated we use it to get the relative translation needed to be done. $T = p`_i - p_i$. The translation \textit{T} is propagated throughout the mesh using a simple propagation scheme. So that each of $p_i$'s neighbor $n$ is translated $T*(1/||p_n - p_i||)$.

\section{Results}

The results were subpar if you were to compare this to any proper implementation using energy functions and quadratic minimization. Also a better way to propagate would have been great to get good looking reults.

\begin{Figure}
	\centering
	\includegraphics[width=\linewidth]{mondef.png}
	\captionof{figure}{Face deformation.}
\end{Figure}

Small deformations work fine, moving parts of a face as an example looks fine, as shown in figure 4. But trying to bend bigger shapes do not come out good without much tweaking to the balancing and changes to the weight used in propagation, shown in figure 5 and 6.

\begin{Figure}
	\centering
	\includegraphics[width=\linewidth]{korv1.png}
	\captionof{figure}{Pre deformed.}
\end{Figure}
\begin{Figure}
	\centering
	\includegraphics[width=\linewidth]{korv2.png}
	\captionof{figure}{Post deformed.}
\end{Figure}

\section{Conclusion and Reflections}

Our implementation of these deformation algorithms are subpar at best. We underestimated the work and planning needed to properly implement and use VGL [Zhou et al. 2005], completely missing the need for WIRE deformation to do large deformations the first ten times I read the paper.

We had intended to use quadratic minimization on energy functions, as laid out in [Zhou et al. 2005], but we did not understand the bounds used nor had we enough time to implement or get used to any library needed for such computation. And as such our simple interpolation does prove decent at preserving volume and detail in small deformation and does prevent self-intersection. But it fails at any large deformation, or any greater deformations tried, which results in odd looking results.

Instead of simply a translation to be propagated, it should be a transformation-matrix, otherwise proper turning and twisting would have a hard time looking proper.

If I got to do this all over again, I would plan in much greater detail all parts of the implementation, choice of datastructures used and all things that actually needed to be understood.

\begin{thebibliography}{7}
\bibitem{zhou}
Kun Zhou, Jin Huang, John Snyder, Xinguo Liu, Hunun Bao, Baining Guo and Heung-Yeung Shun. 2005.
\textit{Large Mesh Deformation Using the Volumetric Graph Laplacian}.
ACM Trans. Graphics (Proc. ACM SIGGRAPH), vol. 24, no. 3, pp. 496-503.

\bibitem{moller}
Tomas M{\"o}ller. 1997.
\textit{A Fast Triangle-Triangle Intersection Test}.
Journal of Graphics Tools, 2(2):25-30.

\bibitem{moller2}
Tomas M{\"o}ller and Ben Trumbore. 1997.
\textit{Fast, Minimum Storage Ray/Triangle Intersection}.
Journal of Graphics Tools, 2(1):21-28.

\bibitem{chung}
Chung F.R.K. 1997.
\textit{Spectral Graph Theory}.
CBMS 92, AMS.

\bibitem{gingh}
Karan Singh and Eugene Fiume. 1998.
\textit{Wires: A Gerometric Deformation Technique}.
SIGGRAPH 98 Conference Proceedings, pages 405-414.
\end{thebibliography}

\end{multicols}
\end{document}