- Main Page
- Namespaces
- Data Structures
- Files

- Search for |

- File List
- Globals

# HydroSDL/oGL_graphics/wave_z_compute_byHand.cpp File Reference

`#include <math.h>`
`#include "Sea.h"`

Include dependency graph for wave_z_compute_byHand.cpp:

Go to the source code of this file.

## Data Structures
struct | seaDatas
## Defines
#define | pi 3.14159265358979
#define | LUTLEN 64
#define | LUTLENF 64.0f
## Functions
void | fillWaveLuts ()
| fill sine and cosine look up tables
__inline float | Wcos (float xarg)
| Cosine approximation using LUT.
__inline float | Wsin (float xarg)
| Sine approximation using LUT.
void | wave_init ()
| Initialize and allocate memory for sea data.
void | wave_z_compute (datas *d)
| Compute sea-mesh.
void | free_wave_variables ()
| Free sea data memory.
void | Draw_sea ()
| Draws the sea.
## Variables
float | sinLUT [LUTLEN]
| Look Up Table for sine function (used for wave drawing).
float | cosLUT [LUTLEN]
| Look Up Table for cosine function (used for wave drawing).
seaDatas | seaDat
seaDatas * | sd = &seaDat

## Detailed Description

Author:
  basile.graf@epfl.ch

!!!! Wave-evaluation function in this file is not automaticaly updated by MATLAB code generation !!!!!

Definition in file wave_z_compute_byHand.cpp.

## Define Documentation

#define LUTLEN 64

Definition at line 26 of file wave_z_compute_byHand.cpp.

Referenced by fillWaveLuts().

#define LUTLENF 64.0f

Definition at line 27 of file wave_z_compute_byHand.cpp.

Referenced by fillWaveLuts(), and Wcos().

#define pi 3.14159265358979

Definition at line 25 of file wave_z_compute_byHand.cpp.

## Function Documentation

void Draw_sea | ( |  | ) |

Draws the sea.

Once initialization with wave_init() is done, and after each call of wave_z_compute(), this function can be called to actually draw the sea. The code of this function contains OpenGL code.

Definition at line 159 of file wave_z_compute_byHand.cpp.

References f(), seaDatas::L, seaDatas::N, sd, and seaDatas::z.

Referenced by DrawGLScene().

void fillWaveLuts | ( |  | ) |

fill sine and cosine look up tables

Definition at line 40 of file wave_z_compute_byHand.cpp.

References cosLUT, f(), LUTLEN, LUTLENF, pi, and sinLUT.

Referenced by wave_init().

void free_wave_variables | ( |  | ) |

Free sea data memory.

Free memory allocated by wave_init().

Definition at line 144 of file wave_z_compute_byHand.cpp.

References seaDatas::B, seaDatas::G, seaDatas::R, sd, and seaDatas::z.

Referenced by quit_tutorial().

void wave_init | ( |  | ) |

Initialize and allocate memory for sea data.

Don't forget to call free_wave_variables()

Definition at line 82 of file wave_z_compute_byHand.cpp.

References seaDatas::B, fillWaveLuts(), seaDatas::G, seaDatas::L, seaDatas::N, seaDatas::R, sd, and seaDatas::z.

Referenced by main().

void wave_z_compute | ( | datas * | d | ) |

Compute sea-mesh.

Fill the sea-mesh containig wave heigth on a mesh representing a sea square of meters using LUT functions (faster)

Parameters:

  | *d | : pointer to the datas data-structure

Definition at line 109 of file wave_z_compute_byHand.cpp.

References f(), seaDatas::L, datas::Lambda0, datas::Lambda1, datas::Lambda2, seaDatas::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 seaDatas::z.

Referenced by DrawGLScene().

__inline float Wcos | ( | float | xarg | ) |

Cosine approximation using LUT.

Parameters:

  | xarg | return result

Definition at line 56 of file wave_z_compute_byHand.cpp.

References cosLUT, LUTLENF, and pi.

Referenced by wave_z_compute(), and Wsin().

__inline float Wsin | ( | float | xarg | ) |

Sine approximation using LUT.

Parameters:

  | xarg | return result

Definition at line 72 of file wave_z_compute_byHand.cpp.

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

Referenced by wave_z_compute().

## Variable Documentation

float cosLUT[LUTLEN]

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

Definition at line 31 of file wave_z_compute_byHand.cpp.

Referenced by fillWaveLuts(), and Wcos().

seaDatas* sd = &seaDat

Definition at line 34 of file wave_z_compute_byHand.cpp.

Referenced by Draw_sea(), free_wave_variables(), wave_init(), and wave_z_compute().

seaDatas seaDat

Definition at line 33 of file wave_z_compute_byHand.cpp.

float sinLUT[LUTLEN]

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

Definition at line 30 of file wave_z_compute_byHand.cpp.

Referenced by fillWaveLuts().