Newer
Older
cg / hw04 / documentation / _Algorithms.tex
\subsection{Chaikin’s Algorithm}
To smooth out a curve one possibility is the Chaikin's algorithm (\cite{DBLP:journals/cvgip/Chaikin74}). Using a set of points the Chaikin's algorithm can be used to generate the mask M which then is multiplied with the set of points to calculate the new set. This process can be repeated indefinitely to further smooth out the curve by constantly adding new points along the edges in perspective to the adjacent points. This algorithm was based on tests and not on mathematical proofs.

\begin{equation}
M  = 
\begin{bmatrix}
    1 \\
    1/2 & 1/2  \\
    & 3/4 & 1/4 \\
    & 1/4 & 3/4 \\
    & & 3/4 & 1/4 \\
    & & 1/4 & 3/4 \\
    & & & &  \ddots \\
    & & & & &  1\\
    
\end{bmatrix}
\end{equation}

\subsection{Interpolating Cubic Subdivision}
While Chaikin's Algorithm is fairly accurate the Interpolating Cubic Subdivision scheme is more detailed and mathematical proven. To use this method the mask needs to be changed to the following. 
\begin{equation}
M  = 
\begin{bmatrix}
    1 \\
    1/2 & 1/2  \\
    1/8 & 3/4 & 1/8 \\
    & 1/2 & 1/2 \\
    & 1/8 & 3/4 & 1/8 \\
    & & 1/2 & 1/2 \\
    & & & &  \ddots \\
    & & & & &  1\\
    
\end{bmatrix}
\end{equation}

\subsection{Linear Loop subdivision - Edge midpoints}
The Linear Loop subdivision (\cite{loop1987smooth}) adds a point at the middle of every edge and then reconnects every corner vertex with its two new adjacent mid points and then all the mid new calculated mid points as another face. This effectively creates three new faces therefore increasing the Resolution of the mesh. This can also be done indefinitely, always increasing the amount of triangles in a mesh.

\begin{figure}[H]
  \centering
 \includesvg[]{images/LinearLoop.svg}
  \caption{Linear Loop subdivision - Edge midpoints}
\end{figure}
\subsection{Loop subdivision - Vertex mask}
Loop subdivision does not only add more triangles to the mesh but also smooths out the shape. To do so we need to know the exact neighbours of each face. A face is considered to be a neighbour of another face if they share exactly two vertices. In order to calculate the new vertices e0 needs to be calculated using the four different points of the main triangle and the one new point from the neighbouring triangle.


\begin{figure}[H]
  \centering
  \includesvg[]{images/E0.svg}
  \caption{Loop subdivision - Edge mask}
  \label{fig:edge-mask}
\end{figure}

\begin{equation}
    e0 = \frac{3}{8}(V0 + V1) + \frac{1}{8}(V2 + V3)
\end{equation}

Now this is done for every side with the according neighbour of the triangle face. For the next step it is also needed $\beta (n)$, where n is the valence of the vertex.

\begin{equation} \label{eq:alpha-beta}
\begin{split}
    &\alpha(n) = \frac{3}{8} + (\frac{3}{8} + \frac{1}{4} \cos{\frac{2\pi}{n}})^2 \\
    &\beta(n) = \frac{8}{5} \alpha(n) - \frac{3}{5}
\end{split}
\end{equation}

Using $\beta (n)$ of every original vertex is used to calculate the new coordinates using the following formula. 

\begin{equation}
    v' = \beta (n)v + \frac{1 - \beta (n)}{n} \sum_{i=0}^n e'_i
\end{equation}

\begin{figure}[H]
  \centering
  \includesvg[]{E012.svg}
  \caption{Loop subdivision - Vertex mask}
  \label{fig:edge-mask-all}
\end{figure}