Ellipsoid P0 qualification profile
G0–G2 are complete for the operation/domain profile below. This closes the comparison, nearest-point and existing-API contract gates; it does not claim all finite inputs, arbitrary flattening geodesics, or GeographicLib feature parity. The remaining feature tranches are G3–G11 in the roadmap.
Comparators and accuracy gates
The offline comparator is full GeographicLib C++ 2.7, source tag r2.7, archive
SHA-256 5aaca14cd75f13aa2690273d76e88e8ddf4aeb267d6be2c3e0ba948deb9ceea5.
The stored build reports 53 significand bits; requesting C++ long double
on its Apple arm64 platform did not provide extra precision. It is not an
arbitrary-precision reference. The original API driver calls series and
elliptic-integral GeodesicExact/line APIs, Geocentric, LocalCartesian,
Gnomonic and triaxial Cartesian3. No upstream test data is copied.
Independent standard-library Decimal mathematics remains authoritative for Cartesian geometry: 180 digits/600 monotone constrained-distance bisections from exact stored binary64 axes/points; forward coordinates use Machin's pi identity and Taylor trigonometry. The multiplier lies above the negative smallest squared radius, certifying the globally nearest branch independently of production code and native C++. Existing 110/220/440-digit controls remain unchanged, including their cusp-component gates.
| Operation | Qualified domain | Existing budgets retained |
|---|---|---|
| Series direct/inverse, distance/arc lines, reduced length, scales, normalized/unrolled longitude | Existing 819 PROJ inputs plus C++ series/Exact controls; Earth-like flattening near ±1/50, unit radii 1e-60, 1, 1e60; up to four circuits | 5e-14*a distance/reduced length/transverse-bearing displacement; 5e-14 scales/physical-longitude angle; 2e-11 degrees latitude/arc |
| Three-radius nearest point and inverse | 720 wider-domain Decimal controls over six sphere/oblate/prolate/triaxial ratios and cyclic axis orders, plus 210 exact-input legacy anchors; scales 1e-60, 1, 6378137, 1e60; axis ratios through 1e6; surface, exterior and unique interiors through 1-2^-45 depth | Footpoint/surface residual 2e-12; inverse normal 1e-9 degrees; height 2e-12*maxRadius, also enforced in tiny units rather than relying on the existing 1e-12 absolute floor |
| Forward Cartesian | Sphere/oblate and 108 triaxial C++/Decimal controls, including polar/equatorial ratio 1e-6, exact and near poles, depths/heights from -0.1*a to 4*a, scaled units | 5e-14*a position discrepancy; exact degree inputs and exact radian inputs have separate independent expectations |
| Reverse Cartesian | Sphere/oblate, thin and scaled geometries; unique interior/exterior/cardinal cases | Existing normal-angle/height ceilings, against independent Decimal expectations |
| ENU rotations | GeographicLib LocalCartesian at surface/interior/offset origins, poles, both hemispheres and scaled units | 5e-14*a displacement; Ellipsoid frame ownership/directions additionally have analytic checks |
| Gnomonic | Sphere and Earth-like oblate shapes, several origins, forward points within the sampled horizon, inverse offsets through about 11*a | Existing 1e-5 Earth-unit forward ceiling scaled with radius; 1e-8 degrees inverse |
The matrix contains 3,480 rows: 930 Decimal geometry rows (720 wider-domain cases and 210 exact-input anchor cases) and 2,550 native
C++ rows. Of these, 3,478 are gates (including 21 intentional prolate-CRS
rejection controls); two Exact many-circuit comparisons are explicitly diagnostic.
The 210 legacy normal-support anchors now use independently computed inverse
expectations for their actual stored XYZ values: ideal generating normals are
not reliable inverse expectations after thin-surface coordinate rounding. Their
existing 1e-9 degree/1e-5 height ceilings are unchanged.
Every qualified row must pass its original budget in Node and Chromium/Firefox/WebKit.
Worst budget usage and every diagnostic discrepancy are stored in the
Node report.
The existing Earth-radius interior-height ceiling of approximately 13 µm
remains visible; these controls do not turn it into a universal nanometre claim.
Findings and intentional differences
- Fixed: thin exterior convergence. A rounded
hypot(u,v)-1could appear converged while the geodetic normal was wrong by roughly3.5e-5radians. The shared compensated shifted-root equation now solves both interiors and thin exteriors. All 24 initially failing new geometry controls pass without weakening their budgets; the old inverse/cusp corpus still gates unchanged. - Fixed: degree-to-radian conditioning near thin poles. Converting a degree latitude first loses low angle bits that large curvature amplifies. Degree normals now retain the polar complement, while radian inputs are compared against their own exact stored values. Exact ±90°/±π/2 endpoints are canonical poles. This is input precision, not a reason to loosen Cartesian budgets.
- Fixed: subnormal axis squares. Polar support and scalar ratio caches use
axes before squaring, retaining polar and ordinary-latitude coordinates when
cached squared radii are subnormal. Analytic regressions include axes down to
1e-300; this preserves previously working inputs without claiming a complete tiny-magnitude inverse domain. - Fixed: extreme rays and ownership. Scaled normalization/projection avoids squared-norm underflow/overflow. Numeric commits snapshot all ordinates before invoking result setters. Finite-axis validation, invalid-input atomicity and small-unit frame pole classification have regression coverage.
- Native C++ thin-shape limitations are not reproduced. Its binary64
Geocentric forward equation subtracts eccentricity terms near one; sampled
forward discrepancies reach about
1.88e-6*a, and a reverse normal differs by about1.33e-10radians from independent mathematics. The C++ triaxial solver rejects 20 stored controls; its largest returned footpoint discrepancy is about1.86e-12*maxRadius. math.gl remains gated against the independent mathematical references for those inputs. Exact inputs and native outcomes are retained, not silently removed from the comparison. - Series is not Exact at arbitrary path lengths. The two diagnostic paths
of
1440*alength (over 200 circuits), near ±1/50 flattening, expose accumulated scale differences against elliptic-integral Exact beyond the unchanged gate. math.gl still matches C++ series there. The four-circuit accuracy profile is qualified; wider-path Exact support belongs to G8. No tolerance is widened. - Ambiguous minima: math.gl rejects centers/medial interiors atomically; native GeographicLib can select a conventional representative. Neither is a unique-solution accuracy test. Unique boundary/cusp roots retain their own exact-dyadic and independent controls.
- Forward negative heights: crossing a normal cut locus can prevent an inverse from recovering the original generating angles. The inverse selects the nearest unique normal or rejects ambiguity; a round trip is not its oracle.
- Adapter domains: geodesics support the qualified prolate domain;
toSpheroidand projection CRS adapters deliberately require sphere/oblate geometry. Triaxial C++ requires ordered axes; math.gl additionally qualifies permutations and equal-axis limits independently.
G2 public contract audit
| API family | Units, ownership and boundary contract |
|---|---|
Constructor, fromSpheroid, toSpheroid, equals, toString | Finite nonnegative constructor axes; zero/default geometry is representable but not a valid conversion surface. Shape/cache vectors are frozen together; toSpheroid returns a fresh frozen sphere/oblate snapshot. Equality/string results are value results. |
| Forward/inverse Cartesian | Axis units for XYZ/height; degrees by default, radians with the existing config flag. Coordinate input is retained. Owned default output; supplied arrays/vector/object results are returned. Aliases, typed-array rounding, M preservation and reentrant result setters are checked. Invalid conversions return undefined before output writes; missing arguments may throw. |
| Geocentric/geodetic/angular normals | Unit directions; finite nonzero rays normalize across the tested 1e-300–1e300 magnitude range. Zero/nonfinite rays return undefined atomically. Angular normals use the configured angle unit; legacy finite trigonometric continuation outside geographic latitude bounds is not a qualified geographic domain. These are algebraic radial/gradient directions, not an implicit nearest-point solve. |
| Nearest versus radial surface | Nearest is globally constrained in the qualified unique domain; ambiguity rejects. Radial projection deliberately follows the input ray and is distinct from geodetic projection. Ordinary radial rounding is retained; unsafe squared intermediates use a scaled path. |
| Scaled-space transforms | Component-wise cached-axis multiplication; no CRS or angle unit. Owned/supplied/aliased/reentrant outputs are checked. These algebraic methods retain Vector3's existing debug/nonfinite arithmetic policy rather than claiming a validated geodetic solve. |
| Normal/Z-axis intersection | Exact equal X/Y radii and positive axes (consistent with the shape, without an absolute epsilon that admits tiny triaxial shapes); axis-unit buffer and documented outside-buffer rejection. Invalid finite-coordinate/buffer conditions reject before writes; output setters cannot corrupt remaining ordinates. |
| ENU/custom-axis matrices | Column-major, right-handed axes, XYZ translation in axis units; output/matrix aliases and nested setters retain captured values. Nonfinite origins/short buffers reject before writes. Surface-gradient frames differ intentionally from GeographicLib's geodetic-origin LocalCartesian frame at nonzero heights. |
| Frame poles/center | Preserve the legacy orientation neighborhood, bounded by 1e-14*min(1,maxRadius) so an entire tiny ellipsoid is not classified as a pole. An exact Cartesian pole has no supplied longitude and uses the retained east convention. Center matrices retain the legacy degenerate convention and are outside qualified physical frames. Core angular ENU retains a supplied meridian at poles. |
| Geodesic facade/adapters | Degrees and axis-unit distances; inputs/options/axes are snapshotted, finite validation precedes evaluation. Longitude unrolling remains opt-in. Invalid shapes/coordinates throw; sphere/oblate adapter restrictions do not remove prolate geodesic support. |
Existing signatures are retained. Legacy number-array-only declarations are not silently broadened by these runtime typed-buffer checks; public bulk API design remains G7. No mandatory data/model loading or new package dependency is added.
Reproduce
Download the pinned r2.7 archive separately, then:
python3 modules/geospatial/scripts/projection/generate-ellipsoid-p0-reference.py --archive /path/to/r2.7.tar.gz
python3 modules/geospatial/scripts/projection/generate-ellipsoid-p0-reference.py --verify-fixture
node modules/geospatial/scripts/projection/qualify-ellipsoid-p0.mjs --output /tmp/p0-node.json
node modules/geospatial/scripts/projection/qualify-ellipsoid-p0.mjs --browser chromium --output /tmp/p0-chromium.json
The generator verifies the archive hash before extracting/compiling selected
components in a temporary directory. It installs nothing. --check reproduces
stored native values with the recorded precision/compiler environment; platform
floating-point differences are not a mathematical proof. Ordinary CI verifies
workload/generator/driver provenance and independently regenerates Decimal
controls; it does not download or compile GeographicLib/PROJ.
New drivers/tests/helpers are original MIT math.gl work. Existing Cesium MIT/Apache-2.0, proj4js/PROJ and Charles Karney/GeographicLib MIT SPDX credits and packaged module licenses remain intact. Native upstream sources stay offline.