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
32 int lon; /* longitude (-180 to 179) */
33 int lat; /* latitude (-90 to 89) */
34 int x; /* x (0 to 7) */
35 int y; /* y (0 to 7) */
39 /* Generate the unique scenery tile index containing the specified
42 The index is constructed as follows:
44 9 bits - to represent 360 degrees of longitude (-180 to 179)
45 8 bits - to represent 180 degrees of latitude (-90 to 89)
47 Each 1 degree by 1 degree tile is further broken down into an 8x8
48 grid. So we also need:
50 3 bits - to represent x (0 to 7)
51 3 bits - to represent y (0 to 7) */
52 long int fgBucketGenIndex(struct fgBUCKET *p);
55 /* Parse a unique scenery tile index and find the lon, lat, x, and y */
56 void fgBucketParseIndex(long int index, struct fgBUCKET *p);
59 /* Build a path name from an tile index */
60 void fgBucketGenBasePath(struct fgBUCKET *p, char *path);
63 /* offset an bucket struct by the specified amounts in the X & Y direction */
64 void fgBucketOffset(struct fgBUCKET *in, struct fgBUCKET *out, int x, int y);
67 /* Given a lat/lon, find the "bucket" or tile that it falls within */
68 void fgBucketFind(double lon, double lat, struct fgBUCKET *p);
71 /* Given a lat/lon, fill in the local tile index array */
72 void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles,
73 int width, int height);
76 #endif /* _BUCKETUTILS_H */
80 /* Revision 1.2 1998/01/24 00:03:28 curt
83 * Revision 1.1 1998/01/23 20:06:52 curt
84 * tileutils.* renamed to bucketutils.*
86 * Revision 1.6 1998/01/22 02:59:42 curt
87 * Changed #ifdef FILE_H to #ifdef _FILE_H
89 * Revision 1.5 1998/01/14 02:19:05 curt
90 * Makde offset_bucket visible to outside.
92 * Revision 1.4 1998/01/13 00:23:12 curt
93 * Initial changes to support loading and management of scenery tiles. Note,
94 * there's still a fair amount of work left to be done.
96 * Revision 1.3 1998/01/10 00:01:48 curt
97 * Misc api changes and tweaks.
99 * Revision 1.2 1998/01/08 02:22:28 curt
100 * Continue working on basic features.
102 * Revision 1.1 1998/01/07 23:50:52 curt
103 * "area" renamed to "tile"
105 * Revision 1.1 1998/01/07 23:23:40 curt