1 /**************************************************************************
2 * bucketutils.h -- support routines to handle fgBUCKET operations
4 * Written by Curtis Olson, started January 1998.
6 * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
24 **************************************************************************/
27 #ifndef _BUCKETUTILS_H
28 #define _BUCKETUTILS_H
37 int lon; /* longitude (-180 to 179) */
38 int lat; /* latitude (-90 to 89) */
39 int x; /* x (0 to 7) */
40 int y; /* y (0 to 7) */
44 /* Generate the unique scenery tile index containing the specified
47 The index is constructed as follows:
49 9 bits - to represent 360 degrees of longitude (-180 to 179)
50 8 bits - to represent 180 degrees of latitude (-90 to 89)
52 Each 1 degree by 1 degree tile is further broken down into an 8x8
53 grid. So we also need:
55 3 bits - to represent x (0 to 7)
56 3 bits - to represent y (0 to 7) */
57 long int fgBucketGenIndex(struct fgBUCKET *p);
60 /* Parse a unique scenery tile index and find the lon, lat, x, and y */
61 void fgBucketParseIndex(long int index, struct fgBUCKET *p);
64 /* Build a path name from an tile index */
65 void fgBucketGenBasePath(struct fgBUCKET *p, char *path);
68 /* offset an bucket struct by the specified amounts in the X & Y direction */
69 void fgBucketOffset(struct fgBUCKET *in, struct fgBUCKET *out, int x, int y);
72 /* Given a lat/lon, find the "bucket" or tile that it falls within */
73 void fgBucketFind(double lon, double lat, struct fgBUCKET *p);
76 /* Given a lat/lon, fill in the local tile index array */
77 void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles,
78 int width, int height);
86 #endif /* _BUCKETUTILS_H */
90 /* Revision 1.1 1998/04/08 23:28:59 curt
91 /* Adopted Gnu automake/autoconf system.
93 * Revision 1.2 1998/01/24 00:03:28 curt
96 * Revision 1.1 1998/01/23 20:06:52 curt
97 * tileutils.* renamed to bucketutils.*
99 * Revision 1.6 1998/01/22 02:59:42 curt
100 * Changed #ifdef FILE_H to #ifdef _FILE_H
102 * Revision 1.5 1998/01/14 02:19:05 curt
103 * Makde offset_bucket visible to outside.
105 * Revision 1.4 1998/01/13 00:23:12 curt
106 * Initial changes to support loading and management of scenery tiles. Note,
107 * there's still a fair amount of work left to be done.
109 * Revision 1.3 1998/01/10 00:01:48 curt
110 * Misc api changes and tweaks.
112 * Revision 1.2 1998/01/08 02:22:28 curt
113 * Continue working on basic features.
115 * Revision 1.1 1998/01/07 23:50:52 curt
116 * "area" renamed to "tile"
118 * Revision 1.1 1998/01/07 23:23:40 curt