Conversation
|
Thanks @holoskii for the contribution! Geodesic polyfill is an exciting addition that I think a lot of folks would use, myself included! Please bear with us as we try to find the time to properly review this PR. Some initial questions from my end:
|
c9be803 to
11cf632
Compare
Fixes / changes
PerformanceI added a dedicated geodesic benchmark that exercises small, medium, and large shapes.
Notes:
|
1.1 - Yes. 1.2 - The geodesic approach behaves better for large polygons and near poles/antimeridian due to great-circle behavior, but it’s architecturally different from the planar path; there isn’t a practical feature we can “back-port” without re-implementing substantial pieces. 2 - We only share 3 - Performance metrics are now included in the main PR comment (see “Performance” above) with the new benchmark. |
|
A few small fixes for the CI:
|
|
@isaacbrodsky was right, separate fuzzer is a way to go. Old fuzzers left not enough time until timeout in each iteration. In the last commit I've added a separate geodesic fuzzer. PR is now fully ready for review |
|
Hi @nrabinowitz @dfellis @isaacbrodsky - friendly bump on this. |
Thanks for updating the PR and for the bump! We appreciate the contribution and know we need to review this, so it's just a matter of finding time to read through it in depth. We would like to bring this in for the next release of H3. |
- rename to camelCase - rest res 0 - correct usage lat/lng -> xyz - fix reverted NY/London verts - move func below to reduce diff - test allocation failure - test mismatched holes - improve test coverage
- remove duplicate header - fix macros
fix max function
f3df47e to
bb067db
Compare
- move test to appropriate file - move comment to appropriate file
|
@holoskii Thanks for the update! I think CI is failing on the formatting assertion (needs |
My update is a bit overdue, this year has been very busy so far 😅 |
|
Resolved final issues, formatted with version 14. Should be ready for the CI 2 small issues to raise after this PR is merged:
|
|
Windows workflow failed because on 32-bit Windows systems, the math library doesn't handle NaN inputs correctly. Instead of ignoring NaN data when building a bounding box, it lets the NaN poison the BBOX. This leads to us hitting NaN down the road and failing later. I added a check at the very beginning, during polygon creation to catch invalid coordinates (NaN or Infinity). Now, we reject bad input right away with a clear error code (E_DOMAIN) instead of letting it break things further down the line. |
Summary
Adds the geodesic traversal mode to
polygonToCellsExperimental, letting us follow true great-circle edges when filling massive polygons (think continental footprints and polar caps). The PR builds the geodesic stack from the ground up—new vector math helpers, bounding caps, iterator wiring, and plenty of validation coverage—while keeping the default planar behavior unchanged (and safely rejecting geodesic flags on the legacy API).Highlights
New geodesic mode
FLAG_GEODESIC_MASK(with helpers) so callers can opt into geodesic coverage; validates acceptable containment modes (FULL,OVERLAPPING) at bothmaxPolygonToCellsSizeExperimentalandpolygonToCellsExperimental.Core geometry plumbing
GeodesicPolygonacceleration structures + helpers (geodesicPolygonCreate/Destroy, containment, boundary/cap intersection tests).latLngToVec3, cross/dot/normalize, distance helpers) and new conversions:vec3dToCell,cellToVec3,cellToGeodesicBoundary,cellToSphereCap.sphereCapTables.hfor both prod code and tests; exposesSphereCap/AABBhelpers.Iterator & polyfill updates
polyfill_iterator.h(with_extracontext) and wires ingeodesic_iterator.c.polygonToCellspath.Benchmarks, fuzzers, and tests
testGeodesicPolygonToCellsExperimental,testSphereCap,testVec3d, plus extendedtestBBoxInternal,testPolygonToCells(Experimental)flag validation, and memory-failure coverage.CMakeLists.txt/CMakeTests.cmake.Documentation
Attribution
This geodesic polyfill work originated at Yellowbrick Data (where I’m currently employed). We’re upstreaming it to the H3 project so the broader community can benefit and use it for coverage.