@mlightcad/geometry-engine 1.0.7 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { AcCmErrors as T } from "@mlightcad/common";
2
- const k = [
1
+ import { AcCmErrors as L } from "@mlightcad/common";
2
+ const R = [
3
3
  "00",
4
4
  "01",
5
5
  "02",
@@ -257,113 +257,113 @@ const k = [
257
257
  "fe",
258
258
  "ff"
259
259
  ];
260
- let St = 1234567;
261
- const Rt = Math.PI / 180, Tt = 180 / Math.PI;
262
- function Qt() {
260
+ let Ct = 1234567;
261
+ const Lt = Math.PI / 180, Ut = 180 / Math.PI;
262
+ function $t() {
263
263
  const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
264
- 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();
264
+ return (R[u & 255] + R[u >> 8 & 255] + R[u >> 16 & 255] + R[u >> 24 & 255] + "-" + R[t & 255] + R[t >> 8 & 255] + "-" + R[t >> 16 & 15 | 64] + R[t >> 24 & 255] + "-" + R[s & 63 | 128] + R[s >> 8 & 255] + "-" + R[s >> 16 & 255] + R[s >> 24 & 255] + R[e & 255] + R[e >> 8 & 255] + R[e >> 16 & 255] + R[e >> 24 & 255]).toLowerCase();
265
265
  }
266
- function j(u, t, s) {
266
+ function X(u, t, s) {
267
267
  return Math.max(t, Math.min(s, u));
268
268
  }
269
- function Vt(u, t) {
269
+ function qt(u, t) {
270
270
  return (u % t + t) % t;
271
271
  }
272
- function Ot(u, t, s, e, n) {
272
+ function Wt(u, t, s, e, n) {
273
273
  return e + (u - t) * (n - e) / (s - t);
274
274
  }
275
- function Wt(u, t, s) {
275
+ function Jt(u, t, s) {
276
276
  return u !== t ? (s - u) / (t - u) : 0;
277
277
  }
278
- function Ut(u, t, s) {
278
+ function Vt(u, t, s) {
279
279
  return (1 - s) * u + s * t;
280
280
  }
281
- function Ht(u, t, s, e) {
282
- return Ut(u, t, 1 - Math.exp(-s * e));
281
+ function vt(u, t, s, e) {
282
+ return Vt(u, t, 1 - Math.exp(-s * e));
283
283
  }
284
- function $t(u, t = 1) {
285
- return t - Math.abs(Vt(u, t * 2) - t);
284
+ function ts(u, t = 1) {
285
+ return t - Math.abs(qt(u, t * 2) - t);
286
286
  }
287
- function Jt(u, t, s) {
287
+ function ss(u, t, s) {
288
288
  return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * (3 - 2 * u));
289
289
  }
290
- function vt(u, t, s) {
290
+ function es(u, t, s) {
291
291
  return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * u * (u * (u * 6 - 15) + 10));
292
292
  }
293
- function ts(u, t) {
293
+ function ns(u, t) {
294
294
  return u + Math.floor(Math.random() * (t - u + 1));
295
295
  }
296
- function ss(u, t) {
296
+ function is(u, t) {
297
297
  return u + Math.random() * (t - u);
298
298
  }
299
- function es(u) {
299
+ function rs(u) {
300
300
  return u * (0.5 - Math.random());
301
301
  }
302
- function ns(u) {
303
- u !== void 0 && (St = u);
304
- let t = St += 1831565813;
302
+ function hs(u) {
303
+ u !== void 0 && (Ct = u);
304
+ let t = Ct += 1831565813;
305
305
  return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
306
306
  }
307
- function is(u) {
308
- return u * Rt;
307
+ function os(u) {
308
+ return u * Lt;
309
309
  }
310
- function rs(u) {
311
- return u * Tt;
310
+ function as(u) {
311
+ return u * Ut;
312
312
  }
313
- function hs(u) {
313
+ function cs(u) {
314
314
  return (u & u - 1) === 0 && u !== 0;
315
315
  }
316
- function os(u) {
316
+ function ls(u) {
317
317
  return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
318
318
  }
319
- function as(u) {
319
+ function us(u) {
320
320
  return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
321
321
  }
322
- function mt(u) {
322
+ function xt(u) {
323
323
  const t = Math.PI * 2;
324
324
  return (u % t + t) % t;
325
325
  }
326
- function cs(u, t, s) {
326
+ function ds(u, t, s) {
327
327
  return u > t && u < s || u > s && u < t;
328
328
  }
329
- function ls(u, t, s, e = !1) {
330
- return u = mt(u), t = mt(t), s = mt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
329
+ function ms(u, t, s, e = !1) {
330
+ return u = xt(u), t = xt(t), s = xt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
331
331
  }
332
- function qt(u) {
332
+ function jt(u) {
333
333
  return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
334
334
  }
335
- function us(u, t = 1e-7) {
336
- const s = qt(u);
335
+ function xs(u, t = 1e-7) {
336
+ const s = jt(u);
337
337
  return Math.max(Math.pow(10, s) * t, t);
338
338
  }
339
339
  const C = {
340
- DEG2RAD: Rt,
341
- RAD2DEG: Tt,
342
- generateUUID: Qt,
343
- clamp: j,
344
- euclideanModulo: Vt,
345
- mapLinear: Ot,
346
- inverseLerp: Wt,
347
- lerp: Ut,
348
- damp: Ht,
349
- pingpong: $t,
350
- smoothstep: Jt,
351
- smootherstep: vt,
352
- randInt: ts,
353
- randFloat: ss,
354
- randFloatSpread: es,
355
- seededRandom: ns,
356
- degToRad: is,
357
- radToDeg: rs,
358
- isPowerOfTwo: hs,
359
- ceilPowerOfTwo: os,
360
- floorPowerOfTwo: as,
361
- normalizeAngle: mt,
362
- isBetween: cs,
363
- isBetweenAngle: ls,
364
- intPartLength: qt,
365
- relativeEps: us
366
- }, W = class W {
340
+ DEG2RAD: Lt,
341
+ RAD2DEG: Ut,
342
+ generateUUID: $t,
343
+ clamp: X,
344
+ euclideanModulo: qt,
345
+ mapLinear: Wt,
346
+ inverseLerp: Jt,
347
+ lerp: Vt,
348
+ damp: vt,
349
+ pingpong: ts,
350
+ smoothstep: ss,
351
+ smootherstep: es,
352
+ randInt: ns,
353
+ randFloat: is,
354
+ randFloatSpread: rs,
355
+ seededRandom: hs,
356
+ degToRad: os,
357
+ radToDeg: as,
358
+ isPowerOfTwo: cs,
359
+ ceilPowerOfTwo: ls,
360
+ floorPowerOfTwo: us,
361
+ normalizeAngle: xt,
362
+ isBetween: ds,
363
+ isBetweenAngle: ms,
364
+ intPartLength: jt,
365
+ relativeEps: xs
366
+ }, K = class K {
367
367
  /**
368
368
  * Construct one vector by two numbers
369
369
  */
@@ -384,7 +384,7 @@ const C = {
384
384
  this.x = t, this.y = s;
385
385
  return;
386
386
  }
387
- throw T.ILLEGAL_PARAMETERS;
387
+ throw L.ILLEGAL_PARAMETERS;
388
388
  }
389
389
  }
390
390
  /**
@@ -479,7 +479,7 @@ const C = {
479
479
  * @returns Return the cloned vector
480
480
  */
481
481
  clone() {
482
- return new W(this.x, this.y);
482
+ return new K(this.x, this.y);
483
483
  }
484
484
  /**
485
485
  * Copy the values of the passed vector's x and y properties to this vector.
@@ -859,9 +859,9 @@ const C = {
859
859
  yield this.x, yield this.y;
860
860
  }
861
861
  };
862
- W.EMPTY = Object.freeze(new W(0, 0));
863
- let P = W;
864
- const H = class H {
862
+ K.EMPTY = Object.freeze(new K(0, 0));
863
+ let b = K;
864
+ const $ = class $ {
865
865
  /**
866
866
  * Create a 3x3 matrix with the given arguments in row-major order. If no arguments are provided,
867
867
  * the constructor initializes the Matrix3 to the 3x3 identity matrix.
@@ -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, h = e[0], r = e[3], a = e[6], o = e[1], c = e[4], l = e[7], d = e[2], m = 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], B = n[5], z = n[8];
958
- return i[0] = h * g + r * f + a * M, i[3] = h * p + r * w + a * B, i[6] = h * _ + r * A + a * z, i[1] = o * g + c * f + l * M, i[4] = o * p + c * w + l * B, i[7] = o * _ + c * A + l * z, i[2] = d * g + m * f + x * M, i[5] = d * p + m * w + x * B, i[8] = d * _ + m * A + x * z, this;
957
+ const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[3], a = e[6], o = e[1], c = e[4], l = e[7], d = e[2], m = e[5], x = e[8], y = n[0], _ = n[3], p = n[6], P = n[1], w = n[4], f = n[7], M = n[2], B = n[5], z = n[8];
958
+ return i[0] = h * y + r * P + a * M, i[3] = h * _ + r * w + a * B, i[6] = h * p + r * f + a * z, i[1] = o * y + c * P + l * M, i[4] = o * _ + c * w + l * B, i[7] = o * p + c * f + l * z, i[2] = d * y + m * P + x * M, i[5] = d * _ + m * w + x * B, i[8] = d * p + m * f + x * z, this;
959
959
  }
960
960
  /**
961
961
  * Multiply every component of the matrix by the scalar value s.
@@ -982,8 +982,8 @@ const H = class H {
982
982
  invert() {
983
983
  const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = c * h - r * o, d = r * a - c * i, m = o * i - h * a, x = s * l + e * d + n * m;
984
984
  if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
985
- const g = 1 / x;
986
- return t[0] = l * g, t[1] = (n * o - c * e) * g, t[2] = (r * e - n * h) * g, t[3] = d * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - r * s) * g, t[6] = m * g, t[7] = (e * a - o * s) * g, t[8] = (h * s - e * i) * g, this;
985
+ const y = 1 / x;
986
+ return t[0] = l * y, t[1] = (n * o - c * e) * y, t[2] = (r * e - n * h) * y, t[3] = d * y, t[4] = (c * s - n * a) * y, t[5] = (n * i - r * s) * y, t[6] = m * y, t[7] = (e * a - o * s) * y, t[8] = (h * s - e * i) * y, this;
987
987
  }
988
988
  /**
989
989
  * Transpose this matrix in place.
@@ -1071,7 +1071,7 @@ const H = class H {
1071
1071
  * @returns Return this matrix
1072
1072
  */
1073
1073
  makeTranslation(t, s) {
1074
- return t instanceof P ? 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;
1074
+ 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;
1075
1075
  }
1076
1076
  /**
1077
1077
  * Set this matrix as a 2D rotational transformation by theta radians
@@ -1128,25 +1128,25 @@ const H = class H {
1128
1128
  * @returns Return the cloned matrix
1129
1129
  */
1130
1130
  clone() {
1131
- return new H().fromArray(this.elements);
1131
+ return new $().fromArray(this.elements);
1132
1132
  }
1133
1133
  };
1134
- H.IDENTITY = Object.freeze(new H());
1135
- let v = H;
1136
- const At = /* @__PURE__ */ new v(), Q = 1e-6, I = 2 * Math.PI, Ss = {
1134
+ $.IDENTITY = Object.freeze(new $());
1135
+ let v = $;
1136
+ const At = /* @__PURE__ */ new v(), O = 1e-6, I = 2 * Math.PI, Bs = {
1137
1137
  x: 0,
1138
1138
  y: 0
1139
- }, jt = {
1139
+ }, Ft = {
1140
1140
  x: 0,
1141
1141
  y: 0,
1142
1142
  z: 0
1143
1143
  };
1144
- class ds {
1144
+ class Xt {
1145
1145
  /**
1146
1146
  * Create tolerance class with default tolerance values
1147
1147
  */
1148
1148
  constructor() {
1149
- this.equalPointTol = Q, this.equalVectorTol = Q;
1149
+ this.equalPointTol = O, this.equalVectorTol = O;
1150
1150
  }
1151
1151
  /**
1152
1152
  * Return true if two points are equal with the specified tolerance.
@@ -1155,7 +1155,7 @@ class ds {
1155
1155
  * @returns Return true if two poitns are equal with the specified tolerance.
1156
1156
  */
1157
1157
  equalPoint2d(t, s) {
1158
- return new P(t).sub(s).length() < this.equalPointTol;
1158
+ return new b(t).sub(s).length() < this.equalPointTol;
1159
1159
  }
1160
1160
  /**
1161
1161
  * Return true if two points are equal with the specified tolerance.
@@ -1164,12 +1164,12 @@ class ds {
1164
1164
  * @returns Return true if two poitns are equal with the specified tolerance.
1165
1165
  */
1166
1166
  equalPoint3d(t, s) {
1167
- return new y(t).sub(s).length() < this.equalPointTol;
1167
+ return new g(t).sub(s).length() < this.equalPointTol;
1168
1168
  }
1169
1169
  /**
1170
1170
  * Return true if the value is equal to zero with the specified tolerance.
1171
1171
  */
1172
- static equalToZero(t, s = Q) {
1172
+ static equalToZero(t, s = O) {
1173
1173
  return t < s && t > -s;
1174
1174
  }
1175
1175
  /**
@@ -1180,7 +1180,7 @@ class ds {
1180
1180
  * @param tol Input the tolerance value
1181
1181
  * @returns Return true if two values are equal with the sepcified tolerance
1182
1182
  */
1183
- static equal(t, s, e = Q) {
1183
+ static equal(t, s, e = O) {
1184
1184
  return Math.abs(t - s) < e;
1185
1185
  }
1186
1186
  /**
@@ -1193,7 +1193,7 @@ class ds {
1193
1193
  * @returns Return true if the first argument are greater than the second argument with the
1194
1194
  * sepcified tolerance.
1195
1195
  */
1196
- static great(t, s, e = Q) {
1196
+ static great(t, s, e = O) {
1197
1197
  return t - s > e;
1198
1198
  }
1199
1199
  /**
@@ -1206,12 +1206,12 @@ class ds {
1206
1206
  * @returns Return *true* if the first argument less than the second argument with the specified
1207
1207
  * tolerance value
1208
1208
  */
1209
- static less(t, s, e = Q) {
1209
+ static less(t, s, e = O) {
1210
1210
  return t - s < e;
1211
1211
  }
1212
1212
  }
1213
- const Ft = new ds();
1214
- function Xt(u, t, s = !1) {
1213
+ const Dt = new Xt();
1214
+ function Yt(u, t, s = !1) {
1215
1215
  const e = u.x, n = u.y;
1216
1216
  let i = !1;
1217
1217
  const h = t.length;
@@ -1222,24 +1222,24 @@ function Xt(u, t, s = !1) {
1222
1222
  }
1223
1223
  return i;
1224
1224
  }
1225
- function ms(u, t) {
1225
+ function ys(u, t) {
1226
1226
  if (u.length === 0 || t.length === 0)
1227
1227
  return !1;
1228
- const s = new V().setFromPoints(u), e = new V().setFromPoints(t);
1228
+ const s = new U().setFromPoints(u), e = new U().setFromPoints(t);
1229
1229
  if (!s.intersectsBox(e))
1230
1230
  return !1;
1231
1231
  for (let n = 0; n < u.length; ) {
1232
- if (Xt(u[n], t, !0))
1232
+ if (Yt(u[n], t, !0))
1233
1233
  return !0;
1234
- n < u.length - 1 && Ft.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
1234
+ n < u.length - 1 && Dt.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
1235
1235
  }
1236
1236
  return !1;
1237
1237
  }
1238
- const xs = {
1239
- isPointInPolygon: Xt,
1240
- isPolygonIntersect: ms
1238
+ const gs = {
1239
+ isPointInPolygon: Yt,
1240
+ isPolygonIntersect: ys
1241
1241
  };
1242
- function ys(u, t) {
1242
+ function _s(u, t) {
1243
1243
  const s = [], e = t - 1, n = u;
1244
1244
  for (let i = 0; i <= n; i++)
1245
1245
  s.push(0);
@@ -1249,7 +1249,7 @@ function ys(u, t) {
1249
1249
  s.push(e - n + 1);
1250
1250
  return s;
1251
1251
  }
1252
- function gs(u, t) {
1252
+ function ps(u, t) {
1253
1253
  const s = t.length - 1, e = u, n = [0];
1254
1254
  let i = 0;
1255
1255
  for (let r = 1; r <= s; r++) {
@@ -1267,7 +1267,7 @@ function gs(u, t) {
1267
1267
  h.push(s - e + 1);
1268
1268
  return h;
1269
1269
  }
1270
- function _s(u, t) {
1270
+ function zs(u, t) {
1271
1271
  const s = t.length - 1, e = u, n = [0];
1272
1272
  let i = 0;
1273
1273
  for (let r = 1; r <= s; r++) {
@@ -1285,13 +1285,13 @@ function _s(u, t) {
1285
1285
  h.push(s - e + 1);
1286
1286
  return h;
1287
1287
  }
1288
- function bt(u, t, s, e) {
1288
+ function St(u, t, s, e) {
1289
1289
  if (t === 0)
1290
1290
  return s >= e[u] && s < e[u + 1] ? 1 : 0;
1291
1291
  const n = e[u + t] - e[u], i = e[u + t + 1] - e[u + 1], h = n > 1e-10 ? (s - e[u]) / n : 0, r = i > 1e-10 ? (e[u + t + 1] - s) / i : 0;
1292
- return h * bt(u, t - 1, s, e) + r * bt(u + 1, t - 1, s, e);
1292
+ return h * St(u, t - 1, s, e) + r * St(u + 1, t - 1, s, e);
1293
1293
  }
1294
- function xt(u, t, s, e, n) {
1294
+ function yt(u, t, s, e, n) {
1295
1295
  const i = e.length - 1, h = t;
1296
1296
  if (u = Math.max(s[h], Math.min(s[i + 1], u)), Math.abs(u - s[i + 1]) < 1e-8)
1297
1297
  return [...e[i]];
@@ -1300,7 +1300,7 @@ function xt(u, t, s, e, n) {
1300
1300
  const r = [0, 0, 0];
1301
1301
  let a = 0;
1302
1302
  for (let o = 0; o <= i; o++) {
1303
- const c = bt(o, h, u, s), l = n[o] * c;
1303
+ const c = St(o, h, u, s), l = n[o] * c;
1304
1304
  r[0] += e[o][0] * l, r[1] += e[o][1] * l, r[2] += e[o][2] * l, a += l;
1305
1305
  }
1306
1306
  if (a < 1e-10) {
@@ -1312,22 +1312,22 @@ function xt(u, t, s, e, n) {
1312
1312
  }
1313
1313
  return a > 1e-10 && (r[0] /= a, r[1] /= a, r[2] /= a), r;
1314
1314
  }
1315
- function ps(u, t, s, e) {
1315
+ function Ms(u, t, s, e) {
1316
1316
  const n = u, i = t[n], h = t[t.length - n - 1];
1317
1317
  let r = 0;
1318
1318
  const a = 1e3, o = (h - i) / a;
1319
- let c = xt(
1319
+ let c = yt(
1320
1320
  i,
1321
1321
  u,
1322
1322
  t,
1323
1323
  s,
1324
1324
  e
1325
1325
  );
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
- r += Math.sqrt(f * f + w * w + A * A), c = _;
1326
+ for (let y = 1; y <= a; y++) {
1327
+ const _ = i + y * o, p = yt(_, u, t, s, e), P = p[0] - c[0], w = p[1] - c[1], f = p[2] - c[2];
1328
+ r += Math.sqrt(P * P + w * w + f * f), c = p;
1329
1329
  }
1330
- const l = xt(
1330
+ const l = yt(
1331
1331
  h,
1332
1332
  u,
1333
1333
  t,
@@ -1336,10 +1336,10 @@ function ps(u, t, s, e) {
1336
1336
  ), d = l[0] - c[0], m = l[1] - c[1], x = l[2] - c[2];
1337
1337
  return r += Math.sqrt(d * d + m * m + x * x), r;
1338
1338
  }
1339
- function zs(u) {
1339
+ function Is(u) {
1340
1340
  return u.map((t) => [...t]);
1341
1341
  }
1342
- class pt {
1342
+ class zt {
1343
1343
  /**
1344
1344
  * Create one instance of this class
1345
1345
  * @param x Input x coordinate
@@ -1362,24 +1362,24 @@ class pt {
1362
1362
  */
1363
1363
  static slerpFlat(t, s, e, n, i, h, r) {
1364
1364
  let a = e[n + 0], o = e[n + 1], c = e[n + 2], l = e[n + 3];
1365
- const d = i[h + 0], m = i[h + 1], x = i[h + 2], g = i[h + 3];
1365
+ const d = i[h + 0], m = i[h + 1], x = i[h + 2], y = i[h + 3];
1366
1366
  if (r === 0) {
1367
1367
  t[s + 0] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
1368
1368
  return;
1369
1369
  }
1370
1370
  if (r === 1) {
1371
- t[s + 0] = d, t[s + 1] = m, t[s + 2] = x, t[s + 3] = g;
1371
+ t[s + 0] = d, t[s + 1] = m, t[s + 2] = x, t[s + 3] = y;
1372
1372
  return;
1373
1373
  }
1374
- if (l !== g || a !== d || o !== m || c !== x) {
1375
- let p = 1 - r;
1376
- const _ = a * d + o * m + c * x + l * g, f = _ >= 0 ? 1 : -1, w = 1 - _ * _;
1374
+ if (l !== y || a !== d || o !== m || c !== x) {
1375
+ let _ = 1 - r;
1376
+ const p = a * d + o * m + c * x + l * y, P = p >= 0 ? 1 : -1, w = 1 - p * p;
1377
1377
  if (w > Number.EPSILON) {
1378
- const M = Math.sqrt(w), B = Math.atan2(M, _ * f);
1379
- p = Math.sin(p * B) / M, r = Math.sin(r * B) / M;
1378
+ const M = Math.sqrt(w), B = Math.atan2(M, p * P);
1379
+ _ = Math.sin(_ * B) / M, r = Math.sin(r * B) / M;
1380
1380
  }
1381
- const A = r * f;
1382
- if (a = a * p + d * A, o = o * p + m * A, c = c * p + x * A, l = l * p + g * A, p === 1 - r) {
1381
+ const f = r * P;
1382
+ if (a = a * _ + d * f, o = o * _ + m * f, c = c * _ + x * f, l = l * _ + y * f, _ === 1 - r) {
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;
1385
1385
  }
@@ -1452,7 +1452,7 @@ class pt {
1452
1452
  * @returns Return cloned instance
1453
1453
  */
1454
1454
  clone() {
1455
- return new pt(this._x, this._y, this._z, this._w);
1455
+ return new zt(this._x, this._y, this._z, this._w);
1456
1456
  }
1457
1457
  /**
1458
1458
  * Copy the x, y, z and w properties of q into this quaternion.
@@ -1545,7 +1545,7 @@ class pt {
1545
1545
  * @returns Return the angle between this quaternion and quaternion q in radians.
1546
1546
  */
1547
1547
  angleTo(t) {
1548
- return 2 * Math.acos(Math.abs(j(this.dot(t), -1, 1)));
1548
+ return 2 * Math.acos(Math.abs(X(this.dot(t), -1, 1)));
1549
1549
  }
1550
1550
  /**
1551
1551
  * Rotate this quaternion by a given angular step to the defined quaternion q. The method ensures
@@ -1730,7 +1730,7 @@ class pt {
1730
1730
  yield this._x, yield this._y, yield this._z, yield this._w;
1731
1731
  }
1732
1732
  }
1733
- const N = class N {
1733
+ const k = class k {
1734
1734
  /**
1735
1735
  * Vector may be constructed by three points, or by three float numbers,
1736
1736
  * or by array of three numbers
@@ -1752,7 +1752,7 @@ const N = class N {
1752
1752
  this.x = t, this.y = s, this.z = e;
1753
1753
  return;
1754
1754
  }
1755
- throw T.ILLEGAL_PARAMETERS;
1755
+ throw L.ILLEGAL_PARAMETERS;
1756
1756
  }
1757
1757
  }
1758
1758
  /**
@@ -1847,7 +1847,7 @@ const N = class N {
1847
1847
  * @returns Return a new vector3 with the same x, y and z values as this one.
1848
1848
  */
1849
1849
  clone() {
1850
- return new N(this.x, this.y, this.z);
1850
+ return new k(this.x, this.y, this.z);
1851
1851
  }
1852
1852
  /**
1853
1853
  * Copy the values of the passed vector3's x, y and z properties to this vector3.
@@ -1947,7 +1947,7 @@ const N = class N {
1947
1947
  * @returns Return this vector
1948
1948
  */
1949
1949
  applyEuler(t) {
1950
- return this.applyQuaternion(Ct.setFromEuler(t));
1950
+ return this.applyQuaternion(Bt.setFromEuler(t));
1951
1951
  }
1952
1952
  /**
1953
1953
  * Apply a rotation specified by an axis and an angle to this vector.
@@ -1956,7 +1956,7 @@ const N = class N {
1956
1956
  * @returns Return this vector
1957
1957
  */
1958
1958
  applyAxisAngle(t, s) {
1959
- return this.applyQuaternion(Ct.setFromAxisAngle(t, s));
1959
+ return this.applyQuaternion(Bt.setFromAxisAngle(t, s));
1960
1960
  }
1961
1961
  /**
1962
1962
  * Multipliy this vector by 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.
@@ -2372,9 +2372,9 @@ const N = class N {
2372
2372
  yield this.x, yield this.y, yield this.z;
2373
2373
  }
2374
2374
  };
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
- let y = N;
2377
- const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2375
+ k.X_AXIS = Object.freeze(new k(1, 0, 0)), k.NEGATIVE_X_AXIS = Object.freeze(new k(-1, 0, 0)), k.Y_AXIS = Object.freeze(new k(0, 1, 0)), k.NEGATIVE_Y_AXIS = Object.freeze(new k(0, -1, 0)), k.Z_AXIS = Object.freeze(new k(0, 0, 1)), k.NEGATIVE_Z_AXIS = Object.freeze(new k(0, 0, -1));
2376
+ let g = k;
2377
+ const ft = /* @__PURE__ */ new g(), Bt = /* @__PURE__ */ new zt(), W = class W {
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.
@@ -2396,8 +2396,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2396
2396
  * @param n43 Input element in the forth row and the third column
2397
2397
  * @param n44 Input element in the forth row and the forth column
2398
2398
  */
2399
- constructor(t, s, e, n, i, h, r, a, o, c, l, d, m, x, g, p) {
2400
- 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 && h != null && r != null && a != null && o != null && c != null && l != null && d != null && m != null && x != null && g != null && p != null && this.set(
2399
+ constructor(t, s, e, n, i, h, r, a, o, c, l, d, m, x, y, _) {
2400
+ 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 && h != null && r != null && a != null && o != null && c != null && l != null && d != null && m != null && x != null && y != null && _ != null && this.set(
2401
2401
  t,
2402
2402
  s,
2403
2403
  e,
@@ -2412,8 +2412,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2412
2412
  d,
2413
2413
  m,
2414
2414
  x,
2415
- g,
2416
- p
2415
+ y,
2416
+ _
2417
2417
  );
2418
2418
  }
2419
2419
  /**
@@ -2437,9 +2437,9 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2437
2437
  * @param n44 Input element in the forth row and the forth column
2438
2438
  * @returns Return this matrix
2439
2439
  */
2440
- set(t, s, e, n, i, h, r, a, o, c, l, d, m, x, g, p) {
2441
- const _ = this.elements;
2442
- return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = h, _[9] = r, _[13] = a, _[2] = o, _[6] = c, _[10] = l, _[14] = d, _[3] = m, _[7] = x, _[11] = g, _[15] = p, this;
2440
+ set(t, s, e, n, i, h, r, a, o, c, l, d, m, x, y, _) {
2441
+ const p = this.elements;
2442
+ return p[0] = t, p[4] = s, p[8] = e, p[12] = n, p[1] = i, p[5] = h, p[9] = r, p[13] = a, p[2] = o, p[6] = c, p[10] = l, p[14] = d, p[3] = m, p[7] = x, p[11] = y, p[15] = _, this;
2443
2443
  }
2444
2444
  /**
2445
2445
  * Reset this matrix to the identity matrix.
@@ -2449,7 +2449,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2449
2449
  return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
2450
2450
  }
2451
2451
  clone() {
2452
- return new $().fromArray(this.elements);
2452
+ return new W().fromArray(this.elements);
2453
2453
  }
2454
2454
  /**
2455
2455
  * Copy the elements of matrix m into this matrix.
@@ -2501,11 +2501,11 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2501
2501
  * @returns Return this matrix
2502
2502
  */
2503
2503
  setFromExtrusionDirection(t) {
2504
- if (Ft.equalPoint3d(t, y.Z_AXIS))
2504
+ if (Dt.equalPoint3d(t, g.Z_AXIS))
2505
2505
  this.identity();
2506
2506
  else {
2507
- const s = new y(1, 0, 0);
2508
- Math.abs(t.x) < 1 / 64 && Math.abs(t.y) < 1 / 64 ? s.crossVectors(y.Y_AXIS, t).normalize() : s.crossVectors(y.Z_AXIS, t).normalize();
2507
+ const s = new g(1, 0, 0);
2508
+ 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();
2509
2509
  const e = t.clone().cross(s).normalize();
2510
2510
  this.set(
2511
2511
  s.x,
@@ -2571,7 +2571,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2571
2571
  * @returns Return this matrix
2572
2572
  */
2573
2573
  extractRotation(t) {
2574
- const s = this.elements, e = t.elements, n = 1 / O.setFromMatrixColumn(t, 0).length(), i = 1 / O.setFromMatrixColumn(t, 1).length(), h = 1 / O.setFromMatrixColumn(t, 2).length();
2574
+ const s = this.elements, e = t.elements, n = 1 / H.setFromMatrixColumn(t, 0).length(), i = 1 / H.setFromMatrixColumn(t, 1).length(), h = 1 / H.setFromMatrixColumn(t, 2).length();
2575
2575
  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] * h, s[9] = e[9] * h, s[10] = e[10] * h, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, this;
2576
2576
  }
2577
2577
  // makeRotationFromEuler(euler) {
@@ -2687,7 +2687,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2687
2687
  * @returns Return this matrix
2688
2688
  */
2689
2689
  makeRotationFromQuaternion(t) {
2690
- return this.compose(Ms, t, As);
2690
+ return this.compose(As, t, fs);
2691
2691
  }
2692
2692
  /**
2693
2693
  * Construct a rotation matrix, looking from eye towards target oriented by the up vector.
@@ -2698,7 +2698,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2698
2698
  */
2699
2699
  lookAt(t, s, e) {
2700
2700
  const n = this.elements;
2701
- return L.subVectors(t, s), L.lengthSq() === 0 && (L.z = 1), L.normalize(), q.crossVectors(e, L), q.lengthSq() === 0 && (Math.abs(e.z) === 1 ? L.x += 1e-4 : L.z += 1e-4, L.normalize(), q.crossVectors(e, L)), q.normalize(), ut.crossVectors(L, q), n[0] = q.x, n[4] = ut.x, n[8] = L.x, n[1] = q.y, n[5] = ut.y, n[9] = L.y, n[2] = q.z, n[6] = ut.z, n[10] = L.z, this;
2701
+ return N.subVectors(t, s), N.lengthSq() === 0 && (N.z = 1), N.normalize(), F.crossVectors(e, N), F.lengthSq() === 0 && (Math.abs(e.z) === 1 ? N.x += 1e-4 : N.z += 1e-4, N.normalize(), F.crossVectors(e, N)), F.normalize(), dt.crossVectors(N, F), n[0] = F.x, n[4] = dt.x, n[8] = N.x, n[1] = F.y, n[5] = dt.y, n[9] = N.y, n[2] = F.z, n[6] = dt.z, n[10] = N.z, this;
2702
2702
  }
2703
2703
  /**
2704
2704
  * Post-multiply this matrix by m.
@@ -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, h = e[0], r = e[4], a = e[8], o = e[12], c = e[1], l = e[5], d = e[9], m = 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], 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] = h * B + r * G + a * nt + o * ot, i[4] = h * z + r * F + a * it + o * at, i[8] = h * E + r * K + a * rt + o * ct, i[12] = h * Z + r * et + a * ht + o * lt, i[1] = c * B + l * G + d * nt + m * ot, i[5] = c * z + l * F + d * it + m * at, i[9] = c * E + l * K + d * rt + m * ct, i[13] = c * Z + l * et + d * ht + m * 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] = f * B + 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, h = e[0], r = e[4], a = e[8], o = e[12], c = e[1], l = e[5], d = e[9], m = e[13], x = e[2], y = e[6], _ = e[10], p = e[14], P = e[3], w = e[7], f = e[11], M = e[15], B = n[0], z = n[4], E = n[8], Z = n[12], G = n[1], D = n[5], Q = n[9], nt = n[13], it = n[2], rt = n[6], ht = n[10], ot = n[14], at = n[3], ct = n[7], lt = n[11], ut = n[15];
2727
+ return i[0] = h * B + r * G + a * it + o * at, i[4] = h * z + r * D + a * rt + o * ct, i[8] = h * E + r * Q + a * ht + o * lt, i[12] = h * Z + r * nt + a * ot + o * ut, i[1] = c * B + l * G + d * it + m * at, i[5] = c * z + l * D + d * rt + m * ct, i[9] = c * E + l * Q + d * ht + m * lt, i[13] = c * Z + l * nt + d * ot + m * ut, i[2] = x * B + y * G + _ * it + p * at, i[6] = x * z + y * D + _ * rt + p * ct, i[10] = x * E + y * Q + _ * ht + p * lt, i[14] = x * Z + y * nt + _ * ot + p * ut, i[3] = P * B + w * G + f * it + M * at, i[7] = P * z + w * D + f * rt + M * ct, i[11] = P * E + w * Q + f * ht + M * lt, i[15] = P * Z + w * nt + f * ot + M * ut, this;
2728
2728
  }
2729
2729
  /**
2730
2730
  * Multiply every component of the matrix by a scalar value s.
@@ -2740,8 +2740,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2740
2740
  * @returns Return the determinant of this matrix.
2741
2741
  */
2742
2742
  determinant() {
2743
- const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], h = t[1], r = t[5], a = t[9], o = t[13], c = t[2], l = t[6], d = t[10], m = t[14], x = t[3], g = t[7], p = t[11], _ = t[15];
2744
- return x * (+i * a * l - n * o * l - i * r * d + e * o * d + n * r * m - e * a * m) + g * (+s * a * m - s * o * d + i * h * d - n * h * m + n * o * c - i * a * c) + p * (+s * o * l - s * r * m - i * h * l + e * h * m + i * r * c - e * o * c) + _ * (-n * r * c - s * a * l + s * r * d + n * h * l - e * h * d + e * a * c);
2743
+ const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], h = t[1], r = t[5], a = t[9], o = t[13], c = t[2], l = t[6], d = t[10], m = t[14], x = t[3], y = t[7], _ = t[11], p = t[15];
2744
+ return x * (+i * a * l - n * o * l - i * r * d + e * o * d + n * r * m - e * a * m) + y * (+s * a * m - s * o * d + i * h * d - n * h * m + n * o * c - i * a * c) + _ * (+s * o * l - s * r * m - i * h * l + e * h * m + i * r * c - e * o * c) + p * (-n * r * c - s * a * l + s * r * d + n * h * l - e * h * d + e * a * c);
2745
2745
  }
2746
2746
  /**
2747
2747
  * Transposes this matrix.
@@ -2761,7 +2761,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2761
2761
  */
2762
2762
  setPosition(t, s, e) {
2763
2763
  const n = this.elements;
2764
- return t instanceof y ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
2764
+ 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;
2765
2765
  }
2766
2766
  /**
2767
2767
  * Invert this matrix, using the analytic method. You can not invert with a determinant of zero.
@@ -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], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = t[9], d = t[10], m = t[11], x = t[12], g = t[13], p = t[14], _ = t[15], f = l * p * o - g * d * o + g * a * m - r * p * m - l * a * _ + r * d * _, w = x * d * o - c * p * o - x * a * m + h * p * m + c * a * _ - h * d * _, A = c * g * o - x * l * o + x * r * m - h * g * m - c * r * _ + h * l * _, M = x * l * a - c * g * a - x * r * d + h * g * d + c * r * p - h * l * p, B = s * f + e * w + n * A + i * M;
2772
+ const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = t[9], d = t[10], m = t[11], x = t[12], y = t[13], _ = t[14], p = t[15], P = l * _ * o - y * d * o + y * a * m - r * _ * m - l * a * p + r * d * p, w = x * d * o - c * _ * o - x * a * m + h * _ * m + c * a * p - h * d * p, f = c * y * o - x * l * o + x * r * m - h * y * m - c * r * p + h * l * p, M = x * l * a - c * y * a - x * r * d + h * y * d + c * r * _ - h * l * _, B = s * P + e * w + n * f + i * M;
2773
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
2775
  const z = 1 / B;
2776
- return t[0] = f * z, t[1] = (g * d * i - l * p * i - g * n * m + e * p * m + l * n * _ - e * d * _) * z, t[2] = (r * p * i - g * a * i + g * n * o - e * p * o - r * n * _ + e * a * _) * z, t[3] = (l * a * i - r * d * i - l * n * o + e * d * o + r * n * m - e * a * m) * z, t[4] = w * z, t[5] = (c * p * i - x * d * i + x * n * m - s * p * m - c * n * _ + s * d * _) * z, t[6] = (x * a * i - h * p * i - x * n * o + s * p * o + h * n * _ - s * a * _) * z, t[7] = (h * d * i - c * a * i + c * n * o - s * d * o - h * n * m + s * a * m) * z, t[8] = A * z, t[9] = (x * l * i - c * g * i - x * e * m + s * g * m + c * e * _ - s * l * _) * z, t[10] = (h * g * i - x * r * i + x * e * o - s * g * o - h * e * _ + s * r * _) * z, t[11] = (c * r * i - h * l * i - c * e * o + s * l * o + h * e * m - s * r * m) * z, t[12] = M * z, t[13] = (c * g * n - x * l * n + x * e * d - s * g * d - c * e * p + s * l * p) * z, t[14] = (x * r * n - h * g * n - x * e * a + s * g * a + h * e * p - s * r * p) * z, t[15] = (h * l * n - c * r * n + c * e * a - s * l * a - h * e * d + s * r * d) * z, this;
2776
+ return t[0] = P * z, t[1] = (y * d * i - l * _ * i - y * n * m + e * _ * m + l * n * p - e * d * p) * z, t[2] = (r * _ * i - y * a * i + y * n * o - e * _ * o - r * n * p + e * a * p) * z, t[3] = (l * a * i - r * d * i - l * n * o + e * d * o + r * n * m - e * a * m) * z, t[4] = w * z, t[5] = (c * _ * i - x * d * i + x * n * m - s * _ * m - c * n * p + s * d * p) * z, t[6] = (x * a * i - h * _ * i - x * n * o + s * _ * o + h * n * p - s * a * p) * z, t[7] = (h * d * i - c * a * i + c * n * o - s * d * o - h * n * m + s * a * m) * z, t[8] = f * z, t[9] = (x * l * i - c * y * i - x * e * m + s * y * m + c * e * p - s * l * p) * z, t[10] = (h * y * i - x * r * i + x * e * o - s * y * o - h * e * p + s * r * p) * z, t[11] = (c * r * i - h * l * i - c * e * o + s * l * o + h * e * m - s * r * m) * z, t[12] = M * z, t[13] = (c * y * n - x * l * n + x * e * d - s * y * d - c * e * _ + s * l * _) * z, t[14] = (x * r * n - h * y * n - x * e * a + s * y * a + h * e * _ - s * r * _) * z, t[15] = (h * l * n - c * r * n + c * e * a - s * l * a - h * e * d + s * r * d) * z, this;
2777
2777
  }
2778
2778
  /**
2779
2779
  * Multiply the columns of this matrix by vector v.
@@ -2800,7 +2800,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2800
2800
  * @returns Return this matrix
2801
2801
  */
2802
2802
  makeTranslation(t, s, e) {
2803
- return t instanceof y ? 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;
2803
+ 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;
2804
2804
  }
2805
2805
  /**
2806
2806
  * Set this matrix as a rotational transformation around the X axis by theta (θ) radians.
@@ -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, h = s.y, r = s.z, a = s.w, o = i + i, c = h + h, l = r + r, d = i * o, m = i * c, x = i * l, g = h * c, p = h * l, _ = r * l, f = a * o, w = a * c, A = a * l, M = e.x, B = e.y, z = e.z;
2891
- return n[0] = (1 - (g + _)) * M, n[1] = (m + A) * M, n[2] = (x - w) * M, n[3] = 0, n[4] = (m - A) * B, n[5] = (1 - (d + _)) * B, n[6] = (p + f) * B, n[7] = 0, n[8] = (x + w) * z, n[9] = (p - f) * z, n[10] = (1 - (d + 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, h = s.y, r = s.z, a = s.w, o = i + i, c = h + h, l = r + r, d = i * o, m = i * c, x = i * l, y = h * c, _ = h * l, p = r * l, P = a * o, w = a * c, f = a * l, M = e.x, B = e.y, z = e.z;
2891
+ return n[0] = (1 - (y + p)) * M, n[1] = (m + f) * M, n[2] = (x - w) * M, n[3] = 0, n[4] = (m - f) * B, n[5] = (1 - (d + p)) * B, n[6] = (_ + P) * B, n[7] = 0, n[8] = (x + w) * z, n[9] = (_ - P) * z, n[10] = (1 - (d + y)) * 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.
@@ -2903,11 +2903,11 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
2903
2903
  */
2904
2904
  decompose(t, s, e) {
2905
2905
  const n = this.elements;
2906
- let i = O.set(n[0], n[1], n[2]).length();
2907
- const h = O.set(n[4], n[5], n[6]).length(), r = O.set(n[8], n[9], n[10]).length();
2908
- this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], R.copy(this);
2906
+ let i = H.set(n[0], n[1], n[2]).length();
2907
+ const h = H.set(n[4], n[5], n[6]).length(), r = H.set(n[8], n[9], n[10]).length();
2908
+ this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], T.copy(this);
2909
2909
  const o = 1 / i, c = 1 / h, l = 1 / r;
2910
- return R.elements[0] *= o, R.elements[1] *= o, R.elements[2] *= o, R.elements[4] *= c, R.elements[5] *= c, R.elements[6] *= c, R.elements[8] *= l, R.elements[9] *= l, R.elements[10] *= l, s.setFromRotationMatrix(R), e.x = i, e.y = h, e.z = r, this;
2910
+ return T.elements[0] *= o, T.elements[1] *= o, T.elements[2] *= o, T.elements[4] *= c, T.elements[5] *= c, T.elements[6] *= c, T.elements[8] *= l, T.elements[9] *= l, T.elements[10] *= l, s.setFromRotationMatrix(T), e.x = i, e.y = h, e.z = r, this;
2911
2911
  }
2912
2912
  // makePerspective(
2913
2913
  // left,
@@ -3033,10 +3033,10 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
3033
3033
  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;
3034
3034
  }
3035
3035
  };
3036
- $.IDENTITY = Object.freeze(new $());
3037
- let tt = $;
3038
- const O = /* @__PURE__ */ new y(), R = /* @__PURE__ */ new tt(), Ms = /* @__PURE__ */ new y(0, 0, 0), As = /* @__PURE__ */ new y(1, 1, 1), q = /* @__PURE__ */ new y(), ut = /* @__PURE__ */ new y(), L = /* @__PURE__ */ new y();
3039
- class Y {
3036
+ W.IDENTITY = Object.freeze(new W());
3037
+ let tt = W;
3038
+ const H = /* @__PURE__ */ new g(), T = /* @__PURE__ */ new tt(), As = /* @__PURE__ */ new g(0, 0, 0), fs = /* @__PURE__ */ new g(1, 1, 1), F = /* @__PURE__ */ new g(), dt = /* @__PURE__ */ new g(), N = /* @__PURE__ */ new g();
3039
+ class j {
3040
3040
  /**
3041
3041
  * Create a 3d box bounded by min and max.
3042
3042
  * @param min (optional) Input the lower (x, y, z) boundary of the box.
@@ -3045,7 +3045,7 @@ class Y {
3045
3045
  * Set it to ( - Infinity, - Infinity, - Infinity ) if undefined or null provided.
3046
3046
  */
3047
3047
  constructor(t = void 0, s = void 0) {
3048
- this.min = t == null ? new y(1 / 0, 1 / 0, 1 / 0) : new y(t.x, t.y, t.z), this.max = s == null ? new y(-1 / 0, -1 / 0, -1 / 0) : new y(s.x, s.y, s.z);
3048
+ 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);
3049
3049
  }
3050
3050
  /**
3051
3051
  * Set the lower and upper (x, y, z) boundaries of this box.
@@ -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
  /**
@@ -3094,7 +3094,7 @@ class Y {
3094
3094
  * @returns Return a new box with the same min and max as this one.
3095
3095
  */
3096
3096
  clone() {
3097
- return new Y().copy(this);
3097
+ return new j().copy(this);
3098
3098
  }
3099
3099
  /**
3100
3100
  * Copy the min and max from box to this box.
@@ -3139,13 +3139,13 @@ class Y {
3139
3139
  * Center point of this box
3140
3140
  */
3141
3141
  get center() {
3142
- return this.isEmpty() ? new y(0, 0, 0) : new y(0, 0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
3142
+ return this.isEmpty() ? new g(0, 0, 0) : new g(0, 0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
3143
3143
  }
3144
3144
  /**
3145
3145
  * Return the width, height and depth of this box.
3146
3146
  */
3147
3147
  get size() {
3148
- return this.isEmpty() ? new y(0, 0, 0) : new y(0, 0, 0).subVectors(this.max, this.min);
3148
+ return this.isEmpty() ? new g(0, 0, 0) : new g(0, 0, 0).subVectors(this.max, this.min);
3149
3149
  }
3150
3150
  /**
3151
3151
  * Expand the boundaries of this box to include point.
@@ -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
@@ -3264,7 +3264,7 @@ class Y {
3264
3264
  * @returns Return this box
3265
3265
  */
3266
3266
  applyMatrix4(t) {
3267
- return this.isEmpty() ? this : (U[0].set(this.min.x, this.min.y, this.min.z).applyMatrix3d(t), U[1].set(this.min.x, this.min.y, this.max.z).applyMatrix3d(t), U[2].set(this.min.x, this.max.y, this.min.z).applyMatrix3d(t), U[3].set(this.min.x, this.max.y, this.max.z).applyMatrix3d(t), U[4].set(this.max.x, this.min.y, this.min.z).applyMatrix3d(t), U[5].set(this.max.x, this.min.y, this.max.z).applyMatrix3d(t), U[6].set(this.max.x, this.max.y, this.min.z).applyMatrix3d(t), U[7].set(this.max.x, this.max.y, this.max.z).applyMatrix3d(t), this.setFromPoints(U), this);
3267
+ return this.isEmpty() ? this : (V[0].set(this.min.x, this.min.y, this.min.z).applyMatrix3d(t), V[1].set(this.min.x, this.min.y, this.max.z).applyMatrix3d(t), V[2].set(this.min.x, this.max.y, this.min.z).applyMatrix3d(t), V[3].set(this.min.x, this.max.y, this.max.z).applyMatrix3d(t), V[4].set(this.max.x, this.min.y, this.min.z).applyMatrix3d(t), V[5].set(this.max.x, this.min.y, this.max.z).applyMatrix3d(t), V[6].set(this.max.x, this.max.y, this.min.z).applyMatrix3d(t), V[7].set(this.max.x, this.max.y, this.max.z).applyMatrix3d(t), this.setFromPoints(V), this);
3268
3268
  }
3269
3269
  /**
3270
3270
  * Add offset to both the upper and lower bounds of this box, effectively moving this box offset units
@@ -3284,17 +3284,17 @@ class Y {
3284
3284
  return t.min.equals(this.min) && t.max.equals(this.max);
3285
3285
  }
3286
3286
  }
3287
- const U = [
3288
- /* @__PURE__ */ new y(),
3289
- /* @__PURE__ */ new y(),
3290
- /* @__PURE__ */ new y(),
3291
- /* @__PURE__ */ new y(),
3292
- /* @__PURE__ */ new y(),
3293
- /* @__PURE__ */ new y(),
3294
- /* @__PURE__ */ new y(),
3295
- /* @__PURE__ */ new y()
3296
- ], ft = /* @__PURE__ */ new y(), Bt = /* @__PURE__ */ new P();
3297
- class V {
3287
+ const V = [
3288
+ /* @__PURE__ */ new g(),
3289
+ /* @__PURE__ */ new g(),
3290
+ /* @__PURE__ */ new g(),
3291
+ /* @__PURE__ */ new g(),
3292
+ /* @__PURE__ */ new g(),
3293
+ /* @__PURE__ */ new g(),
3294
+ /* @__PURE__ */ new g(),
3295
+ /* @__PURE__ */ new g()
3296
+ ], wt = /* @__PURE__ */ new g(), It = /* @__PURE__ */ new b();
3297
+ class U {
3298
3298
  /**
3299
3299
  * Create a 2d box bounded by min and max.
3300
3300
  * @param min (optional) Input 2d vector representing the lower (x, y) boundary of the box.
@@ -3303,7 +3303,7 @@ class V {
3303
3303
  * Set it to ( - Infinity, - Infinity ) if undefined or null provided.
3304
3304
  */
3305
3305
  constructor(t = void 0, s = void 0) {
3306
- this.min = t == null ? new P(1 / 0, 1 / 0) : new P(t.x, t.y), this.max = s == null ? new P(-1 / 0, -1 / 0) : new P(s.x, s.y);
3306
+ 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);
3307
3307
  }
3308
3308
  /**
3309
3309
  * Set the lower and upper (x, y) boundaries of this box.
@@ -3333,7 +3333,7 @@ class V {
3333
3333
  * @returns Return this box
3334
3334
  */
3335
3335
  setFromCenterAndSize(t, s) {
3336
- const e = Bt.copy(s).multiplyScalar(0.5);
3336
+ const e = It.copy(s).multiplyScalar(0.5);
3337
3337
  return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
3338
3338
  }
3339
3339
  /**
@@ -3341,7 +3341,7 @@ class V {
3341
3341
  * @returns Return a new 2d box with the same min and max as this one.
3342
3342
  */
3343
3343
  clone() {
3344
- return new V().copy(this);
3344
+ return new U().copy(this);
3345
3345
  }
3346
3346
  /**
3347
3347
  * Copy the min and max from box to this box.
@@ -3386,13 +3386,13 @@ class V {
3386
3386
  * Center point of this box
3387
3387
  */
3388
3388
  get center() {
3389
- return this.isEmpty() ? new P(0, 0) : new P(0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
3389
+ return this.isEmpty() ? new b(0, 0) : new b(0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
3390
3390
  }
3391
3391
  /**
3392
3392
  * Return the width, height and depth of this box.
3393
3393
  */
3394
3394
  get size() {
3395
- return this.isEmpty() ? new P(0, 0) : new P(0, 0).subVectors(this.max, this.min);
3395
+ return this.isEmpty() ? new b(0, 0) : new b(0, 0).subVectors(this.max, this.min);
3396
3396
  }
3397
3397
  /**
3398
3398
  * Expand the boundaries of this box to include point.
@@ -3473,7 +3473,7 @@ class V {
3473
3473
  * @returns Return the distance from any edge of this box to the specified point.
3474
3474
  */
3475
3475
  distanceToPoint(t) {
3476
- return this.clampPoint(t, Bt).distanceTo(t);
3476
+ return this.clampPoint(t, It).distanceTo(t);
3477
3477
  }
3478
3478
  /**
3479
3479
  * Return the intersection of this and box, setting the upper bound of this box to the lesser of the
@@ -3511,15 +3511,15 @@ 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();
3515
- class zt {
3514
+ const Et = /* @__PURE__ */ new g(), ws = /* @__PURE__ */ new g(), Ps = /* @__PURE__ */ new v();
3515
+ class Mt {
3516
3516
  /**
3517
3517
  * Create one plane
3518
3518
  * @param normal (optional) Input a unit length Vector3 defining the normal of the plane.
3519
3519
  * Default is (1, 0, 0).
3520
3520
  * @param constant (optional) Input the signed distance from the origin to the plane. Default is 0.
3521
3521
  */
3522
- constructor(t = new y(1, 0, 0), s = 0) {
3522
+ constructor(t = new g(1, 0, 0), s = 0) {
3523
3523
  this.normal = t, this.constant = s;
3524
3524
  }
3525
3525
  /**
@@ -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 = Et.subVectors(e, s).cross(ws.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 || Ps.getNormalMatrix(t), n = this.coplanarPoint(Et).applyMatrix3d(t), i = this.normal.applyMatrix3(e).normalize();
3666
3666
  return this.constant = -n.dot(i), this;
3667
3667
  }
3668
3668
  /**
@@ -3687,10 +3687,10 @@ class zt {
3687
3687
  * @returns Return the cloned plane
3688
3688
  */
3689
3689
  clone() {
3690
- return new zt().copy(this);
3690
+ return new Mt().copy(this);
3691
3691
  }
3692
3692
  }
3693
- class b extends P {
3693
+ class S extends b {
3694
3694
  /**
3695
3695
  * Convert one point array to one number array
3696
3696
  * @param array Input one point array
@@ -3703,7 +3703,7 @@ class b extends P {
3703
3703
  }), s;
3704
3704
  }
3705
3705
  }
3706
- class S extends y {
3706
+ class A extends g {
3707
3707
  /**
3708
3708
  * Convert one point array to one number array
3709
3709
  * @param array Input one point array
@@ -3717,7 +3717,7 @@ class S extends y {
3717
3717
  }), n;
3718
3718
  }
3719
3719
  }
3720
- const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J {
3720
+ const Rt = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new zt(), J = class J {
3721
3721
  /**
3722
3722
  * Create one instance of this class
3723
3723
  * @param x (optional) the angle of the x axis in radians. Default is 0.
@@ -3812,22 +3812,22 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
3812
3812
  const n = t.elements, i = n[0], h = n[4], r = n[8], a = n[1], o = n[5], c = n[9], l = n[2], d = n[6], m = n[10];
3813
3813
  switch (s) {
3814
3814
  case "XYZ":
3815
- this._y = Math.asin(j(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(-c, m), this._z = Math.atan2(-h, i)) : (this._x = Math.atan2(d, o), this._z = 0);
3815
+ this._y = Math.asin(X(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(-c, m), this._z = Math.atan2(-h, i)) : (this._x = Math.atan2(d, o), this._z = 0);
3816
3816
  break;
3817
3817
  case "YXZ":
3818
- this._x = Math.asin(-j(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(r, m), this._z = Math.atan2(a, o)) : (this._y = Math.atan2(-l, i), this._z = 0);
3818
+ this._x = Math.asin(-X(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(r, m), this._z = Math.atan2(a, o)) : (this._y = Math.atan2(-l, i), this._z = 0);
3819
3819
  break;
3820
3820
  case "ZXY":
3821
- this._x = Math.asin(j(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-l, m), this._z = Math.atan2(-h, o)) : (this._y = 0, this._z = Math.atan2(a, i));
3821
+ this._x = Math.asin(X(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-l, m), this._z = Math.atan2(-h, o)) : (this._y = 0, this._z = Math.atan2(a, i));
3822
3822
  break;
3823
3823
  case "ZYX":
3824
- this._y = Math.asin(-j(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(d, m), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-h, o));
3824
+ this._y = Math.asin(-X(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(d, m), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-h, o));
3825
3825
  break;
3826
3826
  case "YZX":
3827
- this._z = Math.asin(j(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, o), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(r, m));
3827
+ this._z = Math.asin(X(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, o), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(r, m));
3828
3828
  break;
3829
3829
  case "XZY":
3830
- this._z = Math.asin(-j(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(d, o), this._y = Math.atan2(r, i)) : (this._x = Math.atan2(-c, m), this._y = 0);
3830
+ this._z = Math.asin(-X(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(d, o), this._y = Math.atan2(r, i)) : (this._x = Math.atan2(-c, m), this._y = 0);
3831
3831
  break;
3832
3832
  default:
3833
3833
  console.warn(
@@ -3846,7 +3846,7 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
3846
3846
  * @returns Return this euler
3847
3847
  */
3848
3848
  setFromQuaternion(t, s, e = !0) {
3849
- return Et.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Et, s, e);
3849
+ return Rt.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Rt, s, e);
3850
3850
  }
3851
3851
  /**
3852
3852
  * Set the x, y and z, and optionally update the order.
@@ -3911,7 +3911,7 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
3911
3911
  };
3912
3912
  J.DEFAULT_ORDER = "XYZ";
3913
3913
  let Nt = J;
3914
- class Dt {
3914
+ class Zt {
3915
3915
  constructor() {
3916
3916
  this._boundingBoxNeedsUpdate = !1;
3917
3917
  }
@@ -3923,7 +3923,7 @@ class Dt {
3923
3923
  return this._boundingBoxNeedsUpdate;
3924
3924
  }
3925
3925
  }
3926
- class Yt extends Dt {
3926
+ class Gt extends Zt {
3927
3927
  /**
3928
3928
  * Return new shape translated by given vector.
3929
3929
  */
@@ -3939,7 +3939,7 @@ class Yt extends Dt {
3939
3939
  return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
3940
3940
  }
3941
3941
  }
3942
- class Cs extends Yt {
3942
+ class Es extends Gt {
3943
3943
  /**
3944
3944
  * Create one 2d area defined by one outter loop and multiple inner loops
3945
3945
  */
@@ -3972,7 +3972,7 @@ class Cs extends Yt {
3972
3972
  */
3973
3973
  calculateBoundingBox() {
3974
3974
  const t = this.outter;
3975
- return t ? t.box : new V();
3975
+ return t ? t.box : new U();
3976
3976
  }
3977
3977
  /**
3978
3978
  * @inheritdoc
@@ -4007,7 +4007,7 @@ class Cs extends Yt {
4007
4007
  let d = a + 1;
4008
4008
  for (; d < i; d++) {
4009
4009
  const m = e[d], x = t[m];
4010
- if (s[m].containsBox(l) && xs.isPointInPolygon(
4010
+ if (s[m].containsBox(l) && gs.isPointInPolygon(
4011
4011
  c[C.randInt(0, c.length - 1)],
4012
4012
  x
4013
4013
  )) {
@@ -4027,7 +4027,7 @@ class Cs extends Yt {
4027
4027
  calculateBoundaryBoxes(t) {
4028
4028
  const s = [];
4029
4029
  return t.forEach((e) => {
4030
- s.push(new V().setFromPoints(e));
4030
+ s.push(new U().setFromPoints(e));
4031
4031
  }), s;
4032
4032
  }
4033
4033
  /**
@@ -4050,7 +4050,7 @@ class Cs extends Yt {
4050
4050
  }), e;
4051
4051
  }
4052
4052
  }
4053
- class st extends Yt {
4053
+ class st extends Gt {
4054
4054
  constructor() {
4055
4055
  super(), this.arcLengthDivisions = 100;
4056
4056
  }
@@ -4169,7 +4169,7 @@ class st extends Yt {
4169
4169
  getTangent(t) {
4170
4170
  let e = t - 1e-4, n = t + 1e-4;
4171
4171
  e < 0 && (e = 0), n > 1 && (n = 1);
4172
- const i = this.getPoint(e), h = this.getPoint(n), r = new b();
4172
+ const i = this.getPoint(e), h = this.getPoint(n), r = new S();
4173
4173
  return r.copy(h).sub(i).normalize(), r;
4174
4174
  }
4175
4175
  /**
@@ -4184,7 +4184,7 @@ class st extends Yt {
4184
4184
  return this.getTangent(s);
4185
4185
  }
4186
4186
  }
4187
- class gt extends st {
4187
+ class _t extends st {
4188
4188
  constructor(t, s, e, n, i) {
4189
4189
  super();
4190
4190
  const h = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
@@ -4200,9 +4200,9 @@ class gt extends st {
4200
4200
  );
4201
4201
  else if (h == 5) {
4202
4202
  const r = t;
4203
- this.center = new b(r.x, r.y), this.radius = s, this.startAngle = e, this.endAngle = n, this.clockwise = i;
4203
+ this.center = new S(r.x, r.y), this.radius = s, this.startAngle = e, this.endAngle = n, this.clockwise = i;
4204
4204
  } else
4205
- throw T.ILLEGAL_PARAMETERS;
4205
+ throw L.ILLEGAL_PARAMETERS;
4206
4206
  }
4207
4207
  /**
4208
4208
  * Create arc by three points
@@ -4215,12 +4215,12 @@ class gt extends st {
4215
4215
  x: (z.x + E.x) / 2,
4216
4216
  y: (z.y + E.y) / 2
4217
4217
  }), i = (z, E) => (E.y - z.y) / (E.x - z.x), h = (z) => -1 / z, r = n(t, s), a = n(s, e), o = i(t, s), c = i(s, e), l = h(o), d = h(c), m = (z, E, Z, G) => {
4218
- const F = (G - E) / (z - Z), K = z * F + E;
4219
- return { x: F, y: K };
4220
- }, x = r.y - l * r.x, g = a.y - d * a.x, p = m(l, x, d, g), _ = Math.sqrt(
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), B = 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 = !B;
4218
+ const D = (G - E) / (z - Z), Q = z * D + E;
4219
+ return { x: D, y: Q };
4220
+ }, x = r.y - l * r.x, y = a.y - d * a.x, _ = m(l, x, d, y), p = Math.sqrt(
4221
+ Math.pow(t.x - _.x, 2) + Math.pow(t.y - _.y, 2)
4222
+ ), P = (z, E) => Math.atan2(z.y - E.y, z.x - E.x), w = P(t, _), f = P(s, _), M = P(e, _), B = M > w && M < f || w > M && w < f || f > M && f < w;
4223
+ this.center = _, this.radius = p, this.startAngle = w, this.endAngle = M, this.clockwise = !B;
4224
4224
  }
4225
4225
  /**
4226
4226
  * Create circular arc by two points and one bugle factor
@@ -4235,17 +4235,17 @@ class gt extends st {
4235
4235
  */
4236
4236
  createByStartEndPointsAndBulge(t, s, e) {
4237
4237
  let n, i, h;
4238
- e < 0 ? (n = Math.atan(-e) * 4, i = new P(t), h = new P(s)) : (n = Math.atan(e) * 4, i = new P(s), h = new P(t));
4239
- const r = new P().subVectors(h, i), a = r.length(), o = new P().addVectors(i, r.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = r.normalize();
4238
+ e < 0 ? (n = Math.atan(-e) * 4, i = new b(t), h = new b(s)) : (n = Math.atan(e) * 4, i = new b(s), h = new b(t));
4239
+ const r = new b().subVectors(h, i), a = r.length(), o = new b().addVectors(i, r.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = r.normalize();
4240
4240
  let d;
4241
4241
  if (n < Math.PI) {
4242
- const m = new P(
4242
+ const m = new b(
4243
4243
  l.x * Math.cos(Math.PI / 2) - l.y * Math.sin(Math.PI / 2),
4244
4244
  l.y * Math.cos(Math.PI / 2) + l.x * Math.sin(Math.PI / 2)
4245
4245
  );
4246
4246
  d = o.add(m.multiplyScalar(-c));
4247
4247
  } else {
4248
- const m = new P(
4248
+ const m = new b(
4249
4249
  l.x * Math.cos(Math.PI / 2) - l.y * Math.sin(Math.PI / 2),
4250
4250
  l.y * Math.cos(Math.PI / 2) + l.x * Math.sin(Math.PI / 2)
4251
4251
  );
@@ -4260,7 +4260,7 @@ class gt extends st {
4260
4260
  return this._center;
4261
4261
  }
4262
4262
  set center(t) {
4263
- this._center = new b(t.x, t.y), this._boundingBoxNeedsUpdate = !0;
4263
+ this._center = new S(t.x, t.y), this._boundingBoxNeedsUpdate = !0;
4264
4264
  }
4265
4265
  /**
4266
4266
  * Radius of circular arc
@@ -4344,9 +4344,9 @@ class gt extends st {
4344
4344
  this.clockwise
4345
4345
  ) && t.push(this.getPointAtAngle(i));
4346
4346
  const e = t.map((i) => i.x), n = t.map((i) => i.y);
4347
- return new V(
4348
- new b(Math.min(...e), Math.min(...n)),
4349
- new b(Math.max(...e), Math.max(...n))
4347
+ return new U(
4348
+ new S(Math.min(...e), Math.min(...n)),
4349
+ new S(Math.max(...e), Math.max(...n))
4350
4350
  );
4351
4351
  }
4352
4352
  /**
@@ -4365,7 +4365,7 @@ class gt extends st {
4365
4365
  * @inheritdoc
4366
4366
  */
4367
4367
  clone() {
4368
- return new gt(
4368
+ return new _t(
4369
4369
  this.center.clone(),
4370
4370
  this.radius,
4371
4371
  this.startAngle,
@@ -4380,7 +4380,7 @@ class gt extends st {
4380
4380
  */
4381
4381
  getPointAtAngle(t) {
4382
4382
  const s = this.center.x + this.radius * Math.cos(t), e = this.center.y + this.radius * Math.sin(t);
4383
- return new b(s, e);
4383
+ return new S(s, e);
4384
4384
  }
4385
4385
  /**
4386
4386
  * Divide this arc into the specified nubmer of points and return those points as an array of points.
@@ -4393,17 +4393,17 @@ class gt extends st {
4393
4393
  if (this.closed && (e = I, n = 0), this.clockwise)
4394
4394
  for (let i = 0; i <= t; i++) {
4395
4395
  const h = n - e * (i / t), r = this.getPointAtAngle(h);
4396
- s.push(new b(r.x, r.y));
4396
+ s.push(new S(r.x, r.y));
4397
4397
  }
4398
4398
  else
4399
4399
  for (let i = 0; i <= t; i++) {
4400
4400
  const h = n + e * (i / t), r = this.getPointAtAngle(h);
4401
- s.push(new b(r.x, r.y));
4401
+ s.push(new S(r.x, r.y));
4402
4402
  }
4403
4403
  return s;
4404
4404
  }
4405
4405
  }
4406
- class Ps extends Dt {
4406
+ class bs extends Zt {
4407
4407
  /**
4408
4408
  * Return new shape translated by given vector.
4409
4409
  * Translation vector may be also defined by a pair of numbers.
@@ -4420,15 +4420,15 @@ class Ps extends Dt {
4420
4420
  return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
4421
4421
  }
4422
4422
  }
4423
- class Mt extends Ps {
4423
+ class et extends bs {
4424
4424
  }
4425
- class _t extends Mt {
4425
+ class pt extends et {
4426
4426
  /**
4427
4427
  * This constructor initializes the line object to use start as the start point, and end
4428
4428
  * as the endpoint. Both points must be in WCS coordinates.
4429
4429
  */
4430
4430
  constructor(t, s) {
4431
- super(), this._start = new S(t), this._end = new S(s);
4431
+ super(), this._start = new A(t), this._end = new A(s);
4432
4432
  }
4433
4433
  /**
4434
4434
  * The line's startpoint in WCS coordinates
@@ -4452,13 +4452,13 @@ class _t extends Mt {
4452
4452
  * Normalized direction vector of this line
4453
4453
  */
4454
4454
  get direction() {
4455
- return new y().subVectors(this.endPoint, this.startPoint).normalize();
4455
+ return new g().subVectors(this.endPoint, this.startPoint).normalize();
4456
4456
  }
4457
4457
  /**
4458
4458
  * The middle point of this line.
4459
4459
  */
4460
4460
  get midPoint() {
4461
- return new S(
4461
+ return new A(
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
@@ -4497,11 +4497,11 @@ class _t extends Mt {
4497
4497
  */
4498
4498
  atLength(t, s = !1) {
4499
4499
  if (s) {
4500
- const e = this.delta(X).normalize();
4501
- return new S(this._start).addScaledVector(e, t);
4500
+ const e = this.delta(Y).normalize();
4501
+ return new A(this._start).addScaledVector(e, t);
4502
4502
  } else {
4503
- const e = this.delta(X).normalize();
4504
- return new S(this._end).addScaledVector(e, t);
4503
+ const e = this.delta(Y).normalize();
4504
+ return new A(this._end).addScaledVector(e, t);
4505
4505
  }
4506
4506
  }
4507
4507
  /**
@@ -4513,14 +4513,14 @@ class _t extends Mt {
4513
4513
  */
4514
4514
  extend(t, s = !1) {
4515
4515
  if (s) {
4516
- const e = X.subVectors(this._start, this._end).normalize();
4517
- this._start = new S(this._start).addScaledVector(
4516
+ const e = Y.subVectors(this._start, this._end).normalize();
4517
+ this._start = new A(this._start).addScaledVector(
4518
4518
  e,
4519
4519
  t
4520
4520
  );
4521
4521
  } else {
4522
- const e = this.delta(X).normalize();
4523
- this._end = new S(this._end).addScaledVector(e, t);
4522
+ const e = this.delta(Y).normalize();
4523
+ this._end = new A(this._end).addScaledVector(e, t);
4524
4524
  }
4525
4525
  return this._boundingBoxNeedsUpdate = !0, this;
4526
4526
  }
@@ -4532,9 +4532,9 @@ class _t extends Mt {
4532
4532
  * @returns Return a point parameter based on the closest point as projected on the line segment.
4533
4533
  */
4534
4534
  closestPointToPointParameter(t, s) {
4535
- Lt.subVectors(t, this._start), dt.subVectors(this.endPoint, this.startPoint);
4536
- const e = dt.dot(dt);
4537
- let i = dt.dot(Lt) / e;
4535
+ Tt.subVectors(t, this._start), mt.subVectors(this.endPoint, this.startPoint);
4536
+ const e = mt.dot(mt);
4537
+ let i = mt.dot(Tt) / e;
4538
4538
  return s && (i = C.clamp(i, 0, 1)), i;
4539
4539
  }
4540
4540
  /**
@@ -4577,8 +4577,8 @@ class _t extends Mt {
4577
4577
  * Project a 3d point onto this line
4578
4578
  */
4579
4579
  project(t) {
4580
- const s = this.direction, n = X.subVectors(t, this.startPoint).dot(s);
4581
- return new S().copy(s).multiplyScalar(n).add(this.startPoint);
4580
+ const s = this.direction, n = Y.subVectors(t, this.startPoint).dot(s);
4581
+ return new A().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
@@ -4588,23 +4588,23 @@ class _t extends Mt {
4588
4588
  * @returns Return the point on the line that is the closest to the given point.
4589
4589
  */
4590
4590
  perpPoint(t) {
4591
- const s = this.direction, e = this.startPoint, i = X.subVectors(t, e).dot(s), h = X.copy(s).multiplyScalar(i);
4592
- return new S().addVectors(e, h);
4591
+ const s = this.direction, e = this.startPoint, i = Y.subVectors(t, e).dot(s), h = Y.copy(s).multiplyScalar(i);
4592
+ return new A().addVectors(e, h);
4593
4593
  }
4594
4594
  /**
4595
4595
  * @inheritdoc
4596
4596
  */
4597
4597
  calculateBoundingBox() {
4598
- const t = new S(
4598
+ const t = new A(
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 S(
4602
+ ), s = new A(
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)
4606
4606
  );
4607
- return new Y(t, s);
4607
+ return new j(t, s);
4608
4608
  }
4609
4609
  /**
4610
4610
  * @inheritdoc
@@ -4628,11 +4628,11 @@ class _t extends Mt {
4628
4628
  * @inheritdoc
4629
4629
  */
4630
4630
  clone() {
4631
- return new _t(this._start.clone(), this._end.clone());
4631
+ return new pt(this._start.clone(), this._end.clone());
4632
4632
  }
4633
4633
  }
4634
- const X = /* @__PURE__ */ new y(), Lt = /* @__PURE__ */ new y(), dt = /* @__PURE__ */ new y();
4635
- class yt extends Mt {
4634
+ const Y = /* @__PURE__ */ new g(), Tt = /* @__PURE__ */ new g(), mt = /* @__PURE__ */ new g();
4635
+ class gt extends et {
4636
4636
  /**
4637
4637
  * Compute center point of the arc given three points
4638
4638
  * @param startPoint Input start point of the arc
@@ -4641,11 +4641,11 @@ class yt extends Mt {
4641
4641
  * @returns Return center point of the arc
4642
4642
  */
4643
4643
  static computeCenterPoint(t, s, e) {
4644
- const n = new y().addVectors(t, s).multiplyScalar(0.5), i = new y().addVectors(t, e).multiplyScalar(0.5), h = new y().subVectors(s, t), r = new y().subVectors(e, t), a = new y().crossVectors(h, r).normalize();
4644
+ const n = new g().addVectors(t, s).multiplyScalar(0.5), i = new g().addVectors(t, e).multiplyScalar(0.5), h = new g().subVectors(s, t), r = new g().subVectors(e, t), a = new g().crossVectors(h, r).normalize();
4645
4645
  if (a.lengthSq() === 0)
4646
4646
  return console.error("Points are collinear and cannot form a valid arc."), null;
4647
- const o = new y().crossVectors(h, a).normalize(), c = new y().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = new _t(n, n.clone().add(l)), x = new _t(i, i.clone().add(d)), g = new y();
4648
- return m.closestPointToPoint(x.startPoint, !0, g) ? g : (console.error("Cannot find a valid center for the arc."), null);
4647
+ const o = new g().crossVectors(h, a).normalize(), c = new g().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = new pt(n, n.clone().add(l)), x = new pt(i, i.clone().add(d)), y = new g();
4648
+ return m.closestPointToPoint(x.startPoint, !0, y) ? y : (console.error("Cannot find a valid center for the arc."), null);
4649
4649
  }
4650
4650
  /**
4651
4651
  * Create arc by three points
@@ -4654,19 +4654,19 @@ class yt extends Mt {
4654
4654
  * @param pointOnArc Input one point between the start point and the end point
4655
4655
  */
4656
4656
  static createByThreePoints(t, s, e) {
4657
- const n = yt.computeCenterPoint(
4657
+ const n = gt.computeCenterPoint(
4658
4658
  t,
4659
4659
  s,
4660
4660
  e
4661
4661
  );
4662
4662
  if (n) {
4663
- const i = n.distanceTo(t), h = new y().subVectors(t, n), r = new y().subVectors(s, n), a = Math.atan2(h.y, h.x), o = Math.atan2(r.y, r.x);
4664
- return new yt(
4663
+ const i = n.distanceTo(t), h = new g().subVectors(t, n), r = new g().subVectors(s, n), a = Math.atan2(h.y, h.x), o = Math.atan2(r.y, r.x);
4664
+ return new gt(
4665
4665
  n,
4666
4666
  i,
4667
4667
  a,
4668
4668
  o,
4669
- y.Z_AXIS
4669
+ g.Z_AXIS
4670
4670
  );
4671
4671
  }
4672
4672
  }
@@ -4679,7 +4679,7 @@ class yt extends Mt {
4679
4679
  * @param normal The normal vector of the plane in which the arc lies.
4680
4680
  * @param refVec The reference vector from which angles are measured. Default value is x axis.
4681
4681
  */
4682
- constructor(t, s, e, n, i, h = y.X_AXIS) {
4682
+ constructor(t, s, e, n, i, h = g.X_AXIS) {
4683
4683
  super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = h, (n - e) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = e, this.endAngle = n);
4684
4684
  }
4685
4685
  /**
@@ -4689,7 +4689,7 @@ class yt extends Mt {
4689
4689
  return this._center;
4690
4690
  }
4691
4691
  set center(t) {
4692
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4692
+ this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4693
4693
  }
4694
4694
  /**
4695
4695
  * Radius of circular arc
@@ -4698,7 +4698,7 @@ class yt extends Mt {
4698
4698
  return this._radius;
4699
4699
  }
4700
4700
  set radius(t) {
4701
- if (t < 0) throw T.ILLEGAL_PARAMETERS;
4701
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
4702
4702
  this._radius = t, this._boundingBoxNeedsUpdate = !0;
4703
4703
  }
4704
4704
  /**
@@ -4744,7 +4744,7 @@ class yt extends Mt {
4744
4744
  return this._normal;
4745
4745
  }
4746
4746
  set normal(t) {
4747
- this._normal = new y(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
4747
+ this._normal = new g(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
4748
4748
  }
4749
4749
  /**
4750
4750
  * The unit reference vector of circular arc
@@ -4753,7 +4753,7 @@ class yt extends Mt {
4753
4753
  return this._refVec;
4754
4754
  }
4755
4755
  set refVec(t) {
4756
- this._refVec = new y(t.x, t.y, t.z), this._refVec.normalize(), this._boundingBoxNeedsUpdate = !0;
4756
+ this._refVec = new g(t.x, t.y, t.z), this._refVec.normalize(), this._boundingBoxNeedsUpdate = !0;
4757
4757
  }
4758
4758
  /**
4759
4759
  * The start point of circular arc
@@ -4785,7 +4785,7 @@ class yt extends Mt {
4785
4785
  const o = this.getPointAtAngle(a);
4786
4786
  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 > h && (h = o.y), o.z > r && (r = o.z);
4787
4787
  }
4788
- return new Y(
4788
+ return new j(
4789
4789
  { x: s, y: e, z: n },
4790
4790
  { x: i, y: h, z: r }
4791
4791
  );
@@ -4829,7 +4829,7 @@ class yt extends Mt {
4829
4829
  * @inheritdoc
4830
4830
  */
4831
4831
  clone() {
4832
- return new yt(
4832
+ return new gt(
4833
4833
  this.center.clone(),
4834
4834
  this.radius,
4835
4835
  this.startAngle,
@@ -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, h = this.radius;
4862
- return new S(
4862
+ return new A(
4863
4863
  i.x + h * (e.x * Math.cos(t) + n.x * Math.sin(t)),
4864
4864
  i.y + h * (e.y * Math.cos(t) + n.y * Math.sin(t)),
4865
4865
  i.z + h * (e.z * Math.cos(t) + n.z * Math.sin(t))
@@ -4869,12 +4869,12 @@ class yt extends Mt {
4869
4869
  * Return the plane in which the circular arc lies.
4870
4870
  */
4871
4871
  get plane() {
4872
- const t = new y(this.center).distanceTo(jt);
4873
- return new zt(this.normal, t);
4872
+ const t = new g(this.center).distanceTo(Ft);
4873
+ return new Mt(this.normal, t);
4874
4874
  }
4875
4875
  }
4876
- const Pt = /* @__PURE__ */ new y();
4877
- class Zt extends st {
4876
+ const Pt = /* @__PURE__ */ new g();
4877
+ class Qt extends st {
4878
4878
  /**
4879
4879
  * Construct an instance of the ellipse arc.
4880
4880
  * @param center Center point of the ellipse.
@@ -4896,7 +4896,7 @@ class Zt extends st {
4896
4896
  return this._center;
4897
4897
  }
4898
4898
  set center(t) {
4899
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4899
+ this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
4900
4900
  }
4901
4901
  /**
4902
4902
  * Major axis radius of the ellipse
@@ -4905,7 +4905,7 @@ class Zt extends st {
4905
4905
  return this._majorAxisRadius;
4906
4906
  }
4907
4907
  set majorAxisRadius(t) {
4908
- if (t < 0) throw T.ILLEGAL_PARAMETERS;
4908
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
4909
4909
  this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
4910
4910
  }
4911
4911
  /**
@@ -4915,7 +4915,7 @@ class Zt extends st {
4915
4915
  return this._minorAxisRadius;
4916
4916
  }
4917
4917
  set minorAxisRadius(t) {
4918
- if (t < 0) throw T.ILLEGAL_PARAMETERS;
4918
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
4919
4919
  this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
4920
4920
  }
4921
4921
  /**
@@ -4978,7 +4978,7 @@ class Zt extends st {
4978
4978
  const r = this.getPoint(h / 100);
4979
4979
  s = Math.min(s, r.x), e = Math.min(e, r.y), n = Math.max(n, r.x), i = Math.max(i, r.y);
4980
4980
  }
4981
- return new V({ x: s, y: e }, { x: n, y: i });
4981
+ return new U({ x: s, y: e }, { x: n, y: i });
4982
4982
  }
4983
4983
  /**
4984
4984
  * Return true if its start point is identical to its end point. Otherwise, return false.
@@ -5004,7 +5004,7 @@ class Zt extends st {
5004
5004
  const a = Math.cos(this.rotation), o = Math.sin(this.rotation), c = h - this.center.x, l = r - this.center.y;
5005
5005
  h = c * a - l * o + this.center.x, r = c * o + l * a + this.center.y;
5006
5006
  }
5007
- return new b(h, r);
5007
+ return new S(h, r);
5008
5008
  }
5009
5009
  /**
5010
5010
  * @inheritdoc
@@ -5022,7 +5022,7 @@ class Zt extends st {
5022
5022
  * @inheritdoc
5023
5023
  */
5024
5024
  clone() {
5025
- return new Zt(
5025
+ return new Qt(
5026
5026
  this.center,
5027
5027
  this.majorAxisRadius,
5028
5028
  this.minorAxisRadius,
@@ -5033,7 +5033,7 @@ class Zt extends st {
5033
5033
  );
5034
5034
  }
5035
5035
  }
5036
- class Gt extends Mt {
5036
+ class Ot extends et {
5037
5037
  /**
5038
5038
  * Construct an instance of the ellipse arc.
5039
5039
  * @param center Center point of the ellipse.
@@ -5056,7 +5056,7 @@ class Gt extends Mt {
5056
5056
  return this._center;
5057
5057
  }
5058
5058
  set center(t) {
5059
- this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
5059
+ this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
5060
5060
  }
5061
5061
  /**
5062
5062
  * Major axis radius of the ellipse
@@ -5065,7 +5065,7 @@ class Gt extends Mt {
5065
5065
  return this._majorAxisRadius;
5066
5066
  }
5067
5067
  set majorAxisRadius(t) {
5068
- if (t < 0) throw T.ILLEGAL_PARAMETERS;
5068
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
5069
5069
  this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
5070
5070
  }
5071
5071
  /**
@@ -5075,7 +5075,7 @@ class Gt extends Mt {
5075
5075
  return this._minorAxisRadius;
5076
5076
  }
5077
5077
  set minorAxisRadius(t) {
5078
- if (t < 0) throw T.ILLEGAL_PARAMETERS;
5078
+ if (t < 0) throw L.ILLEGAL_PARAMETERS;
5079
5079
  this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
5080
5080
  }
5081
5081
  /**
@@ -5122,7 +5122,7 @@ class Gt extends Mt {
5122
5122
  return this._normal;
5123
5123
  }
5124
5124
  set normal(t) {
5125
- this._normal = new y(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
5125
+ this._normal = new g(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
5126
5126
  }
5127
5127
  /**
5128
5128
  * Unit major axis vector (in WCS coordinates) of the ellipse. The major axis vector is the vector from the
@@ -5132,13 +5132,13 @@ class Gt extends Mt {
5132
5132
  return this._majorAxis;
5133
5133
  }
5134
5134
  set majorAxis(t) {
5135
- this._majorAxis = new y(t.x, t.y, t.z), this._majorAxis.normalize(), this._boundingBoxNeedsUpdate = !0;
5135
+ this._majorAxis = new g(t.x, t.y, t.z), this._majorAxis.normalize(), this._boundingBoxNeedsUpdate = !0;
5136
5136
  }
5137
5137
  /**
5138
5138
  * Unit minor axis vector (in WCS coordinates) of the ellipse.
5139
5139
  */
5140
5140
  get minorAxis() {
5141
- return new y().crossVectors(this.normal, this.majorAxis).normalize();
5141
+ return new g().crossVectors(this.normal, this.majorAxis).normalize();
5142
5142
  }
5143
5143
  /**
5144
5144
  * Compute the start point of the ellipse arc.
@@ -5157,10 +5157,19 @@ class Gt extends Mt {
5157
5157
  /**
5158
5158
  * @inheritdoc
5159
5159
  */
5160
+ /**
5161
+ * Check if this ellipse arc is actually a circular arc (major and minor radii are equal)
5162
+ * @returns True if the ellipse arc is circular
5163
+ */
5164
+ get isCircular() {
5165
+ return Xt.equal(this.majorAxisRadius, this.minorAxisRadius);
5166
+ }
5160
5167
  get length() {
5161
- const s = this.deltaAngle / 1e3;
5168
+ if (this.isCircular)
5169
+ return this.majorAxisRadius * Math.abs(this.deltaAngle);
5170
+ const t = 1e3, s = this.deltaAngle / t;
5162
5171
  let e = 0, n = this.getPointAtAngle(this.startAngle);
5163
- for (let i = 1; i <= 1e3; i++) {
5172
+ for (let i = 1; i <= t; i++) {
5164
5173
  const h = this.startAngle + i * s, r = this.getPointAtAngle(h), a = r.x - n.x, o = r.y - n.y, c = r.z - n.z;
5165
5174
  e += Math.sqrt(a * a + o * o + c * c), n = r;
5166
5175
  }
@@ -5172,7 +5181,7 @@ class Gt extends Mt {
5172
5181
  * @returns Return bounding box containing the min and max coordinates
5173
5182
  */
5174
5183
  calculateBoundingBox() {
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)) {
5184
+ 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)) {
5176
5185
  const t = [this.startAngle, this.endAngle];
5177
5186
  for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
5178
5187
  C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
@@ -5181,7 +5190,7 @@ class Gt extends Mt {
5181
5190
  const o = this.getPointAtAngle(a);
5182
5191
  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 > h && (h = o.y), o.z > r && (r = o.z);
5183
5192
  }
5184
- return new Y(
5193
+ return new j(
5185
5194
  { x: s, y: e, z: n },
5186
5195
  { x: i, y: h, z: r }
5187
5196
  );
@@ -5191,7 +5200,7 @@ class Gt extends Mt {
5191
5200
  const o = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(o);
5192
5201
  s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x), h = Math.max(h, c.y), r = Math.max(r, c.z);
5193
5202
  }
5194
- return new Y(
5203
+ return new j(
5195
5204
  { x: s, y: e, z: n },
5196
5205
  { x: i, y: h, z: r }
5197
5206
  );
@@ -5220,7 +5229,7 @@ class Gt extends Mt {
5220
5229
  */
5221
5230
  getPointAtAngle(t) {
5222
5231
  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 S(
5232
+ return new A(
5224
5233
  this.center.x + i.x,
5225
5234
  this.center.y + i.y,
5226
5235
  this.center.z + i.z
@@ -5232,7 +5241,7 @@ class Gt extends Mt {
5232
5241
  * @returns - True if the point is inside the ellipse, false otherwise.
5233
5242
  */
5234
5243
  contains(t) {
5235
- const s = new y(t).sub(this.center), e = s.dot(this.majorAxis), n = s.dot(this.minorAxis), i = e / this.majorAxisRadius, h = n / this.minorAxisRadius;
5244
+ const s = new g(t).sub(this.center), e = s.dot(this.majorAxis), n = s.dot(this.minorAxis), i = e / this.majorAxisRadius, h = n / this.minorAxisRadius;
5236
5245
  return i * i + h * h <= 1;
5237
5246
  }
5238
5247
  /**
@@ -5251,7 +5260,7 @@ class Gt extends Mt {
5251
5260
  * @inheritdoc
5252
5261
  */
5253
5262
  clone() {
5254
- return new Gt(
5263
+ return new Ot(
5255
5264
  this.center,
5256
5265
  this.normal,
5257
5266
  this.majorAxis,
@@ -5265,11 +5274,11 @@ class Gt extends Mt {
5265
5274
  * Return the plane in which the ellipse arc lies.
5266
5275
  */
5267
5276
  get plane() {
5268
- const t = new y(this.center).distanceTo(jt);
5269
- return new zt(this.normal, t);
5277
+ const t = new g(this.center).distanceTo(Ft);
5278
+ return new Mt(this.normal, t);
5270
5279
  }
5271
5280
  }
5272
- class Bs extends st {
5281
+ class Rs extends st {
5273
5282
  constructor(t = null, s = !1) {
5274
5283
  super(), this._vertices = t || new Array(), this._closed = s;
5275
5284
  }
@@ -5291,7 +5300,7 @@ class Bs extends st {
5291
5300
  get startPoint() {
5292
5301
  if (this.numberOfVertices > 0) {
5293
5302
  const t = this._vertices[0];
5294
- return new b(t.x, t.y);
5303
+ return new S(t.x, t.y);
5295
5304
  }
5296
5305
  throw new Error("Start point does not exist in an empty polyline.");
5297
5306
  }
@@ -5303,10 +5312,10 @@ class Bs extends st {
5303
5312
  if (t > 0)
5304
5313
  if (this.closed) {
5305
5314
  const s = this._vertices[0];
5306
- return new b(s.x, s.y);
5315
+ return new S(s.x, s.y);
5307
5316
  } else {
5308
5317
  const s = this._vertices[t - 1];
5309
- return new b(s.x, s.y);
5318
+ return new S(s.x, s.y);
5310
5319
  }
5311
5320
  throw new Error("End point does not exist in an empty polyline.");
5312
5321
  }
@@ -5321,10 +5330,10 @@ class Bs extends st {
5321
5330
  let i = null;
5322
5331
  if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
5323
5332
  if (n.bulge) {
5324
- const h = new gt(n, i, n.bulge);
5333
+ const h = new _t(n, i, n.bulge);
5325
5334
  t += h.length;
5326
5335
  } else
5327
- t += new b(n.x, n.y).distanceTo(i);
5336
+ t += new S(n.x, n.y).distanceTo(i);
5328
5337
  }
5329
5338
  return t;
5330
5339
  }
@@ -5355,14 +5364,14 @@ class Bs extends st {
5355
5364
  */
5356
5365
  getPointAt(t) {
5357
5366
  const s = this._vertices[t];
5358
- return new b(s.x, s.y);
5367
+ return new S(s.x, s.y);
5359
5368
  }
5360
5369
  /**
5361
5370
  * @inheritdoc
5362
5371
  */
5363
5372
  calculateBoundingBox() {
5364
5373
  const t = this.getPoints(100);
5365
- return new V().setFromPoints(t);
5374
+ return new U().setFromPoints(t);
5366
5375
  }
5367
5376
  /**
5368
5377
  * @inheritdoc
@@ -5379,7 +5388,7 @@ class Bs extends st {
5379
5388
  getPoints3d(t, s) {
5380
5389
  const e = [];
5381
5390
  return this.getPoints(t).forEach(
5382
- (i) => e.push(new S().set(i.x, i.y, s))
5391
+ (i) => e.push(new A().set(i.x, i.y, s))
5383
5392
  ), e;
5384
5393
  }
5385
5394
  /**
@@ -5394,25 +5403,25 @@ class Bs extends st {
5394
5403
  if (i.bulge) {
5395
5404
  let h = null;
5396
5405
  if (n < e - 1 ? h = this._vertices[n + 1] : n == e - 1 && this.closed && (h = this._vertices[0]), h) {
5397
- const a = new gt(i, h, i.bulge).getPoints(t), o = a.length;
5406
+ const a = new _t(i, h, i.bulge).getPoints(t), o = a.length;
5398
5407
  for (let c = 0; c < o; ++c) {
5399
5408
  const l = a[c];
5400
- s.push(new b(l.x, l.y));
5409
+ s.push(new S(l.x, l.y));
5401
5410
  }
5402
5411
  }
5403
5412
  } else
5404
- s.push(new b(i.x, i.y)), n == e - 1 && this.closed && s.push(s[0]);
5413
+ s.push(new S(i.x, i.y)), n == e - 1 && this.closed && s.push(s[0]);
5405
5414
  }
5406
5415
  return s;
5407
5416
  }
5408
5417
  }
5409
- class Kt extends st {
5418
+ class Ht extends st {
5410
5419
  /**
5411
5420
  * This constructor initializes the line object to use start as the start point, and end
5412
5421
  * as the endpoint. Both points must be in WCS coordinates.
5413
5422
  */
5414
5423
  constructor(t, s) {
5415
- super(), this._start = new b(t), this._end = new b(s);
5424
+ super(), this._start = new S(t), this._end = new S(s);
5416
5425
  }
5417
5426
  /**
5418
5427
  * The line's startpoint in WCS coordinates
@@ -5451,14 +5460,14 @@ class Kt extends st {
5451
5460
  * @inheritdoc
5452
5461
  */
5453
5462
  calculateBoundingBox() {
5454
- const t = new b(
5463
+ const t = new S(
5455
5464
  Math.min(this._start.x, this._end.x),
5456
5465
  Math.min(this._start.y, this._end.y)
5457
- ), s = new b(
5466
+ ), s = new S(
5458
5467
  Math.max(this._start.x, this._end.x),
5459
5468
  Math.max(this._start.y, this._end.y)
5460
5469
  );
5461
- return new V(t, s);
5470
+ return new U(t, s);
5462
5471
  }
5463
5472
  /**
5464
5473
  * @inheritdoc
@@ -5482,10 +5491,10 @@ class Kt extends st {
5482
5491
  * @inheritdoc
5483
5492
  */
5484
5493
  clone() {
5485
- return new Kt(this._start.clone(), this._end.clone());
5494
+ return new Ht(this._start.clone(), this._end.clone());
5486
5495
  }
5487
5496
  }
5488
- class Is extends st {
5497
+ class ks extends st {
5489
5498
  /**
5490
5499
  * Create one loop by connected curves
5491
5500
  * @param curves Input one array of connected curves
@@ -5515,7 +5524,7 @@ class Is extends st {
5515
5524
  get startPoint() {
5516
5525
  if (this._curves.length > 0) {
5517
5526
  const t = this._curves[0].startPoint;
5518
- return new b(t.x, t.y);
5527
+ return new S(t.x, t.y);
5519
5528
  }
5520
5529
  throw new Error("Start point does not exist in an empty loop.");
5521
5530
  }
@@ -5538,7 +5547,7 @@ class Is extends st {
5538
5547
  * @inheritdoc
5539
5548
  */
5540
5549
  calculateBoundingBox() {
5541
- const t = this.getPoints(100), s = new V();
5550
+ const t = this.getPoints(100), s = new U();
5542
5551
  return s.setFromPoints(t), s;
5543
5552
  }
5544
5553
  /**
@@ -5562,24 +5571,225 @@ class Is extends st {
5562
5571
  const s = [];
5563
5572
  return this.curves.forEach((e) => {
5564
5573
  e.getPoints(t).forEach((n) => {
5565
- s.push(new b(n.x, n.y));
5574
+ s.push(new S(n.x, n.y));
5566
5575
  });
5567
5576
  }), s;
5568
5577
  }
5569
5578
  }
5570
- class D {
5579
+ class bt {
5580
+ constructor() {
5581
+ this.c0 = 0, this.c1 = 0, this.c2 = 0, this.c3 = 0;
5582
+ }
5583
+ /**
5584
+ * Compute coefficients for a cubic polynomial
5585
+ * p(s) = c0 + c1*s + c2*s^2 + c3*s^3
5586
+ * such that
5587
+ * p(0) = x0, p(1) = x1
5588
+ * and
5589
+ * p'(0) = t0, p'(1) = t1.
5590
+ */
5591
+ init(t, s, e, n) {
5592
+ this.c0 = t, this.c1 = e, this.c2 = -3 * t + 3 * s - 2 * e - n, this.c3 = 2 * t - 2 * s + e + n;
5593
+ }
5594
+ /**
5595
+ * Initialize for Catmull-Rom interpolation
5596
+ */
5597
+ initCatmullRom(t, s, e, n, i) {
5598
+ this.init(s, e, i * (e - t), i * (n - s));
5599
+ }
5600
+ /**
5601
+ * Initialize for non-uniform Catmull-Rom interpolation
5602
+ */
5603
+ initNonuniformCatmullRom(t, s, e, n, i, h, r) {
5604
+ let a = (s - t) / i - (e - t) / (i + h) + (e - s) / h, o = (e - s) / h - (n - s) / (h + r) + (n - e) / r;
5605
+ a *= h, o *= h, this.init(s, e, a, o);
5606
+ }
5607
+ /**
5608
+ * Calculate the polynomial value at parameter t
5609
+ */
5610
+ calc(t) {
5611
+ const s = t * t, e = s * t;
5612
+ return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
5613
+ }
5614
+ }
5615
+ class Ss extends et {
5616
+ /**
5617
+ * Constructs a new Catmull-Rom curve.
5618
+ *
5619
+ * @param points - An array of 3D points defining the curve.
5620
+ * @param closed - Whether the curve is closed or not.
5621
+ * @param curveType - The curve type.
5622
+ * @param tension - Tension of the curve.
5623
+ */
5624
+ constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
5625
+ super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new g(), this._px = new bt(), this._py = new bt(), this._pz = new bt(), this._points = t.map((i) => new A(i)), this._closed = s, this._curveType = e, this._tension = n;
5626
+ }
5627
+ /**
5628
+ * An array of 3D points defining the curve.
5629
+ */
5630
+ get points() {
5631
+ return this._points;
5632
+ }
5633
+ /**
5634
+ * Whether the curve is closed or not.
5635
+ */
5636
+ get closed() {
5637
+ return this._closed;
5638
+ }
5639
+ /**
5640
+ * The curve type.
5641
+ */
5642
+ get curveType() {
5643
+ return this._curveType;
5644
+ }
5645
+ /**
5646
+ * Tension of the curve.
5647
+ */
5648
+ get tension() {
5649
+ return this._tension;
5650
+ }
5651
+ /**
5652
+ * Start point of this curve.
5653
+ */
5654
+ get startPoint() {
5655
+ return this._points.length > 0 ? this._points[0] : new A();
5656
+ }
5657
+ /**
5658
+ * End point of this curve.
5659
+ */
5660
+ get endPoint() {
5661
+ return this._points.length > 0 ? this._points[this._points.length - 1] : new A();
5662
+ }
5663
+ /**
5664
+ * Length of this curve (approximated).
5665
+ */
5666
+ get length() {
5667
+ if (this._points.length < 2) return 0;
5668
+ let t = 0;
5669
+ for (let s = 1; s < this._points.length; s++)
5670
+ t += this._points[s - 1].distanceTo(this._points[s]);
5671
+ return this._closed && this._points.length > 2 && (t += this._points[this._points.length - 1].distanceTo(
5672
+ this._points[0]
5673
+ )), t;
5674
+ }
5675
+ /**
5676
+ * Returns a point on the curve.
5677
+ *
5678
+ * @param t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
5679
+ * @param optionalTarget - The optional target vector the result is written to.
5680
+ * @return The position on the curve.
5681
+ */
5682
+ getPoint(t, s = new A()) {
5683
+ const e = s, n = this._points, i = n.length;
5684
+ if (i === 0)
5685
+ return e.set(0, 0, 0);
5686
+ if (i === 1)
5687
+ return e.copy(n[0]);
5688
+ const h = (i - (this._closed ? 0 : 1)) * t;
5689
+ let r = Math.floor(h), a = h - r;
5690
+ this._closed ? r += r > 0 ? 0 : (Math.floor(Math.abs(r) / i) + 1) * i : a === 0 && r === i - 1 && (r = i - 2, a = 1);
5691
+ let o, c;
5692
+ this._closed || r > 0 ? o = n[(r - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), o = new A(this._tmp.x, this._tmp.y, this._tmp.z));
5693
+ const l = n[r % i], d = n[(r + 1) % i];
5694
+ if (this._closed || r + 2 < i ? c = n[(r + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new A(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
5695
+ const m = this._curveType === "chordal" ? 0.5 : 0.25;
5696
+ let x = Math.pow(o.distanceToSquared(l), m), y = Math.pow(l.distanceToSquared(d), m), _ = Math.pow(d.distanceToSquared(c), m);
5697
+ y < 1e-4 && (y = 1), x < 1e-4 && (x = y), _ < 1e-4 && (_ = y), this._px.initNonuniformCatmullRom(o.x, l.x, d.x, c.x, x, y, _), this._py.initNonuniformCatmullRom(o.y, l.y, d.y, c.y, x, y, _), this._pz.initNonuniformCatmullRom(o.z, l.z, d.z, c.z, x, y, _);
5698
+ } else this._curveType === "catmullrom" && (this._px.initCatmullRom(o.x, l.x, d.x, c.x, this._tension), this._py.initCatmullRom(o.y, l.y, d.y, c.y, this._tension), this._pz.initCatmullRom(o.z, l.z, d.z, c.z, this._tension));
5699
+ return e.set(
5700
+ this._px.calc(a),
5701
+ this._py.calc(a),
5702
+ this._pz.calc(a)
5703
+ ), e;
5704
+ }
5705
+ /**
5706
+ * Get an array of points along the curve
5707
+ * @param divisions - Number of divisions to create
5708
+ * @returns Array of points along the curve
5709
+ */
5710
+ getPoints(t) {
5711
+ const s = [];
5712
+ for (let e = 0; e <= t; e++)
5713
+ s.push(this.getPoint(e / t));
5714
+ return s;
5715
+ }
5716
+ /**
5717
+ * Set the points defining the curve
5718
+ * @param points - Array of points
5719
+ */
5720
+ setPoints(t) {
5721
+ this._points = t.map((s) => new A(s)), this._boundingBoxNeedsUpdate = !0;
5722
+ }
5723
+ /**
5724
+ * Set whether the curve is closed
5725
+ * @param closed - Whether the curve should be closed
5726
+ */
5727
+ setClosed(t) {
5728
+ this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0);
5729
+ }
5730
+ /**
5731
+ * Set the curve type
5732
+ * @param curveType - The curve type
5733
+ */
5734
+ setCurveType(t) {
5735
+ this._curveType = t;
5736
+ }
5737
+ /**
5738
+ * Set the tension of the curve
5739
+ * @param tension - The tension value
5740
+ */
5741
+ setTension(t) {
5742
+ this._tension = t;
5743
+ }
5744
+ /**
5745
+ * Transforms the curve by applying the input matrix.
5746
+ * @param matrix Input transformation matrix
5747
+ * @return Return this curve
5748
+ */
5749
+ transform(t) {
5750
+ return this._points = this._points.map((s) => {
5751
+ const e = new A();
5752
+ return e.copy(s), e.applyMatrix3d(t), e;
5753
+ }), this._boundingBoxNeedsUpdate = !0, this;
5754
+ }
5755
+ /**
5756
+ * Calculate the bounding box of this curve.
5757
+ * @return The bounding box
5758
+ */
5759
+ calculateBoundingBox() {
5760
+ if (this._points.length === 0)
5761
+ return new j();
5762
+ const t = new j();
5763
+ return this._points.forEach((s) => {
5764
+ t.expandByPoint(s);
5765
+ }), t;
5766
+ }
5767
+ }
5768
+ class q {
5571
5769
  constructor(t, s, e, n) {
5572
- this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) => [...i]), this._weights = n ? [...n] : new Array(e.length).fill(1);
5770
+ this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) => ({ x: i.x, y: i.y, z: i.z })), this._weights = n ? [...n] : new Array(e.length).fill(1);
5573
5771
  }
5772
+ /**
5773
+ * Get the degree of the NURBS curve
5774
+ */
5574
5775
  degree() {
5575
5776
  return this._degree;
5576
5777
  }
5778
+ /**
5779
+ * Get the knot vector
5780
+ */
5577
5781
  knots() {
5578
5782
  return [...this._knots];
5579
5783
  }
5784
+ /**
5785
+ * Get the control points
5786
+ */
5580
5787
  controlPoints() {
5581
- return this._controlPoints.map((t) => [...t]);
5788
+ return this._controlPoints.map((t) => ({ x: t.x, y: t.y, z: t.z }));
5582
5789
  }
5790
+ /**
5791
+ * Get the weights
5792
+ */
5583
5793
  weights() {
5584
5794
  return [...this._weights];
5585
5795
  }
@@ -5587,11 +5797,12 @@ class D {
5587
5797
  * Calculate a point on the curve at parameter u
5588
5798
  */
5589
5799
  point(t) {
5590
- return xt(
5800
+ const s = this._controlPoints.map((e) => [e.x, e.y, e.z]);
5801
+ return yt(
5591
5802
  t,
5592
5803
  this._degree,
5593
5804
  this._knots,
5594
- this._controlPoints,
5805
+ s,
5595
5806
  this._weights
5596
5807
  );
5597
5808
  }
@@ -5599,10 +5810,11 @@ class D {
5599
5810
  * Calculate curve length using numerical integration
5600
5811
  */
5601
5812
  length() {
5602
- return ps(
5813
+ const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
5814
+ return Ms(
5603
5815
  this._degree,
5604
5816
  this._knots,
5605
- this._controlPoints,
5817
+ t,
5606
5818
  this._weights
5607
5819
  );
5608
5820
  }
@@ -5610,7 +5822,7 @@ class D {
5610
5822
  * Create a NURBS curve from control points and knots
5611
5823
  */
5612
5824
  static byKnotsControlPointsWeights(t, s, e, n) {
5613
- return new D(t, s, e, n);
5825
+ return new q(t, s, e, n);
5614
5826
  }
5615
5827
  /**
5616
5828
  * Create a NURBS curve from fit points using interpolation
@@ -5619,94 +5831,131 @@ class D {
5619
5831
  let n;
5620
5832
  switch (e) {
5621
5833
  case "Chord":
5622
- n = gs(s, t);
5834
+ n = ps(s, t);
5623
5835
  break;
5624
5836
  case "SqrtChord":
5625
- n = _s(s, t);
5837
+ n = zs(s, t);
5626
5838
  break;
5627
5839
  case "Uniform":
5628
5840
  default:
5629
- n = ys(s, t.length);
5841
+ n = _s(s, t.length);
5630
5842
  break;
5631
5843
  }
5632
- const i = zs(t), h = new Array(i.length).fill(1);
5633
- return new D(s, n, i, h);
5844
+ const i = t.map((r) => ({ x: r[0], y: r[1], z: r[2] })), h = new Array(i.length).fill(1);
5845
+ return new q(s, n, i, h);
5634
5846
  }
5635
- }
5636
- class Es extends Mt {
5637
- constructor(t, s, e) {
5638
- super();
5639
- const n = +(t !== void 0) + +(s !== void 0) + +(e !== void 0);
5640
- if (n != 2 && n != 3)
5641
- throw T.ILLEGAL_PARAMETERS;
5642
- const i = 3;
5643
- if (this._closed = !1, n == 2 && !Array.isArray(s)) {
5644
- if (this._fitPoints = t, this._knotParameterization = s, this._fitPoints.length < 4)
5645
- throw T.ILLEGAL_PARAMETERS;
5646
- const h = this.toNurbsPoints(this._fitPoints);
5647
- this._nurbsCurve = D.byPoints(
5648
- h,
5649
- i,
5650
- this._knotParameterization
5651
- ), this._controlPoints = this.toGePoints(this._nurbsCurve.controlPoints()), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = [...this._nurbsCurve.weights()];
5652
- } else {
5653
- if (this._controlPoints = t, this._controlPoints.length < 4)
5654
- throw T.ILLEGAL_PARAMETERS;
5655
- const h = this.toNurbsPoints(this._controlPoints);
5656
- this._nurbsCurve = D.byKnotsControlPointsWeights(
5657
- i,
5658
- s,
5659
- h,
5660
- e
5661
- ), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = e ? [...e] : new Array(this._controlPoints.length).fill(1);
5847
+ /**
5848
+ * Get the valid parameter range for this curve
5849
+ */
5850
+ getParameterRange() {
5851
+ const t = this._knots[this._degree], s = this._knots[this._knots.length - this._degree - 1];
5852
+ return { start: t, end: s };
5853
+ }
5854
+ /**
5855
+ * Get points along the curve
5856
+ * @param divisions - Number of divisions to create
5857
+ * @returns Array of points along the curve
5858
+ */
5859
+ getPoints(t) {
5860
+ const s = [], { start: e, end: n } = this.getParameterRange();
5861
+ for (let i = 0; i <= t; i++) {
5862
+ const h = e + (n - e) * (i / t);
5863
+ s.push(this.point(h));
5662
5864
  }
5865
+ return s;
5663
5866
  }
5664
5867
  /**
5665
- * Set the closed property and rebuild the curve if necessary
5868
+ * Check if the curve is closed by comparing start and end points
5666
5869
  */
5667
- setClosed(t) {
5668
- this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0, t ? this.makeClosed() : this.makeOpen());
5870
+ isClosed(t = 1e-6) {
5871
+ const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), h = n[0] - i[0], r = n[1] - i[1], a = n[2] - i[2];
5872
+ return Math.sqrt(h * h + r * r + a * a) < t;
5669
5873
  }
5670
5874
  /**
5671
- * Make the spline closed by adding control points and adjusting knots
5875
+ * Create a closed NURBS curve using Catmull-Rom interpolation for smooth closure
5672
5876
  */
5673
- makeClosed() {
5674
- const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.weights(), n = s.length, i = [
5675
- ...s,
5676
- ...s.slice(0, t)
5677
- ], h = [
5678
- ...e,
5679
- ...e.slice(0, t)
5680
- ], r = this.createClosedKnotVector(n, t);
5681
- this._nurbsCurve = D.byKnotsControlPointsWeights(
5877
+ static createClosedCurve(t, s, e = "Chord") {
5878
+ if (t.length < 4)
5879
+ throw new Error("At least 4 points are required for a closed NURBS curve");
5880
+ const n = new Ss(
5682
5881
  t,
5683
- r,
5684
- i,
5685
- h
5686
- ), this._controlPoints = this.toGePoints(i);
5882
+ !0,
5883
+ "centripetal"
5884
+ ), i = Math.max(50, t.length * 2), r = n.getPoints(i).map((a) => [a.x, a.y, a.z]);
5885
+ return q.byPoints(r, s, e);
5886
+ }
5887
+ }
5888
+ class Kt extends et {
5889
+ constructor(t, s, e, n) {
5890
+ super();
5891
+ const i = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0);
5892
+ if (i < 2 || i > 4)
5893
+ throw L.ILLEGAL_PARAMETERS;
5894
+ const h = 3;
5895
+ if (this._closed = n || !1, Array.isArray(s)) {
5896
+ if (this._controlPoints = t, i >= 4 && (this._closed = n), this._controlPoints.length < 4)
5897
+ throw L.ILLEGAL_PARAMETERS;
5898
+ this._nurbsCurve = q.byKnotsControlPointsWeights(
5899
+ h,
5900
+ s,
5901
+ this._controlPoints,
5902
+ e
5903
+ );
5904
+ } else {
5905
+ if (this._fitPoints = t, this._knotParameterization = s, i >= 3 && (this._closed = e), this._fitPoints.length < 4)
5906
+ throw L.ILLEGAL_PARAMETERS;
5907
+ const r = this.toNurbsPoints(this._fitPoints);
5908
+ this._nurbsCurve = q.byPoints(
5909
+ r,
5910
+ h,
5911
+ this._knotParameterization
5912
+ ), this._controlPoints = this._nurbsCurve.controlPoints();
5913
+ }
5914
+ this._closed && this.buildCurve();
5687
5915
  }
5688
5916
  /**
5689
- * Make the spline open by restoring the original curve
5917
+ * Build the NURBS curve using stored data
5690
5918
  */
5691
- makeOpen() {
5692
- if (!this._originalControlPoints || !this._originalKnots || !this._originalWeights)
5693
- throw new Error("Original curve data not available");
5694
- const t = this._nurbsCurve.degree(), s = this.toNurbsPoints(this._originalControlPoints);
5695
- this._nurbsCurve = D.byKnotsControlPointsWeights(
5696
- t,
5697
- this._originalKnots,
5698
- s,
5699
- this._originalWeights
5700
- ), this._controlPoints = [...this._originalControlPoints];
5919
+ buildCurve() {
5920
+ if (this._fitPoints && this._knotParameterization) {
5921
+ if (this._closed)
5922
+ this._nurbsCurve = q.createClosedCurve(
5923
+ this._fitPoints,
5924
+ 3,
5925
+ this._knotParameterization
5926
+ );
5927
+ else {
5928
+ const s = this.toNurbsPoints(this._fitPoints);
5929
+ this._nurbsCurve = q.byPoints(
5930
+ s,
5931
+ 3,
5932
+ this._knotParameterization
5933
+ );
5934
+ }
5935
+ this._controlPoints = this._nurbsCurve.controlPoints();
5936
+ } else if (this._controlPoints)
5937
+ if (this._closed) {
5938
+ const s = this._knotParameterization || "Chord";
5939
+ this._nurbsCurve = q.createClosedCurve(
5940
+ this._controlPoints,
5941
+ 3,
5942
+ s
5943
+ ), this._controlPoints = this._nurbsCurve.controlPoints();
5944
+ } else {
5945
+ const s = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
5946
+ this._nurbsCurve = q.byKnotsControlPointsWeights(
5947
+ 3,
5948
+ s,
5949
+ this._controlPoints,
5950
+ e
5951
+ );
5952
+ }
5701
5953
  }
5702
5954
  /**
5703
- * Create periodic knot vector for closed curve
5955
+ * Set the closed property and rebuild the curve if necessary
5704
5956
  */
5705
- createClosedKnotVector(t, s) {
5706
- const e = t + 2 * s + 1, n = [];
5707
- for (let i = 0; i < e; i++)
5708
- n.push(i);
5709
- return n;
5957
+ setClosed(t) {
5958
+ this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0, this.buildCurve());
5710
5959
  }
5711
5960
  /**
5712
5961
  * Degree of the spline to be created.
@@ -5722,16 +5971,14 @@ class Es extends Mt {
5722
5971
  */
5723
5972
  get startPoint() {
5724
5973
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
5725
- return new S(n[0], n[1], n[2]);
5974
+ return new A(n[0], n[1], n[2]);
5726
5975
  }
5727
5976
  /**
5728
5977
  * The end point of this spline
5729
5978
  */
5730
5979
  get endPoint() {
5731
- if (this._closed)
5732
- return this.startPoint;
5733
5980
  const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
5734
- return new S(n[0], n[1], n[2]);
5981
+ return new A(n[0], n[1], n[2]);
5735
5982
  }
5736
5983
  /**
5737
5984
  * @inheritdoc
@@ -5764,26 +6011,16 @@ class Es extends Mt {
5764
6011
  return this._controlPoints[e];
5765
6012
  }
5766
6013
  /**
5767
- * Divide this spline into the specified number of points
6014
+ * Divide this spline into the specified nubmer of points
5768
6015
  * those points as an array of points.
5769
- * @param numPoints Input the number of points returned
6016
+ * @param numPoints Input the nubmer of points returned
5770
6017
  * @returns Return an array of point
5771
6018
  */
5772
6019
  getPoints(t = 100) {
5773
- const s = this._nurbsCurve, e = [], n = s.knots(), i = s.degree(), h = n[i], r = n[n.length - i - 1];
5774
- if (this._closed) {
5775
- const o = (r - h) / (t - 1);
5776
- for (let c = 0; c < t - 1; c++) {
5777
- const l = h + c * o, d = s.point(l);
5778
- e.push(new S(d[0], d[1], d[2]));
5779
- }
5780
- e.push(e[0]);
5781
- } else {
5782
- const a = (r - h) / (t - 1);
5783
- for (let o = 0; o < t; o++) {
5784
- const c = o === t - 1 ? r : h + o * a, l = s.point(c);
5785
- e.push(new S(l[0], l[1], l[2]));
5786
- }
6020
+ const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), h = n[i], r = n[n.length - i - 1], a = (r - h) / (t - 1);
6021
+ for (let o = 0; o < t; o++) {
6022
+ const c = o === t - 1 ? r : h + o * a, l = s.point(c);
6023
+ e.push(new A(l[0], l[1], l[2]));
5787
6024
  }
5788
6025
  return e;
5789
6026
  }
@@ -5800,7 +6037,7 @@ class Es extends Mt {
5800
6037
  */
5801
6038
  calculateBoundingBox() {
5802
6039
  const t = this.getPoints(100);
5803
- return new Y().setFromPoints(t);
6040
+ return new j().setFromPoints(t);
5804
6041
  }
5805
6042
  get closed() {
5806
6043
  return this._closed;
@@ -5826,82 +6063,84 @@ class Es extends Mt {
5826
6063
  }), s;
5827
6064
  }
5828
6065
  /**
5829
- * Convert input points to points in geometry engine format
5830
- * @param points Input points to convert
5831
- * @returns Return converted points
6066
+ * Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
6067
+ * @param fitPoints - Array of fit points defining the curve
6068
+ * @param parameterization - Knot parameterization type for NURBS
6069
+ * @returns A closed spline
5832
6070
  */
5833
- toGePoints(t) {
5834
- const s = new Array(t.length);
5835
- return t.forEach((e, n) => {
5836
- s[n] = { x: e[0], y: e[1], z: e[2] };
5837
- }), s;
6071
+ static createClosedSpline(t, s = "Uniform") {
6072
+ if (t.length < 4)
6073
+ throw new Error("At least 4 points are required for a closed spline");
6074
+ return new Kt(t, s, !0);
5838
6075
  }
5839
6076
  }
5840
6077
  export {
5841
- Cs as AcGeArea2d,
5842
- V as AcGeBox2d,
5843
- Y as AcGeBox3d,
5844
- gt as AcGeCircArc2d,
5845
- yt as AcGeCircArc3d,
6078
+ Es as AcGeArea2d,
6079
+ U as AcGeBox2d,
6080
+ j as AcGeBox3d,
6081
+ Ss as AcGeCatmullRomCurve3d,
6082
+ _t as AcGeCircArc2d,
6083
+ gt as AcGeCircArc3d,
5846
6084
  st as AcGeCurve2d,
5847
- Zt as AcGeEllipseArc2d,
5848
- Gt as AcGeEllipseArc3d,
6085
+ Qt as AcGeEllipseArc2d,
6086
+ Ot as AcGeEllipseArc3d,
5849
6087
  Nt as AcGeEuler,
5850
- xs as AcGeGeometryUtil,
5851
- Kt as AcGeLine2d,
5852
- _t as AcGeLine3d,
5853
- Is as AcGeLoop2d,
6088
+ gs as AcGeGeometryUtil,
6089
+ Ht as AcGeLine2d,
6090
+ pt as AcGeLine3d,
6091
+ ks as AcGeLoop2d,
5854
6092
  C as AcGeMathUtil,
5855
6093
  v as AcGeMatrix2d,
5856
6094
  tt as AcGeMatrix3d,
5857
- zt as AcGePlane,
5858
- b as AcGePoint2d,
5859
- S as AcGePoint3d,
5860
- Bs as AcGePolyline2d,
5861
- pt as AcGeQuaternion,
5862
- Yt as AcGeShape2d,
5863
- Es as AcGeSpline3d,
5864
- ds as AcGeTol,
5865
- P as AcGeVector2d,
5866
- y as AcGeVector3d,
5867
- Ft as DEFAULT_TOL,
5868
- Rt as DEG2RAD,
5869
- Q as FLOAT_TOL,
5870
- Ss as ORIGIN_POINT_2D,
5871
- jt as ORIGIN_POINT_3D,
5872
- Tt as RAD2DEG,
6095
+ q as AcGeNurbsCurve,
6096
+ Mt as AcGePlane,
6097
+ S as AcGePoint2d,
6098
+ A as AcGePoint3d,
6099
+ Rs as AcGePolyline2d,
6100
+ zt as AcGeQuaternion,
6101
+ Gt as AcGeShape2d,
6102
+ Kt as AcGeSpline3d,
6103
+ Xt as AcGeTol,
6104
+ b as AcGeVector2d,
6105
+ g as AcGeVector3d,
6106
+ Dt as DEFAULT_TOL,
6107
+ Lt as DEG2RAD,
6108
+ O as FLOAT_TOL,
6109
+ Bs as ORIGIN_POINT_2D,
6110
+ Ft as ORIGIN_POINT_3D,
6111
+ Ut as RAD2DEG,
5873
6112
  I as TAU,
5874
- bt as basisFunction,
5875
- ps as calculateCurveLength,
5876
- os as ceilPowerOfTwo,
5877
- j as clamp,
5878
- Ht as damp,
5879
- is as degToRad,
5880
- Vt as euclideanModulo,
5881
- xt as evaluateNurbsPoint,
5882
- as as floorPowerOfTwo,
5883
- gs as generateChordKnots,
5884
- _s as generateSqrtChordKnots,
5885
- Qt as generateUUID,
5886
- ys as generateUniformKnots,
5887
- qt as intPartLength,
5888
- zs as interpolateControlPoints,
5889
- Wt as inverseLerp,
5890
- cs as isBetween,
5891
- ls as isBetweenAngle,
5892
- Xt as isPointInPolygon,
5893
- ms as isPolygonIntersect,
5894
- hs as isPowerOfTwo,
5895
- Ut as lerp,
5896
- Ot as mapLinear,
5897
- mt as normalizeAngle,
5898
- $t as pingpong,
5899
- rs as radToDeg,
5900
- ss as randFloat,
5901
- es as randFloatSpread,
5902
- ts as randInt,
5903
- us as relativeEps,
5904
- ns as seededRandom,
5905
- vt as smootherstep,
5906
- Jt as smoothstep
6113
+ St as basisFunction,
6114
+ Ms as calculateCurveLength,
6115
+ ls as ceilPowerOfTwo,
6116
+ X as clamp,
6117
+ vt as damp,
6118
+ os as degToRad,
6119
+ qt as euclideanModulo,
6120
+ yt as evaluateNurbsPoint,
6121
+ us as floorPowerOfTwo,
6122
+ ps as generateChordKnots,
6123
+ zs as generateSqrtChordKnots,
6124
+ $t as generateUUID,
6125
+ _s as generateUniformKnots,
6126
+ jt as intPartLength,
6127
+ Is as interpolateControlPoints,
6128
+ Jt as inverseLerp,
6129
+ ds as isBetween,
6130
+ ms as isBetweenAngle,
6131
+ Yt as isPointInPolygon,
6132
+ ys as isPolygonIntersect,
6133
+ cs as isPowerOfTwo,
6134
+ Vt as lerp,
6135
+ Wt as mapLinear,
6136
+ xt as normalizeAngle,
6137
+ ts as pingpong,
6138
+ as as radToDeg,
6139
+ is as randFloat,
6140
+ rs as randFloatSpread,
6141
+ ns as randInt,
6142
+ xs as relativeEps,
6143
+ hs as seededRandom,
6144
+ es as smootherstep,
6145
+ ss as smoothstep
5907
6146
  };