@wemap/geo 14.4.0 → 14.5.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/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import booleanPointInPolygon from "@turf/boolean-point-in-polygon";
2
- var __defProp$1 = Object.defineProperty, __export = (a) => {
3
- let A = {};
4
- for (var j in a) __defProp$1(A, j, {
5
- get: a[j],
2
+ var __defProp$1 = Object.defineProperty, __export = (e) => {
3
+ let T = {};
4
+ for (var E in e) __defProp$1(T, E, {
5
+ get: e[E],
6
6
  enumerable: !0
7
7
  });
8
- return A;
8
+ return T;
9
9
  }, Constants_exports = /* @__PURE__ */ __export({
10
10
  CIRCUMFERENCE: () => CIRCUMFERENCE,
11
11
  EARTH_GRAVITY: () => EARTH_GRAVITY,
@@ -22,65 +22,65 @@ var __defProp$1 = Object.defineProperty, __export = (a) => {
22
22
  R_MINOR_4: () => R_MINOR_4
23
23
  });
24
24
  const R_MAJOR = 6378137, R_MINOR = 6356752.3142, EARTH_GRAVITY = 9.80665, EPS_DEG_MM = 1e-8, EPS_MM = .001, ELLIPSOID_FLATNESS = (R_MAJOR - R_MINOR) / R_MAJOR, ECCENTRICITY = Math.sqrt(ELLIPSOID_FLATNESS * (2 - ELLIPSOID_FLATNESS)), ECCENTRICITY_2 = ECCENTRICITY * ECCENTRICITY, R_MAJOR_2 = R_MAJOR * R_MAJOR, R_MAJOR_4 = R_MAJOR_2 * R_MAJOR_2, R_MINOR_2 = R_MINOR * R_MINOR, R_MINOR_4 = R_MINOR_2 * R_MINOR_2, CIRCUMFERENCE = R_MAJOR * 2 * Math.PI;
25
- var __defProp = Object.defineProperty, __defNormalProp = (a, k, A) => k in a ? __defProp(a, k, {
25
+ var __defProp = Object.defineProperty, __defNormalProp = (e, w, T) => w in e ? __defProp(e, w, {
26
26
  enumerable: !0,
27
27
  configurable: !0,
28
28
  writable: !0,
29
- value: A
30
- }) : a[k] = A, __publicField = (a, k, A) => (__defNormalProp(a, typeof k == "symbol" ? k : k + "", A), A), Vector = class {
31
- static concat(a, k) {
32
- return a.concat(k);
29
+ value: T
30
+ }) : e[w] = T, __publicField = (e, w, T) => (__defNormalProp(e, typeof w == "symbol" ? w : w + "", T), T), Vector = class {
31
+ static concat(e, w) {
32
+ return e.concat(w);
33
33
  }
34
- }, Vector3 = class a extends Vector {
35
- static norm(a) {
36
- return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
34
+ }, Vector3 = class e extends Vector {
35
+ static norm(e) {
36
+ return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
37
37
  }
38
- static normalize(a) {
39
- let k = this.norm(a), A = [
38
+ static normalize(e) {
39
+ let w = this.norm(e), T = [
40
40
  ,
41
41
  ,
42
42
  ,
43
43
  ];
44
- for (let j = 0; j < 3; j++) A[j] = a[j] / k;
45
- return A;
44
+ for (let E = 0; E < 3; E++) T[E] = e[E] / w;
45
+ return T;
46
46
  }
47
- static sum(a, k) {
47
+ static sum(e, w) {
48
48
  return [
49
- a[0] + k[0],
50
- a[1] + k[1],
51
- a[2] + k[2]
49
+ e[0] + w[0],
50
+ e[1] + w[1],
51
+ e[2] + w[2]
52
52
  ];
53
53
  }
54
- static subtract(a, k) {
54
+ static subtract(e, w) {
55
55
  return [
56
- a[0] - k[0],
57
- a[1] - k[1],
58
- a[2] - k[2]
56
+ e[0] - w[0],
57
+ e[1] - w[1],
58
+ e[2] - w[2]
59
59
  ];
60
60
  }
61
- static distance(k, A) {
62
- return a.norm(a.subtract(k, A));
61
+ static distance(w, T) {
62
+ return e.norm(e.subtract(w, T));
63
63
  }
64
- static cross(a, k) {
64
+ static cross(e, w) {
65
65
  return [
66
- a[1] * k[2] - a[2] * k[1],
67
- a[2] * k[0] - a[0] * k[2],
68
- a[0] * k[1] - a[1] * k[0]
66
+ e[1] * w[2] - e[2] * w[1],
67
+ e[2] * w[0] - e[0] * w[2],
68
+ e[0] * w[1] - e[1] * w[0]
69
69
  ];
70
70
  }
71
- static dot(a, k) {
72
- return a[0] * k[0] + a[1] * k[1] + a[2] * k[2];
71
+ static dot(e, w) {
72
+ return e[0] * w[0] + e[1] * w[1] + e[2] * w[2];
73
73
  }
74
- static multiplyScalar(a, k) {
75
- let A = [
74
+ static multiplyScalar(e, w) {
75
+ let T = [
76
76
  ,
77
77
  ,
78
78
  ,
79
79
  ];
80
- for (let j = 0; j < 3; j++) A[j] = a[j] * k;
81
- return A;
80
+ for (let E = 0; E < 3; E++) T[E] = e[E] * w;
81
+ return T;
82
82
  }
83
- }, _Quaternion = class a {
83
+ }, _Quaternion = class e {
84
84
  static get identity() {
85
85
  return [
86
86
  1,
@@ -89,361 +89,361 @@ var __defProp = Object.defineProperty, __defNormalProp = (a, k, A) => k in a ? _
89
89
  0
90
90
  ];
91
91
  }
92
- static sum(a, k) {
92
+ static sum(e, w) {
93
93
  return [
94
- a[0] + k[0],
95
- a[1] + k[1],
96
- a[2] + k[2],
97
- a[3] + k[3]
94
+ e[0] + w[0],
95
+ e[1] + w[1],
96
+ e[2] + w[2],
97
+ e[3] + w[3]
98
98
  ];
99
99
  }
100
- static rotateMatlab(a, k) {
101
- let [A, j, M, N] = a, [P, F, I] = k;
100
+ static rotateMatlab(e, w) {
101
+ let [T, E, D, O] = e, [k, A, j] = w;
102
102
  return [
103
- A * (A * P - M * I + N * F) - M * (A * I - j * F + M * P) + j * (j * P + M * F + N * I) + N * (A * F + j * I - N * P),
104
- A * (A * F + j * I - N * P) + j * (A * I - j * F + M * P) + M * (j * P + M * F + N * I) - N * (A * P - M * I + N * F),
105
- A * (A * I - j * F + M * P) - j * (A * F + j * I - N * P) + M * (A * P - M * I + N * F) + N * (j * P + M * F + N * I)
103
+ T * (T * k - D * j + O * A) - D * (T * j - E * A + D * k) + E * (E * k + D * A + O * j) + O * (T * A + E * j - O * k),
104
+ T * (T * A + E * j - O * k) + E * (T * j - E * A + D * k) + D * (E * k + D * A + O * j) - O * (T * k - D * j + O * A),
105
+ T * (T * j - E * A + D * k) - E * (T * A + E * j - O * k) + D * (T * k - D * j + O * A) + O * (E * k + D * A + O * j)
106
106
  ];
107
107
  }
108
- static rotate(a, k) {
109
- let [A, j, M, N] = a, P = [
110
- j,
111
- M,
112
- N
113
- ], F = Vector3.cross(P, k);
114
- F = Vector3.sum(F, F);
115
- let I = Vector3.sum(k, Vector3.multiplyScalar(F, A));
116
- return Vector3.sum(I, Vector3.cross(P, F));
117
- }
118
- static inverse(a) {
108
+ static rotate(e, w) {
109
+ let [T, E, D, O] = e, k = [
110
+ E,
111
+ D,
112
+ O
113
+ ], A = Vector3.cross(k, w);
114
+ A = Vector3.sum(A, A);
115
+ let j = Vector3.sum(w, Vector3.multiplyScalar(A, T));
116
+ return Vector3.sum(j, Vector3.cross(k, A));
117
+ }
118
+ static inverse(e) {
119
119
  return [
120
- -a[0],
121
- a[1],
122
- a[2],
123
- a[3]
120
+ -e[0],
121
+ e[1],
122
+ e[2],
123
+ e[3]
124
124
  ];
125
125
  }
126
- static multiply(...k) {
127
- if (k.length === 2) {
128
- let [a, A, j, M] = k[0], [N, P, F, I] = k[1];
126
+ static multiply(...w) {
127
+ if (w.length === 2) {
128
+ let [e, T, E, D] = w[0], [O, k, A, j] = w[1];
129
129
  return [
130
- a * N - A * P - j * F - M * I,
131
- a * P + N * A + j * I - M * F,
132
- a * F + N * j + M * P - A * I,
133
- a * I + N * M + A * F - j * P
130
+ e * O - T * k - E * A - D * j,
131
+ e * k + O * T + E * j - D * A,
132
+ e * A + O * E + D * k - T * j,
133
+ e * j + O * D + T * A - E * k
134
134
  ];
135
135
  }
136
- return k.reduce((a, k) => this.multiply(a, k), a.identity);
136
+ return w.reduce((e, w) => this.multiply(e, w), e.identity);
137
137
  }
138
- static fromAxisAngle(a, k) {
139
- let A = Math.sin(k / 2);
138
+ static fromAxisAngle(e, w) {
139
+ let T = Math.sin(w / 2);
140
140
  return [
141
- Math.cos(k / 2),
142
- a[0] * A,
143
- a[1] * A,
144
- a[2] * A
141
+ Math.cos(w / 2),
142
+ e[0] * T,
143
+ e[1] * T,
144
+ e[2] * T
145
145
  ];
146
146
  }
147
- static rotX(a) {
147
+ static rotX(e) {
148
148
  return this.fromAxisAngle([
149
149
  1,
150
150
  0,
151
151
  0
152
- ], a);
152
+ ], e);
153
153
  }
154
- static rotY(a) {
154
+ static rotY(e) {
155
155
  return this.fromAxisAngle([
156
156
  0,
157
157
  1,
158
158
  0
159
- ], a);
159
+ ], e);
160
160
  }
161
- static rotZ(a) {
161
+ static rotZ(e) {
162
162
  return this.fromAxisAngle([
163
163
  0,
164
164
  0,
165
165
  1
166
- ], a);
166
+ ], e);
167
167
  }
168
- static fromMatrix3(a) {
169
- let k = Math.sqrt(1 + a[0][0] + a[1][1] + a[2][2]) / 2;
168
+ static fromMatrix3(e) {
169
+ let w = Math.sqrt(1 + e[0][0] + e[1][1] + e[2][2]) / 2;
170
170
  return [
171
- k,
172
- (a[2][1] - a[1][2]) / (4 * k),
173
- (a[0][2] - a[2][0]) / (4 * k),
174
- (a[1][0] - a[0][1]) / (4 * k)
171
+ w,
172
+ (e[2][1] - e[1][2]) / (4 * w),
173
+ (e[0][2] - e[2][0]) / (4 * w),
174
+ (e[1][0] - e[0][1]) / (4 * w)
175
175
  ];
176
176
  }
177
- static fromMatrix3Matlab(a) {
178
- let k = Math.sqrt(1 + a[0][0] + a[1][1] + a[2][2]) / 2;
177
+ static fromMatrix3Matlab(e) {
178
+ let w = Math.sqrt(1 + e[0][0] + e[1][1] + e[2][2]) / 2;
179
179
  return [
180
- k,
181
- (a[1][2] - a[2][1]) / (4 * k),
182
- (a[2][0] - a[0][2]) / (4 * k),
183
- (a[0][1] - a[1][0]) / (4 * k)
180
+ w,
181
+ (e[1][2] - e[2][1]) / (4 * w),
182
+ (e[2][0] - e[0][2]) / (4 * w),
183
+ (e[0][1] - e[1][0]) / (4 * w)
184
184
  ];
185
185
  }
186
- static toMatrix3(a) {
187
- let [k, A, j, M] = a, N = k * A, P = k * j, F = k * M, I = A * A, L = A * j, R = A * M, z = j * j, B = j * M, V = M * M;
186
+ static toMatrix3(e) {
187
+ let [w, T, E, D] = e, O = w * T, k = w * E, A = w * D, j = T * T, M = T * E, N = T * D, P = E * E, F = E * D, I = D * D;
188
188
  return [
189
189
  [
190
- 1 - 2 * (z + V),
191
- 2 * (L - F),
192
- 2 * (R + P)
190
+ 1 - 2 * (P + I),
191
+ 2 * (M - A),
192
+ 2 * (N + k)
193
193
  ],
194
194
  [
195
- 2 * (L + F),
196
- 1 - 2 * (I + V),
197
- 2 * (B - N)
195
+ 2 * (M + A),
196
+ 1 - 2 * (j + I),
197
+ 2 * (F - O)
198
198
  ],
199
199
  [
200
- 2 * (R - P),
201
- 2 * (B + N),
202
- 1 - 2 * (I + z)
200
+ 2 * (N - k),
201
+ 2 * (F + O),
202
+ 1 - 2 * (j + P)
203
203
  ]
204
204
  ];
205
205
  }
206
- static wxyz2xyzw(a) {
206
+ static wxyz2xyzw(e) {
207
207
  return [
208
- a[1],
209
- a[2],
210
- a[3],
211
- a[0]
208
+ e[1],
209
+ e[2],
210
+ e[3],
211
+ e[0]
212
212
  ];
213
213
  }
214
- static xyzw2wxyz(a) {
214
+ static xyzw2wxyz(e) {
215
215
  return [
216
- a[3],
217
- a[0],
218
- a[1],
219
- a[2]
216
+ e[3],
217
+ e[0],
218
+ e[1],
219
+ e[2]
220
220
  ];
221
221
  }
222
- static distance(k, A) {
223
- return Math.acos(Math.min(2 * a.dot(k, A) ** 2 - 1, 1));
222
+ static distance(w, T) {
223
+ return Math.acos(Math.min(2 * e.dot(w, T) ** 2 - 1, 1));
224
224
  }
225
- static equals(k, A) {
226
- return a.distance(k, A) < 1e-8;
225
+ static equals(w, T) {
226
+ return e.distance(w, T) < 1e-8;
227
227
  }
228
- static normalize(a) {
229
- let k = this.norm(a), A = [
228
+ static normalize(e) {
229
+ let w = this.norm(e), T = [
230
230
  ,
231
231
  ,
232
232
  ,
233
233
  ,
234
234
  ];
235
- for (let j = 0; j < 4; j++) A[j] = a[j] / k;
236
- return A;
235
+ for (let E = 0; E < 4; E++) T[E] = e[E] / w;
236
+ return T;
237
237
  }
238
- static norm(a) {
239
- return Math.sqrt(a[0] ** 2 + a[1] ** 2 + a[2] ** 2 + a[3] ** 2);
238
+ static norm(e) {
239
+ return Math.sqrt(e[0] ** 2 + e[1] ** 2 + e[2] ** 2 + e[3] ** 2);
240
240
  }
241
- static dot(a, k) {
242
- return a[0] * k[0] + a[1] * k[1] + a[2] * k[2] + a[3] * k[3];
241
+ static dot(e, w) {
242
+ return e[0] * w[0] + e[1] * w[1] + e[2] * w[2] + e[3] * w[3];
243
243
  }
244
- static getRotationBetweenTwoVectors(k, A) {
245
- let j = Vector3.normalize(k), M = Vector3.normalize(A), N = Vector3.dot(j, M), P;
246
- if (N < -.999999) return P = Vector3.cross([
244
+ static getRotationBetweenTwoVectors(w, T) {
245
+ let E = Vector3.normalize(w), D = Vector3.normalize(T), O = Vector3.dot(E, D), k;
246
+ if (O < -.999999) return k = Vector3.cross([
247
247
  1,
248
248
  0,
249
249
  0
250
- ], j), Vector3.norm(P) < 1e-6 && (P = Vector3.cross([
250
+ ], E), Vector3.norm(k) < 1e-6 && (k = Vector3.cross([
251
251
  0,
252
252
  1,
253
253
  0
254
- ], j)), P = Vector3.normalize(P), a.fromAxisAngle(P, Math.PI);
255
- if (N > .999999) return a.identity;
256
- P = Vector3.cross(j, M);
257
- let F = [
258
- 1 + N,
259
- P[0],
260
- P[1],
261
- P[2]
254
+ ], E)), k = Vector3.normalize(k), e.fromAxisAngle(k, Math.PI);
255
+ if (O > .999999) return e.identity;
256
+ k = Vector3.cross(E, D);
257
+ let A = [
258
+ 1 + O,
259
+ k[0],
260
+ k[1],
261
+ k[2]
262
262
  ];
263
- return a.normalize(F);
263
+ return e.normalize(A);
264
264
  }
265
- static slerp(k, A, j) {
266
- let M = k[1], N = k[2], P = k[3], F = k[0], I = A[1], L = A[2], R = A[3], z = A[0], B, V, H;
267
- B = M * I + N * L + P * R + F * z, B < 0 && (B = -B, z = -z, I = -I, L = -L, R = -R);
268
- let U = 1 - B < 1e-6;
269
- if (U) V = 1 - j, H = j;
265
+ static slerp(w, T, E) {
266
+ let D = w[1], O = w[2], k = w[3], A = w[0], j = T[1], M = T[2], N = T[3], P = T[0], F, I, L;
267
+ F = D * j + O * M + k * N + A * P, F < 0 && (F = -F, P = -P, j = -j, M = -M, N = -N);
268
+ let R = 1 - F < 1e-6;
269
+ if (R) I = 1 - E, L = E;
270
270
  else {
271
- let a = Math.acos(B), k = Math.sin(a);
272
- V = Math.sin((1 - j) * a) / k, H = Math.sin(j * a) / k;
271
+ let e = Math.acos(F), w = Math.sin(e);
272
+ I = Math.sin((1 - E) * e) / w, L = Math.sin(E * e) / w;
273
273
  }
274
- let W = [
275
- V * F + H * z,
276
- V * M + H * I,
277
- V * N + H * L,
278
- V * P + H * R
274
+ let z = [
275
+ I * A + L * P,
276
+ I * D + L * j,
277
+ I * O + L * M,
278
+ I * k + L * N
279
279
  ];
280
- return U && (W = a.normalize(W)), W;
281
- }
282
- static toString(a) {
283
- return `[${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)}, ${a[3].toFixed(2)}]`;
284
- }
285
- static fromUnitVectors(k, A) {
286
- let j = Vector3.dot(k, A) + 1, M, N, P, F;
287
- j < 2 ** -52 ? (j = 0, Math.abs(k[1]) > Math.abs(k[2]) ? (M = -k[1], N = k[0], P = 0, F = j) : (M = 0, N = -k[2], P = k[1], F = j)) : (M = k[1] * A[2] - k[2] * A[1], N = k[2] * A[0] - k[0] * A[2], P = k[0] * A[1] - k[1] * A[0], F = j);
288
- let I = [
289
- F,
290
- M,
291
- N,
292
- P
280
+ return R && (z = e.normalize(z)), z;
281
+ }
282
+ static toString(e) {
283
+ return `[${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)}, ${e[3].toFixed(2)}]`;
284
+ }
285
+ static fromUnitVectors(w, T) {
286
+ let E = Vector3.dot(w, T) + 1, D, O, k, A;
287
+ E < 2 ** -52 ? (E = 0, Math.abs(w[1]) > Math.abs(w[2]) ? (D = -w[1], O = w[0], k = 0, A = E) : (D = 0, O = -w[2], k = w[1], A = E)) : (D = w[1] * T[2] - w[2] * T[1], O = w[2] * T[0] - w[0] * T[2], k = w[0] * T[1] - w[1] * T[0], A = E);
288
+ let j = [
289
+ A,
290
+ D,
291
+ O,
292
+ k
293
293
  ];
294
- return a.normalize(I);
294
+ return e.normalize(j);
295
295
  }
296
296
  };
297
297
  __publicField(_Quaternion, "ROTX_PI2", _Quaternion.rotX(Math.PI / 2)), __publicField(_Quaternion, "ROTX_PI", _Quaternion.rotX(Math.PI)), __publicField(_Quaternion, "ROTX_MPI2", _Quaternion.rotX(-Math.PI / 2)), __publicField(_Quaternion, "ROTY_PI2", _Quaternion.rotY(Math.PI / 2)), __publicField(_Quaternion, "ROTY_PI", _Quaternion.rotY(Math.PI)), __publicField(_Quaternion, "ROTY_MPI2", _Quaternion.rotY(-Math.PI / 2)), __publicField(_Quaternion, "ROTZ_PI2", _Quaternion.rotZ(Math.PI / 2)), __publicField(_Quaternion, "ROTZ_PI", _Quaternion.rotZ(Math.PI)), __publicField(_Quaternion, "ROTZ_MPI2", _Quaternion.rotZ(-Math.PI / 2));
298
298
  var Quaternion = _Quaternion;
299
- function deg2rad(a) {
300
- return a * (Math.PI / 180);
299
+ function deg2rad(e) {
300
+ return e * (Math.PI / 180);
301
301
  }
302
- function rad2deg(a) {
303
- return a * 180 / Math.PI;
302
+ function rad2deg(e) {
303
+ return e * 180 / Math.PI;
304
304
  }
305
- function positiveMod(a, k) {
306
- return (a % k + k) % k;
305
+ function positiveMod(e, w) {
306
+ return (e % w + w) % w;
307
307
  }
308
- function wrap(a, k, A) {
309
- let j = A - k, M = ((a - k) % j + j) % j + k;
310
- return M === k ? A : M;
308
+ function wrap(e, w, T) {
309
+ let E = T - w, D = ((e - w) % E + E) % E + w;
310
+ return D === w ? T : D;
311
311
  }
312
- var Rotations = class a {
313
- static eulerToQuaternionZXYDegrees(k) {
314
- let A = k.map((a) => deg2rad(a));
315
- return a.eulerToQuaternionZXY(A);
316
- }
317
- static eulerToQuaternionZXY(a) {
318
- let k = a[0], A = a[1], j = a[2], M = Math.cos(k / 2), N = Math.cos(A / 2), P = Math.cos(j / 2), F = Math.sin(k / 2), I = Math.sin(A / 2), L = Math.sin(j / 2), R = M * N * P - F * I * L, z = M * I * P - F * N * L, B = F * I * P + M * N * L, V = F * N * P + M * I * L;
319
- return R < 0 && (R = -R, z = -z, B = -B, V = -V), [
320
- R,
321
- z,
322
- B,
323
- V
312
+ var Rotations = class e {
313
+ static eulerToQuaternionZXYDegrees(w) {
314
+ let T = w.map((e) => deg2rad(e));
315
+ return e.eulerToQuaternionZXY(T);
316
+ }
317
+ static eulerToQuaternionZXY(e) {
318
+ let w = e[0], T = e[1], E = e[2], D = Math.cos(w / 2), O = Math.cos(T / 2), k = Math.cos(E / 2), A = Math.sin(w / 2), j = Math.sin(T / 2), M = Math.sin(E / 2), N = D * O * k - A * j * M, P = D * j * k - A * O * M, F = A * j * k + D * O * M, I = A * O * k + D * j * M;
319
+ return N < 0 && (N = -N, P = -P, F = -F, I = -I), [
320
+ N,
321
+ P,
322
+ F,
323
+ I
324
324
  ];
325
325
  }
326
- static quaternionToEulerZXYDegrees(k) {
327
- return a.quaternionToEulerZXY(k).map((a) => rad2deg(a));
326
+ static quaternionToEulerZXYDegrees(w) {
327
+ return e.quaternionToEulerZXY(w).map((e) => rad2deg(e));
328
328
  }
329
- static quaternionToEulerZXY(a) {
330
- let k = a[0], A = a[1], j = a[2], M = a[3], N, P, F, I = j * M + A * k;
331
- return I > .499 ? (N = 2 * Math.atan2(j, k), P = Math.PI / 2, F = 0) : I < -.499 ? (N = -2 * Math.atan2(j, k), P = -Math.PI / 2, F = 0) : (N = Math.atan2(2 * M * k - 2 * j * A, 1 - 2 * M ** 2 - 2 * A ** 2), P = Math.asin(2 * I), F = Math.atan2(2 * j * k - 2 * M * A, 1 - 2 * j ** 2 - 2 * A ** 2)), N %= 2 * Math.PI, P %= Math.PI, F %= 2 * Math.PI, [
332
- N,
333
- P,
334
- F
329
+ static quaternionToEulerZXY(e) {
330
+ let w = e[0], T = e[1], E = e[2], D = e[3], O, k, A, j = E * D + T * w;
331
+ return j > .499 ? (O = 2 * Math.atan2(E, w), k = Math.PI / 2, A = 0) : j < -.499 ? (O = -2 * Math.atan2(E, w), k = -Math.PI / 2, A = 0) : (O = Math.atan2(2 * D * w - 2 * E * T, 1 - 2 * D ** 2 - 2 * T ** 2), k = Math.asin(2 * j), A = Math.atan2(2 * E * w - 2 * D * T, 1 - 2 * E ** 2 - 2 * T ** 2)), O %= 2 * Math.PI, k %= Math.PI, A %= 2 * Math.PI, [
332
+ O,
333
+ k,
334
+ A
335
335
  ];
336
336
  }
337
- static quaternionToEulerDegrees(k, A) {
338
- return a.quaternionToEuler(k, A).map((a) => rad2deg(a));
339
- }
340
- static quaternionToEuler(k, A) {
341
- let j = k[0], M = k[1], N = k[2], P = k[3];
342
- switch (A.toLowerCase()) {
343
- case "zyx": return a._threeaxisrot(2 * (M * N + j * P), j ** 2 + M ** 2 - N ** 2 - P ** 2, -2 * (M * P - j * N), 2 * (N * P + j * M), j ** 2 - M ** 2 - N ** 2 + P ** 2);
344
- case "zyz": return a._twoaxisrot(2 * (N * P - j * M), 2 * (M * P + j * N), j ** 2 - M ** 2 - N ** 2 + P ** 2, 2 * (N * P + j * M), -2 * (M * P - j * N));
345
- case "zxy": return a._threeaxisrot(-2 * (M * N - j * P), j ** 2 - M ** 2 + N ** 2 - P ** 2, 2 * (N * P + j * M), -2 * (M * P - j * N), j ** 2 - M ** 2 - N ** 2 + P ** 2);
346
- case "zxz": return a._twoaxisrot(2 * (M * P + j * N), -2 * (N * P - j * M), j ** 2 - M ** 2 - N ** 2 + P ** 2, 2 * (M * P - j * N), 2 * (N * P + j * M));
347
- case "yxz": return a._threeaxisrot(2 * (M * P + j * N), j ** 2 - M ** 2 - N ** 2 + P ** 2, -2 * (N * P - j * M), 2 * (M * N + j * P), j ** 2 - M ** 2 + N ** 2 - P ** 2);
348
- case "yxy": return a._twoaxisrot(2 * (M * N - j * P), 2 * (N * P + j * M), j ** 2 - M ** 2 + N ** 2 - P ** 2, 2 * (M * N + j * P), -2 * (N * P - j * M));
349
- case "yzx": return a._threeaxisrot(-2 * (M * P - j * N), j ** 2 + M ** 2 - N ** 2 - P ** 2, 2 * (M * N + j * P), -2 * (N * P - j * M), j ** 2 - M ** 2 + N ** 2 - P ** 2);
350
- case "yzy": return a._twoaxisrot(2 * (N * P + j * M), -2 * (M * N - j * P), j ** 2 - M ** 2 + N ** 2 - P ** 2, 2 * (N * P - j * M), 2 * (M * N + j * P));
351
- case "xyz": return a._threeaxisrot(-2 * (N * P - j * M), j ** 2 - M ** 2 - N ** 2 + P ** 2, 2 * (M * P + j * N), -2 * (M * N - j * P), j ** 2 + M ** 2 - N ** 2 - P ** 2);
352
- case "xyx": return a._twoaxisrot(2 * (M * N + j * P), -2 * (M * P - j * N), j ** 2 + M ** 2 - N ** 2 - P ** 2, 2 * (M * N - j * P), 2 * (M * P + j * N));
353
- case "xzy": return a._threeaxisrot(2 * (N * P + j * M), j ** 2 - M ** 2 + N ** 2 - P ** 2, -2 * (M * N - j * P), 2 * (M * P + j * N), j ** 2 + M ** 2 - N ** 2 - P ** 2);
354
- case "xzx": return a._twoaxisrot(2 * (M * P - j * N), 2 * (M * N + j * P), j ** 2 + M ** 2 - N ** 2 - P ** 2, 2 * (M * P + j * N), -2 * (M * N - j * P));
337
+ static quaternionToEulerDegrees(w, T) {
338
+ return e.quaternionToEuler(w, T).map((e) => rad2deg(e));
339
+ }
340
+ static quaternionToEuler(w, T) {
341
+ let E = w[0], D = w[1], O = w[2], k = w[3];
342
+ switch (T.toLowerCase()) {
343
+ case "zyx": return e._threeaxisrot(2 * (D * O + E * k), E ** 2 + D ** 2 - O ** 2 - k ** 2, -2 * (D * k - E * O), 2 * (O * k + E * D), E ** 2 - D ** 2 - O ** 2 + k ** 2);
344
+ case "zyz": return e._twoaxisrot(2 * (O * k - E * D), 2 * (D * k + E * O), E ** 2 - D ** 2 - O ** 2 + k ** 2, 2 * (O * k + E * D), -2 * (D * k - E * O));
345
+ case "zxy": return e._threeaxisrot(-2 * (D * O - E * k), E ** 2 - D ** 2 + O ** 2 - k ** 2, 2 * (O * k + E * D), -2 * (D * k - E * O), E ** 2 - D ** 2 - O ** 2 + k ** 2);
346
+ case "zxz": return e._twoaxisrot(2 * (D * k + E * O), -2 * (O * k - E * D), E ** 2 - D ** 2 - O ** 2 + k ** 2, 2 * (D * k - E * O), 2 * (O * k + E * D));
347
+ case "yxz": return e._threeaxisrot(2 * (D * k + E * O), E ** 2 - D ** 2 - O ** 2 + k ** 2, -2 * (O * k - E * D), 2 * (D * O + E * k), E ** 2 - D ** 2 + O ** 2 - k ** 2);
348
+ case "yxy": return e._twoaxisrot(2 * (D * O - E * k), 2 * (O * k + E * D), E ** 2 - D ** 2 + O ** 2 - k ** 2, 2 * (D * O + E * k), -2 * (O * k - E * D));
349
+ case "yzx": return e._threeaxisrot(-2 * (D * k - E * O), E ** 2 + D ** 2 - O ** 2 - k ** 2, 2 * (D * O + E * k), -2 * (O * k - E * D), E ** 2 - D ** 2 + O ** 2 - k ** 2);
350
+ case "yzy": return e._twoaxisrot(2 * (O * k + E * D), -2 * (D * O - E * k), E ** 2 - D ** 2 + O ** 2 - k ** 2, 2 * (O * k - E * D), 2 * (D * O + E * k));
351
+ case "xyz": return e._threeaxisrot(-2 * (O * k - E * D), E ** 2 - D ** 2 - O ** 2 + k ** 2, 2 * (D * k + E * O), -2 * (D * O - E * k), E ** 2 + D ** 2 - O ** 2 - k ** 2);
352
+ case "xyx": return e._twoaxisrot(2 * (D * O + E * k), -2 * (D * k - E * O), E ** 2 + D ** 2 - O ** 2 - k ** 2, 2 * (D * O - E * k), 2 * (D * k + E * O));
353
+ case "xzy": return e._threeaxisrot(2 * (O * k + E * D), E ** 2 - D ** 2 + O ** 2 - k ** 2, -2 * (D * O - E * k), 2 * (D * k + E * O), E ** 2 + D ** 2 - O ** 2 - k ** 2);
354
+ case "xzx": return e._twoaxisrot(2 * (D * k - E * O), 2 * (D * O + E * k), E ** 2 + D ** 2 - O ** 2 - k ** 2, 2 * (D * k + E * O), -2 * (D * O - E * k));
355
355
  }
356
356
  throw Error("unknown order");
357
357
  }
358
- static _threeaxisrot(a, k, A, j, M) {
358
+ static _threeaxisrot(e, w, T, E, D) {
359
359
  return [
360
- Math.atan2(a, k),
361
- Math.asin(A),
362
- Math.atan2(j, M)
360
+ Math.atan2(e, w),
361
+ Math.asin(T),
362
+ Math.atan2(E, D)
363
363
  ];
364
364
  }
365
- static _twoaxisrot(a, k, A, j, M) {
365
+ static _twoaxisrot(e, w, T, E, D) {
366
366
  return [
367
- Math.atan2(a, k),
368
- Math.acos(A),
369
- Math.atan2(j, M)
367
+ Math.atan2(e, w),
368
+ Math.acos(T),
369
+ Math.atan2(E, D)
370
370
  ];
371
371
  }
372
- static getHeadingFromQuaternion(a) {
373
- let [k, A, j, M] = a, N = k * A, P = j * M, F = A ** 2;
374
- return Math.asin(2 * (N + P)) < Math.PI / 4 && F + j ** 2 < .5 ? -Math.atan2(k * M - A * j, .5 - F - M ** 2) : -Math.atan2(A * M + k * j, N - P);
372
+ static getHeadingFromQuaternion(e) {
373
+ let [w, T, E, D] = e, O = w * T, k = E * D, A = T ** 2;
374
+ return Math.asin(2 * (O + k)) < Math.PI / 4 && A + E ** 2 < .5 ? -Math.atan2(w * D - T * E, .5 - A - D ** 2) : -Math.atan2(T * D + w * E, O - k);
375
375
  }
376
- }, Level_default = class a {
376
+ }, Level_default = class e {
377
377
  static VERIFY_TYPING = !1;
378
- static checkType(a) {
379
- if (a !== null && !(typeof a == "number" && !isNaN(a))) {
380
- if (Array.isArray(a) && a.length === 2) {
381
- let [k, A] = a;
382
- if (typeof k == "number" && !isNaN(k) && typeof A == "number" && !isNaN(A)) {
383
- if (k > A || k === A) throw Error(`Invalid level range: [${k}, ${A}]`);
378
+ static checkType(e) {
379
+ if (e !== null && !(typeof e == "number" && !isNaN(e))) {
380
+ if (Array.isArray(e) && e.length === 2) {
381
+ let [w, T] = e;
382
+ if (typeof w == "number" && !isNaN(w) && typeof T == "number" && !isNaN(T)) {
383
+ if (w > T || w === T) throw Error(`Invalid level range: [${w}, ${T}]`);
384
384
  return;
385
385
  }
386
386
  }
387
- throw Error(`Unknown level format: ${a}`);
387
+ throw Error(`Unknown level format: ${e}`);
388
388
  }
389
389
  }
390
- static isRange(k) {
391
- return a.VERIFY_TYPING && a.checkType(k), Array.isArray(k);
390
+ static isRange(w) {
391
+ return e.VERIFY_TYPING && e.checkType(w), Array.isArray(w);
392
392
  }
393
- static clone(k) {
394
- return a.VERIFY_TYPING && a.checkType(k), k === null ? null : typeof k == "number" ? k : [k[0], k[1]];
393
+ static clone(w) {
394
+ return e.VERIFY_TYPING && e.checkType(w), w === null ? null : typeof w == "number" ? w : [w[0], w[1]];
395
395
  }
396
- static fromString(k) {
397
- if (k === null) return null;
398
- if (typeof k != "string" || !k.length) throw Error(`argument must be a non empty string, got ${typeof k}`);
399
- if (!isNaN(Number(k))) return parseFloat(k);
400
- let A = k.split(";");
401
- if (A.length > 1) {
402
- let k = A.map((a) => Number(a)), j = Math.min(...k), M = Math.max(...k);
403
- return a.checkType([j, M]), [j, M];
396
+ static fromString(w) {
397
+ if (w === null) return null;
398
+ if (typeof w != "string" || !w.length) throw Error(`argument must be a non empty string, got ${typeof w}`);
399
+ if (!isNaN(Number(w))) return parseFloat(w);
400
+ let T = w.split(";");
401
+ if (T.length > 1) {
402
+ let w = T.map((e) => Number(e)), E = Math.min(...w), D = Math.max(...w);
403
+ return e.checkType([E, D]), [E, D];
404
404
  } else {
405
- let A = k.substring(1).indexOf("-") + 1;
406
- if (A > 0) {
407
- let j = Number(k.substring(0, A)), M = Number(k.substring(A + 1));
408
- return a.checkType([j, M]), [j, M];
405
+ let T = w.substring(1).indexOf("-") + 1;
406
+ if (T > 0) {
407
+ let E = Number(w.substring(0, T)), D = Number(w.substring(T + 1));
408
+ return e.checkType([E, D]), [E, D];
409
409
  }
410
410
  }
411
- throw Error(`Cannot parse following level: ${k}`);
411
+ throw Error(`Cannot parse following level: ${w}`);
412
412
  }
413
- static contains(k, A) {
414
- return a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === A ? !0 : Array.isArray(k) ? Array.isArray(A) ? k[0] <= A[0] && k[1] >= A[1] : A === null ? !1 : k[0] <= A && k[1] >= A : k === null || A === null ? !1 : k <= A[0] && k >= A[1];
413
+ static contains(w, T) {
414
+ return e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === T ? !0 : Array.isArray(w) ? Array.isArray(T) ? w[0] <= T[0] && w[1] >= T[1] : T === null ? !1 : w[0] <= T && w[1] >= T : w === null || T === null ? !1 : w <= T[0] && w >= T[1];
415
415
  }
416
- static intersection(k, A) {
417
- if (a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === null || A === null) return null;
418
- if (a.equals(k, A)) return a.clone(k);
419
- if (typeof k == "number" && typeof A == "number") return k === A ? k : null;
420
- if (Array.isArray(k) && !Array.isArray(A)) return a.contains(k, A) ? A : null;
421
- if (!Array.isArray(k) && Array.isArray(A)) return a.contains(A, k) ? k : null;
422
- let j = Math.max(k[0], A[0]), M = Math.min(k[1], A[1]);
423
- return M === j ? M : M < j ? null : [j, M];
416
+ static intersection(w, T) {
417
+ if (e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === null || T === null) return null;
418
+ if (e.equals(w, T)) return e.clone(w);
419
+ if (typeof w == "number" && typeof T == "number") return w === T ? w : null;
420
+ if (Array.isArray(w) && !Array.isArray(T)) return e.contains(w, T) ? T : null;
421
+ if (!Array.isArray(w) && Array.isArray(T)) return e.contains(T, w) ? w : null;
422
+ let E = Math.max(w[0], T[0]), D = Math.min(w[1], T[1]);
423
+ return D === E ? D : D < E ? null : [E, D];
424
424
  }
425
- static intersect(k, A) {
426
- return a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === null && A === null ? !0 : a.intersection(k, A) !== null;
425
+ static intersect(w, T) {
426
+ return e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === null && T === null ? !0 : e.intersection(w, T) !== null;
427
427
  }
428
- static union(k, A) {
429
- if (a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === A) return a.clone(k);
430
- if (A === null || k === null) return null;
431
- let j, M;
432
- return !Array.isArray(k) && !Array.isArray(A) ? (j = Math.min(k, A), M = Math.max(k, A)) : Array.isArray(k) && !Array.isArray(A) ? (j = Math.min(k[0], A), M = Math.max(k[1], A)) : !Array.isArray(k) && Array.isArray(A) ? (j = Math.min(A[0], k), M = Math.max(A[1], k)) : (j = Math.min(k[0], A[0]), M = Math.max(k[1], A[1])), j === M ? j : [j, M];
428
+ static union(w, T) {
429
+ if (e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === T) return e.clone(w);
430
+ if (T === null || w === null) return null;
431
+ let E, D;
432
+ return !Array.isArray(w) && !Array.isArray(T) ? (E = Math.min(w, T), D = Math.max(w, T)) : Array.isArray(w) && !Array.isArray(T) ? (E = Math.min(w[0], T), D = Math.max(w[1], T)) : !Array.isArray(w) && Array.isArray(T) ? (E = Math.min(T[0], w), D = Math.max(T[1], w)) : (E = Math.min(w[0], T[0]), D = Math.max(w[1], T[1])), E === D ? E : [E, D];
433
433
  }
434
- static multiplyBy(k, A) {
435
- return a.VERIFY_TYPING && a.checkType(k), k === null ? null : Array.isArray(k) ? [k[0] * A, k[1] * A] : k * A;
434
+ static multiplyBy(w, T) {
435
+ return e.VERIFY_TYPING && e.checkType(w), w === null ? null : Array.isArray(w) ? [w[0] * T, w[1] * T] : w * T;
436
436
  }
437
- static toString(k) {
438
- return a.VERIFY_TYPING && a.checkType(k), k === null ? null : Array.isArray(k) ? k[0] + ";" + k[1] : String(k);
437
+ static toString(w) {
438
+ return e.VERIFY_TYPING && e.checkType(w), w === null ? null : Array.isArray(w) ? w[0] + ";" + w[1] : String(w);
439
439
  }
440
- static equals(k, A) {
441
- return a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === A ? !0 : Array.isArray(k) && Array.isArray(A) ? k[0] === A[0] && k[1] === A[1] : !1;
440
+ static equals(w, T) {
441
+ return e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === T ? !0 : Array.isArray(w) && Array.isArray(T) ? w[0] === T[0] && w[1] === T[1] : !1;
442
442
  }
443
- static diff(k, A) {
444
- return a.VERIFY_TYPING && (a.checkType(k), a.checkType(A)), k === null || A === null ? null : !Array.isArray(k) && !Array.isArray(A) ? A - k : Array.isArray(k) && !Array.isArray(A) ? k[0] === A ? A - k[1] : k[1] === A ? A - k[0] : null : Array.isArray(A) && !Array.isArray(k) ? k === A[0] ? A[1] - k : k === A[1] ? A[0] - k : null : a.equals(k, A) ? 0 : null;
443
+ static diff(w, T) {
444
+ return e.VERIFY_TYPING && (e.checkType(w), e.checkType(T)), w === null || T === null ? null : !Array.isArray(w) && !Array.isArray(T) ? T - w : Array.isArray(w) && !Array.isArray(T) ? w[0] === T ? T - w[1] : w[1] === T ? T - w[0] : null : Array.isArray(T) && !Array.isArray(w) ? w === T[0] ? T[1] - w : w === T[1] ? T[0] - w : null : e.equals(w, T) ? 0 : null;
445
445
  }
446
- }, Coordinates_default = class a {
446
+ }, Coordinates_default = class e {
447
447
  _lat;
448
448
  _lng;
449
449
  _alt = null;
@@ -452,156 +452,156 @@ var Rotations = class a {
452
452
  _heightFromGround = null;
453
453
  _ecef;
454
454
  autoWrap = !0;
455
- constructor(a, k, A = null, j = null) {
456
- this.lat = a, this.lng = k, this.alt = A, this.level = j, this._ecef = null;
455
+ constructor(e, w, T = null, E = null) {
456
+ this.lat = e, this.lng = w, this.alt = T, this.level = E, this._ecef = null;
457
457
  }
458
458
  get lat() {
459
459
  return this._lat;
460
460
  }
461
- set lat(a) {
462
- if (Math.abs(a) <= 90) this._lat = a;
463
- else throw Error(`lat argument is not in [-90; 90], value is ${a}`);
461
+ set lat(e) {
462
+ if (Math.abs(e) <= 90) this._lat = e;
463
+ else throw Error(`lat argument is not in [-90; 90], value is ${e}`);
464
464
  this._ecef = null;
465
465
  }
466
466
  get latitude() {
467
467
  return this._lat;
468
468
  }
469
- set latitude(a) {
469
+ set latitude(e) {
470
470
  throw Error("Please use Coordinates#lat setter instead of Coordinate#latitude");
471
471
  }
472
472
  get lng() {
473
473
  return this._lng;
474
474
  }
475
- set lng(a) {
476
- this._lng = a, this.autoWrap && this.wrap(), this._ecef = null;
475
+ set lng(e) {
476
+ this._lng = e, this.autoWrap && this.wrap(), this._ecef = null;
477
477
  }
478
478
  get longitude() {
479
479
  return this._lng;
480
480
  }
481
- set longitude(a) {
481
+ set longitude(e) {
482
482
  throw Error("Please use Coordinates#lng setter instead of Coordinate#longitude");
483
483
  }
484
484
  get alt() {
485
485
  return this._alt;
486
486
  }
487
- set alt(a) {
488
- this._alt = a, this._ecef = null;
487
+ set alt(e) {
488
+ this._alt = e, this._ecef = null;
489
489
  }
490
490
  get level() {
491
491
  return this._level;
492
492
  }
493
- set level(a) {
494
- Level_default.checkType(a), this._level = a;
493
+ set level(e) {
494
+ Level_default.checkType(e), this._level = e;
495
495
  }
496
496
  get heightFromFloor() {
497
497
  return this._heightFromFloor;
498
498
  }
499
- set heightFromFloor(a) {
500
- this._heightFromFloor = a;
499
+ set heightFromFloor(e) {
500
+ this._heightFromFloor = e;
501
501
  }
502
502
  get heightFromGround() {
503
503
  return this._heightFromGround;
504
504
  }
505
- set heightFromGround(a) {
506
- this._heightFromGround = a;
505
+ set heightFromGround(e) {
506
+ this._heightFromGround = e;
507
507
  }
508
508
  clone() {
509
- let k = new a(this.lat, this.lng, this.alt);
510
- return this.level !== null && (k.level = Level_default.clone(this.level)), k;
509
+ let w = new e(this.lat, this.lng, this.alt);
510
+ return this.level !== null && (w.level = Level_default.clone(this.level)), w;
511
511
  }
512
512
  wrap() {
513
513
  (this._lng <= -180 || this._lng > 180) && (this._lng = wrap(this._lng, -180, 180));
514
514
  }
515
- static equals(a, k, A = EPS_DEG_MM, j = EPS_MM) {
516
- return this.equalsWithoutLevel(a, k, A, j) ? a === null || k === null ? !0 : Level_default.equals(a.level, k.level) : !1;
515
+ static equals(e, w, T = EPS_DEG_MM, E = EPS_MM) {
516
+ return this.equalsWithoutLevel(e, w, T, E) ? e === null || w === null ? !0 : Level_default.equals(e.level, w.level) : !1;
517
517
  }
518
- equals(k) {
519
- return a.equals(this, k);
518
+ equals(w) {
519
+ return e.equals(this, w);
520
520
  }
521
- static equalsWithoutLevel(k, A, j = EPS_DEG_MM, M = EPS_MM) {
522
- return k === null && k === A ? !0 : !(k instanceof a) || !(A instanceof a) ? !1 : Math.abs(A.lat - k.lat) < j && Math.abs(A.lng - k.lng) < j && (k.alt === A.alt || k.alt !== null && A.alt !== null && Math.abs(A.alt - k.alt) < M);
521
+ static equalsWithoutLevel(w, T, E = EPS_DEG_MM, D = EPS_MM) {
522
+ return w === null && w === T ? !0 : !(w instanceof e) || !(T instanceof e) ? !1 : Math.abs(T.lat - w.lat) < E && Math.abs(T.lng - w.lng) < E && (w.alt === T.alt || w.alt !== null && T.alt !== null && Math.abs(T.alt - w.alt) < D);
523
523
  }
524
- equalsWithoutLevel(k, A = EPS_DEG_MM, j = EPS_MM) {
525
- return a.equalsWithoutLevel(this, k, A, j);
524
+ equalsWithoutLevel(w, T = EPS_DEG_MM, E = EPS_MM) {
525
+ return e.equalsWithoutLevel(this, w, T, E);
526
526
  }
527
- destinationPoint(a, k, A = null) {
528
- let j = this.clone();
529
- return j.move(a, k, A), j;
527
+ destinationPoint(e, w, T = null) {
528
+ let E = this.clone();
529
+ return E.move(e, w, T), E;
530
530
  }
531
- move(a, k, A = null) {
532
- let j = a / R_MAJOR, N = Math.cos(j), P = Math.sin(j), F = deg2rad(this.lat), I = deg2rad(this.lng), L = Math.asin(Math.sin(F) * N + Math.cos(F) * P * Math.cos(k)), R = I + Math.atan2(Math.sin(k) * P * Math.cos(F), N - Math.sin(F) * Math.sin(L));
533
- if (this.lat = rad2deg(L), this.lng = rad2deg(R), A !== null) {
531
+ move(e, w, T = null) {
532
+ let E = e / R_MAJOR, O = Math.cos(E), k = Math.sin(E), A = deg2rad(this.lat), j = deg2rad(this.lng), M = Math.asin(Math.sin(A) * O + Math.cos(A) * k * Math.cos(w)), N = j + Math.atan2(Math.sin(w) * k * Math.cos(A), O - Math.sin(A) * Math.sin(M));
533
+ if (this.lat = rad2deg(M), this.lng = rad2deg(N), T !== null) {
534
534
  if (this.alt === null) throw Error("Point altitude is not defined");
535
- this.alt += A;
535
+ this.alt += T;
536
536
  }
537
537
  return this;
538
538
  }
539
- distanceTo(a) {
540
- let k = this.lat, A = this.lng, j = a.lat, N = a.lng, P = deg2rad(j - k), F = deg2rad(N - A), I = Math.sin(F / 2), L = Math.sin(P / 2), R = deg2rad(k), z = Math.cos(R), B = deg2rad(j), V = Math.cos(B), H = L * L + z * V * I * I, U = Math.sqrt(H), W = Math.sqrt(1 - H);
541
- return R_MAJOR * (2 * Math.atan2(U, W));
539
+ distanceTo(e) {
540
+ let w = this.lat, T = this.lng, E = e.lat, O = e.lng, k = deg2rad(E - w), A = deg2rad(O - T), j = Math.sin(A / 2), M = Math.sin(k / 2), N = deg2rad(w), P = Math.cos(N), F = deg2rad(E), I = Math.cos(F), L = M * M + P * I * j * j, R = Math.sqrt(L), z = Math.sqrt(1 - L);
541
+ return R_MAJOR * (2 * Math.atan2(R, z));
542
542
  }
543
- static distanceBetween(a, k) {
544
- return a.distanceTo(k);
543
+ static distanceBetween(e, w) {
544
+ return e.distanceTo(w);
545
545
  }
546
- bearingTo(a) {
547
- let k = deg2rad(this.lat), A = deg2rad(a.lat), j = deg2rad(a.lng - this.lng);
548
- return Math.atan2(Math.sin(j) * Math.cos(A), Math.cos(k) * Math.sin(A) - Math.sin(k) * Math.cos(A) * Math.cos(j));
546
+ bearingTo(e) {
547
+ let w = deg2rad(this.lat), T = deg2rad(e.lat), E = deg2rad(e.lng - this.lng);
548
+ return Math.atan2(Math.sin(E) * Math.cos(T), Math.cos(w) * Math.sin(T) - Math.sin(w) * Math.cos(T) * Math.cos(E));
549
549
  }
550
- static bearingTo(a, k) {
551
- return a.bearingTo(k);
550
+ static bearingTo(e, w) {
551
+ return e.bearingTo(w);
552
552
  }
553
553
  get enuToEcefRotation() {
554
- let a = Quaternion.fromAxisAngle([
554
+ let e = Quaternion.fromAxisAngle([
555
555
  0,
556
556
  0,
557
557
  1
558
- ], Math.PI / 2 + deg2rad(this.lng)), k = Quaternion.fromAxisAngle([
558
+ ], Math.PI / 2 + deg2rad(this.lng)), w = Quaternion.fromAxisAngle([
559
559
  1,
560
560
  0,
561
561
  0
562
562
  ], Math.PI / 2 - deg2rad(this.lat));
563
- return Quaternion.multiply(a, k);
563
+ return Quaternion.multiply(e, w);
564
564
  }
565
565
  get ecefToEnuRotation() {
566
- let a = Quaternion.fromAxisAngle([
566
+ let e = Quaternion.fromAxisAngle([
567
567
  1,
568
568
  0,
569
569
  0
570
- ], deg2rad(this.lat) - Math.PI / 2), k = Quaternion.fromAxisAngle([
570
+ ], deg2rad(this.lat) - Math.PI / 2), w = Quaternion.fromAxisAngle([
571
571
  0,
572
572
  0,
573
573
  1
574
574
  ], -deg2rad(this.lng) - Math.PI / 2);
575
- return Quaternion.multiply(a, k);
575
+ return Quaternion.multiply(e, w);
576
576
  }
577
577
  get ecef() {
578
578
  if (!this._ecef) {
579
- let a = deg2rad(this.lat), k = deg2rad(this.lng), A = this.alt || 0;
579
+ let e = deg2rad(this.lat), w = deg2rad(this.lng), T = this.alt || 0;
580
580
  this._ecef = [
581
- (R_MAJOR + A) * Math.cos(a) * Math.cos(k),
582
- (R_MAJOR + A) * Math.cos(a) * Math.sin(k),
583
- (R_MAJOR + A) * Math.sin(a)
581
+ (R_MAJOR + T) * Math.cos(e) * Math.cos(w),
582
+ (R_MAJOR + T) * Math.cos(e) * Math.sin(w),
583
+ (R_MAJOR + T) * Math.sin(e)
584
584
  ];
585
585
  }
586
586
  return this._ecef;
587
587
  }
588
- static fromECEF(k) {
589
- let A = k[0], j = k[1], N = k[2], P = Math.sqrt(A ** 2 + j ** 2), F = Math.atan2(j, A), I = Math.atan2(N, P), L = P / Math.cos(I) - R_MAJOR;
590
- F %= 2 * Math.PI;
591
- let R = new a(rad2deg(I), rad2deg(F), L);
592
- return R._ecef = k, R;
588
+ static fromECEF(w) {
589
+ let T = w[0], E = w[1], O = w[2], k = Math.sqrt(T ** 2 + E ** 2), A = Math.atan2(E, T), j = Math.atan2(O, k), M = k / Math.cos(j) - R_MAJOR;
590
+ A %= 2 * Math.PI;
591
+ let N = new e(rad2deg(j), rad2deg(A), M);
592
+ return N._ecef = w, N;
593
593
  }
594
- getSegmentProjection(k, A) {
595
- let j = Vector3.normalize(k.ecef), N = Vector3.normalize(A.ecef), P = Vector3.normalize(this.ecef), F = Vector3.cross(j, N);
596
- if (Vector3.norm(F) === 0) return null;
597
- let I = Vector3.cross(P, F), L = Vector3.normalize(Vector3.cross(F, I)), R = Vector3.multiplyScalar(L, R_MAJOR), z = a.fromECEF(R), B;
598
- k.alt !== null && A.alt !== null && (B = (k.alt + A.alt) / 2);
599
- let V = new a(z.lat, z.lng, B, Level_default.union(k.level, A.level));
600
- return Math.abs(k.distanceTo(A) - k.distanceTo(V) - A.distanceTo(V)) > .001 ? null : V;
594
+ getSegmentProjection(w, T) {
595
+ let E = Vector3.normalize(w.ecef), O = Vector3.normalize(T.ecef), k = Vector3.normalize(this.ecef), A = Vector3.cross(E, O);
596
+ if (Vector3.norm(A) === 0) return null;
597
+ let j = Vector3.cross(k, A), M = Vector3.normalize(Vector3.cross(A, j)), N = Vector3.multiplyScalar(M, R_MAJOR), P = e.fromECEF(N), F;
598
+ w.alt !== null && T.alt !== null && (F = (w.alt + T.alt) / 2);
599
+ let I = new e(P.lat, P.lng, F, Level_default.union(w.level, T.level));
600
+ return Math.abs(w.distanceTo(T) - w.distanceTo(I) - T.distanceTo(I)) > .001 ? null : I;
601
601
  }
602
602
  toString() {
603
- let a = "[" + this._lat.toFixed(7) + ", " + this._lng.toFixed(7);
604
- return this._alt !== null && (a += ", " + this._alt.toFixed(2)), this._level !== null && (a += ", [" + Level_default.toString(this._level) + "]"), a += "]", a;
603
+ let e = "[" + this._lat.toFixed(7) + ", " + this._lng.toFixed(7);
604
+ return this._alt !== null && (e += ", " + this._alt.toFixed(2)), this._level !== null && (e += ", [" + Level_default.toString(this._level) + "]"), e += "]", e;
605
605
  }
606
606
  toJson() {
607
607
  return {
@@ -611,8 +611,8 @@ var Rotations = class a {
611
611
  ...this.level !== null && { level: this.level }
612
612
  };
613
613
  }
614
- static fromJson(k) {
615
- return new a(k.lat, k.lng, k.alt, k.level);
614
+ static fromJson(w) {
615
+ return new e(w.lat, w.lng, w.alt, w.level);
616
616
  }
617
617
  toCompressedJson() {
618
618
  return this.level === null ? [Number(this.lat.toFixed(8)), Number(this.lng.toFixed(8))] : [
@@ -621,55 +621,55 @@ var Rotations = class a {
621
621
  this.level
622
622
  ];
623
623
  }
624
- static fromCompressedJson(k) {
625
- let A = new a(k[0], k[1]);
626
- return k.length > 2 && (A.level = k[2]), A;
624
+ static fromCompressedJson(w) {
625
+ let T = new e(w[0], w[1]);
626
+ return w.length > 2 && (T.level = w[2]), T;
627
627
  }
628
- }, UserPosition_default = class a extends Coordinates_default {
628
+ }, UserPosition_default = class e extends Coordinates_default {
629
629
  _time = null;
630
630
  _accuracy = null;
631
631
  _bearing = null;
632
- constructor(a, k, A = null, j = null, M = null, N = null, P = null) {
633
- super(a, k, A, j), this.time = M, this.accuracy = N, this.bearing = P;
632
+ constructor(e, w, T = null, E = null, D = null, O = null, k = null) {
633
+ super(e, w, T, E), this.time = D, this.accuracy = O, this.bearing = k;
634
634
  }
635
635
  get time() {
636
636
  return this._time;
637
637
  }
638
- set time(a) {
639
- this._time = a;
638
+ set time(e) {
639
+ this._time = e;
640
640
  }
641
641
  get accuracy() {
642
642
  return this._accuracy;
643
643
  }
644
- set accuracy(a) {
645
- if (a !== null && a < 0) throw Error("accuracy argument is not a positive number");
646
- this._accuracy = a;
644
+ set accuracy(e) {
645
+ if (e !== null && e < 0) throw Error("accuracy argument is not a positive number");
646
+ this._accuracy = e;
647
647
  }
648
648
  get bearing() {
649
649
  return this._bearing;
650
650
  }
651
- set bearing(a) {
652
- this._bearing = a === null ? null : a % (2 * Math.PI);
651
+ set bearing(e) {
652
+ this._bearing = e === null ? null : e % (2 * Math.PI);
653
653
  }
654
- move(a, k, A = null) {
655
- return super.move(a, k, A), this;
654
+ move(e, w, T = null) {
655
+ return super.move(e, w, T), this;
656
656
  }
657
- destinationPoint(a, k, A = null) {
658
- let j = this.clone();
659
- return j.move(a, k, A), j;
657
+ destinationPoint(e, w, T = null) {
658
+ let E = this.clone();
659
+ return E.move(e, w, T), E;
660
660
  }
661
- static fromCoordinates(k) {
662
- return new a(k.lat, k.lng, k.alt, k.level);
661
+ static fromCoordinates(w) {
662
+ return new e(w.lat, w.lng, w.alt, w.level);
663
663
  }
664
664
  clone() {
665
- let k = a.fromCoordinates(super.clone());
666
- return k.time = this.time, k.accuracy = this.accuracy, k.bearing = this.bearing, k;
665
+ let w = e.fromCoordinates(super.clone());
666
+ return w.time = this.time, w.accuracy = this.accuracy, w.bearing = this.bearing, w;
667
667
  }
668
- static equals(k, A, j = EPS_DEG_MM, M = EPS_MM) {
669
- return k === null && k === A ? !0 : !(k instanceof a) || !(A instanceof a) || !super.equals(k, A, j, M) ? !1 : k.time === A.time && k.accuracy === A.accuracy && k.bearing === A.bearing;
668
+ static equals(w, T, E = EPS_DEG_MM, D = EPS_MM) {
669
+ return w === null && w === T ? !0 : !(w instanceof e) || !(T instanceof e) || !super.equals(w, T, E, D) ? !1 : w.time === T.time && w.accuracy === T.accuracy && w.bearing === T.bearing;
670
670
  }
671
- equals(k, A = EPS_DEG_MM, j = EPS_MM) {
672
- return a.equals(this, k, A, j);
671
+ equals(w, T = EPS_DEG_MM, E = EPS_MM) {
672
+ return e.equals(this, w, T, E);
673
673
  }
674
674
  toJson() {
675
675
  return {
@@ -679,114 +679,124 @@ var Rotations = class a {
679
679
  ...this.bearing !== null && { bearing: this.bearing }
680
680
  };
681
681
  }
682
- static fromJson(k) {
683
- let A = a.fromCoordinates(Coordinates_default.fromJson(k));
684
- return k.time !== void 0 && (A.time = k.time), k.accuracy !== void 0 && (A.accuracy = k.accuracy), k.bearing !== void 0 && (A.bearing = k.bearing), A;
682
+ static fromJson(w) {
683
+ let T = e.fromCoordinates(Coordinates_default.fromJson(w));
684
+ return w.time !== void 0 && (T.time = w.time), w.accuracy !== void 0 && (T.accuracy = w.accuracy), w.bearing !== void 0 && (T.bearing = w.bearing), T;
685
685
  }
686
686
  }, Utils_exports = /* @__PURE__ */ __export({
687
687
  calcDistance: () => calcDistance,
688
688
  createSegmentsAtLevel: () => createSegmentsAtLevel,
689
689
  geolocationPositionToUserPosition: () => geolocationPositionToUserPosition,
690
690
  sampleRoute: () => sampleRoute,
691
+ segmentIntersection: () => segmentIntersection,
691
692
  simplifyRoute: () => simplifyRoute,
692
693
  trimRoute: () => trimRoute
693
694
  });
694
- function sampleRoute(a, k = .7, A = 0, j = Number.MAX_VALUE) {
695
- let M = A + j, N = [], P, F = 0, I = 0, L = !1;
696
- for (let j = 0; j < a.length - 1; j++) {
697
- let R = a[j], z = a[j + 1], B = R.distanceTo(z), V = R.bearingTo(z), H = 0;
698
- if (!L) if (A < F + B) L = !0, I = A - F;
695
+ function sampleRoute(e, w = .7, T = 0, E = Number.MAX_VALUE) {
696
+ let D = T + E, O = [], k, A = 0, j = 0, M = !1;
697
+ for (let E = 0; E < e.length - 1; E++) {
698
+ let N = e[E], P = e[E + 1], F = N.distanceTo(P), I = N.bearingTo(P), L = 0;
699
+ if (!M) if (T < A + F) M = !0, j = T - A;
699
700
  else {
700
- F += B;
701
+ A += F;
701
702
  continue;
702
703
  }
703
- for (P = Object.assign(R.clone(), { bearing: V }); H + I < B && F + I <= M;) {
704
- let a = P.destinationPoint(I, V);
705
- a.bearing = V, N.push(a), P = a, H += I, F += I, I = k;
704
+ for (k = Object.assign(N.clone(), { bearing: I }); L + j < F && A + j <= D;) {
705
+ let e = k.destinationPoint(j, I);
706
+ e.bearing = I, O.push(e), k = e, L += j, A += j, j = w;
706
707
  }
707
- if (F + I > M) break;
708
- let U = B - H;
709
- F += U, I -= U;
708
+ if (A + j > D) break;
709
+ let R = F - L;
710
+ A += R, j -= R;
710
711
  }
711
- return N;
712
+ return O;
712
713
  }
713
- function trimRoute(a, k = a[0], A = Number.MAX_VALUE) {
714
- let j = [], M = null, N, P = 0;
715
- if (a.length <= 1) throw Error("Route must have at least 2 points");
716
- for (N = 1; N < a.length; N++) {
717
- let A = a[N - 1], P = a[N];
718
- if (Coordinates_default.equals(k, A)) {
719
- j.push(A), M = A;
714
+ function trimRoute(e, w = e[0], T = Number.MAX_VALUE) {
715
+ let E = [], D = null, O, k = 0;
716
+ if (e.length <= 1) throw Error("Route must have at least 2 points");
717
+ for (O = 1; O < e.length; O++) {
718
+ let T = e[O - 1], k = e[O];
719
+ if (Coordinates_default.equals(w, T)) {
720
+ E.push(T), D = T;
720
721
  break;
721
722
  }
722
- let F = k.getSegmentProjection(A, P);
723
- if (F && Coordinates_default.equals(k, F) && !F.equals(P)) {
724
- j.push(F), M = F;
723
+ let A = w.getSegmentProjection(T, k);
724
+ if (A && Coordinates_default.equals(w, A) && !A.equals(k)) {
725
+ E.push(A), D = A;
725
726
  break;
726
727
  }
727
728
  }
728
- if (!j.length) throw Error("startPosition is not on the route");
729
- for (; M && N < a.length;) {
730
- let k = a[N], F = M.distanceTo(k);
731
- if (P + F >= A || Math.abs(P + F - A) <= .001) {
732
- let a = M.bearingTo(k), N = A - P, F = M.destinationPoint(N, a);
733
- j.push(F);
729
+ if (!E.length) throw Error("startPosition is not on the route");
730
+ for (; D && O < e.length;) {
731
+ let w = e[O], A = D.distanceTo(w);
732
+ if (k + A >= T || Math.abs(k + A - T) <= .001) {
733
+ let e = D.bearingTo(w), O = T - k, A = D.destinationPoint(O, e);
734
+ E.push(A);
734
735
  break;
735
736
  }
736
- j.push(k), M = k, P += F, N++;
737
+ E.push(w), D = w, k += A, O++;
737
738
  }
738
- return j;
739
+ return E;
739
740
  }
740
- function simplifyRoute(a, k = deg2rad(5)) {
741
- let A = a[0].equals(a[a.length - 1]), j = a.slice(0, a.length - (A ? 1 : 0)), M = j.length;
742
- for (let N = A ? 0 : 1; N < M; N++) {
743
- let A = a[positiveMod(N - 1, M)], P = a[N], F = a[positiveMod(N + 1, M)], I = A.bearingTo(P), L = P.bearingTo(F);
744
- Math.abs(L - I) < k && (j = j.filter((a) => a !== P));
741
+ function simplifyRoute(e, w = deg2rad(5)) {
742
+ let T = e[0].equals(e[e.length - 1]), E = e.slice(0, e.length - (T ? 1 : 0)), D = E.length;
743
+ for (let O = T ? 0 : 1; O < D; O++) {
744
+ let T = e[positiveMod(O - 1, D)], k = e[O], A = e[positiveMod(O + 1, D)], j = T.bearingTo(k), M = k.bearingTo(A);
745
+ Math.abs(M - j) < w && (E = E.filter((e) => e !== k));
745
746
  }
746
- return A && j.push(j[0]), j;
747
+ return T && E.push(E[0]), E;
747
748
  }
748
- function geolocationPositionToUserPosition(a) {
749
- if (a === null) return null;
750
- let { latitude: k, longitude: A, accuracy: j, heading: M } = a.coords, N = new UserPosition_default(k, A);
751
- return N.time = a.timestamp, N.accuracy = j, N.bearing = M ? deg2rad(M) : null, N;
749
+ function geolocationPositionToUserPosition(e) {
750
+ if (e === null) return null;
751
+ let { latitude: w, longitude: T, accuracy: E, heading: D } = e.coords, O = new UserPosition_default(w, T);
752
+ return O.time = e.timestamp, O.accuracy = E, O.bearing = D ? deg2rad(D) : null, O;
752
753
  }
753
- function calcDistance(a) {
754
- return a.reduce((a, k, A, j) => a + (A ? j[A - 1].distanceTo(k) : 0), 0);
754
+ function calcDistance(e) {
755
+ return e.reduce((e, w, T, E) => e + (T ? E[T - 1].distanceTo(w) : 0), 0);
755
756
  }
756
- function createSegmentsAtLevel(a, k, A = !0) {
757
- let j = a.length, M = !1, N = [], P = [];
758
- for (let F = 0; F < j; F++) {
759
- let j = a[F], I = Level_default.intersect(k, j.level);
760
- A && !I && M ? P.push(j) : I && (M || (P = [], N.push(P), A && F !== 0 && P.push(a[F - 1])), P.push(j)), M = I;
757
+ function createSegmentsAtLevel(e, w, T = !0) {
758
+ let E = e.length, D = !1, O = [], k = [];
759
+ for (let A = 0; A < E; A++) {
760
+ let E = e[A], j = Level_default.intersect(w, E.level);
761
+ T && !j && D ? k.push(E) : j && (D || (k = [], O.push(k), T && A !== 0 && k.push(e[A - 1])), k.push(E)), D = j;
761
762
  }
762
- return N;
763
+ return O;
764
+ }
765
+ function segmentIntersection(e, w, T, E) {
766
+ let O = (e) => e * Math.PI / 180, k = (e.lat + w.lat + T.lat + E.lat) / 4, A = R_MAJOR * 180 / Math.PI, j = R_MAJOR * 180 / Math.PI * Math.cos(O(k)), M = (e) => ({
767
+ x: e.lng * j,
768
+ y: e.lat * A
769
+ }), N = M(e), P = M(w), F = M(T), I = M(E), L = P.x - N.x, R = P.y - N.y, z = I.x - F.x, B = I.y - F.y, V = L * B - R * z;
770
+ if (Math.abs(V) < 1e-10) return null;
771
+ let H = F.x - N.x, U = F.y - N.y, W = (H * B - U * z) / V, G = (H * R - U * L) / V;
772
+ return W < 0 || W > 1 || G < 0 || G > 1 ? null : new Coordinates_default((N.y + W * R) / A, (N.x + W * L) / j);
763
773
  }
764
- var BoundingBox_default = class a {
774
+ var BoundingBox_default = class e {
765
775
  northEast;
766
776
  southWest;
767
- constructor(a, k) {
768
- if (this.northEast = a, this.southWest = k, this.northEast && this.southWest && this.getNorth() < this.getSouth()) throw Error("Incorrect bounding box");
777
+ constructor(e, w) {
778
+ if (this.northEast = e, this.southWest = w, this.northEast && this.southWest && this.getNorth() < this.getSouth()) throw Error("Incorrect bounding box");
769
779
  }
770
780
  get center() {
771
781
  return new Coordinates_default((this.southWest.lat + this.northEast.lat) / 2, (this.northEast.lng + this.southWest.lng) / 2);
772
782
  }
773
- contains(a) {
774
- return a.lat <= this.northEast.lat && a.lat >= this.southWest.lat && a.lng <= this.northEast.lng && a.lng >= this.southWest.lng;
783
+ contains(e) {
784
+ return e.lat <= this.northEast.lat && e.lat >= this.southWest.lat && e.lng <= this.northEast.lng && e.lng >= this.southWest.lng;
775
785
  }
776
- extend(k) {
777
- let A = this.southWest, j = this.northEast, M, N;
778
- if (k instanceof Coordinates_default) M = k, N = k;
779
- else if (k instanceof a) M = k.southWest, N = k.northEast;
786
+ extend(w) {
787
+ let T = this.southWest, E = this.northEast, D, O;
788
+ if (w instanceof Coordinates_default) D = w, O = w;
789
+ else if (w instanceof e) D = w.southWest, O = w.northEast;
780
790
  else throw Error("Unknown parameter");
781
- return this.southWest = new Coordinates_default(Math.min(M.lat, A.lat), Math.min(M.lng, A.lng)), this.northEast = new Coordinates_default(Math.max(N.lat, j.lat), Math.max(N.lng, j.lng)), this;
791
+ return this.southWest = new Coordinates_default(Math.min(D.lat, T.lat), Math.min(D.lng, T.lng)), this.northEast = new Coordinates_default(Math.max(O.lat, E.lat), Math.max(O.lng, E.lng)), this;
782
792
  }
783
- extendsWithMeasure(a) {
784
- if (typeof a != "number") throw Error("measure is not a number");
785
- return this.northEast = this.northEast.destinationPoint(a, 0).move(a, Math.PI / 2), this.southWest = this.southWest.clone().destinationPoint(a, -Math.PI / 2).destinationPoint(a, Math.PI), this;
793
+ extendsWithMeasure(e) {
794
+ if (typeof e != "number") throw Error("measure is not a number");
795
+ return this.northEast = this.northEast.destinationPoint(e, 0).move(e, Math.PI / 2), this.southWest = this.southWest.clone().destinationPoint(e, -Math.PI / 2).destinationPoint(e, Math.PI), this;
786
796
  }
787
- pad(a) {
788
- let k = this.southWest, A = this.northEast, j = Math.abs(k.lat - A.lat) * a, M = Math.abs(k.lng - A.lng) * a;
789
- return this.southWest = new Coordinates_default(k.lat - j, k.lng - M), this.northEast = new Coordinates_default(A.lat + j, A.lng + M), this;
797
+ pad(e) {
798
+ let w = this.southWest, T = this.northEast, E = Math.abs(w.lat - T.lat) * e, D = Math.abs(w.lng - T.lng) * e;
799
+ return this.southWest = new Coordinates_default(w.lat - E, w.lng - D), this.northEast = new Coordinates_default(T.lat + E, T.lng + D), this;
790
800
  }
791
801
  getSouthWest() {
792
802
  return this.southWest;
@@ -812,17 +822,17 @@ var BoundingBox_default = class a {
812
822
  getNorth() {
813
823
  return this.northEast.lat;
814
824
  }
815
- static equals(a, k) {
816
- return Coordinates_default.equals(a.northEast, k.northEast) && Coordinates_default.equals(a.southWest, k.southWest);
825
+ static equals(e, w) {
826
+ return Coordinates_default.equals(e.northEast, w.northEast) && Coordinates_default.equals(e.southWest, w.southWest);
817
827
  }
818
- equals(k) {
819
- return a.equals(this, k);
828
+ equals(w) {
829
+ return e.equals(this, w);
820
830
  }
821
- static fromArray(k) {
822
- return new a(new Coordinates_default(k[3], k[2]), new Coordinates_default(k[1], k[0]));
831
+ static fromArray(w) {
832
+ return new e(new Coordinates_default(w[3], w[2]), new Coordinates_default(w[1], w[0]));
823
833
  }
824
- static fromCoordinates(k) {
825
- return k.length === 0 ? null : k.reduce((a, k) => a.extend(k), new a(k[0], k[0]));
834
+ static fromCoordinates(w) {
835
+ return w.length === 0 ? null : w.reduce((e, w) => e.extend(w), new e(w[0], w[0]));
826
836
  }
827
837
  toArray() {
828
838
  return [
@@ -832,37 +842,37 @@ var BoundingBox_default = class a {
832
842
  this.getNorth()
833
843
  ];
834
844
  }
835
- }, RelativePosition_default = class a {
845
+ }, RelativePosition_default = class e {
836
846
  x;
837
847
  y;
838
848
  z;
839
849
  time = null;
840
850
  _accuracy = null;
841
851
  _bearing = null;
842
- constructor(a, k, A, j = null, M = null, N = null) {
843
- this.x = a, this.y = k, this.z = A, this.time = j, this.accuracy = M, this.bearing = N;
852
+ constructor(e, w, T, E = null, D = null, O = null) {
853
+ this.x = e, this.y = w, this.z = T, this.time = E, this.accuracy = D, this.bearing = O;
844
854
  }
845
855
  get accuracy() {
846
856
  return this._accuracy;
847
857
  }
848
- set accuracy(a) {
849
- if (a !== null && a < 0) throw Error("accuracy argument is not a positive number");
850
- this._accuracy = a;
858
+ set accuracy(e) {
859
+ if (e !== null && e < 0) throw Error("accuracy argument is not a positive number");
860
+ this._accuracy = e;
851
861
  }
852
862
  get bearing() {
853
863
  return this._bearing;
854
864
  }
855
- set bearing(a) {
856
- this._bearing = a === null ? null : a % (2 * Math.PI);
865
+ set bearing(e) {
866
+ this._bearing = e === null ? null : e % (2 * Math.PI);
857
867
  }
858
868
  clone() {
859
- return new a(this.x, this.y, this.z, this.time, this.accuracy, this.bearing);
869
+ return new e(this.x, this.y, this.z, this.time, this.accuracy, this.bearing);
860
870
  }
861
- static equals(k, A, j = EPS_MM) {
862
- return k === null && k === A ? !0 : !(k instanceof a) || !(A instanceof a) ? !1 : Math.abs(A.x - k.x) < j && Math.abs(A.y - k.y) < j && Math.abs(A.z - k.z) < j && k.time === A.time && k.accuracy === A.accuracy && k.bearing === A.bearing;
871
+ static equals(w, T, E = EPS_MM) {
872
+ return w === null && w === T ? !0 : !(w instanceof e) || !(T instanceof e) ? !1 : Math.abs(T.x - w.x) < E && Math.abs(T.y - w.y) < E && Math.abs(T.z - w.z) < E && w.time === T.time && w.accuracy === T.accuracy && w.bearing === T.bearing;
863
873
  }
864
- equals(k) {
865
- return a.equals(this, k);
874
+ equals(w) {
875
+ return e.equals(this, w);
866
876
  }
867
877
  toJson() {
868
878
  return {
@@ -874,42 +884,42 @@ var BoundingBox_default = class a {
874
884
  ...this.bearing !== null && { bearing: this.bearing }
875
885
  };
876
886
  }
877
- static fromJson(k) {
878
- return new a(k.x, k.y, k.z, k.time, k.accuracy, k.bearing);
887
+ static fromJson(w) {
888
+ return new e(w.x, w.y, w.z, w.time, w.accuracy, w.bearing);
879
889
  }
880
- }, GeoRelativePosition_default = class extends RelativePosition_default {}, GeoRef_default = class k {
890
+ }, GeoRelativePosition_default = class extends RelativePosition_default {}, GeoRef_default = class w {
881
891
  scale = 1;
882
892
  heading = 0;
883
893
  origin;
884
894
  buildingLevels;
885
- constructor(a, k = []) {
886
- this.origin = a, this.buildingLevels = k;
895
+ constructor(e, w = []) {
896
+ this.origin = e, this.buildingLevels = w;
887
897
  }
888
- localToWorld(k) {
889
- let A = Vector3.multiplyScalar(k, this.scale), j = Quaternion.fromAxisAngle([
898
+ localToWorld(w) {
899
+ let T = Vector3.multiplyScalar(w, this.scale), E = Quaternion.fromAxisAngle([
890
900
  0,
891
901
  0,
892
902
  1
893
- ], this.heading), M = Quaternion.multiply(j, this.origin.enuToEcefRotation), N = Quaternion.rotate(M, A), P = Vector3.sum(this.origin.ecef, N), F = Coordinates_default.fromECEF(P), I = F.alt;
894
- F.heightFromGround = F.alt - this.origin.alt;
895
- let L = (a) => {
896
- F.level = a.id, F.heightFromFloor = I - a.floorAltitude;
903
+ ], this.heading), D = Quaternion.multiply(E, this.origin.enuToEcefRotation), O = Quaternion.rotate(D, T), k = Vector3.sum(this.origin.ecef, O), A = Coordinates_default.fromECEF(k), j = A.alt;
904
+ A.heightFromGround = A.alt - this.origin.alt;
905
+ let M = (e) => {
906
+ A.level = e.id, A.heightFromFloor = j - e.floorAltitude;
897
907
  };
898
- if (!this.buildingLevels.length) return F;
899
- let R = this.buildingLevels.filter((a) => I >= a.floorAltitude && I <= a.ceilingAltitude);
900
- if (!R.length) return F;
901
- let z = R[0], B = [F.lng, F.lat], V = R.filter((a) => a.geometries.length);
902
- if (!V.length) return L(z), F;
903
- let H = V.filter((k) => k.geometries.some((k) => booleanPointInPolygon(B, k)))[0];
904
- return H && L(H), F;
905
- }
906
- worldToLocal(a) {
907
- let k = Quaternion.fromAxisAngle([
908
+ if (!this.buildingLevels.length) return A;
909
+ let N = this.buildingLevels.filter((e) => j >= e.floorAltitude && j <= e.ceilingAltitude);
910
+ if (!N.length) return A;
911
+ let P = N[0], F = [A.lng, A.lat], I = N.filter((e) => e.geometries.length);
912
+ if (!I.length) return M(P), A;
913
+ let L = I.filter((w) => w.geometries.some((w) => booleanPointInPolygon(F, w)))[0];
914
+ return L && M(L), A;
915
+ }
916
+ worldToLocal(e) {
917
+ let w = Quaternion.fromAxisAngle([
908
918
  0,
909
919
  0,
910
920
  1
911
- ], -this.heading), A = Quaternion.multiply(this.origin.ecefToEnuRotation, k), j = Vector3.subtract(a.ecef, this.origin.ecef), M = Vector3.multiplyScalar(j, 1 / this.scale);
912
- return Quaternion.rotate(A, M);
921
+ ], -this.heading), T = Quaternion.multiply(this.origin.ecefToEnuRotation, w), E = Vector3.subtract(e.ecef, this.origin.ecef), D = Vector3.multiplyScalar(E, 1 / this.scale);
922
+ return Quaternion.rotate(T, D);
913
923
  }
914
924
  toJson() {
915
925
  return {
@@ -918,11 +928,11 @@ var BoundingBox_default = class a {
918
928
  ...this.heading !== 0 && { heading: this.heading }
919
929
  };
920
930
  }
921
- static fromJson(a) {
922
- let A = new k(Coordinates_default.fromJson(a.origin));
923
- return A.scale = a.scale === void 0 ? 1 : a.scale, A.heading = a.heading === void 0 ? 0 : a.heading, A;
931
+ static fromJson(e) {
932
+ let T = new w(Coordinates_default.fromJson(e.origin));
933
+ return T.scale = e.scale === void 0 ? 1 : e.scale, T.heading = e.heading === void 0 ? 0 : e.heading, T;
924
934
  }
925
- }, Attitude_default = class a {
935
+ }, Attitude_default = class e {
926
936
  _quaternion = [
927
937
  1,
928
938
  0,
@@ -933,11 +943,11 @@ var BoundingBox_default = class a {
933
943
  _eulerAngles = null;
934
944
  _time = null;
935
945
  _accuracy = null;
936
- constructor(a, k = null, A = null) {
937
- this.quaternion = a, this.time = k, this.accuracy = A;
946
+ constructor(e, w = null, T = null) {
947
+ this.quaternion = e, this.time = w, this.accuracy = T;
938
948
  }
939
949
  static unitary() {
940
- return new a([
950
+ return new e([
941
951
  1,
942
952
  0,
943
953
  0,
@@ -947,44 +957,44 @@ var BoundingBox_default = class a {
947
957
  get quaternion() {
948
958
  return this._quaternion;
949
959
  }
950
- set quaternion(a) {
951
- if (Math.abs(1 - Quaternion.norm(a)) > 1e-4) throw Error("quaternion is not a unit quaternion");
952
- this._quaternion = a, this._heading = null, this._eulerAngles = null;
960
+ set quaternion(e) {
961
+ if (Math.abs(1 - Quaternion.norm(e)) > 1e-4) throw Error("quaternion is not a unit quaternion");
962
+ this._quaternion = e, this._heading = null, this._eulerAngles = null;
953
963
  }
954
964
  get time() {
955
965
  return this._time;
956
966
  }
957
- set time(a) {
958
- this._time = a;
967
+ set time(e) {
968
+ this._time = e;
959
969
  }
960
970
  get accuracy() {
961
971
  return this._accuracy;
962
972
  }
963
- set accuracy(a) {
964
- if (a !== null && (a < 0 || a > Math.PI)) throw Error("accuracy argument (" + a + ") is not in range [0; PI]");
965
- this._accuracy = a;
973
+ set accuracy(e) {
974
+ if (e !== null && (e < 0 || e > Math.PI)) throw Error("accuracy argument (" + e + ") is not in range [0; PI]");
975
+ this._accuracy = e;
966
976
  }
967
977
  get eulerAngles() {
968
978
  return this._eulerAngles === null && (this._eulerAngles = Rotations.quaternionToEulerZXY(this.quaternion)), this._eulerAngles;
969
979
  }
970
980
  get eulerAnglesDegrees() {
971
- return this.eulerAngles.map((a) => rad2deg(a));
981
+ return this.eulerAngles.map((e) => rad2deg(e));
972
982
  }
973
983
  get heading() {
974
984
  if (this._heading === null) {
975
- let a = 0;
976
- typeof window < "u" && window && window.orientation && (a = deg2rad(window.orientation)), this._heading = Rotations.getHeadingFromQuaternion(this.quaternion) + a;
985
+ let e = 0;
986
+ typeof window < "u" && window && window.orientation && (e = deg2rad(window.orientation)), this._heading = Rotations.getHeadingFromQuaternion(this.quaternion) + e;
977
987
  }
978
988
  return this._heading;
979
989
  }
980
990
  get headingDegrees() {
981
991
  return rad2deg(this.heading);
982
992
  }
983
- static equals(k, A) {
984
- return k === null && k === A ? !0 : !(k instanceof a) || !(A instanceof a) ? !1 : k === A ? !0 : Quaternion.equals(k.quaternion, A.quaternion);
993
+ static equals(w, T) {
994
+ return w === null && w === T ? !0 : !(w instanceof e) || !(T instanceof e) ? !1 : w === T ? !0 : Quaternion.equals(w.quaternion, T.quaternion);
985
995
  }
986
- equals(k) {
987
- return a.equals(this, k);
996
+ equals(w) {
997
+ return e.equals(this, w);
988
998
  }
989
999
  toJson() {
990
1000
  return this.time === null && this.accuracy === null ? this.quaternion : {
@@ -993,31 +1003,31 @@ var BoundingBox_default = class a {
993
1003
  ...this.accuracy !== null && { accuracy: this.accuracy }
994
1004
  };
995
1005
  }
996
- static fromJson(k) {
997
- return Array.isArray(k) ? new a(k, null, null) : new a(k.q, k.time, k.accuracy);
1006
+ static fromJson(w) {
1007
+ return Array.isArray(w) ? new e(w, null, null) : new e(w.q, w.time, w.accuracy);
998
1008
  }
999
1009
  clone() {
1000
- return new a(this.quaternion.slice(0), this.time, this.accuracy);
1010
+ return new e(this.quaternion.slice(0), this.time, this.accuracy);
1001
1011
  }
1002
- static diff(k, A) {
1003
- let j = Quaternion.multiply(Quaternion.inverse(k.quaternion), A.quaternion), M = null;
1004
- A.time !== null && k.time !== null && (M = A.time - k.time);
1005
- let N = null;
1006
- return k.accuracy !== null && A.accuracy !== null && (N = Math.max(A.accuracy - k.accuracy)), new a(j, M, N);
1012
+ static diff(w, T) {
1013
+ let E = Quaternion.multiply(Quaternion.inverse(w.quaternion), T.quaternion), D = null;
1014
+ T.time !== null && w.time !== null && (D = T.time - w.time);
1015
+ let O = null;
1016
+ return w.accuracy !== null && T.accuracy !== null && (O = Math.max(T.accuracy - w.accuracy)), new e(E, D, O);
1007
1017
  }
1008
- }, AbsoluteHeading_default = class a {
1018
+ }, AbsoluteHeading_default = class e {
1009
1019
  heading;
1010
1020
  time = null;
1011
1021
  _accuracy = null;
1012
- constructor(a, k = null, A = null) {
1013
- this.heading = a, this.time = k, this.accuracy = A;
1022
+ constructor(e, w = null, T = null) {
1023
+ this.heading = e, this.time = w, this.accuracy = T;
1014
1024
  }
1015
1025
  get accuracy() {
1016
1026
  return this._accuracy;
1017
1027
  }
1018
- set accuracy(a) {
1019
- if (a !== null && (a < 0 || a > Math.PI)) throw Error("accuracy argument (" + a + ") is not in range [0; PI]");
1020
- this._accuracy = a;
1028
+ set accuracy(e) {
1029
+ if (e !== null && (e < 0 || e > Math.PI)) throw Error("accuracy argument (" + e + ") is not in range [0; PI]");
1030
+ this._accuracy = e;
1021
1031
  }
1022
1032
  toAttitude() {
1023
1033
  return new Attitude_default(Quaternion.fromAxisAngle([
@@ -1026,11 +1036,11 @@ var BoundingBox_default = class a {
1026
1036
  1
1027
1037
  ], -this.heading), this.time, this.accuracy);
1028
1038
  }
1029
- static equals(k, A) {
1030
- return k === null && k === A ? !0 : !(k instanceof a) || !(A instanceof a) ? !1 : Math.abs(k.heading - A.heading) < 1e-8;
1039
+ static equals(w, T) {
1040
+ return w === null && w === T ? !0 : !(w instanceof e) || !(T instanceof e) ? !1 : Math.abs(w.heading - T.heading) < 1e-8;
1031
1041
  }
1032
- equals(k) {
1033
- return a.equals(this, k);
1042
+ equals(w) {
1043
+ return e.equals(this, w);
1034
1044
  }
1035
1045
  toJson() {
1036
1046
  return {
@@ -1039,11 +1049,11 @@ var BoundingBox_default = class a {
1039
1049
  ...this.accuracy !== null && { accuracy: this.accuracy }
1040
1050
  };
1041
1051
  }
1042
- static fromJson(k) {
1043
- return new a(k.heading, k.time, k.accuracy);
1052
+ static fromJson(w) {
1053
+ return new e(w.heading, w.time, w.accuracy);
1044
1054
  }
1045
1055
  clone() {
1046
- return new a(this.heading, this.time, this.accuracy);
1056
+ return new e(this.heading, this.time, this.accuracy);
1047
1057
  }
1048
1058
  };
1049
1059
  export { AbsoluteHeading_default as AbsoluteHeading, Attitude_default as Attitude, BoundingBox_default as BoundingBox, Constants_exports as Constants, Coordinates_default as Coordinates, GeoRef_default as GeoRef, GeoRelativePosition_default as GeoRelativePosition, Level_default as Level, RelativePosition_default as RelativePosition, UserPosition_default as UserPosition, Utils_exports as Utils };