• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / h3-go
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: justinhwang/forward-gnomonic-opt
DEFAULT BRANCH: master
Repo Added 18 Sep 2018 05:56PM UTC
Files 18
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH justinhwang/forward-gnomonic-opt
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • bench-ranges
  • chore-upgrade-h3-core
  • feat-add-error-codes
  • feat/latlng-to-cells-batch
  • gilley/adopt-modules
  • gilley/test-str
  • gilley/travis
  • joegilley-patch-2
  • joegilley-patch-3
  • justinhwang/4.3
  • justinhwang/4.5
  • justinhwang/bindings
  • justinhwang/bit
  • justinhwang/bump
  • justinhwang/changelog
  • justinhwang/coverage
  • justinhwang/doc
  • justinhwang/docs
  • justinhwang/edge
  • justinhwang/err
  • justinhwang/forward-gnomonic-opt
  • justinhwang/from_string
  • justinhwang/generics
  • justinhwang/github
  • justinhwang/greatcircle
  • justinhwang/griddiskunsafe
  • justinhwang/gridring
  • justinhwang/indexdigit
  • justinhwang/intpow
  • justinhwang/latlngcell
  • justinhwang/latlngstr
  • justinhwang/numverts
  • justinhwang/paritytest-benchmarks
  • justinhwang/purego-phase-a
  • justinhwang/purego-phase-b
  • justinhwang/purego-phase-c
  • justinhwang/purego-phase-d
  • justinhwang/purego-phase-e
  • justinhwang/purego-phase-f
  • justinhwang/purego-phase-g
  • justinhwang/readme
  • justinhwang/remove-h3core
  • justinhwang/stack
  • justinhwang/tostring
  • justinhwang/tovec3-projection-opt
  • justinhwang/unsafe
  • justinhwang/vertex
  • maintainer-banner
  • master
  • refs/tags/v3.7.0
  • refs/tags/v3.7.1
  • refs/tags/v4.0.0
  • refs/tags/v4.0.1
  • refs/tags/v4.1.0
  • refs/tags/v4.1.1
  • refs/tags/v4.1.2
  • refs/tags/v4.2.0
  • refs/tags/v4.2.1
  • refs/tags/v4.2.2
  • refs/tags/v4.2.3
  • refs/tags/v4.2.4
  • refs/tags/v4.3.0
  • refs/tags/v4.4.0
  • refs/tags/v4.4.1
  • refs/tags/v4.5.0
  • update-h3
  • upgrade-github-actions-node24
  • v3.0.0
  • v3.0.1
  • v3.0.2
  • v4
  • vscode
  • zcoleman/exposing-polygontocells-containment
  • zcoleman/issue-78

18 Jun 2026 04:57AM UTC coverage: 100.0%. Remained the same
27738291857

Pull #134

github

justinhwang
perf: fold forward gnomonic projection (toHex2d) into algebra

toHex2d is the forward gnomonic projection behind LatLngToCell, PolygonToCells,
and local-IJ -> cell. Like the earlier toVec3 work it computed the angle and
radius with transcendentals: acos for the angular distance, atan2 (inside
azimuthRads) for the azimuth, tan for the gnomonic scaling, and a final sin/cos
pair, plus two vec3d.normalize() sqrts (the tangent basis and the projection).

Replace them with algebra:
  - the azimuth's cos/sin come straight from the tangent-plane components
    (cosAz = N/hyp, sinAz = E/hyp) instead of atan2 -> cos/sin; because only the
    N/E ratio is used, neither the tangent basis nor the projection needs
    normalizing -- both scale by the same factor, which cancels (drops 2 sqrt);
  - the per-face azimuth offset and the Class III rotation fold in via
    angle-subtraction against the precomputed faceAxis0Cos/Sin and ap7Rot tables;
  - the gnomonic tan(acos x) reduces to sqrt(1-x^2)/x with x = 1 - sqd/2, written
    as sqrt((sqd/2)(2-sqd/2))/x = (1-x)(1+x) to avoid cancellation near center.

Five transcendentals + 2 normalize sqrts become 2 sqrt. The transform is
algebraically exact; output differs from C only at the ULP level, within the
parity suite's 1e-5 tolerance. azimuthRads and posAngleRads are now unused and
removed. All white-box and parity tests pass; package stays at 100% coverage.

NOTE on the face-center guard: the old `acos(1-sqd/2) < epsilon` short-circuit
(the azimuth is singular at the face center, where the tangent projection
vanishes) is re-expressed on sqd as `sqd < epsilon*epsilon`. The exact form
2(1-cos epsilon) underflows to 0 at epsilon=1e-16 (cos(1e-16) rounds to 1), so
its leading-order equivalent epsilon^2 is used; without a working guard a point
exactly on a face center divides 0/0 and yields NaN coordinates.

benchstat, pure-Go, 4953a75 -> this commit (Apple M3 Max, count=10):

                              │   sec/op    │  ... (continued)
Pull Request #134: perf: fold forward gnomonic projection (toHex2d) into algebra

27 of 27 new or added lines in 1 file covered. (100.0%)

4268 of 4268 relevant lines covered (100.0%)

3071535.36 hits per line

Relevant lines Covered
Build:
Build:
4268 RELEVANT LINES 4268 COVERED LINES
3071535.36 HITS PER LINE
Source Files on master
  • Tree
  • List 18
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
27738291857 justinhwang/forward-gnomonic-opt perf: fold forward gnomonic projection (toHex2d) into algebra toHex2d is the forward gnomonic projection behind LatLngToCell, PolygonToCells, and local-IJ -> cell. Like the earlier toVec3 work it computed the angle and radius with transcendentals... Pull #134 18 Jun 2026 05:16AM UTC justinhwang github
100.0
27736586680 justinhwang/tovec3-projection-opt perf: fold projection trig into precomputed tables and fused IJK descent Two hot transforms behind nearly every geometry call are reworked. toVec3 (the inverse gnomonic projection behind CellToLatLng, CellToBoundary, CellArea*, EdgeLength*, vert... Pull #133 18 Jun 2026 04:27AM UTC justinhwang github
100.0
27736352283 justinhwang/tovec3-projection-opt perf: fold projection trig into precomputed tables and fused IJK descent Two hot transforms behind nearly every geometry call are reworked. toVec3 (the inverse gnomonic projection behind CellToLatLng, CellToBoundary, CellArea*, EdgeLength*, vert... push 18 Jun 2026 04:19AM UTC justinhwang github
100.0
27735272019 justinhwang/tovec3-projection-opt perf: fold toVec3 inverse projection into precomputed trig + one sqrt toVec3 (the inverse gnomonic projection behind CellToLatLng, CellToBoundary, CellArea*, EdgeLength*, vertex/edge boundaries, and the polygon paths) computed atan2 + atan + two ... push 18 Jun 2026 03:47AM UTC justinhwang github
99.77
27734628439 justinhwang/paritytest-benchmarks test+perf: parity benchmarks and allocation cuts for x/h3go Add a cgo-vs-pure-Go benchmark suite under x/h3go/paritytest covering every publicly exposed function and method, each run as "impl=cgo" and "impl=go" sub-benchmarks so `benchstat -col /... Pull #132 18 Jun 2026 03:27AM UTC justinhwang github
99.76
27731679822 justinhwang/remove-h3core refactor: remove internal/h3core and reorganize x/h3go Remove the internal/h3core package and inline the shared H3 index-format constants and pentagon base-cell table into both consumers, so neither depends on the shared package: - h3: bit-layout... Pull #131 18 Jun 2026 02:00AM UTC justinhwang github
100.0
27731605010 justinhwang/remove-h3core refactor(h3go): reorganize declarations and genericize shared index ops File organization: - Group const/var/type declaration blocks at the top of each source file. - Split error vars into errors.go; rename h3go.go -> constants.go and add h3.go... push 18 Jun 2026 01:58AM UTC justinhwang github
100.0
27727545624 justinhwang/purego-phase-g feat: add pure-Go regions (polygon/cells, multipolygon) to x/h3go Implements the full H3 regions API in pure Go, verified against the cgo reference: - PolygonToCells (legacy flood-fill polyfill) and GeoPolygon.Cells, with the GeoPolygon/GeoLoo... Pull #130 18 Jun 2026 12:02AM UTC justinhwang github
100.0
27665848677 justinhwang/purego-phase-f feat: add pure-Go vertexes, directed edges & edge length to x/h3go Add the Vertex and DirectedEdge index types with their full method and free-function surfaces: Cell.Vertex/Vertexes and Vertex.LatLng/IsValid/ String/Resolution/IndexDigit; Cell.D... Pull #129 17 Jun 2026 04:32AM UTC justinhwang github
100.0
27664523708 justinhwang/purego-phase-e feat: add pure-Go local IJ coordinates & grid metrics to x/h3go Add CellToLocalIJ/LocalIJToCell, GridDistance, GridPath (and Cell method forms) plus the CoordIJ type, implementing the local IJK/IJ coordinate machinery, cube-coordinate line interp... Pull #128 17 Jun 2026 03:53AM UTC justinhwang github
100.0
See All Builds (332)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc