Match Cesium's fromDegrees exactly and keep toEcef in the stub

fromRadians divides by gamma as Cesium does, so geodetic to ECEF is now
bit for bit Cesium's, and the test checks it exactly. Its tests also
cover three height bands, points inside the Earth and NaN input. toEcef
reads the renderer contract's Position, so it moves to the stub's maths.
The ellipsoid docs pair each conversion with Cesium's.
This commit is contained in:
Sameh Khamis committed 2026-11-05 14:28:10 -08:00
1 parent 11167fa608
commit fb2bb9ae46
4 files changed
+64 -12

No files matched your search

+9
View File
@@ -14,6 +14,8 @@ import {
clamp,
equalsEpsilon,
negate,
clone,
fromDegrees,
rotate,
scale,
vec,
@@ -22,6 +24,13 @@ import {
export * from '../../geo/index.js';
/** A contract `Position` (`Ecef` or `LonLatH`, degrees), as ECEF. */
export function toEcef(position) {
if ('lon' in position && 'lat' in position)
return fromDegrees(position.lon, position.lat, position.height ?? 0);
return clone(position);
}
const EPSILON3 = 1e-3;
const EPSILON10 = 1e-10;