HydroSDL/oGL_graphics/solid_objects.cpp File Reference

#include "solid_objects.h"

Include dependency graph for solid_objects.cpp:

Go to the source code of this file.

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 SolidObject_compute_normals (SolidObject *so)
 Computes the normals for a SolidObject.
void SolidObject_draw (SolidObject *so)
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.
void Boat_delete ()
 Deletes the boat.
void Boat_create (datas *d)
 Creates and defines all boat related SolidObject objects.

Variables

SolidObject hullStruct
 central hydroptere hull
SolidObjecthull = &hullStruct
SolidObject rSwimmStruct
 right swimmer
SolidObjectrSwimm = &rSwimmStruct
SolidObject lSwimmStruct
 left swimmer
SolidObjectlSwimm = &lSwimmStruct
SolidObject bridgeMainStruct
 front bridge
SolidObjectbridgeMain = &bridgeMainStruct
SolidObject bridge2Struct
 bridge 2
SolidObjectbridge2 = &bridge2Struct
SolidObject mastStruct
 mast
SolidObjectmast = &mastStruct
SolidObject foilRightStruct
 right foil
SolidObjectfoilr = &foilRightStruct
SolidObject foilLeftStruct
 left foil
SolidObjectfoill = &foilLeftStruct
SolidObject yawStruct
 yaw
SolidObjectyaw = &yawStruct
SolidObject pitchStruct
 pitch
SolidObjectpitch = &pitchStruct


Detailed Description

Author:
basile.graf@epfl.ch
This file relates to all graphical objects. SolidObject 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 solid_objects.cpp.


Function Documentation

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!

Parameters:
*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.

$ v_c = v_a \times v_b $

Parameters:
*va : pointer to float array of 3 elements ($ v_a $)
*vb : pointer to float array of 3 elements ($ v_b $)
*vc : pointer to float array of 3 elements ($ v_c $)

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.

Parameters:
*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.

Parameters:
x,: slider position, $ -1.0 \leq x \leq 1.0$, 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.

$ v_n = \frac{c}{|c|}$
$ c = v_1 \times v_2 + v_2 \times v_3 + v_3 \times v_4 + v_4 \times v_1$

Parameters:
*v1 : pointer to float array of 3 elements ($ v_1 $)
*v2 : pointer to float array of 3 elements ($ v_2 $)
*v3 : pointer to float array of 3 elements ($ v_3 $)
*v4 : pointer to float array of 3 elements ($ v_4 $)
*vn : pointer to float array of 3 elements ($ v_n $)

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.

Parameters:
*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.

Parameters:
*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.

Parameters:
*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!!

Parameters:
*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 SolidObject_draw ( SolidObject so  ) 

Definition at line 228 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_draw().

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.

Parameters:
x,: cross position, $ -1.0 \leq x \leq 1.0$, clipped outside this range
y,: cross position, $ -1.0 \leq y \leq 1.0$, 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.

Parameters:
x,: slider position, $ -1.0 \leq x \leq 1.0$, clipped outside this range

Definition at line 356 of file solid_objects.cpp.

References f().

Referenced by DrawGLScene().


Variable Documentation

SolidObject* bridge2 = &bridge2Struct

Definition at line 27 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject bridge2Struct

bridge 2

Definition at line 26 of file solid_objects.cpp.

SolidObject* bridgeMain = &bridgeMainStruct

Definition at line 24 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject bridgeMainStruct

front bridge

Definition at line 23 of file solid_objects.cpp.

SolidObject* foill = &foilLeftStruct

Definition at line 36 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject foilLeftStruct

left foil

Definition at line 35 of file solid_objects.cpp.

SolidObject* foilr = &foilRightStruct

Definition at line 33 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject foilRightStruct

right foil

Definition at line 32 of file solid_objects.cpp.

SolidObject* hull = &hullStruct

Definition at line 15 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject hullStruct

central hydroptere hull

Definition at line 14 of file solid_objects.cpp.

SolidObject* lSwimm = &lSwimmStruct

Definition at line 21 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject lSwimmStruct

left swimmer

Definition at line 20 of file solid_objects.cpp.

SolidObject* mast = &mastStruct

Definition at line 30 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject mastStruct

mast

Definition at line 29 of file solid_objects.cpp.

SolidObject* pitch = &pitchStruct

Definition at line 42 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject pitchStruct

pitch

Definition at line 41 of file solid_objects.cpp.

SolidObject* rSwimm = &rSwimmStruct

Definition at line 18 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject rSwimmStruct

right swimmer

Definition at line 17 of file solid_objects.cpp.

SolidObject* yaw = &yawStruct

Definition at line 39 of file solid_objects.cpp.

Referenced by Boat_create(), Boat_delete(), and Boat_draw().

SolidObject yawStruct

yaw

Definition at line 38 of file solid_objects.cpp.


Generated on Wed Sep 20 14:30:04 2006 for hydroSDL by  doxygen 1.4.7