94 lines
3.9 KiB
TeX
94 lines
3.9 KiB
TeX
\subsection{Animation}
|
|
The objective of this part is to animate the mesh we previously generated
|
|
around the skeleton. We have as an input segments of the skeleton, and its
|
|
mesh. The idea is to deform the segments of the skeleton, and to
|
|
automatically have the impact of this deformation on the vertices of the
|
|
mesh.
|
|
|
|
\subsubsection{Trees}
|
|
When we will animate our mesh, we want to keep it as one piece. For
|
|
example, when you move your arm, your elbow and your forearm follows
|
|
the movement of your arm. This means that the transformation that we
|
|
will apply after the shoulders must be kept on the arms and forearms.
|
|
|
|
To manage to do this, we structured everything in trees. The tree for a
|
|
person will be the following for example (to simplify, we will take the
|
|
hypothesis that this human has no knees).
|
|
|
|
\begin{figure}[H]
|
|
\centering
|
|
\begin{tikzpicture}
|
|
% Head
|
|
\draw (0,0) circle [radius=1];
|
|
\draw (0,0) node{Head};
|
|
|
|
% Left son of head
|
|
\draw (0,-1) -- (-3,-2);
|
|
\draw (-3,-3) circle [radius=1];
|
|
\draw (-3,-3) node{Left arm};
|
|
|
|
% Left son of left arm
|
|
\draw (-3,-4) -- (-6,-5);
|
|
\draw (-6,-6) circle [radius=1];
|
|
\draw (-6,-6) node{Left forearm};
|
|
|
|
% Middle son
|
|
\draw ( 0,-1) -- ( 0,-2);
|
|
\draw ( 0,-3) circle [radius=1];
|
|
\draw ( 0,-3) node{Body};
|
|
|
|
% Left leg
|
|
\draw (0, -4) -- (-2, -5);
|
|
\draw ( -2,-6) circle [radius=1];
|
|
\draw ( -2,-6) node{Left leg};
|
|
|
|
% Right leg
|
|
\draw (0, -4) -- (2, -5);
|
|
\draw ( 2,-6) circle [radius=1];
|
|
\draw ( 2,-6) node{Right leg};
|
|
|
|
% Right son
|
|
\draw (0,-1) -- (3,-2);
|
|
\draw (3,-3) circle [radius=1];
|
|
\draw (3,-3) node{Right arm};
|
|
|
|
% Left son of left arm
|
|
\draw (3,-4) -- (6,-5);
|
|
\draw (6,-6) circle [radius=1];
|
|
\draw (6,-6) node{Right forearm};
|
|
|
|
\end{tikzpicture}
|
|
\caption{Tree for a human being skeleton}
|
|
\end{figure}
|
|
|
|
\paragraph{}
|
|
At each node of this, there will be a rotation (with a center, and
|
|
angles), and we will draw the animated mesh by traversing the tree.
|
|
At each node, we will apply the transformation of the current node, and
|
|
then draw the subtree.
|
|
|
|
Of course, we also need to know what faces are in each nodes, so we
|
|
will have a tree of rotations, and a tree of faces.
|
|
|
|
\subsubsection{Junctions processing}
|
|
All we said before is valid only if the three vertices of a face are
|
|
mapped to the same segment. But some faces have vertices that are
|
|
mapped to different segments. For these faces, we need to apply a
|
|
different transformation for each vertex.
|
|
|
|
For this purpose, we created a hashtable between vertex numbers and
|
|
paths in trees so that we are able to find the transformation for these
|
|
vertices.
|
|
|
|
\subsubsection{Graphical User Interface}
|
|
In order to be able to manipulate the animated mesh easily, two graphical interfaces were made :
|
|
\begin{enumerate}
|
|
\item the first one allows the user to add rotation points to the
|
|
skeleton (by default, only the junction points are considered
|
|
as rotation points, and there are no knees and elbows for
|
|
example).
|
|
\item the second one has the OpenGL rendering and a menu controlled
|
|
with the keyboard, allowing the user to select rotation points
|
|
and to change the value of the angles.
|
|
\end{enumerate}
|