source: ether_eccad/trunk/API_EXTRACT/src/grille.h @ 68

Last change on this file since 68 was 68, checked in by cbipsl, 14 years ago

commit v1 eccad

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 839 bytes
Line 
1#ifndef  GRILLE_H_
2#define GRID_H_
3
4
5typedef struct {
6   int width;
7   int height;
8   int *datas;
9}Grid, *ptrGrid;
10
11/* structure d'une zone geographique */
12typedef struct{
13  float lonMin;
14  float lonMax;
15  float latMin;
16  float latMax;
17}Zone, *ptrZone;
18
19#define lat2y(zone, lat)\
20 (float)((zone->latMax - (lat)) / (zone->latMax - zone->latMin))
21#define lon2x(zone, lon)\
22 (float)(((lon) - zone->lonMin) / (zone->lonMax - zone->lonMin))
23
24/* conversions 0-1 -> grille */
25#define x2i(x, grid) ((int)( (float)(x) * (float)((grid)->width  -1) ))
26#define y2j(y, grid) ((int)( (float)(y) * (float)((grid)->height -1) ))
27#define i2x(i, grid) (((float)(i) + 0.5) / (float)((grid)->width  -1))
28#define j2y(j, grid) (((float)(j) + 0.5) / (float)((grid)->height -1))
29
30ptrGrid allocGrid(ind width, int height);
31voi freeGrid(wptrGrid);
32#endif //GRID_H_
Note: See TracBrowser for help on using the repository browser.