feat: add pure-Go measures (cell area, distance, averages) to x/h3go - #126
Open
justinhwang wants to merge 3 commits into
Open
feat: add pure-Go measures (cell area, distance, averages) to x/h3go#126justinhwang wants to merge 3 commits into
justinhwang wants to merge 3 commits into
Conversation
Implement the reverse projection pipeline in pure Go: CellToLatLng (+ Cell.LatLng) and CellToBoundary (+ Cell.Boundary), with the supporting FaceIJK/coordIJK/vec2d/vec3d geometry, substrate grids, and overage adjustment. Verified against the cgo reference via paritytest and by LatLngToCell round-trips, with regression cases ported from the C tests. Refactors applied across the package: - Convert input-parameter helpers to methods on their natural receiver type, with one canonical receiver name per type. - Inline pure-delegation unexported helpers into their exported methods (resolution, baseCellNumber, isPentagon); collapse isValid's guard in. - Add isResClassIII(res) helper, replacing scattered %2 == 1 checks. - Exclude mnd for x/h3go via path-scoped .golangci.yml rule (geometric and bit-layout constants are inherent, not magic) and drop the now-unused //nolint:mnd directives; keep gosec. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Port the measures cluster to pure Go: CellAreaRads2/Km2/M2 (Cagnoli signed-area sum over the cell boundary with Kahan compensated summation), GreatCircleDistanceRads/Km/M (haversine), and the per-resolution average helpers HexagonAreaAvgKm2/M2 and HexagonEdgeLengthAvgKm/M. Verified against the cgo reference via paritytest. Cross-implementation area parity uses a relative tolerance: Go's math and C's libm differ by a few ULPs in the transcendental functions, which grows to ~1e-6 relative at the finest resolution. EdgeLengthRads/Km/M are deferred to the directed-edge phase, which they depend on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 30594576450Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
isaacbrodsky
requested review from
ajfriend,
dfellis,
isaacbrodsky,
jogly and
nrabinowitz
July 29, 2026 16:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port the measures cluster to pure Go: CellAreaRads2/Km2/M2 (Cagnoli signed-area sum over the cell boundary with Kahan compensated summation), GreatCircleDistanceRads/Km/M (haversine), and the per-resolution average helpers HexagonAreaAvgKm2/M2 and HexagonEdgeLengthAvgKm/M.
Verified against the cgo reference via paritytest. Cross-implementation area parity uses a relative tolerance: Go's math and C's libm differ by a few ULPs in the transcendental functions, which grows to ~1e-6 relative at the finest resolution.
EdgeLengthRads/Km/M are deferred to the directed-edge phase, which they depend on.