@mlightcad/geometry-engine 1.0.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/geometry-engine.js +416 -419
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/geometry/AcGeEllipseArc3d.d.ts +5 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -1
- package/lib/geometry/AcGeEllipseArc3d.js +18 -2
- package/lib/geometry/AcGeEllipseArc3d.js.map +1 -1
- package/lib/geometry/AcGeSpline3d.d.ts +2 -2
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
- package/lib/geometry/AcGeSpline3d.js +40 -49
- package/lib/geometry/AcGeSpline3d.js.map +1 -1
- package/package.json +2 -2
package/dist/geometry-engine.js
CHANGED
@@ -258,8 +258,8 @@ const k = [
|
|
258
258
|
"ff"
|
259
259
|
];
|
260
260
|
let St = 1234567;
|
261
|
-
const
|
262
|
-
function
|
261
|
+
const Lt = Math.PI / 180, Tt = 180 / Math.PI;
|
262
|
+
function Ot() {
|
263
263
|
const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
264
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();
|
265
265
|
}
|
@@ -269,100 +269,100 @@ function j(u, t, s) {
|
|
269
269
|
function Vt(u, t) {
|
270
270
|
return (u % t + t) % t;
|
271
271
|
}
|
272
|
-
function
|
272
|
+
function Wt(u, t, s, e, n) {
|
273
273
|
return e + (u - t) * (n - e) / (s - t);
|
274
274
|
}
|
275
|
-
function
|
275
|
+
function Ht(u, t, s) {
|
276
276
|
return u !== t ? (s - u) / (t - u) : 0;
|
277
277
|
}
|
278
278
|
function Ut(u, t, s) {
|
279
279
|
return (1 - s) * u + s * t;
|
280
280
|
}
|
281
|
-
function
|
281
|
+
function $t(u, t, s, e) {
|
282
282
|
return Ut(u, t, 1 - Math.exp(-s * e));
|
283
283
|
}
|
284
|
-
function
|
284
|
+
function Jt(u, t = 1) {
|
285
285
|
return t - Math.abs(Vt(u, t * 2) - t);
|
286
286
|
}
|
287
|
-
function
|
287
|
+
function vt(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
|
290
|
+
function ts(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
|
293
|
+
function ss(u, t) {
|
294
294
|
return u + Math.floor(Math.random() * (t - u + 1));
|
295
295
|
}
|
296
|
-
function
|
296
|
+
function es(u, t) {
|
297
297
|
return u + Math.random() * (t - u);
|
298
298
|
}
|
299
|
-
function
|
299
|
+
function ns(u) {
|
300
300
|
return u * (0.5 - Math.random());
|
301
301
|
}
|
302
|
-
function
|
302
|
+
function is(u) {
|
303
303
|
u !== void 0 && (St = u);
|
304
304
|
let t = St += 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;
|
309
|
-
}
|
310
307
|
function rs(u) {
|
311
|
-
return u *
|
308
|
+
return u * Lt;
|
312
309
|
}
|
313
310
|
function hs(u) {
|
314
|
-
return
|
311
|
+
return u * Tt;
|
315
312
|
}
|
316
313
|
function os(u) {
|
317
|
-
return
|
314
|
+
return (u & u - 1) === 0 && u !== 0;
|
318
315
|
}
|
319
316
|
function as(u) {
|
317
|
+
return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
|
318
|
+
}
|
319
|
+
function cs(u) {
|
320
320
|
return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
|
321
321
|
}
|
322
322
|
function mt(u) {
|
323
323
|
const t = Math.PI * 2;
|
324
324
|
return (u % t + t) % t;
|
325
325
|
}
|
326
|
-
function
|
326
|
+
function ls(u, t, s) {
|
327
327
|
return u > t && u < s || u > s && u < t;
|
328
328
|
}
|
329
|
-
function
|
329
|
+
function us(u, t, s, e = !1) {
|
330
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;
|
331
331
|
}
|
332
332
|
function qt(u) {
|
333
333
|
return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
|
334
334
|
}
|
335
|
-
function
|
335
|
+
function ds(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
|
340
|
-
DEG2RAD:
|
339
|
+
const S = {
|
340
|
+
DEG2RAD: Lt,
|
341
341
|
RAD2DEG: Tt,
|
342
|
-
generateUUID:
|
342
|
+
generateUUID: Ot,
|
343
343
|
clamp: j,
|
344
344
|
euclideanModulo: Vt,
|
345
|
-
mapLinear:
|
346
|
-
inverseLerp:
|
345
|
+
mapLinear: Wt,
|
346
|
+
inverseLerp: Ht,
|
347
347
|
lerp: Ut,
|
348
|
-
damp:
|
349
|
-
pingpong:
|
350
|
-
smoothstep:
|
351
|
-
smootherstep:
|
352
|
-
randInt:
|
353
|
-
randFloat:
|
354
|
-
randFloatSpread:
|
355
|
-
seededRandom:
|
356
|
-
degToRad:
|
357
|
-
radToDeg:
|
358
|
-
isPowerOfTwo:
|
359
|
-
ceilPowerOfTwo:
|
360
|
-
floorPowerOfTwo:
|
348
|
+
damp: $t,
|
349
|
+
pingpong: Jt,
|
350
|
+
smoothstep: vt,
|
351
|
+
smootherstep: ts,
|
352
|
+
randInt: ss,
|
353
|
+
randFloat: es,
|
354
|
+
randFloatSpread: ns,
|
355
|
+
seededRandom: is,
|
356
|
+
degToRad: rs,
|
357
|
+
radToDeg: hs,
|
358
|
+
isPowerOfTwo: os,
|
359
|
+
ceilPowerOfTwo: as,
|
360
|
+
floorPowerOfTwo: cs,
|
361
361
|
normalizeAngle: mt,
|
362
|
-
isBetween:
|
363
|
-
isBetweenAngle:
|
362
|
+
isBetween: ls,
|
363
|
+
isBetweenAngle: us,
|
364
364
|
intPartLength: qt,
|
365
|
-
relativeEps:
|
365
|
+
relativeEps: ds
|
366
366
|
}, W = class W {
|
367
367
|
/**
|
368
368
|
* Construct one vector by two numbers
|
@@ -839,8 +839,8 @@ const C = {
|
|
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 C = {
|
|
851
851
|
}
|
852
852
|
relativeEps(t = 1e-7) {
|
853
853
|
return Math.min(
|
854
|
-
|
855
|
-
|
854
|
+
S.relativeEps(this.x, t),
|
855
|
+
S.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], m = e[2], d = e[5], x = e[8], g = n[0], p = n[3], _ = n[6], w = n[1], f = n[4], A = n[7], z = n[2], C = n[5], M = n[8];
|
958
|
+
return i[0] = h * g + r * w + a * z, i[3] = h * p + r * f + a * C, i[6] = h * _ + r * A + a * M, i[1] = o * g + c * w + l * z, i[4] = o * p + c * f + l * C, i[7] = o * _ + c * A + l * M, i[2] = m * g + d * w + x * z, i[5] = m * p + d * f + x * C, i[8] = m * _ + d * A + x * M, 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, m = r * a - c * i, d = o * i - h * a, x = s * l + e * m + n * d;
|
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] = m * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - r * s) * g, t[6] = d * 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
|
@@ -1141,7 +1141,7 @@ const At = /* @__PURE__ */ new v(), Q = 1e-6, I = 2 * Math.PI, Ss = {
|
|
1141
1141
|
y: 0,
|
1142
1142
|
z: 0
|
1143
1143
|
};
|
1144
|
-
class
|
1144
|
+
class Ft {
|
1145
1145
|
/**
|
1146
1146
|
* Create tolerance class with default tolerance values
|
1147
1147
|
*/
|
@@ -1210,13 +1210,13 @@ class ds {
|
|
1210
1210
|
return t - s < e;
|
1211
1211
|
}
|
1212
1212
|
}
|
1213
|
-
const
|
1214
|
-
function
|
1213
|
+
const Xt = new Ft();
|
1214
|
+
function Dt(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[
|
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, m = t[a].y;
|
1220
1220
|
let d = c > n != m > n;
|
1221
1221
|
s && (d = c >= n != m >= n), d && e < (l - o) * (n - c) / (m - c) + o && (i = !i);
|
1222
1222
|
}
|
@@ -1229,14 +1229,14 @@ function ms(u, t) {
|
|
1229
1229
|
if (!s.intersectsBox(e))
|
1230
1230
|
return !1;
|
1231
1231
|
for (let n = 0; n < u.length; ) {
|
1232
|
-
if (
|
1232
|
+
if (Dt(u[n], t, !0))
|
1233
1233
|
return !0;
|
1234
|
-
n < u.length - 1 &&
|
1234
|
+
n < u.length - 1 && Xt.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
|
1235
1235
|
}
|
1236
1236
|
return !1;
|
1237
1237
|
}
|
1238
1238
|
const xs = {
|
1239
|
-
isPointInPolygon:
|
1239
|
+
isPointInPolygon: Dt,
|
1240
1240
|
isPolygonIntersect: ms
|
1241
1241
|
};
|
1242
1242
|
function ys(u, t) {
|
@@ -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[
|
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), m = Math.sqrt(l);
|
1275
1275
|
i += m, n.push(i);
|
1276
1276
|
}
|
1277
|
-
const
|
1278
|
-
for (let
|
1279
|
-
|
1280
|
-
for (let
|
1281
|
-
const a = n[
|
1282
|
-
|
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
1283
|
}
|
1284
|
-
for (let
|
1285
|
-
|
1286
|
-
return
|
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,18 +1325,18 @@ 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), w = _[0] - c[0], f = _[1] - c[1], A = _[2] - c[2];
|
1328
|
-
|
1328
|
+
r += Math.sqrt(w * w + f * f + 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
1336
|
), m = l[0] - c[0], d = l[1] - c[1], x = l[2] - c[2];
|
1337
|
-
return
|
1337
|
+
return r += Math.sqrt(m * m + d * d + x * x), r;
|
1338
1338
|
}
|
1339
|
-
function
|
1339
|
+
function Ms(u) {
|
1340
1340
|
return u.map((t) => [...t]);
|
1341
1341
|
}
|
1342
1342
|
class pt {
|
@@ -1360,28 +1360,28 @@ 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 m = i[
|
1366
|
-
if (
|
1365
|
+
const m = i[h + 0], d = 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 (
|
1370
|
+
if (r === 1) {
|
1371
1371
|
t[s + 0] = m, t[s + 1] = d, t[s + 2] = x, t[s + 3] = g;
|
1372
1372
|
return;
|
1373
1373
|
}
|
1374
1374
|
if (l !== g || a !== m || o !== d || c !== x) {
|
1375
|
-
let p = 1 -
|
1375
|
+
let p = 1 - r;
|
1376
1376
|
const _ = a * m + o * d + c * x + l * g, w = _ >= 0 ? 1 : -1, f = 1 - _ * _;
|
1377
1377
|
if (f > Number.EPSILON) {
|
1378
|
-
const
|
1379
|
-
p = Math.sin(p *
|
1378
|
+
const z = Math.sqrt(f), C = Math.atan2(z, _ * w);
|
1379
|
+
p = Math.sin(p * C) / z, r = Math.sin(r * C) / z;
|
1380
1380
|
}
|
1381
|
-
const A =
|
1382
|
-
if (a = a * p + m * A, o = o * p + d * A, c = c * p + x * A, l = l * p + g * A, p === 1 -
|
1383
|
-
const
|
1384
|
-
a *=
|
1381
|
+
const A = r * w;
|
1382
|
+
if (a = a * p + m * A, o = o * p + d * A, c = c * p + x * A, l = l * p + g * A, p === 1 - r) {
|
1383
|
+
const z = 1 / Math.sqrt(a * a + o * o + c * c + l * l);
|
1384
|
+
a *= z, o *= z, c *= z, l *= z;
|
1385
1385
|
}
|
1386
1386
|
}
|
1387
1387
|
t[s] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
|
@@ -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], m = i[h + 1], d = i[h + 2], x = i[h + 3];
|
1401
|
+
return t[s] = r * x + c * l + a * d - o * m, t[s + 1] = a * x + c * m + o * l - r * d, t[s + 2] = o * x + c * d + r * m - a * l, t[s + 3] = c * x - r * l - a * m - o * d, t;
|
1402
1402
|
}
|
1403
1403
|
/**
|
1404
1404
|
* X cooridinate
|
@@ -1469,8 +1469,8 @@ 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), m = a(e / 2), d = a(n / 2), x = a(i / 2);
|
1473
|
+
switch (h) {
|
1474
1474
|
case "XYZ":
|
1475
1475
|
this._x = m * c * l + o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l - m * d * x;
|
1476
1476
|
break;
|
@@ -1491,7 +1491,7 @@ class pt {
|
|
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],
|
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], m = e + r + l;
|
1517
1517
|
if (m > 0) {
|
1518
1518
|
const d = 0.5 / Math.sqrt(m + 1);
|
1519
|
-
this._w = 0.25 / d, this._x = (c - a) * d, this._y = (i - o) * d, this._z = (
|
1520
|
-
} else if (e >
|
1521
|
-
const d = 2 * Math.sqrt(1 + e -
|
1522
|
-
this._w = (c - a) / d, this._x = 0.25 * d, this._y = (n +
|
1523
|
-
} else if (
|
1524
|
-
const d = 2 * Math.sqrt(1 +
|
1525
|
-
this._w = (i - o) / d, this._x = (n +
|
1519
|
+
this._w = 0.25 / d, this._x = (c - a) * d, this._y = (i - o) * d, this._z = (h - n) * d;
|
1520
|
+
} else if (e > r && e > l) {
|
1521
|
+
const d = 2 * Math.sqrt(1 + e - r - l);
|
1522
|
+
this._w = (c - a) / d, this._x = 0.25 * d, this._y = (n + h) / d, this._z = (i + o) / d;
|
1523
|
+
} else if (r > l) {
|
1524
|
+
const d = 2 * Math.sqrt(1 + r - e - l);
|
1525
|
+
this._w = (i - o) / d, this._x = (n + h) / d, this._y = 0.25 * d, this._z = (a + c) / d;
|
1526
1526
|
} else {
|
1527
|
-
const d = 2 * Math.sqrt(1 + l - e -
|
1528
|
-
this._w = (
|
1527
|
+
const d = 2 * Math.sqrt(1 + l - e - r);
|
1528
|
+
this._w = (h - n) / d, this._x = (i + o) / d, this._y = (a + c) / d, this._z = 0.25 * d;
|
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
1664
|
const d = 1 - s;
|
1665
|
-
return this._w = d *
|
1665
|
+
return this._w = d * h + s * this._w, this._x = d * e + s * this._x, this._y = d * n + s * this._y, this._z = d * i + s * this._z, this.normalize(), this;
|
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, m = Math.sin(s * c) / o;
|
1668
|
+
return this._w = h * l + this._w * m, this._x = e * l + this._x * m, this._y = n * l + this._y * m, this._z = i * l + this._z * m, this._onChangeCallback(), this;
|
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,15 +2396,15 @@ const ft = /* @__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, m, d, 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 && m != null && d != 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,
|
@@ -2437,9 +2437,9 @@ const ft = /* @__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, m, d, 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] = m, _[3] = d, _[7] = x, _[11] = g, _[15] = p, this;
|
2443
2443
|
}
|
2444
2444
|
/**
|
2445
2445
|
* Reset this matrix to the identity matrix.
|
@@ -2501,7 +2501,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2501
2501
|
* @returns Return this matrix
|
2502
2502
|
*/
|
2503
2503
|
setFromExtrusionDirection(t) {
|
2504
|
-
if (
|
2504
|
+
if (Xt.equalPoint3d(t, y.Z_AXIS))
|
2505
2505
|
this.identity();
|
2506
2506
|
else {
|
2507
2507
|
const s = new y(1, 0, 0);
|
@@ -2571,8 +2571,8 @@ const ft = /* @__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
|
@@ -2687,7 +2687,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2687
2687
|
* @returns Return this matrix
|
2688
2688
|
*/
|
2689
2689
|
makeRotationFromQuaternion(t) {
|
2690
|
-
return this.compose(
|
2690
|
+
return this.compose(zs, t, As);
|
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 ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2698
2698
|
*/
|
2699
2699
|
lookAt(t, s, e) {
|
2700
2700
|
const n = this.elements;
|
2701
|
-
return
|
2701
|
+
return R.subVectors(t, s), R.lengthSq() === 0 && (R.z = 1), R.normalize(), q.crossVectors(e, R), q.lengthSq() === 0 && (Math.abs(e.z) === 1 ? R.x += 1e-4 : R.z += 1e-4, R.normalize(), q.crossVectors(e, R)), q.normalize(), ut.crossVectors(R, q), n[0] = q.x, n[4] = ut.x, n[8] = R.x, n[1] = q.y, n[5] = ut.y, n[9] = R.y, n[2] = q.z, n[6] = ut.z, n[10] = R.z, this;
|
2702
2702
|
}
|
2703
2703
|
/**
|
2704
2704
|
* Post-multiply this matrix by m.
|
@@ -2723,8 +2723,8 @@ const ft = /* @__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], m = e[9], d = e[13], x = e[2], g = e[6], p = e[10], _ = e[14], w = e[3], f = e[7], A = e[11], z = e[15], C = n[0], M = 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 * C + r * G + a * nt + o * ot, i[4] = h * M + 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 * C + l * G + m * nt + d * ot, i[5] = c * M + l * F + m * it + d * at, i[9] = c * E + l * K + m * rt + d * ct, i[13] = c * Z + l * et + m * ht + d * lt, i[2] = x * C + g * G + p * nt + _ * ot, i[6] = x * M + g * F + p * it + _ * at, i[10] = x * E + g * K + p * rt + _ * ct, i[14] = x * Z + g * et + p * ht + _ * lt, i[3] = w * C + f * G + A * nt + z * ot, i[7] = w * M + f * F + A * it + z * at, i[11] = w * E + f * K + A * rt + z * ct, i[15] = w * Z + f * et + A * ht + z * lt, this;
|
2728
2728
|
}
|
2729
2729
|
/**
|
2730
2730
|
* Multiply every component of the matrix by a scalar value s.
|
@@ -2740,8 +2740,8 @@ const ft = /* @__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], m = t[10], d = t[14], x = t[3], g = t[7], p = t[11], _ = t[15];
|
2744
|
+
return x * (+i * a * l - n * o * l - i * r * m + e * o * m + n * r * d - e * a * d) + g * (+s * a * d - s * o * m + i * h * m - n * h * d + n * o * c - i * a * c) + p * (+s * o * l - s * r * d - i * h * l + e * h * d + i * r * c - e * o * c) + _ * (-n * r * c - s * a * l + s * r * m + n * h * l - e * h * m + e * a * c);
|
2745
2745
|
}
|
2746
2746
|
/**
|
2747
2747
|
* Transposes this matrix.
|
@@ -2769,11 +2769,11 @@ const ft = /* @__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], m = t[10], d = t[11], x = t[12], g = t[13], p = t[14], _ = t[15], w = l * p * o - g * m * o + g * a * d - r * p * d - l * a * _ + r * m * _, f = x * m * o - c * p * o - x * a * d + h * p * d + c * a * _ - h * m * _, A = c * g * o - x * l * o + x * r * d - h * g * d - c * r * _ + h * l * _, z = x * l * a - c * g * a - x * r * m + h * g * m + c * r * p - h * l * p, C = s * w + e * f + n * A + i * z;
|
2773
|
+
if (C === 0)
|
2774
2774
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
2775
|
-
const
|
2776
|
-
return t[0] = w *
|
2775
|
+
const M = 1 / C;
|
2776
|
+
return t[0] = w * M, t[1] = (g * m * i - l * p * i - g * n * d + e * p * d + l * n * _ - e * m * _) * M, t[2] = (r * p * i - g * a * i + g * n * o - e * p * o - r * n * _ + e * a * _) * M, t[3] = (l * a * i - r * m * i - l * n * o + e * m * o + r * n * d - e * a * d) * M, t[4] = f * M, t[5] = (c * p * i - x * m * i + x * n * d - s * p * d - c * n * _ + s * m * _) * M, t[6] = (x * a * i - h * p * i - x * n * o + s * p * o + h * n * _ - s * a * _) * M, t[7] = (h * m * i - c * a * i + c * n * o - s * m * o - h * n * d + s * a * d) * M, t[8] = A * M, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * _ - s * l * _) * M, t[10] = (h * g * i - x * r * i + x * e * o - s * g * o - h * e * _ + s * r * _) * M, t[11] = (c * r * i - h * l * i - c * e * o + s * l * o + h * e * d - s * r * d) * M, t[12] = z * M, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * p + s * l * p) * M, t[14] = (x * r * n - h * g * n - x * e * a + s * g * a + h * e * p - s * r * p) * M, t[15] = (h * l * n - c * r * n + c * e * a - s * l * a - h * e * m + s * r * m) * M, this;
|
2777
2777
|
}
|
2778
2778
|
/**
|
2779
2779
|
* Multiply the columns of this matrix by vector v.
|
@@ -2836,18 +2836,18 @@ const ft = /* @__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 ft = /* @__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 ft = /* @__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 + _)) *
|
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, m = i * o, d = i * c, x = i * l, g = h * c, p = h * l, _ = r * l, w = a * o, f = a * c, A = a * l, z = e.x, C = e.y, M = e.z;
|
2891
|
+
return n[0] = (1 - (g + _)) * z, n[1] = (d + A) * z, n[2] = (x - f) * z, n[3] = 0, n[4] = (d - A) * C, n[5] = (1 - (m + _)) * C, n[6] = (p + w) * C, n[7] = 0, n[8] = (x + f) * M, n[9] = (p - w) * M, n[10] = (1 - (m + g)) * M, 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 ft = /* @__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
|
2908
|
-
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14],
|
2909
|
-
const o = 1 / i, c = 1 /
|
2910
|
-
return
|
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], L.copy(this);
|
2909
|
+
const o = 1 / i, c = 1 / h, l = 1 / r;
|
2910
|
+
return L.elements[0] *= o, L.elements[1] *= o, L.elements[2] *= o, L.elements[4] *= c, L.elements[5] *= c, L.elements[6] *= c, L.elements[8] *= l, L.elements[9] *= l, L.elements[10] *= l, s.setFromRotationMatrix(L), e.x = i, e.y = h, e.z = r, this;
|
2911
2911
|
}
|
2912
2912
|
// makePerspective(
|
2913
2913
|
// left,
|
@@ -3035,7 +3035,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
3035
3035
|
};
|
3036
3036
|
$.IDENTITY = Object.freeze(new $());
|
3037
3037
|
let tt = $;
|
3038
|
-
const O = /* @__PURE__ */ new y(),
|
3038
|
+
const O = /* @__PURE__ */ new y(), L = /* @__PURE__ */ new tt(), zs = /* @__PURE__ */ new y(0, 0, 0), As = /* @__PURE__ */ new y(1, 1, 1), q = /* @__PURE__ */ new y(), ut = /* @__PURE__ */ new y(), R = /* @__PURE__ */ new y();
|
3039
3039
|
class Y {
|
3040
3040
|
/**
|
3041
3041
|
* Create a 3d box bounded by min and max.
|
@@ -3512,7 +3512,7 @@ class V {
|
|
3512
3512
|
}
|
3513
3513
|
}
|
3514
3514
|
const It = /* @__PURE__ */ new y(), fs = /* @__PURE__ */ new y(), ws = /* @__PURE__ */ new v();
|
3515
|
-
class
|
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.
|
@@ -3687,7 +3687,7 @@ class zt {
|
|
3687
3687
|
* @returns Return the cloned plane
|
3688
3688
|
*/
|
3689
3689
|
clone() {
|
3690
|
-
return new
|
3690
|
+
return new Mt().copy(this);
|
3691
3691
|
}
|
3692
3692
|
}
|
3693
3693
|
class b extends P {
|
@@ -3703,7 +3703,7 @@ class b extends P {
|
|
3703
3703
|
}), s;
|
3704
3704
|
}
|
3705
3705
|
}
|
3706
|
-
class
|
3706
|
+
class B 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 S 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], m = n[6], d = 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, d), this._z = Math.atan2(-h, i)) : (this._x = Math.atan2(m, 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, d), 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(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, d), this._z = Math.atan2(-
|
3821
|
+
this._x = Math.asin(j(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, d), 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(m, d), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-
|
3824
|
+
this._y = Math.asin(-j(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, d), 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, d));
|
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(m, o), this._y = Math.atan2(r, i)) : (this._x = Math.atan2(-c, d), this._y = 0);
|
3831
3831
|
break;
|
3832
3832
|
default:
|
3833
3833
|
console.warn(
|
@@ -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
|
3914
|
+
class Yt {
|
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
|
3926
|
+
class Zt extends Yt {
|
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
|
3942
|
+
class Cs extends Zt {
|
3943
3943
|
/**
|
3944
3944
|
* Create one 2d area defined by one outter loop and multiple inner loops
|
3945
3945
|
*/
|
@@ -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
4007
|
let m = a + 1;
|
4008
4008
|
for (; m < i; m++) {
|
4009
4009
|
const d = e[m], x = t[d];
|
4010
4010
|
if (s[d].containsBox(l) && xs.isPointInPolygon(
|
4011
|
-
c[
|
4011
|
+
c[S.randInt(0, c.length - 1)],
|
4012
4012
|
x
|
4013
4013
|
)) {
|
4014
|
-
(
|
4014
|
+
(r = n.get(d)) == null || r.children.push(n.get(o));
|
4015
4015
|
break;
|
4016
4016
|
}
|
4017
4017
|
}
|
4018
|
-
m === i &&
|
4018
|
+
m === 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);
|
@@ -4050,7 +4050,7 @@ class Cs extends Yt {
|
|
4050
4050
|
}), e;
|
4051
4051
|
}
|
4052
4052
|
}
|
4053
|
-
class st extends
|
4053
|
+
class st extends Zt {
|
4054
4054
|
constructor() {
|
4055
4055
|
super(), this.arcLengthDivisions = 100;
|
4056
4056
|
}
|
@@ -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,21 +4142,21 @@ 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], m = e[n + 1] - c, d = (
|
4159
|
+
const c = e[n], m = e[n + 1] - c, d = (h - c) / m;
|
4160
4160
|
return (n + d) / (i - 1);
|
4161
4161
|
}
|
4162
4162
|
/**
|
@@ -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
|
}
|
@@ -4211,16 +4211,16 @@ class gt extends st {
|
|
4211
4211
|
* @param p3 Input the end point
|
4212
4212
|
*/
|
4213
4213
|
createByThreePoints(t, s, e) {
|
4214
|
-
const n = (
|
4215
|
-
x: (
|
4216
|
-
y: (
|
4217
|
-
}), i = (
|
4218
|
-
const F = (G - E) / (
|
4214
|
+
const n = (M, E) => ({
|
4215
|
+
x: (M.x + E.x) / 2,
|
4216
|
+
y: (M.y + E.y) / 2
|
4217
|
+
}), i = (M, E) => (E.y - M.y) / (E.x - M.x), h = (M) => -1 / M, r = n(t, s), a = n(s, e), o = i(t, s), c = i(s, e), l = h(o), m = h(c), d = (M, E, Z, G) => {
|
4218
|
+
const F = (G - E) / (M - Z), K = M * F + E;
|
4219
4219
|
return { x: F, y: K };
|
4220
|
-
}, x =
|
4220
|
+
}, x = r.y - l * r.x, g = a.y - m * a.x, p = d(l, x, m, g), _ = Math.sqrt(
|
4221
4221
|
Math.pow(t.x - p.x, 2) + Math.pow(t.y - p.y, 2)
|
4222
|
-
), w = (
|
4223
|
-
this.center = p, this.radius = _, this.startAngle = f, this.endAngle =
|
4222
|
+
), w = (M, E) => Math.atan2(M.y - E.y, M.x - E.x), f = w(t, p), A = w(s, p), z = w(e, p), C = z > f && z < A || f > z && f < A || A > z && A < f;
|
4223
|
+
this.center = p, this.radius = _, this.startAngle = f, this.endAngle = z, this.clockwise = !C;
|
4224
4224
|
}
|
4225
4225
|
/**
|
4226
4226
|
* Create circular arc by two points and one bugle factor
|
@@ -4234,9 +4234,9 @@ 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
|
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
4240
|
let m;
|
4241
4241
|
if (n < Math.PI) {
|
4242
4242
|
const d = new P(
|
@@ -4251,7 +4251,7 @@ class gt extends st {
|
|
4251
4251
|
);
|
4252
4252
|
m = o.add(d.multiplyScalar(c));
|
4253
4253
|
}
|
4254
|
-
e < 0 ? (this.startAngle = Math.atan2(i.y - m.y, i.x - m.x), this.endAngle = Math.atan2(
|
4254
|
+
e < 0 ? (this.startAngle = Math.atan2(i.y - m.y, i.x - m.x), this.endAngle = Math.atan2(h.y - m.y, h.x - m.x)) : (this.startAngle = Math.atan2(h.y - m.y, h.x - m.x), this.endAngle = Math.atan2(i.y - m.y, i.x - m.x)), this.clockwise = e < 0, this.center = m, this.radius = h.sub(m).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 = S.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 : S.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 ? S.normalizeAngle(this.startAngle - this.endAngle) : S.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 = S.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
|
+
S.isBetweenAngle(
|
4341
4341
|
i,
|
4342
4342
|
this.startAngle,
|
4343
4343
|
this.endAngle,
|
@@ -4392,18 +4392,18 @@ 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
|
}
|
4405
4405
|
}
|
4406
|
-
class Ps extends
|
4406
|
+
class Ps extends Yt {
|
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
|
4423
|
+
class zt extends Ps {
|
4424
4424
|
}
|
4425
|
-
class _t extends
|
4425
|
+
class _t extends zt {
|
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
|
4431
|
+
super(), this._start = new B(t), this._end = new B(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 B(
|
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 B(this._start).addScaledVector(e, t);
|
4502
4502
|
} else {
|
4503
4503
|
const e = this.delta(X).normalize();
|
4504
|
-
return new
|
4504
|
+
return new B(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 B(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 B(this._end).addScaledVector(e, t);
|
4524
4524
|
}
|
4525
4525
|
return this._boundingBoxNeedsUpdate = !0, this;
|
4526
4526
|
}
|
@@ -4532,10 +4532,10 @@ 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
|
-
|
4535
|
+
Rt.subVectors(t, this._start), dt.subVectors(this.endPoint, this.startPoint);
|
4536
4536
|
const e = dt.dot(dt);
|
4537
|
-
let i = dt.dot(
|
4538
|
-
return s && (i =
|
4537
|
+
let i = dt.dot(Rt) / e;
|
4538
|
+
return s && (i = S.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 B().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 B().addVectors(e, h);
|
4593
4593
|
}
|
4594
4594
|
/**
|
4595
4595
|
* @inheritdoc
|
4596
4596
|
*/
|
4597
4597
|
calculateBoundingBox() {
|
4598
|
-
const t = new
|
4598
|
+
const t = new B(
|
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 B(
|
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)
|
@@ -4631,8 +4631,8 @@ class _t extends Mt {
|
|
4631
4631
|
return new _t(this._start.clone(), this._end.clone());
|
4632
4632
|
}
|
4633
4633
|
}
|
4634
|
-
const X = /* @__PURE__ */ new y(),
|
4635
|
-
class yt extends
|
4634
|
+
const X = /* @__PURE__ */ new y(), Rt = /* @__PURE__ */ new y(), dt = /* @__PURE__ */ new y();
|
4635
|
+
class yt extends zt {
|
4636
4636
|
/**
|
4637
4637
|
* Compute center point of the arc given three points
|
4638
4638
|
* @param startPoint Input start point of the arc
|
@@ -4641,10 +4641,10 @@ 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(
|
4647
|
+
const o = new y().crossVectors(h, a).normalize(), c = new y().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = new _t(n, n.clone().add(l)), x = new _t(i, i.clone().add(m)), g = new y();
|
4648
4648
|
return d.closestPointToPoint(x.startPoint, !0, g) ? g : (console.error("Cannot find a valid center for the arc."), null);
|
4649
4649
|
}
|
4650
4650
|
/**
|
@@ -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 B(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 = S.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 : S.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 S.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
|
+
S.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 B(
|
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
|
/**
|
@@ -4870,11 +4870,11 @@ class yt extends Mt {
|
|
4870
4870
|
*/
|
4871
4871
|
get plane() {
|
4872
4872
|
const t = new y(this.center).distanceTo(jt);
|
4873
|
-
return new
|
4873
|
+
return new Mt(this.normal, t);
|
4874
4874
|
}
|
4875
4875
|
}
|
4876
4876
|
const Pt = /* @__PURE__ */ new y();
|
4877
|
-
class
|
4877
|
+
class Gt extends st {
|
4878
4878
|
/**
|
4879
4879
|
* Construct an instance of the ellipse arc.
|
4880
4880
|
* @param center Center point of the ellipse.
|
@@ -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 B(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 = S.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 : S.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 S.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
|
@@ -5022,7 +5022,7 @@ class Zt extends st {
|
|
5022
5022
|
* @inheritdoc
|
5023
5023
|
*/
|
5024
5024
|
clone() {
|
5025
|
-
return new
|
5025
|
+
return new Gt(
|
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
|
5036
|
+
class Kt extends zt {
|
5037
5037
|
/**
|
5038
5038
|
* Construct an instance of the ellipse arc.
|
5039
5039
|
* @param center Center point of the ellipse.
|
@@ -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 B(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 = S.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 : S.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 : S.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.
|
@@ -5157,12 +5157,21 @@ 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 Ft.equal(this.majorAxisRadius, this.minorAxisRadius);
|
5166
|
+
}
|
5160
5167
|
get length() {
|
5161
|
-
|
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 <=
|
5164
|
-
const
|
5165
|
-
e += Math.sqrt(a * a + o * o + c * c), n =
|
5172
|
+
for (let i = 1; i <= t; i++) {
|
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;
|
5174
|
+
e += Math.sqrt(a * a + o * o + c * c), n = r;
|
5166
5175
|
}
|
5167
5176
|
return e;
|
5168
5177
|
}
|
@@ -5175,25 +5184,25 @@ class Gt extends Mt {
|
|
5175
5184
|
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
5185
|
const t = [this.startAngle, this.endAngle];
|
5177
5186
|
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,
|
5187
|
+
S.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
5188
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5180
5189
|
for (const a of t) {
|
5181
5190
|
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 >
|
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
5193
|
return new Y(
|
5185
5194
|
{ x: s, y: e, z: n },
|
5186
|
-
{ x: i, y:
|
5195
|
+
{ x: i, y: h, z: r }
|
5187
5196
|
);
|
5188
5197
|
} else {
|
5189
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0,
|
5198
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5190
5199
|
for (let a = 0; a <= 100; a++) {
|
5191
5200
|
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),
|
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
5203
|
return new Y(
|
5195
5204
|
{ x: s, y: e, z: n },
|
5196
|
-
{ x: i, y:
|
5205
|
+
{ x: i, y: h, z: r }
|
5197
5206
|
);
|
5198
5207
|
}
|
5199
5208
|
}
|
@@ -5208,8 +5217,8 @@ class Gt extends Mt {
|
|
5208
5217
|
let e = this.deltaAngle, n = this.startAngle;
|
5209
5218
|
this.closed && (e = I, n = 0);
|
5210
5219
|
for (let i = 0; i <= t; i++) {
|
5211
|
-
const
|
5212
|
-
s.push(
|
5220
|
+
const h = n + e * (i / t), r = this.getPointAtAngle(h);
|
5221
|
+
s.push(r);
|
5213
5222
|
}
|
5214
5223
|
return s;
|
5215
5224
|
}
|
@@ -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
|
5232
|
+
return new B(
|
5224
5233
|
this.center.x + i.x,
|
5225
5234
|
this.center.y + i.y,
|
5226
5235
|
this.center.z + i.z
|
@@ -5232,8 +5241,8 @@ 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,
|
5236
|
-
return i * i +
|
5244
|
+
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;
|
5245
|
+
return i * i + h * h <= 1;
|
5237
5246
|
}
|
5238
5247
|
/**
|
5239
5248
|
* @inheritdoc
|
@@ -5251,7 +5260,7 @@ class Gt extends Mt {
|
|
5251
5260
|
* @inheritdoc
|
5252
5261
|
*/
|
5253
5262
|
clone() {
|
5254
|
-
return new
|
5263
|
+
return new Kt(
|
5255
5264
|
this.center,
|
5256
5265
|
this.normal,
|
5257
5266
|
this.majorAxis,
|
@@ -5266,7 +5275,7 @@ class Gt extends Mt {
|
|
5266
5275
|
*/
|
5267
5276
|
get plane() {
|
5268
5277
|
const t = new y(this.center).distanceTo(jt);
|
5269
|
-
return new
|
5278
|
+
return new Mt(this.normal, t);
|
5270
5279
|
}
|
5271
5280
|
}
|
5272
5281
|
class Bs extends st {
|
@@ -5321,8 +5330,8 @@ 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
|
5325
|
-
t +=
|
5333
|
+
const h = new gt(n, i, n.bulge);
|
5334
|
+
t += h.length;
|
5326
5335
|
} else
|
5327
5336
|
t += new b(n.x, n.y).distanceTo(i);
|
5328
5337
|
}
|
@@ -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
|
5391
|
+
(i) => e.push(new B().set(i.x, i.y, s))
|
5383
5392
|
), e;
|
5384
5393
|
}
|
5385
5394
|
/**
|
@@ -5392,9 +5401,9 @@ class Bs extends st {
|
|
5392
5401
|
for (let n = 0; n < e; ++n) {
|
5393
5402
|
const i = this._vertices[n];
|
5394
5403
|
if (i.bulge) {
|
5395
|
-
let
|
5396
|
-
if (n < e - 1 ?
|
5397
|
-
const a = new gt(i,
|
5404
|
+
let h = null;
|
5405
|
+
if (n < e - 1 ? h = this._vertices[n + 1] : n == e - 1 && this.closed && (h = this._vertices[0]), h) {
|
5406
|
+
const a = new gt(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
5409
|
s.push(new b(l.x, l.y));
|
@@ -5406,7 +5415,7 @@ class Bs extends st {
|
|
5406
5415
|
return s;
|
5407
5416
|
}
|
5408
5417
|
}
|
5409
|
-
class
|
5418
|
+
class Qt 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.
|
@@ -5482,7 +5491,7 @@ class Kt extends st {
|
|
5482
5491
|
* @inheritdoc
|
5483
5492
|
*/
|
5484
5493
|
clone() {
|
5485
|
-
return new
|
5494
|
+
return new Qt(this._start.clone(), this._end.clone());
|
5486
5495
|
}
|
5487
5496
|
}
|
5488
5497
|
class Is extends st {
|
@@ -5629,37 +5638,38 @@ class D {
|
|
5629
5638
|
n = ys(s, t.length);
|
5630
5639
|
break;
|
5631
5640
|
}
|
5632
|
-
const i =
|
5633
|
-
return new D(s, n, i,
|
5641
|
+
const i = Ms(t), h = new Array(i.length).fill(1);
|
5642
|
+
return new D(s, n, i, h);
|
5634
5643
|
}
|
5635
5644
|
}
|
5636
|
-
class Es extends
|
5637
|
-
constructor(t, s, e) {
|
5645
|
+
class Es extends zt {
|
5646
|
+
constructor(t, s, e, n) {
|
5638
5647
|
super();
|
5639
|
-
const
|
5640
|
-
if (
|
5648
|
+
const i = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0);
|
5649
|
+
if (i < 2 || i > 4)
|
5641
5650
|
throw T.ILLEGAL_PARAMETERS;
|
5642
|
-
const
|
5643
|
-
if (this._closed = !1,
|
5644
|
-
if (this.
|
5645
|
-
throw T.ILLEGAL_PARAMETERS;
|
5646
|
-
const r = this.toNurbsPoints(this._fitPoints);
|
5647
|
-
this._nurbsCurve = D.byPoints(
|
5648
|
-
r,
|
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)
|
5651
|
+
const h = 3;
|
5652
|
+
if (this._closed = n || !1, Array.isArray(s)) {
|
5653
|
+
if (this._controlPoints = t, i >= 4 && (this._closed = n), this._controlPoints.length < 4)
|
5654
5654
|
throw T.ILLEGAL_PARAMETERS;
|
5655
5655
|
const r = this.toNurbsPoints(this._controlPoints);
|
5656
5656
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5657
|
-
|
5657
|
+
h,
|
5658
5658
|
s,
|
5659
5659
|
r,
|
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
|
+
} else {
|
5663
|
+
if (this._fitPoints = t, this._knotParameterization = s, i >= 3 && (this._closed = e), this._fitPoints.length < 4)
|
5664
|
+
throw T.ILLEGAL_PARAMETERS;
|
5665
|
+
const r = this.toNurbsPoints(this._fitPoints);
|
5666
|
+
this._nurbsCurve = D.byPoints(
|
5667
|
+
r,
|
5668
|
+
h,
|
5669
|
+
this._knotParameterization
|
5670
|
+
), this._controlPoints = this.toGePoints(this._nurbsCurve.controlPoints()), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = [...this._nurbsCurve.weights()];
|
5662
5671
|
}
|
5672
|
+
this._closed && this.makeClosed();
|
5663
5673
|
}
|
5664
5674
|
/**
|
5665
5675
|
* Set the closed property and rebuild the curve if necessary
|
@@ -5671,15 +5681,15 @@ class Es extends Mt {
|
|
5671
5681
|
* Make the spline closed by adding control points and adjusting knots
|
5672
5682
|
*/
|
5673
5683
|
makeClosed() {
|
5674
|
-
const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.knots(), n = this._nurbsCurve.weights(), i = [...s],
|
5684
|
+
const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.knots(), n = this._nurbsCurve.weights(), i = [...s], h = [...n];
|
5675
5685
|
for (let a = 0; a < t; a++)
|
5676
|
-
i.push([...s[
|
5677
|
-
const
|
5686
|
+
i.push([...s[0]]), h.push(n[0]);
|
5687
|
+
const r = this.createClosedKnotVector(e, t);
|
5678
5688
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5679
5689
|
t,
|
5680
|
-
|
5690
|
+
r,
|
5681
5691
|
i,
|
5682
|
-
|
5692
|
+
h
|
5683
5693
|
), this._controlPoints = this.toGePoints(i);
|
5684
5694
|
}
|
5685
5695
|
/**
|
@@ -5700,9 +5710,9 @@ class Es extends Mt {
|
|
5700
5710
|
* Create knot vector for closed curve
|
5701
5711
|
*/
|
5702
5712
|
createClosedKnotVector(t, s) {
|
5703
|
-
const e = [...t], n = t[t.length - 1], i =
|
5704
|
-
for (let
|
5705
|
-
e.push(n +
|
5713
|
+
const e = [...t], n = t[t.length - 1], i = s;
|
5714
|
+
for (let h = 1; h <= i; h++)
|
5715
|
+
e.push(n + h);
|
5706
5716
|
return e;
|
5707
5717
|
}
|
5708
5718
|
/**
|
@@ -5719,16 +5729,14 @@ class Es extends Mt {
|
|
5719
5729
|
*/
|
5720
5730
|
get startPoint() {
|
5721
5731
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
|
5722
|
-
return new
|
5732
|
+
return new B(n[0], n[1], n[2]);
|
5723
5733
|
}
|
5724
5734
|
/**
|
5725
5735
|
* The end point of this spline
|
5726
5736
|
*/
|
5727
5737
|
get endPoint() {
|
5728
|
-
if (this._closed)
|
5729
|
-
return this.startPoint;
|
5730
5738
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
|
5731
|
-
return new
|
5739
|
+
return new B(n[0], n[1], n[2]);
|
5732
5740
|
}
|
5733
5741
|
/**
|
5734
5742
|
* @inheritdoc
|
@@ -5767,28 +5775,17 @@ class Es extends Mt {
|
|
5767
5775
|
* @returns Return an array of point
|
5768
5776
|
*/
|
5769
5777
|
getPoints(t = 100) {
|
5770
|
-
const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(),
|
5771
|
-
|
5772
|
-
const
|
5773
|
-
|
5774
|
-
let c;
|
5775
|
-
o === t - 1 ? c = r : c = r + o * a;
|
5776
|
-
const l = s.point(c);
|
5777
|
-
e.push(new S(l[0], l[1], l[2]));
|
5778
|
-
}
|
5779
|
-
} else {
|
5780
|
-
const a = (h - r) / (t - 1);
|
5781
|
-
for (let o = 0; o < t; o++) {
|
5782
|
-
const c = o === t - 1 ? h : r + o * a, l = s.point(c);
|
5783
|
-
e.push(new S(l[0], l[1], l[2]));
|
5784
|
-
}
|
5778
|
+
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);
|
5779
|
+
for (let o = 0; o < t; o++) {
|
5780
|
+
const c = o === t - 1 ? r : h + o * a, l = s.point(c);
|
5781
|
+
e.push(new B(l[0], l[1], l[2]));
|
5785
5782
|
}
|
5786
5783
|
return e;
|
5787
5784
|
}
|
5788
5785
|
getCurvePoints(t, s) {
|
5789
|
-
const e = [], n = t.knots(), i = n[3],
|
5786
|
+
const e = [], n = t.knots(), i = n[3], r = (n[n.length - 4] - i) / (s - 1);
|
5790
5787
|
for (let a = 0; a < s; a++) {
|
5791
|
-
const o = i + a *
|
5788
|
+
const o = i + a * r;
|
5792
5789
|
e.push(t.point(o));
|
5793
5790
|
}
|
5794
5791
|
return e;
|
@@ -5842,28 +5839,28 @@ export {
|
|
5842
5839
|
gt as AcGeCircArc2d,
|
5843
5840
|
yt as AcGeCircArc3d,
|
5844
5841
|
st as AcGeCurve2d,
|
5845
|
-
|
5846
|
-
|
5842
|
+
Gt as AcGeEllipseArc2d,
|
5843
|
+
Kt as AcGeEllipseArc3d,
|
5847
5844
|
Nt as AcGeEuler,
|
5848
5845
|
xs as AcGeGeometryUtil,
|
5849
|
-
|
5846
|
+
Qt as AcGeLine2d,
|
5850
5847
|
_t as AcGeLine3d,
|
5851
5848
|
Is as AcGeLoop2d,
|
5852
|
-
|
5849
|
+
S as AcGeMathUtil,
|
5853
5850
|
v as AcGeMatrix2d,
|
5854
5851
|
tt as AcGeMatrix3d,
|
5855
|
-
|
5852
|
+
Mt as AcGePlane,
|
5856
5853
|
b as AcGePoint2d,
|
5857
|
-
|
5854
|
+
B as AcGePoint3d,
|
5858
5855
|
Bs as AcGePolyline2d,
|
5859
5856
|
pt as AcGeQuaternion,
|
5860
|
-
|
5857
|
+
Zt as AcGeShape2d,
|
5861
5858
|
Es as AcGeSpline3d,
|
5862
|
-
|
5859
|
+
Ft as AcGeTol,
|
5863
5860
|
P as AcGeVector2d,
|
5864
5861
|
y as AcGeVector3d,
|
5865
|
-
|
5866
|
-
|
5862
|
+
Xt as DEFAULT_TOL,
|
5863
|
+
Lt as DEG2RAD,
|
5867
5864
|
Q as FLOAT_TOL,
|
5868
5865
|
Ss as ORIGIN_POINT_2D,
|
5869
5866
|
jt as ORIGIN_POINT_3D,
|
@@ -5871,35 +5868,35 @@ export {
|
|
5871
5868
|
I as TAU,
|
5872
5869
|
bt as basisFunction,
|
5873
5870
|
ps as calculateCurveLength,
|
5874
|
-
|
5871
|
+
as as ceilPowerOfTwo,
|
5875
5872
|
j as clamp,
|
5876
|
-
|
5877
|
-
|
5873
|
+
$t as damp,
|
5874
|
+
rs as degToRad,
|
5878
5875
|
Vt as euclideanModulo,
|
5879
5876
|
xt as evaluateNurbsPoint,
|
5880
|
-
|
5877
|
+
cs as floorPowerOfTwo,
|
5881
5878
|
gs as generateChordKnots,
|
5882
5879
|
_s as generateSqrtChordKnots,
|
5883
|
-
|
5880
|
+
Ot as generateUUID,
|
5884
5881
|
ys as generateUniformKnots,
|
5885
5882
|
qt as intPartLength,
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5883
|
+
Ms as interpolateControlPoints,
|
5884
|
+
Ht as inverseLerp,
|
5885
|
+
ls as isBetween,
|
5886
|
+
us as isBetweenAngle,
|
5887
|
+
Dt as isPointInPolygon,
|
5891
5888
|
ms as isPolygonIntersect,
|
5892
|
-
|
5889
|
+
os as isPowerOfTwo,
|
5893
5890
|
Ut as lerp,
|
5894
|
-
|
5891
|
+
Wt as mapLinear,
|
5895
5892
|
mt as normalizeAngle,
|
5896
|
-
|
5897
|
-
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
|
5893
|
+
Jt as pingpong,
|
5894
|
+
hs as radToDeg,
|
5895
|
+
es as randFloat,
|
5896
|
+
ns as randFloatSpread,
|
5897
|
+
ss as randInt,
|
5898
|
+
ds as relativeEps,
|
5899
|
+
is as seededRandom,
|
5900
|
+
ts as smootherstep,
|
5901
|
+
vt as smoothstep
|
5905
5902
|
};
|