@ac-kit/math-geodesy 0.0.0-stage → 0.1.1
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 +113 -0
- package/LICENSE +57 -0
- package/README.md +89 -2
- package/dist/_brand.d.ts +14 -0
- package/dist/_brand.d.ts.map +1 -0
- package/dist/_brand.js +2 -0
- package/dist/_brand.js.map +1 -0
- package/dist/_ecef-forward-bound.d.ts +7 -0
- package/dist/_ecef-forward-bound.d.ts.map +1 -0
- package/dist/_ecef-forward-bound.js +7 -0
- package/dist/_ecef-forward-bound.js.map +1 -0
- package/dist/_ecef-height.d.ts +33 -0
- package/dist/_ecef-height.d.ts.map +1 -0
- package/dist/_ecef-height.js +173 -0
- package/dist/_ecef-height.js.map +1 -0
- package/dist/ellipsoid.d.ts +52 -0
- package/dist/ellipsoid.d.ts.map +1 -0
- package/dist/ellipsoid.js +75 -0
- package/dist/ellipsoid.js.map +1 -0
- package/dist/geodesic/_angle.d.ts +46 -0
- package/dist/geodesic/_angle.d.ts.map +1 -0
- package/dist/geodesic/_angle.js +144 -0
- package/dist/geodesic/_angle.js.map +1 -0
- package/dist/geodesic/_constants.d.ts +38 -0
- package/dist/geodesic/_constants.d.ts.map +1 -0
- package/dist/geodesic/_constants.js +142 -0
- package/dist/geodesic/_constants.js.map +1 -0
- package/dist/geodesic/_inverse.d.ts +22 -0
- package/dist/geodesic/_inverse.d.ts.map +1 -0
- package/dist/geodesic/_inverse.js +720 -0
- package/dist/geodesic/_inverse.js.map +1 -0
- package/dist/geodesic/_line.d.ts +37 -0
- package/dist/geodesic/_line.d.ts.map +1 -0
- package/dist/geodesic/_line.js +219 -0
- package/dist/geodesic/_line.js.map +1 -0
- package/dist/geodesic/_series.d.ts +69 -0
- package/dist/geodesic/_series.d.ts.map +1 -0
- package/dist/geodesic/_series.js +203 -0
- package/dist/geodesic/_series.js.map +1 -0
- package/dist/geodesic.d.ts +97 -0
- package/dist/geodesic.d.ts.map +1 -0
- package/dist/geodesic.js +245 -0
- package/dist/geodesic.js.map +1 -0
- package/dist/geodetic.d.ts +195 -0
- package/dist/geodetic.d.ts.map +1 -0
- package/dist/geodetic.js +456 -0
- package/dist/geodetic.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/local-frame.d.ts +19 -0
- package/dist/local-frame.d.ts.map +1 -0
- package/dist/local-frame.js +66 -0
- package/dist/local-frame.js.map +1 -0
- package/package.json +73 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @ac-kit/math-geodesy
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0b4fe43: The allocation contract is explicit. Solving a problem or a position allocates
|
|
8
|
+
nothing in the solver, whether or not the engine inlines its internals; a
|
|
9
|
+
caller that does not inline `geodesicDirect` or `geodesicLinePosition` boxes
|
|
10
|
+
their fractional `number` arguments, one heap number each. The two line
|
|
11
|
+
constructors allocate the line's record, once per line. `geodesicLinePositions`
|
|
12
|
+
accepts distances that share memory with its output and still allocates
|
|
13
|
+
nothing, and every function re-entered from a getter or setter on a caller's
|
|
14
|
+
record gives the right results.
|
|
15
|
+
- Updated dependencies [0b4fe43]
|
|
16
|
+
- Updated dependencies [0b4fe43]
|
|
17
|
+
- Updated dependencies [0b4fe43]
|
|
18
|
+
- Updated dependencies [0b4fe43]
|
|
19
|
+
- Updated dependencies [0b4fe43]
|
|
20
|
+
- Updated dependencies [0b4fe43]
|
|
21
|
+
- Updated dependencies [0b4fe43]
|
|
22
|
+
- Updated dependencies [0b4fe43]
|
|
23
|
+
- Updated dependencies [0b4fe43]
|
|
24
|
+
- Updated dependencies [0b4fe43]
|
|
25
|
+
- Updated dependencies [0b4fe43]
|
|
26
|
+
- Updated dependencies [0b4fe43]
|
|
27
|
+
- Updated dependencies [0b4fe43]
|
|
28
|
+
- Updated dependencies [0b4fe43]
|
|
29
|
+
- Updated dependencies [0b4fe43]
|
|
30
|
+
- Updated dependencies [0b4fe43]
|
|
31
|
+
- Updated dependencies [0b4fe43]
|
|
32
|
+
- Updated dependencies [0b4fe43]
|
|
33
|
+
- Updated dependencies [0b4fe43]
|
|
34
|
+
- Updated dependencies [0b4fe43]
|
|
35
|
+
- Updated dependencies [0b4fe43]
|
|
36
|
+
- Updated dependencies [0b4fe43]
|
|
37
|
+
- Updated dependencies [0b4fe43]
|
|
38
|
+
- Updated dependencies [0b4fe43]
|
|
39
|
+
- Updated dependencies [0b4fe43]
|
|
40
|
+
- Updated dependencies [0b4fe43]
|
|
41
|
+
- Updated dependencies [0b4fe43]
|
|
42
|
+
- Updated dependencies [0b4fe43]
|
|
43
|
+
- Updated dependencies [0b4fe43]
|
|
44
|
+
- Updated dependencies [0b4fe43]
|
|
45
|
+
- Updated dependencies [0b4fe43]
|
|
46
|
+
- Updated dependencies [0b4fe43]
|
|
47
|
+
- Updated dependencies [0b4fe43]
|
|
48
|
+
- Updated dependencies [0b4fe43]
|
|
49
|
+
- Updated dependencies [0b4fe43]
|
|
50
|
+
- @ac-kit/core@0.13.0
|
|
51
|
+
- @ac-kit/math-geometry@0.4.0
|
|
52
|
+
- @ac-kit/math-linear@0.4.0
|
|
53
|
+
- @ac-kit/math-scalar@0.4.0
|
|
54
|
+
|
|
55
|
+
## 0.1.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- 34e8cfa: First release: the Earth's reference ellipsoid. `ellipsoidCreate`,
|
|
60
|
+
`ELLIPSOID_WGS84` and `ELLIPSOID_GRS80` describe it; `ecefFromGeodetic` and
|
|
61
|
+
`geodeticFromEcef` (and their `Float64Array` bulk forms) convert between
|
|
62
|
+
`[longitudeDeg, latitudeDeg, heightM]` and Earth-centred coordinates;
|
|
63
|
+
`affine3FromLocalFrame` builds the transform to local east-north-up or
|
|
64
|
+
north-east-down metres at a geodetic origin; and `geodesicInverse`,
|
|
65
|
+
`geodesicDirect` and the line functions (`geodesicLine`, `geodesicLineBetween`,
|
|
66
|
+
`geodesicLinePosition`, `geodesicLinePositions`) solve geodesics on the
|
|
67
|
+
ellipsoid to 15 nanometres on WGS 84 with no per-call result object. Degrees and
|
|
68
|
+
metres, longitude first, and `NaN` rather than a throw for an undefined result.
|
|
69
|
+
|
|
70
|
+
The geodesic algorithms are a port of GeographicLib's JavaScript (Charles
|
|
71
|
+
Karney, MIT), so the package is licensed `BSD-3-Clause AND MIT` and its
|
|
72
|
+
`LICENSE` carries GeographicLib's notice; there is no runtime dependency.
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [34e8cfa]
|
|
77
|
+
- Updated dependencies [34e8cfa]
|
|
78
|
+
- Updated dependencies [34e8cfa]
|
|
79
|
+
- Updated dependencies [34e8cfa]
|
|
80
|
+
- Updated dependencies [34e8cfa]
|
|
81
|
+
- Updated dependencies [34e8cfa]
|
|
82
|
+
- Updated dependencies [34e8cfa]
|
|
83
|
+
- Updated dependencies [34e8cfa]
|
|
84
|
+
- Updated dependencies [34e8cfa]
|
|
85
|
+
- Updated dependencies [34e8cfa]
|
|
86
|
+
- Updated dependencies [34e8cfa]
|
|
87
|
+
- Updated dependencies [34e8cfa]
|
|
88
|
+
- Updated dependencies [34e8cfa]
|
|
89
|
+
- Updated dependencies [34e8cfa]
|
|
90
|
+
- Updated dependencies [34e8cfa]
|
|
91
|
+
- Updated dependencies [34e8cfa]
|
|
92
|
+
- Updated dependencies [34e8cfa]
|
|
93
|
+
- Updated dependencies [34e8cfa]
|
|
94
|
+
- Updated dependencies [34e8cfa]
|
|
95
|
+
- Updated dependencies [34e8cfa]
|
|
96
|
+
- Updated dependencies [34e8cfa]
|
|
97
|
+
- Updated dependencies [34e8cfa]
|
|
98
|
+
- Updated dependencies [34e8cfa]
|
|
99
|
+
- Updated dependencies [34e8cfa]
|
|
100
|
+
- Updated dependencies [34e8cfa]
|
|
101
|
+
- Updated dependencies [34e8cfa]
|
|
102
|
+
- Updated dependencies [34e8cfa]
|
|
103
|
+
- Updated dependencies [34e8cfa]
|
|
104
|
+
- Updated dependencies [34e8cfa]
|
|
105
|
+
- Updated dependencies [34e8cfa]
|
|
106
|
+
- Updated dependencies [34e8cfa]
|
|
107
|
+
- Updated dependencies [34e8cfa]
|
|
108
|
+
- Updated dependencies [34e8cfa]
|
|
109
|
+
- Updated dependencies [34e8cfa]
|
|
110
|
+
- @ac-kit/core@0.12.0
|
|
111
|
+
- @ac-kit/math-scalar@0.3.0
|
|
112
|
+
- @ac-kit/math-linear@0.3.0
|
|
113
|
+
- @ac-kit/math-geometry@0.3.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Anthony Champagne and contributors
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
Portions of this package (`src/geodesic/`) are derived from GeographicLib
|
|
33
|
+
(geographiclib-geodesic 2.2.0) and are licensed under the MIT License:
|
|
34
|
+
|
|
35
|
+
The MIT License (MIT).
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2011-2022, Charles Karney
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person
|
|
40
|
+
obtaining a copy of this software and associated documentation
|
|
41
|
+
files (the "Software"), to deal in the Software without
|
|
42
|
+
restriction, including without limitation the rights to use, copy,
|
|
43
|
+
modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
44
|
+
of the Software, and to permit persons to whom the Software is
|
|
45
|
+
furnished to do so, subject to the following conditions:
|
|
46
|
+
|
|
47
|
+
The above copyright notice and this permission notice shall be
|
|
48
|
+
included in all copies or substantial portions of the Software.
|
|
49
|
+
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
51
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
52
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
53
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
54
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
55
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
57
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ac-kit/math-geodesy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Earth's reference ellipsoid: coordinates, local frames and geodesics.
|
|
4
|
+
Degrees and metres at the API, longitude first (like a GeoJSON position), `NaN`
|
|
5
|
+
rather than a throw for an undefined result.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {
|
|
9
|
+
ELLIPSOID_WGS84,
|
|
10
|
+
geodesicInverse,
|
|
11
|
+
geodesicInverseCreate,
|
|
12
|
+
geodeticOf,
|
|
13
|
+
} from "@ac-kit/math-geodesy";
|
|
14
|
+
|
|
15
|
+
const out = geodesicInverseCreate();
|
|
16
|
+
geodesicInverse(
|
|
17
|
+
out,
|
|
18
|
+
geodeticOf(-73.8, 40.6, 0), // New York
|
|
19
|
+
geodeticOf(2.55, 49.017, 0), // Paris
|
|
20
|
+
ELLIPSOID_WGS84,
|
|
21
|
+
);
|
|
22
|
+
// [distanceM ≈ 5 853 212.613, azimuth1Deg ≈ 53.47, azimuth2Deg ≈ 111.59]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Contents
|
|
26
|
+
|
|
27
|
+
| Symbol | Description |
|
|
28
|
+
| ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- |
|
|
29
|
+
| `Ellipsoid`, `ellipsoidCreate(a, f)`, `ellipsoidSphere(radius)` | A frozen parameter record, made once; `0 ≤ f < 1`, throws `RangeError` |
|
|
30
|
+
| `ELLIPSOID_WGS84`, `ELLIPSOID_GRS80` | The two usual ones |
|
|
31
|
+
| `ellipsoidMeridionalRadius`, `ellipsoidPrimeVerticalRadius` | Radii of curvature `M` and `N` at a latitude |
|
|
32
|
+
| `Geodetic`, `geodeticOf`, `geodeticCreate`, … | `[longitudeDeg, latitudeDeg, heightM]`, a branded value with the usual family |
|
|
33
|
+
| `ecefFromGeodetic`, `geodeticFromEcef` | Geodetic ↔ Earth-centred metres, closed forms |
|
|
34
|
+
| `ecefArrayFromGeodetic`, `geodeticArrayFromEcef` | The same over a `Float64Array` of triples, in place allowed |
|
|
35
|
+
| `affine3FromLocalFrame(out, origin, ellipsoid, axes)` | Earth-centred metres → local east-north-up (or north-east-down) metres |
|
|
36
|
+
| `geodesicInverse(out, from, to, ellipsoid)` | Distance and both azimuths between two positions |
|
|
37
|
+
| `geodesicDirect(out, from, azimuthDeg, distanceM, ellipsoid)` | The end point of a geodesic |
|
|
38
|
+
| `geodesicLine`, `geodesicLineBetween`, `geodesicLinePosition`, `…Azimuth`, `…Distance`, `…Positions` | A line built once, queried many times (a horizon of 600 samples is one call) |
|
|
39
|
+
|
|
40
|
+
Heights are ignored by the geodesic functions (geodesics lie on the
|
|
41
|
+
ellipsoid). Azimuths are degrees clockwise from north in `(−180, 180]`;
|
|
42
|
+
coincident points give a distance of `0` and `NaN` azimuths; a non-finite
|
|
43
|
+
argument, or a latitude beyond ±90°, gives `NaN`.
|
|
44
|
+
|
|
45
|
+
## Accuracy
|
|
46
|
+
|
|
47
|
+
- Geodesics: within 15 nanometres on WGS 84 (GeographicLib's published bound),
|
|
48
|
+
checked on the whole of Karney's GeodTest set (`yarn test:geodtest`: 500 000
|
|
49
|
+
lines, worst 11 nm, never worse than `geographiclib-geodesic`), including
|
|
50
|
+
nearly antipodal, pole and equatorial lines.
|
|
51
|
+
- `geodeticFromEcef`: latitude within 1e−13° (measured 2.1e−14°) and height
|
|
52
|
+
within 1 nm (measured 0.47 nm) of the exact geodetic position of the given
|
|
53
|
+
double point, against 80-digit mpmath references over 1 512 points, heights
|
|
54
|
+
from −6 000 km to 10 000 km (the height is evaluated in double-double
|
|
55
|
+
arithmetic; plain doubles give 3.7 nm); beyond, up to coordinates of 1e150 m,
|
|
56
|
+
the height stays within 1 nm plus half an ulp of itself.
|
|
57
|
+
- `ecefFromGeodetic`: each coordinate within `5·2⁻⁵³·(a + |h|)` of the exact
|
|
58
|
+
value, 3.5 nm at sea level and 59 nm at 100 000 km (measured worst
|
|
59
|
+
3.95·2⁻⁵³·(a + |h|) over a seeded 500 000-point mpmath sweep, heights from
|
|
60
|
+
−6 000 km to 100 000 km: `scripts/ecef-sweep.ts`); poles and cardinal
|
|
61
|
+
meridians are exact. Each angle is reduced once, exactly in degrees, and
|
|
62
|
+
costs one `Math.sin`, the cosine coming from `√(1 − sin²)`: about 0.28 of
|
|
63
|
+
`proj4`'s time.
|
|
64
|
+
- `geodeticFromEcef` needs coordinates within `[1e−150, 1e150]` (it squares
|
|
65
|
+
them; far from the Earth its quartic is rescaled by a power of two), and
|
|
66
|
+
`ecefFromGeodetic` takes any finite height; both give `NaN` in all three
|
|
67
|
+
outputs for a component that is not finite.
|
|
68
|
+
|
|
69
|
+
The series are of order 6 in the third flattening: accurate to round-off for
|
|
70
|
+
`|f| ≤ 0.01`, with a Newton correction above it. Prolate ellipsoids (`f < 0`)
|
|
71
|
+
and `|f| > 0.02` precision are not offered yet.
|
|
72
|
+
|
|
73
|
+
## Credits
|
|
74
|
+
|
|
75
|
+
The geodesic algorithms (`src/geodesic/`) are a port of
|
|
76
|
+
[GeographicLib](https://geographiclib.sourceforge.io/)'s JavaScript
|
|
77
|
+
(`geographiclib-geodesic` 2.2.0, Copyright © 2011–2022 Charles Karney, MIT
|
|
78
|
+
licence), after C. F. F. Karney, _Algorithms for geodesics_, J. Geodesy 87
|
|
79
|
+
(2013) 43–55,
|
|
80
|
+
[doi:10.1007/s00190-012-0578-z](https://doi.org/10.1007/s00190-012-0578-z). The
|
|
81
|
+
package is therefore licensed `BSD-3-Clause AND MIT`; `LICENSE` carries both
|
|
82
|
+
texts, and every ported file opens with GeographicLib's legal comment. The
|
|
83
|
+
geodetic ↔ ECEF conversion follows H. Vermeille, _Direct transformation from
|
|
84
|
+
geocentric coordinates to geodetic coordinates_, J. Geodesy 76 (2002) 451–454
|
|
85
|
+
(its 2011 revision, J. Geodesy 85, 105–117, adds the region near the Earth's
|
|
86
|
+
centre, which is not offered); nothing else here is ported.
|
|
87
|
+
|
|
88
|
+
See the
|
|
89
|
+
[generated API docs](https://anthochamp.pages.grenadine.io/node-essentials/api/math-geodesy/)
|
|
90
|
+
for the full reference.
|
package/dist/_brand.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The brand of every value type of the math packages: a property with a string
|
|
3
|
+
* key that is stable across versions, so two installed copies of a package (two
|
|
4
|
+
* dependents pinning different minors) stay assignable to each other, which a
|
|
5
|
+
* per-package `unique symbol` would not allow.
|
|
6
|
+
*
|
|
7
|
+
* Declared identically and internally in each package, never imported across
|
|
8
|
+
* packages: the structure is the identity. The key is reserved, and the brand
|
|
9
|
+
* costs nothing at run time.
|
|
10
|
+
*/
|
|
11
|
+
export type Brand_<Name extends string> = {
|
|
12
|
+
readonly "~acKitMathType": Name;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=_brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_brand.d.ts","sourceRoot":"","sources":["../src/_brand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,MAAM,CAAC,IAAI,SAAS,MAAM,IAAI;IACzC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,CAAC;CAChC,CAAC"}
|
package/dist/_brand.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_brand.js","sourceRoot":"","sources":["../src/_brand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error bound of `ecefFromGeodetic` the README states, per coordinate, in
|
|
3
|
+
* units of `2⁻⁵³·(a + |h|)`. Measured worst 3.95 on the 500 000-point mpmath
|
|
4
|
+
* sweep of `scripts/ecef-sweep.ts` (heights from −6 000 km to 100 000 km).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ECEF_FORWARD_BOUND_EPSILONS_ = 5;
|
|
7
|
+
//# sourceMappingURL=_ecef-forward-bound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_ecef-forward-bound.d.ts","sourceRoot":"","sources":["../src/_ecef-forward-bound.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,IAAI,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error bound of `ecefFromGeodetic` the README states, per coordinate, in
|
|
3
|
+
* units of `2⁻⁵³·(a + |h|)`. Measured worst 3.95 on the 500 000-point mpmath
|
|
4
|
+
* sweep of `scripts/ecef-sweep.ts` (heights from −6 000 km to 100 000 km).
|
|
5
|
+
*/
|
|
6
|
+
export const ECEF_FORWARD_BOUND_EPSILONS_ = 5;
|
|
7
|
+
//# sourceMappingURL=_ecef-forward-bound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_ecef-forward-bound.js","sourceRoot":"","sources":["../src/_ecef-forward-bound.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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>;
|
|
9
|
+
/**
|
|
10
|
+
* The height above the ellipsoid of the point `(x, y, z)` whose foot on the
|
|
11
|
+
* ellipsoid has the sine of the geodetic latitude `s` (the latitude only to
|
|
12
|
+
* about 1e−15 rad: the height is stationary in it, so that costs a second-order
|
|
13
|
+
* 1e−29 m), evaluated in double-double arithmetic so the cancellation of terms
|
|
14
|
+
* of about 6 400 km costs nothing, then rounded once:
|
|
15
|
+
*
|
|
16
|
+
* h = (p − N·cosφ)·cosφ + (z − N·(1 − e²)·sinφ)·sinφ,
|
|
17
|
+
* p = √(x² + y²), N = a / w, w = √(cos²φ + (1 − f)²·sin²φ), cosφ = √(1 − sin²φ).
|
|
18
|
+
*
|
|
19
|
+
* The polar ratio `1 − f` is carried as a pair, as is every intermediate; the
|
|
20
|
+
* results of `Math.sqrt` are refined by one Newton step on the exact residual,
|
|
21
|
+
* and each product by Dekker's error term (Dekker, "A floating-point technique
|
|
22
|
+
* for extending the available precision", 1971; Ogita–Rump–Oishi 2005). Needs
|
|
23
|
+
* the coordinates within `[1e−150, 1e150]`: it squares them.
|
|
24
|
+
*
|
|
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_`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function heightAboveEllipsoid_(): void;
|
|
33
|
+
//# sourceMappingURL=_ecef-height.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,173 @@
|
|
|
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);
|
|
15
|
+
/**
|
|
16
|
+
* The height above the ellipsoid of the point `(x, y, z)` whose foot on the
|
|
17
|
+
* ellipsoid has the sine of the geodetic latitude `s` (the latitude only to
|
|
18
|
+
* about 1e−15 rad: the height is stationary in it, so that costs a second-order
|
|
19
|
+
* 1e−29 m), evaluated in double-double arithmetic so the cancellation of terms
|
|
20
|
+
* of about 6 400 km costs nothing, then rounded once:
|
|
21
|
+
*
|
|
22
|
+
* h = (p − N·cosφ)·cosφ + (z − N·(1 − e²)·sinφ)·sinφ,
|
|
23
|
+
* p = √(x² + y²), N = a / w, w = √(cos²φ + (1 − f)²·sin²φ), cosφ = √(1 − sin²φ).
|
|
24
|
+
*
|
|
25
|
+
* The polar ratio `1 − f` is carried as a pair, as is every intermediate; the
|
|
26
|
+
* results of `Math.sqrt` are refined by one Newton step on the exact residual,
|
|
27
|
+
* and each product by Dekker's error term (Dekker, "A floating-point technique
|
|
28
|
+
* for extending the available precision", 1971; Ogita–Rump–Oishi 2005). Needs
|
|
29
|
+
* the coordinates within `[1e−150, 1e150]`: it squares them.
|
|
30
|
+
*
|
|
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_`.
|
|
37
|
+
*/
|
|
38
|
+
export function heightAboveEllipsoid_() {
|
|
39
|
+
const x = heightRegisters_[HEIGHT_X_];
|
|
40
|
+
const y = heightRegisters_[HEIGHT_Y_];
|
|
41
|
+
const z = heightRegisters_[HEIGHT_Z_];
|
|
42
|
+
const s = heightRegisters_[HEIGHT_SINE_];
|
|
43
|
+
const semiMajorAxis = heightRegisters_[HEIGHT_SEMI_MAJOR_AXIS_];
|
|
44
|
+
const flattening = heightRegisters_[HEIGHT_FLATTENING_];
|
|
45
|
+
// p = √(x² + y²) as a pair
|
|
46
|
+
const x2 = x * x;
|
|
47
|
+
const y2 = y * y;
|
|
48
|
+
const q0 = x2 + 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];
|
|
61
|
+
const ph = Math.sqrt(q0);
|
|
62
|
+
pair_[0] = ph;
|
|
63
|
+
pair_[1] = ph;
|
|
64
|
+
twoProductInRangeInPlace(pair_);
|
|
65
|
+
const pl = (q0 - ph * ph - pair_[1] + q1) / (2 * ph) || 0;
|
|
66
|
+
// the polar ratio r = 1 − f and r², as pairs
|
|
67
|
+
const rh = 1 - flattening;
|
|
68
|
+
pair_[0] = 1;
|
|
69
|
+
pair_[1] = -flattening;
|
|
70
|
+
twoSumInPlace(pair_);
|
|
71
|
+
const rl = pair_[1];
|
|
72
|
+
const r2h = rh * rh;
|
|
73
|
+
pair_[0] = rh;
|
|
74
|
+
pair_[1] = rh;
|
|
75
|
+
twoProductInRangeInPlace(pair_);
|
|
76
|
+
const r2l = pair_[1] + 2 * rh * rl;
|
|
77
|
+
// sin²φ and cos²φ = 1 − sin²φ, and cosφ
|
|
78
|
+
const s2h = s * s;
|
|
79
|
+
pair_[0] = s;
|
|
80
|
+
pair_[1] = s;
|
|
81
|
+
twoProductInRangeInPlace(pair_);
|
|
82
|
+
const s2l = pair_[1];
|
|
83
|
+
const c2h = 1 - s2h;
|
|
84
|
+
pair_[0] = 1;
|
|
85
|
+
pair_[1] = -s2h;
|
|
86
|
+
twoSumInPlace(pair_);
|
|
87
|
+
const c2l = pair_[1] - s2l;
|
|
88
|
+
const ch = Math.sqrt(c2h);
|
|
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
|
+
}
|
|
96
|
+
// w² = cos²φ + r²·sin²φ, and w = √w², then 1/w as a pair
|
|
97
|
+
const m0 = r2h * s2h;
|
|
98
|
+
pair_[0] = r2h;
|
|
99
|
+
pair_[1] = s2h;
|
|
100
|
+
twoProductInRangeInPlace(pair_);
|
|
101
|
+
const m1 = pair_[1] + r2h * s2l + r2l * s2h;
|
|
102
|
+
const w2h = c2h + m0;
|
|
103
|
+
pair_[0] = c2h;
|
|
104
|
+
pair_[1] = m0;
|
|
105
|
+
twoSumInPlace(pair_);
|
|
106
|
+
const w2l = pair_[1] + c2l + m1;
|
|
107
|
+
const wh = Math.sqrt(w2h);
|
|
108
|
+
pair_[0] = wh;
|
|
109
|
+
pair_[1] = wh;
|
|
110
|
+
twoProductInRangeInPlace(pair_);
|
|
111
|
+
const wl = (w2h - wh * wh - pair_[1] + w2l) / (2 * wh);
|
|
112
|
+
const uh = 1 / wh;
|
|
113
|
+
pair_[0] = wh;
|
|
114
|
+
pair_[1] = uh;
|
|
115
|
+
twoProductInRangeInPlace(pair_);
|
|
116
|
+
const ul = uh * (1 - wh * uh - pair_[1] - wl * uh);
|
|
117
|
+
// F_p = a·cosφ / w
|
|
118
|
+
const aph = semiMajorAxis * ch;
|
|
119
|
+
pair_[0] = semiMajorAxis;
|
|
120
|
+
pair_[1] = ch;
|
|
121
|
+
twoProductInRangeInPlace(pair_);
|
|
122
|
+
const apl = pair_[1] + semiMajorAxis * cl;
|
|
123
|
+
const fph = aph * uh;
|
|
124
|
+
pair_[0] = aph;
|
|
125
|
+
pair_[1] = uh;
|
|
126
|
+
twoProductInRangeInPlace(pair_);
|
|
127
|
+
const fpl = pair_[1] + aph * ul + apl * uh;
|
|
128
|
+
// F_z = a·r²·sinφ / w
|
|
129
|
+
const azh = semiMajorAxis * s;
|
|
130
|
+
pair_[0] = semiMajorAxis;
|
|
131
|
+
pair_[1] = s;
|
|
132
|
+
twoProductInRangeInPlace(pair_);
|
|
133
|
+
const azl = pair_[1];
|
|
134
|
+
const bzh = azh * r2h;
|
|
135
|
+
pair_[0] = azh;
|
|
136
|
+
pair_[1] = r2h;
|
|
137
|
+
twoProductInRangeInPlace(pair_);
|
|
138
|
+
const bzl = pair_[1] + azh * r2l + azl * r2h;
|
|
139
|
+
const fzh = bzh * uh;
|
|
140
|
+
pair_[0] = bzh;
|
|
141
|
+
pair_[1] = uh;
|
|
142
|
+
twoProductInRangeInPlace(pair_);
|
|
143
|
+
const fzl = pair_[1] + bzh * ul + bzl * uh;
|
|
144
|
+
// the offsets of the point from the foot point
|
|
145
|
+
const dph = ph - fph;
|
|
146
|
+
pair_[0] = ph;
|
|
147
|
+
pair_[1] = -fph;
|
|
148
|
+
twoSumInPlace(pair_);
|
|
149
|
+
const dpl = pair_[1] + pl - fpl;
|
|
150
|
+
const dzh = z - fzh;
|
|
151
|
+
pair_[0] = z;
|
|
152
|
+
pair_[1] = -fzh;
|
|
153
|
+
twoSumInPlace(pair_);
|
|
154
|
+
const dzl = pair_[1] - fzl;
|
|
155
|
+
// h = dp·cosφ + dz·sinφ
|
|
156
|
+
const t0 = dph * ch;
|
|
157
|
+
const t1 = dzh * s;
|
|
158
|
+
const hh = t0 + t1;
|
|
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;
|
|
171
|
+
heightRegisters_[HEIGHT_RESULT_] = hh + hl;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=_ecef-height.js.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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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Brand_ } from "./_brand.js";
|
|
2
|
+
/**
|
|
3
|
+
* The reference ellipsoid of revolution: a parameter record, made only by
|
|
4
|
+
* {@link ellipsoidCreate} and frozen, not a value. It also carries, out of
|
|
5
|
+
* sight, the constants the geodesic solvers derive from it (a copy made by
|
|
6
|
+
* spread loses them and derives them again on first use).
|
|
7
|
+
*/
|
|
8
|
+
export type Ellipsoid = {
|
|
9
|
+
/** The equatorial radius `a`, metres. */
|
|
10
|
+
readonly semiMajorAxisM: number;
|
|
11
|
+
/** The flattening `f`; `0` for a sphere. */
|
|
12
|
+
readonly flattening: number;
|
|
13
|
+
/** The polar radius `a(1 − f)`, metres. */
|
|
14
|
+
readonly semiMinorAxisM: number;
|
|
15
|
+
/** The first eccentricity squared, `f(2 − f)`. */
|
|
16
|
+
readonly eccentricitySquared: number;
|
|
17
|
+
/** The second eccentricity squared, `e² / (1 − e²)`. */
|
|
18
|
+
readonly secondEccentricitySquared: number;
|
|
19
|
+
/** The third flattening, `f / (2 − f)`. */
|
|
20
|
+
readonly thirdFlattening: number;
|
|
21
|
+
} & Brand_<"Ellipsoid">;
|
|
22
|
+
/**
|
|
23
|
+
* Creates the ellipsoid of equatorial radius `semiMajorAxisM` metres and
|
|
24
|
+
* flattening `flattening` (`1 / 298.257223563` for WGS 84), computing the
|
|
25
|
+
* constants of the geodesic solvers once. Allocates; keep it out of hot loops.
|
|
26
|
+
*
|
|
27
|
+
* @throws {RangeError} Unless `semiMajorAxisM` is finite and positive and `0 ≤
|
|
28
|
+
* flattening < 1`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ellipsoidCreate(semiMajorAxisM: number, flattening: number): Ellipsoid;
|
|
31
|
+
/** The sphere of radius `radiusM` metres: flattening `0`. */
|
|
32
|
+
export declare function ellipsoidSphere(radiusM: number): Ellipsoid;
|
|
33
|
+
/** WGS 84: `a = 6 378 137 m`, `1/f = 298.257223563`. */
|
|
34
|
+
export declare const ELLIPSOID_WGS84: Ellipsoid;
|
|
35
|
+
/** GRS 80: `a = 6 378 137 m`, `1/f = 298.257222101`. */
|
|
36
|
+
export declare const ELLIPSOID_GRS80: Ellipsoid;
|
|
37
|
+
/**
|
|
38
|
+
* The radius of curvature of the meridian `M = a(1 − e²) / (1 − e²
|
|
39
|
+
* sin²φ)^(3/2)` at the geodetic latitude, metres, evaluated as `a(1 − f)² / w³`
|
|
40
|
+
* with `w² = 1 − e² sin²φ = (1 − f)² + e² cos²φ`, so an extreme flattening
|
|
41
|
+
* (whose `e²` rounds to 1) stays finite at the poles. A latitude beyond ±90° or
|
|
42
|
+
* not finite gives `NaN`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function ellipsoidMeridionalRadius(ellipsoid: Ellipsoid, latitudeDeg: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* The radius of curvature of the prime vertical `N = a / √(1 − e² sin²φ)` at
|
|
47
|
+
* the geodetic latitude, metres, evaluated as `a / w` with `w² = (1 − f)² + e²
|
|
48
|
+
* cos²φ` (see {@link ellipsoidMeridionalRadius}). A latitude beyond ±90° or not
|
|
49
|
+
* finite gives `NaN`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ellipsoidPrimeVerticalRadius(ellipsoid: Ellipsoid, latitudeDeg: number): number;
|
|
52
|
+
//# sourceMappingURL=ellipsoid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","sources":["../src/ellipsoid.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;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"}
|