#include "../hydro_source/Datas.h"#include "graphics_relative.h"#include "math.h"#include "mex.h"Include dependency graph for solid_objects.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | SolidObject |
| 3D object description More... | |
Functions | |
| void | SolidObject_create (SolidObject *so, int N, int M) |
| Creates a solid object. | |
| void | SolidObject_delete (SolidObject *so) |
| Deletes a solid object. | |
| void | cross_product (float *va, float *vb, float *vc) |
| Computes the cross-product. | |
| void | one_normal (float *v1, float *v2, float *v3, float *v4, float *vn) |
| Computes normal vector for one vertex. | |
| void | Boat_delete () |
| Deletes the boat. | |
| void | SolidObject_compute_normals (SolidObject *so) |
| Computes the normals for a SolidObject. | |
| void | Boat_create (datas *d) |
| Creates and defines all boat related SolidObject objects. | |
| void | Sail_create_and_draw (datas *d) |
| Create and draw the sail. | |
| void | RelativeWind_draw (datas *d) |
| Draws relative wind vector. | |
| void | Target_draw (float x, float y) |
| Draws a "target instrument" on the screen. | |
| void | VSlider_draw (float x) |
| Draws a "vertical slider instrument" on the screen. | |
| void | HSlider_draw (float x) |
| Draws a "horizontal slider instrument" on the screen. | |
| void | Girouette_draw (datas *d) |
| Draws a girouette on the screen. | |
| void | Boat_draw () |
| Draws the boat. | |
Definition in file solid_objects.h.
| void Boat_create | ( | datas * | d | ) |
Creates and defines all boat related SolidObject objects.
Create and fill all boat informations (coordinates,...)
All hull coordinates are computed/defined herein. Have a look to the code!
| *d | : pointer to the datas data-structure |
Definition at line 552 of file solid_objects.cpp.
References datas::alpha_left, datas::alpha_right, SolidObject::B, bridge2, bridgeMain, datas::Chord_max, datas::Chord_min, datas::Chord_pitch, datas::Chord_yaw, datas::E_foils, datas::E_yaw, datas::Env_pitch, foill, foilr, SolidObject::G, hull, datas::L_mast, datas::Long, lSwimm, mast, SolidObject::nX, SolidObject::nY, SolidObject::nZ, pitch, SolidObject::R, rSwimm, SolidObject_compute_normals(), SolidObject_create(), SolidObject::X, datas::x_foils, datas::x_pitch, datas::x_sail, datas::x_yaw, SolidObject::Y, datas::y_foil_left, datas::y_foil_right, datas::y_pitch, datas::y_sail, datas::y_yaw, yaw, SolidObject::Z, datas::z_foils, datas::z_pitch, and datas::z_yaw.
Referenced by main().
| void Boat_delete | ( | ) |
Deletes the boat.
Deletes all SolidObject objects used in drawing the boat using SolidObject_delete()
Definition at line 528 of file solid_objects.cpp.
References bridge2, bridgeMain, foill, foilr, hull, lSwimm, mast, pitch, rSwimm, SolidObject_delete(), and yaw.
Referenced by quit_tutorial().
| void Boat_draw | ( | ) |
Draws the boat.
Draws the boat once it has been created and defined by Boat_create(). This function uses calls to SolidObject_draw(). The code of this function contains OpenGL code.
Definition at line 508 of file solid_objects.cpp.
References bridge2, bridgeMain, foill, foilr, hull, lSwimm, mast, pitch, rSwimm, SolidObject_draw(), and yaw.
Referenced by DrawGLScene().
| void cross_product | ( | float * | va, | |
| float * | vb, | |||
| float * | vc | |||
| ) |
Computes the cross-product.
| *va | : pointer to float array of 3 elements ( ) | |
| *vb | : pointer to float array of 3 elements ( ) | |
| *vc | : pointer to float array of 3 elements ( ) |
Definition at line 118 of file solid_objects.cpp.
Referenced by Girouette_draw(), one_normal(), and Sail_create_and_draw().
| void Girouette_draw | ( | datas * | d | ) |
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 OpenGL code.
| *d | : pointer to the datas data-structure |
Definition at line 415 of file solid_objects.cpp.
References datas::angle_girouette, cross_product(), datas::dx, datas::dy, f(), datas::tanAngle_sail, datas::Wind_x, and datas::Wind_y.
Referenced by DrawGLScene().
| void HSlider_draw | ( | float | x | ) |
Draws a "horizontal slider instrument" on the screen.
Draws a horizontal slider. The code of this function contains OpenGL code.
| x,: | slider position, , clipped outside this range |
Definition at line 385 of file solid_objects.cpp.
References f().
Referenced by DrawGLScene().
| void one_normal | ( | float * | v1, | |
| float * | v2, | |||
| float * | v3, | |||
| float * | v4, | |||
| float * | vn | |||
| ) |
Computes normal vector for one vertex.
| *v1 | : pointer to float array of 3 elements ( ) | |
| *v2 | : pointer to float array of 3 elements ( ) | |
| *v3 | : pointer to float array of 3 elements ( ) | |
| *v4 | : pointer to float array of 3 elements ( ) | |
| *vn | : pointer to float array of 3 elements ( ) |
Definition at line 125 of file solid_objects.cpp.
References cross_product(), and f().
Referenced by SolidObject_compute_normals().
| void RelativeWind_draw | ( | datas * | d | ) |
Draws relative wind vector.
Draws a relative wind vector at the top of the mast. The code of this function contains OpenGL code.
| *d | : pointer to the datas data-structure |
Definition at line 305 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 DrawGLScene().
| void Sail_create_and_draw | ( | datas * | d | ) |
Create and draw the sail.
The sail is not a SolidObject. It is redefined each time it is drawn (its position relative to the boat can change). The code of this function contains OpenGL code.
| *d | : pointer to the datas data-structure |
Definition at line 261 of file solid_objects.cpp.
References datas::Baume, cross_product(), f(), get_texture(), datas::L_mast, datas::tanAngle_sail, texture, datas::x_sail, datas::y_sail, and datas::z_foils.
Referenced by DrawGLScene().
| void SolidObject_compute_normals | ( | SolidObject * | so | ) |
Computes the normals for a SolidObject.
Once all X-, Y- Z- coordinates of a SolidObjects have been defined, the vertex-normal vectors in the SolidObject can be automatically filled by calling this function.
| *so,: | pointer to the SolidObject |
Definition at line 155 of file solid_objects.cpp.
References SolidObject::M, SolidObject::N, SolidObject::nX, SolidObject::nY, SolidObject::nZ, one_normal(), SolidObject::X, SolidObject::Y, and SolidObject::Z.
Referenced by Boat_create().
| void SolidObject_create | ( | SolidObject * | so, | |
| int | N, | |||
| int | M | |||
| ) |
Creates a solid object.
Initializes memory for a 3D object
Do not forget to call SolidObject_delete() for each object created once finished!!
| *so | pointer to a SolidObject to be initialized | |
| N | length of mesh 2D arrays (coordinates, normals, color) | |
| M | height of mesh 2D arrays (coordinates, normals, color) |
Definition at line 46 of file solid_objects.cpp.
References SolidObject::B, SolidObject::G, SolidObject::M, SolidObject::N, SolidObject::nX, SolidObject::nY, SolidObject::nZ, SolidObject::R, SolidObject::X, SolidObject::Y, and SolidObject::Z.
Referenced by Boat_create().
| void SolidObject_delete | ( | SolidObject * | so | ) |
Deletes a solid object.
Free memory used by a 3D object
To be used after every creation with SolidObject_create()
Definition at line 82 of file solid_objects.cpp.
References SolidObject::B, SolidObject::G, SolidObject::N, SolidObject::nX, SolidObject::nY, SolidObject::nZ, SolidObject::R, SolidObject::X, SolidObject::Y, and SolidObject::Z.
Referenced by Boat_delete().
| void Target_draw | ( | float | x, | |
| float | y | |||
| ) |
Draws a "target instrument" on the screen.
Draws a circular target with a cross inside. The code of this function contains OpenGL code.
| x,: | cross position, , clipped outside this range | |
| y,: | cross position, , clipped outside this range |
Definition at line 322 of file solid_objects.cpp.
References f().
Referenced by DrawGLScene().
| void VSlider_draw | ( | float | x | ) |
Draws a "vertical slider instrument" on the screen.
Draws a vertical slider. The code of this function contains OpenGL code.
| x,: | slider position, , clipped outside this range |
Definition at line 356 of file solid_objects.cpp.
References f().
Referenced by DrawGLScene().
1.4.7