1 // bucketutils.h -- support routines to handle fgBUCKET operations
3 // Written by Curtis Olson, started January 1998.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // (Log is kept at end of this file)
25 #ifndef _BUCKETUTILS_H
26 #define _BUCKETUTILS_H
35 int lon; // longitude (-180 to 179)
36 int lat; // latitude (-90 to 89)
42 /* Generate the unique scenery tile index containing the specified
45 The index is constructed as follows:
47 9 bits - to represent 360 degrees of longitude (-180 to 179)
48 8 bits - to represent 180 degrees of latitude (-90 to 89)
50 Each 1 degree by 1 degree tile is further broken down into an 8x8
51 grid. So we also need:
53 3 bits - to represent x (0 to 7)
54 3 bits - to represent y (0 to 7) */
55 long int fgBucketGenIndex( const fgBUCKET *p);
58 // Parse a unique scenery tile index and find the lon, lat, x, and y
59 void fgBucketParseIndex(long int index, fgBUCKET *p);
62 // Build a path name from an tile index
63 void fgBucketGenBasePath( const fgBUCKET *p, char *path);
66 // offset an bucket struct by the specified amounts in the X & Y direction
67 void fgBucketOffset(fgBUCKET *in, fgBUCKET *out, int x, int y);
70 // Given a lat/lon in degrees, find the "bucket" or tile that it falls
72 void fgBucketFind(double lon, double lat, fgBUCKET *p);
75 // Given a lat/lon, fill in the local tile index array
76 void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height);
84 #endif // _BUCKETUTILS_H
88 // Revision 1.4 1998/12/09 18:48:09 curt
89 // Use C++ style comments.
91 // Revision 1.3 1998/12/07 21:08:03 curt
92 // Added a const in a couple places to get rid of annoying compiler warnings.
94 // Revision 1.2 1998/07/04 00:46:48 curt
95 // typedef'd struct fgBUCKET.
97 // Revision 1.1 1998/04/08 23:28:59 curt
98 // Adopted Gnu automake/autoconf system.
100 // Revision 1.2 1998/01/24 00:03:28 curt
103 // Revision 1.1 1998/01/23 20:06:52 curt
104 // tileutils.* renamed to bucketutils.*
106 // Revision 1.6 1998/01/22 02:59:42 curt
107 // Changed #ifdef FILE_H to #ifdef _FILE_H
109 // Revision 1.5 1998/01/14 02:19:05 curt
110 // Makde offset_bucket visible to outside.
112 // Revision 1.4 1998/01/13 00:23:12 curt
113 // Initial changes to support loading and management of scenery tiles. Note,
114 // there's still a fair amount of work left to be done.
116 // Revision 1.3 1998/01/10 00:01:48 curt
117 // Misc api changes and tweaks.
119 // Revision 1.2 1998/01/08 02:22:28 curt
120 // Continue working on basic features.
122 // Revision 1.1 1998/01/07 23:50:52 curt
123 // "area" renamed to "tile"
125 // Revision 1.1 1998/01/07 23:23:40 curt