@ac-kit/math-geodesy 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +47 -0
  3. package/dist/_ecef-height.d.ts +14 -12
  4. package/dist/_ecef-height.d.ts.map +1 -1
  5. package/dist/_ecef-height.js +115 -41
  6. package/dist/_ecef-height.js.map +1 -1
  7. package/dist/ellipsoid.d.ts +21 -0
  8. package/dist/ellipsoid.d.ts.map +1 -1
  9. package/dist/ellipsoid.js +57 -1
  10. package/dist/ellipsoid.js.map +1 -1
  11. package/dist/geodesic/_angle.d.ts +10 -15
  12. package/dist/geodesic/_angle.d.ts.map +1 -1
  13. package/dist/geodesic/_angle.js +54 -39
  14. package/dist/geodesic/_angle.js.map +1 -1
  15. package/dist/geodesic/_constants.d.ts.map +1 -1
  16. package/dist/geodesic/_constants.js +2 -1
  17. package/dist/geodesic/_constants.js.map +1 -1
  18. package/dist/geodesic/_inverse.d.ts.map +1 -1
  19. package/dist/geodesic/_inverse.js +34 -28
  20. package/dist/geodesic/_inverse.js.map +1 -1
  21. package/dist/geodesic/_line.d.ts +7 -8
  22. package/dist/geodesic/_line.d.ts.map +1 -1
  23. package/dist/geodesic/_line.js +28 -23
  24. package/dist/geodesic/_line.js.map +1 -1
  25. package/dist/geodesic/_series.js.map +1 -1
  26. package/dist/geodesic.d.ts +37 -9
  27. package/dist/geodesic.d.ts.map +1 -1
  28. package/dist/geodesic.js +173 -90
  29. package/dist/geodesic.js.map +1 -1
  30. package/dist/geodetic.d.ts +2 -1
  31. package/dist/geodetic.d.ts.map +1 -1
  32. package/dist/geodetic.js +42 -16
  33. package/dist/geodetic.js.map +1 -1
  34. package/dist/horizon.d.ts +63 -0
  35. package/dist/horizon.d.ts.map +1 -0
  36. package/dist/horizon.js +131 -0
  37. package/dist/horizon.js.map +1 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/local-frame.d.ts.map +1 -1
  43. package/dist/local-frame.js +40 -9
  44. package/dist/local-frame.js.map +1 -1
  45. package/dist/refraction.d.ts +80 -0
  46. package/dist/refraction.d.ts.map +1 -0
  47. package/dist/refraction.js +110 -0
  48. package/dist/refraction.js.map +1 -0
  49. package/package.json +12 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,106 @@
1
1
  # @ac-kit/math-geodesy
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5c203e7: `geodesicLineSet(out, from, azimuthDeg, ellipsoid)` re-aims an existing
8
+ geodesic line in place, as `geodesicLine` would build it: a fan of lines from
9
+ one point (a horizon profile, a viewshed) needs no record per line. It throws
10
+ `RangeError` for the inputs `geodesicLine` rejects, leaving the line as it was,
11
+ and allocates nothing.
12
+ - 5c203e7: Earth curvature, the horizon and terrestrial refraction, for horizon profiles
13
+ and sightlines. `curvatureDrop(distance, radius, k?)` is how far the
14
+ horizontal plane passes above the surface at a distance;
15
+ `horizonDistance(height, radius, k?)` and `horizonDip` give the surface
16
+ distance to the horizon and its dip in degrees; `hiddenHeight(distance,
17
+ eyeHeight, radius, k?)` the height of a far object the horizon hides. Each
18
+ takes a refraction coefficient `k` (default `0`) on the effective Earth of
19
+ curvature `(1 − k)/R`, finite at `k = 1` and beyond (ducting).
20
+ `refractionCurvature(conditions?)` and `refractionCoefficient(conditions?,
21
+ radius?)` derive the ray curvature and `k` from the temperature, station
22
+ pressure, temperature gradient and wavelength (ISA defaults: `k ≈ 0.170`);
23
+ `refractionAngle(distance, radius, k)` is how far refraction raises a point,
24
+ in degrees; `REFRACTION_COEFFICIENT_GAUSS` is `0.13`.
25
+ `ellipsoidNormalSectionRadius(ellipsoid, latitude, azimuth)`,
26
+ `ellipsoidGaussianRadius` and `ellipsoidMeanRadius` give the radius to apply
27
+ them on. Out-of-domain arguments give `NaN`; the per-sample functions allocate
28
+ nothing once inlined.
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [5c203e7]
33
+ - Updated dependencies [5c203e7]
34
+ - Updated dependencies [5c203e7]
35
+ - Updated dependencies [5c203e7]
36
+ - Updated dependencies [5c203e7]
37
+ - Updated dependencies [5c203e7]
38
+ - Updated dependencies [5c203e7]
39
+ - Updated dependencies [5c203e7]
40
+ - Updated dependencies [5c203e7]
41
+ - Updated dependencies [5c203e7]
42
+ - Updated dependencies [5c203e7]
43
+ - Updated dependencies [5c203e7]
44
+ - Updated dependencies [5c203e7]
45
+ - Updated dependencies [5c203e7]
46
+ - Updated dependencies [5c203e7]
47
+ - @ac-kit/core@0.14.0
48
+ - @ac-kit/math-geometry@0.5.0
49
+ - @ac-kit/math-linear@0.5.0
50
+ - @ac-kit/math-scalar@0.5.0
51
+
52
+ ## 0.1.1
53
+
54
+ ### Patch Changes
55
+
56
+ - 0b4fe43: The allocation contract is explicit. Solving a problem or a position allocates
57
+ nothing in the solver, whether or not the engine inlines its internals; a
58
+ caller that does not inline `geodesicDirect` or `geodesicLinePosition` boxes
59
+ their fractional `number` arguments, one heap number each. The two line
60
+ constructors allocate the line's record, once per line. `geodesicLinePositions`
61
+ accepts distances that share memory with its output and still allocates
62
+ nothing, and every function re-entered from a getter or setter on a caller's
63
+ record gives the right results.
64
+ - Updated dependencies [0b4fe43]
65
+ - Updated dependencies [0b4fe43]
66
+ - Updated dependencies [0b4fe43]
67
+ - Updated dependencies [0b4fe43]
68
+ - Updated dependencies [0b4fe43]
69
+ - Updated dependencies [0b4fe43]
70
+ - Updated dependencies [0b4fe43]
71
+ - Updated dependencies [0b4fe43]
72
+ - Updated dependencies [0b4fe43]
73
+ - Updated dependencies [0b4fe43]
74
+ - Updated dependencies [0b4fe43]
75
+ - Updated dependencies [0b4fe43]
76
+ - Updated dependencies [0b4fe43]
77
+ - Updated dependencies [0b4fe43]
78
+ - Updated dependencies [0b4fe43]
79
+ - Updated dependencies [0b4fe43]
80
+ - Updated dependencies [0b4fe43]
81
+ - Updated dependencies [0b4fe43]
82
+ - Updated dependencies [0b4fe43]
83
+ - Updated dependencies [0b4fe43]
84
+ - Updated dependencies [0b4fe43]
85
+ - Updated dependencies [0b4fe43]
86
+ - Updated dependencies [0b4fe43]
87
+ - Updated dependencies [0b4fe43]
88
+ - Updated dependencies [0b4fe43]
89
+ - Updated dependencies [0b4fe43]
90
+ - Updated dependencies [0b4fe43]
91
+ - Updated dependencies [0b4fe43]
92
+ - Updated dependencies [0b4fe43]
93
+ - Updated dependencies [0b4fe43]
94
+ - Updated dependencies [0b4fe43]
95
+ - Updated dependencies [0b4fe43]
96
+ - Updated dependencies [0b4fe43]
97
+ - Updated dependencies [0b4fe43]
98
+ - Updated dependencies [0b4fe43]
99
+ - @ac-kit/core@0.13.0
100
+ - @ac-kit/math-geometry@0.4.0
101
+ - @ac-kit/math-linear@0.4.0
102
+ - @ac-kit/math-scalar@0.4.0
103
+
3
104
  ## 0.1.0
4
105
 
5
106
  ### Minor Changes
package/README.md CHANGED
@@ -29,6 +29,12 @@ geodesicInverse(
29
29
  | `Ellipsoid`, `ellipsoidCreate(a, f)`, `ellipsoidSphere(radius)` | A frozen parameter record, made once; `0 ≤ f < 1`, throws `RangeError` |
30
30
  | `ELLIPSOID_WGS84`, `ELLIPSOID_GRS80` | The two usual ones |
31
31
  | `ellipsoidMeridionalRadius`, `ellipsoidPrimeVerticalRadius` | Radii of curvature `M` and `N` at a latitude |
32
+ | `ellipsoidNormalSectionRadius(e, latitude, azimuth)`, `ellipsoidGaussianRadius`, `ellipsoidMeanRadius` | The radius a sightline sees in one direction (Euler), `√(MN)`, IUGG `R₁` |
33
+ | `curvatureDrop(distance, radius, k?)` | How far the horizontal plane passes above the surface at a distance |
34
+ | `horizonDistance(height, radius, k?)`, `horizonDip(height, radius, k?)` | Surface distance to the horizon and its dip below the horizontal, degrees |
35
+ | `hiddenHeight(distance, eyeHeight, radius, k?)` | The height of a far object the horizon hides |
36
+ | `refractionCurvature(conditions?)`, `refractionCoefficient(conditions?, radius?)` | Ray curvature and terrestrial refraction coefficient `k` from temperature, pressure, lapse rate and wavelength |
37
+ | `refractionAngle(distance, radius, k)`, `REFRACTION_COEFFICIENT_GAUSS` | How far refraction raises a point, degrees; Gauss's `k = 0.13` |
32
38
  | `Geodetic`, `geodeticOf`, `geodeticCreate`, … | `[longitudeDeg, latitudeDeg, heightM]`, a branded value with the usual family |
33
39
  | `ecefFromGeodetic`, `geodeticFromEcef` | Geodetic ↔ Earth-centred metres, closed forms |
34
40
  | `ecefArrayFromGeodetic`, `geodeticArrayFromEcef` | The same over a `Float64Array` of triples, in place allowed |
@@ -36,14 +42,55 @@ geodesicInverse(
36
42
  | `geodesicInverse(out, from, to, ellipsoid)` | Distance and both azimuths between two positions |
37
43
  | `geodesicDirect(out, from, azimuthDeg, distanceM, ellipsoid)` | The end point of a geodesic |
38
44
  | `geodesicLine`, `geodesicLineBetween`, `geodesicLinePosition`, `…Azimuth`, `…Distance`, `…Positions` | A line built once, queried many times (a horizon of 600 samples is one call) |
45
+ | `geodesicLineSet(out, from, azimuthDeg, ellipsoid)` | Re-aims an existing line in place: a fan of lines from one point, no record per line |
39
46
 
40
47
  Heights are ignored by the geodesic functions (geodesics lie on the
41
48
  ellipsoid). Azimuths are degrees clockwise from north in `(−180, 180]`;
42
49
  coincident points give a distance of `0` and `NaN` azimuths; a non-finite
43
50
  argument, or a latitude beyond ±90°, gives `NaN`.
44
51
 
52
+ ## Curvature, horizon and refraction
53
+
54
+ A sightline over the Earth is drawn on a sphere of a radius the caller picks:
55
+ `ellipsoidNormalSectionRadius` in the sightline's direction for a horizon
56
+ profile, `ellipsoidGaussianRadius` around one point, `ellipsoidMeanRadius` for
57
+ the Earth as a whole. Refraction bends a near-horizontal ray by `κ`, the
58
+ coefficient `k = κR` of that radius, and the functions take `k` (default `0`,
59
+ the bare geometry) on the effective Earth of curvature `(1 − k)/R`: at `k = 1`
60
+ the sea looks flat, beyond it ducting makes the surface loom.
61
+
62
+ ```ts
63
+ import {
64
+ curvatureDrop,
65
+ ELLIPSOID_WGS84,
66
+ ellipsoidNormalSectionRadius,
67
+ hiddenHeight,
68
+ refractionAngle,
69
+ refractionCoefficient,
70
+ } from "@ac-kit/math-geodesy";
71
+
72
+ const radius = ellipsoidNormalSectionRadius(ELLIPSOID_WGS84, 45.8, 120);
73
+ const k = refractionCoefficient(
74
+ { temperatureC: 4, pressureHpa: 940, temperatureGradientKPerM: -0.004 },
75
+ radius,
76
+ ); // ≈ 0.186
77
+ curvatureDrop(20000, radius, k); // ≈ 25.5 m below the horizontal plane
78
+ hiddenHeight(20000, 2, radius, k); // ≈ 13.2 m hidden for an eye at 2 m
79
+ refractionAngle(20000, radius, k); // ≈ 0.0167°, to add to a geometric elevation
80
+ ```
81
+
82
+ `refractionCurvature` takes dry air as an ideal gas in hydrostatic balance:
83
+ `κ = K(λ)·P/T²·(g/R_d + dT/dh)/n`, with Birch and Downs' Edlén dispersion for
84
+ `K(λ)`. The lapse rate `dT/dh` dominates; the ISA defaults give `k ≈ 0.170`
85
+ (Hirt et al.'s `503·P/T²·(0.0343 + dT/dh)` agrees within its own rounding).
86
+
45
87
  ## Accuracy
46
88
 
89
+ - Curvature and horizon: exact on the effective sphere, and stable for short
90
+ distances and low eyes (a drop of `s²/2R` keeps full precision at 1 µm). The
91
+ effective Earth itself is exact to first order: against a ray traced through
92
+ a constant index gradient, its drop errs by about `k/(1 − k)·h/R` relative
93
+ (6e−6 at 900 m for `k = 0.17`) and the refraction angle by `0.2 h/R`.
47
94
  - Geodesics: within 15 nanometres on WGS 84 (GeographicLib's published bound),
48
95
  checked on the whole of Karney's GeodTest set (`yarn test:geodtest`: 500 000
49
96
  lines, worst 11 nm, never worse than `geographiclib-geodesic`), including
@@ -1,3 +1,11 @@
1
+ export declare const HEIGHT_X_ = 0;
2
+ export declare const HEIGHT_Y_ = 1;
3
+ export declare const HEIGHT_Z_ = 2;
4
+ export declare const HEIGHT_SINE_ = 3;
5
+ export declare const HEIGHT_SEMI_MAJOR_AXIS_ = 4;
6
+ export declare const HEIGHT_FLATTENING_ = 5;
7
+ export declare const HEIGHT_RESULT_ = 6;
8
+ export declare const heightRegisters_: Float64Array<ArrayBuffer>;
1
9
  /**
2
10
  * The height above the ellipsoid of the point `(x, y, z)` whose foot on the
3
11
  * ellipsoid has the sine of the geodetic latitude `s` (the latitude only to
@@ -14,18 +22,12 @@
14
22
  * for extending the available precision", 1971; Ogita–Rump–Oishi 2005). Needs
15
23
  * the coordinates within `[1e−150, 1e150]`: it squares them.
16
24
  *
17
- * The inputs are read from `heightRegisters_` (`HEIGHT_X_` …
18
- * `HEIGHT_FLATTENING_`) and the height left in
19
- * `heightRegisters_[HEIGHT_RESULT_]`: a double argument or result would be
20
- * boxed, as this function is too large for V8 to inline.
25
+ * No double crosses a call, so a point allocates nothing whatever the engine
26
+ * inlines: the inputs are read from `heightRegisters_` (`HEIGHT_X_` …
27
+ * `HEIGHT_FLATTENING_`), the height is left in
28
+ * `heightRegisters_[HEIGHT_RESULT_]`, and the error-free transformations
29
+ * (`twoSumInPlace`, `twoProductInRangeInPlace`) take their operands and leave
30
+ * their errors in `pair_`.
21
31
  */
22
32
  export declare function heightAboveEllipsoid_(): void;
23
- export declare const HEIGHT_X_ = 0;
24
- export declare const HEIGHT_Y_ = 1;
25
- export declare const HEIGHT_Z_ = 2;
26
- export declare const HEIGHT_SINE_ = 3;
27
- export declare const HEIGHT_SEMI_MAJOR_AXIS_ = 4;
28
- export declare const HEIGHT_FLATTENING_ = 5;
29
- export declare const HEIGHT_RESULT_ = 6;
30
- export declare const heightRegisters_: Float64Array<ArrayBuffer>;
31
33
  //# sourceMappingURL=_ecef-height.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_ecef-height.d.ts","sourceRoot":"","sources":["../src/_ecef-height.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CA+E5C;AAED,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,gBAAgB,2BAAsB,CAAC"}
1
+ {"version":3,"file":"_ecef-height.d.ts","sourceRoot":"","sources":["../src/_ecef-height.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,gBAAgB,2BAAsB,CAAC;AAQpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CA8I5C"}
@@ -1,4 +1,17 @@
1
- import { twoProductError, twoSumError } from "@ac-kit/math-scalar";
1
+ import { twoProductInRangeInPlace, twoSumInPlace } from "@ac-kit/math-scalar";
2
+ export const HEIGHT_X_ = 0;
3
+ export const HEIGHT_Y_ = 1;
4
+ export const HEIGHT_Z_ = 2;
5
+ export const HEIGHT_SINE_ = 3;
6
+ export const HEIGHT_SEMI_MAJOR_AXIS_ = 4;
7
+ export const HEIGHT_FLATTENING_ = 5;
8
+ export const HEIGHT_RESULT_ = 6;
9
+ export const heightRegisters_ = new Float64Array(7);
10
+ /**
11
+ * Where the error-free transformations below take their two operands and leave
12
+ * the result and its error.
13
+ */
14
+ const pair_ = new Float64Array(2);
2
15
  /**
3
16
  * The height above the ellipsoid of the point `(x, y, z)` whose foot on the
4
17
  * ellipsoid has the sine of the geodetic latitude `s` (the latitude only to
@@ -15,10 +28,12 @@ import { twoProductError, twoSumError } from "@ac-kit/math-scalar";
15
28
  * for extending the available precision", 1971; Ogita–Rump–Oishi 2005). Needs
16
29
  * the coordinates within `[1e−150, 1e150]`: it squares them.
17
30
  *
18
- * The inputs are read from `heightRegisters_` (`HEIGHT_X_` …
19
- * `HEIGHT_FLATTENING_`) and the height left in
20
- * `heightRegisters_[HEIGHT_RESULT_]`: a double argument or result would be
21
- * boxed, as this function is too large for V8 to inline.
31
+ * No double crosses a call, so a point allocates nothing whatever the engine
32
+ * inlines: the inputs are read from `heightRegisters_` (`HEIGHT_X_` …
33
+ * `HEIGHT_FLATTENING_`), the height is left in
34
+ * `heightRegisters_[HEIGHT_RESULT_]`, and the error-free transformations
35
+ * (`twoSumInPlace`, `twoProductInRangeInPlace`) take their operands and leave
36
+ * their errors in `pair_`.
22
37
  */
23
38
  export function heightAboveEllipsoid_() {
24
39
  const x = heightRegisters_[HEIGHT_X_];
@@ -31,69 +46,128 @@ export function heightAboveEllipsoid_() {
31
46
  const x2 = x * x;
32
47
  const y2 = y * y;
33
48
  const q0 = x2 + y2;
34
- const q1 = twoSumError(x2, y2, q0) +
35
- twoProductError(x, x, x2) +
36
- twoProductError(y, y, y2);
49
+ pair_[0] = x2;
50
+ pair_[1] = y2;
51
+ twoSumInPlace(pair_);
52
+ const q0Error = pair_[1];
53
+ pair_[0] = x;
54
+ pair_[1] = x;
55
+ twoProductInRangeInPlace(pair_);
56
+ const x2Error = pair_[1];
57
+ pair_[0] = y;
58
+ pair_[1] = y;
59
+ twoProductInRangeInPlace(pair_);
60
+ const q1 = q0Error + x2Error + pair_[1];
37
61
  const ph = Math.sqrt(q0);
38
- const pl = (q0 - ph * ph - twoProductError(ph, ph, ph * ph) + q1) / (2 * ph) || 0;
62
+ pair_[0] = ph;
63
+ pair_[1] = ph;
64
+ twoProductInRangeInPlace(pair_);
65
+ const pl = (q0 - ph * ph - pair_[1] + q1) / (2 * ph) || 0;
39
66
  // the polar ratio r = 1 − f and r², as pairs
40
67
  const rh = 1 - flattening;
41
- const rl = twoSumError(1, -flattening, rh);
68
+ pair_[0] = 1;
69
+ pair_[1] = -flattening;
70
+ twoSumInPlace(pair_);
71
+ const rl = pair_[1];
42
72
  const r2h = rh * rh;
43
- const r2l = twoProductError(rh, rh, r2h) + 2 * rh * rl;
73
+ pair_[0] = rh;
74
+ pair_[1] = rh;
75
+ twoProductInRangeInPlace(pair_);
76
+ const r2l = pair_[1] + 2 * rh * rl;
44
77
  // sin²φ and cos²φ = 1 − sin²φ, and cosφ
45
78
  const s2h = s * s;
46
- const s2l = twoProductError(s, s, s2h);
79
+ pair_[0] = s;
80
+ pair_[1] = s;
81
+ twoProductInRangeInPlace(pair_);
82
+ const s2l = pair_[1];
47
83
  const c2h = 1 - s2h;
48
- const c2l = twoSumError(1, -s2h, c2h) - s2l;
84
+ pair_[0] = 1;
85
+ pair_[1] = -s2h;
86
+ twoSumInPlace(pair_);
87
+ const c2l = pair_[1] - s2l;
49
88
  const ch = Math.sqrt(c2h);
50
- const cl = ch === 0
51
- ? 0
52
- : (c2h - ch * ch - twoProductError(ch, ch, ch * ch) + c2l) / (2 * ch);
89
+ let cl = 0;
90
+ if (ch !== 0) {
91
+ pair_[0] = ch;
92
+ pair_[1] = ch;
93
+ twoProductInRangeInPlace(pair_);
94
+ cl = (c2h - ch * ch - pair_[1] + c2l) / (2 * ch);
95
+ }
53
96
  // w² = cos²φ + r²·sin²φ, and w = √w², then 1/w as a pair
54
97
  const m0 = r2h * s2h;
55
- const m1 = twoProductError(r2h, s2h, m0) + r2h * s2l + r2l * s2h;
98
+ pair_[0] = r2h;
99
+ pair_[1] = s2h;
100
+ twoProductInRangeInPlace(pair_);
101
+ const m1 = pair_[1] + r2h * s2l + r2l * s2h;
56
102
  const w2h = c2h + m0;
57
- const w2l = twoSumError(c2h, m0, w2h) + c2l + m1;
103
+ pair_[0] = c2h;
104
+ pair_[1] = m0;
105
+ twoSumInPlace(pair_);
106
+ const w2l = pair_[1] + c2l + m1;
58
107
  const wh = Math.sqrt(w2h);
59
- const wl = (w2h - wh * wh - twoProductError(wh, wh, wh * wh) + w2l) / (2 * wh);
108
+ pair_[0] = wh;
109
+ pair_[1] = wh;
110
+ twoProductInRangeInPlace(pair_);
111
+ const wl = (w2h - wh * wh - pair_[1] + w2l) / (2 * wh);
60
112
  const uh = 1 / wh;
61
- const ul = uh * (1 - wh * uh - twoProductError(wh, uh, wh * uh) - wl * uh);
113
+ pair_[0] = wh;
114
+ pair_[1] = uh;
115
+ twoProductInRangeInPlace(pair_);
116
+ const ul = uh * (1 - wh * uh - pair_[1] - wl * uh);
62
117
  // F_p = a·cosφ / w
63
118
  const aph = semiMajorAxis * ch;
64
- const apl = twoProductError(semiMajorAxis, ch, aph) + semiMajorAxis * cl;
119
+ pair_[0] = semiMajorAxis;
120
+ pair_[1] = ch;
121
+ twoProductInRangeInPlace(pair_);
122
+ const apl = pair_[1] + semiMajorAxis * cl;
65
123
  const fph = aph * uh;
66
- const fpl = twoProductError(aph, uh, fph) + aph * ul + apl * uh;
124
+ pair_[0] = aph;
125
+ pair_[1] = uh;
126
+ twoProductInRangeInPlace(pair_);
127
+ const fpl = pair_[1] + aph * ul + apl * uh;
67
128
  // F_z = a·r²·sinφ / w
68
129
  const azh = semiMajorAxis * s;
69
- const azl = twoProductError(semiMajorAxis, s, azh);
130
+ pair_[0] = semiMajorAxis;
131
+ pair_[1] = s;
132
+ twoProductInRangeInPlace(pair_);
133
+ const azl = pair_[1];
70
134
  const bzh = azh * r2h;
71
- const bzl = twoProductError(azh, r2h, bzh) + azh * r2l + azl * r2h;
135
+ pair_[0] = azh;
136
+ pair_[1] = r2h;
137
+ twoProductInRangeInPlace(pair_);
138
+ const bzl = pair_[1] + azh * r2l + azl * r2h;
72
139
  const fzh = bzh * uh;
73
- const fzl = twoProductError(bzh, uh, fzh) + bzh * ul + bzl * uh;
140
+ pair_[0] = bzh;
141
+ pair_[1] = uh;
142
+ twoProductInRangeInPlace(pair_);
143
+ const fzl = pair_[1] + bzh * ul + bzl * uh;
74
144
  // the offsets of the point from the foot point
75
145
  const dph = ph - fph;
76
- const dpl = twoSumError(ph, -fph, dph) + pl - fpl;
146
+ pair_[0] = ph;
147
+ pair_[1] = -fph;
148
+ twoSumInPlace(pair_);
149
+ const dpl = pair_[1] + pl - fpl;
77
150
  const dzh = z - fzh;
78
- const dzl = twoSumError(z, -fzh, dzh) - fzl;
151
+ pair_[0] = z;
152
+ pair_[1] = -fzh;
153
+ twoSumInPlace(pair_);
154
+ const dzl = pair_[1] - fzl;
79
155
  // h = dp·cosφ + dz·sinφ
80
156
  const t0 = dph * ch;
81
157
  const t1 = dzh * s;
82
158
  const hh = t0 + t1;
83
- const hl = twoSumError(t0, t1, hh) +
84
- twoProductError(dph, ch, t0) +
85
- twoProductError(dzh, s, t1) +
86
- dph * cl +
87
- dpl * ch +
88
- dzl * s;
159
+ pair_[0] = t0;
160
+ pair_[1] = t1;
161
+ twoSumInPlace(pair_);
162
+ const hhError = pair_[1];
163
+ pair_[0] = dph;
164
+ pair_[1] = ch;
165
+ twoProductInRangeInPlace(pair_);
166
+ const t0Error = pair_[1];
167
+ pair_[0] = dzh;
168
+ pair_[1] = s;
169
+ twoProductInRangeInPlace(pair_);
170
+ const hl = hhError + t0Error + pair_[1] + dph * cl + dpl * ch + dzl * s;
89
171
  heightRegisters_[HEIGHT_RESULT_] = hh + hl;
90
172
  }
91
- export const HEIGHT_X_ = 0;
92
- export const HEIGHT_Y_ = 1;
93
- export const HEIGHT_Z_ = 2;
94
- export const HEIGHT_SINE_ = 3;
95
- export const HEIGHT_SEMI_MAJOR_AXIS_ = 4;
96
- export const HEIGHT_FLATTENING_ = 5;
97
- export const HEIGHT_RESULT_ = 6;
98
- export const heightRegisters_ = new Float64Array(7);
99
173
  //# sourceMappingURL=_ecef-height.js.map
@@ -1 +1 @@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wBAAwB,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;IACxE,gBAAgB,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AAC5C,CAAC"}
@@ -49,4 +49,25 @@ export declare function ellipsoidMeridionalRadius(ellipsoid: Ellipsoid, latitude
49
49
  * finite gives `NaN`.
50
50
  */
51
51
  export declare function ellipsoidPrimeVerticalRadius(ellipsoid: Ellipsoid, latitudeDeg: number): number;
52
+ /**
53
+ * The radius of curvature of the normal section at the geodetic latitude in the
54
+ * direction `azimuthDeg` (degrees clockwise from north), metres: Euler's `1/R_α
55
+ * = cos²α / M + sin²α / N`, so `M` along the meridian and `N` east–west. It is
56
+ * the radius a sightline leaving the point in that direction sees the ellipsoid
57
+ * curve with. A latitude beyond ±90°, or an argument that is not finite, gives
58
+ * `NaN`.
59
+ */
60
+ export declare function ellipsoidNormalSectionRadius(ellipsoid: Ellipsoid, latitudeDeg: number, azimuthDeg: number): number;
61
+ /**
62
+ * The Gaussian mean radius of curvature `√(MN)` at the geodetic latitude,
63
+ * metres, evaluated as `a(1 − f) / w²` (see {@link ellipsoidMeridionalRadius}):
64
+ * the radius of the sphere that best fits the ellipsoid around the point, in no
65
+ * particular direction. A latitude beyond ±90° or not finite gives `NaN`.
66
+ */
67
+ export declare function ellipsoidGaussianRadius(ellipsoid: Ellipsoid, latitudeDeg: number): number;
68
+ /**
69
+ * The IUGG mean radius `R₁ = (2a + b) / 3`, metres: 6 371 008.771 m for WGS 84,
70
+ * the radius of a global spherical Earth.
71
+ */
72
+ export declare function ellipsoidMeanRadius(ellipsoid: Ellipsoid): number;
52
73
  //# sourceMappingURL=ellipsoid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","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id.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { describeValue, isFinitePositive } from "@ac-kit/core";
2
- import { cosDeg } from "@ac-kit/math-scalar";
2
+ import { cosDeg, sinCosDegInPlace } from "@ac-kit/math-scalar";
3
3
  import { CONSTANTS_KEY_, constantsCreate_ } from "./geodesic/_constants.js";
4
+ /**
5
+ * `[latitude → sin, cos, azimuth → sin, cos]` for
6
+ * {@link ellipsoidNormalSectionRadius}.
7
+ */
8
+ const angleRegisters_ = new Float64Array(4);
4
9
  /**
5
10
  * Creates the ellipsoid of equatorial radius `semiMajorAxisM` metres and
6
11
  * flattening `flattening` (`1 / 298.257223563` for WGS 84), computing the
@@ -64,6 +69,57 @@ export function ellipsoidPrimeVerticalRadius(ellipsoid, latitudeDeg) {
64
69
  const w = curvatureDenominator_(ellipsoid, polarRatio * polarRatio, latitudeDeg);
65
70
  return ellipsoid.semiMajorAxisM / w;
66
71
  }
72
+ /**
73
+ * The radius of curvature of the normal section at the geodetic latitude in the
74
+ * direction `azimuthDeg` (degrees clockwise from north), metres: Euler's `1/R_α
75
+ * = cos²α / M + sin²α / N`, so `M` along the meridian and `N` east–west. It is
76
+ * the radius a sightline leaving the point in that direction sees the ellipsoid
77
+ * curve with. A latitude beyond ±90°, or an argument that is not finite, gives
78
+ * `NaN`.
79
+ */
80
+ export function ellipsoidNormalSectionRadius(ellipsoid, latitudeDeg, azimuthDeg) {
81
+ // Every field is read before the registers are used, so a getter that
82
+ // re-enters this function cannot clobber them.
83
+ const semiMajorAxis = ellipsoid.semiMajorAxisM;
84
+ const eccentricitySquared = ellipsoid.eccentricitySquared;
85
+ const polarRatio = 1 - ellipsoid.flattening;
86
+ const polarRatioSquared = polarRatio * polarRatio;
87
+ if (!(Math.abs(latitudeDeg) <= 90)) {
88
+ return Number.NaN;
89
+ }
90
+ // The angles go through a buffer: sinDeg and cosDeg take and return
91
+ // doubles, which V8 boxes whenever it does not inline them.
92
+ angleRegisters_[0] = latitudeDeg;
93
+ angleRegisters_[2] = azimuthDeg;
94
+ sinCosDegInPlace(angleRegisters_, 0);
95
+ sinCosDegInPlace(angleRegisters_, 2);
96
+ const latitudeCosine = angleRegisters_[1];
97
+ const sine = angleRegisters_[2];
98
+ const cosine = angleRegisters_[3];
99
+ const wSquared = polarRatioSquared + eccentricitySquared * (latitudeCosine * latitudeCosine);
100
+ // a / R_α = w (w² cos²α / (1 − f)² + sin²α), from M = a(1 − f)²/w³, N = a/w.
101
+ const scale = Math.sqrt(wSquared) *
102
+ ((wSquared / polarRatioSquared) * (cosine * cosine) + sine * sine);
103
+ return semiMajorAxis / scale;
104
+ }
105
+ /**
106
+ * The Gaussian mean radius of curvature `√(MN)` at the geodetic latitude,
107
+ * metres, evaluated as `a(1 − f) / w²` (see {@link ellipsoidMeridionalRadius}):
108
+ * the radius of the sphere that best fits the ellipsoid around the point, in no
109
+ * particular direction. A latitude beyond ±90° or not finite gives `NaN`.
110
+ */
111
+ export function ellipsoidGaussianRadius(ellipsoid, latitudeDeg) {
112
+ const polarRatio = 1 - ellipsoid.flattening;
113
+ const w = curvatureDenominator_(ellipsoid, polarRatio * polarRatio, latitudeDeg);
114
+ return (ellipsoid.semiMajorAxisM * polarRatio) / (w * w);
115
+ }
116
+ /**
117
+ * The IUGG mean radius `R₁ = (2a + b) / 3`, metres: 6 371 008.771 m for WGS 84,
118
+ * the radius of a global spherical Earth.
119
+ */
120
+ export function ellipsoidMeanRadius(ellipsoid) {
121
+ return (2 * ellipsoid.semiMajorAxisM + ellipsoid.semiMinorAxisM) / 3;
122
+ }
67
123
  /** `w = √((1 − f)² + e² cos²φ)`, `NaN` beyond ±90°. */
68
124
  function curvatureDenominator_(ellipsoid, polarRatioSquared, latitudeDeg) {
69
125
  if (!(Math.abs(latitudeDeg) <= 90)) {
@@ -1 +1 @@
1
- {"version":3,"file":"ellipsoid.js","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MA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AAqB,CAC9B,SAAS,EACT,UAAU,GAAG,UAAU,EACvB,WAAW,CACX,CAAC;IACF,OAAO,CAAC,SAAS,CAAC,cAAc,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAoB;IACvD,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC;AAED,uDAAuD;AACvD,SAAS,qBAAqB,CAC7B,SAAoB,EACpB,iBAAyB,EACzB,WAAmB;IAEnB,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC,GAAG,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,IAAI,CACf,iBAAiB,GAAG,SAAS,CAAC,mBAAmB,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CACrE,CAAC;AACH,CAAC"}
@@ -17,34 +17,29 @@ export declare const TINY_: number;
17
17
  */
18
18
  export declare const TINY_DOUBLE_: Float64Array<ArrayBuffer>;
19
19
  /**
20
- * Snaps an angle within 1/16° of zero onto a grid of 2⁻⁵⁷°, so a latitude that
21
- * is zero up to rounding is treated as the equator. Tiny negatives become `−0`,
22
- * and `−0` becomes `+0`.
20
+ * Snaps the angle `buffer[index]` within 1/16° of zero onto a grid of 2⁻⁵⁷°, so
21
+ * a latitude that is zero up to rounding is treated as the equator. Tiny
22
+ * negatives become `−0`, and `−0` stays `−0`.
23
23
  */
24
- export declare function angleRound_(x: number): number;
24
+ export declare function angleRoundInPlace_(buffer: Scratch_, index: number): void;
25
25
  /**
26
- * `x` reduced to `[−180, 180]`; a result of ±180 or ±0 takes the sign of `x`.
27
- *
28
- * The rare result `copySign(180, x)` is computed on every path, here and in the
29
- * functions below: a call that has never run has no type feedback, V8 cannot
30
- * inline it, and merging its boxed result with a computed double makes V8 box
31
- * that double on the common path too.
26
+ * The angle `buffer[index]` reduced to `[−180, 180]`; a result of ±180 or ±0
27
+ * takes the sign of the angle.
32
28
  */
33
- export declare function angleNormalize_(x: number): number;
29
+ export declare function angleNormalizeInPlace_(buffer: Scratch_, index: number): void;
34
30
  /**
35
31
  * `io[1] − io[0]` reduced to `[−180, 180]`, written back as `io[0] + io[1]`:
36
32
  * `io[0]` is the nearest double and `io[1]` the rounding error, below 2⁻²⁶. A
37
33
  * result of ±0 or ±180 takes the sign of the difference (of `−error` when the
38
- * error is not zero). (Doubles travel in the buffer: a call passing them as
39
- * arguments could box them.)
34
+ * error is not zero).
40
35
  */
41
36
  export declare function angleDifference_(io: Scratch_): void;
42
37
  /**
43
38
  * Sine and cosine, written to `io[0]` and `io[1]`, of `io[0] + io[1]` degrees,
44
39
  * where `io[1]` is the small error term of {@link angleDifference_}. The
45
40
  * argument is reduced to `[−45, 45]` before the conversion to radians and the
46
- * reduced sum snapped by {@link angleRound_} (upstream's `sincosde`, whose
47
- * contract no `math-scalar` function has); 30° and 45° give their exact
41
+ * reduced sum snapped by {@link angleRoundInPlace_} (upstream's `sincosde`,
42
+ * whose contract no `math-scalar` function has); 30° and 45° give their exact
48
43
  * algebraic values.
49
44
  */
50
45
  export declare function sineCosineCorrected_(io: Scratch_): void;
@@ -1 +1 @@
1
- {"version":3,"file":"_angle.d.ts","sourceRoot":"","sources":["../../src/geodesic/_angle.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAI7I;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEpC,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAEvD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,QAA+C,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,YAAY,2BAAyB,CAAC;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