h3 4.2.2__tar.gz → 4.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {h3-4.2.2 → h3-4.3.0}/CHANGELOG.md +4 -1
- {h3-4.2.2 → h3-4.3.0}/PKG-INFO +2 -2
- {h3-4.2.2 → h3-4.3.0}/pyproject.toml +1 -1
- {h3-4.2.2 → h3-4.3.0}/readme.md +1 -1
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/cells.pyx +4 -40
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/h3lib.pxd +1 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/CMakeLists.txt +2 -0
- h3-4.3.0/src/h3lib/VERSION +1 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/algos.h +3 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/h3api.h.in +9 -3
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/algos.c +101 -2
- h3-4.2.2/src/h3lib/VERSION +0 -1
- {h3-4.2.2 → h3-4.3.0}/.github/workflows/build_docs.yml +0 -0
- {h3-4.2.2 → h3-4.3.0}/.github/workflows/lint_and_coverage.yml +0 -0
- {h3-4.2.2 → h3-4.3.0}/.github/workflows/tests.yml +0 -0
- {h3-4.2.2 → h3-4.3.0}/.github/workflows/wheels.yml +0 -0
- {h3-4.2.2 → h3-4.3.0}/.gitignore +0 -0
- {h3-4.2.2 → h3-4.3.0}/.gitmodules +0 -0
- {h3-4.2.2 → h3-4.3.0}/CMakeLists.txt +0 -0
- {h3-4.2.2 → h3-4.3.0}/LICENSE +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/CMakeLists.txt +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/CMakeLists.txt +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/cells.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/edges.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/edges.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/error_system.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/error_system.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/latlng.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/latlng.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/memory.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/memory.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/to_multipoly.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/util.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/util.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/vertex.pxd +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_cy/vertex.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_h3shape.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/_version.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/basic_int/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/basic_int/_convert.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/basic_str/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/basic_str/_convert.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/memview_int/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/memview_int/_convert.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/numpy_int/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3/api/numpy_int/_convert.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/LICENSE +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/README.md +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/cmake/Config.cmake.in +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/cmake/TestWrapValgrind.cmake +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/alloc.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/baseCells.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/bbox.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/constants.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/coordijk.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/directedEdge.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/faceijk.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/h3Assert.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/h3Index.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/iterators.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/latLng.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/linkedGeo.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/localij.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/mathExtensions.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/polyfill.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/polygon.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/polygonAlgos.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/vec2d.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/vec3d.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/vertex.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/include/vertexGraph.h +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/baseCells.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/bbox.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/coordijk.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/directedEdge.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/faceijk.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/h3Assert.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/h3Index.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/iterators.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/latLng.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/linkedGeo.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/localij.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/mathExtensions.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/polyfill.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/polygon.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/vec2d.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/vec3d.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/vertex.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/src/h3lib/src/h3lib/lib/vertexGraph.c +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/readme.md +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_cython/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_cython/cython_example.pyx +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_cython/test_cython.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/test_h3.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/test_polyfill.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/test_polyfill_ordering.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/test_polygon_class.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/polyfill/test_to_multipoly.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/__init__.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_api_bindings_match.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_basic_int.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_basic_str.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_collection_inputs.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_ico_faces.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_memview_int.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_apis/test_numpy_int.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_cells_and_edges.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_error_codes.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_h3.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/test_length_area.py +0 -0
- {h3-4.2.2 → h3-4.3.0}/tests/test_lib/util.py +0 -0
|
@@ -16,7 +16,10 @@ avoid adding features or APIs which do not map onto the
|
|
|
16
16
|
|
|
17
17
|
## Unreleased
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
## [4.3.0] - 2025-06-17
|
|
20
|
+
|
|
21
|
+
- Update `h3lib` to v4.3.0. (#461)
|
|
22
|
+
- Uses `gridRing` (uber/h3#1016) instead of Cython fallback logic.
|
|
20
23
|
|
|
21
24
|
## [4.2.2] - 2025-03-10
|
|
22
25
|
|
{h3-4.2.2 → h3-4.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: h3
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.0
|
|
4
4
|
Summary: Uber's hierarchical hexagonal geospatial indexing system
|
|
5
5
|
Author-Email: Uber Technologies <ajfriend@gmail.com>
|
|
6
6
|
Maintainer-Email: AJ Friend <ajfriend@gmail.com>
|
|
@@ -257,7 +257,7 @@ Description-Content-Type: text/markdown
|
|
|
257
257
|
[](https://badge.fury.io/py/h3)
|
|
258
258
|
[](https://pypistats.org/packages/h3)
|
|
259
259
|
[](https://anaconda.org/conda-forge/h3-py)
|
|
260
|
-
[](https://github.com/uber/h3/releases/tag/v4.3.0)
|
|
261
261
|
[](https://github.com/uber/h3-py/blob/master/LICENSE)
|
|
262
262
|
|
|
263
263
|
[](https://github.com/uber/h3-py/actions)
|
{h3-4.2.2 → h3-4.3.0}/readme.md
RENAMED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://badge.fury.io/py/h3)
|
|
6
6
|
[](https://pypistats.org/packages/h3)
|
|
7
7
|
[](https://anaconda.org/conda-forge/h3-py)
|
|
8
|
-
[](https://github.com/uber/h3/releases/tag/v4.3.0)
|
|
9
9
|
[](https://github.com/uber/h3-py/blob/master/LICENSE)
|
|
10
10
|
|
|
11
11
|
[](https://github.com/uber/h3-py/actions)
|
|
@@ -87,41 +87,6 @@ cpdef H3int[:] grid_disk(H3int h, int k):
|
|
|
87
87
|
return mv
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
cpdef H3int[:] _ring_fallback(H3int h, int k):
|
|
91
|
-
"""
|
|
92
|
-
`ring` tries to call `h3lib.hexRing` first; if that fails, we call
|
|
93
|
-
this function, which relies on `h3lib.kRingDistances`.
|
|
94
|
-
|
|
95
|
-
Failures for `h3lib.hexRing` happen when the algorithm runs into a pentagon.
|
|
96
|
-
"""
|
|
97
|
-
cdef:
|
|
98
|
-
int64_t n
|
|
99
|
-
int[:] distances ## todo: weird, this needs to be specified to avoid errors. cython bug?
|
|
100
|
-
|
|
101
|
-
check_cell(h)
|
|
102
|
-
check_distance(k)
|
|
103
|
-
|
|
104
|
-
check_for_error(
|
|
105
|
-
h3lib.maxGridDiskSize(k, &n)
|
|
106
|
-
)
|
|
107
|
-
hmm = H3MemoryManager(n)
|
|
108
|
-
|
|
109
|
-
# parallel array of cell distances from `h`.
|
|
110
|
-
# idea: instead of a memoryview object, have a my_mv object that can return a ptr, but does the correct logic when it has length 0
|
|
111
|
-
# then can always just return the pointer, instead of the weird &mv[0] syntax
|
|
112
|
-
distances = int_mv(n)
|
|
113
|
-
check_for_error(
|
|
114
|
-
h3lib.gridDiskDistances(h, k, hmm.ptr, &distances[0])
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
for i,v in enumerate(distances):
|
|
118
|
-
if v != k:
|
|
119
|
-
hmm.ptr[i] = 0
|
|
120
|
-
|
|
121
|
-
mv = hmm.to_mv()
|
|
122
|
-
|
|
123
|
-
return mv
|
|
124
|
-
|
|
125
90
|
cpdef H3int[:] grid_ring(H3int h, int k):
|
|
126
91
|
""" Return cells at grid distance `== k` from `h`.
|
|
127
92
|
Collection is "hollow" for k >= 1.
|
|
@@ -131,11 +96,10 @@ cpdef H3int[:] grid_ring(H3int h, int k):
|
|
|
131
96
|
|
|
132
97
|
n = 6*k if k > 0 else 1
|
|
133
98
|
hmm = H3MemoryManager(n)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
mv = hmm.to_mv()
|
|
99
|
+
check_for_error(
|
|
100
|
+
h3lib.gridRing(h, k, hmm.ptr)
|
|
101
|
+
)
|
|
102
|
+
mv = hmm.to_mv()
|
|
139
103
|
|
|
140
104
|
return mv
|
|
141
105
|
|
|
@@ -139,6 +139,7 @@ cdef extern from 'h3api.h':
|
|
|
139
139
|
H3Error localIjToCell(H3int origin, const CoordIJ *ij, uint32_t mode, H3int *out) nogil
|
|
140
140
|
|
|
141
141
|
H3Error gridDiskDistances(H3int origin, int k, H3int *out, int *distances) nogil
|
|
142
|
+
H3Error gridRing(H3int origin, int k, H3int *out) nogil
|
|
142
143
|
H3Error gridRingUnsafe(H3int origin, int k, H3int *out) nogil
|
|
143
144
|
|
|
144
145
|
H3Error areNeighborCells(H3int origin, H3int destination, int *out) nogil
|
|
@@ -242,6 +242,8 @@ set(OTHER_SOURCE_FILES
|
|
|
242
242
|
src/apps/testapps/testGetIcosahedronFaces.c
|
|
243
243
|
src/apps/testapps/testLatLng.c
|
|
244
244
|
src/apps/testapps/testLatLngInternal.c
|
|
245
|
+
src/apps/testapps/testGridRing.c
|
|
246
|
+
src/apps/testapps/testGridRingInternal.c
|
|
245
247
|
src/apps/testapps/testGridRingUnsafe.c
|
|
246
248
|
src/apps/testapps/testH3SetToVertexGraphInternal.c
|
|
247
249
|
src/apps/testapps/testBBoxInternal.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.3.0
|
|
@@ -53,4 +53,7 @@ H3Error _getEdgeHexagons(const GeoLoop *geoloop, int64_t numHexagons, int res,
|
|
|
53
53
|
// The safe gridDiskDistances algorithm.
|
|
54
54
|
H3Error _gridDiskDistancesInternal(H3Index origin, int k, H3Index *out,
|
|
55
55
|
int *distances, int64_t maxIdx, int curK);
|
|
56
|
+
|
|
57
|
+
// The safe gridRing algorithm.
|
|
58
|
+
H3Error _gridRingInternal(H3Index origin, int k, H3Index *out);
|
|
56
59
|
#endif
|
|
@@ -282,12 +282,18 @@ DECLSPEC H3Error H3_EXPORT(gridDiskDistances)(H3Index origin, int k,
|
|
|
282
282
|
H3Index *out, int *distances);
|
|
283
283
|
/** @} */
|
|
284
284
|
|
|
285
|
-
/** @defgroup
|
|
286
|
-
* Functions for
|
|
285
|
+
/** @defgroup gridRing gridRing
|
|
286
|
+
* Functions for gridRing
|
|
287
287
|
* @{
|
|
288
288
|
*/
|
|
289
|
-
/** @brief
|
|
289
|
+
/** @brief maximum number of hexagons in hollow k-ring */
|
|
290
|
+
DECLSPEC H3Error H3_EXPORT(maxGridRingSize)(int k, int64_t *out);
|
|
291
|
+
|
|
292
|
+
/** @brief hollow hexagon ring k distance from origin */
|
|
290
293
|
DECLSPEC H3Error H3_EXPORT(gridRingUnsafe)(H3Index origin, int k, H3Index *out);
|
|
294
|
+
|
|
295
|
+
/** @brief hollow hexagon ring k distance from origin */
|
|
296
|
+
DECLSPEC H3Error H3_EXPORT(gridRing)(H3Index origin, int k, H3Index *out);
|
|
291
297
|
/** @} */
|
|
292
298
|
|
|
293
299
|
/** @defgroup polygonToCells polygonToCells
|
|
@@ -334,6 +334,103 @@ H3Error H3_EXPORT(gridDiskDistancesSafe)(H3Index origin, int k, H3Index *out,
|
|
|
334
334
|
return _gridDiskDistancesInternal(origin, k, out, distances, maxIdx, 0);
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Maximum number of cells that result from the gridRing algorithm with the
|
|
339
|
+
* given k.
|
|
340
|
+
*
|
|
341
|
+
* @param k k value, k >= 0.
|
|
342
|
+
* @param out size in indexes
|
|
343
|
+
*/
|
|
344
|
+
H3Error H3_EXPORT(maxGridRingSize)(int k, int64_t *out) {
|
|
345
|
+
if (k < 0) {
|
|
346
|
+
return E_DOMAIN;
|
|
347
|
+
}
|
|
348
|
+
if (k == 0) {
|
|
349
|
+
*out = 1;
|
|
350
|
+
return E_SUCCESS;
|
|
351
|
+
}
|
|
352
|
+
*out = 6 * (int64_t)k;
|
|
353
|
+
return E_SUCCESS;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Returns the "hollow" ring of hexagons at exactly grid distance k from
|
|
358
|
+
* the origin hexagon. In particular, k=0 returns just the origin hexagon.
|
|
359
|
+
*
|
|
360
|
+
* Elements of the output array may be left zero, as can happen when crossing a
|
|
361
|
+
* pentagon.
|
|
362
|
+
*
|
|
363
|
+
* @param origin Origin location.
|
|
364
|
+
* @param k k >= 0
|
|
365
|
+
* @param out Array which must be of size 6 * k (or 1 if k == 0)
|
|
366
|
+
* @return 0 if successful; nonzero otherwise.
|
|
367
|
+
*/
|
|
368
|
+
H3Error H3_EXPORT(gridRing)(H3Index origin, int k, H3Index *out) {
|
|
369
|
+
// Optimistically try the faster gridDiskUnsafe algorithm first
|
|
370
|
+
const H3Error failed = H3_EXPORT(gridRingUnsafe)(origin, k, out);
|
|
371
|
+
if (!failed) {
|
|
372
|
+
return E_SUCCESS;
|
|
373
|
+
}
|
|
374
|
+
// Fast algo failed, fall back to slower, correct algo
|
|
375
|
+
// and also wipe out array because contents untrustworthy
|
|
376
|
+
memset(out, 0, 6 * k * sizeof(H3Index));
|
|
377
|
+
return _gridRingInternal(origin, k, out);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Internal algorithm for the safe but slow version of gridRing
|
|
382
|
+
*
|
|
383
|
+
* This function uses _gridDiskDistancesInternal to get all cells up to distance
|
|
384
|
+
* k, then filters those results to include only cells exactly at distance k.
|
|
385
|
+
*
|
|
386
|
+
* @param origin Origin cell.
|
|
387
|
+
* @param k Exact distance to filter for.
|
|
388
|
+
* @param out Array which must be of size 6 * k (or 1 if k == 0). This is where
|
|
389
|
+
* the final filtered results will be placed.
|
|
390
|
+
* @return H3Error indicating success or failure.
|
|
391
|
+
*/
|
|
392
|
+
H3Error _gridRingInternal(H3Index origin, int k, H3Index *out) {
|
|
393
|
+
// Short-circuit on 'identity' ring
|
|
394
|
+
if (k == 0) {
|
|
395
|
+
out[0] = origin;
|
|
396
|
+
return E_SUCCESS;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
int64_t maxIdx;
|
|
400
|
+
H3Error err = H3_EXPORT(maxGridDiskSize)(k, &maxIdx);
|
|
401
|
+
if (err) {
|
|
402
|
+
return err;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
H3Index *disk_out = H3_MEMORY(calloc)(maxIdx, sizeof(H3Index));
|
|
406
|
+
if (!disk_out) {
|
|
407
|
+
return E_MEMORY_ALLOC;
|
|
408
|
+
}
|
|
409
|
+
int *disk_distances = H3_MEMORY(calloc)(maxIdx, sizeof(int));
|
|
410
|
+
if (!disk_distances) {
|
|
411
|
+
H3_MEMORY(free)(disk_out);
|
|
412
|
+
return E_MEMORY_ALLOC;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
err = _gridDiskDistancesInternal(origin, k, disk_out, disk_distances,
|
|
416
|
+
maxIdx, 0);
|
|
417
|
+
if (err) {
|
|
418
|
+
H3_MEMORY(free)(disk_out);
|
|
419
|
+
H3_MEMORY(free)(disk_distances);
|
|
420
|
+
return err;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
int current_idx = 0;
|
|
424
|
+
for (int64_t i = 0; i < maxIdx; ++i) {
|
|
425
|
+
if (disk_out[i] != 0 && disk_distances[i] == k) {
|
|
426
|
+
out[current_idx++] = disk_out[i];
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
H3_MEMORY(free)(disk_out);
|
|
430
|
+
H3_MEMORY(free)(disk_distances);
|
|
431
|
+
return E_SUCCESS;
|
|
432
|
+
}
|
|
433
|
+
|
|
337
434
|
/**
|
|
338
435
|
* Returns the hexagon index neighboring the origin, in the direction dir.
|
|
339
436
|
*
|
|
@@ -690,6 +787,9 @@ H3Error H3_EXPORT(gridDisksUnsafe)(H3Index *h3Set, int length, int k,
|
|
|
690
787
|
* @return 0 if successful; nonzero otherwise.
|
|
691
788
|
*/
|
|
692
789
|
H3Error H3_EXPORT(gridRingUnsafe)(H3Index origin, int k, H3Index *out) {
|
|
790
|
+
if (k < 0) {
|
|
791
|
+
return E_DOMAIN;
|
|
792
|
+
}
|
|
693
793
|
// Short-circuit on 'identity' ring
|
|
694
794
|
if (k == 0) {
|
|
695
795
|
out[0] = origin;
|
|
@@ -755,9 +855,8 @@ H3Error H3_EXPORT(gridRingUnsafe)(H3Index origin, int k, H3Index *out) {
|
|
|
755
855
|
// failure.
|
|
756
856
|
if (lastIndex != origin) {
|
|
757
857
|
return E_PENTAGON;
|
|
758
|
-
} else {
|
|
759
|
-
return E_SUCCESS;
|
|
760
858
|
}
|
|
859
|
+
return E_SUCCESS;
|
|
761
860
|
}
|
|
762
861
|
|
|
763
862
|
/**
|
h3-4.2.2/src/h3lib/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4.2.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{h3-4.2.2 → h3-4.3.0}/.gitignore
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{h3-4.2.2 → h3-4.3.0}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|