\documentclass[a4paper,10pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[top=2cm,bottom=2cm,left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{array}
\usepackage{float}
\usepackage{xcolor}

% Title Page
\title{Tests report}
\author{Thomas Forgione, Emilie Jalras, Marion Lenfant, Thierry Malon, Amandine Pailloux}

\makeatletter
\@addtoreset{chapter}{part}
\makeatother

\begin{document}
\maketitle
\tableofcontents

\part{Camera calibration, skeletonization, detection and matching of keypoints}
\chapter{Calibration}
\section{External calibration}

To test the external calibration, the idea is to have two pictures of a scene
containing two chessboards : one blue and one red. We will compute the
homography that transforms the blue chessboard on the first picture to the blue
chessboard of the second picture. Then, we will apply this transformation to
the red chessboard on the first picture, and if the calibration has a good
quality, the points found should be on the red chessboard.
\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/externalCalibration/result.png}
 \caption{Test of the external calibration}
\end{figure}
As you can see, the points computed are slightly displaced from the corners of
the chessboard. We can explain this by the difficulty we had to have a very
plane chessboard : the ink from the printer humidify the paper, and we were not
able to have a really plane chessboard.

\chapter{Detection and matching of keypoints}
\section{Detection of keypoints}
We tried three differents algorithm to find points of interest :
\begin{itemize}
	\item surf algorithm
	\item sift algorithm
	\item brisk algorithm
\end{itemize}
The results were similar with the three algorithms.
We kept the surf algorithm for detection as it is the fatest one but finally we decided to use brisk algorithm because surf and sift
are patented algorithm and cannot be used for commercial use. In the following results you can see the differences between surf
and brisk.
With the surf algorithm there is a parameter named minHessian which can be modified, influencing the number of detected points.
The higher the minHessian, the fewer keypoints you will obtain, on the other hand, the lower the minHessian, the more keypoints you get, but they may be more noisy.
With the brisk algorithm some parameters can be changed like the FAST/AGAST detection threshold score (thresh), the detection octaves (octaves) and
the scale to the pattern used for sampling the neighbourhood of a keypoint (patternScale).

\subsection{Test lapin}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/LapinSift}
 \caption{\label{LapinSift} Lapin, Sift algorithm}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/LapinSurf500}
 \caption{\label{LapinSurf500} Lapin, Surf algorithm, minHessian=500}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/LapinSurf1000}
 \caption{\label{LapinSurf1000} Lapin, Surf algorithm, minHessian=1000}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.49]{images/pointsDetection/brisk3415}
 \caption{\label{brisk3415} Lapin, Brisk, thresh=3, octaves=4, patternScale=1.5}
\end{figure}

\newpage
\subsection{Test minion}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/MignonSift}
 \caption{\label{MignonSift} Minion, Sift algorithm}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/MignonSurf500}
 \caption{\label{} Minion, Surf algorithm, minHessian=500}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsDetection/MignonSurf1000}
 \caption{\label{fig} Minion, Surf algorithm, minHessian=1000}
\end{figure}


\section{Matching of keypoints}
\subsection{Different filters on Surf }
Different kinds of filters :
\begin{itemize}
	\item symmetric constraint
	\item order constraint
	\item match distance filter
	\item geometric filter (with Ransac algorithm)
\end{itemize}

\begin{table}[H]
\begin{center}
\begin{tabular}{|p{3.8cm}|p{3.8cm}|p{3.8cm}|}
	\hline
	Filters & Description & Parameter \\
	\hline
	Symmetric constraint & 	The symmetric constraint delivers efficient results, and does not remove too many points. This is why we will keep this filter. & None\\
	\hline
	Order constraint &  The order constraint does not seem relevant when used with a too high threshold. The order constraint does not seem relevant when used with a too high threshold. & proportion: represent the rate of error accepted\\
	\hline
	Match distance filter & The match distance criteria seems to remove wise points but the results are less effective when removing lots of points. & threshold : represent the distance between two keypoints, between 0 and 1. \\
	\hline
	Geometric filter & The geometric filter, using Ransac to find outliers, gives us back really good points, but it seems too selective. & param RANSAC : It is the maximum distance from a point to an epipolar line in pixels, beyond which the point is considered an outlier and is not used for computing the final fundamental matrix. It can be set to something like 1-3, depending on the accuracy of the point localization, image resolution, and the image noise.\\
	\hline
\end{tabular}
\caption{\label{filters}Different kinds of filters}
\end{center}
\end{table}


\begin{table}[H]
\begin{center}
\begin{tabular}{|c|c|c|c|}
%begin{tabular}{|p{6cm}|p{2.8cm}|p{2.8cm}|p{3.8cm}|}
	\hline
	Type of filter & Parameter & Number of points & Figure\\
	\hline
	no cache & -- & -- & fig \ref{LapinNoCache} \\
	\hline
	no filter img1 - img2 & -- & 503 & fig \ref{LapinNoFilter1-2}\\
	\hline
	no filter img2 - img1 & -- & 395 & fig \ref{LapinNoFilter2-1} \\
	\hline
	symmetric constraint & -- & 174 & fig \ref{LapinSymmetric}\\
	\hline
	order constraint & proportion : 1 & 503 &  \\
	\hline
	order constraint & proportion : 1/4 & 0 &  \\
	\hline
	distance criteria & threshold : 0.5 & 478 & \\
	\hline
	distance criteria & threshold : 0.4 & 417 & fig \ref{LapinCorrected0-4} \\
	\hline
	symmetric constraint / distance criteria & threshold : 0.3 & 124 & fig \ref{LapinSymmetricCorrected0-3} \\
	\hline
	geometric constraint & RANSAC param : 3 & 73 & fig \ref{LapinGeometric}\\
	\hline
	symmetric constraint / geometric constraint & RANSAC param : 3 & 104 & fig \ref{LapinSymmetricGeometric}\\
	\hline

\end{tabular}
\caption{\label{fig2} Number of points per filter}
\end{center}
\end{table}
With the geometric constraint we obtain more points when limiting to the symmetric points.
This probably comes from the calculation of the fundamental matrix with the Ransac algorithm, which is less accurate when using wrong points as input.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinNoCache}
 \caption{\label{LapinNoCache} No cache}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinNoFilter1-2}
 \caption{\label{LapinNoFilter1-2} Mask but no filter img1 - img2}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinNoFilter2-1}
 \caption{\label{LapinNoFilter2-1} Mask but no filter img2 - img1}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinSymmetric}
 \caption{\label{LapinSymmetric} Symmetric constraint}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinCorrected0-4}
 \caption{\label{LapinCorrected0-4} Distance criteria 0.4}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinSymmetricCorrected0-3}
 \caption{\label{LapinSymmetricCorrected0-3} Symmetric constraint and distance criteria 0.4}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinGeometric}
 \caption{\label{LapinGeometric} Geometric constraint}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinSymmetricGeometric}
 \caption{\label{LapinSymmetricGeometric} Symmetric constraint and geometric constraint}
\end{figure}

\subsection{Tests with two times the same picture}
	We seem to have good results when using only the surf matching algorithm, with or without mask.
	At first we obtained no points at all with the geometric filter. This test allowed us to find an error in our file
	(you can see the different results wihout mask, no filter, geometric filter with and without error Figures \ref{LapinAgain},
	\ref{LapinAgainMask}, \ref{LapinAgainWrongGeometric} and \ref{LapinAgainGeometric})

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinAgain}
 \caption{\label{LapinAgain} No mask no filter}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinAgainMask}
 \caption{\label{LapinAgainMask}No filter}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinAgainWrongGeometric}
 \caption{\label{LapinAgainWrongGeometric} Geometric filter with error}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.45]{images/pointsMatching/LapinAgainGeometric}
 \caption{\label{LapinAgainGeometric} Geometric filter}
\end{figure}

\subsection{Test using BRISK algorithm}

We changed the parameters of brisk algorithm and of the filters to find the best
values in order to find the best matching points. The different results are
summarise in the table \ref{briskTest}.

\begin{table}[H]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
Figure &     Thresh &    Octaves &    PatternScales   &   Proportion  &     RANSAC   &   Matches number\\
\hline
\ref{B1}   &    2   &        4   &        1.5    &             1   &            3      &     55\\
\hline
\ref{B2}    &   10   &       4       &    1.5      &           1     &          3     &      43\\
\hline
\ref{B3}    &   3      &     4       &    1.5     &            1    &           3   &        57\\
\hline
\ref{B4}    &   3     &      4       &    1.0     &            1     &          3     &      31\\
\hline
\ref{B5}    &   3      &     4     &      2.0     &            1     &          3    &       53\\
\hline
\ref{B6}    &   3      &     4       &    1.5         &        1     &          5     &      66\\
\hline
\ref{B7}    &   3      &     4      &     1.5     &            0.5   &          3     &      69\\
\hline
\end{tabular}
\caption{\label{briskTest} Test on parameters of brisk algorithm and filters}
\end{center}
\end{table}

\paragraph{Analyses} When we raise the thresh parameter over 3 the number of matches decrease, the same thing
happened when we decrease it below 3. That is why we kept the value 3 for thresh parameter. Then, the value of
PatternScales parameter is important to adjust the number of keypoints detected and so the number of matches,
the optimal value is 1.5. Using the order constraint filter allow us to find more and better matches because
the fundamental matrix is computed from all the keypoints so if there are a lot of errors this matrix is not
well approximated and there are less good matches at the end. Finally when we change the value of RANSAC parameter
around 3 there are more errors. The final values kept for the parameters are
those corresponding to the figure \ref{B7}.



\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/1}
 \caption{\label{B1} BRISK}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/2}
 \caption{\label{B2} BRISK}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/3}
 \caption{\label{B3} BRISK}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/4}
 \caption{\label{B4} BRISK}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/5}
 \caption{\label{B5} BRISK}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/6}
 \caption{\label{B6} BRISK : one error when we change RANSAC parameter}
\end{figure}

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.55]{images/pointsMatching/7}
 \caption{\label{B7} BRISK : final Result}
\end{figure}

\chapter{Skeletonization}
\section{Cutting skeleton into pieces}
To test the cutting skeleton part, we use different files ".skl". We count ourselves the number of branches which has to be found. Then, we apply the algorithm and verify that the number of branches is the same as expected. We plotted the branches with different colors: it gives an easy way to verify that there is no error with branches. To be sure of the results, numerical verifications have been made concerning the indexes of the edges composing each branch.

The following figure shows two skeletons just before branches identification. The skeletons that we used are untitled "skullTest1.skl" and "skullTest2.skl". There are very simple as they are composed of about twenty points. We build these skeletons ourselves to be able to make unitary tests. In addition, we will see in the matching branches section that these skeletons were the only ones on which we could execute the matching algorithm.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.24]{images/branchesExtraction/unbranchedSkelsTest.png}
 \caption{No color has been associated before the identification of the branches. We clearly see that six branches have to be found on each skeleton.}
\end{figure}

Then, we identify the branches starting from each junction point and going on until we find an extremity point or another junction point. It delimitates a branch.
We used the six same colors for the two skeletons to highlight the fact that the branches are not matched yet. It will be the next step.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.32]{images/branchesExtraction/branchedSkelsTest.png}
 \caption{The skeletons have been splitted into branches. A color has been associated to each branch.}
\end{figure}


\section{Matching pieces of skeleton by pairs}
The matching part revealed unexpected issues. In particular, skeletons rarely have the same number of branches on two different views. Several ways of improvement to address this issue are provided in the report.

After we took several pictures of each plushes and applied segmentation to each, we extracted the skeletons and splitted them into branches.

Results are quite unexpected: for a same plush photographed in the same conditions and with the same angles, the results can be different.

On the following figure, the two first pictures are almost identical. The segmented images are also almost identical. However, on the second picture, the left leg of the rabbit is composed of an extra branch, and the right leg is composed of a branch less. The right foreleg also contains more branches on the second picture than on the first. On the third picture, the photograph was taken closer, so the plush appears bigger. The skeleton is totally different from the two others.

These main problems occur on extremeties, but there can also be problem outside the extremities. There is a small branch separating the two arms of the rabbit on the two first pictures, whereas on the third picture, the two arms branches join on a point.

Branches extraction reveals 30 branches on the first picture, 31 on the second picture and 21 on the third one.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.38]{images/skeletonsExtraction/TestSkel00.png}
 \caption{Front rabbit pictures and skeletons}
\end{figure}

With the same plush and an other angle, the same kind of issue occur: the plush skeleton is different on each picture. Even when there seems to be the same number of branches, for example the first and the second skeletons, these branches can be different, for example on the first skeleton, the foreleg branch continues until the outline, whereas it ends earlier on the second skeleton. Third and fourth skeletons show one more time the differences near the extremities with an extra branch on the ear or a single branch foreleg.

Having different number of branches between different pictures of the same plush with the same angle is a first problem. It leads naturally to another problem: the number of branches is different between two different pictures of the same object with different angles. Even when, by chance, there is the same amount of branches of both, these branches do not really match together because there is probably an extra branch on a limb of the first picture, and an extra branch on another limb on the second picture.

Branches extraction reveals 16 branches on the first picture, 15 on the second picture, 16 on the third picture and 14 on the fourth one.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.37]{images/skeletonsExtraction/TestSkel01.png}
 \caption{Side rabbit pictures and skeletons}
\end{figure}

We tried two other plushes. For the teddybear, branches extraction reveals 17 branches on the first picture, 14 on the second, 15 on the third and 18 on the fourth.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.37]{images/skeletonsExtraction/TestSkel02.png}
 \caption{Teddy bear pictures and skeletons}
\end{figure}

For the red doll, branches extraction reveals 15 branches on the first and the second pictures, and 10 branches on the third and the fourth pictures. Even so, the first and the second skeletons cannot be matched at all.

These tests confirm how different skeletons are. The first picture never match with the other angles. The only correct matching is between the third and the forth pictures of the red doll, but they were taken with the same angle.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.42]{images/skeletonsExtraction/TestSkel03.png}
 \caption{Side rabbit pictures and skeletons}
\end{figure}

As the two skeletons do not have the same number of branches, the tests do not succeed. However, we used the same two skeletons as in the cutting skeleton part to verify that the matching branches algorithm works when it is used on two corresponding skeletons which have the same number of branches. These skeletons have been imaginated, so there is no associated picture. That is why we defined keypoints ourselves. To test the robustness of the matching branches algorithm, one of the keypoint has been designed to give a vote to a branch match between branches.

In particular, the matching matrix between the branches of the first skeleton and the branches of the second skeleton is the expected following one:

$$
\begin{pmatrix}
    0 & 5 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 5 \\
    0 & 0 & 0 & 3 & 0 & 0 \\
    0 & 0 & 3 & 0 & 0 & 0 \\
    1 & 0 & 0 & 0 & 3 & 0 \\
    4 & 0 & 0 & 0 & 0 & 0
\end{pmatrix}
$$

For the tests, the branches of the two skeletons have not been written in the same order. In the other case, we would have had a diagonal matching matrix. The first line can be read as "five pairs of matching keypoints vote for a match between the first branch of the first skeleton and the second branch of the second skeleton". The "1" in the matrix is the outlier we put to test the robustness of the algorithm.

Finally, the test revealed the following matches between the indexes of the branches in the first skeleton and the indexes of the branches in the second skeleton:

$$
\begin{pmatrix}
    0 & 1 \\
    1 & 5 \\
    2 & 4 \\
    3 & 2 \\
    4 & 3 \\
    5 & 0
\end{pmatrix}
$$

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.3]{images/branchesExtraction/pairedSkelsTest.png}
 \caption{The two sets of branches have been matched together: the colors of corresponding branches are the same.}
\end{figure}



\part{Meshing and animation}
\chapter{Meshing}
\section{Splines}
The spline is a mathematical tool to create a smooth curve from a set of
points. The following test illustrates the fact that our spline is smooth, and
that the derivative of the splines are computed right.
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.4]{images/splines/spline.png}
    \caption{A spline blue and its tangent in red}
\end{figure}

\section{Meshing the extremities}
\paragraph{} In our mesh the extremities refer to the extrem points of splines which are not part of a junction.
Meshing the extremities consists in two steps : build each extremity and subdivise it. In order to build the extremities,
we chose to link the existing meshing points along the extrem circles of each extremity with the projection of the
circle's center on the corresponding sphere. Then the subdivisions are made by projecting the middle of the previous segments (links)
on the sphere.

\paragraph{} Some results can be seen in the following Figures (All of these extremities were built on dino.skl). The deeper the subdivision
is, the smoother the extremity's surface is. We can easily choose the depth of the subdivision to adapt it according to the skeleton
in input.

\begin{table}[H]
\begin{center}
\begin{tabular}{|c|c|c|}
%begin{tabular}{|p{6cm}|p{2.8cm}|p{2.8cm}|p{3.8cm}|}
	\hline
	Depth of subdivision & Figure & Description\\
	\hline
        0 & \ref{0} & No subdivision : filled mesh\\
        \hline
        0 & \ref{0ed} & No subdivision : edges\\
        \hline
        1 & \ref{1} & One subdivision : filled mesh\\
        \hline
        1 & \ref{1ed} & One subdivision : edges\\
        \hline
        2 & \ref{meshextremity} & Triangular faces for two subdivisions\\
        \hline
        2 & \ref{2} & Two subdivisions : filled mesh\\
        \hline
        2 & \ref{2ed} & Two subdivisions : edges\\
        \hline
        10 & \ref{10} & Ten subdivisions : filled mesh\\
        \hline
        10 & \ref{10ed} & Ten subdivisions : edges\\
        \hline
\end{tabular}
\caption{\label{tblfigures} Tests on extremities}
\end{center}
\end{table}


\begin{figure}[H]
 \centering
 \includegraphics[scale=0.4]{images/extremity/meshextremity}
 \caption{\label{meshextremity} 2 subdivisions on an extremity}
\end{figure}

\begin{figure}[H]
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/0}
 \caption{\label{0} No subdivision : filled mesh}
 \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/0ed}
 \caption{\label{0ed} No subdivision : edges}
 \end{minipage}
\end{figure}

\begin{figure}[H]
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/1}
 \caption{\label{1} One subdivision : filled mesh}
 \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/1ed}
 \caption{\label{1ed} One subdivision : edges}
 \end{minipage}
\end{figure}

\begin{figure}[H]
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/2}
 \caption{\label{2} Two subdivisions : filled mesh}
 \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/2ed}
 \caption{\label{2ed} Two subdivisions : edges}
 \end{minipage}
\end{figure}

\begin{figure}[H]
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/10}
 \caption{\label{10} Ten subdivisions : filled mesh}
 \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
 \centering
 \includegraphics[scale=0.35]{images/extremity/10ed}
 \caption{\label{10ed} Ten subdivisions : edges}
 \end{minipage}
\end{figure}



\section{Meshing the junctions}

\paragraph{} Meshing junctions was the most difficult part of the meshing.
It is due to the fact that it depends a lot on the 3D-skeleton given in input and particularly quality of it in line with the theory.
In fact to give a good result it needs to respect some rules that are not completely respected because of the numbers' precision possible on computers and the approximation that come with it.
In theory to mesh a junction we get the last circle of each spline that join on that point and then we cut the circles in two and mesh the upper points of the circles with the center of the sphere corresponding to the junction projected on the up side of the sphere, idem for the down points. This is possible because consecutive circles are tangent. In reality circles are not tangent there is a little shift or they crossed themselves and we need to link the circles between them.
:
\paragraph{} However the circles need to be apart to have a good looking junction and in the real skeletons that we have it is not the case.
That is why we have created some simple examples of junction with three or four circles to join to be sure that our algorithm is working, it is easier to see than in a complete skeleton with the rest of the mesh.

Here \ref{3junction} you can see the result with 3 circles not tangent mesh with our algorithm.
\begin{figure}[H]
 \centering
 \includegraphics[scale=0.3]{images/junctions/img/test1/capture0.png}
 \includegraphics[scale=0.3]{images/junctions/img/test1/capture1.png}
 \includegraphics[scale=0.3]{images/junctions/img/test1/capture3.png}
 \caption{\label{3junction}Junction with three parts to join show from different angles}
\end{figure}

Because junctions are not always between three branches but can be between four or more branches, we need to have a algorithm that work for all possible cases. Here \ref{4junction} the result of a 4-branches' junction meshing.

\begin{figure}[H]
 \centering
 \includegraphics[scale=0.25]{images/junctions/junction4/capture0.png}
 \includegraphics[scale=0.25]{images/junctions/junction4/capture1.png}
 \includegraphics[scale=0.15]{images/junctions/junction4/capture2.png}
 \caption{\label{4junction}Junction with four parts to join show from different angles}
\end{figure}

With the skeleton made by ourself the geometrical properties that allow the circles to join without crossing themselves is not respected that is why the result is not pretty good. So the results obtained are not particularly good looking but respect the algorithm.

\begin{figure}[H]
 \centering
 \colorbox{black}{
 	\includegraphics[scale=0.1]{images/junctions/test2/capture1.png}
 	\includegraphics[scale=0.1]{images/junctions/test2/capture2.png}
 }
 \caption{Result of meshing junction on Dino.skl}
\end{figure}

And last, we have test our junction's algorithm with a 3D-skeleton computed from a real 2D skeleton. Because of the complexity of the 2D-skeleton it is not easy to see properly the junction.

\begin{figure}[H]
 \centering
 \colorbox{black}{
 	\includegraphics[scale=0.1]{images/junctions/test3/capture0.png}
 	\includegraphics[scale=0.1]{images/junctions/test3/capture1.png}
 }
 \caption{Result of meshing junction on a 3D skeleton computed from a 2D skeleton}
\end{figure}


\chapter{Animation}
\section{Clicks}
To test this part, we clicked around the skeleton. We can see that the point
added is the one which is the closest point of the spline. We can also see that
the points are in the correct order.
\begin{figure}[H]
 \centering
 	\includegraphics[scale=0.3]{images/clicks/click1.png}
 	\includegraphics[scale=0.315]{images/clicks/click2.png}
 \caption{Clicks}
\end{figure}

\section{Match vertices of the mesh with the closest branch}
The test of the matching between the vertices and the segments of the skeleton
is tested by using colors. All the vertices associated to the same segment
share the same color, and the following image shows that it works correctly
(especially the gradient of colors near the rotation points).
\begin{figure}[H]
 \centering
 	\includegraphics[scale=0.15]{images/colormesh/capture.png}
 \caption{Matching of the vertices of the mesh to the segments}
\end{figure}

\section{Renderer}
This part is only here to show the quality of the renderer and the animation,
and especially the junctions.
\begin{figure}[H]
 \centering
 	\includegraphics[scale=0.15]{images/colormesh/animated.png}
 \caption{Matching of the vertices of the mesh to the segments}
\end{figure}

\end{document}
