1 | /* |
2 | * Copyright 2016-2017 Uber Technologies, Inc. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | */ |
16 | /** @file bbox.h |
17 | * @brief Geographic bounding box functions |
18 | */ |
19 | |
20 | #ifndef BBOX_H |
21 | #define BBOX_H |
22 | |
23 | #include <stdbool.h> |
24 | #include "geoCoord.h" |
25 | |
26 | /** @struct BBox |
27 | * @brief Geographic bounding box with coordinates defined in radians |
28 | */ |
29 | typedef struct { |
30 | double north; ///< north latitude |
31 | double south; ///< south latitude |
32 | double east; ///< east longitude |
33 | double west; ///< west longitude |
34 | } BBox; |
35 | |
36 | bool bboxIsTransmeridian(const BBox* bbox); |
37 | void bboxCenter(const BBox* bbox, GeoCoord* center); |
38 | bool bboxContains(const BBox* bbox, const GeoCoord* point); |
39 | bool bboxEquals(const BBox* b1, const BBox* b2); |
40 | int bboxHexRadius(const BBox* bbox, int res); |
41 | |
42 | #endif |
43 | |