@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.
- package/CHANGELOG.md +101 -0
- package/README.md +47 -0
- package/dist/_ecef-height.d.ts +14 -12
- package/dist/_ecef-height.d.ts.map +1 -1
- package/dist/_ecef-height.js +115 -41
- package/dist/_ecef-height.js.map +1 -1
- package/dist/ellipsoid.d.ts +21 -0
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +57 -1
- package/dist/ellipsoid.js.map +1 -1
- package/dist/geodesic/_angle.d.ts +10 -15
- package/dist/geodesic/_angle.d.ts.map +1 -1
- package/dist/geodesic/_angle.js +54 -39
- package/dist/geodesic/_angle.js.map +1 -1
- package/dist/geodesic/_constants.d.ts.map +1 -1
- package/dist/geodesic/_constants.js +2 -1
- package/dist/geodesic/_constants.js.map +1 -1
- package/dist/geodesic/_inverse.d.ts.map +1 -1
- package/dist/geodesic/_inverse.js +34 -28
- package/dist/geodesic/_inverse.js.map +1 -1
- package/dist/geodesic/_line.d.ts +7 -8
- package/dist/geodesic/_line.d.ts.map +1 -1
- package/dist/geodesic/_line.js +28 -23
- package/dist/geodesic/_line.js.map +1 -1
- package/dist/geodesic/_series.js.map +1 -1
- package/dist/geodesic.d.ts +37 -9
- package/dist/geodesic.d.ts.map +1 -1
- package/dist/geodesic.js +173 -90
- package/dist/geodesic.js.map +1 -1
- package/dist/geodetic.d.ts +2 -1
- package/dist/geodetic.d.ts.map +1 -1
- package/dist/geodetic.js +42 -16
- package/dist/geodetic.js.map +1 -1
- package/dist/horizon.d.ts +63 -0
- package/dist/horizon.d.ts.map +1 -0
- package/dist/horizon.js +131 -0
- package/dist/horizon.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/local-frame.d.ts.map +1 -1
- package/dist/local-frame.js +40 -9
- package/dist/local-frame.js.map +1 -1
- package/dist/refraction.d.ts +80 -0
- package/dist/refraction.d.ts.map +1 -0
- package/dist/refraction.js +110 -0
- package/dist/refraction.js.map +1 -0
- 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
|
package/dist/_ecef-height.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
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
|
|
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"}
|
package/dist/_ecef-height.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `
|
|
21
|
-
*
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
+
pair_[0] = 1;
|
|
69
|
+
pair_[1] = -flattening;
|
|
70
|
+
twoSumInPlace(pair_);
|
|
71
|
+
const rl = pair_[1];
|
|
42
72
|
const r2h = rh * rh;
|
|
43
|
-
|
|
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
|
-
|
|
79
|
+
pair_[0] = s;
|
|
80
|
+
pair_[1] = s;
|
|
81
|
+
twoProductInRangeInPlace(pair_);
|
|
82
|
+
const s2l = pair_[1];
|
|
47
83
|
const c2h = 1 - s2h;
|
|
48
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
130
|
+
pair_[0] = semiMajorAxis;
|
|
131
|
+
pair_[1] = s;
|
|
132
|
+
twoProductInRangeInPlace(pair_);
|
|
133
|
+
const azl = pair_[1];
|
|
70
134
|
const bzh = azh * r2h;
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
package/dist/_ecef-height.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_ecef-height.js","sourceRoot":"","sources":["../src/_ecef-height.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"_ecef-height.js","sourceRoot":"","sources":["../src/_ecef-height.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,qBAAqB;IACpC,MAAM,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAE,CAAC;IACvC,MAAM,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAE,CAAC;IACvC,MAAM,CAAC,GAAG,gBAAgB,CAAC,SAAS,CAAE,CAAC;IACvC,MAAM,CAAC,GAAG,gBAAgB,CAAC,YAAY,CAAE,CAAC;IAC1C,MAAM,aAAa,GAAG,gBAAgB,CAAC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,GAAG,CAAC;IACf,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACd,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACf,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,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"}
|
package/dist/ellipsoid.d.ts
CHANGED
|
@@ -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
|
package/dist/ellipsoid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAS1C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,yCAAyC;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kDAAkD;IAClD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,wDAAwD;IACxD,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAC3C,2CAA2C;IAC3C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACjC,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAExB;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GAChB,SAAS,CA0BX;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAE1D;AAED,wDAAwD;AACxD,eAAO,MAAM,eAAe,EAAE,SAG7B,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,eAAe,EAAE,SAG7B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,GACjB,MAAM,CAKR;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC3C,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GAChB,MAAM,CA0BR;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACtC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEhE"}
|
package/dist/ellipsoid.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)) {
|
package/dist/ellipsoid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipsoid.js","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ellipsoid.js","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAuB5C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC9B,cAAsB,EACtB,UAAkB;IAElB,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,UAAU,CACnB,oEAAoE,aAAa,CAAC,cAAc,CAAC,GAAG,CACpG,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,IAAI,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,UAAU,CACnB,sDAAsD,aAAa,CAAC,UAAU,CAAC,GAAG,CAClF,CAAC;IACH,CAAC;IACD,MAAM,mBAAmB,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,CAAC,GAAG,UAAU,CAAC;IAClC,MAAM,SAAS,GAAG;QACjB,cAAc;QACd,UAAU;QACV,cAAc,EAAE,cAAc,GAAG,UAAU;QAC3C,mBAAmB;QACnB,yBAAyB,EAAE,mBAAmB,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;QAC1E,eAAe,EAAE,UAA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;GAKG;AACH,MAAM,UAAU,uBAAuB,CACtC,SAAoB,EACpB,WAAmB;IAEnB,MAAM,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;IAC5C,MAAM,CAAC,GAAG,qBAAqB,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
|
|
21
|
-
* is zero up to rounding is treated as the equator. Tiny
|
|
22
|
-
* and `−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
|
|
24
|
+
export declare function angleRoundInPlace_(buffer: Scratch_, index: number): void;
|
|
25
25
|
/**
|
|
26
|
-
* `
|
|
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
|
|
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).
|
|
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
|
|
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;
|
|
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;AAqBnD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAOxE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAM5E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAqBnD;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA+CvD"}
|