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

uber / h3-go / 27738291857
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: justinhwang/forward-gnomonic-opt
DEFAULT BRANCH: master
Ran 18 Jun 2026 05:16AM UTC
Jobs 1
Files 18
Run time 1min
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

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

Jobs
ID Job ID Ran Files Coverage
1 Go- - 27738291857.1 18 Jun 2026 05:16AM UTC 18
100.0
GitHub Action Run
Source Files on build 27738291857
  • Tree
  • List 18
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #134
  • PR Base - justinhwang/tovec3-projection-opt (#27736586680)
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