\chapter{Streamtubes}

The last of the non-optional assignments, just as the height plots, a 3-dimensional assignment. Streamlines and streamtubes can also however be used in 2D grids if needed. \\

\section{Description}

Imagine dropping of bit of ink into the fluid and let it flow for a while. This will result in a line that shows the path a ink particle has taken. Such a path is
called a streamline. A streamtube is a 3D variant of a streamline. It consists of a number of consecutive tubes that together form a thick 3-dimensional tube. \\

Each streamtube has a beginning and an end. The starting point of a streamtube is called a seedpoint. From this seedpoint the tube will begin flowing with the
fluid. It ends after a number of frames. \\

The implemented streamtubes initially were not actually flowing trough the fluid but through a frame history. Each frame's velocity or force vector components are
stored in a history array and the streamtubes take a path trough this history. The 2D grid became a 3D grid with this new feature. \\

\section{Implementation}

Firstly the seedpoint placement was implemented. The user is able to pick an exact position for a seedpoint by with the mouse. A seedpoint is rendered as a small
sphere. From such a seedpoint either a streamline or streamtube is rendered. This is shown on figure 12. \\

\begin {center}
  \includegraphics[width=\textwidth]{streamtubes.png} \\
  Figure 12: Eight streamtubes with a rainbow colormap \\
\end {center}

The simulation also has a history array that stores up to 80 frames. The user can go back and forth in this frame history or render all 80 frames at once to get
some sort of volumetric effect of the smoke. This effect is shown in the image below (figure 13). \\

\begin {center}
  \includegraphics[width=\textwidth]{volume.png} \\
  Figure 13: volumetric render of the smoke \\
\end {center}

\section{Difficulties}

Since time was becoming an issue, the implementation of streamtubes might not be fully correct. \\
