\hypertarget{solid__objects_8h}{
\section{D:/Basile/Visual\-Cpp\-Projects/hydro\-MEX3/hydro\-MEX3/o\-GL\_\-graphics/solid\_\-objects.h File Reference}
\label{solid__objects_8h}\index{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL_graphics/solid_objects.h@{D:/Basile/VisualCppProjects/hydroMEX3/hydroMEX3/oGL\_\-graphics/solid\_\-objects.h}}
}
{\tt \#include \char`\"{}../hydro\_\-source/Datas.h\char`\"{}}\par
{\tt \#include \char`\"{}graphics\_\-relative.h\char`\"{}}\par
{\tt \#include \char`\"{}math.h\char`\"{}}\par
{\tt \#include \char`\"{}mex.h\char`\"{}}\par


Include dependency graph for solid\_\-objects.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=364pt]{solid__objects_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=420pt]{solid__objects_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct_solid_object}{Solid\-Object}
\begin{CompactList}\small\item\em 3D object description \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{solid__objects_8h_59653144565208f986cd017ce8accacc}{Solid\-Object\_\-create} (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$so, int N, int M)
\begin{CompactList}\small\item\em Creates a solid object. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_067f2dfb7094da8f0eac9561b42ba047}{Solid\-Object\_\-delete} (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$so)
\begin{CompactList}\small\item\em Deletes a solid object. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_a5ab64f26bf1f5b1bf9a57f0ada97833}{cross\_\-product} (float $\ast$va, float $\ast$vb, float $\ast$vc)
\begin{CompactList}\small\item\em Computes the cross-product. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_11a8f8b0c5b4ecabbcab9390e5992e2d}{one\_\-normal} (float $\ast$v1, float $\ast$v2, float $\ast$v3, float $\ast$v4, float $\ast$vn)
\begin{CompactList}\small\item\em Computes normal vector for one vertex. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_db325cc23dfae772457e4b4fd48ffe90}{Boat\_\-delete} ()
\begin{CompactList}\small\item\em Deletes the boat. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_81dceb9cb9518f78a99ee6c78dc84cc2}{Solid\-Object\_\-compute\_\-normals} (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$so)
\begin{CompactList}\small\item\em Computes the normals for a \hyperlink{struct_solid_object}{Solid\-Object}. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_6b4c2c288966bb2692c0509017656ea0}{Boat\_\-create} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Creates and defines all boat related \hyperlink{struct_solid_object}{Solid\-Object} objects. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_2f28d819d61ca4d60ca0c78ba39c8c32}{Sail\_\-create\_\-and\_\-draw} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Create and draw the sail. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_785f76ac562afbb4e1665009963b228e}{Relative\-Wind\_\-draw} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Draws relative wind vector. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_e92c036a4a9e1eab55015957740f36e6}{Target\_\-draw} (float x, float y)
\begin{CompactList}\small\item\em Draws a \char`\"{}target instrument\char`\"{} on the screen. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_6a9f1c38f7da2f7e560c3e29e2fceaeb}{VSlider\_\-draw} (float x)
\begin{CompactList}\small\item\em Draws a \char`\"{}vertical slider instrument\char`\"{} on the screen. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_32d59b6583b22556df056cda02a3c808}{HSlider\_\-draw} (float x)
\begin{CompactList}\small\item\em Draws a \char`\"{}horizontal slider instrument\char`\"{} on the screen. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_53f39f9e1e74394d7a9714a5e5e8313a}{Girouette\_\-draw} (\hyperlink{structdatas}{datas} $\ast$d)
\begin{CompactList}\small\item\em Draws a girouette on the screen. \item\end{CompactList}\item 
void \hyperlink{solid__objects_8h_6ea315967f0750817445fa9d4a279dd8}{Boat\_\-draw} ()
\begin{CompactList}\small\item\em Draws the boat. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\begin{Desc}
\item[Author:]\href{mailto:basile.graf@epfl.ch}{\tt basile.graf@epfl.ch}\end{Desc}
This file relates to all graphical objects. \hyperlink{struct_solid_object}{Solid\-Object} is the 3D desription of an object like a boat hull. This file contains also functions to draw navigation instruments on the screen. 

Definition in file \hyperlink{solid__objects_8h-source}{solid\_\-objects.h}.

\subsection{Function Documentation}
\hypertarget{solid__objects_8h_6b4c2c288966bb2692c0509017656ea0}{
\index{solid_objects.h@{solid\_\-objects.h}!Boat_create@{Boat\_\-create}}
\index{Boat_create@{Boat\_\-create}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Boat\_\-create]{\setlength{\rightskip}{0pt plus 5cm}void Boat\_\-create (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{solid__objects_8h_6b4c2c288966bb2692c0509017656ea0}


Creates and defines all boat related \hyperlink{struct_solid_object}{Solid\-Object} objects. 

Create and fill all boat informations (coordinates,...) \par
 All hull coordinates are computed/defined herein. Have a look to the code! \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}


Definition at line 538 of file solid\_\-objects.cpp.

References Solid\-Object::B, bridge2, bridge\-Main, foill, foilr, Solid\-Object::G, hull, datas::Long, l\-Swimm, mast, pitch, Solid\-Object::R, r\-Swimm, Solid\-Object\_\-create(), Solid\-Object::X, datas::x\_\-yaw, Solid\-Object::Y, datas::y\_\-yaw, yaw, Solid\-Object::Z, and datas::z\_\-foils.

Referenced by mex\-Function().\hypertarget{solid__objects_8h_db325cc23dfae772457e4b4fd48ffe90}{
\index{solid_objects.h@{solid\_\-objects.h}!Boat_delete@{Boat\_\-delete}}
\index{Boat_delete@{Boat\_\-delete}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Boat\_\-delete]{\setlength{\rightskip}{0pt plus 5cm}void Boat\_\-delete ()}}
\label{solid__objects_8h_db325cc23dfae772457e4b4fd48ffe90}


Deletes the boat. 

Deletes all \hyperlink{struct_solid_object}{Solid\-Object} objects used in drawing the boat using \hyperlink{solid__objects_8cpp_067f2dfb7094da8f0eac9561b42ba047}{Solid\-Object\_\-delete()} 

Definition at line 514 of file solid\_\-objects.cpp.

References bridge2, bridge\-Main, foill, foilr, hull, l\-Swimm, mast, pitch, r\-Swimm, Solid\-Object\_\-delete(), and yaw.

Referenced by mex\-Function().\hypertarget{solid__objects_8h_6ea315967f0750817445fa9d4a279dd8}{
\index{solid_objects.h@{solid\_\-objects.h}!Boat_draw@{Boat\_\-draw}}
\index{Boat_draw@{Boat\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Boat\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void Boat\_\-draw ()}}
\label{solid__objects_8h_6ea315967f0750817445fa9d4a279dd8}


Draws the boat. 

Draws the boat once it has been created and defined by \hyperlink{solid__objects_8cpp_6b4c2c288966bb2692c0509017656ea0}{Boat\_\-create()}. This function uses calls to \hyperlink{solid__objects_8cpp_a9cbac01dcbf6ed6d3cf042a8a349aa6}{Solid\-Object\_\-draw()}. The code of this function contains Open\-GL code. 

Definition at line 494 of file solid\_\-objects.cpp.

References bridge2, bridge\-Main, foill, foilr, hull, l\-Swimm, mast, pitch, r\-Swimm, Solid\-Object\_\-draw(), and yaw.

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_a5ab64f26bf1f5b1bf9a57f0ada97833}{
\index{solid_objects.h@{solid\_\-objects.h}!cross_product@{cross\_\-product}}
\index{cross_product@{cross\_\-product}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[cross\_\-product]{\setlength{\rightskip}{0pt plus 5cm}void cross\_\-product (float $\ast$ {\em va}, float $\ast$ {\em vb}, float $\ast$ {\em vc})}}
\label{solid__objects_8h_a5ab64f26bf1f5b1bf9a57f0ada97833}


Computes the cross-product. 

$ v_c = v_a \times v_b $ \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$va}]: pointer to float array of 3 elements ($ v_a $) \item[{\em $\ast$vb}]: pointer to float array of 3 elements ($ v_b $) \item[{\em $\ast$vc}]: pointer to float array of 3 elements ($ v_c $) \end{description}
\end{Desc}


Definition at line 118 of file solid\_\-objects.cpp.

Referenced by Girouette\_\-draw(), one\_\-normal(), and Sail\_\-create\_\-and\_\-draw().\hypertarget{solid__objects_8h_53f39f9e1e74394d7a9714a5e5e8313a}{
\index{solid_objects.h@{solid\_\-objects.h}!Girouette_draw@{Girouette\_\-draw}}
\index{Girouette_draw@{Girouette\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Girouette\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void Girouette\_\-draw (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{solid__objects_8h_53f39f9e1e74394d7a9714a5e5e8313a}


Draws a girouette on the screen. 

Draws a girouette instrument indicating relative wind direction as an on screen instrument. The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}


Definition at line 402 of file solid\_\-objects.cpp.

References datas::angle\_\-girouette, cross\_\-product(), datas::dx, datas::dy, f(), datas::tan\-Angle\_\-sail, datas::Wind\_\-x, and datas::Wind\_\-y.

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_32d59b6583b22556df056cda02a3c808}{
\index{solid_objects.h@{solid\_\-objects.h}!HSlider_draw@{HSlider\_\-draw}}
\index{HSlider_draw@{HSlider\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[HSlider\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void HSlider\_\-draw (float {\em x})}}
\label{solid__objects_8h_32d59b6583b22556df056cda02a3c808}


Draws a \char`\"{}horizontal slider instrument\char`\"{} on the screen. 

Draws a horizontal slider. The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em x,:}]slider position, $ -1.0 \leq x \leq 1.0$, clipped outside this range \end{description}
\end{Desc}


Definition at line 372 of file solid\_\-objects.cpp.

References f().

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_11a8f8b0c5b4ecabbcab9390e5992e2d}{
\index{solid_objects.h@{solid\_\-objects.h}!one_normal@{one\_\-normal}}
\index{one_normal@{one\_\-normal}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[one\_\-normal]{\setlength{\rightskip}{0pt plus 5cm}void one\_\-normal (float $\ast$ {\em v1}, float $\ast$ {\em v2}, float $\ast$ {\em v3}, float $\ast$ {\em v4}, float $\ast$ {\em vn})}}
\label{solid__objects_8h_11a8f8b0c5b4ecabbcab9390e5992e2d}


Computes normal vector for one vertex. 

$ v_n = \frac{c}{|c|}$ \par
 $ c = v_1 \times v_2 + v_2 \times v_3 + v_3 \times v_4 + v_4 \times v_1$ \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$v1}]: pointer to float array of 3 elements ($ v_1 $) \item[{\em $\ast$v2}]: pointer to float array of 3 elements ($ v_2 $) \item[{\em $\ast$v3}]: pointer to float array of 3 elements ($ v_3 $) \item[{\em $\ast$v4}]: pointer to float array of 3 elements ($ v_4 $) \item[{\em $\ast$vn}]: pointer to float array of 3 elements ($ v_n $) \end{description}
\end{Desc}


Definition at line 125 of file solid\_\-objects.cpp.

References cross\_\-product(), and f().

Referenced by Solid\-Object\_\-compute\_\-normals().\hypertarget{solid__objects_8h_785f76ac562afbb4e1665009963b228e}{
\index{solid_objects.h@{solid\_\-objects.h}!RelativeWind_draw@{RelativeWind\_\-draw}}
\index{RelativeWind_draw@{RelativeWind\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[RelativeWind\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void Relative\-Wind\_\-draw (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{solid__objects_8h_785f76ac562afbb4e1665009963b228e}


Draws relative wind vector. 

Draws a relative wind vector at the top of the mast. The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}


Definition at line 292 of file solid\_\-objects.cpp.

References datas::dx, datas::dy, f(), datas::L\_\-mast, datas::phi, datas::psi, datas::theta, datas::Wind\_\-x, datas::Wind\_\-y, datas::x\_\-sail, datas::y\_\-sail, and datas::z\_\-foils.

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_2f28d819d61ca4d60ca0c78ba39c8c32}{
\index{solid_objects.h@{solid\_\-objects.h}!Sail_create_and_draw@{Sail\_\-create\_\-and\_\-draw}}
\index{Sail_create_and_draw@{Sail\_\-create\_\-and\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Sail\_\-create\_\-and\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void Sail\_\-create\_\-and\_\-draw (\hyperlink{structdatas}{datas} $\ast$ {\em d})}}
\label{solid__objects_8h_2f28d819d61ca4d60ca0c78ba39c8c32}


Create and draw the sail. 

The sail is not a \hyperlink{struct_solid_object}{Solid\-Object}. It is redefined each time it is drawn (its position relative to the boat can change). The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$d}]: pointer to the datas data-structure \end{description}
\end{Desc}


Definition at line 261 of file solid\_\-objects.cpp.

References datas::Baume, cross\_\-product(), f(), datas::L\_\-mast, datas::tan\-Angle\_\-sail, datas::x\_\-sail, datas::y\_\-sail, and datas::z\_\-foils.

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_81dceb9cb9518f78a99ee6c78dc84cc2}{
\index{solid_objects.h@{solid\_\-objects.h}!SolidObject_compute_normals@{SolidObject\_\-compute\_\-normals}}
\index{SolidObject_compute_normals@{SolidObject\_\-compute\_\-normals}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[SolidObject\_\-compute\_\-normals]{\setlength{\rightskip}{0pt plus 5cm}void Solid\-Object\_\-compute\_\-normals (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$ {\em so})}}
\label{solid__objects_8h_81dceb9cb9518f78a99ee6c78dc84cc2}


Computes the normals for a \hyperlink{struct_solid_object}{Solid\-Object}. 

Once all X-, Y- Z- coordinates of a Solid\-Objects have been defined, the vertex-normal vectors in the \hyperlink{struct_solid_object}{Solid\-Object} can be automatically filled by calling this function. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$so,:}]pointer to the \hyperlink{struct_solid_object}{Solid\-Object} \end{description}
\end{Desc}


Definition at line 155 of file solid\_\-objects.cpp.

References Solid\-Object::M, Solid\-Object::N, Solid\-Object::n\-X, Solid\-Object::n\-Y, Solid\-Object::n\-Z, one\_\-normal(), Solid\-Object::X, Solid\-Object::Y, and Solid\-Object::Z.\hypertarget{solid__objects_8h_59653144565208f986cd017ce8accacc}{
\index{solid_objects.h@{solid\_\-objects.h}!SolidObject_create@{SolidObject\_\-create}}
\index{SolidObject_create@{SolidObject\_\-create}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[SolidObject\_\-create]{\setlength{\rightskip}{0pt plus 5cm}void Solid\-Object\_\-create (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$ {\em so}, int {\em N}, int {\em M})}}
\label{solid__objects_8h_59653144565208f986cd017ce8accacc}


Creates a solid object. 

Initializes memory for a 3D object \par
 Do not forget to call \hyperlink{solid__objects_8cpp_067f2dfb7094da8f0eac9561b42ba047}{Solid\-Object\_\-delete()} for each object created once finished!! \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em $\ast$so}]pointer to a \hyperlink{struct_solid_object}{Solid\-Object} to be initialized \item[{\em N}]length of mesh 2D arrays (coordinates, normals, color) \item[{\em M}]height of mesh 2D arrays (coordinates, normals, color) \end{description}
\end{Desc}


Definition at line 46 of file solid\_\-objects.cpp.

References Solid\-Object::B, Solid\-Object::G, Solid\-Object::M, Solid\-Object::N, Solid\-Object::n\-X, Solid\-Object::n\-Y, Solid\-Object::n\-Z, Solid\-Object::R, Solid\-Object::X, Solid\-Object::Y, and Solid\-Object::Z.

Referenced by Boat\_\-create().\hypertarget{solid__objects_8h_067f2dfb7094da8f0eac9561b42ba047}{
\index{solid_objects.h@{solid\_\-objects.h}!SolidObject_delete@{SolidObject\_\-delete}}
\index{SolidObject_delete@{SolidObject\_\-delete}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[SolidObject\_\-delete]{\setlength{\rightskip}{0pt plus 5cm}void Solid\-Object\_\-delete (\hyperlink{struct_solid_object}{Solid\-Object} $\ast$ {\em so})}}
\label{solid__objects_8h_067f2dfb7094da8f0eac9561b42ba047}


Deletes a solid object. 

Free memory used by a 3D object \par
 To be used after every creation with \hyperlink{solid__objects_8cpp_59653144565208f986cd017ce8accacc}{Solid\-Object\_\-create()} 

Definition at line 82 of file solid\_\-objects.cpp.

References Solid\-Object::B, Solid\-Object::G, Solid\-Object::N, Solid\-Object::n\-X, Solid\-Object::n\-Y, Solid\-Object::n\-Z, Solid\-Object::R, Solid\-Object::X, Solid\-Object::Y, and Solid\-Object::Z.

Referenced by Boat\_\-delete().\hypertarget{solid__objects_8h_e92c036a4a9e1eab55015957740f36e6}{
\index{solid_objects.h@{solid\_\-objects.h}!Target_draw@{Target\_\-draw}}
\index{Target_draw@{Target\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[Target\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void Target\_\-draw (float {\em x}, float {\em y})}}
\label{solid__objects_8h_e92c036a4a9e1eab55015957740f36e6}


Draws a \char`\"{}target instrument\char`\"{} on the screen. 

Draws a circular target with a cross inside. The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em x,:}]cross position, $ -1.0 \leq x \leq 1.0$, clipped outside this range \item[{\em y,:}]cross position, $ -1.0 \leq y \leq 1.0$, clipped outside this range \end{description}
\end{Desc}


Definition at line 309 of file solid\_\-objects.cpp.

References f().

Referenced by Draw\-GLScene().\hypertarget{solid__objects_8h_6a9f1c38f7da2f7e560c3e29e2fceaeb}{
\index{solid_objects.h@{solid\_\-objects.h}!VSlider_draw@{VSlider\_\-draw}}
\index{VSlider_draw@{VSlider\_\-draw}!solid_objects.h@{solid\_\-objects.h}}
\subsubsection[VSlider\_\-draw]{\setlength{\rightskip}{0pt plus 5cm}void VSlider\_\-draw (float {\em x})}}
\label{solid__objects_8h_6a9f1c38f7da2f7e560c3e29e2fceaeb}


Draws a \char`\"{}vertical slider instrument\char`\"{} on the screen. 

Draws a vertical slider. The code of this function contains Open\-GL code. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em x,:}]slider position, $ -1.0 \leq x \leq 1.0$, clipped outside this range \end{description}
\end{Desc}


Definition at line 343 of file solid\_\-objects.cpp.

References f().

Referenced by Draw\-GLScene().