@mlightcad/geometry-engine 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/geometry-engine.js
CHANGED
@@ -336,7 +336,7 @@ function us(u, t = 1e-7) {
|
|
336
336
|
const s = qt(u);
|
337
337
|
return Math.max(Math.pow(10, s) * t, t);
|
338
338
|
}
|
339
|
-
const
|
339
|
+
const C = {
|
340
340
|
DEG2RAD: Rt,
|
341
341
|
RAD2DEG: Tt,
|
342
342
|
generateUUID: Qt,
|
@@ -839,8 +839,8 @@ const S = {
|
|
839
839
|
* @returns Return this vector
|
840
840
|
*/
|
841
841
|
rotateAround(t, s) {
|
842
|
-
const e = Math.cos(s), n = Math.sin(s), i = this.x - t.x,
|
843
|
-
return this.x = i * e -
|
842
|
+
const e = Math.cos(s), n = Math.sin(s), i = this.x - t.x, h = this.y - t.y;
|
843
|
+
return this.x = i * e - h * n + t.x, this.y = i * n + h * e + t.y, this;
|
844
844
|
}
|
845
845
|
/**
|
846
846
|
* Set each component of this vector to a pseudo-random value between 0 and 1, excluding 1.
|
@@ -851,8 +851,8 @@ const S = {
|
|
851
851
|
}
|
852
852
|
relativeEps(t = 1e-7) {
|
853
853
|
return Math.min(
|
854
|
-
|
855
|
-
|
854
|
+
C.relativeEps(this.x, t),
|
855
|
+
C.relativeEps(this.y, t)
|
856
856
|
);
|
857
857
|
}
|
858
858
|
*[Symbol.iterator]() {
|
@@ -875,8 +875,8 @@ const H = class H {
|
|
875
875
|
* @param n32 Input element in the third row and the second column
|
876
876
|
* @param n33 Input element in the third row and the third column
|
877
877
|
*/
|
878
|
-
constructor(t, s, e, n, i,
|
879
|
-
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null &&
|
878
|
+
constructor(t, s, e, n, i, h, r, a, o) {
|
879
|
+
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && h != null && r != null && a != null && o != null && this.set(t, s, e, n, i, h, r, a, o);
|
880
880
|
}
|
881
881
|
/**
|
882
882
|
* Set the 3x3 matrix values to the given row-major sequence of values.
|
@@ -892,9 +892,9 @@ const H = class H {
|
|
892
892
|
* @param n33 Input element in the third row and the third column
|
893
893
|
* @returns Return this matrix
|
894
894
|
*/
|
895
|
-
set(t, s, e, n, i,
|
895
|
+
set(t, s, e, n, i, h, r, a, o) {
|
896
896
|
const c = this.elements;
|
897
|
-
return c[0] = t, c[1] = n, c[2] =
|
897
|
+
return c[0] = t, c[1] = n, c[2] = r, c[3] = s, c[4] = i, c[5] = a, c[6] = e, c[7] = h, c[8] = o, this;
|
898
898
|
}
|
899
899
|
/**
|
900
900
|
* Reset this matrix 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,
|
958
|
-
return i[0] =
|
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;
|
959
959
|
}
|
960
960
|
/**
|
961
961
|
* Multiply every component of the matrix by the scalar value s.
|
@@ -971,8 +971,8 @@ const H = class H {
|
|
971
971
|
* @returns Return the determinant of this matrix
|
972
972
|
*/
|
973
973
|
determinant() {
|
974
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3],
|
975
|
-
return s *
|
974
|
+
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];
|
975
|
+
return s * h * c - s * r * o - e * i * c + e * r * a + n * i * o - n * h * a;
|
976
976
|
}
|
977
977
|
/**
|
978
978
|
* Invert this matrix, using the analytic method. You can not invert with a determinant of zero.
|
@@ -980,10 +980,10 @@ const H = class H {
|
|
980
980
|
* @returns Return this matrix
|
981
981
|
*/
|
982
982
|
invert() {
|
983
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3],
|
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
985
|
const g = 1 / x;
|
986
|
-
return t[0] = l * g, t[1] = (n * o - c * e) * g, t[2] = (
|
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;
|
987
987
|
}
|
988
988
|
/**
|
989
989
|
* Transpose this matrix in place.
|
@@ -1024,15 +1024,15 @@ const H = class H {
|
|
1024
1024
|
* @param cy Input center y of rotation
|
1025
1025
|
* @returns Return this matrix
|
1026
1026
|
*/
|
1027
|
-
setUvTransform(t, s, e, n, i,
|
1027
|
+
setUvTransform(t, s, e, n, i, h, r) {
|
1028
1028
|
const a = Math.cos(i), o = Math.sin(i);
|
1029
1029
|
return this.set(
|
1030
1030
|
e * a,
|
1031
1031
|
e * o,
|
1032
|
-
-e * (a *
|
1032
|
+
-e * (a * h + o * r) + h + t,
|
1033
1033
|
-n * o,
|
1034
1034
|
n * a,
|
1035
|
-
-n * (-o *
|
1035
|
+
-n * (-o * h + a * r) + r + s,
|
1036
1036
|
0,
|
1037
1037
|
0,
|
1038
1038
|
1
|
@@ -1214,11 +1214,11 @@ const Ft = new ds();
|
|
1214
1214
|
function Xt(u, t, s = !1) {
|
1215
1215
|
const e = u.x, n = u.y;
|
1216
1216
|
let i = !1;
|
1217
|
-
const
|
1218
|
-
for (let
|
1219
|
-
const o = t[
|
1220
|
-
let
|
1221
|
-
s && (
|
1217
|
+
const h = t.length;
|
1218
|
+
for (let r = 0, a = h - 1; r < h; a = r++) {
|
1219
|
+
const o = t[r].x, c = t[r].y, l = t[a].x, d = t[a].y;
|
1220
|
+
let m = c > n != d > n;
|
1221
|
+
s && (m = c >= n != d >= n), m && e < (l - o) * (n - c) / (d - c) + o && (i = !i);
|
1222
1222
|
}
|
1223
1223
|
return i;
|
1224
1224
|
}
|
@@ -1252,70 +1252,70 @@ function ys(u, t) {
|
|
1252
1252
|
function gs(u, t) {
|
1253
1253
|
const s = t.length - 1, e = u, n = [0];
|
1254
1254
|
let i = 0;
|
1255
|
-
for (let
|
1256
|
-
const a = t[
|
1255
|
+
for (let r = 1; r <= s; r++) {
|
1256
|
+
const a = t[r][0] - t[r - 1][0], o = t[r][1] - t[r - 1][1], c = t[r][2] - t[r - 1][2], l = Math.sqrt(a * a + o * o + c * c);
|
1257
1257
|
i += l, n.push(i);
|
1258
1258
|
}
|
1259
|
-
const
|
1260
|
-
for (let
|
1261
|
-
|
1262
|
-
for (let
|
1263
|
-
const a = n[
|
1264
|
-
|
1259
|
+
const h = [];
|
1260
|
+
for (let r = 0; r <= e; r++)
|
1261
|
+
h.push(0);
|
1262
|
+
for (let r = 1; r <= s - e; r++) {
|
1263
|
+
const a = n[r] / i;
|
1264
|
+
h.push(a * (s - e + 1));
|
1265
1265
|
}
|
1266
|
-
for (let
|
1267
|
-
|
1268
|
-
return
|
1266
|
+
for (let r = 0; r <= e; r++)
|
1267
|
+
h.push(s - e + 1);
|
1268
|
+
return h;
|
1269
1269
|
}
|
1270
1270
|
function _s(u, t) {
|
1271
1271
|
const s = t.length - 1, e = u, n = [0];
|
1272
1272
|
let i = 0;
|
1273
|
-
for (let
|
1274
|
-
const a = t[
|
1275
|
-
i +=
|
1276
|
-
}
|
1277
|
-
const
|
1278
|
-
for (let
|
1279
|
-
|
1280
|
-
for (let
|
1281
|
-
const a = n[
|
1282
|
-
|
1283
|
-
}
|
1284
|
-
for (let
|
1285
|
-
|
1286
|
-
return
|
1273
|
+
for (let r = 1; r <= s; r++) {
|
1274
|
+
const a = t[r][0] - t[r - 1][0], o = t[r][1] - t[r - 1][1], c = t[r][2] - t[r - 1][2], l = Math.sqrt(a * a + o * o + c * c), d = Math.sqrt(l);
|
1275
|
+
i += d, n.push(i);
|
1276
|
+
}
|
1277
|
+
const h = [];
|
1278
|
+
for (let r = 0; r <= e; r++)
|
1279
|
+
h.push(0);
|
1280
|
+
for (let r = 1; r <= s - e; r++) {
|
1281
|
+
const a = n[r] / i;
|
1282
|
+
h.push(a * (s - e + 1));
|
1283
|
+
}
|
1284
|
+
for (let r = 0; r <= e; r++)
|
1285
|
+
h.push(s - e + 1);
|
1286
|
+
return h;
|
1287
1287
|
}
|
1288
1288
|
function bt(u, t, s, e) {
|
1289
1289
|
if (t === 0)
|
1290
1290
|
return s >= e[u] && s < e[u + 1] ? 1 : 0;
|
1291
|
-
const n = e[u + t] - e[u], i = e[u + t + 1] - e[u + 1],
|
1292
|
-
return
|
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);
|
1293
1293
|
}
|
1294
1294
|
function xt(u, t, s, e, n) {
|
1295
|
-
const i = e.length - 1,
|
1296
|
-
if (u = Math.max(s[
|
1295
|
+
const i = e.length - 1, h = t;
|
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]];
|
1298
|
-
if (Math.abs(u - s[
|
1298
|
+
if (Math.abs(u - s[h]) < 1e-8)
|
1299
1299
|
return [...e[0]];
|
1300
|
-
const
|
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,
|
1304
|
-
|
1303
|
+
const c = bt(o, h, u, s), l = n[o] * c;
|
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) {
|
1307
|
-
const o = s[s.length -
|
1307
|
+
const o = s[s.length - h - 1];
|
1308
1308
|
if (Math.abs(u - o) < 1e-8)
|
1309
1309
|
return [...e[i]];
|
1310
|
-
if (Math.abs(u - s[
|
1310
|
+
if (Math.abs(u - s[h]) < 1e-8)
|
1311
1311
|
return [...e[0]];
|
1312
1312
|
}
|
1313
|
-
return a > 1e-10 && (
|
1313
|
+
return a > 1e-10 && (r[0] /= a, r[1] /= a, r[2] /= a), r;
|
1314
1314
|
}
|
1315
1315
|
function ps(u, t, s, e) {
|
1316
|
-
const n = u, i = t[n],
|
1317
|
-
let
|
1318
|
-
const a = 1e3, o = (
|
1316
|
+
const n = u, i = t[n], h = t[t.length - n - 1];
|
1317
|
+
let r = 0;
|
1318
|
+
const a = 1e3, o = (h - i) / a;
|
1319
1319
|
let c = xt(
|
1320
1320
|
i,
|
1321
1321
|
u,
|
@@ -1325,16 +1325,16 @@ function ps(u, t, s, e) {
|
|
1325
1325
|
);
|
1326
1326
|
for (let g = 1; g <= a; g++) {
|
1327
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
|
-
|
1328
|
+
r += Math.sqrt(f * f + w * w + A * A), c = _;
|
1329
1329
|
}
|
1330
1330
|
const l = xt(
|
1331
|
-
|
1331
|
+
h,
|
1332
1332
|
u,
|
1333
1333
|
t,
|
1334
1334
|
s,
|
1335
1335
|
e
|
1336
|
-
),
|
1337
|
-
return
|
1336
|
+
), d = l[0] - c[0], m = l[1] - c[1], x = l[2] - c[2];
|
1337
|
+
return r += Math.sqrt(d * d + m * m + x * x), r;
|
1338
1338
|
}
|
1339
1339
|
function zs(u) {
|
1340
1340
|
return u.map((t) => [...t]);
|
@@ -1360,26 +1360,26 @@ class pt {
|
|
1360
1360
|
* @param srcOffset1 Input an offset into the array src1.
|
1361
1361
|
* @param t Input normalized interpolation factor (between 0 and 1).
|
1362
1362
|
*/
|
1363
|
-
static slerpFlat(t, s, e, n, i,
|
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
|
1366
|
-
if (
|
1365
|
+
const d = i[h + 0], m = i[h + 1], x = i[h + 2], g = i[h + 3];
|
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
|
-
if (
|
1371
|
-
t[s + 0] =
|
1370
|
+
if (r === 1) {
|
1371
|
+
t[s + 0] = d, t[s + 1] = m, t[s + 2] = x, t[s + 3] = g;
|
1372
1372
|
return;
|
1373
1373
|
}
|
1374
|
-
if (l !== g || a !==
|
1375
|
-
let p = 1 -
|
1376
|
-
const _ = a *
|
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 - _ * _;
|
1377
1377
|
if (w > Number.EPSILON) {
|
1378
|
-
const M = Math.sqrt(w),
|
1379
|
-
p = Math.sin(p *
|
1378
|
+
const M = Math.sqrt(w), B = Math.atan2(M, _ * f);
|
1379
|
+
p = Math.sin(p * B) / M, r = Math.sin(r * B) / M;
|
1380
1380
|
}
|
1381
|
-
const A =
|
1382
|
-
if (a = a * p +
|
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) {
|
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
|
}
|
@@ -1396,9 +1396,9 @@ class pt {
|
|
1396
1396
|
* @param srcOffset1 Input an offset into the array src1.
|
1397
1397
|
* @returns Return an array
|
1398
1398
|
*/
|
1399
|
-
static multiplyQuaternionsFlat(t, s, e, n, i,
|
1400
|
-
const
|
1401
|
-
return t[s] =
|
1399
|
+
static multiplyQuaternionsFlat(t, s, e, n, i, h) {
|
1400
|
+
const r = e[n], a = e[n + 1], o = e[n + 2], c = e[n + 3], l = i[h], d = i[h + 1], m = i[h + 2], x = i[h + 3];
|
1401
|
+
return t[s] = r * x + c * l + a * m - o * d, t[s + 1] = a * x + c * d + o * l - r * m, t[s + 2] = o * x + c * m + r * d - a * l, t[s + 3] = c * x - r * l - a * d - o * m, t;
|
1402
1402
|
}
|
1403
1403
|
/**
|
1404
1404
|
* X cooridinate
|
@@ -1469,29 +1469,29 @@ class pt {
|
|
1469
1469
|
* @returns Return this quaternion
|
1470
1470
|
*/
|
1471
1471
|
setFromEuler(t, s = !0) {
|
1472
|
-
const e = t.x, n = t.y, i = t.z,
|
1473
|
-
switch (
|
1472
|
+
const e = t.x, n = t.y, i = t.z, h = t.order, r = Math.cos, a = Math.sin, o = r(e / 2), c = r(n / 2), l = r(i / 2), d = a(e / 2), m = a(n / 2), x = a(i / 2);
|
1473
|
+
switch (h) {
|
1474
1474
|
case "XYZ":
|
1475
|
-
this._x =
|
1475
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l - d * m * x;
|
1476
1476
|
break;
|
1477
1477
|
case "YXZ":
|
1478
|
-
this._x =
|
1478
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l + d * m * x;
|
1479
1479
|
break;
|
1480
1480
|
case "ZXY":
|
1481
|
-
this._x =
|
1481
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l - d * m * x;
|
1482
1482
|
break;
|
1483
1483
|
case "ZYX":
|
1484
|
-
this._x =
|
1484
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l + d * m * x;
|
1485
1485
|
break;
|
1486
1486
|
case "YZX":
|
1487
|
-
this._x =
|
1487
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l - d * m * x;
|
1488
1488
|
break;
|
1489
1489
|
case "XZY":
|
1490
|
-
this._x =
|
1490
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l + d * m * x;
|
1491
1491
|
break;
|
1492
1492
|
default:
|
1493
1493
|
console.warn(
|
1494
|
-
"THREE.Quaternion: .setFromEuler() encountered an unknown order: " +
|
1494
|
+
"THREE.Quaternion: .setFromEuler() encountered an unknown order: " + h
|
1495
1495
|
);
|
1496
1496
|
}
|
1497
1497
|
return s === !0 && this._onChangeCallback(), this;
|
@@ -1513,19 +1513,19 @@ class pt {
|
|
1513
1513
|
* @returns Return this quaternion
|
1514
1514
|
*/
|
1515
1515
|
setFromRotationMatrix(t) {
|
1516
|
-
const s = t.elements, e = s[0], n = s[4], i = s[8],
|
1517
|
-
if (
|
1518
|
-
const
|
1519
|
-
this._w = 0.25 /
|
1520
|
-
} else if (e >
|
1521
|
-
const
|
1522
|
-
this._w = (c - a) /
|
1523
|
-
} else if (
|
1524
|
-
const
|
1525
|
-
this._w = (i - o) /
|
1516
|
+
const s = t.elements, e = s[0], n = s[4], i = s[8], h = s[1], r = s[5], a = s[9], o = s[2], c = s[6], l = s[10], d = e + r + l;
|
1517
|
+
if (d > 0) {
|
1518
|
+
const m = 0.5 / Math.sqrt(d + 1);
|
1519
|
+
this._w = 0.25 / m, this._x = (c - a) * m, this._y = (i - o) * m, this._z = (h - n) * m;
|
1520
|
+
} else if (e > r && e > l) {
|
1521
|
+
const m = 2 * Math.sqrt(1 + e - r - l);
|
1522
|
+
this._w = (c - a) / m, this._x = 0.25 * m, this._y = (n + h) / m, this._z = (i + o) / m;
|
1523
|
+
} else if (r > l) {
|
1524
|
+
const m = 2 * Math.sqrt(1 + r - e - l);
|
1525
|
+
this._w = (i - o) / m, this._x = (n + h) / m, this._y = 0.25 * m, this._z = (a + c) / m;
|
1526
1526
|
} else {
|
1527
|
-
const
|
1528
|
-
this._w = (
|
1527
|
+
const m = 2 * Math.sqrt(1 + l - e - r);
|
1528
|
+
this._w = (h - n) / m, this._x = (i + o) / m, this._y = (a + c) / m, this._z = 0.25 * m;
|
1529
1529
|
}
|
1530
1530
|
return this._onChangeCallback(), this;
|
1531
1531
|
}
|
@@ -1642,8 +1642,8 @@ class pt {
|
|
1642
1642
|
* @returns Return this quaternion
|
1643
1643
|
*/
|
1644
1644
|
multiplyQuaternions(t, s) {
|
1645
|
-
const e = t._x, n = t._y, i = t._z,
|
1646
|
-
return this._x = e * c +
|
1645
|
+
const e = t._x, n = t._y, i = t._z, h = t._w, r = s._x, a = s._y, o = s._z, c = s._w;
|
1646
|
+
return this._x = e * c + h * r + n * o - i * a, this._y = n * c + h * a + i * r - e * o, this._z = i * c + h * o + e * a - n * r, this._w = h * c - e * r - n * a - i * o, this._onChangeCallback(), this;
|
1647
1647
|
}
|
1648
1648
|
/**
|
1649
1649
|
* Handles the spherical linear interpolation between quaternions. t represents the amount of rotation
|
@@ -1655,17 +1655,17 @@ class pt {
|
|
1655
1655
|
slerp(t, s) {
|
1656
1656
|
if (s === 0) return this;
|
1657
1657
|
if (s === 1) return this.copy(t);
|
1658
|
-
const e = this._x, n = this._y, i = this._z,
|
1659
|
-
let
|
1660
|
-
if (
|
1661
|
-
return this._w =
|
1662
|
-
const a = 1 -
|
1658
|
+
const e = this._x, n = this._y, i = this._z, h = this._w;
|
1659
|
+
let r = h * t._w + e * t._x + n * t._y + i * t._z;
|
1660
|
+
if (r < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, r = -r) : this.copy(t), r >= 1)
|
1661
|
+
return this._w = h, this._x = e, this._y = n, this._z = i, this;
|
1662
|
+
const a = 1 - r * r;
|
1663
1663
|
if (a <= Number.EPSILON) {
|
1664
|
-
const
|
1665
|
-
return this._w =
|
1664
|
+
const m = 1 - s;
|
1665
|
+
return this._w = m * h + s * this._w, this._x = m * e + s * this._x, this._y = m * n + s * this._y, this._z = m * i + s * this._z, this.normalize(), this;
|
1666
1666
|
}
|
1667
|
-
const o = Math.sqrt(a), c = Math.atan2(o,
|
1668
|
-
return this._w =
|
1667
|
+
const o = Math.sqrt(a), c = Math.atan2(o, r), l = Math.sin((1 - s) * c) / o, d = Math.sin(s * c) / o;
|
1668
|
+
return this._w = h * l + this._w * d, this._x = e * l + this._x * d, this._y = n * l + this._y * d, this._z = i * l + this._z * d, this._onChangeCallback(), this;
|
1669
1669
|
}
|
1670
1670
|
/**
|
1671
1671
|
* Perform a spherical linear interpolation between the given quaternions and stores the result in
|
@@ -1744,8 +1744,8 @@ const N = class N {
|
|
1744
1744
|
return;
|
1745
1745
|
}
|
1746
1746
|
if (n === 1) {
|
1747
|
-
const { x: i, y:
|
1748
|
-
this.x = i, this.y =
|
1747
|
+
const { x: i, y: h, z: r } = t;
|
1748
|
+
this.x = i, this.y = h, this.z = r || 0;
|
1749
1749
|
return;
|
1750
1750
|
}
|
1751
1751
|
if (n === 3) {
|
@@ -1981,8 +1981,8 @@ const N = class N {
|
|
1981
1981
|
* @returns Return this vector
|
1982
1982
|
*/
|
1983
1983
|
applyMatrix3d(t) {
|
1984
|
-
const s = this.x, e = this.y, n = this.z, i = t.elements,
|
1985
|
-
return this.x = (i[0] * s + i[4] * e + i[8] * n + i[12]) *
|
1984
|
+
const s = this.x, e = this.y, n = this.z, i = t.elements, h = 1 / (i[3] * s + i[7] * e + i[11] * n + i[15]);
|
1985
|
+
return this.x = (i[0] * s + i[4] * e + i[8] * n + i[12]) * h, this.y = (i[1] * s + i[5] * e + i[9] * n + i[13]) * h, this.z = (i[2] * s + i[6] * e + i[10] * n + i[14]) * h, this;
|
1986
1986
|
}
|
1987
1987
|
/**
|
1988
1988
|
* Apply a quaternion transform to this vector.
|
@@ -1990,8 +1990,8 @@ const N = class N {
|
|
1990
1990
|
* @returns Return this vector
|
1991
1991
|
*/
|
1992
1992
|
applyQuaternion(t) {
|
1993
|
-
const s = this.x, e = this.y, n = this.z, i = t.x,
|
1994
|
-
return this.x = s + a * o +
|
1993
|
+
const s = this.x, e = this.y, n = this.z, i = t.x, h = t.y, r = t.z, a = t.w, o = 2 * (h * n - r * e), c = 2 * (r * s - i * n), l = 2 * (i * e - h * s);
|
1994
|
+
return this.x = s + a * o + h * l - r * c, this.y = e + a * c + r * o - i * l, this.z = n + a * l + i * c - h * o, this;
|
1995
1995
|
}
|
1996
1996
|
/**
|
1997
1997
|
* Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a m) and
|
@@ -2202,8 +2202,8 @@ const N = class N {
|
|
2202
2202
|
* @returns Return this vector
|
2203
2203
|
*/
|
2204
2204
|
crossVectors(t, s) {
|
2205
|
-
const e = t.x, n = t.y, i = t.z,
|
2206
|
-
return this.x = n * a - i *
|
2205
|
+
const e = t.x, n = t.y, i = t.z, h = s.x, r = s.y, a = s.z;
|
2206
|
+
return this.x = n * a - i * r, this.y = i * h - e * a, this.z = e * r - n * h, this;
|
2207
2207
|
}
|
2208
2208
|
/**
|
2209
2209
|
* Project this vector onto v.
|
@@ -2396,21 +2396,21 @@ 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,
|
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 &&
|
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(
|
2401
2401
|
t,
|
2402
2402
|
s,
|
2403
2403
|
e,
|
2404
2404
|
n,
|
2405
2405
|
i,
|
2406
|
-
r,
|
2407
2406
|
h,
|
2407
|
+
r,
|
2408
2408
|
a,
|
2409
2409
|
o,
|
2410
2410
|
c,
|
2411
2411
|
l,
|
2412
|
-
m,
|
2413
2412
|
d,
|
2413
|
+
m,
|
2414
2414
|
x,
|
2415
2415
|
g,
|
2416
2416
|
p
|
@@ -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,
|
2440
|
+
set(t, s, e, n, i, h, r, a, o, c, l, d, m, x, g, p) {
|
2441
2441
|
const _ = this.elements;
|
2442
|
-
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] =
|
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;
|
2443
2443
|
}
|
2444
2444
|
/**
|
2445
2445
|
* Reset this matrix to the identity matrix.
|
@@ -2571,8 +2571,8 @@ 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(),
|
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] *
|
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();
|
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) {
|
2578
2578
|
// const te = this.elements
|
@@ -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,
|
2727
|
-
return i[0] =
|
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;
|
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],
|
2744
|
-
return x * (+i * a * l - n * o * l - i *
|
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);
|
2745
2745
|
}
|
2746
2746
|
/**
|
2747
2747
|
* Transposes this matrix.
|
@@ -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],
|
2773
|
-
if (
|
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;
|
2773
|
+
if (B === 0)
|
2774
2774
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
2775
|
-
const z = 1 /
|
2776
|
-
return t[0] = f * z, t[1] = (g *
|
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;
|
2777
2777
|
}
|
2778
2778
|
/**
|
2779
2779
|
* Multiply the columns of this matrix by vector v.
|
@@ -2836,18 +2836,18 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2836
2836
|
* @returns Return this matrix
|
2837
2837
|
*/
|
2838
2838
|
makeRotationAxis(t, s) {
|
2839
|
-
const e = Math.cos(s), n = Math.sin(s), i = 1 - e,
|
2839
|
+
const e = Math.cos(s), n = Math.sin(s), i = 1 - e, h = t.x, r = t.y, a = t.z, o = i * h, c = i * r;
|
2840
2840
|
return this.set(
|
2841
|
-
o *
|
2842
|
-
o *
|
2843
|
-
o * a + n *
|
2841
|
+
o * h + e,
|
2842
|
+
o * r - n * a,
|
2843
|
+
o * a + n * r,
|
2844
2844
|
0,
|
2845
|
-
o *
|
2846
|
-
c *
|
2847
|
-
c * a - n *
|
2845
|
+
o * r + n * a,
|
2846
|
+
c * r + e,
|
2847
|
+
c * a - n * h,
|
2848
2848
|
0,
|
2849
|
-
o * a - n *
|
2850
|
-
c * a + n *
|
2849
|
+
o * a - n * r,
|
2850
|
+
c * a + n * h,
|
2851
2851
|
i * a * a + e,
|
2852
2852
|
0,
|
2853
2853
|
0,
|
@@ -2876,8 +2876,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2876
2876
|
* @param zy Input the amount to shear Z by Y.
|
2877
2877
|
* @returns Return this matrix
|
2878
2878
|
*/
|
2879
|
-
makeShear(t, s, e, n, i,
|
2880
|
-
return this.set(1, e, i, 0, t, 1,
|
2879
|
+
makeShear(t, s, e, n, i, h) {
|
2880
|
+
return this.set(1, e, i, 0, t, 1, h, 0, s, n, 1, 0, 0, 0, 0, 1), this;
|
2881
2881
|
}
|
2882
2882
|
/**
|
2883
2883
|
* Set this matrix to the transformation composed of position, quaternion and scale.
|
@@ -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,
|
2891
|
-
return n[0] = (1 - (g + _)) * M, n[1] = (
|
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;
|
2892
2892
|
}
|
2893
2893
|
/**
|
2894
2894
|
* Decompose this matrix into its position, quaternion and scale components.
|
@@ -2904,10 +2904,10 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2904
2904
|
decompose(t, s, e) {
|
2905
2905
|
const n = this.elements;
|
2906
2906
|
let i = O.set(n[0], n[1], n[2]).length();
|
2907
|
-
const
|
2907
|
+
const h = O.set(n[4], n[5], n[6]).length(), r = O.set(n[8], n[9], n[10]).length();
|
2908
2908
|
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], R.copy(this);
|
2909
|
-
const o = 1 / i, c = 1 /
|
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 =
|
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;
|
2911
2911
|
}
|
2912
2912
|
// makePerspective(
|
2913
2913
|
// left,
|
@@ -3703,7 +3703,7 @@ class b extends P {
|
|
3703
3703
|
}), s;
|
3704
3704
|
}
|
3705
3705
|
}
|
3706
|
-
class
|
3706
|
+
class S extends y {
|
3707
3707
|
/**
|
3708
3708
|
* Convert one point array to one number array
|
3709
3709
|
* @param array Input one point array
|
@@ -3712,8 +3712,8 @@ class B extends y {
|
|
3712
3712
|
*/
|
3713
3713
|
static pointArrayToNumberArray(t, s = !0) {
|
3714
3714
|
const e = s ? 3 : 2, n = new Array(t.length * e);
|
3715
|
-
return t.forEach((i,
|
3716
|
-
i.toArray(n,
|
3715
|
+
return t.forEach((i, h) => {
|
3716
|
+
i.toArray(n, h * e);
|
3717
3717
|
}), n;
|
3718
3718
|
}
|
3719
3719
|
}
|
@@ -3809,25 +3809,25 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
|
|
3809
3809
|
* @returns Return this euler
|
3810
3810
|
*/
|
3811
3811
|
setFromRotationMatrix(t, s = this._order, e = !0) {
|
3812
|
-
const n = t.elements, i = n[0],
|
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(
|
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);
|
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(
|
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);
|
3819
3819
|
break;
|
3820
3820
|
case "ZXY":
|
3821
|
-
this._x = Math.asin(j(
|
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));
|
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(
|
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));
|
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(
|
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));
|
3828
3828
|
break;
|
3829
3829
|
case "XZY":
|
3830
|
-
this._z = Math.asin(-j(
|
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);
|
3831
3831
|
break;
|
3832
3832
|
default:
|
3833
3833
|
console.warn(
|
@@ -3994,30 +3994,30 @@ class Cs extends Yt {
|
|
3994
3994
|
return s;
|
3995
3995
|
}
|
3996
3996
|
buildHierarchy() {
|
3997
|
-
var
|
3997
|
+
var r;
|
3998
3998
|
const t = this.getPoints(100), s = this.calculateBoundaryBoxes(t), e = this.sortBoundaryBoxesByAreas(s), n = /* @__PURE__ */ new Map(), i = e.length;
|
3999
3999
|
for (let a = 0; a < i; a++)
|
4000
4000
|
n.set(e[a], {
|
4001
4001
|
index: e[a],
|
4002
4002
|
children: []
|
4003
4003
|
});
|
4004
|
-
const
|
4004
|
+
const h = { index: -1, children: [] };
|
4005
4005
|
for (let a = 0; a < i; a++) {
|
4006
4006
|
const o = e[a], c = t[o], l = s[o];
|
4007
|
-
let
|
4008
|
-
for (;
|
4009
|
-
const
|
4010
|
-
if (s[
|
4011
|
-
c[
|
4007
|
+
let d = a + 1;
|
4008
|
+
for (; d < i; d++) {
|
4009
|
+
const m = e[d], x = t[m];
|
4010
|
+
if (s[m].containsBox(l) && xs.isPointInPolygon(
|
4011
|
+
c[C.randInt(0, c.length - 1)],
|
4012
4012
|
x
|
4013
4013
|
)) {
|
4014
|
-
(
|
4014
|
+
(r = n.get(m)) == null || r.children.push(n.get(o));
|
4015
4015
|
break;
|
4016
4016
|
}
|
4017
4017
|
}
|
4018
|
-
|
4018
|
+
d === i && h.children.push(n.get(o));
|
4019
4019
|
}
|
4020
|
-
return
|
4020
|
+
return h;
|
4021
4021
|
}
|
4022
4022
|
/**
|
4023
4023
|
* Calcuate bounding box of each loop in this area and return an array of their bounding box
|
@@ -4038,9 +4038,9 @@ class Cs extends Yt {
|
|
4038
4038
|
sortBoundaryBoxesByAreas(t) {
|
4039
4039
|
const s = [];
|
4040
4040
|
t.forEach((n, i) => {
|
4041
|
-
const
|
4041
|
+
const h = n.size, r = h.width * h.height;
|
4042
4042
|
s.push({
|
4043
|
-
area:
|
4043
|
+
area: r,
|
4044
4044
|
index: i
|
4045
4045
|
});
|
4046
4046
|
}), s.sort((n, i) => n.area - i.area);
|
@@ -4130,8 +4130,8 @@ class st extends Yt {
|
|
4130
4130
|
const s = [];
|
4131
4131
|
let e, n = this.getPoint(0), i = 0;
|
4132
4132
|
s.push(0);
|
4133
|
-
for (let
|
4134
|
-
e = this.getPoint(
|
4133
|
+
for (let h = 1; h <= t; h++)
|
4134
|
+
e = this.getPoint(h / t), i += e.distanceTo(n), s.push(i), n = e;
|
4135
4135
|
return s;
|
4136
4136
|
}
|
4137
4137
|
/**
|
@@ -4142,22 +4142,22 @@ class st extends Yt {
|
|
4142
4142
|
const e = this.getLengths();
|
4143
4143
|
let n = 0;
|
4144
4144
|
const i = e.length;
|
4145
|
-
let
|
4146
|
-
s ?
|
4147
|
-
let
|
4148
|
-
for (;
|
4149
|
-
if (n = Math.floor(
|
4150
|
-
|
4145
|
+
let h;
|
4146
|
+
s ? h = s : h = t * e[i - 1];
|
4147
|
+
let r = 0, a = i - 1, o;
|
4148
|
+
for (; r <= a; )
|
4149
|
+
if (n = Math.floor(r + (a - r) / 2), o = e[n] - h, o < 0)
|
4150
|
+
r = n + 1;
|
4151
4151
|
else if (o > 0)
|
4152
4152
|
a = n - 1;
|
4153
4153
|
else {
|
4154
4154
|
a = n;
|
4155
4155
|
break;
|
4156
4156
|
}
|
4157
|
-
if (n = a, e[n] ===
|
4157
|
+
if (n = a, e[n] === h)
|
4158
4158
|
return n / (i - 1);
|
4159
|
-
const c = e[n],
|
4160
|
-
return (n +
|
4159
|
+
const c = e[n], d = e[n + 1] - c, m = (h - c) / d;
|
4160
|
+
return (n + m) / (i - 1);
|
4161
4161
|
}
|
4162
4162
|
/**
|
4163
4163
|
* Return a unit vector tangent at `t`. If the derived curve does not implement its tangent derivation,
|
@@ -4169,8 +4169,8 @@ 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),
|
4173
|
-
return
|
4172
|
+
const i = this.getPoint(e), h = this.getPoint(n), r = new b();
|
4173
|
+
return r.copy(h).sub(i).normalize(), r;
|
4174
4174
|
}
|
4175
4175
|
/**
|
4176
4176
|
* Return tangent at a point which is equidistant to the ends of the curve from the point given in
|
@@ -4187,8 +4187,8 @@ class st extends Yt {
|
|
4187
4187
|
class gt extends st {
|
4188
4188
|
constructor(t, s, e, n, i) {
|
4189
4189
|
super();
|
4190
|
-
const
|
4191
|
-
if (
|
4190
|
+
const h = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
|
4191
|
+
if (h == 3)
|
4192
4192
|
typeof t == "object" && typeof s == "object" && typeof e == "object" ? this.createByThreePoints(
|
4193
4193
|
t,
|
4194
4194
|
s,
|
@@ -4198,9 +4198,9 @@ class gt extends st {
|
|
4198
4198
|
s,
|
4199
4199
|
e
|
4200
4200
|
);
|
4201
|
-
else if (
|
4202
|
-
const
|
4203
|
-
this.center = new b(
|
4201
|
+
else if (h == 5) {
|
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;
|
4204
4204
|
} else
|
4205
4205
|
throw T.ILLEGAL_PARAMETERS;
|
4206
4206
|
}
|
@@ -4214,13 +4214,13 @@ class gt extends st {
|
|
4214
4214
|
const n = (z, E) => ({
|
4215
4215
|
x: (z.x + E.x) / 2,
|
4216
4216
|
y: (z.y + E.y) / 2
|
4217
|
-
}), i = (z, E) => (E.y - z.y) / (E.x - z.x),
|
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
4218
|
const F = (G - E) / (z - Z), K = z * F + E;
|
4219
4219
|
return { x: F, y: K };
|
4220
|
-
}, x =
|
4220
|
+
}, x = r.y - l * r.x, g = a.y - d * a.x, p = m(l, x, d, g), _ = Math.sqrt(
|
4221
4221
|
Math.pow(t.x - p.x, 2) + Math.pow(t.y - p.y, 2)
|
4222
|
-
), f = (z, E) => Math.atan2(z.y - E.y, z.x - E.x), w = f(t, p), A = f(s, p), M = f(e, p),
|
4223
|
-
this.center = p, this.radius = _, this.startAngle = w, this.endAngle = M, this.clockwise = !
|
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;
|
4224
4224
|
}
|
4225
4225
|
/**
|
4226
4226
|
* Create circular arc by two points and one bugle factor
|
@@ -4234,24 +4234,24 @@ class gt extends st {
|
|
4234
4234
|
* - https://www.afralisp.net/archive/lisp/Bulges1.htm
|
4235
4235
|
*/
|
4236
4236
|
createByStartEndPointsAndBulge(t, s, e) {
|
4237
|
-
let n, i,
|
4238
|
-
e < 0 ? (n = Math.atan(-e) * 4, i = new P(t),
|
4239
|
-
const
|
4240
|
-
let
|
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();
|
4240
|
+
let d;
|
4241
4241
|
if (n < Math.PI) {
|
4242
|
-
const
|
4242
|
+
const m = new P(
|
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
|
4248
|
+
const m = new P(
|
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
|
);
|
4252
|
-
|
4252
|
+
d = o.add(m.multiplyScalar(c));
|
4253
4253
|
}
|
4254
|
-
e < 0 ? (this.startAngle = Math.atan2(i.y -
|
4254
|
+
e < 0 ? (this.startAngle = Math.atan2(i.y - d.y, i.x - d.x), this.endAngle = Math.atan2(h.y - d.y, h.x - d.x)) : (this.startAngle = Math.atan2(h.y - d.y, h.x - d.x), this.endAngle = Math.atan2(i.y - d.y, i.x - d.x)), this.clockwise = e < 0, this.center = d, this.radius = h.sub(d).length();
|
4255
4255
|
}
|
4256
4256
|
/**
|
4257
4257
|
* Center of circular arc
|
@@ -4278,7 +4278,7 @@ class gt extends st {
|
|
4278
4278
|
return this._startAngle;
|
4279
4279
|
}
|
4280
4280
|
set startAngle(t) {
|
4281
|
-
this._startAngle =
|
4281
|
+
this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4282
4282
|
}
|
4283
4283
|
/**
|
4284
4284
|
* End angle in radians of circular arc in the range 0 to 2 * PI.
|
@@ -4287,13 +4287,13 @@ class gt extends st {
|
|
4287
4287
|
return this._endAngle;
|
4288
4288
|
}
|
4289
4289
|
set endAngle(t) {
|
4290
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4290
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4291
4291
|
}
|
4292
4292
|
/**
|
4293
4293
|
* Angle between endAngle and startAngle in range 0 to 2*PI
|
4294
4294
|
*/
|
4295
4295
|
get deltaAngle() {
|
4296
|
-
return this.clockwise ?
|
4296
|
+
return this.clockwise ? C.normalizeAngle(this.startAngle - this.endAngle) : C.normalizeAngle(this.endAngle - this.startAngle);
|
4297
4297
|
}
|
4298
4298
|
/**
|
4299
4299
|
* Rotation direction of the arc.
|
@@ -4320,7 +4320,7 @@ class gt extends st {
|
|
4320
4320
|
* Middle point of circular arc
|
4321
4321
|
*/
|
4322
4322
|
get midPoint() {
|
4323
|
-
const t =
|
4323
|
+
const t = C.normalizeAngle(
|
4324
4324
|
(this.startAngle + this.endAngle) / 2
|
4325
4325
|
);
|
4326
4326
|
return this.getPointAtAngle(t);
|
@@ -4337,7 +4337,7 @@ class gt extends st {
|
|
4337
4337
|
calculateBoundingBox() {
|
4338
4338
|
const t = [this.startPoint, this.endPoint], s = [0, Math.PI / 2, Math.PI, 3 * Math.PI / 2];
|
4339
4339
|
for (const i of s)
|
4340
|
-
|
4340
|
+
C.isBetweenAngle(
|
4341
4341
|
i,
|
4342
4342
|
this.startAngle,
|
4343
4343
|
this.endAngle,
|
@@ -4392,13 +4392,13 @@ class gt extends st {
|
|
4392
4392
|
let e = this.deltaAngle, n = this.startAngle;
|
4393
4393
|
if (this.closed && (e = I, n = 0), this.clockwise)
|
4394
4394
|
for (let i = 0; i <= t; i++) {
|
4395
|
-
const
|
4396
|
-
s.push(new b(
|
4395
|
+
const h = n - e * (i / t), r = this.getPointAtAngle(h);
|
4396
|
+
s.push(new b(r.x, r.y));
|
4397
4397
|
}
|
4398
4398
|
else
|
4399
4399
|
for (let i = 0; i <= t; i++) {
|
4400
|
-
const
|
4401
|
-
s.push(new b(
|
4400
|
+
const h = n + e * (i / t), r = this.getPointAtAngle(h);
|
4401
|
+
s.push(new b(r.x, r.y));
|
4402
4402
|
}
|
4403
4403
|
return s;
|
4404
4404
|
}
|
@@ -4428,7 +4428,7 @@ class _t extends Mt {
|
|
4428
4428
|
* as the endpoint. Both points must be in WCS coordinates.
|
4429
4429
|
*/
|
4430
4430
|
constructor(t, s) {
|
4431
|
-
super(), this._start = new
|
4431
|
+
super(), this._start = new S(t), this._end = new S(s);
|
4432
4432
|
}
|
4433
4433
|
/**
|
4434
4434
|
* The line's startpoint in WCS coordinates
|
@@ -4458,7 +4458,7 @@ class _t extends Mt {
|
|
4458
4458
|
* The middle point of this line.
|
4459
4459
|
*/
|
4460
4460
|
get midPoint() {
|
4461
|
-
return new
|
4461
|
+
return new S(
|
4462
4462
|
(this._start.x + this._end.x) / 2,
|
4463
4463
|
(this._start.y + this._end.y) / 2,
|
4464
4464
|
(this._start.z + this._end.z) / 2
|
@@ -4498,10 +4498,10 @@ class _t extends Mt {
|
|
4498
4498
|
atLength(t, s = !1) {
|
4499
4499
|
if (s) {
|
4500
4500
|
const e = this.delta(X).normalize();
|
4501
|
-
return new
|
4501
|
+
return new S(this._start).addScaledVector(e, t);
|
4502
4502
|
} else {
|
4503
4503
|
const e = this.delta(X).normalize();
|
4504
|
-
return new
|
4504
|
+
return new S(this._end).addScaledVector(e, t);
|
4505
4505
|
}
|
4506
4506
|
}
|
4507
4507
|
/**
|
@@ -4514,13 +4514,13 @@ class _t extends Mt {
|
|
4514
4514
|
extend(t, s = !1) {
|
4515
4515
|
if (s) {
|
4516
4516
|
const e = X.subVectors(this._start, this._end).normalize();
|
4517
|
-
this._start = new
|
4517
|
+
this._start = new S(this._start).addScaledVector(
|
4518
4518
|
e,
|
4519
4519
|
t
|
4520
4520
|
);
|
4521
4521
|
} else {
|
4522
4522
|
const e = this.delta(X).normalize();
|
4523
|
-
this._end = new
|
4523
|
+
this._end = new S(this._end).addScaledVector(e, t);
|
4524
4524
|
}
|
4525
4525
|
return this._boundingBoxNeedsUpdate = !0, this;
|
4526
4526
|
}
|
@@ -4535,7 +4535,7 @@ class _t extends Mt {
|
|
4535
4535
|
Lt.subVectors(t, this._start), dt.subVectors(this.endPoint, this.startPoint);
|
4536
4536
|
const e = dt.dot(dt);
|
4537
4537
|
let i = dt.dot(Lt) / e;
|
4538
|
-
return s && (i =
|
4538
|
+
return s && (i = C.clamp(i, 0, 1)), i;
|
4539
4539
|
}
|
4540
4540
|
/**
|
4541
4541
|
* Return the closets point on the line. If clampToLine is true, then the returned value will be
|
@@ -4578,7 +4578,7 @@ class _t extends Mt {
|
|
4578
4578
|
*/
|
4579
4579
|
project(t) {
|
4580
4580
|
const s = this.direction, n = X.subVectors(t, this.startPoint).dot(s);
|
4581
|
-
return new
|
4581
|
+
return new S().copy(s).multiplyScalar(n).add(this.startPoint);
|
4582
4582
|
}
|
4583
4583
|
/**
|
4584
4584
|
* Finds the point on the line that is perpendicular to the given point. When you need the shortest distance
|
@@ -4588,18 +4588,18 @@ 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),
|
4592
|
-
return new
|
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);
|
4593
4593
|
}
|
4594
4594
|
/**
|
4595
4595
|
* @inheritdoc
|
4596
4596
|
*/
|
4597
4597
|
calculateBoundingBox() {
|
4598
|
-
const t = new
|
4598
|
+
const t = new S(
|
4599
4599
|
Math.min(this._start.x, this._end.x),
|
4600
4600
|
Math.min(this._start.y, this._end.y),
|
4601
4601
|
Math.min(this._start.z, this._end.z)
|
4602
|
-
), s = new
|
4602
|
+
), s = new S(
|
4603
4603
|
Math.max(this._start.x, this._end.x),
|
4604
4604
|
Math.max(this._start.y, this._end.y),
|
4605
4605
|
Math.max(this._start.z, this._end.z)
|
@@ -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),
|
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();
|
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(
|
4648
|
-
return
|
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);
|
4649
4649
|
}
|
4650
4650
|
/**
|
4651
4651
|
* Create arc by three points
|
@@ -4660,7 +4660,7 @@ class yt extends Mt {
|
|
4660
4660
|
e
|
4661
4661
|
);
|
4662
4662
|
if (n) {
|
4663
|
-
const i = n.distanceTo(t),
|
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
4664
|
return new yt(
|
4665
4665
|
n,
|
4666
4666
|
i,
|
@@ -4679,8 +4679,8 @@ 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,
|
4683
|
-
super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec =
|
4682
|
+
constructor(t, s, e, n, i, h = y.X_AXIS) {
|
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
|
/**
|
4686
4686
|
* Center of circular arc
|
@@ -4689,7 +4689,7 @@ class yt extends Mt {
|
|
4689
4689
|
return this._center;
|
4690
4690
|
}
|
4691
4691
|
set center(t) {
|
4692
|
-
this._center = new
|
4692
|
+
this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4693
4693
|
}
|
4694
4694
|
/**
|
4695
4695
|
* Radius of circular arc
|
@@ -4708,7 +4708,7 @@ class yt extends Mt {
|
|
4708
4708
|
return this._startAngle;
|
4709
4709
|
}
|
4710
4710
|
set startAngle(t) {
|
4711
|
-
this._startAngle =
|
4711
|
+
this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4712
4712
|
}
|
4713
4713
|
/**
|
4714
4714
|
* End angle in radians of circular arc in the range 0 to 2 * PI.
|
@@ -4717,13 +4717,13 @@ class yt extends Mt {
|
|
4717
4717
|
return this._endAngle;
|
4718
4718
|
}
|
4719
4719
|
set endAngle(t) {
|
4720
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4720
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4721
4721
|
}
|
4722
4722
|
/**
|
4723
4723
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
4724
4724
|
*/
|
4725
4725
|
get deltaAngle() {
|
4726
|
-
return
|
4726
|
+
return C.normalizeAngle(this.endAngle - this.startAngle);
|
4727
4727
|
}
|
4728
4728
|
/**
|
4729
4729
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -4779,15 +4779,15 @@ class yt extends Mt {
|
|
4779
4779
|
calculateBoundingBox() {
|
4780
4780
|
const t = [this.startAngle, this.endAngle];
|
4781
4781
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
4782
|
-
|
4783
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0,
|
4782
|
+
C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
4783
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
4784
4784
|
for (const a of t) {
|
4785
4785
|
const o = this.getPointAtAngle(a);
|
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 >
|
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
4788
|
return new Y(
|
4789
4789
|
{ x: s, y: e, z: n },
|
4790
|
-
{ x: i, y:
|
4790
|
+
{ x: i, y: h, z: r }
|
4791
4791
|
);
|
4792
4792
|
}
|
4793
4793
|
/**
|
@@ -4807,8 +4807,8 @@ class yt extends Mt {
|
|
4807
4807
|
let e = this.deltaAngle, n = this.startAngle;
|
4808
4808
|
this.closed && (e = I, n = 0);
|
4809
4809
|
for (let i = 0; i <= t; i++) {
|
4810
|
-
const
|
4811
|
-
s.push(
|
4810
|
+
const h = n + e * (i / t), r = this.getPointAtAngle(h);
|
4811
|
+
s.push(r);
|
4812
4812
|
}
|
4813
4813
|
return s;
|
4814
4814
|
}
|
@@ -4858,11 +4858,11 @@ class yt extends Mt {
|
|
4858
4858
|
x: s.y * e.z - s.z * e.y,
|
4859
4859
|
y: s.z * e.x - s.x * e.z,
|
4860
4860
|
z: s.x * e.y - s.y * e.x
|
4861
|
-
}, i = this.center,
|
4862
|
-
return new
|
4863
|
-
i.x +
|
4864
|
-
i.y +
|
4865
|
-
i.z +
|
4861
|
+
}, i = this.center, h = this.radius;
|
4862
|
+
return new S(
|
4863
|
+
i.x + h * (e.x * Math.cos(t) + n.x * Math.sin(t)),
|
4864
|
+
i.y + h * (e.y * Math.cos(t) + n.y * Math.sin(t)),
|
4865
|
+
i.z + h * (e.z * Math.cos(t) + n.z * Math.sin(t))
|
4866
4866
|
);
|
4867
4867
|
}
|
4868
4868
|
/**
|
@@ -4886,8 +4886,8 @@ class Zt extends st {
|
|
4886
4886
|
* @param rotation The rotation angle of the ellipse in radians, counterclockwise from the positive X
|
4887
4887
|
* axis (optional). Default is 0.
|
4888
4888
|
*/
|
4889
|
-
constructor(t, s, e, n = 0, i = I,
|
4890
|
-
super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = n, this.endAngle = i), this.clockwise =
|
4889
|
+
constructor(t, s, e, n = 0, i = I, h = !1, r = 0) {
|
4890
|
+
super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = n, this.endAngle = i), this.clockwise = h, this.rotation = r;
|
4891
4891
|
}
|
4892
4892
|
/**
|
4893
4893
|
* Center of the ellipse in 3d space
|
@@ -4896,7 +4896,7 @@ class Zt extends st {
|
|
4896
4896
|
return this._center;
|
4897
4897
|
}
|
4898
4898
|
set center(t) {
|
4899
|
-
this._center = new
|
4899
|
+
this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4900
4900
|
}
|
4901
4901
|
/**
|
4902
4902
|
* Major axis radius of the ellipse
|
@@ -4925,7 +4925,7 @@ class Zt extends st {
|
|
4925
4925
|
return this._startAngle;
|
4926
4926
|
}
|
4927
4927
|
set startAngle(t) {
|
4928
|
-
this._startAngle =
|
4928
|
+
this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4929
4929
|
}
|
4930
4930
|
/**
|
4931
4931
|
* End angle of the ellipse arc in radians in the range -pi to pi.
|
@@ -4934,7 +4934,7 @@ class Zt extends st {
|
|
4934
4934
|
return this._endAngle;
|
4935
4935
|
}
|
4936
4936
|
set endAngle(t) {
|
4937
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4937
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4938
4938
|
}
|
4939
4939
|
/**
|
4940
4940
|
* The flag Whether the ellipse arc is drawn clockwise. Default is false.
|
@@ -4959,7 +4959,7 @@ class Zt extends st {
|
|
4959
4959
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
4960
4960
|
*/
|
4961
4961
|
get deltaAngle() {
|
4962
|
-
return
|
4962
|
+
return C.normalizeAngle(this.endAngle - this.startAngle);
|
4963
4963
|
}
|
4964
4964
|
/**
|
4965
4965
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -4974,9 +4974,9 @@ class Zt extends st {
|
|
4974
4974
|
*/
|
4975
4975
|
calculateBoundingBox() {
|
4976
4976
|
let s = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
4977
|
-
for (let
|
4978
|
-
const
|
4979
|
-
s = Math.min(s,
|
4977
|
+
for (let h = 0; h <= 100; h++) {
|
4978
|
+
const r = this.getPoint(h / 100);
|
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
4981
|
return new V({ x: s, y: e }, { x: n, y: i });
|
4982
4982
|
}
|
@@ -4999,12 +4999,12 @@ class Zt extends st {
|
|
4999
4999
|
for (; e > s; ) e -= s;
|
5000
5000
|
e < Number.EPSILON && (n ? e = 0 : e = s), this.clockwise === !0 && !n && (e === s ? e = -s : e = e - s);
|
5001
5001
|
const i = this.startAngle + t * e;
|
5002
|
-
let
|
5002
|
+
let h = this.center.x + this.majorAxisRadius * Math.cos(i), r = this.center.y + this.minorAxisRadius * Math.sin(i);
|
5003
5003
|
if (this.rotation !== 0) {
|
5004
|
-
const a = Math.cos(this.rotation), o = Math.sin(this.rotation), c =
|
5005
|
-
|
5004
|
+
const a = Math.cos(this.rotation), o = Math.sin(this.rotation), c = h - this.center.x, l = r - this.center.y;
|
5005
|
+
h = c * a - l * o + this.center.x, r = c * o + l * a + this.center.y;
|
5006
5006
|
}
|
5007
|
-
return new b(
|
5007
|
+
return new b(h, r);
|
5008
5008
|
}
|
5009
5009
|
/**
|
5010
5010
|
* @inheritdoc
|
@@ -5044,10 +5044,10 @@ class Gt extends Mt {
|
|
5044
5044
|
* @param startAngle Start angle of the ellipse arc in radians.
|
5045
5045
|
* @param endAngle End angle of the ellipse arc in radians.
|
5046
5046
|
*/
|
5047
|
-
constructor(t, s, e, n, i,
|
5047
|
+
constructor(t, s, e, n, i, h = 0, r = I) {
|
5048
5048
|
super(), this.center = t, this.normal = s, this.majorAxis = e, this.majorAxisRadius = n, this.minorAxisRadius = i;
|
5049
|
-
const a = Math.abs(
|
5050
|
-
Math.abs(a - I) < 1e-10 || Math.abs(a - 2 * I) < 1e-10 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle =
|
5049
|
+
const a = Math.abs(r - h);
|
5050
|
+
Math.abs(a - I) < 1e-10 || Math.abs(a - 2 * I) < 1e-10 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = h, this.endAngle = r);
|
5051
5051
|
}
|
5052
5052
|
/**
|
5053
5053
|
* Center of the ellipse in 3d space
|
@@ -5056,7 +5056,7 @@ class Gt extends Mt {
|
|
5056
5056
|
return this._center;
|
5057
5057
|
}
|
5058
5058
|
set center(t) {
|
5059
|
-
this._center = new
|
5059
|
+
this._center = new S(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
5060
5060
|
}
|
5061
5061
|
/**
|
5062
5062
|
* Major axis radius of the ellipse
|
@@ -5085,7 +5085,7 @@ class Gt extends Mt {
|
|
5085
5085
|
return this._startAngle;
|
5086
5086
|
}
|
5087
5087
|
set startAngle(t) {
|
5088
|
-
this._startAngle =
|
5088
|
+
this._startAngle = C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
5089
5089
|
}
|
5090
5090
|
/**
|
5091
5091
|
* End angle of the ellipse arc in radians in the range -pi to pi.
|
@@ -5094,14 +5094,14 @@ class Gt extends Mt {
|
|
5094
5094
|
return this._endAngle;
|
5095
5095
|
}
|
5096
5096
|
set endAngle(t) {
|
5097
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
5097
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : C.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
5098
5098
|
}
|
5099
5099
|
/**
|
5100
5100
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
5101
5101
|
*/
|
5102
5102
|
get deltaAngle() {
|
5103
5103
|
const t = this.endAngle - this.startAngle;
|
5104
|
-
return Math.abs(t - I) < 1e-10 ? I :
|
5104
|
+
return Math.abs(t - I) < 1e-10 ? I : C.normalizeAngle(t);
|
5105
5105
|
}
|
5106
5106
|
/**
|
5107
5107
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -5161,8 +5161,8 @@ class Gt extends Mt {
|
|
5161
5161
|
const s = this.deltaAngle / 1e3;
|
5162
5162
|
let e = 0, n = this.getPointAtAngle(this.startAngle);
|
5163
5163
|
for (let i = 1; i <= 1e3; i++) {
|
5164
|
-
const
|
5165
|
-
e += Math.sqrt(a * a + o * o + c * c), n =
|
5164
|
+
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
|
+
e += Math.sqrt(a * a + o * o + c * c), n = r;
|
5166
5166
|
}
|
5167
5167
|
return e;
|
5168
5168
|
}
|
@@ -5175,25 +5175,25 @@ class Gt extends Mt {
|
|
5175
5175
|
if (this.majorAxis.equals(y.X_AXIS) || this.majorAxis.equals(y.Y_AXIS) || this.majorAxis.isParallelTo(y.X_AXIS) || this.majorAxis.isParallelTo(y.Y_AXIS)) {
|
5176
5176
|
const t = [this.startAngle, this.endAngle];
|
5177
5177
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
5178
|
-
|
5179
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0,
|
5178
|
+
C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
5179
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5180
5180
|
for (const a of t) {
|
5181
5181
|
const o = this.getPointAtAngle(a);
|
5182
|
-
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 >
|
5182
|
+
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
5183
|
}
|
5184
5184
|
return new Y(
|
5185
5185
|
{ x: s, y: e, z: n },
|
5186
|
-
{ x: i, y:
|
5186
|
+
{ x: i, y: h, z: r }
|
5187
5187
|
);
|
5188
5188
|
} else {
|
5189
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0,
|
5189
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5190
5190
|
for (let a = 0; a <= 100; a++) {
|
5191
5191
|
const o = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(o);
|
5192
|
-
s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x),
|
5192
|
+
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
5193
|
}
|
5194
5194
|
return new Y(
|
5195
5195
|
{ x: s, y: e, z: n },
|
5196
|
-
{ x: i, y:
|
5196
|
+
{ x: i, y: h, z: r }
|
5197
5197
|
);
|
5198
5198
|
}
|
5199
5199
|
}
|
@@ -5208,8 +5208,8 @@ class Gt extends Mt {
|
|
5208
5208
|
let e = this.deltaAngle, n = this.startAngle;
|
5209
5209
|
this.closed && (e = I, n = 0);
|
5210
5210
|
for (let i = 0; i <= t; i++) {
|
5211
|
-
const
|
5212
|
-
s.push(
|
5211
|
+
const h = n + e * (i / t), r = this.getPointAtAngle(h);
|
5212
|
+
s.push(r);
|
5213
5213
|
}
|
5214
5214
|
return s;
|
5215
5215
|
}
|
@@ -5220,7 +5220,7 @@ class Gt extends Mt {
|
|
5220
5220
|
*/
|
5221
5221
|
getPointAtAngle(t) {
|
5222
5222
|
const s = Math.cos(t), e = Math.sin(t), n = this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e), i = this.majorAxis.clone().multiplyScalar(s * this.majorAxisRadius).add(n);
|
5223
|
-
return new
|
5223
|
+
return new S(
|
5224
5224
|
this.center.x + i.x,
|
5225
5225
|
this.center.y + i.y,
|
5226
5226
|
this.center.z + i.z
|
@@ -5232,8 +5232,8 @@ class Gt extends Mt {
|
|
5232
5232
|
* @returns - True if the point is inside the ellipse, false otherwise.
|
5233
5233
|
*/
|
5234
5234
|
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,
|
5236
|
-
return i * i +
|
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;
|
5236
|
+
return i * i + h * h <= 1;
|
5237
5237
|
}
|
5238
5238
|
/**
|
5239
5239
|
* @inheritdoc
|
@@ -5321,8 +5321,8 @@ class Bs extends st {
|
|
5321
5321
|
let i = null;
|
5322
5322
|
if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
|
5323
5323
|
if (n.bulge) {
|
5324
|
-
const
|
5325
|
-
t +=
|
5324
|
+
const h = new gt(n, i, n.bulge);
|
5325
|
+
t += h.length;
|
5326
5326
|
} else
|
5327
5327
|
t += new b(n.x, n.y).distanceTo(i);
|
5328
5328
|
}
|
@@ -5379,7 +5379,7 @@ class Bs extends st {
|
|
5379
5379
|
getPoints3d(t, s) {
|
5380
5380
|
const e = [];
|
5381
5381
|
return this.getPoints(t).forEach(
|
5382
|
-
(i) => e.push(new
|
5382
|
+
(i) => e.push(new S().set(i.x, i.y, s))
|
5383
5383
|
), e;
|
5384
5384
|
}
|
5385
5385
|
/**
|
@@ -5392,9 +5392,9 @@ class Bs extends st {
|
|
5392
5392
|
for (let n = 0; n < e; ++n) {
|
5393
5393
|
const i = this._vertices[n];
|
5394
5394
|
if (i.bulge) {
|
5395
|
-
let
|
5396
|
-
if (n < e - 1 ?
|
5397
|
-
const a = new gt(i,
|
5395
|
+
let h = null;
|
5396
|
+
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;
|
5398
5398
|
for (let c = 0; c < o; ++c) {
|
5399
5399
|
const l = a[c];
|
5400
5400
|
s.push(new b(l.x, l.y));
|
@@ -5629,8 +5629,8 @@ class D {
|
|
5629
5629
|
n = ys(s, t.length);
|
5630
5630
|
break;
|
5631
5631
|
}
|
5632
|
-
const i = zs(t),
|
5633
|
-
return new D(s, n, i,
|
5632
|
+
const i = zs(t), h = new Array(i.length).fill(1);
|
5633
|
+
return new D(s, n, i, h);
|
5634
5634
|
}
|
5635
5635
|
}
|
5636
5636
|
class Es extends Mt {
|
@@ -5643,20 +5643,20 @@ class Es extends Mt {
|
|
5643
5643
|
if (this._closed = !1, n == 2 && !Array.isArray(s)) {
|
5644
5644
|
if (this._fitPoints = t, this._knotParameterization = s, this._fitPoints.length < 4)
|
5645
5645
|
throw T.ILLEGAL_PARAMETERS;
|
5646
|
-
const
|
5646
|
+
const h = this.toNurbsPoints(this._fitPoints);
|
5647
5647
|
this._nurbsCurve = D.byPoints(
|
5648
|
-
|
5648
|
+
h,
|
5649
5649
|
i,
|
5650
5650
|
this._knotParameterization
|
5651
5651
|
), this._controlPoints = this.toGePoints(this._nurbsCurve.controlPoints()), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = [...this._nurbsCurve.weights()];
|
5652
5652
|
} else {
|
5653
5653
|
if (this._controlPoints = t, this._controlPoints.length < 4)
|
5654
5654
|
throw T.ILLEGAL_PARAMETERS;
|
5655
|
-
const
|
5655
|
+
const h = this.toNurbsPoints(this._controlPoints);
|
5656
5656
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5657
5657
|
i,
|
5658
5658
|
s,
|
5659
|
-
|
5659
|
+
h,
|
5660
5660
|
e
|
5661
5661
|
), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = e ? [...e] : new Array(this._controlPoints.length).fill(1);
|
5662
5662
|
}
|
@@ -5671,15 +5671,18 @@ class Es extends Mt {
|
|
5671
5671
|
* Make the spline closed by adding control points and adjusting knots
|
5672
5672
|
*/
|
5673
5673
|
makeClosed() {
|
5674
|
-
const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.
|
5675
|
-
|
5676
|
-
|
5677
|
-
|
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);
|
5678
5681
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5679
5682
|
t,
|
5680
|
-
|
5683
|
+
r,
|
5681
5684
|
i,
|
5682
|
-
|
5685
|
+
h
|
5683
5686
|
), this._controlPoints = this.toGePoints(i);
|
5684
5687
|
}
|
5685
5688
|
/**
|
@@ -5697,13 +5700,13 @@ class Es extends Mt {
|
|
5697
5700
|
), this._controlPoints = [...this._originalControlPoints];
|
5698
5701
|
}
|
5699
5702
|
/**
|
5700
|
-
* Create knot vector for closed curve
|
5703
|
+
* Create periodic knot vector for closed curve
|
5701
5704
|
*/
|
5702
5705
|
createClosedKnotVector(t, s) {
|
5703
|
-
const e =
|
5704
|
-
for (let
|
5705
|
-
|
5706
|
-
return
|
5706
|
+
const e = t + 2 * s + 1, n = [];
|
5707
|
+
for (let i = 0; i < e; i++)
|
5708
|
+
n.push(i);
|
5709
|
+
return n;
|
5707
5710
|
}
|
5708
5711
|
/**
|
5709
5712
|
* Degree of the spline to be created.
|
@@ -5719,14 +5722,16 @@ class Es extends Mt {
|
|
5719
5722
|
*/
|
5720
5723
|
get startPoint() {
|
5721
5724
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
|
5722
|
-
return new
|
5725
|
+
return new S(n[0], n[1], n[2]);
|
5723
5726
|
}
|
5724
5727
|
/**
|
5725
5728
|
* The end point of this spline
|
5726
5729
|
*/
|
5727
5730
|
get endPoint() {
|
5731
|
+
if (this._closed)
|
5732
|
+
return this.startPoint;
|
5728
5733
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
|
5729
|
-
return new
|
5734
|
+
return new S(n[0], n[1], n[2]);
|
5730
5735
|
}
|
5731
5736
|
/**
|
5732
5737
|
* @inheritdoc
|
@@ -5759,23 +5764,33 @@ class Es extends Mt {
|
|
5759
5764
|
return this._controlPoints[e];
|
5760
5765
|
}
|
5761
5766
|
/**
|
5762
|
-
* Divide this spline into the specified
|
5767
|
+
* Divide this spline into the specified number of points
|
5763
5768
|
* those points as an array of points.
|
5764
|
-
* @param numPoints Input the
|
5769
|
+
* @param numPoints Input the number of points returned
|
5765
5770
|
* @returns Return an array of point
|
5766
5771
|
*/
|
5767
5772
|
getPoints(t = 100) {
|
5768
|
-
const s = this._nurbsCurve, e = [], n = s.knots(), i =
|
5769
|
-
|
5770
|
-
const
|
5771
|
-
|
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
|
+
}
|
5772
5787
|
}
|
5773
5788
|
return e;
|
5774
5789
|
}
|
5775
5790
|
getCurvePoints(t, s) {
|
5776
|
-
const e = [], n = t.knots(), i = n[3],
|
5791
|
+
const e = [], n = t.knots(), i = n[3], r = (n[n.length - 4] - i) / (s - 1);
|
5777
5792
|
for (let a = 0; a < s; a++) {
|
5778
|
-
const o = i + a *
|
5793
|
+
const o = i + a * r;
|
5779
5794
|
e.push(t.point(o));
|
5780
5795
|
}
|
5781
5796
|
return e;
|
@@ -5836,12 +5851,12 @@ export {
|
|
5836
5851
|
Kt as AcGeLine2d,
|
5837
5852
|
_t as AcGeLine3d,
|
5838
5853
|
Is as AcGeLoop2d,
|
5839
|
-
|
5854
|
+
C as AcGeMathUtil,
|
5840
5855
|
v as AcGeMatrix2d,
|
5841
5856
|
tt as AcGeMatrix3d,
|
5842
5857
|
zt as AcGePlane,
|
5843
5858
|
b as AcGePoint2d,
|
5844
|
-
|
5859
|
+
S as AcGePoint3d,
|
5845
5860
|
Bs as AcGePolyline2d,
|
5846
5861
|
pt as AcGeQuaternion,
|
5847
5862
|
Yt as AcGeShape2d,
|