| 1 |
/****************************************************************************** |
| 2 |
NAME ISIN.H |
| 3 |
|
| 4 |
PURPOSE: Integerized Sinusoidal Library Header - constants, data |
| 5 |
structures and prototypes for integerized sinusoidal library |
| 6 |
functions. |
| 7 |
|
| 8 |
PROGRAMMER DATE REASON |
| 9 |
---------- ---- ------ |
| 10 |
Robert Wolfe (STX) 1-2-97 Initial version. |
| 11 |
Raj Gejjagaraguppe (ARC) 1-15-97 Modified the code to work with |
| 12 |
GCTP software. |
| 13 |
|
| 14 |
D*****************************************************************************/ |
| 15 |
|
| 16 |
|
| 17 |
#ifdef __cplusplus |
| 18 |
extern "C" { |
| 19 |
#endif |
| 20 |
|
| 21 |
/* Status returned */ |
| 22 |
|
| 23 |
#define ISIN_SUCCESS 0 /* Successful return */ |
| 24 |
#define ISIN_ERROR -1 /* Error return */ |
| 25 |
#define ISIN_ERANGE -2 /* Input variable out of range */ |
| 26 |
|
| 27 |
/* Data Structures */ |
| 28 |
|
| 29 |
/* Row Type; Information for Eash Row (longitudinal band) in Projection */ |
| 30 |
|
| 31 |
typedef struct { |
| 32 |
long ncol; /* Number of columns */ |
| 33 |
long icol_cen; /* Column number to left of center of grid */ |
| 34 |
double ncol_inv; /* Number of columns inverse */ |
| 35 |
} Isin_row_t; |
| 36 |
|
| 37 |
/* Handle Type; Values assigned in 'Isin_init' */ |
| 38 |
|
| 39 |
typedef struct { |
| 40 |
double false_east; /* Northing at projection origin */ |
| 41 |
double false_north; /* Easting at projection origin */ |
| 42 |
double sphere; /* Sphere radius (user's units) */ |
| 43 |
double sphere_inv; /* Sphere radius inverse (user's units) */ |
| 44 |
double ang_size_inv; /* Grid angular resolution inverse (1/rad)*/ |
| 45 |
long nrow; /* Number of rows (longitudinal zones) */ |
| 46 |
long nrow_half; /* Half of number of rows (longitudinal zones)*/ |
| 47 |
double ref_lon; /* Zero reference longitude (rad) */ |
| 48 |
double lon_cen_mer; /* Longitude of central meridian (rad) */ |
| 49 |
int ijustify; /* Justify flag (see Isin_init) */ |
| 50 |
double col_dist; /* Distance for one column in projection |
| 51 |
* (user's units) */ |
| 52 |
double col_dist_inv; /* Distance for one column in projection inverse |
| 53 |
* (user's units) */ |
| 54 |
Isin_row_t *row; /* Row data structure */ |
| 55 |
long key; /* Data structure key */ |
| 56 |
} Isin_t; |
| 57 |
|
| 58 |
|
| 59 |
/* Error Structure */ |
| 60 |
|
| 61 |
typedef struct { |
| 62 |
int num; /* Error number */ |
| 63 |
char *str; /* Error message */ |
| 64 |
} error_t; |
| 65 |
|
| 66 |
|
| 67 |
/* Prototypes */ |
| 68 |
|
| 69 |
/* Initialize integerized sinusoidal forward transformations */ |
| 70 |
|
| 71 |
int isinusforinit(double , double, double, double, double, double); |
| 72 |
|
| 73 |
Isin_t *Isin_for_init(double , double, double, double, long, int); |
| 74 |
|
| 75 |
/* Initialize integerized sinusoidal inverse transformations */ |
| 76 |
|
| 77 |
int isinusinvinit(double , double, double, double, double, double); |
| 78 |
|
| 79 |
Isin_t *Isin_inv_init(double , double, double, double, long, int); |
| 80 |
|
| 81 |
/* Forward mapping; converts geographic coordinates ('lon', 'lat') |
| 82 |
* to map projection coordinates ('x', 'y') */ |
| 83 |
|
| 84 |
int isinusfor(double, double, double *, double *); |
| 85 |
|
| 86 |
int Isin_fwd(const Isin_t *, double, double, double *, double *); |
| 87 |
|
| 88 |
/* Inverse mapping; converts map projection coordinates ('x', 'y') to |
| 89 |
* geographic coordinates ('lon', 'lat') */ |
| 90 |
|
| 91 |
int isinusinv(double, double, double *, double *); |
| 92 |
|
| 93 |
int Isin_inv(const Isin_t *, double, double, double *, double *); |
| 94 |
|
| 95 |
/* Deallocate the 'isin' data structure and array memory */ |
| 96 |
|
| 97 |
int Isin_for_free(Isin_t *); |
| 98 |
|
| 99 |
int Isin_inv_free(Isin_t *); |
| 100 |
|
| 101 |
/* Private function to handle errors */ |
| 102 |
|
| 103 |
static int Isin_error(const error_t *, const char *); |
| 104 |
|
| 105 |
|
| 106 |
#ifdef __cplusplus |
| 107 |
} |
| 108 |
#endif |