@ac-kit/math-geodesy 0.0.0-stage → 0.1.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 +61 -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 +31 -0
- package/dist/_ecef-height.d.ts.map +1 -0
- package/dist/_ecef-height.js +99 -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 +51 -0
- package/dist/geodesic/_angle.d.ts.map +1 -0
- package/dist/geodesic/_angle.js +129 -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 +141 -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 +714 -0
- package/dist/geodesic/_inverse.js.map +1 -0
- package/dist/geodesic/_line.d.ts +38 -0
- package/dist/geodesic/_line.d.ts.map +1 -0
- package/dist/geodesic/_line.js +214 -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 +84 -0
- package/dist/geodesic.d.ts.map +1 -0
- package/dist/geodesic.js +197 -0
- package/dist/geodesic.js.map +1 -0
- package/dist/geodetic.d.ts +194 -0
- package/dist/geodetic.d.ts.map +1 -0
- package/dist/geodetic.js +430 -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 +35 -0
- package/dist/local-frame.js.map +1 -0
- package/package.json +72 -3
package/dist/geodetic.js
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { isCloseAbsolute, numberAtOrNaN } from "@ac-kit/core";
|
|
2
|
+
import { geometryConfig } from "@ac-kit/math-geometry";
|
|
3
|
+
import { vec3ArrayIsFinite, vec3Create } from "@ac-kit/math-linear";
|
|
4
|
+
import { atan2Deg, DEG_TO_RAD, sinDeg } from "@ac-kit/math-scalar";
|
|
5
|
+
import { HEIGHT_FLATTENING_, HEIGHT_RESULT_, HEIGHT_SEMI_MAJOR_AXIS_, HEIGHT_SINE_, HEIGHT_X_, HEIGHT_Y_, HEIGHT_Z_, heightAboveEllipsoid_, heightRegisters_, } from "./_ecef-height.js";
|
|
6
|
+
/**
|
|
7
|
+
* Every creator copies this array, which holds non-integer doubles and is never
|
|
8
|
+
* exposed.
|
|
9
|
+
*/
|
|
10
|
+
const TEMPLATE_ = [0.5, 0.5, 0.5];
|
|
11
|
+
/**
|
|
12
|
+
* Creates the position `[0, 0, 0]`.
|
|
13
|
+
*
|
|
14
|
+
* Allocates; keep it out of hot loops.
|
|
15
|
+
*/
|
|
16
|
+
export function geodeticCreate() {
|
|
17
|
+
const out = TEMPLATE_.slice();
|
|
18
|
+
out[0] = 0;
|
|
19
|
+
out[1] = 0;
|
|
20
|
+
out[2] = 0;
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates the position `longitudeDeg, latitudeDeg, heightM`.
|
|
25
|
+
*
|
|
26
|
+
* Allocates; keep it out of hot loops.
|
|
27
|
+
*/
|
|
28
|
+
export function geodeticOf(longitudeDeg, latitudeDeg, heightM) {
|
|
29
|
+
const out = TEMPLATE_.slice();
|
|
30
|
+
out[0] = longitudeDeg;
|
|
31
|
+
out[1] = latitudeDeg;
|
|
32
|
+
out[2] = heightM;
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a copy of `a`. Like every creator it starts from a clean array.
|
|
37
|
+
*
|
|
38
|
+
* Allocates; keep it out of hot loops.
|
|
39
|
+
*/
|
|
40
|
+
export function geodeticClone(a) {
|
|
41
|
+
const out = TEMPLATE_.slice();
|
|
42
|
+
out[0] = a[0];
|
|
43
|
+
out[1] = a[1];
|
|
44
|
+
out[2] = a[2];
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** Writes the components, in storage order, into `out`. */
|
|
48
|
+
export function geodeticSet(out, longitudeDeg, latitudeDeg, heightM) {
|
|
49
|
+
out[0] = longitudeDeg;
|
|
50
|
+
out[1] = latitudeDeg;
|
|
51
|
+
out[2] = heightM;
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
55
|
+
export function geodeticCopy(out, a) {
|
|
56
|
+
out[0] = a[0];
|
|
57
|
+
out[1] = a[1];
|
|
58
|
+
out[2] = a[2];
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Exact component-wise equality: `−0` equals `+0`, `NaN` equals nothing, itself
|
|
63
|
+
* included. A longitude of 180° and one of −180° are different numbers. See
|
|
64
|
+
* {@link geodeticIsClose} for a tolerant test.
|
|
65
|
+
*/
|
|
66
|
+
export function geodeticEquals(a, b) {
|
|
67
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Component-wise approximate equality: every pair differs by at most
|
|
71
|
+
* `tolerance`, the same absolute bound for degrees and metres (pass one that
|
|
72
|
+
* suits both, or compare the parts yourself). Longitudes are compared as
|
|
73
|
+
* numbers, not around the antimeridian.
|
|
74
|
+
*
|
|
75
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
76
|
+
*/
|
|
77
|
+
export function geodeticIsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
|
|
78
|
+
return (isCloseAbsolute(a[0], b[0], tolerance) &&
|
|
79
|
+
isCloseAbsolute(a[1], b[1], tolerance) &&
|
|
80
|
+
isCloseAbsolute(a[2], b[2], tolerance));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The checked way in from untyped data: `source[offset … offset + 3)` copied
|
|
84
|
+
* into `out`, each element that is not a number written as `NaN`, an index past
|
|
85
|
+
* the end too. A cold path: buffers use {@link geodeticLoad}. `source` may be
|
|
86
|
+
* `out`. O(1).
|
|
87
|
+
*/
|
|
88
|
+
export function geodeticFromArray(out, source, offset = 0) {
|
|
89
|
+
const value0 = numberAtOrNaN(source, offset);
|
|
90
|
+
const value1 = numberAtOrNaN(source, offset + 1);
|
|
91
|
+
const value2 = numberAtOrNaN(source, offset + 2);
|
|
92
|
+
out[0] = value0;
|
|
93
|
+
out[1] = value1;
|
|
94
|
+
out[2] = value2;
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Whether every component is a finite number: the check after parsing untrusted
|
|
99
|
+
* data.
|
|
100
|
+
*/
|
|
101
|
+
export function geodeticIsFinite(value) {
|
|
102
|
+
return (Number.isFinite(value[0]) &&
|
|
103
|
+
Number.isFinite(value[1]) &&
|
|
104
|
+
Number.isFinite(value[2]));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Writes element `index` of `array`, the numbers at `[index·3, index·3 + 3)`,
|
|
108
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
109
|
+
* end gives `NaN`, never `undefined`. O(1).
|
|
110
|
+
*/
|
|
111
|
+
export function geodeticLoad(out, array, index) {
|
|
112
|
+
const base = index * 3;
|
|
113
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
114
|
+
out[0] = +array[base];
|
|
115
|
+
out[1] = +array[base + 1];
|
|
116
|
+
out[2] = +array[base + 2];
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Writes `value` into `array` as element `index`. An element past the end of
|
|
121
|
+
* `array` writes nothing. O(1).
|
|
122
|
+
*/
|
|
123
|
+
export function geodeticStore(array, index, value) {
|
|
124
|
+
const base = index * 3;
|
|
125
|
+
array[base] = value[0];
|
|
126
|
+
array[base + 1] = value[1];
|
|
127
|
+
array[base + 2] = value[2];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Like {@link geodeticLoad} for interleaved data: element `index` starts at
|
|
131
|
+
* `offset + index·stride`, both counted in numbers. O(1).
|
|
132
|
+
*/
|
|
133
|
+
export function geodeticLoadStrided(out, array, offset, stride, index) {
|
|
134
|
+
const base = offset + index * stride;
|
|
135
|
+
out[0] = +array[base];
|
|
136
|
+
out[1] = +array[base + 1];
|
|
137
|
+
out[2] = +array[base + 2];
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Like {@link geodeticStore} for interleaved data: element `index` starts at
|
|
142
|
+
* `offset + index·stride`, both counted in numbers. O(1).
|
|
143
|
+
*/
|
|
144
|
+
export function geodeticStoreStrided(array, offset, stride, index, value) {
|
|
145
|
+
const base = offset + index * stride;
|
|
146
|
+
array[base] = value[0];
|
|
147
|
+
array[base + 1] = value[1];
|
|
148
|
+
array[base + 2] = value[2];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Whether every number of `array` is finite (`vec3ArrayIsFinite`: a buffer of
|
|
152
|
+
* triples). O(n).
|
|
153
|
+
*/
|
|
154
|
+
export function geodeticArrayIsFinite(array) {
|
|
155
|
+
return vec3ArrayIsFinite(array);
|
|
156
|
+
}
|
|
157
|
+
/** Creates the result `[0, 0, 0]`. Allocates; keep it out of hot loops. */
|
|
158
|
+
export function geodesicInverseCreate() {
|
|
159
|
+
const out = TEMPLATE_.slice();
|
|
160
|
+
out[0] = 0;
|
|
161
|
+
out[1] = 0;
|
|
162
|
+
out[2] = 0;
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/** Creates the result `distanceM, azimuth1Deg, azimuth2Deg`. Allocates. */
|
|
166
|
+
export function geodesicInverseOf(distanceM, azimuth1Deg, azimuth2Deg) {
|
|
167
|
+
const out = TEMPLATE_.slice();
|
|
168
|
+
out[0] = distanceM;
|
|
169
|
+
out[1] = azimuth1Deg;
|
|
170
|
+
out[2] = azimuth2Deg;
|
|
171
|
+
return out;
|
|
172
|
+
}
|
|
173
|
+
/** Creates a copy of `a`. Allocates. */
|
|
174
|
+
export function geodesicInverseClone(a) {
|
|
175
|
+
const out = TEMPLATE_.slice();
|
|
176
|
+
out[0] = a[0];
|
|
177
|
+
out[1] = a[1];
|
|
178
|
+
out[2] = a[2];
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
/** Writes the components into `out`. */
|
|
182
|
+
export function geodesicInverseSet(out, distanceM, azimuth1Deg, azimuth2Deg) {
|
|
183
|
+
out[0] = distanceM;
|
|
184
|
+
out[1] = azimuth1Deg;
|
|
185
|
+
out[2] = azimuth2Deg;
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
189
|
+
export function geodesicInverseCopy(out, a) {
|
|
190
|
+
out[0] = a[0];
|
|
191
|
+
out[1] = a[1];
|
|
192
|
+
out[2] = a[2];
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
/** Exact component-wise equality: `NaN` equals nothing, itself included. */
|
|
196
|
+
export function geodesicInverseEquals(a, b) {
|
|
197
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Component-wise approximate equality with one absolute `tolerance` for the
|
|
201
|
+
* metres and the degrees. Azimuths are compared as numbers, not around ±180°.
|
|
202
|
+
*
|
|
203
|
+
* @param tolerance Defaults to `geometryConfig.defaultLinearTolerance`.
|
|
204
|
+
*/
|
|
205
|
+
export function geodesicInverseIsClose(a, b, tolerance = geometryConfig.defaultLinearTolerance) {
|
|
206
|
+
return (isCloseAbsolute(a[0], b[0], tolerance) &&
|
|
207
|
+
isCloseAbsolute(a[1], b[1], tolerance) &&
|
|
208
|
+
isCloseAbsolute(a[2], b[2], tolerance));
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Whether every component is a finite number: `false` for the `NaN` result of
|
|
212
|
+
* an undefined problem.
|
|
213
|
+
*/
|
|
214
|
+
export function geodesicInverseIsFinite(value) {
|
|
215
|
+
return (Number.isFinite(value[0]) &&
|
|
216
|
+
Number.isFinite(value[1]) &&
|
|
217
|
+
Number.isFinite(value[2]));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Writes the Earth-centred, Earth-fixed coordinates, metres, of the geodetic
|
|
221
|
+
* `position` on `ellipsoid` into `out`: x through the equator at longitude 0, z
|
|
222
|
+
* through the north pole.
|
|
223
|
+
*
|
|
224
|
+
* The closed form `x = (N + h)·cosφ·cosλ`, `y = (N + h)·cosφ·sinλ`, `z = (N(1 −
|
|
225
|
+
* e²) + h)·sinφ` with the prime-vertical radius `N = a / √(cos²φ + (1 −
|
|
226
|
+
* f)²·sin²φ)`, using the polar ratio `1 − f` itself so that an extreme
|
|
227
|
+
* flattening (whose `e²` rounds to 1) still works. Each angle is reduced
|
|
228
|
+
* exactly in degrees to within 45° of a multiple of 90°, as `sinDeg` does; the
|
|
229
|
+
* remainder's sine comes from `Math.sin` and its cosine from `√(1 − sin²)`, so
|
|
230
|
+
* the poles and the cardinal meridians are exact. Each coordinate is within
|
|
231
|
+
* `5·2⁻⁵³·(a + |h|)` of the exact value, 3.5 nm at sea level (see the README).
|
|
232
|
+
* A component that is not finite gives `NaN` in all three; any finite height
|
|
233
|
+
* works. O(1).
|
|
234
|
+
*/
|
|
235
|
+
export function ecefFromGeodetic(out, position, ellipsoid) {
|
|
236
|
+
ecefInputScratch_[0] = position[0];
|
|
237
|
+
ecefInputScratch_[1] = position[1];
|
|
238
|
+
ecefInputScratch_[2] = position[2];
|
|
239
|
+
ecefWrite_(ecefOutputScratch_, ecefInputScratch_, 0, ellipsoid);
|
|
240
|
+
out[0] = ecefOutputScratch_[0];
|
|
241
|
+
out[1] = ecefOutputScratch_[1];
|
|
242
|
+
out[2] = ecefOutputScratch_[2];
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
const ecefInputScratch_ = new Float64Array(3);
|
|
246
|
+
const ecefOutputScratch_ = new Float64Array(3);
|
|
247
|
+
const ONE_NINETIETH_ = 1 / 90;
|
|
248
|
+
/**
|
|
249
|
+
* The forward conversion of the triple at `input[base … base + 3)` into
|
|
250
|
+
* `out[base … base + 3)`, reading before writing. Its parameters are arrays, an
|
|
251
|
+
* index and the record, never a double, so V8 boxes nothing when it does not
|
|
252
|
+
* inline it. Multiplying by `1/90` rather than dividing may round a quotient
|
|
253
|
+
* near an odd multiple of 45° the other way, which only picks the other
|
|
254
|
+
* quadrant of two equally accurate ones; the multiples of 90° stay exact.
|
|
255
|
+
*/
|
|
256
|
+
function ecefWrite_(out, input, base, ellipsoid) {
|
|
257
|
+
const longitude = input[base];
|
|
258
|
+
const latitude = input[base + 1];
|
|
259
|
+
const height = input[base + 2];
|
|
260
|
+
if (!(Number.isFinite(longitude) &&
|
|
261
|
+
Number.isFinite(latitude) &&
|
|
262
|
+
Number.isFinite(height))) {
|
|
263
|
+
out[base] = Number.NaN;
|
|
264
|
+
out[base + 1] = Number.NaN;
|
|
265
|
+
out[base + 2] = Number.NaN;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
// Longitude and latitude reduced to (−180, 180], then to a remainder within
|
|
269
|
+
// 45° of the multiple `quadrant`·90°.
|
|
270
|
+
let longitudeReduced = longitude > -180 && longitude <= 180 ? longitude : longitude % 360;
|
|
271
|
+
if (longitudeReduced > 180) {
|
|
272
|
+
longitudeReduced -= 360;
|
|
273
|
+
}
|
|
274
|
+
else if (longitudeReduced <= -180) {
|
|
275
|
+
longitudeReduced += 360;
|
|
276
|
+
}
|
|
277
|
+
const longitudeQuarters = longitudeReduced * ONE_NINETIETH_;
|
|
278
|
+
const longitudeQuadrant = Math.round(longitudeQuarters);
|
|
279
|
+
const longitudeSine0 = Math.sin((longitudeReduced - 90 * longitudeQuadrant) * DEG_TO_RAD);
|
|
280
|
+
const longitudeCosine0 = Math.sqrt(1 - longitudeSine0 * longitudeSine0);
|
|
281
|
+
let latitudeReduced = latitude > -180 && latitude <= 180 ? latitude : latitude % 360;
|
|
282
|
+
if (latitudeReduced > 180) {
|
|
283
|
+
latitudeReduced -= 360;
|
|
284
|
+
}
|
|
285
|
+
else if (latitudeReduced <= -180) {
|
|
286
|
+
latitudeReduced += 360;
|
|
287
|
+
}
|
|
288
|
+
const latitudeQuarters = latitudeReduced * ONE_NINETIETH_;
|
|
289
|
+
const latitudeQuadrant = Math.round(latitudeQuarters);
|
|
290
|
+
const latitudeSine0 = Math.sin((latitudeReduced - 90 * latitudeQuadrant) * DEG_TO_RAD);
|
|
291
|
+
const latitudeCosine0 = Math.sqrt(1 - latitudeSine0 * latitudeSine0);
|
|
292
|
+
// The quadrant's swap and signs as factors 0, 1 and ±1 (exact products), not
|
|
293
|
+
// branches: random quadrants would mispredict them.
|
|
294
|
+
const longitudeSwap = longitudeQuadrant & 1;
|
|
295
|
+
const latitudeSwap = latitudeQuadrant & 1;
|
|
296
|
+
const sinLongitude = (1 - (longitudeQuadrant & 2)) *
|
|
297
|
+
(longitudeSine0 * (1 - longitudeSwap) + longitudeCosine0 * longitudeSwap);
|
|
298
|
+
const cosLongitude = (1 - ((longitudeQuadrant + 1) & 2)) *
|
|
299
|
+
(longitudeCosine0 * (1 - longitudeSwap) + longitudeSine0 * longitudeSwap);
|
|
300
|
+
const sinLatitude = (1 - (latitudeQuadrant & 2)) *
|
|
301
|
+
(latitudeSine0 * (1 - latitudeSwap) + latitudeCosine0 * latitudeSwap);
|
|
302
|
+
const cosLatitude = (1 - ((latitudeQuadrant + 1) & 2)) *
|
|
303
|
+
(latitudeCosine0 * (1 - latitudeSwap) + latitudeSine0 * latitudeSwap);
|
|
304
|
+
const polarRatio = 1 - ellipsoid.flattening;
|
|
305
|
+
const polarRatioSquared = polarRatio * polarRatio;
|
|
306
|
+
const primeVertical = ellipsoid.semiMajorAxisM /
|
|
307
|
+
Math.sqrt(cosLatitude * cosLatitude +
|
|
308
|
+
polarRatioSquared * (sinLatitude * sinLatitude));
|
|
309
|
+
const radial = (primeVertical + height) * cosLatitude;
|
|
310
|
+
// `+ 0` turns the −0 of a zero cosine into +0.
|
|
311
|
+
out[base] = radial * cosLongitude + 0;
|
|
312
|
+
out[base + 1] = radial * sinLongitude + 0;
|
|
313
|
+
out[base + 2] = (primeVertical * polarRatioSquared + height) * sinLatitude;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Writes the geodetic position of the Earth-centred point `point`, metres, on
|
|
317
|
+
* `ellipsoid` into `out`: longitude in `(−180, 180]`, latitude in `[−90, 90]`,
|
|
318
|
+
* and the height along the ellipsoid normal.
|
|
319
|
+
*
|
|
320
|
+
* Vermeille's closed form (J. Geodesy 76 (2002) 451–454, which solves a quartic
|
|
321
|
+
* for the latitude without iteration) gives the latitude, to 1e−13°. The height
|
|
322
|
+
* is the offset of the point from its foot on the ellipsoid along the normal,
|
|
323
|
+
* which is stationary in the latitude, evaluated in double-double arithmetic
|
|
324
|
+
* (`_ecef-height.ts`): the rounding of 6 400 km terms, 1 to 3 nm in plain
|
|
325
|
+
* doubles, costs nothing. Against 80-digit references of the exact point, for
|
|
326
|
+
* heights from −6 000 km to 10 000 km: see the README. The centre of the Earth
|
|
327
|
+
* has no geodetic position, and a component that is not finite gives `NaN` in
|
|
328
|
+
* all three. Valid for coordinates within `[1e−150, 1e150]`: the squares stay
|
|
329
|
+
* finite, and far from the Earth the quartic, which depends only on `p/e⁴` and
|
|
330
|
+
* `q/e⁴`, is scaled by a power of two so its cubes do not overflow. O(1).
|
|
331
|
+
*/
|
|
332
|
+
export function geodeticFromEcef(out, point, ellipsoid) {
|
|
333
|
+
const x = point[0];
|
|
334
|
+
const y = point[1];
|
|
335
|
+
const z = point[2];
|
|
336
|
+
const equatorialSquared = x * x + y * y;
|
|
337
|
+
if (!(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z)) ||
|
|
338
|
+
!(equatorialSquared + z * z > 0)) {
|
|
339
|
+
// Not finite, or the centre of the Earth, which has no geodetic position.
|
|
340
|
+
out[0] = Number.NaN;
|
|
341
|
+
out[1] = Number.NaN;
|
|
342
|
+
out[2] = Number.NaN;
|
|
343
|
+
return out;
|
|
344
|
+
}
|
|
345
|
+
const semiMajorAxis = ellipsoid.semiMajorAxisM;
|
|
346
|
+
const polarRatio = 1 - ellipsoid.flattening;
|
|
347
|
+
const equatorial = Math.sqrt(equatorialSquared);
|
|
348
|
+
let p = equatorialSquared / (semiMajorAxis * semiMajorAxis);
|
|
349
|
+
let q = ((polarRatio * polarRatio) / (semiMajorAxis * semiMajorAxis)) * z * z;
|
|
350
|
+
let eccentricitySquared = ellipsoid.eccentricitySquared;
|
|
351
|
+
// The solution depends only on p/e⁴ and q/e⁴: far from the Earth, scale p,
|
|
352
|
+
// q and e⁴ by a power of two (exact), so that p·q and r³ do not overflow.
|
|
353
|
+
if (p + q > LARGE_QUARTIC_) {
|
|
354
|
+
const halfExponent = Math.ceil(Math.log2(p + q) / 2);
|
|
355
|
+
const scale = 2 ** -halfExponent;
|
|
356
|
+
p *= scale * scale;
|
|
357
|
+
q *= scale * scale;
|
|
358
|
+
eccentricitySquared *= scale;
|
|
359
|
+
}
|
|
360
|
+
const eccentricityFourth = eccentricitySquared * eccentricitySquared;
|
|
361
|
+
const r = (p + q - eccentricityFourth) / 6;
|
|
362
|
+
const s = (eccentricityFourth * p * q) / (4 * r * r * r);
|
|
363
|
+
const t = Math.cbrt(1 + s + Math.sqrt(s * (2 + s)));
|
|
364
|
+
const u = r * (1 + t + 1 / t);
|
|
365
|
+
const v = Math.sqrt(u * u + eccentricityFourth * q);
|
|
366
|
+
const w = (eccentricitySquared * (u + v - q)) / (2 * v);
|
|
367
|
+
const k = Math.sqrt(u + v + w * w) - w;
|
|
368
|
+
const d = (k * equatorial) / (k + eccentricitySquared);
|
|
369
|
+
const rho = Math.sqrt(d * d + z * z);
|
|
370
|
+
const latitude = 2 * atan2Deg(z, d + rho);
|
|
371
|
+
out[0] = atan2Deg(y, x);
|
|
372
|
+
out[1] = latitude;
|
|
373
|
+
heightRegisters_[HEIGHT_X_] = x;
|
|
374
|
+
heightRegisters_[HEIGHT_Y_] = y;
|
|
375
|
+
heightRegisters_[HEIGHT_Z_] = z;
|
|
376
|
+
heightRegisters_[HEIGHT_SINE_] = sinDeg(latitude);
|
|
377
|
+
heightRegisters_[HEIGHT_SEMI_MAJOR_AXIS_] = semiMajorAxis;
|
|
378
|
+
heightRegisters_[HEIGHT_FLATTENING_] = ellipsoid.flattening;
|
|
379
|
+
heightAboveEllipsoid_();
|
|
380
|
+
out[2] = heightRegisters_[HEIGHT_RESULT_];
|
|
381
|
+
return out;
|
|
382
|
+
}
|
|
383
|
+
function assertBulk_(name, out, input) {
|
|
384
|
+
if (out.length !== input.length || input.length % 3 !== 0) {
|
|
385
|
+
throw new RangeError(`${name}: out and input must have the same length, a multiple of 3 (got ${out.length} and ${input.length}).`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const geodeticScratch_ = geodeticCreate();
|
|
389
|
+
const pointScratch_ = vec3Create();
|
|
390
|
+
/**
|
|
391
|
+
* Above this `p + q` (a point farther than about `a·2¹⁵⁰`), Vermeille's quartic
|
|
392
|
+
* is scaled: its cube of `r` would overflow from about 1e102.
|
|
393
|
+
*/
|
|
394
|
+
const LARGE_QUARTIC_ = 2 ** 300;
|
|
395
|
+
/**
|
|
396
|
+
* Writes the Earth-centred coordinates of every geodetic triple of `input`
|
|
397
|
+
* (`[longitudeDeg, latitudeDeg, heightM, …]`) into `out` (as
|
|
398
|
+
* {@link ecefFromGeodetic}), the count taken from the length. `out` may be
|
|
399
|
+
* `input` (in place). O(n).
|
|
400
|
+
*
|
|
401
|
+
* @throws {RangeError} Unless both have the same length, a multiple of 3.
|
|
402
|
+
*/
|
|
403
|
+
export function ecefArrayFromGeodetic(out, input, ellipsoid) {
|
|
404
|
+
assertBulk_("ecefArrayFromGeodetic", out, input);
|
|
405
|
+
for (let base = 0; base < input.length; base += 3) {
|
|
406
|
+
ecefWrite_(out, input, base, ellipsoid);
|
|
407
|
+
}
|
|
408
|
+
return out;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Writes the geodetic triple of every Earth-centred point of `input` into `out`
|
|
412
|
+
* (as {@link geodeticFromEcef}), the count taken from the length. `out` may be
|
|
413
|
+
* `input` (in place). O(n).
|
|
414
|
+
*
|
|
415
|
+
* @throws {RangeError} Unless both have the same length, a multiple of 3.
|
|
416
|
+
*/
|
|
417
|
+
export function geodeticArrayFromEcef(out, input, ellipsoid) {
|
|
418
|
+
assertBulk_("geodeticArrayFromEcef", out, input);
|
|
419
|
+
for (let base = 0; base < input.length; base += 3) {
|
|
420
|
+
pointScratch_[0] = input[base];
|
|
421
|
+
pointScratch_[1] = input[base + 1];
|
|
422
|
+
pointScratch_[2] = input[base + 2];
|
|
423
|
+
geodeticFromEcef(geodeticScratch_, pointScratch_, ellipsoid);
|
|
424
|
+
out[base] = geodeticScratch_[0];
|
|
425
|
+
out[base + 1] = geodeticScratch_[1];
|
|
426
|
+
out[base + 2] = geodeticScratch_[2];
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}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AgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type LocalAxes } from "@ac-kit/math-geometry";
|
|
2
|
+
import { type Affine3 } from "@ac-kit/math-linear";
|
|
3
|
+
import type { Ellipsoid } from "./ellipsoid.js";
|
|
4
|
+
import { type ReadonlyGeodetic } from "./geodetic.js";
|
|
5
|
+
/**
|
|
6
|
+
* Writes into `out` the transform from Earth-centred metres to local metres at
|
|
7
|
+
* `origin`: `local = R·(ecef − ecef(origin))`, where `R` is
|
|
8
|
+
* `mat3x3FromLocalFrame` at the origin's longitude and geodetic latitude, so
|
|
9
|
+
* the up axis is the ellipsoid normal (not the direction to the Earth's
|
|
10
|
+
* centre). The origin maps to `0`. Apply it with `vec3TransformAffine3` or
|
|
11
|
+
* `vec3ArrayTransformAffine3`.
|
|
12
|
+
*
|
|
13
|
+
* Built once per origin (a frame is a builder: it throws).
|
|
14
|
+
*
|
|
15
|
+
* @param axes `"east-north-up"` or `"north-east-down"`.
|
|
16
|
+
* @throws {RangeError} For `axes` other than the two named.
|
|
17
|
+
*/
|
|
18
|
+
export declare function affine3FromLocalFrame(out: Affine3, origin: ReadonlyGeodetic, ellipsoid: Ellipsoid, axes: LocalAxes): Affine3;
|
|
19
|
+
//# sourceMappingURL=local-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-frame.d.ts","sourceRoot":"","sources":["../src/local-frame.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,OAAO,EAKZ,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAOxE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,SAAS,GACb,OAAO,CAYT"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { longitudeLatitudeCreate, mat3x3FromLocalFrame, } from "@ac-kit/math-geometry";
|
|
2
|
+
import { affine3FromMat3x3, mat3x3Create, vec3Create, vec3TransformMat3x3, } from "@ac-kit/math-linear";
|
|
3
|
+
import { angleNormalizeDeg, DEG_TO_RAD } from "@ac-kit/math-scalar";
|
|
4
|
+
import { ecefFromGeodetic } from "./geodetic.js";
|
|
5
|
+
const rotationScratch_ = mat3x3Create();
|
|
6
|
+
const anglesScratch_ = longitudeLatitudeCreate();
|
|
7
|
+
const originScratch_ = vec3Create();
|
|
8
|
+
const translationScratch_ = vec3Create();
|
|
9
|
+
/**
|
|
10
|
+
* Writes into `out` the transform from Earth-centred metres to local metres at
|
|
11
|
+
* `origin`: `local = R·(ecef − ecef(origin))`, where `R` is
|
|
12
|
+
* `mat3x3FromLocalFrame` at the origin's longitude and geodetic latitude, so
|
|
13
|
+
* the up axis is the ellipsoid normal (not the direction to the Earth's
|
|
14
|
+
* centre). The origin maps to `0`. Apply it with `vec3TransformAffine3` or
|
|
15
|
+
* `vec3ArrayTransformAffine3`.
|
|
16
|
+
*
|
|
17
|
+
* Built once per origin (a frame is a builder: it throws).
|
|
18
|
+
*
|
|
19
|
+
* @param axes `"east-north-up"` or `"north-east-down"`.
|
|
20
|
+
* @throws {RangeError} For `axes` other than the two named.
|
|
21
|
+
*/
|
|
22
|
+
export function affine3FromLocalFrame(out, origin, ellipsoid, axes) {
|
|
23
|
+
// Reduced in degrees first: a huge longitude loses its turns in radians.
|
|
24
|
+
anglesScratch_[0] = angleNormalizeDeg(origin[0]) * DEG_TO_RAD;
|
|
25
|
+
anglesScratch_[1] = angleNormalizeDeg(origin[1]) * DEG_TO_RAD;
|
|
26
|
+
mat3x3FromLocalFrame(rotationScratch_, anglesScratch_, axes);
|
|
27
|
+
ecefFromGeodetic(originScratch_, origin, ellipsoid);
|
|
28
|
+
vec3TransformMat3x3(translationScratch_, originScratch_, rotationScratch_);
|
|
29
|
+
affine3FromMat3x3(out, rotationScratch_);
|
|
30
|
+
out[9] = -translationScratch_[0];
|
|
31
|
+
out[10] = -translationScratch_[1];
|
|
32
|
+
out[11] = -translationScratch_[2];
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=local-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-frame.js","sourceRoot":"","sources":["../src/local-frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,uBAAuB,EACvB,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,gBAAgB,EAAyB,MAAM,eAAe,CAAC;AAExE,MAAM,gBAAgB,GAAG,YAAY,EAAE,CAAC;AACxC,MAAM,cAAc,GAAG,uBAAuB,EAAE,CAAC;AACjD,MAAM,cAAc,GAAG,UAAU,EAAE,CAAC;AACpC,MAAM,mBAAmB,GAAG,UAAU,EAAE,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACpC,GAAY,EACZ,MAAwB,EACxB,SAAoB,EACpB,IAAe;IAEf,yEAAyE;IACzE,cAAc,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAC9D,cAAc,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAC9D,oBAAoB,CAAC,gBAAgB,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC7D,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACpD,mBAAmB,CAAC,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAC3E,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IACzC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACjC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/math-geodesy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Earth's reference ellipsoid: geodetic and ECEF coordinates, local frames and geodesics (direct, inverse and lines).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ecef",
|
|
7
|
+
"ellipsoid",
|
|
8
|
+
"geodesic",
|
|
9
|
+
"geodesy",
|
|
10
|
+
"wgs84"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://anthochamp.pages.grenadine.io/node-essentials/api/math-geodesy/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://git.grenadine.io/anthochamp/node-essentials/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "BSD-3-Clause AND MIT",
|
|
17
|
+
"author": "Anthony Champagne <dev@anthonychampagne.fr>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://git.grenadine.io/anthochamp/node-essentials.git",
|
|
21
|
+
"directory": "packages/math-geodesy"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"compile": "tsc -p ./tsconfig.build.json -outDir dist",
|
|
41
|
+
"compile:check": "tsc -noEmit -p ./tsconfig.json",
|
|
42
|
+
"clean": "rimraf dist",
|
|
43
|
+
"build": "yarn clean && yarn compile",
|
|
44
|
+
"test": "yarn run -T vitest run",
|
|
45
|
+
"test:geodtest": "node --import tsx ./scripts/geodtest-full.ts",
|
|
46
|
+
"test:ecef-sweep": "node --import tsx ./scripts/ecef-sweep.ts",
|
|
47
|
+
"prepack": "yarn build"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@ac-kit/core": "^0.12.0",
|
|
51
|
+
"@ac-kit/math-geometry": "^0.3.0",
|
|
52
|
+
"@ac-kit/math-linear": "^0.3.0",
|
|
53
|
+
"@ac-kit/math-scalar": "^0.3.0",
|
|
54
|
+
"@types/web": "^0.0.367"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@ac-kit/math-random": "0.4.0",
|
|
58
|
+
"@ac-kit/tsconfig": "0.1.0",
|
|
59
|
+
"@ac-kit/typedoc-config": "0.1.0",
|
|
60
|
+
"@ac-kit/vitest-config": "0.2.0",
|
|
61
|
+
"@types/node": "26.6.11",
|
|
62
|
+
"@typescript/native": "typescript@7.0.2",
|
|
63
|
+
"geographiclib-geodesic": "2.2.0",
|
|
64
|
+
"proj4": "2.23.0",
|
|
65
|
+
"rimraf": "6.1.4",
|
|
66
|
+
"tsx": "4.23.15",
|
|
67
|
+
"typedoc": "0.28.20",
|
|
68
|
+
"typescript": "@typescript/typescript6@6.0.2",
|
|
69
|
+
"vite": "8.4.0",
|
|
70
|
+
"vitest": "5.1.2"
|
|
71
|
+
},
|
|
72
|
+
"engines": {
|
|
73
|
+
"node": ">=24"
|
|
74
|
+
}
|
|
6
75
|
}
|