@cearth/tools 2.5.0 → 2.6.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/tools.js CHANGED
@@ -1,6 +1,6 @@
1
- import { WebGLConstants as P, Cartesian3 as l, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as M, Plane as rt, Transforms as E, BoundingSphere as C, JulianDate as h, Cartesian2 as x, ComponentDatatype as Z, Cartographic as D, Cartesian4 as O, Rectangle as v, Matrix2 as F } from "cesium";
2
- import { MatrixComposeOrder as _, mat4_decompose_quat as at, mat4_compose_quat as st, getMatrixOfQuantizedMeshTerrainData as ct, Geometry as lt, workerApi as ut, GeometricRelation as z, computeSignAreaOfPolygon3 as K, computeRelationAreaOfPolygon2Terrain as ft } from "@web-3d/tools";
3
- function Lt(t) {
1
+ import { WebGLConstants as M, Cartesian3 as l, HeadingPitchRoll as I, Quaternion as w, Matrix3 as g, Matrix4 as a, TranslationRotationScale as P, Plane as rt, Transforms as E, BoundingSphere as C, JulianDate as h, Cartesian2 as x, ComponentDatatype as Z, Cartographic as D, Cartesian4 as O, Rectangle as v, Matrix2 as N } from "cesium";
2
+ import { MatrixComposeOrder as F, mat4_decompose_quat as at, mat4_compose_quat as st, getMatrixOfQuantizedMeshTerrainData as ct, Geometry as lt, workerApi as ut, GeometricRelation as z, computeSignAreaOfPolygon3 as K, computeRelationAreaOfPolygon2Terrain as ft } from "@web-3d/tools";
3
+ function Ut(t) {
4
4
  return q(t) || J(t) || mt(t);
5
5
  }
6
6
  function q(t) {
@@ -17,43 +17,43 @@ const pt = {
17
17
  * 8-bit signed byte corresponding to <code>gl.BYTE</code> and the type
18
18
  * of an element in <code>Int8Array</code>.
19
19
  */
20
- [P.BYTE]: Int8Array,
20
+ [M.BYTE]: Int8Array,
21
21
  /**
22
22
  * 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
23
23
  * of an element in <code>Uint8Array</code>.
24
24
  */
25
- [P.UNSIGNED_BYTE]: Uint8Array,
25
+ [M.UNSIGNED_BYTE]: Uint8Array,
26
26
  /**
27
27
  * 16-bit signed short corresponding to <code>SHORT</code> and the type
28
28
  * of an element in <code>Int16Array</code>.
29
29
  */
30
- [P.SHORT]: Int16Array,
30
+ [M.SHORT]: Int16Array,
31
31
  /**
32
32
  * 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
33
33
  * of an element in <code>Uint16Array</code>.
34
34
  */
35
- [P.UNSIGNED_SHORT]: Uint16Array,
35
+ [M.UNSIGNED_SHORT]: Uint16Array,
36
36
  /**
37
37
  * 32-bit signed int corresponding to <code>INT</code> and the type
38
38
  * of an element in <code>Int32Array</code>.
39
39
  */
40
- [P.INT]: Int32Array,
40
+ [M.INT]: Int32Array,
41
41
  /**
42
42
  * 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
43
43
  * of an element in <code>Uint32Array</code>.
44
44
  */
45
- [P.UNSIGNED_INT]: Uint32Array,
45
+ [M.UNSIGNED_INT]: Uint32Array,
46
46
  /**
47
47
  * 32-bit floating-point corresponding to <code>FLOAT</code> and the type
48
48
  * of an element in <code>Float32Array</code>.
49
49
  */
50
- [P.FLOAT]: Float32Array,
50
+ [M.FLOAT]: Float32Array,
51
51
  /**
52
52
  * 64-bit floating-point corresponding to <code>gl.DOUBLE</code> (in Desktop OpenGL;
53
53
  * this is not supported in WebGL, and is emulated in Cesium via {@link GeometryPipeline.encodeAttribute})
54
54
  * and the type of an element in <code>Float64Array</code>.
55
55
  */
56
- [P.DOUBLE]: Float64Array
56
+ [M.DOUBLE]: Float64Array
57
57
  };
58
58
  var dt = /* @__PURE__ */ ((t) => (t[t.x = 0] = "x", t[t.y = 1] = "y", t[t.z = 2] = "z", t))(dt || {}), b = /* @__PURE__ */ ((t) => (t.x = "roll", t.y = "pitch", t.z = "heading", t))(b || {});
59
59
  ((t) => {
@@ -85,7 +85,7 @@ function G(t) {
85
85
  const o = b.toHeadingPitchRoll(t);
86
86
  return w.fromHeadingPitchRoll(o);
87
87
  }
88
- function Ut(t, o, n) {
88
+ function Yt(t, o, n) {
89
89
  const e = g.fromQuaternion(t), i = a.fromRotation(e), r = a.inverseTransformation(o, new a()), s = a.multiply(r, i, i);
90
90
  return tt(s);
91
91
  }
@@ -93,7 +93,7 @@ function tt(t, o) {
93
93
  const n = a.getMatrix3(t, new g()), e = w.fromRotationMatrix(n);
94
94
  return I.fromQuaternion(e, o);
95
95
  }
96
- function Yt(t, o, n) {
96
+ function jt(t, o, n) {
97
97
  n = n ?? new a();
98
98
  const e = a.inverse(o, new a());
99
99
  return a.multiply(e, t, n);
@@ -104,7 +104,7 @@ function wt(t, o, n) {
104
104
  const i = w.computeAngle(t);
105
105
  return e = a.multiplyByPointAsVector(o, e, e), w.fromAxisAngle(e, i);
106
106
  }
107
- function jt(t, o, n) {
107
+ function Wt(t, o, n) {
108
108
  let e = w.computeAxis(t, new l());
109
109
  if (e.equals(l.ZERO)) return null;
110
110
  const i = w.computeAngle(t), r = a.inverse(o, new a());
@@ -112,22 +112,22 @@ function jt(t, o, n) {
112
112
  }
113
113
  function L(t, o) {
114
114
  let { translation: n, rotation: e, scale: i } = t;
115
- const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o);
116
- let f = null;
117
- return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (f = G(e), c || (f = wt(f, r))), i && (u || (i = a.multiplyByPointAsVector(r, i, new l()))), { translation: n, rotation: f, scale: i };
115
+ const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: f } = $(o);
116
+ let u = null;
117
+ return n && (s || (n = a.multiplyByPointAsVector(r, n, new l()))), e && (u = G(e), c || (u = wt(u, r))), i && (f || (i = a.multiplyByPointAsVector(r, i, new l()))), { translation: n, rotation: u, scale: i };
118
118
  }
119
119
  function gt(t, o) {
120
120
  let { translation: n, rotation: e, scale: i } = t;
121
- const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: u } = $(o), f = r ? a.inverse(r, new a()) : null;
121
+ const { referFrame: r, worldTranslation: s, worldRotation: c, worldScale: f } = $(o), u = r ? a.inverse(r, new a()) : null;
122
122
  let m = null;
123
- if (n && s && (n = a.multiplyByPointAsVector(f, n, new l())), e && (m = G(e), c)) {
123
+ if (n && s && (n = a.multiplyByPointAsVector(u, n, new l())), e && (m = G(e), c)) {
124
124
  let p = w.computeAxis(m, new l());
125
125
  if (!p.equals(l.ZERO)) {
126
126
  const d = w.computeAngle(m);
127
- p = a.multiplyByPointAsVector(f, p, p), m = w.fromAxisAngle(p, d);
127
+ p = a.multiplyByPointAsVector(u, p, p), m = w.fromAxisAngle(p, d);
128
128
  }
129
129
  }
130
- return i && u && (i = a.multiplyByPointAsVector(f, i, new l())), { translation: n, rotation: m, scale: i };
130
+ return i && f && (i = a.multiplyByPointAsVector(u, i, new l())), { translation: n, rotation: m, scale: i };
131
131
  }
132
132
  function ht(t, o) {
133
133
  const n = o?.defaultMatrix;
@@ -139,32 +139,32 @@ function ht(t, o) {
139
139
  }
140
140
  r || (r = a.getScale(n, new l()));
141
141
  }
142
- const s = new M(e ?? void 0, i ?? void 0, r ?? void 0);
142
+ const s = new P(e ?? void 0, i ?? void 0, r ?? void 0);
143
143
  return a.fromTranslationRotationScale(s);
144
144
  }
145
- function Wt(t) {
146
- const { translation: o, rotation: n, scale: e } = t, i = n ? G(n) : void 0, r = new M(o ?? void 0, i, e ?? void 0);
145
+ function Xt(t) {
146
+ const { translation: o, rotation: n, scale: e } = t, i = n ? G(n) : void 0, r = new P(o ?? void 0, i, e ?? void 0);
147
147
  return a.fromTranslationRotationScale(r);
148
148
  }
149
149
  function xt(t, o, n) {
150
150
  const e = l.subtract(o, t, new l()), i = l.subtract(n, t, new l()), r = l.cross(e, i, e);
151
151
  return l.normalize(r, e);
152
152
  }
153
- function Xt(t, o, n) {
153
+ function Zt(t, o, n) {
154
154
  const e = xt(t, o, n);
155
155
  return rt.fromPointNormal(e, t);
156
156
  }
157
- function* Zt(t, o = !0, n, e) {
157
+ function* Kt(t, o = !0, n, e) {
158
158
  const i = t.length, r = o ? i : i - 1, s = n || e ? l.prototype.equalsEpsilon : l.prototype.equals;
159
159
  for (let c = 0; c < r; c++) {
160
- const u = t[c];
161
- let f = (c + 1) % i, m = t[f], p = c;
162
- for (; s.call(u, m, n, e); ) {
163
- if (f = (++p + 1) % i, f === c)
160
+ const f = t[c];
161
+ let u = (c + 1) % i, m = t[u], p = c;
162
+ for (; s.call(f, m, n, e); ) {
163
+ if (u = (++p + 1) % i, u === c)
164
164
  return;
165
- m = t[f];
165
+ m = t[u];
166
166
  }
167
- c = p, yield [u, m];
167
+ c = p, yield [f, m];
168
168
  }
169
169
  }
170
170
  function H(t, o, n) {
@@ -172,25 +172,25 @@ function H(t, o, n) {
172
172
  const e = a.inverse(o, new a()), i = a.multiply(t, e, e);
173
173
  return a.multiply(o, i, n);
174
174
  }
175
- function Kt(t, o, n, e) {
175
+ function $t(t, o, n, e) {
176
176
  e = e ?? new a();
177
177
  const i = a.inverse(n, new a());
178
178
  let r = a.multiply(i, t, i);
179
179
  return r = a.multiply(o, r, r), a.multiply(n, r, e);
180
180
  }
181
- function $t(t, o, n) {
181
+ function tn(t, o, n) {
182
182
  const e = a.fromTranslation(t);
183
183
  return H(e, o, n);
184
184
  }
185
- function tn(t, o, n, e) {
185
+ function nn(t, o, n, e) {
186
186
  const i = w.fromAxisAngle(t, o), r = g.fromQuaternion(i), s = a.fromRotation(r);
187
187
  return H(s, n, e);
188
188
  }
189
- function nn(t, o, n) {
189
+ function on(t, o, n) {
190
190
  const e = a.fromScale(t);
191
191
  return H(e, o, n);
192
192
  }
193
- function on(t, o, n) {
193
+ function en(t, o, n) {
194
194
  const e = g.fromScale(o);
195
195
  if (n)
196
196
  for (const i of t)
@@ -202,29 +202,29 @@ function on(t, o, n) {
202
202
  }
203
203
  return t;
204
204
  }
205
- function en(t, o) {
205
+ function rn(t, o) {
206
206
  const { translation: n, rotation: e, scale: i } = t;
207
207
  let r;
208
208
  if (e) {
209
- const { axis: c, angle: u } = e;
210
- r = w.fromAxisAngle(c, u);
209
+ const { axis: c, angle: f } = e;
210
+ r = w.fromAxisAngle(c, f);
211
211
  }
212
- const s = new M(n ?? void 0, r, i ?? void 0);
212
+ const s = new P(n ?? void 0, r, i ?? void 0);
213
213
  return a.fromTranslationRotationScale(s, o ?? void 0);
214
214
  }
215
215
  function nt(t, o, n) {
216
- n ??= new M();
217
- const e = a.pack(t, []), i = [], r = [], s = [], c = o ? _[o] : _.trs;
216
+ n ??= new P();
217
+ const e = a.pack(t, []), i = [], r = [], s = [], c = o ? F[o] : F.trs;
218
218
  return at(i, s, r, e, c), l.unpack(i, 0, n.translation), l.unpack(r, 0, n.scale), w.unpack(s, 0, n.rotation), n;
219
219
  }
220
- function rn(t, o) {
220
+ function an(t, o) {
221
221
  return nt(t, null, o);
222
222
  }
223
223
  function Tt(t, o, n) {
224
- const e = l.pack(t.translation, []), i = l.pack(t.scale, []), r = w.pack(t.rotation, []), s = o ? _[o] : _.trs, c = st([], e, r, i, s);
224
+ const e = l.pack(t.translation, []), i = l.pack(t.scale, []), r = w.pack(t.rotation, []), s = o ? F[o] : F.trs, c = st([], e, r, i, s);
225
225
  return a.unpack(c, 0, n);
226
226
  }
227
- const an = a.fromTranslationRotationScale;
227
+ const sn = a.fromTranslationRotationScale;
228
228
  function vt(t, o) {
229
229
  const n = a.inverse(t, new a()), e = new a();
230
230
  function i(s, c) {
@@ -235,7 +235,7 @@ function vt(t, o) {
235
235
  }
236
236
  return { compose: i, decompose: r, referInverse: n };
237
237
  }
238
- function sn(t, o, n) {
238
+ function At(t, o, n) {
239
239
  const e = E.eastNorthUpToFixedFrame(t, n ?? void 0);
240
240
  return { ...vt(e, o), refer: e };
241
241
  }
@@ -265,10 +265,10 @@ function ln(t, o) {
265
265
  }
266
266
  function un(t, o, n) {
267
267
  let { translation: e, rotation: i, scale: r } = L(o, n);
268
- const s = new M(e ?? void 0, i ?? void 0, r ?? void 0), c = a.fromTranslationRotationScale(s);
269
- return At(t, c);
268
+ const s = new P(e ?? void 0, i ?? void 0, r ?? void 0), c = a.fromTranslationRotationScale(s);
269
+ return Mt(t, c);
270
270
  }
271
- function At(t, o) {
271
+ function Mt(t, o) {
272
272
  const n = t.modelMatrix;
273
273
  if (n)
274
274
  return a.multiply(o, n, n), t.modelMatrix = n, !0;
@@ -292,7 +292,7 @@ function At(t, o) {
292
292
  return !1;
293
293
  }
294
294
  function fn(t, o, n) {
295
- const e = Mt(t), i = ht(o, { ...n, defaultMatrix: e });
295
+ const e = Rt(t), i = ht(o, { ...n, defaultMatrix: e });
296
296
  return Pt(t, i);
297
297
  }
298
298
  function Pt(t, o) {
@@ -316,11 +316,11 @@ function Pt(t, o) {
316
316
  }
317
317
  return !1;
318
318
  }
319
- function Mt(t) {
319
+ function Rt(t) {
320
320
  if (q(t))
321
321
  return t.modelMatrix;
322
322
  if (J(t)) {
323
- const n = t.position, e = t.scale ?? 1, i = new M(n, void 0, new l(e, e, e));
323
+ const n = t.position, e = t.scale ?? 1, i = new P(n, void 0, new l(e, e, e));
324
324
  return a.fromTranslationRotationScale(i);
325
325
  }
326
326
  const o = t.positions;
@@ -332,10 +332,10 @@ function Mt(t) {
332
332
  }
333
333
  function mn(t, o) {
334
334
  let { translation: n, rotation: e, scale: i } = L(o, o);
335
- const { reset: r, referFrame: s } = o, c = h.now(), u = !r;
335
+ const { reset: r, referFrame: s } = o, c = h.now(), f = !r;
336
336
  if (e) {
337
337
  let A = e;
338
- if (u) {
338
+ if (f) {
339
339
  const T = t.orientation?.getValue(c);
340
340
  T && (A = w.multiply(e, T, T));
341
341
  }
@@ -343,45 +343,45 @@ function mn(t, o) {
343
343
  }
344
344
  if (n) {
345
345
  let A = n;
346
- if (u) {
346
+ if (f) {
347
347
  const T = t.position?.getValue(c);
348
348
  T && (A = l.add(T, n, T));
349
349
  }
350
350
  t.position = A;
351
351
  }
352
352
  if (!s) return;
353
- const { translation: f, rotation: m, scale: p } = gt(o, o), d = new M(f ?? void 0, m ?? void 0, p ?? void 0);
353
+ const { translation: u, rotation: m, scale: p } = gt(o, o), d = new P(u ?? void 0, m ?? void 0, p ?? void 0);
354
354
  let y = a.fromTranslationRotationScale(d);
355
355
  if (y = H(y, s, y), p) {
356
356
  const A = t.box;
357
- A && Rt(A, p);
357
+ A && St(A, p);
358
358
  const T = t.cylinder;
359
- T && St(T, p);
359
+ T && Dt(T, p);
360
360
  const Y = t.ellipse;
361
- Y && Dt(Y, p);
361
+ Y && Vt(Y, p);
362
362
  const j = t.ellipsoid;
363
- j && Vt(j, p);
363
+ j && Bt(j, p);
364
364
  const W = t.model;
365
- W && Bt(W, p, r);
365
+ W && It(W, p, r);
366
366
  const X = t.plane;
367
- X && It(X, p);
367
+ X && Ot(X, p);
368
368
  }
369
369
  const R = t.corridor;
370
- R && Ot(R, y, p);
370
+ R && Ct(R, y, p);
371
371
  const V = t.polygon;
372
- V && Ct(V, y, p);
372
+ V && bt(V, y, p);
373
373
  const S = t.polyline;
374
- S && bt(S, y, p);
374
+ S && _t(S, y, p);
375
375
  const B = t.polylineVolume;
376
376
  B && Nt(B, y, p);
377
- const N = t.wall;
378
- N && Ft(N, y, p);
377
+ const _ = t.wall;
378
+ _ && Ft(_, y, p);
379
379
  }
380
- function Rt(t, o) {
380
+ function St(t, o) {
381
381
  const n = h.now(), e = t.dimensions?.getValue(n);
382
382
  e && (t.dimensions = l.multiplyComponents(e, o, e));
383
383
  }
384
- function St(t, o) {
384
+ function Dt(t, o) {
385
385
  const n = h.now(), e = t.length?.getValue(n);
386
386
  e != null && (t.length = e * o.z);
387
387
  const i = Math.max(o.x, o.y), r = t.topRadius?.getValue(n);
@@ -389,23 +389,23 @@ function St(t, o) {
389
389
  const s = o.z, c = t.bottomRadius?.getValue(n);
390
390
  c != null && (t.bottomRadius = c * s);
391
391
  }
392
- function Dt(t, o) {
392
+ function Vt(t, o) {
393
393
  const n = h.now(), e = Math.max(o.x, o.y), i = o.z, r = t.semiMajorAxis?.getValue(n);
394
394
  r != null && (t.semiMajorAxis = r * e);
395
395
  const s = t.semiMinorAxis?.getValue(n);
396
396
  s != null && (t.semiMinorAxis = s * e);
397
397
  const c = t.height?.getValue(n);
398
398
  c != null && (t.height = c * i);
399
- const u = t.extrudedHeight?.getValue(n);
400
- u != null && (t.extrudedHeight = u * i);
399
+ const f = t.extrudedHeight?.getValue(n);
400
+ f != null && (t.extrudedHeight = f * i);
401
401
  }
402
- function Vt(t, o) {
402
+ function Bt(t, o) {
403
403
  const n = h.now(), e = t.radii?.getValue(n);
404
404
  e != null && (t.radii = l.multiplyComponents(e, o, e));
405
405
  const i = t.innerRadii?.getValue(n);
406
406
  i != null && (t.innerRadii = l.multiplyComponents(i, o, i));
407
407
  }
408
- function Bt(t, o, n) {
408
+ function It(t, o, n) {
409
409
  let e = l.maximumComponent(o);
410
410
  if (!n) {
411
411
  const i = h.now(), r = t.scale?.getValue(i) ?? 1;
@@ -413,11 +413,11 @@ function Bt(t, o, n) {
413
413
  }
414
414
  t.scale = e;
415
415
  }
416
- function It(t, o) {
416
+ function Ot(t, o) {
417
417
  const n = h.now(), e = x.fromCartesian3(o), i = t.dimensions?.getValue(n);
418
418
  i && (t.dimensions = x.multiplyComponents(i, e, i));
419
419
  }
420
- function Ot(t, o, n) {
420
+ function Ct(t, o, n) {
421
421
  const e = h.now(), i = new l(), r = t.positions?.getValue(e);
422
422
  if (r?.length > 0) {
423
423
  for (const p of r)
@@ -426,16 +426,16 @@ function Ot(t, o, n) {
426
426
  }
427
427
  const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
428
428
  t.width?.getValue(e) != null && (t.width = c * scale);
429
- const f = t.height?.getValue(e), m = s.z;
430
- f != null && (t.height = f * m);
429
+ const u = t.height?.getValue(e), m = s.z;
430
+ u != null && (t.height = u * m);
431
431
  }
432
- function Ct(t, o, n) {
432
+ function bt(t, o, n) {
433
433
  const e = h.now(), i = new l(), r = t.hierarchy?.getValue(e);
434
434
  r && (ot(r, o), t.hierarchy = r);
435
- const c = (n ?? a.getScale(o, i)).z, u = t.height?.getValue(e);
436
- u != null && (t.height = u * c);
437
- const f = t.extrudedHeight?.getValue(e);
438
- f != null && (t.extrudedHeight = f * c);
435
+ const c = (n ?? a.getScale(o, i)).z, f = t.height?.getValue(e);
436
+ f != null && (t.height = f * c);
437
+ const u = t.extrudedHeight?.getValue(e);
438
+ u != null && (t.extrudedHeight = u * c);
439
439
  }
440
440
  function ot(t, o) {
441
441
  const { positions: n, holes: e } = t;
@@ -445,11 +445,11 @@ function ot(t, o) {
445
445
  for (const i of e)
446
446
  ot(i, o);
447
447
  }
448
- function bt(t, o, n) {
448
+ function _t(t, o, n) {
449
449
  const e = h.now(), i = new l(), r = t.positions?.getValue(e);
450
450
  if (r?.length > 0) {
451
- for (const f of r)
452
- a.multiplyByPoint(o, f, f);
451
+ for (const u of r)
452
+ a.multiplyByPoint(o, u, u);
453
453
  t.positions = r;
454
454
  }
455
455
  const s = n ?? a.getScale(o, i), c = Math.max(s.x, s.y);
@@ -458,15 +458,15 @@ function bt(t, o, n) {
458
458
  function Nt(t, o, n) {
459
459
  const e = h.now(), i = new l(), r = t.positions?.getValue(e);
460
460
  if (r?.length > 0) {
461
- for (const f of r)
462
- a.multiplyByPoint(o, f, f);
461
+ for (const u of r)
462
+ a.multiplyByPoint(o, u, u);
463
463
  t.positions = r;
464
464
  }
465
- const s = n ?? a.getScale(o, i), c = x.fromCartesian3(s), u = t.shape?.getValue(e);
466
- if (u != null) {
467
- for (const f of u)
468
- x.multiplyComponents(f, c, f);
469
- t.shape = u;
465
+ const s = n ?? a.getScale(o, i), c = x.fromCartesian3(s), f = t.shape?.getValue(e);
466
+ if (f != null) {
467
+ for (const u of f)
468
+ x.multiplyComponents(u, c, u);
469
+ t.shape = f;
470
470
  }
471
471
  }
472
472
  function Ft(t, o, n) {
@@ -476,21 +476,21 @@ function Ft(t, o, n) {
476
476
  a.multiplyByPoint(o, m, m);
477
477
  t.positions = r;
478
478
  }
479
- const c = (n ?? a.getScale(o, i)).z, u = t.minimumHeights?.getValue(e);
480
- u != null && (graphicsgraphics.minimumHeights = u.map((m) => m * c));
481
- const f = t.maximumHeights?.getValue(e);
482
- f != null && (graphicsgraphics.maximumHeights = f.map((m) => m * c));
479
+ const c = (n ?? a.getScale(o, i)).z, f = t.minimumHeights?.getValue(e);
480
+ f != null && (graphicsgraphics.minimumHeights = f.map((m) => m * c));
481
+ const u = t.maximumHeights?.getValue(e);
482
+ u != null && (graphicsgraphics.maximumHeights = u.map((m) => m * c));
483
483
  }
484
484
  function pn(t, o, n) {
485
485
  const e = h.now(), i = t.position?.getValue(e);
486
486
  if (!i) return null;
487
- const r = t.orientation?.getValue(e), s = t.model?.scale?.getValue(e) ?? 1, c = new l(s, s, s), u = o(i, n), f = a.inverse(u, new a()), m = a.multiplyByPoint(f, i, new l()), p = { translation: m, position: i, scale: c, rotation: new l() };
487
+ const r = t.orientation?.getValue(e), s = t.model?.scale?.getValue(e) ?? 1, c = new l(s, s, s), f = o(i, n), u = a.inverse(f, new a()), m = a.multiplyByPoint(u, i, new l()), p = { translation: m, position: i, scale: c, rotation: new l() };
488
488
  let d;
489
489
  if (r) {
490
- const V = g.fromQuaternion(r), S = a.fromRotation(V), B = a.multiply(f, S, S), N = tt(B);
491
- d = b.toCartesian3(N), p.rotation = d;
490
+ const V = g.fromQuaternion(r), S = a.fromRotation(V), B = a.multiply(u, S, S), _ = tt(B);
491
+ d = b.toCartesian3(_), p.rotation = d;
492
492
  }
493
- const y = new M(m ?? void 0, d ? G(d) : void 0, c ?? void 0);
493
+ const y = new P(m ?? void 0, d ? G(d) : void 0, c ?? void 0);
494
494
  let R = a.fromTranslationRotationScale(y);
495
495
  return p.matrix = R, p;
496
496
  }
@@ -510,9 +510,9 @@ function wn(t) {
510
510
  new x(), new l(), new O();
511
511
  const Q = [new x(), new x(), new x(), new x()], k = [new l(), new l(), new l(), new l()];
512
512
  new O(), new O(), new O(), new O();
513
- const _t = [new D(), new D(), new D(), new D()];
513
+ const zt = [new D(), new D(), new D(), new D()];
514
514
  new v(), new v(), new v(), new v();
515
- new F(), new F(), new F(), new F();
515
+ new N(), new N(), new N(), new N();
516
516
  new g(), new g(), new g(), new g();
517
517
  new a(), new a(), new a(), new a();
518
518
  new w(), new w(), new w(), new w();
@@ -526,17 +526,17 @@ function gn(t, o = []) {
526
526
  function hn(t, o, n) {
527
527
  return t.encoding.decodePosition(t.vertexArray, o, n);
528
528
  }
529
- function zt(t) {
530
- const { stride: o, vertices: n, indices: e, encoding: i } = t, r = n.length / o, s = k[0], c = new Float32Array(r * 3), u = Q[0], f = new Float32Array(r * 2), m = new Float32Array(r);
529
+ function Gt(t) {
530
+ const { stride: o, vertices: n, indices: e, encoding: i } = t, r = n.length / o, s = k[0], c = new Float32Array(r * 3), f = Q[0], u = new Float32Array(r * 2), m = new Float32Array(r);
531
531
  for (let p = 0; p < r; p++) {
532
532
  i.decodePosition(n, p, s), l.pack(s, c, p * 3);
533
533
  const d = i.decodeHeight(n, p);
534
- m[p] = d, i.decodeTextureCoordinates(n, p, u), x.pack(u, f, p * 2);
534
+ m[p] = d, i.decodeTextureCoordinates(n, p, f), x.pack(f, u, p * 2);
535
535
  }
536
536
  return {
537
537
  attributes: {
538
538
  position: { array: c, vectorSize: 3 },
539
- uv: { array: f, vectorSize: 2 },
539
+ uv: { array: u, vectorSize: 2 },
540
540
  height: { array: m, vectorSize: 1 }
541
541
  },
542
542
  indices: e.slice(),
@@ -553,9 +553,9 @@ function et(t, o) {
553
553
  }
554
554
  function xn(t) {
555
555
  const o = t._surface._tilesToRender;
556
- return Gt(o);
556
+ return Ht(o);
557
557
  }
558
- function Gt(t) {
558
+ function Ht(t) {
559
559
  const o = /* @__PURE__ */ new Set();
560
560
  for (const r of t)
561
561
  o.add(r.level);
@@ -564,25 +564,25 @@ function Gt(t) {
564
564
  }
565
565
  function it(t) {
566
566
  return t.map((o) => {
567
- const { mesh: n, terrainData: e } = o.data, i = zt(n), { x: r, y: s, level: c } = o, u = [e._minimumHeight, e._maximumHeight];
568
- return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange: u, x: r, y: s, level: c };
567
+ const { mesh: n, terrainData: e } = o.data, i = Gt(n), { x: r, y: s, level: c } = o, f = [e._minimumHeight, e._maximumHeight];
568
+ return { data: i, encoding: n.encoding, rectangle: o.rectangle, heightRange: f, x: r, y: s, level: c };
569
569
  });
570
570
  }
571
571
  function Tn(t) {
572
572
  const { x: o, y: n, level: e } = t;
573
573
  return t.data.terrainData.upsample(t.tilingScheme, o, n, e, o, n, e);
574
574
  }
575
- function Ht(t, o, n) {
576
- const { east: e, north: i, south: r, west: s } = o, c = _t[0];
575
+ function kt(t, o, n) {
576
+ const { east: e, north: i, south: r, west: s } = o, c = zt[0];
577
577
  c.longitude = s, c.latitude = r;
578
- const u = t.positionToTileXY(c, n, Q[0]);
578
+ const f = t.positionToTileXY(c, n, Q[0]);
579
579
  c.longitude = e, c.latitude = i;
580
- const f = t.positionToTileXY(c, n, Q[1]), [m, p] = u.x < f.x ? [u.x, f.x] : [f.x, u.x], [d, y] = u.y < f.y ? [u.y, f.y] : [f.y, u.y];
580
+ const u = t.positionToTileXY(c, n, Q[1]), [m, p] = f.x < u.x ? [f.x, u.x] : [u.x, f.x], [d, y] = f.y < u.y ? [f.y, u.y] : [u.y, f.y];
581
581
  return { min: [m, d], max: [p, y] };
582
582
  }
583
- const kt = 32767;
583
+ const Qt = 32767;
584
584
  function vn(t, o = new l()) {
585
- return g.getScale(t.halfAxes, o), l.multiplyByScalar(o, 2 * kt, o), o;
585
+ return g.getScale(t.halfAxes, o), l.multiplyByScalar(o, 2 * Qt, o), o;
586
586
  }
587
587
  function U(t, o, n) {
588
588
  return n = t.getLocalCurvature(o, n), n.x = 1 / n.x, n.y = 1 / n.y, n;
@@ -592,7 +592,7 @@ function An(t, o, n) {
592
592
  const e = Math.PI / 180;
593
593
  return x.multiplyByScalar(n, e, n);
594
594
  }
595
- function Qt(t) {
595
+ function Et(t) {
596
596
  const { _quantizedVertices: o, _indices: n } = t, e = o.length / 3, i = {
597
597
  type: "Float32Array",
598
598
  start: 0,
@@ -613,32 +613,32 @@ function Qt(t) {
613
613
  indices: n
614
614
  };
615
615
  }
616
- async function Pn(t, o, n, e) {
616
+ async function Mn(t, o, n, e) {
617
617
  const i = await t.requestTileGeometry(o, n, e);
618
618
  if (!i) return null;
619
- const r = Qt(i), s = [data._minimumHeight, data._maximumHeight], c = t.tilingScheme.tileXYToRectangle(o, n, e), u = ct(c, s), f = a.fromArray(u, void 0), m = ["u", "v", "height"], p = new lt({ ...r, positionNames: m }), d = new l();
620
- return p.mapForAggregate(m, (y, R) => (l.fromArray(y, 0, d), a.multiplyByPoint(f, d, d), new D(d.x, d.y, d.z)));
621
- }
622
- async function Mn(t, o, n) {
623
- const { min: e, max: i } = Ht(t.tilingScheme, o, n), r = [], s = [];
624
- for (let u = e[0]; u <= i[0]; u++)
625
- for (let f = e[1]; f <= i[1]; f++) {
626
- const m = Et(t, u, f, n);
627
- m && (r.push(m), s.push({ x: u, y: f }));
619
+ const r = Et(i), s = [data._minimumHeight, data._maximumHeight], c = t.tilingScheme.tileXYToRectangle(o, n, e), f = ct(c, s), u = a.fromArray(f, void 0), m = ["u", "v", "height"], p = new lt({ ...r, positionNames: m }), d = new l();
620
+ return p.mapForAggregate(m, (y, R) => (l.fromArray(y, 0, d), a.multiplyByPoint(u, d, d), new D(d.x, d.y, d.z)));
621
+ }
622
+ async function Pn(t, o, n) {
623
+ const { min: e, max: i } = kt(t.tilingScheme, o, n), r = [], s = [];
624
+ for (let f = e[0]; f <= i[0]; f++)
625
+ for (let u = e[1]; u <= i[1]; u++) {
626
+ const m = qt(t, f, u, n);
627
+ m && (r.push(m), s.push({ x: f, y: u }));
628
628
  }
629
- return (await Promise.all(r)).map(function(u, f) {
630
- const { x: m, y: p } = s[f];
631
- return { x: m, y: p, level: n, data: u };
629
+ return (await Promise.all(r)).map(function(f, u) {
630
+ const { x: m, y: p } = s[u];
631
+ return { x: m, y: p, level: n, data: f };
632
632
  });
633
633
  }
634
- async function Et(t, o, n, e) {
634
+ async function qt(t, o, n, e) {
635
635
  return t.getTileDataAvailable(o, n, e) ? (await t.loadTileDataAvailability(o, n, e), t.requestTileGeometry(o, n, e)) : Promise.reject("不可用");
636
636
  }
637
637
  async function Rn(t, o) {
638
- const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), u = E.eastNorthUpToFixedFrame(e);
639
- a.inverseTransformation(u, u);
640
- const f = o.map((d) => {
641
- const y = a.multiplyByPoint(u, d, k[2]);
638
+ const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), f = E.eastNorthUpToFixedFrame(e);
639
+ a.inverseTransformation(f, f);
640
+ const u = o.map((d) => {
641
+ const y = a.multiplyByPoint(f, d, k[2]);
642
642
  return [y.x, y.y];
643
643
  });
644
644
  let m = 0;
@@ -649,9 +649,9 @@ async function Rn(t, o) {
649
649
  ...y,
650
650
  ...R,
651
651
  positionNames: ["position"],
652
- region: f,
652
+ region: u,
653
653
  // @ts-ignore
654
- matrix: a.pack(u, []),
654
+ matrix: a.pack(f, []),
655
655
  relation: z.Contain | z.Intersect,
656
656
  scale: r
657
657
  }],
@@ -666,10 +666,10 @@ async function Rn(t, o) {
666
666
  return m;
667
667
  }
668
668
  function Sn(t, o) {
669
- const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), u = E.eastNorthUpToFixedFrame(e);
670
- a.inverseTransformation(u, u);
671
- const f = o.map((p) => {
672
- const d = a.multiplyByPoint(u, p, k[2]);
669
+ const n = v.fromCartesianArray(o), e = D.toCartesian(v.center(n)), i = U(t.ellipsoid, e), r = [i.x, i.y, 1], s = et(t, n), c = it(s), f = E.eastNorthUpToFixedFrame(e);
670
+ a.inverseTransformation(f, f);
671
+ const u = o.map((p) => {
672
+ const d = a.multiplyByPoint(f, p, k[2]);
673
673
  return [d.x, d.y];
674
674
  });
675
675
  let m = 0;
@@ -679,9 +679,9 @@ function Sn(t, o) {
679
679
  ...d,
680
680
  ...y,
681
681
  positionNames: ["position"],
682
- region: f,
682
+ region: u,
683
683
  // @ts-ignore
684
- matrix: a.pack(u, []),
684
+ matrix: a.pack(f, []),
685
685
  relation: z.Contain | z.Intersect,
686
686
  scale: r
687
687
  });
@@ -693,12 +693,22 @@ function Sn(t, o) {
693
693
  }
694
694
  return m;
695
695
  }
696
+ function Dn(t, o, n) {
697
+ const e = a.inverse(t.root.transform, new a()), { compose: i, decompose: r, ...s } = At(t.boundingSphere.center, o, n);
698
+ function c(u, m) {
699
+ return m = i(u, m), a.multiply(m, e, m);
700
+ }
701
+ function f(u) {
702
+ return r(t.root.computedTransform, u);
703
+ }
704
+ return { ...s, right: e, compose: c, decompose: f };
705
+ }
696
706
  export {
697
707
  dt as CartesianAxis,
698
708
  yt as HeadingPitchRollComponent,
699
709
  b as Xyz_Hpr,
700
- Kt as applyMatrixReferFrame,
701
- At as applyTransformInPrimitive,
710
+ $t as applyMatrixReferFrame,
711
+ Mt as applyTransformInPrimitive,
702
712
  un as applyTransformInfoPrimitive,
703
713
  pt as componentDatatypeTypedArrayMap,
704
714
  yn as computeAttributeSizeInBytes,
@@ -706,69 +716,70 @@ export {
706
716
  Sn as computeTerrainAreaOfPolygon,
707
717
  Rn as computeTerrainAreaOfPolygon_worker,
708
718
  dn as computeVertexNumOfAttribute,
709
- Xt as createPlaneOfCoplanars,
719
+ Zt as createPlaneOfCoplanars,
710
720
  $ as flatTransformInfoOptions,
711
721
  wn as getAttributeData,
712
722
  cn as getBoundingSphere,
713
723
  gn as getDecodePositionsOfTerrainMesh,
714
724
  pn as getEntityInfo,
715
- Qt as getGeometryDataOfQuantizedMeshTerrainData,
716
- zt as getGeometryDataOfTerrainMesh,
717
- Gt as getLevelRangeOfQuadtreeTiles,
725
+ Et as getGeometryDataOfQuantizedMeshTerrainData,
726
+ Gt as getGeometryDataOfTerrainMesh,
727
+ Ht as getLevelRangeOfQuadtreeTiles,
718
728
  U as getLocalCurvatureRadius,
719
729
  An as getLocalSizePerDegrees,
720
730
  gt as getLocalTransformInfo,
721
- en as getMatrix4OfTransformInfo,
722
- Zt as getNeighborPairs,
731
+ rn as getMatrix4OfTransformInfo,
732
+ Kt as getNeighborPairs,
723
733
  ln as getPosition,
724
734
  hn as getPositionOfTerrainMesh,
725
735
  et as getRenderedQuadtreeTilesOfIntersectRectangle,
726
736
  xn as getRenderedTileLevelRange,
727
737
  vn as getScaleOfTerrainDataByOrientedBoundingBox,
728
- Et as getTerrainData,
738
+ qt as getTerrainData,
729
739
  Tn as getTerrainDataOfQuadtreeTile,
730
- Mn as getTerrainDatasOfIntersectRectangle,
740
+ Pn as getTerrainDatasOfIntersectRectangle,
731
741
  it as getTerrainDatasOfQuadtreeTiles,
732
- Ht as getTileRangeOfIntersectRectangle,
733
- Mt as getTransform,
734
- Pn as getWorldDataOfQuantizedMeshTerrainData,
742
+ kt as getTileRangeOfIntersectRectangle,
743
+ Rt as getTransform,
744
+ Mn as getWorldDataOfQuantizedMeshTerrainData,
735
745
  ht as getWorldMatrix,
736
746
  L as getWorldTransformInfo,
737
747
  q as isMatrixPrimitive,
738
748
  mt as isPositionListPrimitive,
739
749
  J as isPositionPrimitive,
740
- Lt as isPrimitiveObject,
750
+ Ut as isPrimitiveObject,
741
751
  wt as localQuaternionToWorld,
742
752
  vt as localTRS_WorldMatrix4_Convert,
743
- sn as localTRS_WorldMatrix4_ENU_Convert,
753
+ At as localTRS_WorldMatrix4_ENU_Convert,
744
754
  H as makeMatrixReferFrame,
745
- an as mat4_compose,
755
+ sn as mat4_compose,
746
756
  Tt as mat4_composeByOrder,
747
- rn as mat4_decompose,
757
+ an as mat4_decompose,
748
758
  nt as mat4_decomposeByOrder,
749
759
  tt as matrix4ToHeadingPitchRoll,
750
- Ut as quaternionToHeadingPitchRoll,
760
+ Yt as quaternionToHeadingPitchRoll,
751
761
  Pt as resetTransformInPrimitive,
752
762
  fn as resetTransformInfoPrimitive,
753
- tn as rotateMatrixReferFrame,
763
+ nn as rotateMatrixReferFrame,
754
764
  G as rotationInfoToQuaternion,
755
- Rt as scaleBoxGraphics,
756
- St as scaleCylinderGraphics,
757
- Dt as scaleEllipseGraphics,
758
- Vt as scaleEllipsoidGraphics,
759
- nn as scaleMatrixReferFrame,
760
- Bt as scaleModelGraphics,
761
- It as scalePlaneGraphics,
762
- on as scalePoints,
763
- Ot as transformCorridorGraphics,
765
+ St as scaleBoxGraphics,
766
+ Dt as scaleCylinderGraphics,
767
+ Vt as scaleEllipseGraphics,
768
+ Bt as scaleEllipsoidGraphics,
769
+ on as scaleMatrixReferFrame,
770
+ It as scaleModelGraphics,
771
+ Ot as scalePlaneGraphics,
772
+ en as scalePoints,
773
+ Dn as tileset_enuTRS_modelMatrix_Convert,
774
+ Ct as transformCorridorGraphics,
764
775
  mn as transformEntity,
765
- Wt as transformInfoToMatrix,
766
- Ct as transformPolygonGraphics,
776
+ Xt as transformInfoToMatrix,
777
+ bt as transformPolygonGraphics,
767
778
  ot as transformPolygonHierarchy,
768
- bt as transformPolylineGraphics,
779
+ _t as transformPolylineGraphics,
769
780
  Nt as transformPolylineVolumeGraphics,
770
781
  Ft as transformWallGraphics,
771
- $t as translationMatrixReferFrame,
772
- Yt as worldMatrixToLocal,
773
- jt as worldQuaternionToLocal
782
+ tn as translationMatrixReferFrame,
783
+ jt as worldMatrixToLocal,
784
+ Wt as worldQuaternionToLocal
774
785
  };