typedef'd struct fgBUCKET.

This commit is contained in:
curt 1998-07-04 00:46:47 +00:00
parent a76904c314
commit 4205c0a38d
2 changed files with 30 additions and 24 deletions

View File

@ -45,7 +45,7 @@
3 bits - to represent x (0 to 7) 3 bits - to represent x (0 to 7)
3 bits - to represent y (0 to 7) */ 3 bits - to represent y (0 to 7) */
long int fgBucketGenIndex(struct fgBUCKET *p) { long int fgBucketGenIndex(fgBUCKET *p) {
long index = 0; long index = 0;
index = ((p->lon + 180) << 14) + ((p->lat + 90) << 6) + (p->y << 3) + p->x; index = ((p->lon + 180) << 14) + ((p->lat + 90) << 6) + (p->y << 3) + p->x;
@ -56,7 +56,7 @@ long int fgBucketGenIndex(struct fgBUCKET *p) {
/* Parse a unique scenery tile index and find the lon, lat, x, and y */ /* Parse a unique scenery tile index and find the lon, lat, x, and y */
void fgBucketParseIndex(long int index, struct fgBUCKET *p) { void fgBucketParseIndex(long int index, fgBUCKET *p) {
p->lon = index >> 14; p->lon = index >> 14;
index -= p->lon << 14; index -= p->lon << 14;
p->lon -= 180; p->lon -= 180;
@ -73,7 +73,7 @@ void fgBucketParseIndex(long int index, struct fgBUCKET *p) {
/* Build a path name from an tile index */ /* Build a path name from an tile index */
void fgBucketGenBasePath(struct fgBUCKET *p, char *path) { void fgBucketGenBasePath(fgBUCKET *p, char *path) {
long int index; long int index;
int top_lon, top_lat, main_lon, main_lat; int top_lon, top_lat, main_lon, main_lat;
char hem, pole; char hem, pole;
@ -121,7 +121,7 @@ void fgBucketGenBasePath(struct fgBUCKET *p, char *path) {
/* offset an bucket struct by the specified amounts in the X & Y direction */ /* offset an bucket struct by the specified amounts in the X & Y direction */
void fgBucketOffset(struct fgBUCKET *in, struct fgBUCKET *out, int x, int y) { void fgBucketOffset(fgBUCKET *in, fgBUCKET *out, int x, int y) {
int diff, temp; int diff, temp;
int dist_lat; int dist_lat;
@ -176,8 +176,9 @@ void fgBucketOffset(struct fgBUCKET *in, struct fgBUCKET *out, int x, int y) {
} }
/* Given a lat/lon, find the "bucket" or tile that it falls within */ /* Given a lat/lon in degrees, find the "bucket" or tile that it falls
void fgBucketFind(double lon, double lat, struct fgBUCKET *p) { within */
void fgBucketFind(double lon, double lat, fgBUCKET *p) {
double diff; double diff;
diff = lon - (double)(int)lon; diff = lon - (double)(int)lon;
@ -206,9 +207,8 @@ void fgBucketFind(double lon, double lat, struct fgBUCKET *p) {
/* Given a lat/lon, fill in the local tile index array */ /* Given a lat/lon, fill in the local tile index array */
void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles, void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height) {
int width, int height) { fgBUCKET *p2;
struct fgBUCKET *p2;
int dw, dh, i, j; int dw, dh, i, j;
dh = height / 2; dh = height / 2;
@ -227,7 +227,7 @@ void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles,
/* sample main for testing /* sample main for testing
int main() { int main() {
struct fgBUCKET p1; fgBUCKET p1;
long int tile[49]; long int tile[49];
char path[256]; char path[256];
double lon, lat; double lon, lat;
@ -267,9 +267,12 @@ int main() {
/* $Log$ /* $Log$
/* Revision 1.2 1998/04/25 22:06:22 curt /* Revision 1.3 1998/07/04 00:46:47 curt
/* Edited cvs log messages in source files ... bad bad bad! /* typedef'd struct fgBUCKET.
/* /*
* Revision 1.2 1998/04/25 22:06:22 curt
* Edited cvs log messages in source files ... bad bad bad!
*
* Revision 1.1 1998/04/08 23:28:58 curt * Revision 1.1 1998/04/08 23:28:58 curt
* Adopted Gnu automake/autoconf system. * Adopted Gnu automake/autoconf system.
* *

View File

@ -33,12 +33,12 @@ extern "C" {
#endif #endif
struct fgBUCKET { typedef struct {
int lon; /* longitude (-180 to 179) */ int lon; /* longitude (-180 to 179) */
int lat; /* latitude (-90 to 89) */ int lat; /* latitude (-90 to 89) */
int x; /* x (0 to 7) */ int x; /* x (0 to 7) */
int y; /* y (0 to 7) */ int y; /* y (0 to 7) */
}; } fgBUCKET;
/* Generate the unique scenery tile index containing the specified /* Generate the unique scenery tile index containing the specified
@ -54,28 +54,28 @@ struct fgBUCKET {
3 bits - to represent x (0 to 7) 3 bits - to represent x (0 to 7)
3 bits - to represent y (0 to 7) */ 3 bits - to represent y (0 to 7) */
long int fgBucketGenIndex(struct fgBUCKET *p); long int fgBucketGenIndex(fgBUCKET *p);
/* Parse a unique scenery tile index and find the lon, lat, x, and y */ /* Parse a unique scenery tile index and find the lon, lat, x, and y */
void fgBucketParseIndex(long int index, struct fgBUCKET *p); void fgBucketParseIndex(long int index, fgBUCKET *p);
/* Build a path name from an tile index */ /* Build a path name from an tile index */
void fgBucketGenBasePath(struct fgBUCKET *p, char *path); void fgBucketGenBasePath(fgBUCKET *p, char *path);
/* offset an bucket struct by the specified amounts in the X & Y direction */ /* offset an bucket struct by the specified amounts in the X & Y direction */
void fgBucketOffset(struct fgBUCKET *in, struct fgBUCKET *out, int x, int y); void fgBucketOffset(fgBUCKET *in, fgBUCKET *out, int x, int y);
/* Given a lat/lon, find the "bucket" or tile that it falls within */ /* Given a lat/lon in degrees, find the "bucket" or tile that it falls
void fgBucketFind(double lon, double lat, struct fgBUCKET *p); within */
void fgBucketFind(double lon, double lat, fgBUCKET *p);
/* Given a lat/lon, fill in the local tile index array */ /* Given a lat/lon, fill in the local tile index array */
void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles, void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height);
int width, int height);
#ifdef __cplusplus #ifdef __cplusplus
@ -87,9 +87,12 @@ void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles,
/* $Log$ /* $Log$
/* Revision 1.1 1998/04/08 23:28:59 curt /* Revision 1.2 1998/07/04 00:46:48 curt
/* Adopted Gnu automake/autoconf system. /* typedef'd struct fgBUCKET.
/* /*
* Revision 1.1 1998/04/08 23:28:59 curt
* Adopted Gnu automake/autoconf system.
*
* Revision 1.2 1998/01/24 00:03:28 curt * Revision 1.2 1998/01/24 00:03:28 curt
* Initial revision. * Initial revision.
* *