@mlightcad/geometry-engine 1.0.5 → 1.0.6

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.
@@ -336,7 +336,7 @@ function us(u, t = 1e-7) {
336
336
  const s = qt(u);
337
337
  return Math.max(Math.pow(10, s) * t, t);
338
338
  }
339
- const S = {
339
+ const C = {
340
340
  DEG2RAD: Rt,
341
341
  RAD2DEG: Tt,
342
342
  generateUUID: Qt,
@@ -851,8 +851,8 @@ const S = {
851
851
  }
852
852
  relativeEps(t = 1e-7) {
853
853
  return Math.min(
854
- S.relativeEps(this.x, t),
855
- S.relativeEps(this.y, t)
854
+ C.relativeEps(this.x, t),
855
+ C.relativeEps(this.y, t)
856
856
  );
857
857
  }
858
858
  *[Symbol.iterator]() {
@@ -954,8 +954,8 @@ const H = class H {
954
954
  * @returns Return this matrix
955
955
  */
956
956
  multiplyMatrices(t, s) {
957
- const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[3], a = e[6], o = e[1], c = e[4], l = e[7], m = e[2], d = e[5], x = e[8], g = n[0], p = n[3], _ = n[6], f = n[1], w = n[4], A = n[7], M = n[2], C = n[5], z = n[8];
958
- return i[0] = r * g + h * f + a * M, i[3] = r * p + h * w + a * C, i[6] = r * _ + h * A + a * z, i[1] = o * g + c * f + l * M, i[4] = o * p + c * w + l * C, i[7] = o * _ + c * A + l * z, i[2] = m * g + d * f + x * M, i[5] = m * p + d * w + x * C, i[8] = m * _ + d * A + x * z, this;
957
+ const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[3], a = e[6], o = e[1], c = e[4], l = e[7], m = e[2], d = e[5], x = e[8], g = n[0], p = n[3], _ = n[6], w = n[1], f = n[4], A = n[7], M = n[2], B = n[5], z = n[8];
958
+ return i[0] = r * g + h * w + a * M, i[3] = r * p + h * f + a * B, i[6] = r * _ + h * A + a * z, i[1] = o * g + c * w + l * M, i[4] = o * p + c * f + l * B, i[7] = o * _ + c * A + l * z, i[2] = m * g + d * w + x * M, i[5] = m * p + d * f + x * B, i[8] = m * _ + d * A + x * z, this;
959
959
  }
960
960
  /**
961
961
  * Multiply every component of the matrix by the scalar value s.
@@ -1324,8 +1324,8 @@ function ps(u, t, s, e) {
1324
1324
  e
1325
1325
  );
1326
1326
  for (let g = 1; g <= a; g++) {
1327
- const p = i + g * o, _ = xt(p, u, t, s, e), f = _[0] - c[0], w = _[1] - c[1], A = _[2] - c[2];
1328
- h += Math.sqrt(f * f + w * w + A * A), c = _;
1327
+ const p = i + g * o, _ = xt(p, u, t, s, e), w = _[0] - c[0], f = _[1] - c[1], A = _[2] - c[2];
1328
+ h += Math.sqrt(w * w + f * f + A * A), c = _;
1329
1329
  }
1330
1330
  const l = xt(
1331
1331
  r,
@@ -1373,12 +1373,12 @@ class pt {
1373
1373
  }
1374
1374
  if (l !== g || a !== m || o !== d || c !== x) {
1375
1375
  let p = 1 - h;
1376
- const _ = a * m + o * d + c * x + l * g, f = _ >= 0 ? 1 : -1, w = 1 - _ * _;
1377
- if (w > Number.EPSILON) {
1378
- const M = Math.sqrt(w), C = Math.atan2(M, _ * f);
1379
- p = Math.sin(p * C) / M, h = Math.sin(h * C) / M;
1376
+ const _ = a * m + o * d + c * x + l * g, w = _ >= 0 ? 1 : -1, f = 1 - _ * _;
1377
+ if (f > Number.EPSILON) {
1378
+ const M = Math.sqrt(f), B = Math.atan2(M, _ * w);
1379
+ p = Math.sin(p * B) / M, h = Math.sin(h * B) / M;
1380
1380
  }
1381
- const A = h * f;
1381
+ const A = h * w;
1382
1382
  if (a = a * p + m * A, o = o * p + d * A, c = c * p + x * A, l = l * p + g * A, p === 1 - h) {
1383
1383
  const M = 1 / Math.sqrt(a * a + o * o + c * c + l * l);
1384
1384
  a *= M, o *= M, c *= M, l *= M;
@@ -2223,7 +2223,7 @@ const N = class N {
2223
2223
  * @returns Return this vector
2224
2224
  */
2225
2225
  projectOnPlane(t) {
2226
- return wt.copy(this).projectOnVector(t), this.sub(wt);
2226
+ return ft.copy(this).projectOnVector(t), this.sub(ft);
2227
2227
  }
2228
2228
  /**
2229
2229
  * Reflect this vector off of plane orthogonal to normal. Normal is assumed to have unit length.
@@ -2231,7 +2231,7 @@ const N = class N {
2231
2231
  * @returns Return this vector
2232
2232
  */
2233
2233
  reflect(t) {
2234
- return this.sub(wt.copy(t).multiplyScalar(2 * this.dot(t)));
2234
+ return this.sub(ft.copy(t).multiplyScalar(2 * this.dot(t)));
2235
2235
  }
2236
2236
  /**
2237
2237
  * Return the angle between this vector and vector v in radians.
@@ -2374,7 +2374,7 @@ const N = class N {
2374
2374
  };
2375
2375
  N.X_AXIS = Object.freeze(new N(1, 0, 0)), N.NEGATIVE_X_AXIS = Object.freeze(new N(-1, 0, 0)), N.Y_AXIS = Object.freeze(new N(0, 1, 0)), N.NEGATIVE_Y_AXIS = Object.freeze(new N(0, -1, 0)), N.Z_AXIS = Object.freeze(new N(0, 0, 1)), N.NEGATIVE_Z_AXIS = Object.freeze(new N(0, 0, -1));
2376
2376
  let y = N;
2377
- const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2377
+ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2378
2378
  /**
2379
2379
  * Create a 4x4 matrix with the given arguments in row-major order. If no arguments are provided,
2380
2380
  * the constructor initializes the Matrix4 to the 4x4 identity matrix.
@@ -2723,8 +2723,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2723
2723
  * @returns Return this matrix
2724
2724
  */
2725
2725
  multiplyMatrices(t, s) {
2726
- const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[4], a = e[8], o = e[12], c = e[1], l = e[5], m = e[9], d = e[13], x = e[2], g = e[6], p = e[10], _ = e[14], f = e[3], w = e[7], A = e[11], M = e[15], C = n[0], z = n[4], E = n[8], Z = n[12], G = n[1], F = n[5], K = n[9], et = n[13], nt = n[2], it = n[6], rt = n[10], ht = n[14], ot = n[3], at = n[7], ct = n[11], lt = n[15];
2727
- return i[0] = r * C + h * G + a * nt + o * ot, i[4] = r * z + h * F + a * it + o * at, i[8] = r * E + h * K + a * rt + o * ct, i[12] = r * Z + h * et + a * ht + o * lt, i[1] = c * C + l * G + m * nt + d * ot, i[5] = c * z + l * F + m * it + d * at, i[9] = c * E + l * K + m * rt + d * ct, i[13] = c * Z + l * et + m * ht + d * lt, i[2] = x * C + g * G + p * nt + _ * ot, i[6] = x * z + g * F + p * it + _ * at, i[10] = x * E + g * K + p * rt + _ * ct, i[14] = x * Z + g * et + p * ht + _ * lt, i[3] = f * C + w * G + A * nt + M * ot, i[7] = f * z + w * F + A * it + M * at, i[11] = f * E + w * K + A * rt + M * ct, i[15] = f * Z + w * et + A * ht + M * lt, this;
2726
+ const e = t.elements, n = s.elements, i = this.elements, r = e[0], h = e[4], a = e[8], o = e[12], c = e[1], l = e[5], m = e[9], d = e[13], x = e[2], g = e[6], p = e[10], _ = e[14], w = e[3], f = e[7], A = e[11], M = e[15], B = n[0], z = n[4], E = n[8], Z = n[12], G = n[1], F = n[5], K = n[9], et = n[13], nt = n[2], it = n[6], rt = n[10], ht = n[14], ot = n[3], at = n[7], ct = n[11], lt = n[15];
2727
+ return i[0] = r * B + h * G + a * nt + o * ot, i[4] = r * z + h * F + a * it + o * at, i[8] = r * E + h * K + a * rt + o * ct, i[12] = r * Z + h * et + a * ht + o * lt, i[1] = c * B + l * G + m * nt + d * ot, i[5] = c * z + l * F + m * it + d * at, i[9] = c * E + l * K + m * rt + d * ct, i[13] = c * Z + l * et + m * ht + d * lt, i[2] = x * B + g * G + p * nt + _ * ot, i[6] = x * z + g * F + p * it + _ * at, i[10] = x * E + g * K + p * rt + _ * ct, i[14] = x * Z + g * et + p * ht + _ * lt, i[3] = w * B + f * G + A * nt + M * ot, i[7] = w * z + f * F + A * it + M * at, i[11] = w * E + f * K + A * rt + M * ct, i[15] = w * Z + f * et + A * ht + M * lt, this;
2728
2728
  }
2729
2729
  /**
2730
2730
  * Multiply every component of the matrix by a scalar value s.
@@ -2769,11 +2769,11 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2769
2769
  * @returns Return this matrix
2770
2770
  */
2771
2771
  invert() {
2772
- const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], h = t[5], a = t[6], o = t[7], c = t[8], l = t[9], m = t[10], d = t[11], x = t[12], g = t[13], p = t[14], _ = t[15], f = l * p * o - g * m * o + g * a * d - h * p * d - l * a * _ + h * m * _, w = x * m * o - c * p * o - x * a * d + r * p * d + c * a * _ - r * m * _, A = c * g * o - x * l * o + x * h * d - r * g * d - c * h * _ + r * l * _, M = x * l * a - c * g * a - x * h * m + r * g * m + c * h * p - r * l * p, C = s * f + e * w + n * A + i * M;
2773
- if (C === 0)
2772
+ const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], h = t[5], a = t[6], o = t[7], c = t[8], l = t[9], m = t[10], d = t[11], x = t[12], g = t[13], p = t[14], _ = t[15], w = l * p * o - g * m * o + g * a * d - h * p * d - l * a * _ + h * m * _, f = x * m * o - c * p * o - x * a * d + r * p * d + c * a * _ - r * m * _, A = c * g * o - x * l * o + x * h * d - r * g * d - c * h * _ + r * l * _, M = x * l * a - c * g * a - x * h * m + r * g * m + c * h * p - r * l * p, B = s * w + e * f + n * A + i * M;
2773
+ if (B === 0)
2774
2774
  return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
2775
- const z = 1 / C;
2776
- return t[0] = f * z, t[1] = (g * m * i - l * p * i - g * n * d + e * p * d + l * n * _ - e * m * _) * z, t[2] = (h * p * i - g * a * i + g * n * o - e * p * o - h * n * _ + e * a * _) * z, t[3] = (l * a * i - h * m * i - l * n * o + e * m * o + h * n * d - e * a * d) * z, t[4] = w * z, t[5] = (c * p * i - x * m * i + x * n * d - s * p * d - c * n * _ + s * m * _) * z, t[6] = (x * a * i - r * p * i - x * n * o + s * p * o + r * n * _ - s * a * _) * z, t[7] = (r * m * i - c * a * i + c * n * o - s * m * o - r * n * d + s * a * d) * z, t[8] = A * z, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * _ - s * l * _) * z, t[10] = (r * g * i - x * h * i + x * e * o - s * g * o - r * e * _ + s * h * _) * z, t[11] = (c * h * i - r * l * i - c * e * o + s * l * o + r * e * d - s * h * d) * z, t[12] = M * z, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * p + s * l * p) * z, t[14] = (x * h * n - r * g * n - x * e * a + s * g * a + r * e * p - s * h * p) * z, t[15] = (r * l * n - c * h * n + c * e * a - s * l * a - r * e * m + s * h * m) * z, this;
2775
+ const z = 1 / B;
2776
+ return t[0] = w * z, t[1] = (g * m * i - l * p * i - g * n * d + e * p * d + l * n * _ - e * m * _) * z, t[2] = (h * p * i - g * a * i + g * n * o - e * p * o - h * n * _ + e * a * _) * z, t[3] = (l * a * i - h * m * i - l * n * o + e * m * o + h * n * d - e * a * d) * z, t[4] = f * z, t[5] = (c * p * i - x * m * i + x * n * d - s * p * d - c * n * _ + s * m * _) * z, t[6] = (x * a * i - r * p * i - x * n * o + s * p * o + r * n * _ - s * a * _) * z, t[7] = (r * m * i - c * a * i + c * n * o - s * m * o - r * n * d + s * a * d) * z, t[8] = A * z, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * _ - s * l * _) * z, t[10] = (r * g * i - x * h * i + x * e * o - s * g * o - r * e * _ + s * h * _) * z, t[11] = (c * h * i - r * l * i - c * e * o + s * l * o + r * e * d - s * h * d) * z, t[12] = M * z, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * p + s * l * p) * z, t[14] = (x * h * n - r * g * n - x * e * a + s * g * a + r * e * p - s * h * p) * z, t[15] = (r * l * n - c * h * n + c * e * a - s * l * a - r * e * m + s * h * m) * z, this;
2777
2777
  }
2778
2778
  /**
2779
2779
  * Multiply the columns of this matrix by vector v.
@@ -2887,8 +2887,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2887
2887
  * @returns Return this matrix
2888
2888
  */
2889
2889
  compose(t, s, e) {
2890
- const n = this.elements, i = s.x, r = s.y, h = s.z, a = s.w, o = i + i, c = r + r, l = h + h, m = i * o, d = i * c, x = i * l, g = r * c, p = r * l, _ = h * l, f = a * o, w = a * c, A = a * l, M = e.x, C = e.y, z = e.z;
2891
- return n[0] = (1 - (g + _)) * M, n[1] = (d + A) * M, n[2] = (x - w) * M, n[3] = 0, n[4] = (d - A) * C, n[5] = (1 - (m + _)) * C, n[6] = (p + f) * C, n[7] = 0, n[8] = (x + w) * z, n[9] = (p - f) * z, n[10] = (1 - (m + g)) * z, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
2890
+ const n = this.elements, i = s.x, r = s.y, h = s.z, a = s.w, o = i + i, c = r + r, l = h + h, m = i * o, d = i * c, x = i * l, g = r * c, p = r * l, _ = h * l, w = a * o, f = a * c, A = a * l, M = e.x, B = e.y, z = e.z;
2891
+ return n[0] = (1 - (g + _)) * M, n[1] = (d + A) * M, n[2] = (x - f) * M, n[3] = 0, n[4] = (d - A) * B, n[5] = (1 - (m + _)) * B, n[6] = (p + w) * B, n[7] = 0, n[8] = (x + f) * z, n[9] = (p - w) * z, n[10] = (1 - (m + g)) * z, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
2892
2892
  }
2893
2893
  /**
2894
2894
  * Decompose this matrix into its position, quaternion and scale components.
@@ -3065,7 +3065,7 @@ class Y {
3065
3065
  setFromArray(t) {
3066
3066
  this.makeEmpty();
3067
3067
  for (let s = 0, e = t.length; s < e; s += 3)
3068
- this.expandByPoint(ft.fromArray(t, s));
3068
+ this.expandByPoint(wt.fromArray(t, s));
3069
3069
  return this;
3070
3070
  }
3071
3071
  /**
@@ -3086,7 +3086,7 @@ class Y {
3086
3086
  * @returns Return this box
3087
3087
  */
3088
3088
  setFromCenterAndSize(t, s) {
3089
- const e = ft.copy(s).multiplyScalar(0.5);
3089
+ const e = wt.copy(s).multiplyScalar(0.5);
3090
3090
  return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
3091
3091
  }
3092
3092
  /**
@@ -3237,7 +3237,7 @@ class Y {
3237
3237
  * @returns Return the distance from any edge of this box to the specified point.
3238
3238
  */
3239
3239
  distanceToPoint(t) {
3240
- return this.clampPoint(t, ft).distanceTo(t);
3240
+ return this.clampPoint(t, wt).distanceTo(t);
3241
3241
  }
3242
3242
  /**
3243
3243
  * Compute the intersection of this and box, setting the upper bound of this box to the lesser of the
@@ -3293,7 +3293,7 @@ const U = [
3293
3293
  /* @__PURE__ */ new y(),
3294
3294
  /* @__PURE__ */ new y(),
3295
3295
  /* @__PURE__ */ new y()
3296
- ], ft = /* @__PURE__ */ new y(), Bt = /* @__PURE__ */ new P();
3296
+ ], wt = /* @__PURE__ */ new y(), Bt = /* @__PURE__ */ new P();
3297
3297
  class V {
3298
3298
  /**
3299
3299
  * Create a 2d box bounded by min and max.
@@ -3511,7 +3511,7 @@ class V {
3511
3511
  return t.min.equals(this.min) && t.max.equals(this.max);
3512
3512
  }
3513
3513
  }
3514
- const It = /* @__PURE__ */ new y(), ws = /* @__PURE__ */ new y(), fs = /* @__PURE__ */ new v();
3514
+ const It = /* @__PURE__ */ new y(), fs = /* @__PURE__ */ new y(), ws = /* @__PURE__ */ new v();
3515
3515
  class zt {
3516
3516
  /**
3517
3517
  * Create one plane
@@ -3560,7 +3560,7 @@ class zt {
3560
3560
  * @returns Return this plane
3561
3561
  */
3562
3562
  setFromCoplanarPoints(t, s, e) {
3563
- const n = It.subVectors(e, s).cross(ws.subVectors(t, s)).normalize();
3563
+ const n = It.subVectors(e, s).cross(fs.subVectors(t, s)).normalize();
3564
3564
  return this.setFromNormalAndCoplanarPoint(n, t), this;
3565
3565
  }
3566
3566
  /**
@@ -3662,7 +3662,7 @@ class zt {
3662
3662
  * @returns Return this plane
3663
3663
  */
3664
3664
  applyMatrix4(t, s) {
3665
- const e = s || fs.getNormalMatrix(t), n = this.coplanarPoint(It).applyMatrix3d(t), i = this.normal.applyMatrix3(e).normalize();
3665
+ const e = s || ws.getNormalMatrix(t), n = this.coplanarPoint(It).applyMatrix3d(t), i = this.normal.applyMatrix3(e).normalize();
3666
3666
  return this.constant = -n.dot(i), this;
3667
3667
  }
3668
3668
  /**
@@ -3703,7 +3703,7 @@ class b extends P {
3703
3703
  }), s;
3704
3704
  }
3705
3705
  }
3706
- class B extends y {
3706
+ class S extends y {
3707
3707
  /**
3708
3708
  * Convert one point array to one number array
3709
3709
  * @param array Input one point array
@@ -4008,7 +4008,7 @@ class Cs extends Yt {
4008
4008
  for (; m < i; m++) {
4009
4009
  const d = e[m], x = t[d];
4010
4010
  if (s[d].containsBox(l) && xs.isPointInPolygon(
4011
- c[S.randInt(0, c.length - 1)],
4011
+ c[C.randInt(0, c.length - 1)],
4012
4012
  x
4013
4013
  )) {
4014
4014
  (h = n.get(d)) == null || h.children.push(n.get(o));
@@ -4219,8 +4219,8 @@ class gt extends st {
4219
4219
  return { x: F, y: K };
4220
4220
  }, x = h.y - l * h.x, g = a.y - m * a.x, p = d(l, x, m, g), _ = Math.sqrt(
4221
4221
  Math.pow(t.x - p.x, 2) + Math.pow(t.y - p.y, 2)
4222
- ), f = (z, E) => Math.atan2(z.y - E.y, z.x - E.x), w = f(t, p), A = f(s, p), M = f(e, p), C = M > w && M < A || w > M && w < A || A > M && A < w;
4223
- this.center = p, this.radius = _, this.startAngle = w, this.endAngle = M, this.clockwise = !C;
4222
+ ), w = (z, E) => Math.atan2(z.y - E.y, z.x - E.x), f = w(t, p), A = w(s, p), M = w(e, p), B = M > f && M < A || f > M && f < A || A > M && A < f;
4223
+ this.center = p, this.radius = _, this.startAngle = f, this.endAngle = M, this.clockwise = !B;
4224
4224
  }
4225
4225
  /**
4226
4226
  * Create circular arc by two points and one bugle factor
@@ -4278,7 +4278,7 @@ class gt extends st {
4278
4278
  return this._startAngle;
4279
4279
  }
4280
4280
  set startAngle(t) {
4281
- this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4281
+ this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4282
4282
  }
4283
4283
  /**
4284
4284
  * End angle in radians of circular arc in the range 0 to 2 * PI.
@@ -4287,13 +4287,13 @@ class gt extends st {
4287
4287
  return this._endAngle;
4288
4288
  }
4289
4289
  set endAngle(t) {
4290
- this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4290
+ this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4291
4291
  }
4292
4292
  /**
4293
4293
  * Angle between endAngle and startAngle in range 0 to 2*PI
4294
4294
  */
4295
4295
  get deltaAngle() {
4296
- return this.clockwise ? S.normalizeAngle(this.startAngle - this.endAngle) : S.normalizeAngle(this.endAngle - this.startAngle);
4296
+ return this.clockwise ? C.normalizeAngle(this.startAngle - this.endAngle) : C.normalizeAngle(this.endAngle - this.startAngle);
4297
4297
  }
4298
4298
  /**
4299
4299
  * Rotation direction of the arc.
@@ -4320,7 +4320,7 @@ class gt extends st {
4320
4320
  * Middle point of circular arc
4321
4321
  */
4322
4322
  get midPoint() {
4323
- const t = S.normalizeAngle(
4323
+ const t = C.normalizeAngle(
4324
4324
  (this.startAngle + this.endAngle) / 2
4325
4325
  );
4326
4326
  return this.getPointAtAngle(t);
@@ -4337,7 +4337,7 @@ class gt extends st {
4337
4337
  calculateBoundingBox() {
4338
4338
  const t = [this.startPoint, this.endPoint], s = [0, Math.PI / 2, Math.PI, 3 * Math.PI / 2];
4339
4339
  for (const i of s)
4340
- S.isBetweenAngle(
4340
+ C.isBetweenAngle(
4341
4341
  i,
4342
4342
  this.startAngle,
4343
4343
  this.endAngle,
@@ -4428,7 +4428,7 @@ class _t extends Mt {
4428
4428
  * as the endpoint. Both points must be in WCS coordinates.
4429
4429
  */
4430
4430
  constructor(t, s) {
4431
- super(), this._start = new B(t), this._end = new B(s);
4431
+ super(), this._start = new S(t), this._end = new S(s);
4432
4432
  }
4433
4433
  /**
4434
4434
  * The line's startpoint in WCS coordinates
@@ -4458,7 +4458,7 @@ class _t extends Mt {
4458
4458
  * The middle point of this line.
4459
4459
  */
4460
4460
  get midPoint() {
4461
- return new B(
4461
+ return new S(
4462
4462
  (this._start.x + this._end.x) / 2,
4463
4463
  (this._start.y + this._end.y) / 2,
4464
4464
  (this._start.z + this._end.z) / 2
@@ -4498,10 +4498,10 @@ class _t extends Mt {
4498
4498
  atLength(t, s = !1) {
4499
4499
  if (s) {
4500
4500
  const e = this.delta(X).normalize();
4501
- return new B(this._start).addScaledVector(e, t);
4501
+ return new S(this._start).addScaledVector(e, t);
4502
4502
  } else {
4503
4503
  const e = this.delta(X).normalize();
4504
- return new B(this._end).addScaledVector(e, t);
4504
+ return new S(this._end).addScaledVector(e, t);
4505
4505
  }
4506
4506
  }
4507
4507
  /**
@@ -4514,13 +4514,13 @@ class _t extends Mt {
4514
4514
  extend(t, s = !1) {
4515
4515
  if (s) {
4516
4516
  const e = X.subVectors(this._start, this._end).normalize();
4517
- this._start = new B(this._start).addScaledVector(
4517
+ this._start = new S(this._start).addScaledVector(
4518
4518
  e,
4519
4519
  t
4520
4520
  );
4521
4521
  } else {
4522
4522
  const e = this.delta(X).normalize();
4523
- this._end = new B(this._end).addScaledVector(e, t);
4523
+ this._end = new S(this._end).addScaledVector(e, t);
4524
4524
  }
4525
4525
  return this._boundingBoxNeedsUpdate = !0, this;
4526
4526
  }
@@ -4535,7 +4535,7 @@ class _t extends Mt {
4535
4535
  Lt.subVectors(t, this._start), dt.subVectors(this.endPoint, this.startPoint);
4536
4536
  const e = dt.dot(dt);
4537
4537
  let i = dt.dot(Lt) / e;
4538
- return s && (i = S.clamp(i, 0, 1)), i;
4538
+ return s && (i = C.clamp(i, 0, 1)), i;
4539
4539
  }
4540
4540
  /**
4541
4541
  * Return the closets point on the line. If clampToLine is true, then the returned value will be
@@ -4578,7 +4578,7 @@ class _t extends Mt {
4578
4578
  */
4579
4579
  project(t) {
4580
4580
  const s = this.direction, n = X.subVectors(t, this.startPoint).dot(s);
4581
- return new B().copy(s).multiplyScalar(n).add(this.startPoint);
4581
+ return new S().copy(s).multiplyScalar(n).add(this.startPoint);
4582
4582
  }
4583
4583
  /**
4584
4584
  * Finds the point on the line that is perpendicular to the given point. When you need the shortest distance
@@ -4589,17 +4589,17 @@ class _t extends Mt {
4589
4589
  */
4590
4590
  perpPoint(t) {
4591
4591
  const s = this.direction, e = this.startPoint, i = X.subVectors(t, e).dot(s), r = X.copy(s).multiplyScalar(i);
4592
- return new B().addVectors(e, r);
4592
+ return new S().addVectors(e, r);
4593
4593
  }
4594
4594
  /**
4595
4595
  * @inheritdoc
4596
4596
  */
4597
4597
  calculateBoundingBox() {
4598
- const t = new B(
4598
+ const t = new S(
4599
4599
  Math.min(this._start.x, this._end.x),
4600
4600
  Math.min(this._start.y, this._end.y),
4601
4601
  Math.min(this._start.z, this._end.z)
4602
- ), s = new B(
4602
+ ), s = new S(
4603
4603
  Math.max(this._start.x, this._end.x),
4604
4604
  Math.max(this._start.y, this._end.y),
4605
4605
  Math.max(this._start.z, this._end.z)
@@ -4689,7 +4689,7 @@ class yt extends Mt {
4689
4689
  return this._center;
4690
4690
  }
4691
4691
  set center(t) {
4692
- this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4692
+ this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4693
4693
  }
4694
4694
  /**
4695
4695
  * Radius of circular arc
@@ -4708,7 +4708,7 @@ class yt extends Mt {
4708
4708
  return this._startAngle;
4709
4709
  }
4710
4710
  set startAngle(t) {
4711
- this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4711
+ this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4712
4712
  }
4713
4713
  /**
4714
4714
  * End angle in radians of circular arc in the range 0 to 2 * PI.
@@ -4717,13 +4717,13 @@ class yt extends Mt {
4717
4717
  return this._endAngle;
4718
4718
  }
4719
4719
  set endAngle(t) {
4720
- this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4720
+ this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4721
4721
  }
4722
4722
  /**
4723
4723
  * Return angle between endAngle and startAngle in range 0 to 2*PI
4724
4724
  */
4725
4725
  get deltaAngle() {
4726
- return S.normalizeAngle(this.endAngle - this.startAngle);
4726
+ return C.normalizeAngle(this.endAngle - this.startAngle);
4727
4727
  }
4728
4728
  /**
4729
4729
  * Return true if the arc is a large arc whose delta angle value is greater than PI.
@@ -4779,7 +4779,7 @@ class yt extends Mt {
4779
4779
  calculateBoundingBox() {
4780
4780
  const t = [this.startAngle, this.endAngle];
4781
4781
  for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
4782
- S.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
4782
+ C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
4783
4783
  let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, h = -1 / 0;
4784
4784
  for (const a of t) {
4785
4785
  const o = this.getPointAtAngle(a);
@@ -4859,7 +4859,7 @@ class yt extends Mt {
4859
4859
  y: s.z * e.x - s.x * e.z,
4860
4860
  z: s.x * e.y - s.y * e.x
4861
4861
  }, i = this.center, r = this.radius;
4862
- return new B(
4862
+ return new S(
4863
4863
  i.x + r * (e.x * Math.cos(t) + n.x * Math.sin(t)),
4864
4864
  i.y + r * (e.y * Math.cos(t) + n.y * Math.sin(t)),
4865
4865
  i.z + r * (e.z * Math.cos(t) + n.z * Math.sin(t))
@@ -4896,7 +4896,7 @@ class Zt extends st {
4896
4896
  return this._center;
4897
4897
  }
4898
4898
  set center(t) {
4899
- this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4899
+ this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4900
4900
  }
4901
4901
  /**
4902
4902
  * Major axis radius of the ellipse
@@ -4925,7 +4925,7 @@ class Zt extends st {
4925
4925
  return this._startAngle;
4926
4926
  }
4927
4927
  set startAngle(t) {
4928
- this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4928
+ this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4929
4929
  }
4930
4930
  /**
4931
4931
  * End angle of the ellipse arc in radians in the range -pi to pi.
@@ -4934,7 +4934,7 @@ class Zt extends st {
4934
4934
  return this._endAngle;
4935
4935
  }
4936
4936
  set endAngle(t) {
4937
- this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4937
+ this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
4938
4938
  }
4939
4939
  /**
4940
4940
  * The flag Whether the ellipse arc is drawn clockwise. Default is false.
@@ -4959,7 +4959,7 @@ class Zt extends st {
4959
4959
  * Return angle between endAngle and startAngle in range 0 to 2*PI
4960
4960
  */
4961
4961
  get deltaAngle() {
4962
- return S.normalizeAngle(this.endAngle - this.startAngle);
4962
+ return C.normalizeAngle(this.endAngle - this.startAngle);
4963
4963
  }
4964
4964
  /**
4965
4965
  * Return true if the arc is a large arc whose delta angle value is greater than PI.
@@ -5056,7 +5056,7 @@ class Gt extends Mt {
5056
5056
  return this._center;
5057
5057
  }
5058
5058
  set center(t) {
5059
- this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
5059
+ this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
5060
5060
  }
5061
5061
  /**
5062
5062
  * Major axis radius of the ellipse
@@ -5085,7 +5085,7 @@ class Gt extends Mt {
5085
5085
  return this._startAngle;
5086
5086
  }
5087
5087
  set startAngle(t) {
5088
- this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
5088
+ this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
5089
5089
  }
5090
5090
  /**
5091
5091
  * End angle of the ellipse arc in radians in the range -pi to pi.
@@ -5094,14 +5094,14 @@ class Gt extends Mt {
5094
5094
  return this._endAngle;
5095
5095
  }
5096
5096
  set endAngle(t) {
5097
- this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
5097
+ this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
5098
5098
  }
5099
5099
  /**
5100
5100
  * Return angle between endAngle and startAngle in range 0 to 2*PI
5101
5101
  */
5102
5102
  get deltaAngle() {
5103
5103
  const t = this.endAngle - this.startAngle;
5104
- return Math.abs(t - I) < 1e-10 ? I : S.normalizeAngle(t);
5104
+ return Math.abs(t - I) < 1e-10 ? I : C.normalizeAngle(t);
5105
5105
  }
5106
5106
  /**
5107
5107
  * Return true if the arc is a large arc whose delta angle value is greater than PI.
@@ -5175,7 +5175,7 @@ class Gt extends Mt {
5175
5175
  if (this.majorAxis.equals(y.X_AXIS) || this.majorAxis.equals(y.Y_AXIS) || this.majorAxis.isParallelTo(y.X_AXIS) || this.majorAxis.isParallelTo(y.Y_AXIS)) {
5176
5176
  const t = [this.startAngle, this.endAngle];
5177
5177
  for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
5178
- S.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
5178
+ C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
5179
5179
  let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, h = -1 / 0;
5180
5180
  for (const a of t) {
5181
5181
  const o = this.getPointAtAngle(a);
@@ -5220,7 +5220,7 @@ class Gt extends Mt {
5220
5220
  */
5221
5221
  getPointAtAngle(t) {
5222
5222
  const s = Math.cos(t), e = Math.sin(t), n = this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e), i = this.majorAxis.clone().multiplyScalar(s * this.majorAxisRadius).add(n);
5223
- return new B(
5223
+ return new S(
5224
5224
  this.center.x + i.x,
5225
5225
  this.center.y + i.y,
5226
5226
  this.center.z + i.z
@@ -5379,7 +5379,7 @@ class Bs extends st {
5379
5379
  getPoints3d(t, s) {
5380
5380
  const e = [];
5381
5381
  return this.getPoints(t).forEach(
5382
- (i) => e.push(new B().set(i.x, i.y, s))
5382
+ (i) => e.push(new S().set(i.x, i.y, s))
5383
5383
  ), e;
5384
5384
  }
5385
5385
  /**
@@ -5673,7 +5673,7 @@ class Es extends Mt {
5673
5673
  makeClosed() {
5674
5674
  const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.knots(), n = this._nurbsCurve.weights(), i = [...s], r = [...n];
5675
5675
  for (let a = 0; a < t; a++)
5676
- i.push([...s[0]]), r.push(n[0]);
5676
+ i.push([...s[a]]), r.push(n[a]);
5677
5677
  const h = this.createClosedKnotVector(e, t);
5678
5678
  this._nurbsCurve = D.byKnotsControlPointsWeights(
5679
5679
  t,
@@ -5700,9 +5700,9 @@ class Es extends Mt {
5700
5700
  * Create knot vector for closed curve
5701
5701
  */
5702
5702
  createClosedKnotVector(t, s) {
5703
- const e = [...t], n = t[t.length - 1], i = s;
5704
- for (let r = 1; r <= i; r++)
5705
- e.push(n + r);
5703
+ const e = [...t], n = t[t.length - 1], i = t[0], r = (n - i) / (t.length - 1), h = s;
5704
+ for (let a = 1; a <= h; a++)
5705
+ e.push(n + a * r);
5706
5706
  return e;
5707
5707
  }
5708
5708
  /**
@@ -5719,14 +5719,16 @@ class Es extends Mt {
5719
5719
  */
5720
5720
  get startPoint() {
5721
5721
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
5722
- return new B(n[0], n[1], n[2]);
5722
+ return new S(n[0], n[1], n[2]);
5723
5723
  }
5724
5724
  /**
5725
5725
  * The end point of this spline
5726
5726
  */
5727
5727
  get endPoint() {
5728
+ if (this._closed)
5729
+ return this.startPoint;
5728
5730
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
5729
- return new B(n[0], n[1], n[2]);
5731
+ return new S(n[0], n[1], n[2]);
5730
5732
  }
5731
5733
  /**
5732
5734
  * @inheritdoc
@@ -5765,10 +5767,21 @@ class Es extends Mt {
5765
5767
  * @returns Return an array of point
5766
5768
  */
5767
5769
  getPoints(t = 100) {
5768
- const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i], h = n[n.length - i - 1], a = (h - r) / (t - 1);
5769
- for (let o = 0; o < t; o++) {
5770
- const c = o === t - 1 ? h : r + o * a, l = s.point(c);
5771
- e.push(new B(l[0], l[1], l[2]));
5770
+ const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i], h = n[n.length - i - 1];
5771
+ if (this._closed) {
5772
+ const a = (h - r) / (t - 1);
5773
+ for (let o = 0; o < t; o++) {
5774
+ let c;
5775
+ o === t - 1 ? c = r : c = r + o * a;
5776
+ const l = s.point(c);
5777
+ e.push(new S(l[0], l[1], l[2]));
5778
+ }
5779
+ } else {
5780
+ const a = (h - r) / (t - 1);
5781
+ for (let o = 0; o < t; o++) {
5782
+ const c = o === t - 1 ? h : r + o * a, l = s.point(c);
5783
+ e.push(new S(l[0], l[1], l[2]));
5784
+ }
5772
5785
  }
5773
5786
  return e;
5774
5787
  }
@@ -5836,12 +5849,12 @@ export {
5836
5849
  Kt as AcGeLine2d,
5837
5850
  _t as AcGeLine3d,
5838
5851
  Is as AcGeLoop2d,
5839
- S as AcGeMathUtil,
5852
+ C as AcGeMathUtil,
5840
5853
  v as AcGeMatrix2d,
5841
5854
  tt as AcGeMatrix3d,
5842
5855
  zt as AcGePlane,
5843
5856
  b as AcGePoint2d,
5844
- B as AcGePoint3d,
5857
+ S as AcGePoint3d,
5845
5858
  Bs as AcGePolyline2d,
5846
5859
  pt as AcGeQuaternion,
5847
5860
  Yt as AcGeShape2d,
@@ -1 +1 @@
1
- (function(y,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],L):(y=typeof globalThis<"u"?globalThis:y||self,L(y["geometry-engine"]={},y.common))})(this,function(y,L){"use strict";const N=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Ft=1234567;const wt=Math.PI/180,Pt=180/Math.PI;function Gt(){const u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(N[u&255]+N[u>>8&255]+N[u>>16&255]+N[u>>24&255]+"-"+N[t&255]+N[t>>8&255]+"-"+N[t>>16&15|64]+N[t>>24&255]+"-"+N[s&63|128]+N[s>>8&255]+"-"+N[s>>16&255]+N[s>>24&255]+N[e&255]+N[e>>8&255]+N[e>>16&255]+N[e>>24&255]).toLowerCase()}function q(u,t,s){return Math.max(t,Math.min(s,u))}function bt(u,t){return(u%t+t)%t}function Xt(u,t,s,e,n){return e+(u-t)*(n-e)/(s-t)}function Dt(u,t,s){return u!==t?(s-u)/(t-u):0}function St(u,t,s){return(1-s)*u+s*t}function Yt(u,t,s,e){return St(u,t,1-Math.exp(-s*e))}function Zt(u,t=1){return t-Math.abs(bt(u,t*2)-t)}function Ot(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*(3-2*u))}function Kt(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*u*(u*(u*6-15)+10))}function Qt(u,t){return u+Math.floor(Math.random()*(t-u+1))}function Wt(u,t){return u+Math.random()*(t-u)}function Ht(u){return u*(.5-Math.random())}function $t(u){u!==void 0&&(Ft=u);let t=Ft+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Jt(u){return u*wt}function vt(u){return u*Pt}function ts(u){return(u&u-1)===0&&u!==0}function ss(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function es(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function v(u){const t=Math.PI*2;return(u%t+t)%t}function ns(u,t,s){return u>t&&u<s||u>s&&u<t}function is(u,t,s,e=!1){return u=v(u),t=v(t),s=v(s),e?t>s?u<=t&&u>=s:u<=t||u>=s:t<s?u>=t&&u<=s:u>=t||u<=s}function Ct(u){return u=Math.abs(u),u<1?0:Math.ceil(Math.log10(Math.abs(u)+1))}function rs(u,t=1e-7){const s=Ct(u);return Math.max(Math.pow(10,s)*t,t)}const C={DEG2RAD:wt,RAD2DEG:Pt,generateUUID:Gt,clamp:q,euclideanModulo:bt,mapLinear:Xt,inverseLerp:Dt,lerp:St,damp:Yt,pingpong:Zt,smoothstep:Ot,smootherstep:Kt,randInt:Qt,randFloat:Wt,randFloatSpread:Ht,seededRandom:$t,degToRad:Jt,radToDeg:vt,isPowerOfTwo:ts,ceilPowerOfTwo:ss,floorPowerOfTwo:es,normalizeAngle:v,isBetween:ns,isBetweenAngle:is,intPartLength:Ct,relativeEps:rs},ht=class ht{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw L.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new ht(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,r=this.y-t.y;return this.x=i*e-r*n+t.x,this.y=i*n+r*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(C.relativeEps(this.x,t),C.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};ht.EMPTY=Object.freeze(new ht(0,0));let b=ht;const ot=class ot{constructor(t,s,e,n,i,r,h,a,o){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&h!=null&&a!=null&&o!=null&&this.set(t,s,e,n,i,r,h,a,o)}set(t,s,e,n,i,r,h,a,o){const c=this.elements;return c[0]=t,c[1]=n,c[2]=h,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=r,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],h=e[3],a=e[6],o=e[1],c=e[4],l=e[7],m=e[2],d=e[5],x=e[8],_=n[0],M=n[3],A=n[6],P=n[1],w=n[4],f=n[7],p=n[2],I=n[5],z=n[8];return i[0]=r*_+h*P+a*p,i[3]=r*M+h*w+a*I,i[6]=r*A+h*f+a*z,i[1]=o*_+c*P+l*p,i[4]=o*M+c*w+l*I,i[7]=o*A+c*f+l*z,i[2]=m*_+d*P+x*p,i[5]=m*M+d*w+x*I,i[8]=m*A+d*f+x*z,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8];return s*r*c-s*h*o-e*i*c+e*h*a+n*i*o-n*r*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8],l=c*r-h*o,m=h*a-c*i,d=o*i-r*a,x=s*l+e*m+n*d;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/x;return t[0]=l*_,t[1]=(n*o-c*e)*_,t[2]=(h*e-n*r)*_,t[3]=m*_,t[4]=(c*s-n*a)*_,t[5]=(n*i-h*s)*_,t[6]=d*_,t[7]=(e*a-o*s)*_,t[8]=(r*s-e*i)*_,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,r,h){const a=Math.cos(i),o=Math.sin(i);return this.set(e*a,e*o,-e*(a*r+o*h)+r+t,-n*o,n*a,-n*(-o*r+a*h)+h+s,0,0,1),this}scale(t,s){return this.premultiply(Et.makeScale(t,s)),this}rotate(t){return this.premultiply(Et.makeRotation(-t)),this}translate(t,s){return this.premultiply(Et.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof b?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new ot().fromArray(this.elements)}};ot.IDENTITY=Object.freeze(new ot);let O=ot;const Et=new O,X=1e-6,B=2*Math.PI,ps={x:0,y:0},It={x:0,y:0,z:0};class hs{constructor(){this.equalPointTol=X,this.equalVectorTol=X}equalPoint2d(t,s){return new b(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new g(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=X){return t<s&&t>-s}static equal(t,s,e=X){return Math.abs(t-s)<e}static great(t,s,e=X){return t-s>e}static less(t,s,e=X){return t-s<e}}const Bt=new hs;function Nt(u,t,s=!1){const e=u.x,n=u.y;let i=!1;const r=t.length;for(let h=0,a=r-1;h<r;a=h++){const o=t[h].x,c=t[h].y,l=t[a].x,m=t[a].y;let d=c>n!=m>n;s&&(d=c>=n!=m>=n),d&&e<(l-o)*(n-c)/(m-c)+o&&(i=!i)}return i}function os(u,t){if(u.length===0||t.length===0)return!1;const s=new U().setFromPoints(u),e=new U().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<u.length;){if(Nt(u[n],t,!0))return!0;n<u.length-1&&Bt.equalPoint2d(u[n+1],u[n])&&++n,++n}return!1}const as={isPointInPolygon:Nt,isPolygonIntersect:os};function cs(u,t){const s=[],e=t-1,n=u;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function ls(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let h=1;h<=s;h++){const a=t[h][0]-t[h-1][0],o=t[h][1]-t[h-1][1],c=t[h][2]-t[h-1][2],l=Math.sqrt(a*a+o*o+c*c);i+=l,n.push(i)}const r=[];for(let h=0;h<=e;h++)r.push(0);for(let h=1;h<=s-e;h++){const a=n[h]/i;r.push(a*(s-e+1))}for(let h=0;h<=e;h++)r.push(s-e+1);return r}function us(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let h=1;h<=s;h++){const a=t[h][0]-t[h-1][0],o=t[h][1]-t[h-1][1],c=t[h][2]-t[h-1][2],l=Math.sqrt(a*a+o*o+c*c),m=Math.sqrt(l);i+=m,n.push(i)}const r=[];for(let h=0;h<=e;h++)r.push(0);for(let h=1;h<=s-e;h++){const a=n[h]/i;r.push(a*(s-e+1))}for(let h=0;h<=e;h++)r.push(s-e+1);return r}function lt(u,t,s,e){if(t===0)return s>=e[u]&&s<e[u+1]?1:0;const n=e[u+t]-e[u],i=e[u+t+1]-e[u+1],r=n>1e-10?(s-e[u])/n:0,h=i>1e-10?(e[u+t+1]-s)/i:0;return r*lt(u,t-1,s,e)+h*lt(u+1,t-1,s,e)}function tt(u,t,s,e,n){const i=e.length-1,r=t;if(u=Math.max(s[r],Math.min(s[i+1],u)),Math.abs(u-s[i+1])<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]];const h=[0,0,0];let a=0;for(let o=0;o<=i;o++){const c=lt(o,r,u,s),l=n[o]*c;h[0]+=e[o][0]*l,h[1]+=e[o][1]*l,h[2]+=e[o][2]*l,a+=l}if(a<1e-10){const o=s[s.length-r-1];if(Math.abs(u-o)<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]]}return a>1e-10&&(h[0]/=a,h[1]/=a,h[2]/=a),h}function ds(u,t,s,e){const n=u,i=t[n],r=t[t.length-n-1];let h=0;const a=1e3,o=(r-i)/a;let c=tt(i,u,t,s,e);for(let _=1;_<=a;_++){const M=i+_*o,A=tt(M,u,t,s,e),P=A[0]-c[0],w=A[1]-c[1],f=A[2]-c[2];h+=Math.sqrt(P*P+w*w+f*f),c=A}const l=tt(r,u,t,s,e),m=l[0]-c[0],d=l[1]-c[1],x=l[2]-c[2];return h+=Math.sqrt(m*m+d*d+x*x),h}function ms(u){return u.map(t=>[...t])}class st{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,r,h){let a=e[n+0],o=e[n+1],c=e[n+2],l=e[n+3];const m=i[r+0],d=i[r+1],x=i[r+2],_=i[r+3];if(h===0){t[s+0]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l;return}if(h===1){t[s+0]=m,t[s+1]=d,t[s+2]=x,t[s+3]=_;return}if(l!==_||a!==m||o!==d||c!==x){let M=1-h;const A=a*m+o*d+c*x+l*_,P=A>=0?1:-1,w=1-A*A;if(w>Number.EPSILON){const p=Math.sqrt(w),I=Math.atan2(p,A*P);M=Math.sin(M*I)/p,h=Math.sin(h*I)/p}const f=h*P;if(a=a*M+m*f,o=o*M+d*f,c=c*M+x*f,l=l*M+_*f,M===1-h){const p=1/Math.sqrt(a*a+o*o+c*c+l*l);a*=p,o*=p,c*=p,l*=p}}t[s]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,r){const h=e[n],a=e[n+1],o=e[n+2],c=e[n+3],l=i[r],m=i[r+1],d=i[r+2],x=i[r+3];return t[s]=h*x+c*l+a*d-o*m,t[s+1]=a*x+c*m+o*l-h*d,t[s+2]=o*x+c*d+h*m-a*l,t[s+3]=c*x-h*l-a*m-o*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new st(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,r=t.order,h=Math.cos,a=Math.sin,o=h(e/2),c=h(n/2),l=h(i/2),m=a(e/2),d=a(n/2),x=a(i/2);switch(r){case"XYZ":this._x=m*c*l+o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l-m*d*x;break;case"YXZ":this._x=m*c*l+o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l+m*d*x;break;case"ZXY":this._x=m*c*l-o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l-m*d*x;break;case"ZYX":this._x=m*c*l-o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l+m*d*x;break;case"YZX":this._x=m*c*l+o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l-m*d*x;break;case"XZY":this._x=m*c*l-o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l+m*d*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],r=s[1],h=s[5],a=s[9],o=s[2],c=s[6],l=s[10],m=e+h+l;if(m>0){const d=.5/Math.sqrt(m+1);this._w=.25/d,this._x=(c-a)*d,this._y=(i-o)*d,this._z=(r-n)*d}else if(e>h&&e>l){const d=2*Math.sqrt(1+e-h-l);this._w=(c-a)/d,this._x=.25*d,this._y=(n+r)/d,this._z=(i+o)/d}else if(h>l){const d=2*Math.sqrt(1+h-e-l);this._w=(i-o)/d,this._x=(n+r)/d,this._y=.25*d,this._z=(a+c)/d}else{const d=2*Math.sqrt(1+l-e-h);this._w=(r-n)/d,this._x=(i+o)/d,this._y=(a+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(q(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,r=t._w,h=s._x,a=s._y,o=s._z,c=s._w;return this._x=e*c+r*h+n*o-i*a,this._y=n*c+r*a+i*h-e*o,this._z=i*c+r*o+e*a-n*h,this._w=r*c-e*h-n*a-i*o,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,r=this._w;let h=r*t._w+e*t._x+n*t._y+i*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=r,this._x=e,this._y=n,this._z=i,this;const a=1-h*h;if(a<=Number.EPSILON){const d=1-s;return this._w=d*r+s*this._w,this._x=d*e+s*this._x,this._y=d*n+s*this._y,this._z=d*i+s*this._z,this.normalize(),this}const o=Math.sqrt(a),c=Math.atan2(o,h),l=Math.sin((1-s)*c)/o,m=Math.sin(s*c)/o;return this._w=r*l+this._w*m,this._x=e*l+this._x*m,this._y=n*l+this._y*m,this._z=i*l+this._z*m,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const T=class T{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:r,z:h}=t;this.x=i,this.y=r,this.z=h||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw L.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new T(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(xs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(xs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const s=this.x,e=this.y,n=this.z,i=t.elements,r=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*r,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*r,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*r,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,r=t.y,h=t.z,a=t.w,o=2*(r*n-h*e),c=2*(h*s-i*n),l=2*(i*e-r*s);return this.x=s+a*o+r*l-h*c,this.y=e+a*c+h*o-i*l,this.z=n+a*l+i*c-r*o,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,r=s.x,h=s.y,a=s.z;return this.x=n*a-i*h,this.y=i*r-e*a,this.z=e*h-n*r,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return kt.copy(this).projectOnVector(t),this.sub(kt)}reflect(t){return this.sub(kt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};T.X_AXIS=Object.freeze(new T(1,0,0)),T.NEGATIVE_X_AXIS=Object.freeze(new T(-1,0,0)),T.Y_AXIS=Object.freeze(new T(0,1,0)),T.NEGATIVE_Y_AXIS=Object.freeze(new T(0,-1,0)),T.Z_AXIS=Object.freeze(new T(0,0,1)),T.NEGATIVE_Z_AXIS=Object.freeze(new T(0,0,-1));let g=T;const kt=new g,xs=new st,at=class at{constructor(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,M){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&h!=null&&a!=null&&o!=null&&c!=null&&l!=null&&m!=null&&d!=null&&x!=null&&_!=null&&M!=null&&this.set(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,M)}set(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,M){const A=this.elements;return A[0]=t,A[4]=s,A[8]=e,A[12]=n,A[1]=i,A[5]=r,A[9]=h,A[13]=a,A[2]=o,A[6]=c,A[10]=l,A[14]=m,A[3]=d,A[7]=x,A[11]=_,A[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new at().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Bt.equalPoint3d(t,g.Z_AXIS))this.identity();else{const s=new g(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(g.Y_AXIS,t).normalize():s.crossVectors(g.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/Q.setFromMatrixColumn(t,0).length(),i=1/Q.setFromMatrixColumn(t,1).length(),r=1/Q.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*r,s[9]=e[9]*r,s[10]=e[10]*r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(fs,t,ws)}lookAt(t,s,e){const n=this.elements;return R.subVectors(t,s),R.lengthSq()===0&&(R.z=1),R.normalize(),F.crossVectors(e,R),F.lengthSq()===0&&(Math.abs(e.z)===1?R.x+=1e-4:R.z+=1e-4,R.normalize(),F.crossVectors(e,R)),F.normalize(),ut.crossVectors(R,F),n[0]=F.x,n[4]=ut.x,n[8]=R.x,n[1]=F.y,n[5]=ut.y,n[9]=R.y,n[2]=F.z,n[6]=ut.z,n[10]=R.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],h=e[4],a=e[8],o=e[12],c=e[1],l=e[5],m=e[9],d=e[13],x=e[2],_=e[6],M=e[10],A=e[14],P=e[3],w=e[7],f=e[11],p=e[15],I=n[0],z=n[4],k=n[8],H=n[12],$=n[1],Z=n[5],J=n[9],xt=n[13],yt=n[2],gt=n[6],_t=n[10],At=n[14],Mt=n[3],zt=n[7],pt=n[11],ft=n[15];return i[0]=r*I+h*$+a*yt+o*Mt,i[4]=r*z+h*Z+a*gt+o*zt,i[8]=r*k+h*J+a*_t+o*pt,i[12]=r*H+h*xt+a*At+o*ft,i[1]=c*I+l*$+m*yt+d*Mt,i[5]=c*z+l*Z+m*gt+d*zt,i[9]=c*k+l*J+m*_t+d*pt,i[13]=c*H+l*xt+m*At+d*ft,i[2]=x*I+_*$+M*yt+A*Mt,i[6]=x*z+_*Z+M*gt+A*zt,i[10]=x*k+_*J+M*_t+A*pt,i[14]=x*H+_*xt+M*At+A*ft,i[3]=P*I+w*$+f*yt+p*Mt,i[7]=P*z+w*Z+f*gt+p*zt,i[11]=P*k+w*J+f*_t+p*pt,i[15]=P*H+w*xt+f*At+p*ft,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],r=t[1],h=t[5],a=t[9],o=t[13],c=t[2],l=t[6],m=t[10],d=t[14],x=t[3],_=t[7],M=t[11],A=t[15];return x*(+i*a*l-n*o*l-i*h*m+e*o*m+n*h*d-e*a*d)+_*(+s*a*d-s*o*m+i*r*m-n*r*d+n*o*c-i*a*c)+M*(+s*o*l-s*h*d-i*r*l+e*r*d+i*h*c-e*o*c)+A*(-n*h*c-s*a*l+s*h*m+n*r*l-e*r*m+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof g?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8],l=t[9],m=t[10],d=t[11],x=t[12],_=t[13],M=t[14],A=t[15],P=l*M*o-_*m*o+_*a*d-h*M*d-l*a*A+h*m*A,w=x*m*o-c*M*o-x*a*d+r*M*d+c*a*A-r*m*A,f=c*_*o-x*l*o+x*h*d-r*_*d-c*h*A+r*l*A,p=x*l*a-c*_*a-x*h*m+r*_*m+c*h*M-r*l*M,I=s*P+e*w+n*f+i*p;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/I;return t[0]=P*z,t[1]=(_*m*i-l*M*i-_*n*d+e*M*d+l*n*A-e*m*A)*z,t[2]=(h*M*i-_*a*i+_*n*o-e*M*o-h*n*A+e*a*A)*z,t[3]=(l*a*i-h*m*i-l*n*o+e*m*o+h*n*d-e*a*d)*z,t[4]=w*z,t[5]=(c*M*i-x*m*i+x*n*d-s*M*d-c*n*A+s*m*A)*z,t[6]=(x*a*i-r*M*i-x*n*o+s*M*o+r*n*A-s*a*A)*z,t[7]=(r*m*i-c*a*i+c*n*o-s*m*o-r*n*d+s*a*d)*z,t[8]=f*z,t[9]=(x*l*i-c*_*i-x*e*d+s*_*d+c*e*A-s*l*A)*z,t[10]=(r*_*i-x*h*i+x*e*o-s*_*o-r*e*A+s*h*A)*z,t[11]=(c*h*i-r*l*i-c*e*o+s*l*o+r*e*d-s*h*d)*z,t[12]=p*z,t[13]=(c*_*n-x*l*n+x*e*m-s*_*m-c*e*M+s*l*M)*z,t[14]=(x*h*n-r*_*n-x*e*a+s*_*a+r*e*M-s*h*M)*z,t[15]=(r*l*n-c*h*n+c*e*a-s*l*a-r*e*m+s*h*m)*z,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof g?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,r=t.x,h=t.y,a=t.z,o=i*r,c=i*h;return this.set(o*r+e,o*h-n*a,o*a+n*h,0,o*h+n*a,c*h+e,c*a-n*r,0,o*a-n*h,c*a+n*r,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,r){return this.set(1,e,i,0,t,1,r,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,r=s.y,h=s.z,a=s.w,o=i+i,c=r+r,l=h+h,m=i*o,d=i*c,x=i*l,_=r*c,M=r*l,A=h*l,P=a*o,w=a*c,f=a*l,p=e.x,I=e.y,z=e.z;return n[0]=(1-(_+A))*p,n[1]=(d+f)*p,n[2]=(x-w)*p,n[3]=0,n[4]=(d-f)*I,n[5]=(1-(m+A))*I,n[6]=(M+P)*I,n[7]=0,n[8]=(x+w)*z,n[9]=(M-P)*z,n[10]=(1-(m+_))*z,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=Q.set(n[0],n[1],n[2]).length();const r=Q.set(n[4],n[5],n[6]).length(),h=Q.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],V.copy(this);const o=1/i,c=1/r,l=1/h;return V.elements[0]*=o,V.elements[1]*=o,V.elements[2]*=o,V.elements[4]*=c,V.elements[5]*=c,V.elements[6]*=c,V.elements[8]*=l,V.elements[9]*=l,V.elements[10]*=l,s.setFromRotationMatrix(V),e.x=i,e.y=r,e.z=h,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};at.IDENTITY=Object.freeze(new at);let K=at;const Q=new g,V=new K,fs=new g(0,0,0),ws=new g(1,1,1),F=new g,ut=new g,R=new g;class G{constructor(t=void 0,s=void 0){this.min=t==null?new g(1/0,1/0,1/0):new g(t.x,t.y,t.z),this.max=s==null?new g(-1/0,-1/0,-1/0):new g(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(Lt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=Lt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new G().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new g(0,0,0):new g(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new g(0,0,0):new g(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Lt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(j[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),j[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),j[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),j[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),j[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),j[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),j[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),j[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(j),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const j=[new g,new g,new g,new g,new g,new g,new g,new g],Lt=new g,ys=new b;class U{constructor(t=void 0,s=void 0){this.min=t==null?new b(1/0,1/0):new b(t.x,t.y),this.max=s==null?new b(-1/0,-1/0):new b(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=ys.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new U().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new b(0,0):new b(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new b(0,0):new b(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ys).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const gs=new g,Ps=new g,bs=new O;class et{constructor(t=new g(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=gs.subVectors(e,s).cross(Ps.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||bs.getNormalMatrix(t),n=this.coplanarPoint(gs).applyMatrix3d(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new et().copy(this)}}class S extends b{static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class E extends g{static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,r)=>{i.toArray(n,r*e)}),n}}const _s=new K,As=new st,ct=class ct{constructor(t=0,s=0,e=0,n=ct.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new ct(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],r=n[4],h=n[8],a=n[1],o=n[5],c=n[9],l=n[2],m=n[6],d=n[10];switch(s){case"XYZ":this._y=Math.asin(q(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,i)):(this._x=Math.atan2(m,o),this._z=0);break;case"YXZ":this._x=Math.asin(-q(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(h,d),this._z=Math.atan2(a,o)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(q(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-q(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(m,d),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(q(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(h,d));break;case"XZY":this._z=Math.asin(-q(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(m,o),this._y=Math.atan2(h,i)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+s)}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return _s.makeRotationFromQuaternion(t),this.setFromRotationMatrix(_s,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return As.setFromEuler(this),this.setFromQuaternion(As,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ct.DEFAULT_ORDER="XYZ";let Tt=ct;class Ms{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Rt extends Ms{translate(t){return this.transform(new O().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ss extends Rt{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new U}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var h;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const r={index:-1,children:[]};for(let a=0;a<i;a++){const o=e[a],c=t[o],l=s[o];let m=a+1;for(;m<i;m++){const d=e[m],x=t[d];if(s[d].containsBox(l)&&as.isPointInPolygon(c[C.randInt(0,c.length-1)],x)){(h=n.get(d))==null||h.children.push(n.get(o));break}}m===i&&r.children.push(n.get(o))}return r}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new U().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const r=n.size,h=r.width*r.height;s.push({area:h,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class W extends Rt{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let r=1;r<=t;r++)e=this.getPoint(r/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let r;s?r=s:r=t*e[i-1];let h=0,a=i-1,o;for(;h<=a;)if(n=Math.floor(h+(a-h)/2),o=e[n]-r,o<0)h=n+1;else if(o>0)a=n-1;else{a=n;break}if(n=a,e[n]===r)return n/(i-1);const c=e[n],m=e[n+1]-c,d=(r-c)/m;return(n+d)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),r=this.getPoint(n),h=new S;return h.copy(r).sub(i).normalize(),h}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class nt extends W{constructor(t,s,e,n,i){super();const r=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(r==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(r==5){const h=t;this.center=new S(h.x,h.y),this.radius=s,this.startAngle=e,this.endAngle=n,this.clockwise=i}else throw L.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(z,k)=>({x:(z.x+k.x)/2,y:(z.y+k.y)/2}),i=(z,k)=>(k.y-z.y)/(k.x-z.x),r=z=>-1/z,h=n(t,s),a=n(s,e),o=i(t,s),c=i(s,e),l=r(o),m=r(c),d=(z,k,H,$)=>{const Z=($-k)/(z-H),J=z*Z+k;return{x:Z,y:J}},x=h.y-l*h.x,_=a.y-m*a.x,M=d(l,x,m,_),A=Math.sqrt(Math.pow(t.x-M.x,2)+Math.pow(t.y-M.y,2)),P=(z,k)=>Math.atan2(z.y-k.y,z.x-k.x),w=P(t,M),f=P(s,M),p=P(e,M),I=p>w&&p<f||w>p&&w<f||f>p&&f<w;this.center=M,this.radius=A,this.startAngle=w,this.endAngle=p,this.clockwise=!I}createByStartEndPointsAndBulge(t,s,e){let n,i,r;e<0?(n=Math.atan(-e)*4,i=new b(t),r=new b(s)):(n=Math.atan(e)*4,i=new b(s),r=new b(t));const h=new b().subVectors(r,i),a=h.length(),o=new b().addVectors(i,h.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=h.normalize();let m;if(n<Math.PI){const d=new b(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));m=o.add(d.multiplyScalar(-c))}else{const d=new b(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));m=o.add(d.multiplyScalar(c))}e<0?(this.startAngle=Math.atan2(i.y-m.y,i.x-m.x),this.endAngle=Math.atan2(r.y-m.y,r.x-m.x)):(this.startAngle=Math.atan2(r.y-m.y,r.x-m.x),this.endAngle=Math.atan2(i.y-m.y,i.x-m.x)),this.clockwise=e<0,this.center=m,this.radius=r.sub(m).length()}get center(){return this._center}set center(t){this._center=new S(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?C.normalizeAngle(this.startAngle-this.endAngle):C.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=C.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s)C.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(i));const e=t.map(i=>i.x),n=t.map(i=>i.y);return new U(new S(Math.min(...e),Math.min(...n)),new S(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new nt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const s=this.center.x+this.radius*Math.cos(t),e=this.center.y+this.radius*Math.sin(t);return new S(s,e)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;if(this.closed&&(e=B,n=0),this.clockwise)for(let i=0;i<=t;i++){const r=n-e*(i/t),h=this.getPointAtAngle(r);s.push(new S(h.x,h.y))}else for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(new S(h.x,h.y))}return s}}class Cs extends Ms{translate(t){return this.transform(new K().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class dt extends Cs{}class it extends dt{constructor(t,s){super(),this._start=new E(t),this._end=new E(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new g().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new E((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta(D).normalize();return new E(this._start).addScaledVector(e,t)}else{const e=this.delta(D).normalize();return new E(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=D.subVectors(this._start,this._end).normalize();this._start=new E(this._start).addScaledVector(e,t)}else{const e=this.delta(D).normalize();this._end=new E(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){zs.subVectors(t,this._start),mt.subVectors(this.endPoint,this.startPoint);const e=mt.dot(mt);let i=mt.dot(zs)/e;return s&&(i=C.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=D.subVectors(t,this.startPoint).dot(s);return new E().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=D.subVectors(t,e).dot(s),r=D.copy(s).multiplyScalar(i);return new E().addVectors(e,r)}calculateBoundingBox(){const t=new E(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new E(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new G(t,s)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new it(this._start.clone(),this._end.clone())}}const D=new g,zs=new g,mt=new g;class rt extends dt{static computeCenterPoint(t,s,e){const n=new g().addVectors(t,s).multiplyScalar(.5),i=new g().addVectors(t,e).multiplyScalar(.5),r=new g().subVectors(s,t),h=new g().subVectors(e,t),a=new g().crossVectors(r,h).normalize();if(a.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const o=new g().crossVectors(r,a).normalize(),c=new g().crossVectors(h,a).normalize(),l=o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=new it(n,n.clone().add(l)),x=new it(i,i.clone().add(m)),_=new g;return d.closestPointToPoint(x.startPoint,!0,_)?_:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,s,e){const n=rt.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),r=new g().subVectors(t,n),h=new g().subVectors(s,n),a=Math.atan2(r.y,r.x),o=Math.atan2(h.y,h.x);return new rt(n,i,a,o,g.Z_AXIS)}}constructor(t,s,e,n,i,r=g.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=r,(n-e)%B==0?(this.startAngle=0,this.endAngle=B):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new g(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new g(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)C.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>r&&(r=o.y),o.z>h&&(h=o.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=B,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(h)}return s}transform(t){const s=Ut.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),e=Ut.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),s.applyMatrix3d(t),e.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(s),this.endAngle=this.getAngle(e),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Ut.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,r=this.radius;return new E(i.x+r*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+r*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+r*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new g(this.center).distanceTo(It);return new et(this.normal,t)}}const Ut=new g;class Vt extends W{constructor(t,s,e,n=0,i=B,r=!1,h=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%B==0?(this.startAngle=0,this.endAngle=B):(this.startAngle=n,this.endAngle=i),this.clockwise=r,this.rotation=h}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let r=0;r<=100;r++){const h=this.getPoint(r/100);s=Math.min(s,h.x),e=Math.min(e,h.y),n=Math.max(n,h.x),i=Math.max(i,h.y)}return new U({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let r=this.center.x+this.majorAxisRadius*Math.cos(i),h=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),o=Math.sin(this.rotation),c=r-this.center.x,l=h-this.center.y;r=c*a-l*o+this.center.x,h=c*o+l*a+this.center.y}return new S(r,h)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new Vt(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class qt extends dt{constructor(t,s,e,n,i,r=0,h=B){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(h-r);Math.abs(a-B)<1e-10||Math.abs(a-2*B)<1e-10?(this.startAngle=0,this.endAngle=B):(this.startAngle=r,this.endAngle=h)}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-B)<1e-10?B:C.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new g(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new g(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new g().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){const s=this.deltaAngle/1e3;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=1e3;i++){const r=this.startAngle+i*s,h=this.getPointAtAngle(r),a=h.x-n.x,o=h.y-n.y,c=h.z-n.z;e+=Math.sqrt(a*a+o*o+c*c),n=h}return e}calculateBoundingBox(){if(this.majorAxis.equals(g.X_AXIS)||this.majorAxis.equals(g.Y_AXIS)||this.majorAxis.isParallelTo(g.X_AXIS)||this.majorAxis.isParallelTo(g.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)C.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>r&&(r=o.y),o.z>h&&(h=o.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(let a=0;a<=100;a++){const o=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(o);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),r=Math.max(r,c.y),h=Math.max(h,c.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=B,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(h)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new E(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new g(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,r=n/this.minorAxisRadius;return i*i+r*r<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new qt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new g(this.center).distanceTo(It);return new et(this.normal,t)}}class Es extends W{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new S(s.x,s.y)}else{const s=this._vertices[t-1];return new S(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const r=new nt(n,i,n.bulge);t+=r.length}else t+=new S(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const s=this._vertices[t];return new S(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new U().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new E().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let r=null;if(n<e-1?r=this._vertices[n+1]:n==e-1&&this.closed&&(r=this._vertices[0]),r){const a=new nt(i,r,i.bulge).getPoints(t),o=a.length;for(let c=0;c<o;++c){const l=a[c];s.push(new S(l.x,l.y))}}}else s.push(new S(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class jt extends W{constructor(t,s){super(),this._start=new S(t),this._end=new S(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new S(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new S(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new U(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new jt(this._start.clone(),this._end.clone())}}class Is extends W{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new U;return s.setFromPoints(t),s}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new S(n.x,n.y))})}),s}}class Y{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>[...i]),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>[...t])}weights(){return[...this._weights]}point(t){return tt(t,this._degree,this._knots,this._controlPoints,this._weights)}length(){return ds(this._degree,this._knots,this._controlPoints,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new Y(t,s,e,n)}static byPoints(t,s,e="Uniform"){let n;switch(e){case"Chord":n=ls(s,t);break;case"SqrtChord":n=us(s,t);break;case"Uniform":default:n=cs(s,t.length);break}const i=ms(t),r=new Array(i.length).fill(1);return new Y(s,n,i,r)}}class Bs extends dt{constructor(t,s,e){super();const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!=2&&n!=3)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const i=3;if(this._closed=!1,n==2&&!Array.isArray(s)){if(this._fitPoints=t,this._knotParameterization=s,this._fitPoints.length<4)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Y.byPoints(r,i,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints()),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=[...this._nurbsCurve.weights()]}else{if(this._controlPoints=t,this._controlPoints.length<4)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._controlPoints);this._nurbsCurve=Y.byKnotsControlPointsWeights(i,s,r,e),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=e?[...e]:new Array(this._controlPoints.length).fill(1)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,t?this.makeClosed():this.makeOpen())}makeClosed(){const t=this._nurbsCurve.degree(),s=this._nurbsCurve.controlPoints(),e=this._nurbsCurve.knots(),n=this._nurbsCurve.weights(),i=[...s],r=[...n];for(let a=0;a<t;a++)i.push([...s[0]]),r.push(n[0]);const h=this.createClosedKnotVector(e,t);this._nurbsCurve=Y.byKnotsControlPointsWeights(t,h,i,r),this._controlPoints=this.toGePoints(i)}makeOpen(){if(!this._originalControlPoints||!this._originalKnots||!this._originalWeights)throw new Error("Original curve data not available");const t=this._nurbsCurve.degree(),s=this.toNurbsPoints(this._originalControlPoints);this._nurbsCurve=Y.byKnotsControlPointsWeights(t,this._originalKnots,s,this._originalWeights),this._controlPoints=[...this._originalControlPoints]}createClosedKnotVector(t,s){const e=[...t],n=t[t.length-1],i=s;for(let r=1;r<=i;r++)e.push(n+r);return e}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new E(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new E(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),r=n[i],h=n[n.length-i-1],a=(h-r)/(t-1);for(let o=0;o<t;o++){const c=o===t-1?h:r+o*a,l=s.point(c);e.push(new E(l[0],l[1],l[2]))}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=n[3],h=(n[n.length-4]-i)/(s-1);for(let a=0;a<s;a++){const o=i+a*h;e.push(t.point(o))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new G().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}toGePoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]={x:e[0],y:e[1],z:e[2]}}),s}}y.AcGeArea2d=Ss,y.AcGeBox2d=U,y.AcGeBox3d=G,y.AcGeCircArc2d=nt,y.AcGeCircArc3d=rt,y.AcGeCurve2d=W,y.AcGeEllipseArc2d=Vt,y.AcGeEllipseArc3d=qt,y.AcGeEuler=Tt,y.AcGeGeometryUtil=as,y.AcGeLine2d=jt,y.AcGeLine3d=it,y.AcGeLoop2d=Is,y.AcGeMathUtil=C,y.AcGeMatrix2d=O,y.AcGeMatrix3d=K,y.AcGePlane=et,y.AcGePoint2d=S,y.AcGePoint3d=E,y.AcGePolyline2d=Es,y.AcGeQuaternion=st,y.AcGeShape2d=Rt,y.AcGeSpline3d=Bs,y.AcGeTol=hs,y.AcGeVector2d=b,y.AcGeVector3d=g,y.DEFAULT_TOL=Bt,y.DEG2RAD=wt,y.FLOAT_TOL=X,y.ORIGIN_POINT_2D=ps,y.ORIGIN_POINT_3D=It,y.RAD2DEG=Pt,y.TAU=B,y.basisFunction=lt,y.calculateCurveLength=ds,y.ceilPowerOfTwo=ss,y.clamp=q,y.damp=Yt,y.degToRad=Jt,y.euclideanModulo=bt,y.evaluateNurbsPoint=tt,y.floorPowerOfTwo=es,y.generateChordKnots=ls,y.generateSqrtChordKnots=us,y.generateUUID=Gt,y.generateUniformKnots=cs,y.intPartLength=Ct,y.interpolateControlPoints=ms,y.inverseLerp=Dt,y.isBetween=ns,y.isBetweenAngle=is,y.isPointInPolygon=Nt,y.isPolygonIntersect=os,y.isPowerOfTwo=ts,y.lerp=St,y.mapLinear=Xt,y.normalizeAngle=v,y.pingpong=Zt,y.radToDeg=vt,y.randFloat=Wt,y.randFloatSpread=Ht,y.randInt=Qt,y.relativeEps=rs,y.seededRandom=$t,y.smootherstep=Kt,y.smoothstep=Ot,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
1
+ (function(y,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("@mlightcad/common")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common"],L):(y=typeof globalThis<"u"?globalThis:y||self,L(y["geometry-engine"]={},y.common))})(this,function(y,L){"use strict";const k=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Ft=1234567;const wt=Math.PI/180,Pt=180/Math.PI;function Gt(){const u=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0,e=Math.random()*4294967295|0;return(k[u&255]+k[u>>8&255]+k[u>>16&255]+k[u>>24&255]+"-"+k[t&255]+k[t>>8&255]+"-"+k[t>>16&15|64]+k[t>>24&255]+"-"+k[s&63|128]+k[s>>8&255]+"-"+k[s>>16&255]+k[s>>24&255]+k[e&255]+k[e>>8&255]+k[e>>16&255]+k[e>>24&255]).toLowerCase()}function q(u,t,s){return Math.max(t,Math.min(s,u))}function bt(u,t){return(u%t+t)%t}function Xt(u,t,s,e,n){return e+(u-t)*(n-e)/(s-t)}function Dt(u,t,s){return u!==t?(s-u)/(t-u):0}function St(u,t,s){return(1-s)*u+s*t}function Yt(u,t,s,e){return St(u,t,1-Math.exp(-s*e))}function Zt(u,t=1){return t-Math.abs(bt(u,t*2)-t)}function Ot(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*(3-2*u))}function Kt(u,t,s){return u<=t?0:u>=s?1:(u=(u-t)/(s-t),u*u*u*(u*(u*6-15)+10))}function Qt(u,t){return u+Math.floor(Math.random()*(t-u+1))}function Wt(u,t){return u+Math.random()*(t-u)}function Ht(u){return u*(.5-Math.random())}function $t(u){u!==void 0&&(Ft=u);let t=Ft+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Jt(u){return u*wt}function vt(u){return u*Pt}function ts(u){return(u&u-1)===0&&u!==0}function ss(u){return Math.pow(2,Math.ceil(Math.log(u)/Math.LN2))}function es(u){return Math.pow(2,Math.floor(Math.log(u)/Math.LN2))}function v(u){const t=Math.PI*2;return(u%t+t)%t}function ns(u,t,s){return u>t&&u<s||u>s&&u<t}function is(u,t,s,e=!1){return u=v(u),t=v(t),s=v(s),e?t>s?u<=t&&u>=s:u<=t||u>=s:t<s?u>=t&&u<=s:u>=t||u<=s}function Ct(u){return u=Math.abs(u),u<1?0:Math.ceil(Math.log10(Math.abs(u)+1))}function rs(u,t=1e-7){const s=Ct(u);return Math.max(Math.pow(10,s)*t,t)}const C={DEG2RAD:wt,RAD2DEG:Pt,generateUUID:Gt,clamp:q,euclideanModulo:bt,mapLinear:Xt,inverseLerp:Dt,lerp:St,damp:Yt,pingpong:Zt,smoothstep:Ot,smootherstep:Kt,randInt:Qt,randFloat:Wt,randFloatSpread:Ht,seededRandom:$t,degToRad:Jt,radToDeg:vt,isPowerOfTwo:ts,ceilPowerOfTwo:ss,floorPowerOfTwo:es,normalizeAngle:v,isBetween:ns,isBetweenAngle:is,intPartLength:Ct,relativeEps:rs},ht=class ht{constructor(t,s){this.x=0,this.y=0;const e=+(t!==void 0)+ +(s!==void 0);if(e!==0){if(e===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(e===1){const{x:n,y:i}=t;this.x=n,this.y=i;return}if(e===2){this.x=t,this.y=s;return}throw L.AcCmErrors.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,s){return this.x=t,this.y=s,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new ht(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const s=this.x,e=this.y,n=t.elements;return this.x=n[0]*s+n[3]*e+n[6],this.y=n[1]*s+n[4]*e+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y;return s*s+e*e}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t}rotateAround(t,s){const e=Math.cos(s),n=Math.sin(s),i=this.x-t.x,r=this.y-t.y;return this.x=i*e-r*n+t.x,this.y=i*n+r*e+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(C.relativeEps(this.x,t),C.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};ht.EMPTY=Object.freeze(new ht(0,0));let b=ht;const ot=class ot{constructor(t,s,e,n,i,r,h,a,o){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&h!=null&&a!=null&&o!=null&&this.set(t,s,e,n,i,r,h,a,o)}set(t,s,e,n,i,r,h,a,o){const c=this.elements;return c[0]=t,c[1]=n,c[2]=h,c[3]=s,c[4]=i,c[5]=a,c[6]=e,c[7]=r,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],this}extractBasis(t,s,e){return t.setFromMatrix3Column(this,0),s.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const s=t.elements;return this.set(s[0],s[4],s[8],s[1],s[5],s[9],s[2],s[6],s[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],h=e[3],a=e[6],o=e[1],c=e[4],l=e[7],m=e[2],d=e[5],x=e[8],_=n[0],p=n[3],A=n[6],P=n[1],w=n[4],f=n[7],z=n[2],I=n[5],M=n[8];return i[0]=r*_+h*P+a*z,i[3]=r*p+h*w+a*I,i[6]=r*A+h*f+a*M,i[1]=o*_+c*P+l*z,i[4]=o*p+c*w+l*I,i[7]=o*A+c*f+l*M,i[2]=m*_+d*P+x*z,i[5]=m*p+d*w+x*I,i[8]=m*A+d*f+x*M,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[3]*=t,s[6]*=t,s[1]*=t,s[4]*=t,s[7]*=t,s[2]*=t,s[5]*=t,s[8]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8];return s*r*c-s*h*o-e*i*c+e*h*a+n*i*o-n*r*a}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8],l=c*r-h*o,m=h*a-c*i,d=o*i-r*a,x=s*l+e*m+n*d;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/x;return t[0]=l*_,t[1]=(n*o-c*e)*_,t[2]=(h*e-n*r)*_,t[3]=m*_,t[4]=(c*s-n*a)*_,t[5]=(n*i-h*s)*_,t[6]=d*_,t[7]=(e*a-o*s)*_,t[8]=(r*s-e*i)*_,this}transpose(){let t;const s=this.elements;return t=s[1],s[1]=s[3],s[3]=t,t=s[2],s[2]=s[6],s[6]=t,t=s[5],s[5]=s[7],s[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const s=this.elements;return t.elements[0]=s[0],t.elements[1]=s[3],t.elements[2]=s[6],t.elements[3]=s[1],t.elements[4]=s[4],t.elements[5]=s[7],t.elements[6]=s[2],t.elements[7]=s[5],t.elements[8]=s[8],this}setUvTransform(t,s,e,n,i,r,h){const a=Math.cos(i),o=Math.sin(i);return this.set(e*a,e*o,-e*(a*r+o*h)+r+t,-n*o,n*a,-n*(-o*r+a*h)+h+s,0,0,1),this}scale(t,s){return this.premultiply(Et.makeScale(t,s)),this}rotate(t){return this.premultiply(Et.makeRotation(-t)),this}translate(t,s){return this.premultiply(Et.makeTranslation(t,s)),this}makeTranslation(t,s){return t instanceof b?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,s,0,0,1),this}makeRotation(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,e,s,0,0,0,1),this}makeScale(t,s){return this.set(t,0,0,0,s,0,0,0,1),this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<9;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<9;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t}clone(){return new ot().fromArray(this.elements)}};ot.IDENTITY=Object.freeze(new ot);let O=ot;const Et=new O,X=1e-6,B=2*Math.PI,zs={x:0,y:0},It={x:0,y:0,z:0};class hs{constructor(){this.equalPointTol=X,this.equalVectorTol=X}equalPoint2d(t,s){return new b(t).sub(s).length()<this.equalPointTol}equalPoint3d(t,s){return new g(t).sub(s).length()<this.equalPointTol}static equalToZero(t,s=X){return t<s&&t>-s}static equal(t,s,e=X){return Math.abs(t-s)<e}static great(t,s,e=X){return t-s>e}static less(t,s,e=X){return t-s<e}}const Bt=new hs;function kt(u,t,s=!1){const e=u.x,n=u.y;let i=!1;const r=t.length;for(let h=0,a=r-1;h<r;a=h++){const o=t[h].x,c=t[h].y,l=t[a].x,m=t[a].y;let d=c>n!=m>n;s&&(d=c>=n!=m>=n),d&&e<(l-o)*(n-c)/(m-c)+o&&(i=!i)}return i}function os(u,t){if(u.length===0||t.length===0)return!1;const s=new U().setFromPoints(u),e=new U().setFromPoints(t);if(!s.intersectsBox(e))return!1;for(let n=0;n<u.length;){if(kt(u[n],t,!0))return!0;n<u.length-1&&Bt.equalPoint2d(u[n+1],u[n])&&++n,++n}return!1}const as={isPointInPolygon:kt,isPolygonIntersect:os};function cs(u,t){const s=[],e=t-1,n=u;for(let i=0;i<=n;i++)s.push(0);for(let i=1;i<=e-n;i++)s.push(i);for(let i=0;i<=n;i++)s.push(e-n+1);return s}function ls(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let h=1;h<=s;h++){const a=t[h][0]-t[h-1][0],o=t[h][1]-t[h-1][1],c=t[h][2]-t[h-1][2],l=Math.sqrt(a*a+o*o+c*c);i+=l,n.push(i)}const r=[];for(let h=0;h<=e;h++)r.push(0);for(let h=1;h<=s-e;h++){const a=n[h]/i;r.push(a*(s-e+1))}for(let h=0;h<=e;h++)r.push(s-e+1);return r}function us(u,t){const s=t.length-1,e=u,n=[0];let i=0;for(let h=1;h<=s;h++){const a=t[h][0]-t[h-1][0],o=t[h][1]-t[h-1][1],c=t[h][2]-t[h-1][2],l=Math.sqrt(a*a+o*o+c*c),m=Math.sqrt(l);i+=m,n.push(i)}const r=[];for(let h=0;h<=e;h++)r.push(0);for(let h=1;h<=s-e;h++){const a=n[h]/i;r.push(a*(s-e+1))}for(let h=0;h<=e;h++)r.push(s-e+1);return r}function lt(u,t,s,e){if(t===0)return s>=e[u]&&s<e[u+1]?1:0;const n=e[u+t]-e[u],i=e[u+t+1]-e[u+1],r=n>1e-10?(s-e[u])/n:0,h=i>1e-10?(e[u+t+1]-s)/i:0;return r*lt(u,t-1,s,e)+h*lt(u+1,t-1,s,e)}function tt(u,t,s,e,n){const i=e.length-1,r=t;if(u=Math.max(s[r],Math.min(s[i+1],u)),Math.abs(u-s[i+1])<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]];const h=[0,0,0];let a=0;for(let o=0;o<=i;o++){const c=lt(o,r,u,s),l=n[o]*c;h[0]+=e[o][0]*l,h[1]+=e[o][1]*l,h[2]+=e[o][2]*l,a+=l}if(a<1e-10){const o=s[s.length-r-1];if(Math.abs(u-o)<1e-8)return[...e[i]];if(Math.abs(u-s[r])<1e-8)return[...e[0]]}return a>1e-10&&(h[0]/=a,h[1]/=a,h[2]/=a),h}function ds(u,t,s,e){const n=u,i=t[n],r=t[t.length-n-1];let h=0;const a=1e3,o=(r-i)/a;let c=tt(i,u,t,s,e);for(let _=1;_<=a;_++){const p=i+_*o,A=tt(p,u,t,s,e),P=A[0]-c[0],w=A[1]-c[1],f=A[2]-c[2];h+=Math.sqrt(P*P+w*w+f*f),c=A}const l=tt(r,u,t,s,e),m=l[0]-c[0],d=l[1]-c[1],x=l[2]-c[2];return h+=Math.sqrt(m*m+d*d+x*x),h}function ms(u){return u.map(t=>[...t])}class st{constructor(t=0,s=0,e=0,n=1){this._x=t,this._y=s,this._z=e,this._w=n}static slerpFlat(t,s,e,n,i,r,h){let a=e[n+0],o=e[n+1],c=e[n+2],l=e[n+3];const m=i[r+0],d=i[r+1],x=i[r+2],_=i[r+3];if(h===0){t[s+0]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l;return}if(h===1){t[s+0]=m,t[s+1]=d,t[s+2]=x,t[s+3]=_;return}if(l!==_||a!==m||o!==d||c!==x){let p=1-h;const A=a*m+o*d+c*x+l*_,P=A>=0?1:-1,w=1-A*A;if(w>Number.EPSILON){const z=Math.sqrt(w),I=Math.atan2(z,A*P);p=Math.sin(p*I)/z,h=Math.sin(h*I)/z}const f=h*P;if(a=a*p+m*f,o=o*p+d*f,c=c*p+x*f,l=l*p+_*f,p===1-h){const z=1/Math.sqrt(a*a+o*o+c*c+l*l);a*=z,o*=z,c*=z,l*=z}}t[s]=a,t[s+1]=o,t[s+2]=c,t[s+3]=l}static multiplyQuaternionsFlat(t,s,e,n,i,r){const h=e[n],a=e[n+1],o=e[n+2],c=e[n+3],l=i[r],m=i[r+1],d=i[r+2],x=i[r+3];return t[s]=h*x+c*l+a*d-o*m,t[s+1]=a*x+c*m+o*l-h*d,t[s+2]=o*x+c*d+h*m-a*l,t[s+3]=c*x-h*l-a*m-o*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,s,e,n){return this._x=t,this._y=s,this._z=e,this._w=n,this._onChangeCallback(),this}clone(){return new st(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,s=!0){const e=t.x,n=t.y,i=t.z,r=t.order,h=Math.cos,a=Math.sin,o=h(e/2),c=h(n/2),l=h(i/2),m=a(e/2),d=a(n/2),x=a(i/2);switch(r){case"XYZ":this._x=m*c*l+o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l-m*d*x;break;case"YXZ":this._x=m*c*l+o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l+m*d*x;break;case"ZXY":this._x=m*c*l-o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l-m*d*x;break;case"ZYX":this._x=m*c*l-o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l+m*d*x;break;case"YZX":this._x=m*c*l+o*d*x,this._y=o*d*l+m*c*x,this._z=o*c*x-m*d*l,this._w=o*c*l-m*d*x;break;case"XZY":this._x=m*c*l-o*d*x,this._y=o*d*l-m*c*x,this._z=o*c*x+m*d*l,this._w=o*c*l+m*d*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return s===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,s){const e=s/2,n=Math.sin(e);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(e),this._onChangeCallback(),this}setFromRotationMatrix(t){const s=t.elements,e=s[0],n=s[4],i=s[8],r=s[1],h=s[5],a=s[9],o=s[2],c=s[6],l=s[10],m=e+h+l;if(m>0){const d=.5/Math.sqrt(m+1);this._w=.25/d,this._x=(c-a)*d,this._y=(i-o)*d,this._z=(r-n)*d}else if(e>h&&e>l){const d=2*Math.sqrt(1+e-h-l);this._w=(c-a)/d,this._x=.25*d,this._y=(n+r)/d,this._z=(i+o)/d}else if(h>l){const d=2*Math.sqrt(1+h-e-l);this._w=(i-o)/d,this._x=(n+r)/d,this._y=.25*d,this._z=(a+c)/d}else{const d=2*Math.sqrt(1+l-e-h);this._w=(r-n)/d,this._x=(i+o)/d,this._y=(a+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,s){let e=t.dot(s)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*s.z-t.z*s.y,this._y=t.z*s.x-t.x*s.z,this._z=t.x*s.y-t.y*s.x,this._w=e),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(q(this.dot(t),-1,1)))}rotateTowards(t,s){const e=this.angleTo(t);if(e===0)return this;const n=Math.min(1,s/e);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,s){const e=t._x,n=t._y,i=t._z,r=t._w,h=s._x,a=s._y,o=s._z,c=s._w;return this._x=e*c+r*h+n*o-i*a,this._y=n*c+r*a+i*h-e*o,this._z=i*c+r*o+e*a-n*h,this._w=r*c-e*h-n*a-i*o,this._onChangeCallback(),this}slerp(t,s){if(s===0)return this;if(s===1)return this.copy(t);const e=this._x,n=this._y,i=this._z,r=this._w;let h=r*t._w+e*t._x+n*t._y+i*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=r,this._x=e,this._y=n,this._z=i,this;const a=1-h*h;if(a<=Number.EPSILON){const d=1-s;return this._w=d*r+s*this._w,this._x=d*e+s*this._x,this._y=d*n+s*this._y,this._z=d*i+s*this._z,this.normalize(),this}const o=Math.sqrt(a),c=Math.atan2(o,h),l=Math.sin((1-s)*c)/o,m=Math.sin(s*c)/o;return this._w=r*l+this._w*m,this._x=e*l+this._x*m,this._y=n*l+this._y*m,this._z=i*l+this._z*m,this._onChangeCallback(),this}slerpQuaternions(t,s,e){return this.copy(t).slerp(s,e)}random(){const t=2*Math.PI*Math.random(),s=2*Math.PI*Math.random(),e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(s),i*Math.cos(s))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,s=0){return this._x=t[s],this._y=t[s+1],this._z=t[s+2],this._w=t[s+3],this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const T=class T{constructor(t,s,e){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:i,y:r,z:h}=t;this.x=i,this.y=r,this.z=h||0;return}if(n===3){this.x=t,this.y=s,this.z=e;return}throw L.AcCmErrors.ILLEGAL_PARAMETERS}}set(t,s,e){return e===void 0&&(e=this.z),this.x=t,this.y=s,this.z=e,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,s){switch(t){case 0:this.x=s;break;case 1:this.y=s;break;case 2:this.z=s;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new T(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,s){return this.x=t.x+s.x,this.y=t.y+s.y,this.z=t.z+s.z,this}addScaledVector(t,s){return this.x+=t.x*s,this.y+=t.y*s,this.z+=t.z*s,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,s){return this.x=t.x-s.x,this.y=t.y-s.y,this.z=t.z-s.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,s){return this.x=t.x*s.x,this.y=t.y*s.y,this.z=t.z*s.z,this}applyEuler(t){return this.applyQuaternion(xs.setFromEuler(t))}applyAxisAngle(t,s){return this.applyQuaternion(xs.setFromAxisAngle(t,s))}applyMatrix3(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[3]*e+i[6]*n,this.y=i[1]*s+i[4]*e+i[7]*n,this.z=i[2]*s+i[5]*e+i[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix3d(t){const s=this.x,e=this.y,n=this.z,i=t.elements,r=1/(i[3]*s+i[7]*e+i[11]*n+i[15]);return this.x=(i[0]*s+i[4]*e+i[8]*n+i[12])*r,this.y=(i[1]*s+i[5]*e+i[9]*n+i[13])*r,this.z=(i[2]*s+i[6]*e+i[10]*n+i[14])*r,this}applyQuaternion(t){const s=this.x,e=this.y,n=this.z,i=t.x,r=t.y,h=t.z,a=t.w,o=2*(r*n-h*e),c=2*(h*s-i*n),l=2*(i*e-r*s);return this.x=s+a*o+r*l-h*c,this.y=e+a*c+h*o-i*l,this.z=n+a*l+i*c-r*o,this}transformDirection(t){const s=this.x,e=this.y,n=this.z,i=t.elements;return this.x=i[0]*s+i[4]*e+i[8]*n,this.y=i[1]*s+i[5]*e+i[9]*n,this.z=i[2]*s+i[6]*e+i[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,s){return this.x=Math.max(t.x,Math.min(s.x,this.x)),this.y=Math.max(t.y,Math.min(s.y,this.y)),this.z=Math.max(t.z,Math.min(s.z,this.z)),this}clampScalar(t,s){return this.x=Math.max(t,Math.min(s,this.x)),this.y=Math.max(t,Math.min(s,this.y)),this.z=Math.max(t,Math.min(s,this.z)),this}clampLength(t,s){const e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(s,e)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const s=this.dot(t),e=this.length(),n=t.length();return Math.abs(s)===e*n}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,s){return this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s,this.z+=(t.z-this.z)*s,this}lerpVectors(t,s,e){return this.x=t.x+(s.x-t.x)*e,this.y=t.y+(s.y-t.y)*e,this.z=t.z+(s.z-t.z)*e,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,s){const e=t.x,n=t.y,i=t.z,r=s.x,h=s.y,a=s.z;return this.x=n*a-i*h,this.y=i*r-e*a,this.z=e*h-n*r,this}projectOnVector(t){const s=t.lengthSq();if(s===0)return this.set(0,0,0);const e=t.dot(this)/s;return this.copy(t).multiplyScalar(e)}projectOnPlane(t){return Nt.copy(this).projectOnVector(t),this.sub(Nt)}reflect(t){return this.sub(Nt.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const s=Math.sqrt(this.lengthSq()*t.lengthSq());if(s===0)return Math.PI/2;const e=this.dot(t)/s;return Math.acos(Math.max(-1,Math.min(1,e)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const s=this.x-t.x,e=this.y-t.y,n=this.z-t.z;return s*s+e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const s=t.elements;return this.x=s[12],this.y=s[13],this.z=s[14],this}setFromMatrixScale(t){const s=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=s,this.y=e,this.z=n,this}setFromMatrixColumn(t,s){return this.fromArray(t.elements,s*4)}setFromMatrix3Column(t,s){return this.fromArray(t.elements,s*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,s=0){return this.x=t[s],this.y=t[s+1],this.z=t[s+2],this}toArray(t=[],s=0){return t[s]=this.x,t[s+1]=this.y,t[s+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,s=Math.random()*2-1,e=Math.sqrt(1-s*s);return this.x=e*Math.cos(t),this.y=s,this.z=e*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};T.X_AXIS=Object.freeze(new T(1,0,0)),T.NEGATIVE_X_AXIS=Object.freeze(new T(-1,0,0)),T.Y_AXIS=Object.freeze(new T(0,1,0)),T.NEGATIVE_Y_AXIS=Object.freeze(new T(0,-1,0)),T.Z_AXIS=Object.freeze(new T(0,0,1)),T.NEGATIVE_Z_AXIS=Object.freeze(new T(0,0,-1));let g=T;const Nt=new g,xs=new st,at=class at{constructor(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&s!=null&&e!=null&&n!=null&&i!=null&&r!=null&&h!=null&&a!=null&&o!=null&&c!=null&&l!=null&&m!=null&&d!=null&&x!=null&&_!=null&&p!=null&&this.set(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,p)}set(t,s,e,n,i,r,h,a,o,c,l,m,d,x,_,p){const A=this.elements;return A[0]=t,A[4]=s,A[8]=e,A[12]=n,A[1]=i,A[5]=r,A[9]=h,A[13]=a,A[2]=o,A[6]=c,A[10]=l,A[14]=m,A[3]=d,A[7]=x,A[11]=_,A[15]=p,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new at().fromArray(this.elements)}copy(t){const s=this.elements,e=t.elements;return s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[4],s[5]=e[5],s[6]=e[6],s[7]=e[7],s[8]=e[8],s[9]=e[9],s[10]=e[10],s[11]=e[11],s[12]=e[12],s[13]=e[13],s[14]=e[14],s[15]=e[15],this}copyPosition(t){const s=this.elements,e=t.elements;return s[12]=e[12],s[13]=e[13],s[14]=e[14],this}setFromMatrix3(t){const s=t.elements;return this.set(s[0],s[3],s[6],0,s[1],s[4],s[7],0,s[2],s[5],s[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(Bt.equalPoint3d(t,g.Z_AXIS))this.identity();else{const s=new g(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?s.crossVectors(g.Y_AXIS,t).normalize():s.crossVectors(g.Z_AXIS,t).normalize();const e=t.clone().cross(s).normalize();this.set(s.x,s.y,s.z,0,e.x,e.y,e.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,s,e){return t.setFromMatrixColumn(this,0),s.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this}makeBasis(t,s,e){return this.set(t.x,s.x,e.x,0,t.y,s.y,e.y,0,t.z,s.z,e.z,0,0,0,0,1),this}extractRotation(t){const s=this.elements,e=t.elements,n=1/Q.setFromMatrixColumn(t,0).length(),i=1/Q.setFromMatrixColumn(t,1).length(),r=1/Q.setFromMatrixColumn(t,2).length();return s[0]=e[0]*n,s[1]=e[1]*n,s[2]=e[2]*n,s[3]=0,s[4]=e[4]*i,s[5]=e[5]*i,s[6]=e[6]*i,s[7]=0,s[8]=e[8]*r,s[9]=e[9]*r,s[10]=e[10]*r,s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,this}makeRotationFromQuaternion(t){return this.compose(fs,t,ws)}lookAt(t,s,e){const n=this.elements;return R.subVectors(t,s),R.lengthSq()===0&&(R.z=1),R.normalize(),F.crossVectors(e,R),F.lengthSq()===0&&(Math.abs(e.z)===1?R.x+=1e-4:R.z+=1e-4,R.normalize(),F.crossVectors(e,R)),F.normalize(),ut.crossVectors(R,F),n[0]=F.x,n[4]=ut.x,n[8]=R.x,n[1]=F.y,n[5]=ut.y,n[9]=R.y,n[2]=F.z,n[6]=ut.z,n[10]=R.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,s){const e=t.elements,n=s.elements,i=this.elements,r=e[0],h=e[4],a=e[8],o=e[12],c=e[1],l=e[5],m=e[9],d=e[13],x=e[2],_=e[6],p=e[10],A=e[14],P=e[3],w=e[7],f=e[11],z=e[15],I=n[0],M=n[4],N=n[8],H=n[12],$=n[1],Z=n[5],J=n[9],xt=n[13],yt=n[2],gt=n[6],_t=n[10],At=n[14],pt=n[3],Mt=n[7],zt=n[11],ft=n[15];return i[0]=r*I+h*$+a*yt+o*pt,i[4]=r*M+h*Z+a*gt+o*Mt,i[8]=r*N+h*J+a*_t+o*zt,i[12]=r*H+h*xt+a*At+o*ft,i[1]=c*I+l*$+m*yt+d*pt,i[5]=c*M+l*Z+m*gt+d*Mt,i[9]=c*N+l*J+m*_t+d*zt,i[13]=c*H+l*xt+m*At+d*ft,i[2]=x*I+_*$+p*yt+A*pt,i[6]=x*M+_*Z+p*gt+A*Mt,i[10]=x*N+_*J+p*_t+A*zt,i[14]=x*H+_*xt+p*At+A*ft,i[3]=P*I+w*$+f*yt+z*pt,i[7]=P*M+w*Z+f*gt+z*Mt,i[11]=P*N+w*J+f*_t+z*zt,i[15]=P*H+w*xt+f*At+z*ft,this}multiplyScalar(t){const s=this.elements;return s[0]*=t,s[4]*=t,s[8]*=t,s[12]*=t,s[1]*=t,s[5]*=t,s[9]*=t,s[13]*=t,s[2]*=t,s[6]*=t,s[10]*=t,s[14]*=t,s[3]*=t,s[7]*=t,s[11]*=t,s[15]*=t,this}determinant(){const t=this.elements,s=t[0],e=t[4],n=t[8],i=t[12],r=t[1],h=t[5],a=t[9],o=t[13],c=t[2],l=t[6],m=t[10],d=t[14],x=t[3],_=t[7],p=t[11],A=t[15];return x*(+i*a*l-n*o*l-i*h*m+e*o*m+n*h*d-e*a*d)+_*(+s*a*d-s*o*m+i*r*m-n*r*d+n*o*c-i*a*c)+p*(+s*o*l-s*h*d-i*r*l+e*r*d+i*h*c-e*o*c)+A*(-n*h*c-s*a*l+s*h*m+n*r*l-e*r*m+e*a*c)}transpose(){const t=this.elements;let s;return s=t[1],t[1]=t[4],t[4]=s,s=t[2],t[2]=t[8],t[8]=s,s=t[6],t[6]=t[9],t[9]=s,s=t[3],t[3]=t[12],t[12]=s,s=t[7],t[7]=t[13],t[13]=s,s=t[11],t[11]=t[14],t[14]=s,this}setPosition(t,s,e){const n=this.elements;return t instanceof g?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=s,n[14]=e),this}invert(){const t=this.elements,s=t[0],e=t[1],n=t[2],i=t[3],r=t[4],h=t[5],a=t[6],o=t[7],c=t[8],l=t[9],m=t[10],d=t[11],x=t[12],_=t[13],p=t[14],A=t[15],P=l*p*o-_*m*o+_*a*d-h*p*d-l*a*A+h*m*A,w=x*m*o-c*p*o-x*a*d+r*p*d+c*a*A-r*m*A,f=c*_*o-x*l*o+x*h*d-r*_*d-c*h*A+r*l*A,z=x*l*a-c*_*a-x*h*m+r*_*m+c*h*p-r*l*p,I=s*P+e*w+n*f+i*z;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/I;return t[0]=P*M,t[1]=(_*m*i-l*p*i-_*n*d+e*p*d+l*n*A-e*m*A)*M,t[2]=(h*p*i-_*a*i+_*n*o-e*p*o-h*n*A+e*a*A)*M,t[3]=(l*a*i-h*m*i-l*n*o+e*m*o+h*n*d-e*a*d)*M,t[4]=w*M,t[5]=(c*p*i-x*m*i+x*n*d-s*p*d-c*n*A+s*m*A)*M,t[6]=(x*a*i-r*p*i-x*n*o+s*p*o+r*n*A-s*a*A)*M,t[7]=(r*m*i-c*a*i+c*n*o-s*m*o-r*n*d+s*a*d)*M,t[8]=f*M,t[9]=(x*l*i-c*_*i-x*e*d+s*_*d+c*e*A-s*l*A)*M,t[10]=(r*_*i-x*h*i+x*e*o-s*_*o-r*e*A+s*h*A)*M,t[11]=(c*h*i-r*l*i-c*e*o+s*l*o+r*e*d-s*h*d)*M,t[12]=z*M,t[13]=(c*_*n-x*l*n+x*e*m-s*_*m-c*e*p+s*l*p)*M,t[14]=(x*h*n-r*_*n-x*e*a+s*_*a+r*e*p-s*h*p)*M,t[15]=(r*l*n-c*h*n+c*e*a-s*l*a-r*e*m+s*h*m)*M,this}scale(t){const s=this.elements,e=t.x,n=t.y,i=t.z;return s[0]*=e,s[4]*=n,s[8]*=i,s[1]*=e,s[5]*=n,s[9]*=i,s[2]*=e,s[6]*=n,s[10]*=i,s[3]*=e,s[7]*=n,s[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,s=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(s,e,n))}makeTranslation(t,s,e){return t instanceof g?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,s,0,0,1,e,0,0,0,1),this}makeRotationX(t){const s=Math.cos(t),e=Math.sin(t);return this.set(1,0,0,0,0,s,-e,0,0,e,s,0,0,0,0,1),this}makeRotationY(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,0,e,0,0,1,0,0,-e,0,s,0,0,0,0,1),this}makeRotationZ(t){const s=Math.cos(t),e=Math.sin(t);return this.set(s,-e,0,0,e,s,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,s){const e=Math.cos(s),n=Math.sin(s),i=1-e,r=t.x,h=t.y,a=t.z,o=i*r,c=i*h;return this.set(o*r+e,o*h-n*a,o*a+n*h,0,o*h+n*a,c*h+e,c*a-n*r,0,o*a-n*h,c*a+n*r,i*a*a+e,0,0,0,0,1),this}makeScale(t,s,e){return this.set(t,0,0,0,0,s,0,0,0,0,e,0,0,0,0,1),this}makeShear(t,s,e,n,i,r){return this.set(1,e,i,0,t,1,r,0,s,n,1,0,0,0,0,1),this}compose(t,s,e){const n=this.elements,i=s.x,r=s.y,h=s.z,a=s.w,o=i+i,c=r+r,l=h+h,m=i*o,d=i*c,x=i*l,_=r*c,p=r*l,A=h*l,P=a*o,w=a*c,f=a*l,z=e.x,I=e.y,M=e.z;return n[0]=(1-(_+A))*z,n[1]=(d+f)*z,n[2]=(x-w)*z,n[3]=0,n[4]=(d-f)*I,n[5]=(1-(m+A))*I,n[6]=(p+P)*I,n[7]=0,n[8]=(x+w)*M,n[9]=(p-P)*M,n[10]=(1-(m+_))*M,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,s,e){const n=this.elements;let i=Q.set(n[0],n[1],n[2]).length();const r=Q.set(n[4],n[5],n[6]).length(),h=Q.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),t.x=n[12],t.y=n[13],t.z=n[14],V.copy(this);const o=1/i,c=1/r,l=1/h;return V.elements[0]*=o,V.elements[1]*=o,V.elements[2]*=o,V.elements[4]*=c,V.elements[5]*=c,V.elements[6]*=c,V.elements[8]*=l,V.elements[9]*=l,V.elements[10]*=l,s.setFromRotationMatrix(V),e.x=i,e.y=r,e.z=h,this}equals(t){const s=this.elements,e=t.elements;for(let n=0;n<16;n++)if(s[n]!==e[n])return!1;return!0}fromArray(t,s=0){for(let e=0;e<16;e++)this.elements[e]=t[e+s];return this}toArray(t=[],s=0){const e=this.elements;return t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3],t[s+4]=e[4],t[s+5]=e[5],t[s+6]=e[6],t[s+7]=e[7],t[s+8]=e[8],t[s+9]=e[9],t[s+10]=e[10],t[s+11]=e[11],t[s+12]=e[12],t[s+13]=e[13],t[s+14]=e[14],t[s+15]=e[15],t}};at.IDENTITY=Object.freeze(new at);let K=at;const Q=new g,V=new K,fs=new g(0,0,0),ws=new g(1,1,1),F=new g,ut=new g,R=new g;class G{constructor(t=void 0,s=void 0){this.min=t==null?new g(1/0,1/0,1/0):new g(t.x,t.y,t.z),this.max=s==null?new g(-1/0,-1/0,-1/0):new g(s.x,s.y,s.z)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromArray(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s+=3)this.expandByPoint(Lt.fromArray(t,s));return this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=Lt.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new G().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new g(0,0,0):new g(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new g(0,0,0):new g(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let s,e;return t.normal.x>0?(s=t.normal.x*this.min.x,e=t.normal.x*this.max.x):(s=t.normal.x*this.max.x,e=t.normal.x*this.min.x),t.normal.y>0?(s+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(s+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),t.normal.z>0?(s+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(s+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),s<=-t.constant&&e>=-t.constant}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Lt).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(j[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(t),j[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(t),j[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(t),j[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(t),j[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(t),j[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(t),j[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(t),j[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(t),this.setFromPoints(j),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const j=[new g,new g,new g,new g,new g,new g,new g,new g],Lt=new g,ys=new b;class U{constructor(t=void 0,s=void 0){this.min=t==null?new b(1/0,1/0):new b(t.x,t.y),this.max=s==null?new b(-1/0,-1/0):new b(s.x,s.y)}set(t,s){return this.min.copy(t),this.max.copy(s),this}setFromPoints(t){this.makeEmpty();for(let s=0,e=t.length;s<e;s++)this.expandByPoint(t[s]);return this}setFromCenterAndSize(t,s){const e=ys.copy(s).multiplyScalar(.5);return this.min.copy(t).sub(e),this.max.copy(t).add(e),this}clone(){return new U().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new b(0,0):new b(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new b(0,0):new b(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,s){return s.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,s){return s.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ys).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const gs=new g,Ps=new g,bs=new O;class et{constructor(t=new g(1,0,0),s=0){this.normal=t,this.constant=s}set(t,s){return this.normal.copy(t),this.constant=s,this}setComponents(t,s,e,n){return this.normal.set(t,s,e),this.constant=n,this}setFromNormalAndCoplanarPoint(t,s){return this.normal.copy(t),this.constant=-s.dot(this.normal),this}setFromCoplanarPoints(t,s,e){const n=gs.subVectors(e,s).cross(Ps.subVectors(t,s)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,s){return s.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,s){const e=s||bs.getNormalMatrix(t),n=this.coplanarPoint(gs).applyMatrix3d(t),i=this.normal.applyMatrix3(e).normalize();return this.constant=-n.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new et().copy(this)}}class S extends b{static pointArrayToNumberArray(t){const s=new Array(t.length*2);return t.forEach((e,n)=>{e.toArray(s,n*2)}),s}}class E extends g{static pointArrayToNumberArray(t,s=!0){const e=s?3:2,n=new Array(t.length*e);return t.forEach((i,r)=>{i.toArray(n,r*e)}),n}}const _s=new K,As=new st,ct=class ct{constructor(t=0,s=0,e=0,n=ct.DEFAULT_ORDER){this._x=t,this._y=s,this._z=e,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,s,e,n=this._order){return this._x=t,this._y=s,this._z=e,this._order=n,this._onChangeCallback(),this}clone(){return new ct(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,s=this._order,e=!0){const n=t.elements,i=n[0],r=n[4],h=n[8],a=n[1],o=n[5],c=n[9],l=n[2],m=n[6],d=n[10];switch(s){case"XYZ":this._y=Math.asin(q(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,i)):(this._x=Math.atan2(m,o),this._z=0);break;case"YXZ":this._x=Math.asin(-q(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(h,d),this._z=Math.atan2(a,o)):(this._y=Math.atan2(-l,i),this._z=0);break;case"ZXY":this._x=Math.asin(q(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-q(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(m,d),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(q(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-l,i)):(this._x=0,this._y=Math.atan2(h,d));break;case"XZY":this._z=Math.asin(-q(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(m,o),this._y=Math.atan2(h,i)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+s)}return this._order=s,e===!0&&this._onChangeCallback(),this}setFromQuaternion(t,s,e=!0){return _s.makeRotationFromQuaternion(t),this.setFromRotationMatrix(_s,s,e)}setFromVector3(t,s=this._order){return this.set(t.x,t.y,t.z,s)}reorder(t){return As.setFromEuler(this),this.setFromQuaternion(As,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],s=0){return t[s]=this._x,t[s+1]=this._y,t[s+2]=this._z,t[s+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ct.DEFAULT_ORDER="XYZ";let Tt=ct;class ps{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Rt extends ps{translate(t){return this.transform(new O().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ss extends Rt{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new U}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const s=[];for(let e=0;e<this.loops.length;++e){const i=this.loops[e].getPoints(t);s.push(i)}return s}buildHierarchy(){var h;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),e=this.sortBoundaryBoxesByAreas(s),n=new Map,i=e.length;for(let a=0;a<i;a++)n.set(e[a],{index:e[a],children:[]});const r={index:-1,children:[]};for(let a=0;a<i;a++){const o=e[a],c=t[o],l=s[o];let m=a+1;for(;m<i;m++){const d=e[m],x=t[d];if(s[d].containsBox(l)&&as.isPointInPolygon(c[C.randInt(0,c.length-1)],x)){(h=n.get(d))==null||h.children.push(n.get(o));break}}m===i&&r.children.push(n.get(o))}return r}calculateBoundaryBoxes(t){const s=[];return t.forEach(e=>{s.push(new U().setFromPoints(e))}),s}sortBoundaryBoxesByAreas(t){const s=[];t.forEach((n,i)=>{const r=n.size,h=r.width*r.height;s.push({area:h,index:i})}),s.sort((n,i)=>n.area-i.area);const e=[];return s.forEach(n=>{e.push(n.index)}),e}}class W extends Rt{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const s=this.getUtoTmapping(t);return this.getPoint(s)}getPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPoint(e/t));return s}getSpacedPoints(t=5){const s=[];for(let e=0;e<=t;e++)s.push(this.getPointAt(e/t));return s}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const s=[];let e,n=this.getPoint(0),i=0;s.push(0);for(let r=1;r<=t;r++)e=this.getPoint(r/t),i+=e.distanceTo(n),s.push(i),n=e;return s}getUtoTmapping(t,s){const e=this.getLengths();let n=0;const i=e.length;let r;s?r=s:r=t*e[i-1];let h=0,a=i-1,o;for(;h<=a;)if(n=Math.floor(h+(a-h)/2),o=e[n]-r,o<0)h=n+1;else if(o>0)a=n-1;else{a=n;break}if(n=a,e[n]===r)return n/(i-1);const c=e[n],m=e[n+1]-c,d=(r-c)/m;return(n+d)/(i-1)}getTangent(t){let e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);const i=this.getPoint(e),r=this.getPoint(n),h=new S;return h.copy(r).sub(i).normalize(),h}getTangentAt(t){const s=this.getUtoTmapping(t);return this.getTangent(s)}}class nt extends W{constructor(t,s,e,n,i){super();const r=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0)+ +(n!==void 0)+ +(i!==void 0);if(r==3)typeof t=="object"&&typeof s=="object"&&typeof e=="object"?this.createByThreePoints(t,s,e):this.createByStartEndPointsAndBulge(t,s,e);else if(r==5){const h=t;this.center=new S(h.x,h.y),this.radius=s,this.startAngle=e,this.endAngle=n,this.clockwise=i}else throw L.AcCmErrors.ILLEGAL_PARAMETERS}createByThreePoints(t,s,e){const n=(M,N)=>({x:(M.x+N.x)/2,y:(M.y+N.y)/2}),i=(M,N)=>(N.y-M.y)/(N.x-M.x),r=M=>-1/M,h=n(t,s),a=n(s,e),o=i(t,s),c=i(s,e),l=r(o),m=r(c),d=(M,N,H,$)=>{const Z=($-N)/(M-H),J=M*Z+N;return{x:Z,y:J}},x=h.y-l*h.x,_=a.y-m*a.x,p=d(l,x,m,_),A=Math.sqrt(Math.pow(t.x-p.x,2)+Math.pow(t.y-p.y,2)),P=(M,N)=>Math.atan2(M.y-N.y,M.x-N.x),w=P(t,p),f=P(s,p),z=P(e,p),I=z>w&&z<f||w>z&&w<f||f>z&&f<w;this.center=p,this.radius=A,this.startAngle=w,this.endAngle=z,this.clockwise=!I}createByStartEndPointsAndBulge(t,s,e){let n,i,r;e<0?(n=Math.atan(-e)*4,i=new b(t),r=new b(s)):(n=Math.atan(e)*4,i=new b(s),r=new b(t));const h=new b().subVectors(r,i),a=h.length(),o=new b().addVectors(i,h.multiplyScalar(.5)),c=Math.abs(a/2/Math.tan(n/2)),l=h.normalize();let m;if(n<Math.PI){const d=new b(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));m=o.add(d.multiplyScalar(-c))}else{const d=new b(l.x*Math.cos(Math.PI/2)-l.y*Math.sin(Math.PI/2),l.y*Math.cos(Math.PI/2)+l.x*Math.sin(Math.PI/2));m=o.add(d.multiplyScalar(c))}e<0?(this.startAngle=Math.atan2(i.y-m.y,i.x-m.x),this.endAngle=Math.atan2(r.y-m.y,r.x-m.x)):(this.startAngle=Math.atan2(r.y-m.y,r.x-m.x),this.endAngle=Math.atan2(i.y-m.y,i.x-m.x)),this.clockwise=e<0,this.center=m,this.radius=r.sub(m).length()}get center(){return this._center}set center(t){this._center=new S(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?C.normalizeAngle(this.startAngle-this.endAngle):C.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=C.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(t)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],s=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of s)C.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&t.push(this.getPointAtAngle(i));const e=t.map(i=>i.x),n=t.map(i=>i.y);return new U(new S(Math.min(...e),Math.min(...n)),new S(Math.max(...e),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new nt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(t){const s=this.center.x+this.radius*Math.cos(t),e=this.center.y+this.radius*Math.sin(t);return new S(s,e)}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;if(this.closed&&(e=B,n=0),this.clockwise)for(let i=0;i<=t;i++){const r=n-e*(i/t),h=this.getPointAtAngle(r);s.push(new S(h.x,h.y))}else for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(new S(h.x,h.y))}return s}}class Cs extends ps{translate(t){return this.transform(new K().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class dt extends Cs{}class it extends dt{constructor(t,s){super(),this._start=new E(t),this._end=new E(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new g().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new E((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,s){return this.delta(s).multiplyScalar(t).add(this._start)}atLength(t,s=!1){if(s){const e=this.delta(D).normalize();return new E(this._start).addScaledVector(e,t)}else{const e=this.delta(D).normalize();return new E(this._end).addScaledVector(e,t)}}extend(t,s=!1){if(s){const e=D.subVectors(this._start,this._end).normalize();this._start=new E(this._start).addScaledVector(e,t)}else{const e=this.delta(D).normalize();this._end=new E(this._end).addScaledVector(e,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,s){Ms.subVectors(t,this._start),mt.subVectors(this.endPoint,this.startPoint);const e=mt.dot(mt);let i=mt.dot(Ms)/e;return s&&(i=C.clamp(i,0,1)),i}closestPointToPoint(t,s,e){const n=this.closestPointToPointParameter(t,s);return this.delta(e).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const s=this.direction,n=D.subVectors(t,this.startPoint).dot(s);return new E().copy(s).multiplyScalar(n).add(this.startPoint)}perpPoint(t){const s=this.direction,e=this.startPoint,i=D.subVectors(t,e).dot(s),r=D.copy(s).multiplyScalar(i);return new E().addVectors(e,r)}calculateBoundingBox(){const t=new E(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),s=new E(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new G(t,s)}transform(t){return this._start.applyMatrix3d(t),this._end.applyMatrix3d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new it(this._start.clone(),this._end.clone())}}const D=new g,Ms=new g,mt=new g;class rt extends dt{static computeCenterPoint(t,s,e){const n=new g().addVectors(t,s).multiplyScalar(.5),i=new g().addVectors(t,e).multiplyScalar(.5),r=new g().subVectors(s,t),h=new g().subVectors(e,t),a=new g().crossVectors(r,h).normalize();if(a.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const o=new g().crossVectors(r,a).normalize(),c=new g().crossVectors(h,a).normalize(),l=o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),d=new it(n,n.clone().add(l)),x=new it(i,i.clone().add(m)),_=new g;return d.closestPointToPoint(x.startPoint,!0,_)?_:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,s,e){const n=rt.computeCenterPoint(t,s,e);if(n){const i=n.distanceTo(t),r=new g().subVectors(t,n),h=new g().subVectors(s,n),a=Math.atan2(r.y,r.x),o=Math.atan2(h.y,h.x);return new rt(n,i,a,o,g.Z_AXIS)}}constructor(t,s,e,n,i,r=g.X_AXIS){super(),this.center=t,this.radius=s,this.startAngle=e,this.endAngle=n,this.normal=i,this.refVec=r,(n-e)%B==0?(this.startAngle=0,this.endAngle=B):(this.startAngle=e,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new g(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new g(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)C.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>r&&(r=o.y),o.z>h&&(h=o.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=B,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(h)}return s}transform(t){const s=Ut.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),e=Ut.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(t),s.applyMatrix3d(t),e.applyMatrix3d(t),this.normal.applyMatrix3d(t).normalize(),this.refVec.applyMatrix3d(t).normalize(),this.startAngle=this.getAngle(s),this.endAngle=this.getAngle(e),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new rt(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Ut.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const s=this.normal,e=this.refVec,n={x:s.y*e.z-s.z*e.y,y:s.z*e.x-s.x*e.z,z:s.x*e.y-s.y*e.x},i=this.center,r=this.radius;return new E(i.x+r*(e.x*Math.cos(t)+n.x*Math.sin(t)),i.y+r*(e.y*Math.cos(t)+n.y*Math.sin(t)),i.z+r*(e.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new g(this.center).distanceTo(It);return new et(this.normal,t)}}const Ut=new g;class Vt extends W{constructor(t,s,e,n=0,i=B,r=!1,h=0){super(),this.center=t,this.majorAxisRadius=s,this.minorAxisRadius=e,(i-n)%B==0?(this.startAngle=0,this.endAngle=B):(this.startAngle=n,this.endAngle=i),this.clockwise=r,this.rotation=h}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return C.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let s=1/0,e=1/0,n=-1/0,i=-1/0;for(let r=0;r<=100;r++){const h=this.getPoint(r/100);s=Math.min(s,h.x),e=Math.min(e,h.y),n=Math.max(n,h.x),i=Math.max(i,h.y)}return new U({x:s,y:e},{x:n,y:i})}get closed(){return this.deltaAngle==0}getPoint(t){const s=Math.PI*2;let e=this.endAngle-this.startAngle;const n=Math.abs(e)<Number.EPSILON;for(;e<0;)e+=s;for(;e>s;)e-=s;e<Number.EPSILON&&(n?e=0:e=s),this.clockwise===!0&&!n&&(e===s?e=-s:e=e-s);const i=this.startAngle+t*e;let r=this.center.x+this.majorAxisRadius*Math.cos(i),h=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const a=Math.cos(this.rotation),o=Math.sin(this.rotation),c=r-this.center.x,l=h-this.center.y;r=c*a-l*o+this.center.x,h=c*o+l*a+this.center.y}return new S(r,h)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new Vt(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class qt extends dt{constructor(t,s,e,n,i,r=0,h=B){super(),this.center=t,this.normal=s,this.majorAxis=e,this.majorAxisRadius=n,this.minorAxisRadius=i;const a=Math.abs(h-r);Math.abs(a-B)<1e-10||Math.abs(a-2*B)<1e-10?(this.startAngle=0,this.endAngle=B):(this.startAngle=r,this.endAngle=h)}get center(){return this._center}set center(t){this._center=new E(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw L.AcCmErrors.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==B?t:C.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-B)<1e-10?B:C.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new g(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new g(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new g().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){const s=this.deltaAngle/1e3;let e=0,n=this.getPointAtAngle(this.startAngle);for(let i=1;i<=1e3;i++){const r=this.startAngle+i*s,h=this.getPointAtAngle(r),a=h.x-n.x,o=h.y-n.y,c=h.z-n.z;e+=Math.sqrt(a*a+o*o+c*c),n=h}return e}calculateBoundingBox(){if(this.majorAxis.equals(g.X_AXIS)||this.majorAxis.equals(g.Y_AXIS)||this.majorAxis.isParallelTo(g.X_AXIS)||this.majorAxis.isParallelTo(g.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let a=0;a<2*Math.PI;a+=Math.PI/2)C.isBetweenAngle(a,this.startAngle,this.endAngle)&&t.push(a);let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(const a of t){const o=this.getPointAtAngle(a);o.x<s&&(s=o.x),o.y<e&&(e=o.y),o.z<n&&(n=o.z),o.x>i&&(i=o.x),o.y>r&&(r=o.y),o.z>h&&(h=o.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}else{let s=1/0,e=1/0,n=1/0,i=-1/0,r=-1/0,h=-1/0;for(let a=0;a<=100;a++){const o=this.startAngle+this.deltaAngle*(a/100),c=this.getPointAtAngle(o);s=Math.min(s,c.x),e=Math.min(e,c.y),n=Math.min(n,c.z),i=Math.max(i,c.x),r=Math.max(r,c.y),h=Math.max(h,c.z)}return new G({x:s,y:e,z:n},{x:i,y:r,z:h})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const s=[];let e=this.deltaAngle,n=this.startAngle;this.closed&&(e=B,n=0);for(let i=0;i<=t;i++){const r=n+e*(i/t),h=this.getPointAtAngle(r);s.push(h)}return s}getPointAtAngle(t){const s=Math.cos(t),e=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e),i=this.majorAxis.clone().multiplyScalar(s*this.majorAxisRadius).add(n);return new E(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(t){const s=new g(t).sub(this.center),e=s.dot(this.majorAxis),n=s.dot(this.minorAxis),i=e/this.majorAxisRadius,r=n/this.minorAxisRadius;return i*i+r*r<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new qt(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new g(this.center).distanceTo(It);return new et(this.normal,t)}}class Es extends W{constructor(t=null,s=!1){super(),this._vertices=t||new Array,this._closed=s}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const s=this._vertices[0];return new S(s.x,s.y)}else{const s=this._vertices[t-1];return new S(s.x,s.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const s=this._vertices.length;for(let e=0;e<s;++e){const n=this._vertices[e];let i=null;if(e<s-1?i=this._vertices[e+1]:e==s-1&&this.closed&&(i=this._vertices[0]),i)if(n.bulge){const r=new nt(n,i,n.bulge);t+=r.length}else t+=new S(n.x,n.y).distanceTo(i)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,s){t<=0?this._vertices.unshift(s):this._vertices.splice(t,0,s),this._boundingBoxNeedsUpdate=!0}getPointAt(t){const s=this._vertices[t];return new S(s.x,s.y)}calculateBoundingBox(){const t=this.getPoints(100);return new U().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,s){const e=[];return this.getPoints(t).forEach(i=>e.push(new E().set(i.x,i.y,s))),e}getPoints(t){const s=[],e=this._vertices.length;for(let n=0;n<e;++n){const i=this._vertices[n];if(i.bulge){let r=null;if(n<e-1?r=this._vertices[n+1]:n==e-1&&this.closed&&(r=this._vertices[0]),r){const a=new nt(i,r,i.bulge).getPoints(t),o=a.length;for(let c=0;c<o;++c){const l=a[c];s.push(new S(l.x,l.y))}}}else s.push(new S(i.x,i.y)),n==e-1&&this.closed&&s.push(s[0])}return s}}class jt extends W{constructor(t,s){super(),this._start=new S(t),this._end=new S(s)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new S(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),s=new S(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new U(t,s)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new jt(this._start.clone(),this._end.clone())}}class Is extends W{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new S(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(s=>{t+=s.length}),t}calculateBoundingBox(){const t=this.getPoints(100),s=new U;return s.setFromPoints(t),s}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const s=[];return this.curves.forEach(e=>{e.getPoints(t).forEach(n=>{s.push(new S(n.x,n.y))})}),s}}class Y{constructor(t,s,e,n){this._degree=t,this._knots=[...s],this._controlPoints=e.map(i=>[...i]),this._weights=n?[...n]:new Array(e.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>[...t])}weights(){return[...this._weights]}point(t){return tt(t,this._degree,this._knots,this._controlPoints,this._weights)}length(){return ds(this._degree,this._knots,this._controlPoints,this._weights)}static byKnotsControlPointsWeights(t,s,e,n){return new Y(t,s,e,n)}static byPoints(t,s,e="Uniform"){let n;switch(e){case"Chord":n=ls(s,t);break;case"SqrtChord":n=us(s,t);break;case"Uniform":default:n=cs(s,t.length);break}const i=ms(t),r=new Array(i.length).fill(1);return new Y(s,n,i,r)}}class Bs extends dt{constructor(t,s,e){super();const n=+(t!==void 0)+ +(s!==void 0)+ +(e!==void 0);if(n!=2&&n!=3)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const i=3;if(this._closed=!1,n==2&&!Array.isArray(s)){if(this._fitPoints=t,this._knotParameterization=s,this._fitPoints.length<4)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Y.byPoints(r,i,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints()),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=[...this._nurbsCurve.weights()]}else{if(this._controlPoints=t,this._controlPoints.length<4)throw L.AcCmErrors.ILLEGAL_PARAMETERS;const r=this.toNurbsPoints(this._controlPoints);this._nurbsCurve=Y.byKnotsControlPointsWeights(i,s,r,e),this._originalControlPoints=[...this._controlPoints],this._originalKnots=[...this._nurbsCurve.knots()],this._originalWeights=e?[...e]:new Array(this._controlPoints.length).fill(1)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,t?this.makeClosed():this.makeOpen())}makeClosed(){const t=this._nurbsCurve.degree(),s=this._nurbsCurve.controlPoints(),e=this._nurbsCurve.knots(),n=this._nurbsCurve.weights(),i=[...s],r=[...n];for(let a=0;a<t;a++)i.push([...s[a]]),r.push(n[a]);const h=this.createClosedKnotVector(e,t);this._nurbsCurve=Y.byKnotsControlPointsWeights(t,h,i,r),this._controlPoints=this.toGePoints(i)}makeOpen(){if(!this._originalControlPoints||!this._originalKnots||!this._originalWeights)throw new Error("Original curve data not available");const t=this._nurbsCurve.degree(),s=this.toNurbsPoints(this._originalControlPoints);this._nurbsCurve=Y.byKnotsControlPointsWeights(t,this._originalKnots,s,this._originalWeights),this._controlPoints=[...this._originalControlPoints]}createClosedKnotVector(t,s){const e=[...t],n=t[t.length-1],i=t[0],r=(n-i)/(t.length-1),h=s;for(let a=1;a<=h;a++)e.push(n+a*r);return e}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[s],n=this._nurbsCurve.point(e);return new E(n[0],n[1],n[2])}get endPoint(){if(this._closed)return this.startPoint;const t=this._nurbsCurve.knots(),s=this._nurbsCurve.degree(),e=t[t.length-s-1],n=this._nurbsCurve.point(e);return new E(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const s=this._fitPoints.length,e=t<0||t>=s?s-1:t,n=this._fitPoints[e];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const s=this._controlPoints.length,e=t<0||t>=s?s-1:t;return this._controlPoints[e]}getPoints(t=100){const s=this._nurbsCurve,e=[],n=s.knots(),i=this._nurbsCurve.degree(),r=n[i],h=n[n.length-i-1];if(this._closed){const a=(h-r)/(t-1);for(let o=0;o<t;o++){let c;o===t-1?c=r:c=r+o*a;const l=s.point(c);e.push(new E(l[0],l[1],l[2]))}}else{const a=(h-r)/(t-1);for(let o=0;o<t;o++){const c=o===t-1?h:r+o*a,l=s.point(c);e.push(new E(l[0],l[1],l[2]))}}return e}getCurvePoints(t,s){const e=[],n=t.knots(),i=n[3],h=(n[n.length-4]-i)/(s-1);for(let a=0;a<s;a++){const o=i+a*h;e.push(t.point(o))}return e}calculateBoundingBox(){const t=this.getPoints(100);return new G().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]=[e.x,e.y,e.z||0]}),s}toGePoints(t){const s=new Array(t.length);return t.forEach((e,n)=>{s[n]={x:e[0],y:e[1],z:e[2]}}),s}}y.AcGeArea2d=Ss,y.AcGeBox2d=U,y.AcGeBox3d=G,y.AcGeCircArc2d=nt,y.AcGeCircArc3d=rt,y.AcGeCurve2d=W,y.AcGeEllipseArc2d=Vt,y.AcGeEllipseArc3d=qt,y.AcGeEuler=Tt,y.AcGeGeometryUtil=as,y.AcGeLine2d=jt,y.AcGeLine3d=it,y.AcGeLoop2d=Is,y.AcGeMathUtil=C,y.AcGeMatrix2d=O,y.AcGeMatrix3d=K,y.AcGePlane=et,y.AcGePoint2d=S,y.AcGePoint3d=E,y.AcGePolyline2d=Es,y.AcGeQuaternion=st,y.AcGeShape2d=Rt,y.AcGeSpline3d=Bs,y.AcGeTol=hs,y.AcGeVector2d=b,y.AcGeVector3d=g,y.DEFAULT_TOL=Bt,y.DEG2RAD=wt,y.FLOAT_TOL=X,y.ORIGIN_POINT_2D=zs,y.ORIGIN_POINT_3D=It,y.RAD2DEG=Pt,y.TAU=B,y.basisFunction=lt,y.calculateCurveLength=ds,y.ceilPowerOfTwo=ss,y.clamp=q,y.damp=Yt,y.degToRad=Jt,y.euclideanModulo=bt,y.evaluateNurbsPoint=tt,y.floorPowerOfTwo=es,y.generateChordKnots=ls,y.generateSqrtChordKnots=us,y.generateUUID=Gt,y.generateUniformKnots=cs,y.intPartLength=Ct,y.interpolateControlPoints=ms,y.inverseLerp=Dt,y.isBetween=ns,y.isBetweenAngle=is,y.isPointInPolygon=kt,y.isPolygonIntersect=os,y.isPowerOfTwo=ts,y.lerp=St,y.mapLinear=Xt,y.normalizeAngle=v,y.pingpong=Zt,y.radToDeg=vt,y.randFloat=Wt,y.randFloatSpread=Ht,y.randInt=Qt,y.relativeEps=rs,y.seededRandom=$t,y.smootherstep=Kt,y.smoothstep=Ot,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- {"version":3,"file":"AcGeSpline3d.d.ts","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],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O,CAAS;IACxB,OAAO,CAAC,sBAAsB,CAAC,CAAiB;IAChD,OAAO,CAAC,cAAc,CAAC,CAAU;IACjC,OAAO,CAAC,gBAAgB,CAAC,CAAU;gBAGjC,aAAa,EAAE,aAAa,EAAE,EAC9B,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,MAAM,EAAE;gBAGlB,SAAS,EAAE,aAAa,EAAE,EAC1B,SAAS,EAAE,4BAA4B;IA6DzC;;OAEG;IACH,OAAO,CAAC,SAAS;IAejB;;OAEG;IACH,OAAO,CAAC,UAAU;IAgClB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAuBhB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA6B9B;;OAEG;IACH,IAAI,MAAM,WAET;IAED,IAAI,oBAAoB,6CAEvB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,WAAW,CAM5B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,WAAW,CAW1B;IAED;;OAEG;IACH,IAAI,MAAM,WAET;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe;IAU7C;;;;;;OAMG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAM/B;;;;;OAKG;IACH,SAAS,CAAC,SAAS,GAAE,MAAY,GAAG,WAAW,EAAE;IAuCjD,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM;IAkB/C;;OAEG;IACH,oBAAoB;IAKpB,IAAI,MAAM,IAGQ,OAAO,CADxB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAExB;IAED;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,YAAY;IAM/B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAQrB;;;;OAIG;IACH,OAAO,CAAC,UAAU;CAOnB"}
@@ -175,18 +175,17 @@ var AcGeSpline3d = /** @class */ (function (_super) {
175
175
  var originalControlPoints = this._nurbsCurve.controlPoints();
176
176
  var originalKnots = this._nurbsCurve.knots();
177
177
  var originalWeights = this._nurbsCurve.weights();
178
- // For a closed curve, we need to add control points at the end
179
- // that ensure the curve closes smoothly
178
+ // For a proper closed curve, we need to ensure the curve closes at the same point
179
+ // The key is to create a periodic curve where the end connects smoothly to the beginning
180
180
  var closedControlPoints = __spreadArray([], __read(originalControlPoints), false);
181
181
  var closedWeights = __spreadArray([], __read(originalWeights), false);
182
- // Add control points to close the curve
183
- // For a degree 3 curve, we typically need 3 additional control points
182
+ // For a degree 3 curve, we need to add control points that ensure smooth closure
183
+ // We add the first 'degree' control points at the end to create continuity
184
184
  for (var i = 0; i < degree; i++) {
185
- // Use the first control point to ensure the curve closes
186
- closedControlPoints.push(__spreadArray([], __read(originalControlPoints[0]), false));
187
- closedWeights.push(originalWeights[0]);
185
+ closedControlPoints.push(__spreadArray([], __read(originalControlPoints[i]), false));
186
+ closedWeights.push(originalWeights[i]);
188
187
  }
189
- // Create new knot vector for closed curve
188
+ // Create a periodic knot vector for the closed curve
190
189
  var closedKnots = this.createClosedKnotVector(originalKnots, degree);
191
190
  // Create new NURBS curve
192
191
  this._nurbsCurve = NurbsCurve.byKnotsControlPointsWeights(degree, closedKnots, closedControlPoints, closedWeights);
@@ -211,18 +210,22 @@ var AcGeSpline3d = /** @class */ (function (_super) {
211
210
  * Create knot vector for closed curve
212
211
  */
213
212
  AcGeSpline3d.prototype.createClosedKnotVector = function (originalKnots, degree) {
214
- // For a closed curve, we need to create a proper knot vector
213
+ // For a closed curve, we need to create a proper periodic knot vector
215
214
  // that allows the curve to close smoothly
216
215
  // Start with the original knots
217
216
  var closedKnots = __spreadArray([], __read(originalKnots), false);
218
217
  // For a closed curve, we need to extend the knot vector
219
218
  // The key is to ensure that the curve can actually close
220
219
  var lastKnot = originalKnots[originalKnots.length - 1];
220
+ var firstKnot = originalKnots[0];
221
+ // Calculate the knot spacing from the original curve
222
+ var knotSpacing = (lastKnot - firstKnot) / (originalKnots.length - 1);
221
223
  // Add knots for the additional control points
222
- // Use a spacing that ensures the curve closes properly
224
+ // For a closed curve, we need to ensure the curve closes at the same point
225
+ // We add knots that extend the parameter range appropriately
223
226
  var additionalKnots = degree;
224
227
  for (var i = 1; i <= additionalKnots; i++) {
225
- closedKnots.push(lastKnot + i);
228
+ closedKnots.push(lastKnot + i * knotSpacing);
226
229
  }
227
230
  return closedKnots;
228
231
  };
@@ -262,6 +265,10 @@ var AcGeSpline3d = /** @class */ (function (_super) {
262
265
  * The end point of this spline
263
266
  */
264
267
  get: function () {
268
+ if (this._closed) {
269
+ // For closed splines, the end point should be the same as the start point
270
+ return this.startPoint;
271
+ }
265
272
  var knots = this._nurbsCurve.knots();
266
273
  var degree = this._nurbsCurve.degree();
267
274
  var endParam = knots[knots.length - degree - 1];
@@ -325,13 +332,32 @@ var AcGeSpline3d = /** @class */ (function (_super) {
325
332
  var degree = this._nurbsCurve.degree();
326
333
  var startParam = knots[degree];
327
334
  var endParam = knots[knots.length - degree - 1];
328
- // Adjust step size for correct range
329
- var step = (endParam - startParam) / (numPoints - 1);
330
- for (var i = 0; i < numPoints; i++) {
331
- // For the last point, use endParam exactly to avoid floating-point issues
332
- var t = i === numPoints - 1 ? endParam : startParam + i * step;
333
- var point = curve.point(t);
334
- points.push(new AcGePoint3d(point[0], point[1], point[2]));
335
+ if (this._closed) {
336
+ // For closed splines, ensure the curve closes properly
337
+ // We need to ensure the first and last points are the same
338
+ var step = (endParam - startParam) / (numPoints - 1);
339
+ for (var i = 0; i < numPoints; i++) {
340
+ var t = void 0;
341
+ if (i === numPoints - 1) {
342
+ // For the last point, use the start parameter to ensure closure
343
+ t = startParam;
344
+ }
345
+ else {
346
+ t = startParam + i * step;
347
+ }
348
+ var point = curve.point(t);
349
+ points.push(new AcGePoint3d(point[0], point[1], point[2]));
350
+ }
351
+ }
352
+ else {
353
+ // For open splines, use the original logic
354
+ var step = (endParam - startParam) / (numPoints - 1);
355
+ for (var i = 0; i < numPoints; i++) {
356
+ // For the last point, use endParam exactly to avoid floating-point issues
357
+ var t = i === numPoints - 1 ? endParam : startParam + i * step;
358
+ var point = curve.point(t);
359
+ points.push(new AcGePoint3d(point[0], point[1], point[2]));
360
+ }
335
361
  }
336
362
  return points;
337
363
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AcGeSpline3d.js","sourceRoot":"","sources":["../../src/geometry/AcGeSpline3d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EACL,SAAS,EAET,WAAW,EAGZ,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C;;GAEG;AACH;IAME,oBACE,MAAc,EACd,KAAe,EACf,aAAyB,EACzB,OAAkB;QAElB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,MAAM,4BAAO,KAAK,SAAC,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,gCAAI,CAAC,WAAL,CAAM,CAAC,CAAA;QACpD,IAAI,CAAC,QAAQ,GAAG,OAAO;YACrB,CAAC,0BAAK,OAAO,UACb,CAAC,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,CAAC;IAED,2BAAM,GAAN;QACE,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,0BAAK,GAAL;QACE,gCAAW,IAAI,CAAC,MAAM,UAAC;IACzB,CAAC;IAED,kCAAa,GAAb;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,gCAAI,CAA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0.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "keywords": [