\hypertarget{wave__z__compute__by_hand_8cpp}{
\section{D:/Basile/Visual\-Cpp\-Projects/hydro\-MEX3/hydro\-MEX3/o\-GL\_\-graphics/wave\_\-z\_\-compute\_\-by\-Hand.cpp File Reference}
\label{wave__z__compute__by_hand_8cpp}\index{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL_graphics/wave_z_compute_byHand.cpp@{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL\_\-graphics/wave\_\-z\_\-compute\_\-byHand.cpp}}
}
{\tt \#include $<$math.h$>$}\par
{\tt \#include \char`\"{}Sea.h\char`\"{}}\par


Include dependency graph for wave\_\-z\_\-compute\_\-by\-Hand.cpp:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=361pt]{wave__z__compute__by_hand_8cpp__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structsea_datas}{sea\-Datas}
\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{wave__z__compute__by_hand_8cpp_1daf785e3f68d293c7caa1c756d5cb74}{pi}~3.14159265358979
\item 
\#define \hyperlink{wave__z__compute__by_hand_8cpp_87b8ad71993132028259bc06b0a4665d}{LUTLEN}~64
\item 
\#define \hyperlink{wave__z__compute__by_hand_8cpp_22c94c9ca7293613cc4639c9ca37daca}{LUTLENF}~64.0f
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{wave__z__compute__by_hand_8cpp_c120c74a08494279430f54650fd16386}{fill\-Wave\-Luts} ()
\begin{CompactList}\small\item\em fill sine and cosine look up tables \item\end{CompactList}\item 
\_\-\_\-inline float \hyperlink{wave__z__compute__by_hand_8cpp_5d3cab237c899444df8442c0be7c5ed2}{Wcos} (float xarg)
\begin{CompactList}\small\item\em Cosine approximation using LUT. \item\end{CompactList}\item 
\_\-\_\-inline float \hyperlink{wave__z__compute__by_hand_8cpp_f254ab55b1a3989b299a406f6aefe176}{Wsin} (float xarg)
\begin{CompactList}\small\item\em Sine approximation using LUT. \item\end{CompactList}\item 
void \hyperlink{wave__z__compute__by_hand_8cpp_39edf53f76846285d78d17753bbb1863}{wave\_\-init} ()
\begin{CompactList}\small\item\em Initialize and allocate memory for sea data. \item\end{CompactList}\item 
void \hyperlink{wave__z__compute__by_hand_8cpp_84e6ce9f2eb7a8d40438c27f6edafd9c}{wave\_\-z\_\-compute} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Compute sea-mesh. \item\end{CompactList}\item 
void \hyperlink{wave__z__compute__by_hand_8cpp_db1085a37034bc00d7e193fd7fc35929}{free\_\-wave\_\-variables} ()
\begin{CompactList}\small\item\em Free sea data memory. \item\end{CompactList}\item 
void \hyperlink{wave__z__compute__by_hand_8cpp_aaf6567b92f73893458331fd5f33b22c}{Draw\_\-sea} ()
\begin{CompactList}\small\item\em Draws the sea. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
float \hyperlink{wave__z__compute__by_hand_8cpp_e020899289587f54d1e0bd3c187182f8}{sin\-LUT} \mbox{[}LUTLEN\mbox{]}
\begin{CompactList}\small\item\em Look Up Table for sine function (used for wave drawing). \item\end{CompactList}\item 
float \hyperlink{wave__z__compute__by_hand_8cpp_388c8f1215fa6fd9e494560dc30b0380}{cos\-LUT} \mbox{[}LUTLEN\mbox{]}
\begin{CompactList}\small\item\em Look Up Table for cosine function (used for wave drawing). \item\end{CompactList}\item 
\hyperlink{structsea_datas}{sea\-Datas} \hyperlink{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}{sea\-Dat}
\item 
\hyperlink{structsea_datas}{sea\-Datas} $\ast$ \hyperlink{wave__z__compute__by_hand_8cpp_a3f75de6e41f19af3498ed4ff897142f}{sd} = \&\hyperlink{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}{sea\-Dat}
\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[Author:]\href{mailto:basile.graf@epfl.ch}{\tt basile.graf@epfl.ch}\end{Desc}
!!!! Wave-evaluation function in this file is not automaticaly updated by MATLAB code generation !!!!! 

Definition in file \hyperlink{wave__z__compute__by_hand_8cpp-source}{wave\_\-z\_\-compute\_\-by\-Hand.cpp}.

\subsection{Define Documentation}
\hypertarget{wave__z__compute__by_hand_8cpp_87b8ad71993132028259bc06b0a4665d}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!LUTLEN@{LUTLEN}}
\index{LUTLEN@{LUTLEN}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[LUTLEN]{\setlength{\rightskip}{0pt plus 5cm}\#define LUTLEN~64}}
\label{wave__z__compute__by_hand_8cpp_87b8ad71993132028259bc06b0a4665d}




Definition at line 26 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

Referenced by fill\-Wave\-Luts().\hypertarget{wave__z__compute__by_hand_8cpp_22c94c9ca7293613cc4639c9ca37daca}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!LUTLENF@{LUTLENF}}
\index{LUTLENF@{LUTLENF}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[LUTLENF]{\setlength{\rightskip}{0pt plus 5cm}\#define LUTLENF~64.0f}}
\label{wave__z__compute__by_hand_8cpp_22c94c9ca7293613cc4639c9ca37daca}




Definition at line 27 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

Referenced by fill\-Wave\-Luts(), and Wcos().\hypertarget{wave__z__compute__by_hand_8cpp_1daf785e3f68d293c7caa1c756d5cb74}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!pi@{pi}}
\index{pi@{pi}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[pi]{\setlength{\rightskip}{0pt plus 5cm}\#define pi~3.14159265358979}}
\label{wave__z__compute__by_hand_8cpp_1daf785e3f68d293c7caa1c756d5cb74}




Definition at line 25 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

\subsection{Function Documentation}
\hypertarget{wave__z__compute__by_hand_8cpp_aaf6567b92f73893458331fd5f33b22c}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!Draw_sea@{Draw\_\-sea}}
\index{Draw_sea@{Draw\_\-sea}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[Draw\_\-sea]{\setlength{\rightskip}{0pt plus 5cm}void Draw\_\-sea ()}}
\label{wave__z__compute__by_hand_8cpp_aaf6567b92f73893458331fd5f33b22c}


Draws the sea. 

Once initialization with \hyperlink{_sea_8h_39edf53f76846285d78d17753bbb1863}{wave\_\-init()} is done, and after each call of \hyperlink{_sea_8h_84e6ce9f2eb7a8d40438c27f6edafd9c}{wave\_\-z\_\-compute()}, this function can be called to actually draw the sea. The code of this function contains Open\-GL code. 

Definition at line 159 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References f(), sea\-Datas::L, sea\-Datas::N, sd, and sea\-Datas::z.

Referenced by Draw\-GLScene().\hypertarget{wave__z__compute__by_hand_8cpp_c120c74a08494279430f54650fd16386}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!fillWaveLuts@{fillWaveLuts}}
\index{fillWaveLuts@{fillWaveLuts}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[fillWaveLuts]{\setlength{\rightskip}{0pt plus 5cm}void fill\-Wave\-Luts ()}}
\label{wave__z__compute__by_hand_8cpp_c120c74a08494279430f54650fd16386}


fill sine and cosine look up tables 



Definition at line 40 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References cos\-LUT, f(), LUTLEN, LUTLENF, pi, and sin\-LUT.

Referenced by wave\_\-init().\hypertarget{wave__z__compute__by_hand_8cpp_db1085a37034bc00d7e193fd7fc35929}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!free_wave_variables@{free\_\-wave\_\-variables}}
\index{free_wave_variables@{free\_\-wave\_\-variables}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[free\_\-wave\_\-variables]{\setlength{\rightskip}{0pt plus 5cm}void free\_\-wave\_\-variables ()}}
\label{wave__z__compute__by_hand_8cpp_db1085a37034bc00d7e193fd7fc35929}


Free sea data memory. 

Free memory allocated by \hyperlink{_sea_8h_39edf53f76846285d78d17753bbb1863}{wave\_\-init()}. 

Definition at line 144 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References sea\-Datas::B, sea\-Datas::G, sea\-Datas::R, sd, and sea\-Datas::z.

Referenced by mex\-Function().\hypertarget{wave__z__compute__by_hand_8cpp_39edf53f76846285d78d17753bbb1863}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!wave_init@{wave\_\-init}}
\index{wave_init@{wave\_\-init}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[wave\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void wave\_\-init ()}}
\label{wave__z__compute__by_hand_8cpp_39edf53f76846285d78d17753bbb1863}


Initialize and allocate memory for sea data. 

Don't forget to call \hyperlink{_sea_8h_db1085a37034bc00d7e193fd7fc35929}{free\_\-wave\_\-variables()} 

Definition at line 82 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References sea\-Datas::B, fill\-Wave\-Luts(), sea\-Datas::G, sea\-Datas::L, sea\-Datas::N, sea\-Datas::R, sd, and sea\-Datas::z.

Referenced by mex\-Function().\hypertarget{wave__z__compute__by_hand_8cpp_84e6ce9f2eb7a8d40438c27f6edafd9c}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!wave_z_compute@{wave\_\-z\_\-compute}}
\index{wave_z_compute@{wave\_\-z\_\-compute}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[wave\_\-z\_\-compute]{\setlength{\rightskip}{0pt plus 5cm}void wave\_\-z\_\-compute (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{wave__z__compute__by_hand_8cpp_84e6ce9f2eb7a8d40438c27f6edafd9c}


Compute sea-mesh. 

Fill the sea-mesh containig wave heigth on a $ N \times N $ mesh representing a sea square of $ L \times L $ meters using LUT functions (faster) \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}


Definition at line 109 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References f(), sea\-Datas::L, datas::Lambda0, datas::Lambda1, datas::Lambda2, sea\-Datas::N, pi, sd, datas::t, datas::V\_\-wave0, datas::V\_\-wave1, datas::V\_\-wave2, datas::Wave\_\-amp0, datas::Wave\_\-amp1, datas::Wave\_\-amp2, datas::Wave\_\-angle0, datas::Wave\_\-angle1, datas::Wave\_\-angle2, Wcos(), Wsin(), datas::x, datas::y, and sea\-Datas::z.

Referenced by Draw\-GLScene().\hypertarget{wave__z__compute__by_hand_8cpp_5d3cab237c899444df8442c0be7c5ed2}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!Wcos@{Wcos}}
\index{Wcos@{Wcos}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[Wcos]{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-inline float Wcos (float {\em xarg})}}
\label{wave__z__compute__by_hand_8cpp_5d3cab237c899444df8442c0be7c5ed2}


Cosine approximation using LUT. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em xarg}]return result \end{description}
\end{Desc}


Definition at line 56 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References cos\-LUT, LUTLENF, and pi.

Referenced by wave\_\-z\_\-compute(), and Wsin().\hypertarget{wave__z__compute__by_hand_8cpp_f254ab55b1a3989b299a406f6aefe176}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!Wsin@{Wsin}}
\index{Wsin@{Wsin}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[Wsin]{\setlength{\rightskip}{0pt plus 5cm}\_\-\_\-inline float Wsin (float {\em xarg})}}
\label{wave__z__compute__by_hand_8cpp_f254ab55b1a3989b299a406f6aefe176}


Sine approximation using LUT. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em xarg}]return result \end{description}
\end{Desc}


Definition at line 72 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

References f(), pi, and Wcos().

Referenced by wave\_\-z\_\-compute().

\subsection{Variable Documentation}
\hypertarget{wave__z__compute__by_hand_8cpp_388c8f1215fa6fd9e494560dc30b0380}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!cosLUT@{cosLUT}}
\index{cosLUT@{cosLUT}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[cosLUT]{\setlength{\rightskip}{0pt plus 5cm}float \hyperlink{wave__z__compute__by_hand_8cpp_388c8f1215fa6fd9e494560dc30b0380}{cos\-LUT}\mbox{[}LUTLEN\mbox{]}}}
\label{wave__z__compute__by_hand_8cpp_388c8f1215fa6fd9e494560dc30b0380}


Look Up Table for cosine function (used for wave drawing). 



Definition at line 31 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

Referenced by fill\-Wave\-Luts(), and Wcos().\hypertarget{wave__z__compute__by_hand_8cpp_a3f75de6e41f19af3498ed4ff897142f}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!sd@{sd}}
\index{sd@{sd}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[sd]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structsea_datas}{sea\-Datas}$\ast$ \hyperlink{wave__z__compute__by_hand_8cpp_a3f75de6e41f19af3498ed4ff897142f}{sd} = \&\hyperlink{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}{sea\-Dat}}}
\label{wave__z__compute__by_hand_8cpp_a3f75de6e41f19af3498ed4ff897142f}




Definition at line 34 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

Referenced by Draw\_\-sea(), free\_\-wave\_\-variables(), wave\_\-init(), and wave\_\-z\_\-compute().\hypertarget{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!seaDat@{seaDat}}
\index{seaDat@{seaDat}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[seaDat]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{structsea_datas}{sea\-Datas} \hyperlink{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}{sea\-Dat}}}
\label{wave__z__compute__by_hand_8cpp_73033db00119afc5ce0b6b6725cf8531}




Definition at line 33 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.\hypertarget{wave__z__compute__by_hand_8cpp_e020899289587f54d1e0bd3c187182f8}{
\index{wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}!sinLUT@{sinLUT}}
\index{sinLUT@{sinLUT}!wave_z_compute_byHand.cpp@{wave\_\-z\_\-compute\_\-by\-Hand.cpp}}
\subsubsection[sinLUT]{\setlength{\rightskip}{0pt plus 5cm}float \hyperlink{wave__z__compute__by_hand_8cpp_e020899289587f54d1e0bd3c187182f8}{sin\-LUT}\mbox{[}LUTLEN\mbox{]}}}
\label{wave__z__compute__by_hand_8cpp_e020899289587f54d1e0bd3c187182f8}


Look Up Table for sine function (used for wave drawing). 



Definition at line 30 of file wave\_\-z\_\-compute\_\-by\-Hand.cpp.

Referenced by fill\-Wave\-Luts().