@mlightcad/geometry-engine 3.2.17 → 3.2.19
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 +510 -437
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/geometry/AcGeArea2d.d.ts +4 -0
- package/lib/geometry/AcGeArea2d.d.ts.map +1 -1
- package/lib/geometry/AcGeArea2d.js +10 -0
- package/lib/geometry/AcGeArea2d.js.map +1 -1
- package/lib/geometry/AcGeCatmullRomCurve3d.d.ts +4 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.d.ts.map +1 -1
- package/lib/geometry/AcGeCatmullRomCurve3d.js +6 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.js.map +1 -1
- package/lib/geometry/AcGeCurve2d.d.ts +4 -0
- package/lib/geometry/AcGeCurve2d.d.ts.map +1 -1
- package/lib/geometry/AcGeCurve2d.js.map +1 -1
- package/lib/geometry/AcGeCurve3d.d.ts +4 -0
- package/lib/geometry/AcGeCurve3d.d.ts.map +1 -1
- package/lib/geometry/AcGeCurve3d.js.map +1 -1
- package/lib/geometry/AcGeLoop2d.d.ts +4 -0
- package/lib/geometry/AcGeLoop2d.d.ts.map +1 -1
- package/lib/geometry/AcGeLoop2d.js +6 -0
- package/lib/geometry/AcGeLoop2d.js.map +1 -1
- package/lib/geometry/AcGeNurbsCurve.d.ts +4 -0
- package/lib/geometry/AcGeNurbsCurve.d.ts.map +1 -1
- package/lib/geometry/AcGeNurbsCurve.js +6 -0
- package/lib/geometry/AcGeNurbsCurve.js.map +1 -1
- package/lib/geometry/AcGePolyline2d.d.ts +4 -0
- package/lib/geometry/AcGePolyline2d.d.ts.map +1 -1
- package/lib/geometry/AcGePolyline2d.js +17 -0
- package/lib/geometry/AcGePolyline2d.js.map +1 -1
- package/lib/geometry/AcGeShape.d.ts +4 -0
- package/lib/geometry/AcGeShape.d.ts.map +1 -1
- package/lib/geometry/AcGeShape.js.map +1 -1
- package/lib/geometry/AcGeShape2d.d.ts +4 -0
- package/lib/geometry/AcGeShape2d.d.ts.map +1 -1
- package/lib/geometry/AcGeShape2d.js.map +1 -1
- package/lib/geometry/AcGeShape3d.d.ts +4 -0
- package/lib/geometry/AcGeShape3d.d.ts.map +1 -1
- package/lib/geometry/AcGeShape3d.js.map +1 -1
- package/lib/geometry/AcGeSpline3d.d.ts +4 -0
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
- package/lib/geometry/AcGeSpline3d.js +29 -0
- package/lib/geometry/AcGeSpline3d.js.map +1 -1
- package/lib/math/AcGePoint2d.d.ts +4 -0
- package/lib/math/AcGePoint2d.d.ts.map +1 -1
- package/lib/math/AcGePoint2d.js +6 -0
- package/lib/math/AcGePoint2d.js.map +1 -1
- package/lib/math/AcGePoint3d.d.ts +4 -0
- package/lib/math/AcGePoint3d.d.ts.map +1 -1
- package/lib/math/AcGePoint3d.js +6 -0
- package/lib/math/AcGePoint3d.js.map +1 -1
- package/lib/util/AcGeTol.d.ts +4 -0
- package/lib/util/AcGeTol.d.ts.map +1 -1
- package/lib/util/AcGeTol.js +9 -0
- package/lib/util/AcGeTol.js.map +1 -1
- package/package.json +2 -2
package/dist/geometry-engine.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AcCmErrors as
|
|
1
|
+
import { AcCmErrors as U } from "@mlightcad/common";
|
|
2
2
|
const N = [
|
|
3
3
|
"00",
|
|
4
4
|
"01",
|
|
@@ -257,112 +257,112 @@ const N = [
|
|
|
257
257
|
"fe",
|
|
258
258
|
"ff"
|
|
259
259
|
];
|
|
260
|
-
let
|
|
261
|
-
const
|
|
262
|
-
function
|
|
263
|
-
const
|
|
264
|
-
return (N[
|
|
260
|
+
let Tt = 1234567;
|
|
261
|
+
const Dt = Math.PI / 180, Yt = 180 / Math.PI;
|
|
262
|
+
function es() {
|
|
263
|
+
const m = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
|
264
|
+
return (N[m & 255] + N[m >> 8 & 255] + N[m >> 16 & 255] + N[m >> 24 & 255] + "-" + N[t & 255] + N[t >> 8 & 255] + "-" + N[t >> 16 & 15 | 64] + N[t >> 24 & 255] + "-" + N[s & 63 | 128] + N[s >> 8 & 255] + "-" + N[s >> 16 & 255] + N[s >> 24 & 255] + N[e & 255] + N[e >> 8 & 255] + N[e >> 16 & 255] + N[e >> 24 & 255]).toLowerCase();
|
|
265
265
|
}
|
|
266
|
-
function Z(
|
|
267
|
-
return Math.max(t, Math.min(s,
|
|
266
|
+
function Z(m, t, s) {
|
|
267
|
+
return Math.max(t, Math.min(s, m));
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
return (
|
|
269
|
+
function Zt(m, t) {
|
|
270
|
+
return (m % t + t) % t;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return e + (
|
|
272
|
+
function ns(m, t, s, e, n) {
|
|
273
|
+
return e + (m - t) * (n - e) / (s - t);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
275
|
+
function is(m, t, s) {
|
|
276
|
+
return m !== t ? (s - m) / (t - m) : 0;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
return (1 - s) *
|
|
278
|
+
function Ot(m, t, s) {
|
|
279
|
+
return (1 - s) * m + s * t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return
|
|
281
|
+
function rs(m, t, s, e) {
|
|
282
|
+
return Ot(m, t, 1 - Math.exp(-s * e));
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return t - Math.abs(
|
|
284
|
+
function os(m, t = 1) {
|
|
285
|
+
return t - Math.abs(Zt(m, t * 2) - t);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
return
|
|
287
|
+
function hs(m, t, s) {
|
|
288
|
+
return m <= t ? 0 : m >= s ? 1 : (m = (m - t) / (s - t), m * m * (3 - 2 * m));
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
return
|
|
290
|
+
function as(m, t, s) {
|
|
291
|
+
return m <= t ? 0 : m >= s ? 1 : (m = (m - t) / (s - t), m * m * m * (m * (m * 6 - 15) + 10));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return
|
|
293
|
+
function cs(m, t) {
|
|
294
|
+
return m + Math.floor(Math.random() * (t - m + 1));
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return
|
|
296
|
+
function ls(m, t) {
|
|
297
|
+
return m + Math.random() * (t - m);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
299
|
+
function us(m) {
|
|
300
|
+
return m * (0.5 - Math.random());
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
|
|
304
|
-
let t =
|
|
302
|
+
function ds(m) {
|
|
303
|
+
m !== void 0 && (Tt = m);
|
|
304
|
+
let t = Tt += 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
|
|
308
|
-
return
|
|
307
|
+
function ms(m) {
|
|
308
|
+
return m * Dt;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
return
|
|
310
|
+
function xs(m) {
|
|
311
|
+
return m * Yt;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
return (
|
|
313
|
+
function gs(m) {
|
|
314
|
+
return (m & m - 1) === 0 && m !== 0;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
return Math.pow(2, Math.ceil(Math.log(
|
|
316
|
+
function ys(m) {
|
|
317
|
+
return Math.pow(2, Math.ceil(Math.log(m) / Math.LN2));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
return Math.pow(2, Math.floor(Math.log(
|
|
319
|
+
function _s(m) {
|
|
320
|
+
return Math.pow(2, Math.floor(Math.log(m) / Math.LN2));
|
|
321
321
|
}
|
|
322
|
-
function pt(
|
|
322
|
+
function pt(m) {
|
|
323
323
|
const t = Math.PI * 2;
|
|
324
|
-
return (
|
|
324
|
+
return (m % t + t) % t;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
327
|
-
return
|
|
326
|
+
function ps(m, t, s) {
|
|
327
|
+
return m > t && m < s || m > s && m < t;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
return
|
|
329
|
+
function fs(m, t, s, e = !1) {
|
|
330
|
+
return m = pt(m), t = pt(t), s = pt(s), e ? t > s ? m <= t && m >= s : m <= t || m >= s : t < s ? m >= t && m <= s : m >= t || m <= s;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
return
|
|
332
|
+
function Qt(m) {
|
|
333
|
+
return m = Math.abs(m), m < 1 ? 0 : Math.ceil(Math.log10(Math.abs(m) + 1));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const s =
|
|
335
|
+
function As(m, t = 1e-7) {
|
|
336
|
+
const s = Qt(m);
|
|
337
337
|
return Math.max(Math.pow(10, s) * t, t);
|
|
338
338
|
}
|
|
339
339
|
const M = {
|
|
340
|
-
DEG2RAD:
|
|
341
|
-
RAD2DEG:
|
|
342
|
-
generateUUID:
|
|
340
|
+
DEG2RAD: Dt,
|
|
341
|
+
RAD2DEG: Yt,
|
|
342
|
+
generateUUID: es,
|
|
343
343
|
clamp: Z,
|
|
344
|
-
euclideanModulo:
|
|
345
|
-
mapLinear:
|
|
346
|
-
inverseLerp:
|
|
347
|
-
lerp:
|
|
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:
|
|
344
|
+
euclideanModulo: Zt,
|
|
345
|
+
mapLinear: ns,
|
|
346
|
+
inverseLerp: is,
|
|
347
|
+
lerp: Ot,
|
|
348
|
+
damp: rs,
|
|
349
|
+
pingpong: os,
|
|
350
|
+
smoothstep: hs,
|
|
351
|
+
smootherstep: as,
|
|
352
|
+
randInt: cs,
|
|
353
|
+
randFloat: ls,
|
|
354
|
+
randFloatSpread: us,
|
|
355
|
+
seededRandom: ds,
|
|
356
|
+
degToRad: ms,
|
|
357
|
+
radToDeg: xs,
|
|
358
|
+
isPowerOfTwo: gs,
|
|
359
|
+
ceilPowerOfTwo: ys,
|
|
360
|
+
floorPowerOfTwo: _s,
|
|
361
361
|
normalizeAngle: pt,
|
|
362
|
-
isBetween:
|
|
363
|
-
isBetweenAngle:
|
|
364
|
-
intPartLength:
|
|
365
|
-
relativeEps:
|
|
362
|
+
isBetween: ps,
|
|
363
|
+
isBetweenAngle: fs,
|
|
364
|
+
intPartLength: Qt,
|
|
365
|
+
relativeEps: As
|
|
366
366
|
}, tt = class tt {
|
|
367
367
|
constructor(t, s) {
|
|
368
368
|
this.x = 0, this.y = 0;
|
|
@@ -381,7 +381,7 @@ const M = {
|
|
|
381
381
|
this.x = t, this.y = s;
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
throw
|
|
384
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
get width() {
|
|
@@ -610,8 +610,8 @@ const st = class st {
|
|
|
610
610
|
return this.multiplyMatrices(t, this);
|
|
611
611
|
}
|
|
612
612
|
multiplyMatrices(t, s) {
|
|
613
|
-
const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[3], a = e[6], h = e[1], c = e[4], l = e[7],
|
|
614
|
-
return i[0] = r * g + o * z + a * P, i[3] = r * y + o * f + a * I, i[6] = r * _ + o * b + a * A, i[1] = h * g + c * z + l * P, i[4] = h * y + c * f + l * I, i[7] = h * _ + c * b + l * A, i[2] =
|
|
613
|
+
const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[3], a = e[6], h = e[1], c = e[4], l = e[7], d = e[2], u = e[5], x = e[8], g = n[0], y = n[3], _ = n[6], z = n[1], f = n[4], b = n[7], P = n[2], I = n[5], A = n[8];
|
|
614
|
+
return i[0] = r * g + o * z + a * P, i[3] = r * y + o * f + a * I, i[6] = r * _ + o * b + a * A, i[1] = h * g + c * z + l * P, i[4] = h * y + c * f + l * I, i[7] = h * _ + c * b + l * A, i[2] = d * g + u * z + x * P, i[5] = d * y + u * f + x * I, i[8] = d * _ + u * b + x * A, this;
|
|
615
615
|
}
|
|
616
616
|
multiplyScalar(t) {
|
|
617
617
|
const s = this.elements;
|
|
@@ -622,10 +622,10 @@ const st = class st {
|
|
|
622
622
|
return s * r * c - s * o * h - e * i * c + e * o * a + n * i * h - n * r * a;
|
|
623
623
|
}
|
|
624
624
|
invert() {
|
|
625
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = c * r - o * h,
|
|
625
|
+
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = c * r - o * h, d = o * a - c * i, u = h * i - r * a, x = s * l + e * d + n * u;
|
|
626
626
|
if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
627
627
|
const g = 1 / x;
|
|
628
|
-
return t[0] = l * g, t[1] = (n * h - c * e) * g, t[2] = (o * e - n * r) * g, t[3] =
|
|
628
|
+
return t[0] = l * g, t[1] = (n * h - c * e) * g, t[2] = (o * e - n * r) * g, t[3] = d * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - o * s) * g, t[6] = u * g, t[7] = (e * a - h * s) * g, t[8] = (r * s - e * i) * g, this;
|
|
629
629
|
}
|
|
630
630
|
transpose() {
|
|
631
631
|
let t;
|
|
@@ -654,13 +654,13 @@ const st = class st {
|
|
|
654
654
|
), this;
|
|
655
655
|
}
|
|
656
656
|
scale(t, s) {
|
|
657
|
-
return this.premultiply(
|
|
657
|
+
return this.premultiply(Et.makeScale(t, s)), this;
|
|
658
658
|
}
|
|
659
659
|
rotate(t) {
|
|
660
|
-
return this.premultiply(
|
|
660
|
+
return this.premultiply(Et.makeRotation(-t)), this;
|
|
661
661
|
}
|
|
662
662
|
translate(t, s) {
|
|
663
|
-
return this.premultiply(
|
|
663
|
+
return this.premultiply(Et.makeTranslation(t, s)), this;
|
|
664
664
|
}
|
|
665
665
|
makeTranslation(t, s) {
|
|
666
666
|
return t instanceof B ? this.set(1, 0, t.x, 0, 1, t.y, 0, 0, 1) : this.set(1, 0, t, 0, 1, s, 0, 0, 1), this;
|
|
@@ -693,17 +693,21 @@ const st = class st {
|
|
|
693
693
|
};
|
|
694
694
|
st.IDENTITY = Object.freeze(new st());
|
|
695
695
|
let it = st;
|
|
696
|
-
const
|
|
696
|
+
const Et = new it(), W = 1e-6, E = 2 * Math.PI, Rs = {
|
|
697
697
|
x: 0,
|
|
698
698
|
y: 0
|
|
699
|
-
},
|
|
699
|
+
}, Kt = {
|
|
700
700
|
x: 0,
|
|
701
701
|
y: 0,
|
|
702
702
|
z: 0
|
|
703
703
|
};
|
|
704
|
-
class
|
|
704
|
+
class bt {
|
|
705
705
|
constructor() {
|
|
706
|
-
this.equalPointTol =
|
|
706
|
+
this.equalPointTol = W, this.equalVectorTol = W;
|
|
707
|
+
}
|
|
708
|
+
clone() {
|
|
709
|
+
const t = new bt();
|
|
710
|
+
return t.equalPointTol = this.equalPointTol, t.equalVectorTol = this.equalVectorTol, t;
|
|
707
711
|
}
|
|
708
712
|
equalPoint2d(t, s) {
|
|
709
713
|
return new B(t).sub(s).length() < this.equalPointTol;
|
|
@@ -711,50 +715,50 @@ class Qt {
|
|
|
711
715
|
equalPoint3d(t, s) {
|
|
712
716
|
return new p(t).sub(s).length() < this.equalPointTol;
|
|
713
717
|
}
|
|
714
|
-
static equalToZero(t, s =
|
|
718
|
+
static equalToZero(t, s = W) {
|
|
715
719
|
return t < s && t > -s;
|
|
716
720
|
}
|
|
717
|
-
static equal(t, s, e =
|
|
721
|
+
static equal(t, s, e = W) {
|
|
718
722
|
return Math.abs(t - s) < e;
|
|
719
723
|
}
|
|
720
|
-
static great(t, s, e =
|
|
724
|
+
static great(t, s, e = W) {
|
|
721
725
|
return t - s > e;
|
|
722
726
|
}
|
|
723
|
-
static less(t, s, e =
|
|
727
|
+
static less(t, s, e = W) {
|
|
724
728
|
return t - s < e;
|
|
725
729
|
}
|
|
726
730
|
}
|
|
727
|
-
const
|
|
728
|
-
function
|
|
729
|
-
const e =
|
|
731
|
+
const $t = new bt();
|
|
732
|
+
function Wt(m, t, s = !1) {
|
|
733
|
+
const e = m.x, n = m.y;
|
|
730
734
|
let i = !1;
|
|
731
735
|
const r = t.length;
|
|
732
736
|
for (let o = 0, a = r - 1; o < r; a = o++) {
|
|
733
|
-
const h = t[o].x, c = t[o].y, l = t[a].x,
|
|
734
|
-
let u = c > n !=
|
|
735
|
-
s && (u = c >= n !=
|
|
737
|
+
const h = t[o].x, c = t[o].y, l = t[a].x, d = t[a].y;
|
|
738
|
+
let u = c > n != d > n;
|
|
739
|
+
s && (u = c >= n != d >= n), u && e < (l - h) * (n - c) / (d - c) + h && (i = !i);
|
|
736
740
|
}
|
|
737
741
|
return i;
|
|
738
742
|
}
|
|
739
|
-
function
|
|
740
|
-
if (
|
|
743
|
+
function zs(m, t) {
|
|
744
|
+
if (m.length === 0 || t.length === 0)
|
|
741
745
|
return !1;
|
|
742
|
-
const s = new
|
|
746
|
+
const s = new X().setFromPoints(m), e = new X().setFromPoints(t);
|
|
743
747
|
if (!s.intersectsBox(e))
|
|
744
748
|
return !1;
|
|
745
|
-
for (let n = 0; n <
|
|
746
|
-
if (
|
|
749
|
+
for (let n = 0; n < m.length; ) {
|
|
750
|
+
if (Wt(m[n], t, !0))
|
|
747
751
|
return !0;
|
|
748
|
-
n <
|
|
752
|
+
n < m.length - 1 && $t.equalPoint2d(m[n + 1], m[n]) && ++n, ++n;
|
|
749
753
|
}
|
|
750
754
|
return !1;
|
|
751
755
|
}
|
|
752
|
-
const
|
|
753
|
-
isPointInPolygon:
|
|
754
|
-
isPolygonIntersect:
|
|
756
|
+
const ws = {
|
|
757
|
+
isPointInPolygon: Wt,
|
|
758
|
+
isPolygonIntersect: zs
|
|
755
759
|
};
|
|
756
|
-
function
|
|
757
|
-
const s = [], e = t - 1, n =
|
|
760
|
+
function Ns(m, t) {
|
|
761
|
+
const s = [], e = t - 1, n = m;
|
|
758
762
|
for (let i = 0; i <= n; i++)
|
|
759
763
|
s.push(0);
|
|
760
764
|
for (let i = 1; i <= e - n; i++)
|
|
@@ -763,8 +767,8 @@ function ks(d, t) {
|
|
|
763
767
|
s.push(e - n + 1);
|
|
764
768
|
return s;
|
|
765
769
|
}
|
|
766
|
-
function
|
|
767
|
-
const s = t.length - 1, e =
|
|
770
|
+
function Ts(m, t) {
|
|
771
|
+
const s = t.length - 1, e = m, n = [0];
|
|
768
772
|
let i = 0;
|
|
769
773
|
for (let o = 1; o <= s; o++) {
|
|
770
774
|
const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c);
|
|
@@ -781,8 +785,8 @@ function Rs(d, t) {
|
|
|
781
785
|
r.push(s - e + 1);
|
|
782
786
|
return r;
|
|
783
787
|
}
|
|
784
|
-
function
|
|
785
|
-
const s =
|
|
788
|
+
function Ms(m, t = "Uniform") {
|
|
789
|
+
const s = m.length;
|
|
786
790
|
if (s === 0)
|
|
787
791
|
return [];
|
|
788
792
|
if (s === 1)
|
|
@@ -793,13 +797,13 @@ function As(d, t = "Uniform") {
|
|
|
793
797
|
const n = [0];
|
|
794
798
|
let i = 0;
|
|
795
799
|
for (let r = 1; r <= e; r++) {
|
|
796
|
-
const o =
|
|
800
|
+
const o = m[r][0] - m[r - 1][0], a = m[r][1] - m[r - 1][1], h = m[r][2] - m[r - 1][2], c = Math.sqrt(o * o + a * a + h * h), l = t === "SqrtChord" ? Math.sqrt(c) : c;
|
|
797
801
|
i += l, n.push(i);
|
|
798
802
|
}
|
|
799
803
|
return i < 1e-12 ? new Array(s).fill(0).map((r, o) => o / e) : n.map((r) => r / i);
|
|
800
804
|
}
|
|
801
|
-
function
|
|
802
|
-
const s = t.length - 1, e =
|
|
805
|
+
function Ps(m, t) {
|
|
806
|
+
const s = t.length - 1, e = m, n = s + e + 1, i = new Array(n + 1).fill(0), r = t[t.length - 1];
|
|
803
807
|
for (let o = n - e; o <= n; o++)
|
|
804
808
|
i[o] = r;
|
|
805
809
|
for (let o = 1; o <= s - e; o++) {
|
|
@@ -810,12 +814,12 @@ function zs(d, t) {
|
|
|
810
814
|
}
|
|
811
815
|
return i;
|
|
812
816
|
}
|
|
813
|
-
function
|
|
814
|
-
const s = t.length - 1, e =
|
|
817
|
+
function js(m, t) {
|
|
818
|
+
const s = t.length - 1, e = m, n = [0];
|
|
815
819
|
let i = 0;
|
|
816
820
|
for (let o = 1; o <= s; o++) {
|
|
817
|
-
const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c),
|
|
818
|
-
i +=
|
|
821
|
+
const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c), d = Math.sqrt(l);
|
|
822
|
+
i += d, n.push(i);
|
|
819
823
|
}
|
|
820
824
|
const r = [];
|
|
821
825
|
for (let o = 0; o <= e; o++)
|
|
@@ -828,8 +832,8 @@ function Ns(d, t) {
|
|
|
828
832
|
r.push(s - e + 1);
|
|
829
833
|
return r;
|
|
830
834
|
}
|
|
831
|
-
function
|
|
832
|
-
const s =
|
|
835
|
+
function It(m, t) {
|
|
836
|
+
const s = m.length, e = m.map((r) => r.slice()), n = t.slice();
|
|
833
837
|
for (let r = 0; r < s; r++) {
|
|
834
838
|
let o = r, a = Math.abs(e[r][r]);
|
|
835
839
|
for (let h = r + 1; h < s; h++) {
|
|
@@ -862,122 +866,122 @@ function Et(d, t) {
|
|
|
862
866
|
}
|
|
863
867
|
return i;
|
|
864
868
|
}
|
|
865
|
-
function
|
|
866
|
-
if (
|
|
869
|
+
function Ht(m, t, s = "Uniform", e, n) {
|
|
870
|
+
if (m.length === 0)
|
|
867
871
|
return { controlPoints: [], knots: [], weights: [] };
|
|
868
|
-
const i =
|
|
872
|
+
const i = m.map((C) => [C[0], C[1], C[2] ?? 0]), r = !!e, o = !!n, a = (r ? 1 : 0) + (o ? 1 : 0), h = i.length - 1, c = h + a;
|
|
869
873
|
if (c < t)
|
|
870
874
|
throw new Error("Not enough points to interpolate a curve of this degree.");
|
|
871
|
-
const l =
|
|
872
|
-
r &&
|
|
873
|
-
const u =
|
|
875
|
+
const l = Ms(i, s), d = l.slice();
|
|
876
|
+
r && d.unshift(l[0]), o && d.push(l[l.length - 1]);
|
|
877
|
+
const u = Ps(t, d), x = c + 1, g = new Array(x), y = new Array(x), _ = new Array(x), z = new Array(x);
|
|
874
878
|
let f = 0;
|
|
875
879
|
g[f] = new Array(x).fill(0), g[f][0] = 1, y[f] = i[0][0], _[f] = i[0][1], z[f] = i[0][2], f++;
|
|
876
|
-
for (let
|
|
877
|
-
const
|
|
880
|
+
for (let C = 1; C <= h - 1; C++) {
|
|
881
|
+
const j = l[C];
|
|
878
882
|
g[f] = new Array(x).fill(0);
|
|
879
|
-
for (let
|
|
880
|
-
g[f][
|
|
881
|
-
y[f] = i[
|
|
883
|
+
for (let q = 0; q <= c; q++)
|
|
884
|
+
g[f][q] = wt(q, t, j, u);
|
|
885
|
+
y[f] = i[C][0], _[f] = i[C][1], z[f] = i[C][2], f++;
|
|
882
886
|
}
|
|
883
887
|
if (g[f] = new Array(x).fill(0), g[f][c] = 1, y[f] = i[h][0], _[f] = i[h][1], z[f] = i[h][2], f++, r) {
|
|
884
|
-
const
|
|
885
|
-
g[f] = new Array(x).fill(0), g[f][0] = -
|
|
888
|
+
const C = u[t + 1] - u[0], j = C !== 0 ? t / C : 0;
|
|
889
|
+
g[f] = new Array(x).fill(0), g[f][0] = -j, g[f][1] = j, y[f] = (e == null ? void 0 : e[0]) ?? 0, _[f] = (e == null ? void 0 : e[1]) ?? 0, z[f] = (e == null ? void 0 : e[2]) ?? 0, f++;
|
|
886
890
|
}
|
|
887
891
|
if (o) {
|
|
888
|
-
const
|
|
889
|
-
g[f] = new Array(x).fill(0), g[f][c - 1] = -
|
|
892
|
+
const C = u[c + t + 1] - u[c], j = C !== 0 ? t / C : 0;
|
|
893
|
+
g[f] = new Array(x).fill(0), g[f][c - 1] = -j, g[f][c] = j, y[f] = (n == null ? void 0 : n[0]) ?? 0, _[f] = (n == null ? void 0 : n[1]) ?? 0, z[f] = (n == null ? void 0 : n[2]) ?? 0, f++;
|
|
890
894
|
}
|
|
891
|
-
const b =
|
|
892
|
-
for (let
|
|
893
|
-
A[
|
|
895
|
+
const b = It(g, y), P = It(g, _), I = It(g, z), A = new Array(x);
|
|
896
|
+
for (let C = 0; C < x; C++)
|
|
897
|
+
A[C] = [b[C], P[C], I[C]];
|
|
894
898
|
const k = new Array(x).fill(1);
|
|
895
899
|
return { controlPoints: A, knots: u, weights: k };
|
|
896
900
|
}
|
|
897
|
-
function wt(
|
|
901
|
+
function wt(m, t, s, e) {
|
|
898
902
|
if (t === 0)
|
|
899
|
-
return s >= e[
|
|
900
|
-
const n = e[
|
|
901
|
-
return r * wt(
|
|
903
|
+
return s >= e[m] && s < e[m + 1] ? 1 : 0;
|
|
904
|
+
const n = e[m + t] - e[m], i = e[m + t + 1] - e[m + 1], r = n > 1e-10 ? (s - e[m]) / n : 0, o = i > 1e-10 ? (e[m + t + 1] - s) / i : 0;
|
|
905
|
+
return r * wt(m, t - 1, s, e) + o * wt(m + 1, t - 1, s, e);
|
|
902
906
|
}
|
|
903
|
-
function ft(
|
|
907
|
+
function ft(m, t, s, e, n) {
|
|
904
908
|
const i = e.length - 1, r = t;
|
|
905
|
-
if (
|
|
909
|
+
if (m = Math.max(s[r], Math.min(s[i + 1], m)), Math.abs(m - s[i + 1]) < 1e-8)
|
|
906
910
|
return [...e[i]];
|
|
907
|
-
if (Math.abs(
|
|
911
|
+
if (Math.abs(m - s[r]) < 1e-8)
|
|
908
912
|
return [...e[0]];
|
|
909
913
|
const o = [0, 0, 0];
|
|
910
914
|
let a = 0;
|
|
911
915
|
for (let h = 0; h <= i; h++) {
|
|
912
|
-
const c = wt(h, r,
|
|
916
|
+
const c = wt(h, r, m, s), l = n[h] * c;
|
|
913
917
|
o[0] += e[h][0] * l, o[1] += e[h][1] * l, o[2] += e[h][2] * l, a += l;
|
|
914
918
|
}
|
|
915
919
|
if (Math.abs(a) < 1e-10) {
|
|
916
920
|
const h = s[s.length - r - 1];
|
|
917
|
-
if (Math.abs(
|
|
921
|
+
if (Math.abs(m - h) < 1e-8)
|
|
918
922
|
return [...e[i]];
|
|
919
|
-
if (Math.abs(
|
|
923
|
+
if (Math.abs(m - s[r]) < 1e-8)
|
|
920
924
|
return [...e[0]];
|
|
921
925
|
}
|
|
922
926
|
return Math.abs(a) >= 1e-10 && (o[0] /= a, o[1] /= a, o[2] /= a), o;
|
|
923
927
|
}
|
|
924
|
-
function
|
|
925
|
-
const n =
|
|
928
|
+
function bs(m, t, s, e) {
|
|
929
|
+
const n = m, i = t[n], r = t[t.length - n - 1];
|
|
926
930
|
let o = 0;
|
|
927
931
|
const a = 1e3, h = (r - i) / a;
|
|
928
932
|
let c = ft(
|
|
929
933
|
i,
|
|
930
|
-
|
|
934
|
+
m,
|
|
931
935
|
t,
|
|
932
936
|
s,
|
|
933
937
|
e
|
|
934
938
|
);
|
|
935
939
|
for (let g = 1; g <= a; g++) {
|
|
936
|
-
const y = i + g * h, _ = ft(y,
|
|
940
|
+
const y = i + g * h, _ = ft(y, m, t, s, e), z = _[0] - c[0], f = _[1] - c[1], b = _[2] - c[2];
|
|
937
941
|
o += Math.sqrt(z * z + f * f + b * b), c = _;
|
|
938
942
|
}
|
|
939
943
|
const l = ft(
|
|
940
944
|
r,
|
|
941
|
-
|
|
945
|
+
m,
|
|
942
946
|
t,
|
|
943
947
|
s,
|
|
944
948
|
e
|
|
945
|
-
),
|
|
946
|
-
return o += Math.sqrt(
|
|
949
|
+
), d = l[0] - c[0], u = l[1] - c[1], x = l[2] - c[2];
|
|
950
|
+
return o += Math.sqrt(d * d + u * u + x * x), o;
|
|
947
951
|
}
|
|
948
|
-
function
|
|
949
|
-
return
|
|
950
|
-
|
|
952
|
+
function Vs(m, t = 3, s = "Uniform", e, n) {
|
|
953
|
+
return m.length === 0 ? [] : Ht(
|
|
954
|
+
m,
|
|
951
955
|
t,
|
|
952
956
|
s,
|
|
953
957
|
e,
|
|
954
958
|
n
|
|
955
959
|
).controlPoints;
|
|
956
960
|
}
|
|
957
|
-
class
|
|
961
|
+
class St {
|
|
958
962
|
constructor(t = 0, s = 0, e = 0, n = 1) {
|
|
959
963
|
this._x = t, this._y = s, this._z = e, this._w = n;
|
|
960
964
|
}
|
|
961
965
|
static slerpFlat(t, s, e, n, i, r, o) {
|
|
962
966
|
let a = e[n + 0], h = e[n + 1], c = e[n + 2], l = e[n + 3];
|
|
963
|
-
const
|
|
967
|
+
const d = i[r + 0], u = i[r + 1], x = i[r + 2], g = i[r + 3];
|
|
964
968
|
if (o === 0) {
|
|
965
969
|
t[s + 0] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
966
970
|
return;
|
|
967
971
|
}
|
|
968
972
|
if (o === 1) {
|
|
969
|
-
t[s + 0] =
|
|
973
|
+
t[s + 0] = d, t[s + 1] = u, t[s + 2] = x, t[s + 3] = g;
|
|
970
974
|
return;
|
|
971
975
|
}
|
|
972
|
-
if (l !== g || a !==
|
|
976
|
+
if (l !== g || a !== d || h !== u || c !== x) {
|
|
973
977
|
let y = 1 - o;
|
|
974
|
-
const _ = a *
|
|
978
|
+
const _ = a * d + h * u + c * x + l * g, z = _ >= 0 ? 1 : -1, f = 1 - _ * _;
|
|
975
979
|
if (f > Number.EPSILON) {
|
|
976
980
|
const P = Math.sqrt(f), I = Math.atan2(P, _ * z);
|
|
977
981
|
y = Math.sin(y * I) / P, o = Math.sin(o * I) / P;
|
|
978
982
|
}
|
|
979
983
|
const b = o * z;
|
|
980
|
-
if (a = a * y +
|
|
984
|
+
if (a = a * y + d * b, h = h * y + u * b, c = c * y + x * b, l = l * y + g * b, y === 1 - o) {
|
|
981
985
|
const P = 1 / Math.sqrt(a * a + h * h + c * c + l * l);
|
|
982
986
|
a *= P, h *= P, c *= P, l *= P;
|
|
983
987
|
}
|
|
@@ -985,8 +989,8 @@ class bt {
|
|
|
985
989
|
t[s] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
986
990
|
}
|
|
987
991
|
static multiplyQuaternionsFlat(t, s, e, n, i, r) {
|
|
988
|
-
const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r],
|
|
989
|
-
return t[s] = o * x + c * l + a * u - h *
|
|
992
|
+
const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r], d = i[r + 1], u = i[r + 2], x = i[r + 3];
|
|
993
|
+
return t[s] = o * x + c * l + a * u - h * d, t[s + 1] = a * x + c * d + h * l - o * u, t[s + 2] = h * x + c * u + o * d - a * l, t[s + 3] = c * x - o * l - a * d - h * u, t;
|
|
990
994
|
}
|
|
991
995
|
get x() {
|
|
992
996
|
return this._x;
|
|
@@ -1016,31 +1020,31 @@ class bt {
|
|
|
1016
1020
|
return this._x = t, this._y = s, this._z = e, this._w = n, this._onChangeCallback(), this;
|
|
1017
1021
|
}
|
|
1018
1022
|
clone() {
|
|
1019
|
-
return new
|
|
1023
|
+
return new St(this._x, this._y, this._z, this._w);
|
|
1020
1024
|
}
|
|
1021
1025
|
copy(t) {
|
|
1022
1026
|
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
1023
1027
|
}
|
|
1024
1028
|
setFromEuler(t, s = !0) {
|
|
1025
|
-
const e = t.x, n = t.y, i = t.z, r = t.order, o = Math.cos, a = Math.sin, h = o(e / 2), c = o(n / 2), l = o(i / 2),
|
|
1029
|
+
const e = t.x, n = t.y, i = t.z, r = t.order, o = Math.cos, a = Math.sin, h = o(e / 2), c = o(n / 2), l = o(i / 2), d = a(e / 2), u = a(n / 2), x = a(i / 2);
|
|
1026
1030
|
switch (r) {
|
|
1027
1031
|
case "XYZ":
|
|
1028
|
-
this._x =
|
|
1032
|
+
this._x = d * c * l + h * u * x, this._y = h * u * l - d * c * x, this._z = h * c * x + d * u * l, this._w = h * c * l - d * u * x;
|
|
1029
1033
|
break;
|
|
1030
1034
|
case "YXZ":
|
|
1031
|
-
this._x =
|
|
1035
|
+
this._x = d * c * l + h * u * x, this._y = h * u * l - d * c * x, this._z = h * c * x - d * u * l, this._w = h * c * l + d * u * x;
|
|
1032
1036
|
break;
|
|
1033
1037
|
case "ZXY":
|
|
1034
|
-
this._x =
|
|
1038
|
+
this._x = d * c * l - h * u * x, this._y = h * u * l + d * c * x, this._z = h * c * x + d * u * l, this._w = h * c * l - d * u * x;
|
|
1035
1039
|
break;
|
|
1036
1040
|
case "ZYX":
|
|
1037
|
-
this._x =
|
|
1041
|
+
this._x = d * c * l - h * u * x, this._y = h * u * l + d * c * x, this._z = h * c * x - d * u * l, this._w = h * c * l + d * u * x;
|
|
1038
1042
|
break;
|
|
1039
1043
|
case "YZX":
|
|
1040
|
-
this._x =
|
|
1044
|
+
this._x = d * c * l + h * u * x, this._y = h * u * l + d * c * x, this._z = h * c * x - d * u * l, this._w = h * c * l - d * u * x;
|
|
1041
1045
|
break;
|
|
1042
1046
|
case "XZY":
|
|
1043
|
-
this._x =
|
|
1047
|
+
this._x = d * c * l - h * u * x, this._y = h * u * l - d * c * x, this._z = h * c * x + d * u * l, this._w = h * c * l + d * u * x;
|
|
1044
1048
|
break;
|
|
1045
1049
|
}
|
|
1046
1050
|
return s === !0 && this._onChangeCallback(), this;
|
|
@@ -1050,9 +1054,9 @@ class bt {
|
|
|
1050
1054
|
return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(e), this._onChangeCallback(), this;
|
|
1051
1055
|
}
|
|
1052
1056
|
setFromRotationMatrix(t) {
|
|
1053
|
-
const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1], o = s[5], a = s[9], h = s[2], c = s[6], l = s[10],
|
|
1054
|
-
if (
|
|
1055
|
-
const u = 0.5 / Math.sqrt(
|
|
1057
|
+
const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1], o = s[5], a = s[9], h = s[2], c = s[6], l = s[10], d = e + o + l;
|
|
1058
|
+
if (d > 0) {
|
|
1059
|
+
const u = 0.5 / Math.sqrt(d + 1);
|
|
1056
1060
|
this._w = 0.25 / u, this._x = (c - a) * u, this._y = (i - h) * u, this._z = (r - n) * u;
|
|
1057
1061
|
} else if (e > o && e > l) {
|
|
1058
1062
|
const u = 2 * Math.sqrt(1 + e - o - l);
|
|
@@ -1125,8 +1129,8 @@ class bt {
|
|
|
1125
1129
|
const u = 1 - s;
|
|
1126
1130
|
return this._w = u * r + s * this._w, this._x = u * e + s * this._x, this._y = u * n + s * this._y, this._z = u * i + s * this._z, this.normalize(), this;
|
|
1127
1131
|
}
|
|
1128
|
-
const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h,
|
|
1129
|
-
return this._w = r * l + this._w *
|
|
1132
|
+
const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h, d = Math.sin(s * c) / h;
|
|
1133
|
+
return this._w = r * 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;
|
|
1130
1134
|
}
|
|
1131
1135
|
slerpQuaternions(t, s, e) {
|
|
1132
1136
|
return this.copy(t).slerp(s, e);
|
|
@@ -1179,7 +1183,7 @@ const R = class R {
|
|
|
1179
1183
|
this.x = t, this.y = s, this.z = e;
|
|
1180
1184
|
return;
|
|
1181
1185
|
}
|
|
1182
|
-
throw
|
|
1186
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
1183
1187
|
}
|
|
1184
1188
|
}
|
|
1185
1189
|
set(t, s, e) {
|
|
@@ -1262,10 +1266,10 @@ const R = class R {
|
|
|
1262
1266
|
return this.x = t.x * s.x, this.y = t.y * s.y, this.z = t.z * s.z, this;
|
|
1263
1267
|
}
|
|
1264
1268
|
applyEuler(t) {
|
|
1265
|
-
return this.applyQuaternion(
|
|
1269
|
+
return this.applyQuaternion(jt.setFromEuler(t));
|
|
1266
1270
|
}
|
|
1267
1271
|
applyAxisAngle(t, s) {
|
|
1268
|
-
return this.applyQuaternion(
|
|
1272
|
+
return this.applyQuaternion(jt.setFromAxisAngle(t, s));
|
|
1269
1273
|
}
|
|
1270
1274
|
applyMatrix3(t) {
|
|
1271
1275
|
const s = this.x, e = this.y, n = this.z, i = t.elements;
|
|
@@ -1367,10 +1371,10 @@ const R = class R {
|
|
|
1367
1371
|
return this.copy(t).multiplyScalar(e);
|
|
1368
1372
|
}
|
|
1369
1373
|
projectOnPlane(t) {
|
|
1370
|
-
return
|
|
1374
|
+
return Bt.copy(this).projectOnVector(t), this.sub(Bt);
|
|
1371
1375
|
}
|
|
1372
1376
|
reflect(t) {
|
|
1373
|
-
return this.sub(
|
|
1377
|
+
return this.sub(Bt.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
1374
1378
|
}
|
|
1375
1379
|
angleTo(t) {
|
|
1376
1380
|
const s = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
@@ -1424,9 +1428,9 @@ const R = class R {
|
|
|
1424
1428
|
};
|
|
1425
1429
|
R.ORIGIN = Object.freeze(new R(0, 0, 0)), R.X_AXIS = Object.freeze(new R(1, 0, 0)), R.NEGATIVE_X_AXIS = Object.freeze(new R(-1, 0, 0)), R.Y_AXIS = Object.freeze(new R(0, 1, 0)), R.NEGATIVE_Y_AXIS = Object.freeze(new R(0, -1, 0)), R.Z_AXIS = Object.freeze(new R(0, 0, 1)), R.NEGATIVE_Z_AXIS = Object.freeze(new R(0, 0, -1));
|
|
1426
1430
|
let p = R;
|
|
1427
|
-
const
|
|
1428
|
-
constructor(t, s, e, n, i, r, o, a, h, c, l,
|
|
1429
|
-
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && c != null && l != null &&
|
|
1431
|
+
const Bt = new p(), jt = new St(), et = class et {
|
|
1432
|
+
constructor(t, s, e, n, i, r, o, a, h, c, l, d, u, x, g, y) {
|
|
1433
|
+
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && c != null && l != null && d != null && u != null && x != null && g != null && y != null && this.set(
|
|
1430
1434
|
t,
|
|
1431
1435
|
s,
|
|
1432
1436
|
e,
|
|
@@ -1438,16 +1442,16 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1438
1442
|
h,
|
|
1439
1443
|
c,
|
|
1440
1444
|
l,
|
|
1441
|
-
|
|
1445
|
+
d,
|
|
1442
1446
|
u,
|
|
1443
1447
|
x,
|
|
1444
1448
|
g,
|
|
1445
1449
|
y
|
|
1446
1450
|
);
|
|
1447
1451
|
}
|
|
1448
|
-
set(t, s, e, n, i, r, o, a, h, c, l,
|
|
1452
|
+
set(t, s, e, n, i, r, o, a, h, c, l, d, u, x, g, y) {
|
|
1449
1453
|
const _ = this.elements;
|
|
1450
|
-
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] = o, _[13] = a, _[2] = h, _[6] = c, _[10] = l, _[14] =
|
|
1454
|
+
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] = o, _[13] = a, _[2] = h, _[6] = c, _[10] = l, _[14] = d, _[3] = u, _[7] = x, _[11] = g, _[15] = y, this;
|
|
1451
1455
|
}
|
|
1452
1456
|
identity() {
|
|
1453
1457
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
@@ -1485,7 +1489,7 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1485
1489
|
), this;
|
|
1486
1490
|
}
|
|
1487
1491
|
setFromExtrusionDirection(t) {
|
|
1488
|
-
if (
|
|
1492
|
+
if ($t.equalPoint3d(t, p.Z_AXIS))
|
|
1489
1493
|
this.identity();
|
|
1490
1494
|
else {
|
|
1491
1495
|
const s = new p(1, 0, 0);
|
|
@@ -1536,15 +1540,15 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1536
1540
|
), this;
|
|
1537
1541
|
}
|
|
1538
1542
|
extractRotation(t) {
|
|
1539
|
-
const s = this.elements, e = t.elements, n = 1 /
|
|
1543
|
+
const s = this.elements, e = t.elements, n = 1 / H.setFromMatrixColumn(t, 0).length(), i = 1 / H.setFromMatrixColumn(t, 1).length(), r = 1 / H.setFromMatrixColumn(t, 2).length();
|
|
1540
1544
|
return s[0] = e[0] * n, s[1] = e[1] * n, s[2] = e[2] * n, s[3] = 0, s[4] = e[4] * i, s[5] = e[5] * i, s[6] = e[6] * i, s[7] = 0, s[8] = e[8] * r, s[9] = e[9] * r, s[10] = e[10] * r, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, this;
|
|
1541
1545
|
}
|
|
1542
1546
|
makeRotationFromQuaternion(t) {
|
|
1543
|
-
return this.compose(
|
|
1547
|
+
return this.compose(Ss, t, Cs);
|
|
1544
1548
|
}
|
|
1545
1549
|
lookAt(t, s, e) {
|
|
1546
1550
|
const n = this.elements;
|
|
1547
|
-
return V.subVectors(t, s), V.lengthSq() === 0 && (V.z = 1), V.normalize(),
|
|
1551
|
+
return V.subVectors(t, s), V.lengthSq() === 0 && (V.z = 1), V.normalize(), Y.crossVectors(e, V), Y.lengthSq() === 0 && (Math.abs(e.z) === 1 ? V.x += 1e-4 : V.z += 1e-4, V.normalize(), Y.crossVectors(e, V)), Y.normalize(), yt.crossVectors(V, Y), n[0] = Y.x, n[4] = yt.x, n[8] = V.x, n[1] = Y.y, n[5] = yt.y, n[9] = V.y, n[2] = Y.z, n[6] = yt.z, n[10] = V.z, this;
|
|
1548
1552
|
}
|
|
1549
1553
|
multiply(t) {
|
|
1550
1554
|
return this.multiplyMatrices(this, t);
|
|
@@ -1553,16 +1557,16 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1553
1557
|
return this.multiplyMatrices(t, this);
|
|
1554
1558
|
}
|
|
1555
1559
|
multiplyMatrices(t, s) {
|
|
1556
|
-
const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[4], a = e[8], h = e[12], c = e[1], l = e[5],
|
|
1557
|
-
return i[0] = r * I + o *
|
|
1560
|
+
const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[4], a = e[8], h = e[12], c = e[1], l = e[5], d = e[9], u = e[13], x = e[2], g = e[6], y = e[10], _ = e[14], z = e[3], f = e[7], b = e[11], P = e[15], I = n[0], A = n[4], k = n[8], C = n[12], j = n[1], q = n[5], $ = n[9], ht = n[13], at = n[2], ct = n[6], lt = n[10], ut = n[14], dt = n[3], mt = n[7], xt = n[11], gt = n[15];
|
|
1561
|
+
return i[0] = r * I + o * j + a * at + h * dt, i[4] = r * A + o * q + a * ct + h * mt, i[8] = r * k + o * $ + a * lt + h * xt, i[12] = r * C + o * ht + a * ut + h * gt, i[1] = c * I + l * j + d * at + u * dt, i[5] = c * A + l * q + d * ct + u * mt, i[9] = c * k + l * $ + d * lt + u * xt, i[13] = c * C + l * ht + d * ut + u * gt, i[2] = x * I + g * j + y * at + _ * dt, i[6] = x * A + g * q + y * ct + _ * mt, i[10] = x * k + g * $ + y * lt + _ * xt, i[14] = x * C + g * ht + y * ut + _ * gt, i[3] = z * I + f * j + b * at + P * dt, i[7] = z * A + f * q + b * ct + P * mt, i[11] = z * k + f * $ + b * lt + P * xt, i[15] = z * C + f * ht + b * ut + P * gt, this;
|
|
1558
1562
|
}
|
|
1559
1563
|
multiplyScalar(t) {
|
|
1560
1564
|
const s = this.elements;
|
|
1561
1565
|
return s[0] *= t, s[4] *= t, s[8] *= t, s[12] *= t, s[1] *= t, s[5] *= t, s[9] *= t, s[13] *= t, s[2] *= t, s[6] *= t, s[10] *= t, s[14] *= t, s[3] *= t, s[7] *= t, s[11] *= t, s[15] *= t, this;
|
|
1562
1566
|
}
|
|
1563
1567
|
determinant() {
|
|
1564
|
-
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1], o = t[5], a = t[9], h = t[13], c = t[2], l = t[6],
|
|
1565
|
-
return x * (+i * a * l - n * h * l - i * o *
|
|
1568
|
+
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1], o = t[5], a = t[9], h = t[13], c = t[2], l = t[6], d = t[10], u = t[14], x = t[3], g = t[7], y = t[11], _ = t[15];
|
|
1569
|
+
return x * (+i * a * l - n * h * l - i * o * d + e * h * d + n * o * u - e * a * u) + g * (+s * a * u - s * h * d + i * r * d - n * r * u + n * h * c - i * a * c) + y * (+s * h * l - s * o * u - i * r * l + e * r * u + i * o * c - e * h * c) + _ * (-n * o * c - s * a * l + s * o * d + n * r * l - e * r * d + e * a * c);
|
|
1566
1570
|
}
|
|
1567
1571
|
transpose() {
|
|
1568
1572
|
const t = this.elements;
|
|
@@ -1574,11 +1578,11 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1574
1578
|
return t instanceof p ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
|
|
1575
1579
|
}
|
|
1576
1580
|
invert() {
|
|
1577
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = t[9],
|
|
1581
|
+
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = t[9], d = t[10], u = t[11], x = t[12], g = t[13], y = t[14], _ = t[15], z = l * y * h - g * d * h + g * a * u - o * y * u - l * a * _ + o * d * _, f = x * d * h - c * y * h - x * a * u + r * y * u + c * a * _ - r * d * _, b = c * g * h - x * l * h + x * o * u - r * g * u - c * o * _ + r * l * _, P = x * l * a - c * g * a - x * o * d + r * g * d + c * o * y - r * l * y, I = s * z + e * f + n * b + i * P;
|
|
1578
1582
|
if (I === 0)
|
|
1579
1583
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1580
1584
|
const A = 1 / I;
|
|
1581
|
-
return t[0] = z * A, t[1] = (g *
|
|
1585
|
+
return t[0] = z * A, t[1] = (g * d * i - l * y * i - g * n * u + e * y * u + l * n * _ - e * d * _) * A, t[2] = (o * y * i - g * a * i + g * n * h - e * y * h - o * n * _ + e * a * _) * A, t[3] = (l * a * i - o * d * i - l * n * h + e * d * h + o * n * u - e * a * u) * A, t[4] = f * A, t[5] = (c * y * i - x * d * i + x * n * u - s * y * u - c * n * _ + s * d * _) * A, t[6] = (x * a * i - r * y * i - x * n * h + s * y * h + r * n * _ - s * a * _) * A, t[7] = (r * d * i - c * a * i + c * n * h - s * d * h - r * n * u + s * a * u) * A, t[8] = b * A, t[9] = (x * l * i - c * g * i - x * e * u + s * g * u + c * e * _ - s * l * _) * A, t[10] = (r * g * i - x * o * i + x * e * h - s * g * h - r * e * _ + s * o * _) * A, t[11] = (c * o * i - r * l * i - c * e * h + s * l * h + r * e * u - s * o * u) * A, t[12] = P * A, t[13] = (c * g * n - x * l * n + x * e * d - s * g * d - c * e * y + s * l * y) * A, t[14] = (x * o * n - r * g * n - x * e * a + s * g * a + r * e * y - s * o * y) * A, t[15] = (r * l * n - c * o * n + c * e * a - s * l * a - r * e * d + s * o * d) * A, this;
|
|
1582
1586
|
}
|
|
1583
1587
|
scale(t) {
|
|
1584
1588
|
const s = this.elements, e = t.x, n = t.y, i = t.z;
|
|
@@ -1631,16 +1635,16 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1631
1635
|
return this.set(1, e, i, 0, t, 1, r, 0, s, n, 1, 0, 0, 0, 0, 1), this;
|
|
1632
1636
|
}
|
|
1633
1637
|
compose(t, s, e) {
|
|
1634
|
-
const n = this.elements, i = s.x, r = s.y, o = s.z, a = s.w, h = i + i, c = r + r, l = o + o,
|
|
1635
|
-
return n[0] = (1 - (g + _)) * P, n[1] = (u + b) * P, n[2] = (x - f) * P, n[3] = 0, n[4] = (u - b) * I, n[5] = (1 - (
|
|
1638
|
+
const n = this.elements, i = s.x, r = s.y, o = s.z, a = s.w, h = i + i, c = r + r, l = o + o, d = i * h, u = i * c, x = i * l, g = r * c, y = r * l, _ = o * l, z = a * h, f = a * c, b = a * l, P = e.x, I = e.y, A = e.z;
|
|
1639
|
+
return n[0] = (1 - (g + _)) * P, n[1] = (u + b) * P, n[2] = (x - f) * P, n[3] = 0, n[4] = (u - b) * I, n[5] = (1 - (d + _)) * I, n[6] = (y + z) * I, n[7] = 0, n[8] = (x + f) * A, n[9] = (y - z) * A, n[10] = (1 - (d + g)) * A, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
|
|
1636
1640
|
}
|
|
1637
1641
|
decompose(t, s, e) {
|
|
1638
1642
|
const n = this.elements;
|
|
1639
|
-
let i =
|
|
1640
|
-
const r =
|
|
1641
|
-
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14],
|
|
1643
|
+
let i = H.set(n[0], n[1], n[2]).length();
|
|
1644
|
+
const r = H.set(n[4], n[5], n[6]).length(), o = H.set(n[8], n[9], n[10]).length();
|
|
1645
|
+
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], L.copy(this);
|
|
1642
1646
|
const h = 1 / i, c = 1 / r, l = 1 / o;
|
|
1643
|
-
return
|
|
1647
|
+
return L.elements[0] *= h, L.elements[1] *= h, L.elements[2] *= h, 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 = r, e.z = o, this;
|
|
1644
1648
|
}
|
|
1645
1649
|
equals(t) {
|
|
1646
1650
|
const s = this.elements, e = t.elements;
|
|
@@ -1659,9 +1663,9 @@ const It = new p(), Nt = new bt(), et = class et {
|
|
|
1659
1663
|
}
|
|
1660
1664
|
};
|
|
1661
1665
|
et.IDENTITY = Object.freeze(new et());
|
|
1662
|
-
let
|
|
1663
|
-
const
|
|
1664
|
-
class
|
|
1666
|
+
let G = et;
|
|
1667
|
+
const H = new p(), L = new G(), Ss = new p(0, 0, 0), Cs = new p(1, 1, 1), Y = new p(), yt = new p(), V = new p();
|
|
1668
|
+
class D {
|
|
1665
1669
|
constructor(t = void 0, s = void 0) {
|
|
1666
1670
|
this.min = t == null ? new p(1 / 0, 1 / 0, 1 / 0) : new p(t.x, t.y, t.z), this.max = s == null ? new p(-1 / 0, -1 / 0, -1 / 0) : new p(s.x, s.y, s.z);
|
|
1667
1671
|
}
|
|
@@ -1671,7 +1675,7 @@ class Y {
|
|
|
1671
1675
|
setFromArray(t) {
|
|
1672
1676
|
this.makeEmpty();
|
|
1673
1677
|
for (let s = 0, e = t.length; s < e; s += 3)
|
|
1674
|
-
this.expandByPoint(
|
|
1678
|
+
this.expandByPoint(kt.fromArray(t, s));
|
|
1675
1679
|
return this;
|
|
1676
1680
|
}
|
|
1677
1681
|
setFromPoints(t) {
|
|
@@ -1681,11 +1685,11 @@ class Y {
|
|
|
1681
1685
|
return this;
|
|
1682
1686
|
}
|
|
1683
1687
|
setFromCenterAndSize(t, s) {
|
|
1684
|
-
const e =
|
|
1688
|
+
const e = kt.copy(s).multiplyScalar(0.5);
|
|
1685
1689
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
|
1686
1690
|
}
|
|
1687
1691
|
clone() {
|
|
1688
|
-
return new
|
|
1692
|
+
return new D().copy(this);
|
|
1689
1693
|
}
|
|
1690
1694
|
copy(t) {
|
|
1691
1695
|
return this.min.copy(t.min), this.max.copy(t.max), this;
|
|
@@ -1741,7 +1745,7 @@ class Y {
|
|
|
1741
1745
|
return s.copy(t).clamp(this.min, this.max);
|
|
1742
1746
|
}
|
|
1743
1747
|
distanceToPoint(t) {
|
|
1744
|
-
return this.clampPoint(t,
|
|
1748
|
+
return this.clampPoint(t, kt).distanceTo(t);
|
|
1745
1749
|
}
|
|
1746
1750
|
intersect(t) {
|
|
1747
1751
|
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
|
|
@@ -1750,7 +1754,7 @@ class Y {
|
|
|
1750
1754
|
return this.min.min(t.min), this.max.max(t.max), this;
|
|
1751
1755
|
}
|
|
1752
1756
|
applyMatrix4(t) {
|
|
1753
|
-
return this.isEmpty() ? this : (
|
|
1757
|
+
return this.isEmpty() ? this : (v[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), v[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), v[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), v[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), v[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), v[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), v[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), v[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(v), this);
|
|
1754
1758
|
}
|
|
1755
1759
|
translate(t) {
|
|
1756
1760
|
return this.min.add(t), this.max.add(t), this;
|
|
@@ -1759,7 +1763,7 @@ class Y {
|
|
|
1759
1763
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1760
1764
|
}
|
|
1761
1765
|
}
|
|
1762
|
-
const
|
|
1766
|
+
const v = [
|
|
1763
1767
|
new p(),
|
|
1764
1768
|
new p(),
|
|
1765
1769
|
new p(),
|
|
@@ -1768,8 +1772,8 @@ const D = [
|
|
|
1768
1772
|
new p(),
|
|
1769
1773
|
new p(),
|
|
1770
1774
|
new p()
|
|
1771
|
-
],
|
|
1772
|
-
class
|
|
1775
|
+
], kt = new p(), Vt = new B();
|
|
1776
|
+
class X {
|
|
1773
1777
|
constructor(t = void 0, s = void 0) {
|
|
1774
1778
|
this.min = t == null ? new B(1 / 0, 1 / 0) : new B(t.x, t.y), this.max = s == null ? new B(-1 / 0, -1 / 0) : new B(s.x, s.y);
|
|
1775
1779
|
}
|
|
@@ -1783,11 +1787,11 @@ class F {
|
|
|
1783
1787
|
return this;
|
|
1784
1788
|
}
|
|
1785
1789
|
setFromCenterAndSize(t, s) {
|
|
1786
|
-
const e =
|
|
1790
|
+
const e = Vt.copy(s).multiplyScalar(0.5);
|
|
1787
1791
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
|
1788
1792
|
}
|
|
1789
1793
|
clone() {
|
|
1790
|
-
return new
|
|
1794
|
+
return new X().copy(this);
|
|
1791
1795
|
}
|
|
1792
1796
|
copy(t) {
|
|
1793
1797
|
return this.min.copy(t.min), this.max.copy(t.max), this;
|
|
@@ -1838,7 +1842,7 @@ class F {
|
|
|
1838
1842
|
return s.copy(t).clamp(this.min, this.max);
|
|
1839
1843
|
}
|
|
1840
1844
|
distanceToPoint(t) {
|
|
1841
|
-
return this.clampPoint(t,
|
|
1845
|
+
return this.clampPoint(t, Vt).distanceTo(t);
|
|
1842
1846
|
}
|
|
1843
1847
|
intersect(t) {
|
|
1844
1848
|
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
|
|
@@ -1853,8 +1857,8 @@ class F {
|
|
|
1853
1857
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1854
1858
|
}
|
|
1855
1859
|
}
|
|
1856
|
-
const
|
|
1857
|
-
class
|
|
1860
|
+
const qt = new p(), Es = new p(), Is = new it();
|
|
1861
|
+
class Ct {
|
|
1858
1862
|
constructor(t = new p(1, 0, 0), s = 0) {
|
|
1859
1863
|
this.normal = t, this.constant = s;
|
|
1860
1864
|
}
|
|
@@ -1868,7 +1872,7 @@ class St {
|
|
|
1868
1872
|
return this.normal.copy(t), this.constant = -s.dot(this.normal), this;
|
|
1869
1873
|
}
|
|
1870
1874
|
setFromCoplanarPoints(t, s, e) {
|
|
1871
|
-
const n =
|
|
1875
|
+
const n = qt.subVectors(e, s).cross(Es.subVectors(t, s)).normalize();
|
|
1872
1876
|
return this.setFromNormalAndCoplanarPoint(n, t), this;
|
|
1873
1877
|
}
|
|
1874
1878
|
copy(t) {
|
|
@@ -1894,7 +1898,7 @@ class St {
|
|
|
1894
1898
|
return t.copy(this.normal).multiplyScalar(-this.constant);
|
|
1895
1899
|
}
|
|
1896
1900
|
applyMatrix4(t, s) {
|
|
1897
|
-
const e = s ||
|
|
1901
|
+
const e = s || Is.getNormalMatrix(t), n = this.coplanarPoint(qt).applyMatrix4(t), i = this.normal.applyMatrix3(e).normalize();
|
|
1898
1902
|
return this.constant = -n.dot(i), this;
|
|
1899
1903
|
}
|
|
1900
1904
|
translate(t) {
|
|
@@ -1904,10 +1908,13 @@ class St {
|
|
|
1904
1908
|
return t.normal.equals(this.normal) && t.constant === this.constant;
|
|
1905
1909
|
}
|
|
1906
1910
|
clone() {
|
|
1907
|
-
return new
|
|
1911
|
+
return new Ct().copy(this);
|
|
1908
1912
|
}
|
|
1909
1913
|
}
|
|
1910
|
-
class
|
|
1914
|
+
class S extends B {
|
|
1915
|
+
clone() {
|
|
1916
|
+
return new S(this.x, this.y);
|
|
1917
|
+
}
|
|
1911
1918
|
static pointArrayToNumberArray(t) {
|
|
1912
1919
|
const s = new Array(t.length * 2);
|
|
1913
1920
|
return t.forEach((e, n) => {
|
|
@@ -1916,6 +1923,9 @@ class C extends B {
|
|
|
1916
1923
|
}
|
|
1917
1924
|
}
|
|
1918
1925
|
class w extends p {
|
|
1926
|
+
clone() {
|
|
1927
|
+
return new w(this.x, this.y, this.z);
|
|
1928
|
+
}
|
|
1919
1929
|
static pointArrayToNumberArray(t, s = !0) {
|
|
1920
1930
|
const e = s ? 3 : 2, n = new Array(t.length * e);
|
|
1921
1931
|
return t.forEach((i, r) => {
|
|
@@ -1923,7 +1933,7 @@ class w extends p {
|
|
|
1923
1933
|
}), n;
|
|
1924
1934
|
}
|
|
1925
1935
|
}
|
|
1926
|
-
const
|
|
1936
|
+
const Ut = new G(), Lt = new St(), nt = class nt {
|
|
1927
1937
|
constructor(t = 0, s = 0, e = 0, n = nt.DEFAULT_ORDER) {
|
|
1928
1938
|
this._x = t, this._y = s, this._z = e, this._order = n;
|
|
1929
1939
|
}
|
|
@@ -1961,37 +1971,37 @@ const Vt = new H(), Ut = new bt(), nt = class nt {
|
|
|
1961
1971
|
return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this._onChangeCallback(), this;
|
|
1962
1972
|
}
|
|
1963
1973
|
setFromRotationMatrix(t, s = this._order, e = !0) {
|
|
1964
|
-
const n = t.elements, i = n[0], r = n[4], o = n[8], a = n[1], h = n[5], c = n[9], l = n[2],
|
|
1974
|
+
const n = t.elements, i = n[0], r = n[4], o = n[8], a = n[1], h = n[5], c = n[9], l = n[2], d = n[6], u = n[10];
|
|
1965
1975
|
switch (s) {
|
|
1966
1976
|
case "XYZ":
|
|
1967
|
-
this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c, u), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(
|
|
1977
|
+
this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c, u), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(d, h), this._z = 0);
|
|
1968
1978
|
break;
|
|
1969
1979
|
case "YXZ":
|
|
1970
1980
|
this._x = Math.asin(-Z(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(o, u), this._z = Math.atan2(a, h)) : (this._y = Math.atan2(-l, i), this._z = 0);
|
|
1971
1981
|
break;
|
|
1972
1982
|
case "ZXY":
|
|
1973
|
-
this._x = Math.asin(Z(
|
|
1983
|
+
this._x = Math.asin(Z(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-l, u), this._z = Math.atan2(-r, h)) : (this._y = 0, this._z = Math.atan2(a, i));
|
|
1974
1984
|
break;
|
|
1975
1985
|
case "ZYX":
|
|
1976
|
-
this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(
|
|
1986
|
+
this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(d, u), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-r, h));
|
|
1977
1987
|
break;
|
|
1978
1988
|
case "YZX":
|
|
1979
1989
|
this._z = Math.asin(Z(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, h), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(o, u));
|
|
1980
1990
|
break;
|
|
1981
1991
|
case "XZY":
|
|
1982
|
-
this._z = Math.asin(-Z(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(
|
|
1992
|
+
this._z = Math.asin(-Z(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(d, h), this._y = Math.atan2(o, i)) : (this._x = Math.atan2(-c, u), this._y = 0);
|
|
1983
1993
|
break;
|
|
1984
1994
|
}
|
|
1985
1995
|
return this._order = s, e === !0 && this._onChangeCallback(), this;
|
|
1986
1996
|
}
|
|
1987
1997
|
setFromQuaternion(t, s, e = !0) {
|
|
1988
|
-
return
|
|
1998
|
+
return Ut.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Ut, s, e);
|
|
1989
1999
|
}
|
|
1990
2000
|
setFromVector3(t, s = this._order) {
|
|
1991
2001
|
return this.set(t.x, t.y, t.z, s);
|
|
1992
2002
|
}
|
|
1993
2003
|
reorder(t) {
|
|
1994
|
-
return
|
|
2004
|
+
return Lt.setFromEuler(this), this.setFromQuaternion(Lt, t);
|
|
1995
2005
|
}
|
|
1996
2006
|
equals(t) {
|
|
1997
2007
|
return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order;
|
|
@@ -2012,8 +2022,8 @@ const Vt = new H(), Ut = new bt(), nt = class nt {
|
|
|
2012
2022
|
}
|
|
2013
2023
|
};
|
|
2014
2024
|
nt.DEFAULT_ORDER = "XYZ";
|
|
2015
|
-
let
|
|
2016
|
-
class
|
|
2025
|
+
let Ft = nt;
|
|
2026
|
+
class Jt {
|
|
2017
2027
|
constructor() {
|
|
2018
2028
|
this._boundingBoxNeedsUpdate = !1;
|
|
2019
2029
|
}
|
|
@@ -2021,7 +2031,7 @@ class Wt {
|
|
|
2021
2031
|
return this._boundingBoxNeedsUpdate;
|
|
2022
2032
|
}
|
|
2023
2033
|
}
|
|
2024
|
-
class
|
|
2034
|
+
class Gt extends Jt {
|
|
2025
2035
|
translate(t) {
|
|
2026
2036
|
return this.transform(new it().makeTranslation(t.x, t.y));
|
|
2027
2037
|
}
|
|
@@ -2029,7 +2039,7 @@ class Ht extends Wt {
|
|
|
2029
2039
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2030
2040
|
}
|
|
2031
2041
|
}
|
|
2032
|
-
class
|
|
2042
|
+
class ts extends Gt {
|
|
2033
2043
|
constructor() {
|
|
2034
2044
|
super(), this._loops = [];
|
|
2035
2045
|
}
|
|
@@ -2045,13 +2055,19 @@ class js extends Ht {
|
|
|
2045
2055
|
}
|
|
2046
2056
|
calculateBoundingBox() {
|
|
2047
2057
|
const t = this.outter;
|
|
2048
|
-
return t ? t.box : new
|
|
2058
|
+
return t ? t.box : new X();
|
|
2049
2059
|
}
|
|
2050
2060
|
transform(t) {
|
|
2051
2061
|
return this._loops.forEach((s) => {
|
|
2052
2062
|
s.transform(t);
|
|
2053
2063
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
2054
2064
|
}
|
|
2065
|
+
clone() {
|
|
2066
|
+
const t = new ts();
|
|
2067
|
+
return this._loops.forEach((s) => {
|
|
2068
|
+
t.add(s.clone());
|
|
2069
|
+
}), t;
|
|
2070
|
+
}
|
|
2055
2071
|
getPoints(t) {
|
|
2056
2072
|
const s = [];
|
|
2057
2073
|
for (let e = 0; e < this.loops.length; ++e) {
|
|
@@ -2071,10 +2087,10 @@ class js extends Ht {
|
|
|
2071
2087
|
const r = { index: -1, children: [] };
|
|
2072
2088
|
for (let a = 0; a < i; a++) {
|
|
2073
2089
|
const h = e[a], c = t[h], l = s[h];
|
|
2074
|
-
let
|
|
2075
|
-
for (;
|
|
2076
|
-
const u = e[
|
|
2077
|
-
if (s[u].containsBox(l) &&
|
|
2090
|
+
let d = a + 1;
|
|
2091
|
+
for (; d < i; d++) {
|
|
2092
|
+
const u = e[d], x = t[u];
|
|
2093
|
+
if (s[u].containsBox(l) && ws.isPointInPolygon(
|
|
2078
2094
|
c[M.randInt(0, c.length - 1)],
|
|
2079
2095
|
x
|
|
2080
2096
|
)) {
|
|
@@ -2082,7 +2098,7 @@ class js extends Ht {
|
|
|
2082
2098
|
break;
|
|
2083
2099
|
}
|
|
2084
2100
|
}
|
|
2085
|
-
|
|
2101
|
+
d === i && r.children.push(n.get(h));
|
|
2086
2102
|
}
|
|
2087
2103
|
return r;
|
|
2088
2104
|
}
|
|
@@ -2108,7 +2124,7 @@ class js extends Ht {
|
|
|
2108
2124
|
calculateBoundaryBoxes(t) {
|
|
2109
2125
|
const s = [];
|
|
2110
2126
|
return t.forEach((e) => {
|
|
2111
|
-
s.push(new
|
|
2127
|
+
s.push(new X().setFromPoints(e));
|
|
2112
2128
|
}), s;
|
|
2113
2129
|
}
|
|
2114
2130
|
sortBoundaryBoxesByAreas(t) {
|
|
@@ -2126,7 +2142,7 @@ class js extends Ht {
|
|
|
2126
2142
|
}), e;
|
|
2127
2143
|
}
|
|
2128
2144
|
}
|
|
2129
|
-
class rt extends
|
|
2145
|
+
class rt extends Gt {
|
|
2130
2146
|
constructor() {
|
|
2131
2147
|
super(), this.arcLengthDivisions = 100;
|
|
2132
2148
|
}
|
|
@@ -2188,13 +2204,13 @@ class rt extends Ht {
|
|
|
2188
2204
|
}
|
|
2189
2205
|
if (n = a, e[n] === r)
|
|
2190
2206
|
return n / (i - 1);
|
|
2191
|
-
const c = e[n],
|
|
2207
|
+
const c = e[n], d = e[n + 1] - c, u = (r - c) / d;
|
|
2192
2208
|
return (n + u) / (i - 1);
|
|
2193
2209
|
}
|
|
2194
2210
|
getTangent(t) {
|
|
2195
2211
|
let e = t - 1e-4, n = t + 1e-4;
|
|
2196
2212
|
e < 0 && (e = 0), n > 1 && (n = 1);
|
|
2197
|
-
const i = this.getPoint(e), r = this.getPoint(n), o = new
|
|
2213
|
+
const i = this.getPoint(e), r = this.getPoint(n), o = new S();
|
|
2198
2214
|
return o.copy(r).sub(i).normalize(), o;
|
|
2199
2215
|
}
|
|
2200
2216
|
getTangentAt(t) {
|
|
@@ -2202,7 +2218,7 @@ class rt extends Ht {
|
|
|
2202
2218
|
return this.getTangent(s);
|
|
2203
2219
|
}
|
|
2204
2220
|
}
|
|
2205
|
-
class
|
|
2221
|
+
class K extends rt {
|
|
2206
2222
|
constructor(t, s, e, n, i) {
|
|
2207
2223
|
super();
|
|
2208
2224
|
const r = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
|
|
@@ -2218,18 +2234,18 @@ class Q extends rt {
|
|
|
2218
2234
|
);
|
|
2219
2235
|
else if (r == 5) {
|
|
2220
2236
|
const o = t;
|
|
2221
|
-
this.center = new
|
|
2237
|
+
this.center = new S(o.x, o.y), this.radius = s, this._clockwise = i, this._startAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(e)) : M.normalizeAngle(e), this._endAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(n)) : M.normalizeAngle(n);
|
|
2222
2238
|
} else
|
|
2223
|
-
throw
|
|
2239
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
2224
2240
|
}
|
|
2225
2241
|
createByThreePoints(t, s, e) {
|
|
2226
2242
|
const n = (A, k) => ({
|
|
2227
2243
|
x: (A.x + k.x) / 2,
|
|
2228
2244
|
y: (A.y + k.y) / 2
|
|
2229
|
-
}), i = (A, k) => (k.y - A.y) / (k.x - A.x), r = (A) => -1 / A, o = n(t, s), a = n(s, e), h = i(t, s), c = i(s, e), l = r(h),
|
|
2230
|
-
const
|
|
2231
|
-
return { x:
|
|
2232
|
-
}, x = o.y - l * o.x, g = a.y -
|
|
2245
|
+
}), i = (A, k) => (k.y - A.y) / (k.x - A.x), r = (A) => -1 / A, o = n(t, s), a = n(s, e), h = i(t, s), c = i(s, e), l = r(h), d = r(c), u = (A, k, C, j) => {
|
|
2246
|
+
const q = (j - k) / (A - C), $ = A * q + k;
|
|
2247
|
+
return { x: q, y: $ };
|
|
2248
|
+
}, x = o.y - l * o.x, g = a.y - d * a.x, y = u(l, x, d, g), _ = Math.sqrt(
|
|
2233
2249
|
Math.pow(t.x - y.x, 2) + Math.pow(t.y - y.y, 2)
|
|
2234
2250
|
), z = (A, k) => Math.atan2(A.y - k.y, A.x - k.x), f = z(t, y), b = z(s, y), P = z(e, y), I = P > f && P < b || f > P && f < b || b > P && b < f;
|
|
2235
2251
|
this.center = y, this.radius = _, this._clockwise = !I, this._startAngle = f, this._endAngle = P;
|
|
@@ -2237,9 +2253,9 @@ class Q extends rt {
|
|
|
2237
2253
|
createByStartEndPointsAndBulge(t, s, e) {
|
|
2238
2254
|
let n, i, r;
|
|
2239
2255
|
e < 0 ? (n = Math.atan(-e) * 4, i = new B(t), r = new B(s)) : (n = Math.atan(e) * 4, i = new B(s), r = new B(t));
|
|
2240
|
-
const o = new B().subVectors(r, i), a = o.length(), h = new B().addVectors(i, o.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = o.normalize(),
|
|
2241
|
-
l.x * Math.cos(
|
|
2242
|
-
l.y * Math.cos(
|
|
2256
|
+
const o = new B().subVectors(r, i), a = o.length(), h = new B().addVectors(i, o.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = o.normalize(), d = e < 0 ? -Math.PI / 2 : Math.PI / 2, u = new B(
|
|
2257
|
+
l.x * Math.cos(d) - l.y * Math.sin(d),
|
|
2258
|
+
l.y * Math.cos(d) + l.x * Math.sin(d)
|
|
2243
2259
|
);
|
|
2244
2260
|
let x;
|
|
2245
2261
|
n < Math.PI ? e < 0 ? x = h.add(u.multiplyScalar(c)) : x = h.add(u.multiplyScalar(-c)) : e < 0 ? x = h.add(u.multiplyScalar(-c)) : x = h.add(u.multiplyScalar(c)), e < 0 ? (this._startAngle = Math.atan2(i.y - x.y, i.x - x.x), this._endAngle = Math.atan2(r.y - x.y, r.x - x.x)) : (this._startAngle = Math.atan2(r.y - x.y, r.x - x.x), this._endAngle = Math.atan2(i.y - x.y, i.x - x.x)), this._clockwise = e < 0, this.center = x, this.radius = r.sub(x).length();
|
|
@@ -2248,7 +2264,7 @@ class Q extends rt {
|
|
|
2248
2264
|
return this._center;
|
|
2249
2265
|
}
|
|
2250
2266
|
set center(t) {
|
|
2251
|
-
this._center = new
|
|
2267
|
+
this._center = new S(t.x, t.y), this._boundingBoxNeedsUpdate = !0;
|
|
2252
2268
|
}
|
|
2253
2269
|
get radius() {
|
|
2254
2270
|
return this._radius;
|
|
@@ -2311,9 +2327,9 @@ class Q extends rt {
|
|
|
2311
2327
|
) && t.push(this.getPointAtAngle(i));
|
|
2312
2328
|
}
|
|
2313
2329
|
const e = t.map((i) => i.x), n = t.map((i) => i.y);
|
|
2314
|
-
return new
|
|
2315
|
-
new
|
|
2316
|
-
new
|
|
2330
|
+
return new X(
|
|
2331
|
+
new S(Math.min(...e), Math.min(...n)),
|
|
2332
|
+
new S(Math.max(...e), Math.max(...n))
|
|
2317
2333
|
);
|
|
2318
2334
|
}
|
|
2319
2335
|
get length() {
|
|
@@ -2326,7 +2342,7 @@ class Q extends rt {
|
|
|
2326
2342
|
n.y - e.y,
|
|
2327
2343
|
n.x - e.x
|
|
2328
2344
|
), this._endAngle = this._startAngle, this._clockwise = s.determinant() < 0 ? !this._clockwise : this._clockwise, this._boundingBoxNeedsUpdate = !0, this;
|
|
2329
|
-
const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new
|
|
2345
|
+
const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new K(
|
|
2330
2346
|
n,
|
|
2331
2347
|
i,
|
|
2332
2348
|
r
|
|
@@ -2347,7 +2363,7 @@ class Q extends rt {
|
|
|
2347
2363
|
), this._boundingBoxNeedsUpdate = !0, this;
|
|
2348
2364
|
}
|
|
2349
2365
|
clone() {
|
|
2350
|
-
return new
|
|
2366
|
+
return new K(
|
|
2351
2367
|
this.center.clone(),
|
|
2352
2368
|
this.radius,
|
|
2353
2369
|
this._startAngle,
|
|
@@ -2357,7 +2373,7 @@ class Q extends rt {
|
|
|
2357
2373
|
}
|
|
2358
2374
|
getPointAtAngle(t) {
|
|
2359
2375
|
const s = this._getInternalAngle(t), e = this.center.x + this.radius * Math.cos(s), n = this.center.y + this.radius * Math.sin(s);
|
|
2360
|
-
return new
|
|
2376
|
+
return new S(e, n);
|
|
2361
2377
|
}
|
|
2362
2378
|
getPoints(t = 100) {
|
|
2363
2379
|
const s = [];
|
|
@@ -2365,25 +2381,25 @@ class Q extends rt {
|
|
|
2365
2381
|
if (this.closed && (e = E, n = 0), this.clockwise)
|
|
2366
2382
|
for (let i = 0; i <= t; i++) {
|
|
2367
2383
|
const r = n - e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
|
|
2368
|
-
s.push(new
|
|
2384
|
+
s.push(new S(a.x, a.y));
|
|
2369
2385
|
}
|
|
2370
2386
|
else
|
|
2371
2387
|
for (let i = 0; i <= t; i++) {
|
|
2372
2388
|
const r = n + e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
|
|
2373
|
-
s.push(new
|
|
2389
|
+
s.push(new S(a.x, a.y));
|
|
2374
2390
|
}
|
|
2375
2391
|
return s;
|
|
2376
2392
|
}
|
|
2377
2393
|
}
|
|
2378
|
-
class
|
|
2394
|
+
class Bs extends Jt {
|
|
2379
2395
|
translate(t) {
|
|
2380
|
-
return this.transform(new
|
|
2396
|
+
return this.transform(new G().makeTranslation(t.x, t.y, t.z));
|
|
2381
2397
|
}
|
|
2382
2398
|
get box() {
|
|
2383
2399
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2384
2400
|
}
|
|
2385
2401
|
}
|
|
2386
|
-
class ot extends
|
|
2402
|
+
class ot extends Bs {
|
|
2387
2403
|
}
|
|
2388
2404
|
class Mt extends ot {
|
|
2389
2405
|
constructor(t, s) {
|
|
@@ -2446,9 +2462,9 @@ class Mt extends ot {
|
|
|
2446
2462
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
2447
2463
|
}
|
|
2448
2464
|
closestPointToPointParameter(t, s) {
|
|
2449
|
-
|
|
2465
|
+
Xt.subVectors(t, this._start), _t.subVectors(this.endPoint, this.startPoint);
|
|
2450
2466
|
const e = _t.dot(_t);
|
|
2451
|
-
let i = _t.dot(
|
|
2467
|
+
let i = _t.dot(Xt) / e;
|
|
2452
2468
|
return s && (i = M.clamp(i, 0, 1)), i;
|
|
2453
2469
|
}
|
|
2454
2470
|
closestPointToPoint(t, s, e) {
|
|
@@ -2482,7 +2498,7 @@ class Mt extends ot {
|
|
|
2482
2498
|
Math.max(this._start.y, this._end.y),
|
|
2483
2499
|
Math.max(this._start.z, this._end.z)
|
|
2484
2500
|
);
|
|
2485
|
-
return new
|
|
2501
|
+
return new D(t, s);
|
|
2486
2502
|
}
|
|
2487
2503
|
transform(t) {
|
|
2488
2504
|
return this._start.applyMatrix4(t), this._end.applyMatrix4(t), this._boundingBoxNeedsUpdate = !0, this;
|
|
@@ -2497,13 +2513,13 @@ class Mt extends ot {
|
|
|
2497
2513
|
return new Mt(this._start.clone(), this._end.clone());
|
|
2498
2514
|
}
|
|
2499
2515
|
}
|
|
2500
|
-
const O = new p(),
|
|
2516
|
+
const O = new p(), Xt = new p(), _t = new p();
|
|
2501
2517
|
class At extends ot {
|
|
2502
2518
|
static computeCenterPoint(t, s, e) {
|
|
2503
2519
|
const n = new p().addVectors(t, s).multiplyScalar(0.5), i = new p().addVectors(t, e).multiplyScalar(0.5), r = new p().subVectors(s, t), o = new p().subVectors(e, t), a = new p().crossVectors(r, o).normalize();
|
|
2504
2520
|
if (a.lengthSq() === 0)
|
|
2505
2521
|
return null;
|
|
2506
|
-
const h = new p().crossVectors(r, a).normalize(), c = new p().crossVectors(o, a).normalize(), l = h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),
|
|
2522
|
+
const h = new p().crossVectors(r, a).normalize(), c = new p().crossVectors(o, a).normalize(), l = h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), u = new Mt(n, n.clone().add(l)), x = new Mt(i, i.clone().add(d)), g = new p();
|
|
2507
2523
|
return u.closestPointToPoint(x.startPoint, !0, g) ? g : null;
|
|
2508
2524
|
}
|
|
2509
2525
|
static createByThreePoints(t, s, e) {
|
|
@@ -2536,7 +2552,7 @@ class At extends ot {
|
|
|
2536
2552
|
return this._radius;
|
|
2537
2553
|
}
|
|
2538
2554
|
set radius(t) {
|
|
2539
|
-
if (t < 0) throw
|
|
2555
|
+
if (t < 0) throw U.ILLEGAL_PARAMETERS;
|
|
2540
2556
|
this._radius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2541
2557
|
}
|
|
2542
2558
|
get startAngle() {
|
|
@@ -2595,16 +2611,16 @@ class At extends ot {
|
|
|
2595
2611
|
if (a.lengthSq() === 0)
|
|
2596
2612
|
return this.startPoint.clone();
|
|
2597
2613
|
a.normalize().multiplyScalar(this.radius);
|
|
2598
|
-
const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle,
|
|
2614
|
+
const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle, d = this.deltaAngle;
|
|
2599
2615
|
let u = M.normalizeAngle(c - l);
|
|
2600
|
-
u < 0 && (u = 0), u >
|
|
2616
|
+
u < 0 && (u = 0), u > d && (u = d);
|
|
2601
2617
|
const x = this.getPointAtAngle(l + u), g = x.distanceTo(s), y = this.startPoint.distanceTo(s), _ = this.endPoint.distanceTo(s);
|
|
2602
2618
|
return y < g && y <= _ ? this.startPoint.clone() : _ < g && _ < y ? this.endPoint.clone() : x;
|
|
2603
2619
|
}
|
|
2604
2620
|
tangentPoints(t) {
|
|
2605
|
-
const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i), h = e.clone().sub(i.clone().multiplyScalar(a)), c = n.clone(),
|
|
2606
|
-
if (
|
|
2607
|
-
const u = Math.acos(r /
|
|
2621
|
+
const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i), h = e.clone().sub(i.clone().multiplyScalar(a)), c = n.clone(), d = h.clone().sub(c).length();
|
|
2622
|
+
if (d < r) return s;
|
|
2623
|
+
const u = Math.acos(r / d), x = this.getAngle(h.clone()), g = [x + u, x - u];
|
|
2608
2624
|
for (const y of g) {
|
|
2609
2625
|
const _ = M.normalizeAngle(y - this.startAngle);
|
|
2610
2626
|
_ >= 0 && _ <= this.deltaAngle && s.push(this.getPointAtAngle(this.startAngle + _));
|
|
@@ -2626,7 +2642,7 @@ class At extends ot {
|
|
|
2626
2642
|
const h = this.getPointAtAngle(a);
|
|
2627
2643
|
h.x < s && (s = h.x), h.y < e && (e = h.y), h.z < n && (n = h.z), h.x > i && (i = h.x), h.y > r && (r = h.y), h.z > o && (o = h.z);
|
|
2628
2644
|
}
|
|
2629
|
-
return new
|
|
2645
|
+
return new D(
|
|
2630
2646
|
{ x: s, y: e, z: n },
|
|
2631
2647
|
{ x: i, y: r, z: o }
|
|
2632
2648
|
);
|
|
@@ -2656,7 +2672,7 @@ class At extends ot {
|
|
|
2656
2672
|
const h = (c) => {
|
|
2657
2673
|
const l = new p(c).sub(s);
|
|
2658
2674
|
return Math.atan2(
|
|
2659
|
-
l.dot(
|
|
2675
|
+
l.dot(vt.crossVectors(a, r)),
|
|
2660
2676
|
l.dot(r)
|
|
2661
2677
|
);
|
|
2662
2678
|
};
|
|
@@ -2677,7 +2693,7 @@ class At extends ot {
|
|
|
2677
2693
|
}
|
|
2678
2694
|
getAngle(t) {
|
|
2679
2695
|
return t.sub(this.center), Math.atan2(
|
|
2680
|
-
t.dot(
|
|
2696
|
+
t.dot(vt.crossVectors(this.refVec, this.normal)),
|
|
2681
2697
|
t.dot(this.refVec)
|
|
2682
2698
|
);
|
|
2683
2699
|
}
|
|
@@ -2694,12 +2710,12 @@ class At extends ot {
|
|
|
2694
2710
|
);
|
|
2695
2711
|
}
|
|
2696
2712
|
get plane() {
|
|
2697
|
-
const t = new p(this.center).distanceTo(
|
|
2698
|
-
return new
|
|
2713
|
+
const t = new p(this.center).distanceTo(Kt);
|
|
2714
|
+
return new Ct(this.normal, t);
|
|
2699
2715
|
}
|
|
2700
2716
|
}
|
|
2701
|
-
const
|
|
2702
|
-
class
|
|
2717
|
+
const vt = new p();
|
|
2718
|
+
class J extends rt {
|
|
2703
2719
|
constructor(t, s, e, n = 0, i = E, r = !1, o = 0) {
|
|
2704
2720
|
super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) % E == 0 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = n, this.endAngle = i), this.clockwise = r, this.rotation = o;
|
|
2705
2721
|
}
|
|
@@ -2713,14 +2729,14 @@ class W extends rt {
|
|
|
2713
2729
|
return this._majorAxisRadius;
|
|
2714
2730
|
}
|
|
2715
2731
|
set majorAxisRadius(t) {
|
|
2716
|
-
if (t < 0) throw
|
|
2732
|
+
if (t < 0) throw U.ILLEGAL_PARAMETERS;
|
|
2717
2733
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2718
2734
|
}
|
|
2719
2735
|
get minorAxisRadius() {
|
|
2720
2736
|
return this._minorAxisRadius;
|
|
2721
2737
|
}
|
|
2722
2738
|
set minorAxisRadius(t) {
|
|
2723
|
-
if (t < 0) throw
|
|
2739
|
+
if (t < 0) throw U.ILLEGAL_PARAMETERS;
|
|
2724
2740
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2725
2741
|
}
|
|
2726
2742
|
get startAngle() {
|
|
@@ -2759,7 +2775,7 @@ class W extends rt {
|
|
|
2759
2775
|
const o = this.getPoint(r / 100);
|
|
2760
2776
|
s = Math.min(s, o.x), e = Math.min(e, o.y), n = Math.max(n, o.x), i = Math.max(i, o.y);
|
|
2761
2777
|
}
|
|
2762
|
-
return new
|
|
2778
|
+
return new X({ x: s, y: e }, { x: n, y: i });
|
|
2763
2779
|
}
|
|
2764
2780
|
get closed() {
|
|
2765
2781
|
return this.deltaAngle == 0;
|
|
@@ -2777,25 +2793,25 @@ class W extends rt {
|
|
|
2777
2793
|
const a = Math.cos(this.rotation), h = Math.sin(this.rotation), c = r - this.center.x, l = o - this.center.y;
|
|
2778
2794
|
r = c * a - l * h + this.center.x, o = c * h + l * a + this.center.y;
|
|
2779
2795
|
}
|
|
2780
|
-
return new
|
|
2796
|
+
return new S(r, o);
|
|
2781
2797
|
}
|
|
2782
2798
|
transform(t) {
|
|
2783
|
-
const s = t, e = new
|
|
2799
|
+
const s = t, e = new S(this.center).applyMatrix2d(
|
|
2784
2800
|
s
|
|
2785
2801
|
), n = new w(
|
|
2786
2802
|
e.x,
|
|
2787
2803
|
e.y,
|
|
2788
2804
|
this.center.z
|
|
2789
|
-
), i = this.getPointAtAngle(0).clone().applyMatrix2d(s), r = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix2d(s), o = new
|
|
2805
|
+
), i = this.getPointAtAngle(0).clone().applyMatrix2d(s), r = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix2d(s), o = new S(i).sub(
|
|
2790
2806
|
e
|
|
2791
|
-
), a = new
|
|
2807
|
+
), a = new S(r).sub(
|
|
2792
2808
|
e
|
|
2793
|
-
), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x),
|
|
2794
|
-
const z = new
|
|
2809
|
+
), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x), d = o.clone().normalize(), u = a.clone().normalize(), x = (_) => {
|
|
2810
|
+
const z = new S(_).sub(e), f = z.dot(d), b = z.dot(u);
|
|
2795
2811
|
return M.normalizeAngle(
|
|
2796
2812
|
Math.atan2(b / c, f / h)
|
|
2797
2813
|
);
|
|
2798
|
-
}, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new
|
|
2814
|
+
}, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new J(
|
|
2799
2815
|
n,
|
|
2800
2816
|
h,
|
|
2801
2817
|
c,
|
|
@@ -2803,7 +2819,7 @@ class W extends rt {
|
|
|
2803
2819
|
E,
|
|
2804
2820
|
g,
|
|
2805
2821
|
l
|
|
2806
|
-
) : new
|
|
2822
|
+
) : new J(
|
|
2807
2823
|
n,
|
|
2808
2824
|
h,
|
|
2809
2825
|
c,
|
|
@@ -2823,7 +2839,7 @@ class W extends rt {
|
|
|
2823
2839
|
return this.center = t.center, this.majorAxisRadius = t.majorAxisRadius, this.minorAxisRadius = t.minorAxisRadius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this.clockwise = t.clockwise, this.rotation = t.rotation, this;
|
|
2824
2840
|
}
|
|
2825
2841
|
clone() {
|
|
2826
|
-
return new
|
|
2842
|
+
return new J(
|
|
2827
2843
|
this.center,
|
|
2828
2844
|
this.majorAxisRadius,
|
|
2829
2845
|
this.minorAxisRadius,
|
|
@@ -2850,14 +2866,14 @@ class zt extends ot {
|
|
|
2850
2866
|
return this._majorAxisRadius;
|
|
2851
2867
|
}
|
|
2852
2868
|
set majorAxisRadius(t) {
|
|
2853
|
-
if (t < 0) throw
|
|
2869
|
+
if (t < 0) throw U.ILLEGAL_PARAMETERS;
|
|
2854
2870
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2855
2871
|
}
|
|
2856
2872
|
get minorAxisRadius() {
|
|
2857
2873
|
return this._minorAxisRadius;
|
|
2858
2874
|
}
|
|
2859
2875
|
set minorAxisRadius(t) {
|
|
2860
|
-
if (t < 0) throw
|
|
2876
|
+
if (t < 0) throw U.ILLEGAL_PARAMETERS;
|
|
2861
2877
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2862
2878
|
}
|
|
2863
2879
|
get startAngle() {
|
|
@@ -2910,7 +2926,7 @@ class zt extends ot {
|
|
|
2910
2926
|
return this.getPointAtAngle(e);
|
|
2911
2927
|
}
|
|
2912
2928
|
get isCircular() {
|
|
2913
|
-
return
|
|
2929
|
+
return bt.equal(this.majorAxisRadius, this.minorAxisRadius);
|
|
2914
2930
|
}
|
|
2915
2931
|
get length() {
|
|
2916
2932
|
if (this.isCircular)
|
|
@@ -2940,7 +2956,7 @@ class zt extends ot {
|
|
|
2940
2956
|
const h = this.getPointAtAngle(a);
|
|
2941
2957
|
h.x < s && (s = h.x), h.y < e && (e = h.y), h.z < n && (n = h.z), h.x > i && (i = h.x), h.y > r && (r = h.y), h.z > o && (o = h.z);
|
|
2942
2958
|
}
|
|
2943
|
-
return new
|
|
2959
|
+
return new D(
|
|
2944
2960
|
{ x: s, y: e, z: n },
|
|
2945
2961
|
{ x: i, y: r, z: o }
|
|
2946
2962
|
);
|
|
@@ -2950,7 +2966,7 @@ class zt extends ot {
|
|
|
2950
2966
|
const h = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(h);
|
|
2951
2967
|
s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x), r = Math.max(r, c.y), o = Math.max(o, c.z);
|
|
2952
2968
|
}
|
|
2953
|
-
return new
|
|
2969
|
+
return new D(
|
|
2954
2970
|
{ x: s, y: e, z: n },
|
|
2955
2971
|
{ x: i, y: r, z: o }
|
|
2956
2972
|
);
|
|
@@ -2987,10 +3003,10 @@ class zt extends ot {
|
|
|
2987
3003
|
), o = new p(i).sub(
|
|
2988
3004
|
e
|
|
2989
3005
|
), a = r.length(), h = o.length(), c = r.clone().normalize(), l = new p().crossVectors(r, o).normalize();
|
|
2990
|
-
let
|
|
2991
|
-
|
|
3006
|
+
let d = new p().crossVectors(l, c).normalize();
|
|
3007
|
+
d.dot(o) < 0 && (l.negate(), d = new p().crossVectors(l, c).normalize());
|
|
2992
3008
|
const u = (g) => {
|
|
2993
|
-
const y = new p(g).sub(e), _ = y.dot(c), z = y.dot(
|
|
3009
|
+
const y = new p(g).sub(e), _ = y.dot(c), z = y.dot(d);
|
|
2994
3010
|
return M.normalizeAngle(
|
|
2995
3011
|
Math.atan2(z / h, _ / a)
|
|
2996
3012
|
);
|
|
@@ -3028,11 +3044,11 @@ class zt extends ot {
|
|
|
3028
3044
|
);
|
|
3029
3045
|
}
|
|
3030
3046
|
get plane() {
|
|
3031
|
-
const t = new p(this.center).distanceTo(
|
|
3032
|
-
return new
|
|
3047
|
+
const t = new p(this.center).distanceTo(Kt);
|
|
3048
|
+
return new Ct(this.normal, t);
|
|
3033
3049
|
}
|
|
3034
3050
|
}
|
|
3035
|
-
class
|
|
3051
|
+
class ss extends rt {
|
|
3036
3052
|
constructor(t = null, s = !1) {
|
|
3037
3053
|
super(), this._vertices = t || new Array(), this._closed = s;
|
|
3038
3054
|
}
|
|
@@ -3048,7 +3064,7 @@ class Vs extends rt {
|
|
|
3048
3064
|
get startPoint() {
|
|
3049
3065
|
if (this.numberOfVertices > 0) {
|
|
3050
3066
|
const t = this._vertices[0];
|
|
3051
|
-
return new
|
|
3067
|
+
return new S(t.x, t.y);
|
|
3052
3068
|
}
|
|
3053
3069
|
throw new Error("Start point does not exist in an empty polyline.");
|
|
3054
3070
|
}
|
|
@@ -3057,10 +3073,10 @@ class Vs extends rt {
|
|
|
3057
3073
|
if (t > 0)
|
|
3058
3074
|
if (this.closed) {
|
|
3059
3075
|
const s = this._vertices[0];
|
|
3060
|
-
return new
|
|
3076
|
+
return new S(s.x, s.y);
|
|
3061
3077
|
} else {
|
|
3062
3078
|
const s = this._vertices[t - 1];
|
|
3063
|
-
return new
|
|
3079
|
+
return new S(s.x, s.y);
|
|
3064
3080
|
}
|
|
3065
3081
|
throw new Error("End point does not exist in an empty polyline.");
|
|
3066
3082
|
}
|
|
@@ -3072,10 +3088,10 @@ class Vs extends rt {
|
|
|
3072
3088
|
let i = null;
|
|
3073
3089
|
if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
|
|
3074
3090
|
if (n.bulge) {
|
|
3075
|
-
const r = new
|
|
3091
|
+
const r = new K(n, i, n.bulge);
|
|
3076
3092
|
t += r.length;
|
|
3077
3093
|
} else
|
|
3078
|
-
t += new
|
|
3094
|
+
t += new S(n.x, n.y).distanceTo(i);
|
|
3079
3095
|
}
|
|
3080
3096
|
return t;
|
|
3081
3097
|
}
|
|
@@ -3097,19 +3113,25 @@ class Vs extends rt {
|
|
|
3097
3113
|
}
|
|
3098
3114
|
getPointAt(t) {
|
|
3099
3115
|
const s = this._vertices[t];
|
|
3100
|
-
return new
|
|
3116
|
+
return new S(s.x, s.y);
|
|
3101
3117
|
}
|
|
3102
3118
|
calculateBoundingBox() {
|
|
3103
3119
|
const t = this.getPoints(100);
|
|
3104
|
-
return new
|
|
3120
|
+
return new X().setFromPoints(t);
|
|
3105
3121
|
}
|
|
3106
3122
|
transform(t) {
|
|
3107
3123
|
const s = t.determinant() < 0;
|
|
3108
3124
|
return this._vertices.forEach((e) => {
|
|
3109
|
-
const n = new
|
|
3125
|
+
const n = new S(e).applyMatrix2d(t);
|
|
3110
3126
|
e.x = n.x, e.y = n.y, s && e.bulge != null && (e.bulge = -e.bulge);
|
|
3111
3127
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3112
3128
|
}
|
|
3129
|
+
clone() {
|
|
3130
|
+
return new ss(
|
|
3131
|
+
this._vertices.map((t) => ({ ...t })),
|
|
3132
|
+
this._closed
|
|
3133
|
+
);
|
|
3134
|
+
}
|
|
3113
3135
|
getPoints3d(t, s) {
|
|
3114
3136
|
const e = [];
|
|
3115
3137
|
return this.getPoints(t).forEach(
|
|
@@ -3123,21 +3145,21 @@ class Vs extends rt {
|
|
|
3123
3145
|
if (i.bulge) {
|
|
3124
3146
|
let r = null;
|
|
3125
3147
|
if (n < e - 1 ? r = this._vertices[n + 1] : n == e - 1 && this.closed && (r = this._vertices[0]), r) {
|
|
3126
|
-
const a = new
|
|
3148
|
+
const a = new K(i, r, i.bulge).getPoints(t), h = a.length;
|
|
3127
3149
|
for (let c = 0; c < h; ++c) {
|
|
3128
3150
|
const l = a[c];
|
|
3129
|
-
s.push(new
|
|
3151
|
+
s.push(new S(l.x, l.y));
|
|
3130
3152
|
}
|
|
3131
3153
|
}
|
|
3132
3154
|
} else
|
|
3133
|
-
s.push(new
|
|
3155
|
+
s.push(new S(i.x, i.y)), n == e - 1 && this.closed && s.push(s[0]);
|
|
3134
3156
|
}
|
|
3135
3157
|
return s;
|
|
3136
3158
|
}
|
|
3137
3159
|
}
|
|
3138
3160
|
class Pt extends rt {
|
|
3139
3161
|
constructor(t, s) {
|
|
3140
|
-
super(), this._start = new
|
|
3162
|
+
super(), this._start = new S(t), this._end = new S(s);
|
|
3141
3163
|
}
|
|
3142
3164
|
get startPoint() {
|
|
3143
3165
|
return this._start;
|
|
@@ -3158,14 +3180,14 @@ class Pt extends rt {
|
|
|
3158
3180
|
return this.startPoint.distanceTo(this.endPoint);
|
|
3159
3181
|
}
|
|
3160
3182
|
calculateBoundingBox() {
|
|
3161
|
-
const t = new
|
|
3183
|
+
const t = new S(
|
|
3162
3184
|
Math.min(this._start.x, this._end.x),
|
|
3163
3185
|
Math.min(this._start.y, this._end.y)
|
|
3164
|
-
), s = new
|
|
3186
|
+
), s = new S(
|
|
3165
3187
|
Math.max(this._start.x, this._end.x),
|
|
3166
3188
|
Math.max(this._start.y, this._end.y)
|
|
3167
3189
|
);
|
|
3168
|
-
return new
|
|
3190
|
+
return new X(t, s);
|
|
3169
3191
|
}
|
|
3170
3192
|
transform(t) {
|
|
3171
3193
|
return this._start.applyMatrix2d(t), this._end.applyMatrix2d(t), this._boundingBoxNeedsUpdate = !0, this;
|
|
@@ -3180,7 +3202,7 @@ class Pt extends rt {
|
|
|
3180
3202
|
return new Pt(this._start.clone(), this._end.clone());
|
|
3181
3203
|
}
|
|
3182
3204
|
}
|
|
3183
|
-
class
|
|
3205
|
+
class F extends rt {
|
|
3184
3206
|
constructor(t = []) {
|
|
3185
3207
|
super(), this._curves = t;
|
|
3186
3208
|
}
|
|
@@ -3196,20 +3218,20 @@ class X extends rt {
|
|
|
3196
3218
|
for (; e.length > 0; ) {
|
|
3197
3219
|
const o = [], a = e.shift();
|
|
3198
3220
|
o.push(a);
|
|
3199
|
-
const h =
|
|
3200
|
-
let c =
|
|
3221
|
+
const h = F.getEdgeStartPoint(a);
|
|
3222
|
+
let c = F.getEdgeEndPoint(a);
|
|
3201
3223
|
if (!r(h, c))
|
|
3202
3224
|
for (; e.length > 0; ) {
|
|
3203
|
-
const l =
|
|
3225
|
+
const l = F.findConnectingEdge(
|
|
3204
3226
|
e,
|
|
3205
3227
|
c,
|
|
3206
3228
|
i
|
|
3207
3229
|
);
|
|
3208
3230
|
if (l.index < 0) break;
|
|
3209
|
-
let
|
|
3210
|
-
if (l.reverse && (
|
|
3231
|
+
let d = e.splice(l.index, 1)[0];
|
|
3232
|
+
if (l.reverse && (d = F.reverseEdge(d)), o.push(d), c = F.getEdgeEndPoint(d), r(c, h)) break;
|
|
3211
3233
|
}
|
|
3212
|
-
n.push(new
|
|
3234
|
+
n.push(new F(o));
|
|
3213
3235
|
}
|
|
3214
3236
|
return n;
|
|
3215
3237
|
}
|
|
@@ -3222,7 +3244,7 @@ class X extends rt {
|
|
|
3222
3244
|
get startPoint() {
|
|
3223
3245
|
if (this._curves.length > 0) {
|
|
3224
3246
|
const t = this._curves[0].startPoint;
|
|
3225
|
-
return new
|
|
3247
|
+
return new S(t.x, t.y);
|
|
3226
3248
|
}
|
|
3227
3249
|
throw new Error("Start point does not exist in an empty loop.");
|
|
3228
3250
|
}
|
|
@@ -3236,11 +3258,11 @@ class X extends rt {
|
|
|
3236
3258
|
}), t;
|
|
3237
3259
|
}
|
|
3238
3260
|
calculateBoundingBox() {
|
|
3239
|
-
const t = this.getPoints(100), s = new
|
|
3261
|
+
const t = this.getPoints(100), s = new X();
|
|
3240
3262
|
return s.setFromPoints(t), s;
|
|
3241
3263
|
}
|
|
3242
3264
|
transform(t) {
|
|
3243
|
-
const s = new
|
|
3265
|
+
const s = new G().set(
|
|
3244
3266
|
t.elements[0],
|
|
3245
3267
|
t.elements[3],
|
|
3246
3268
|
0,
|
|
@@ -3259,9 +3281,12 @@ class X extends rt {
|
|
|
3259
3281
|
1
|
|
3260
3282
|
);
|
|
3261
3283
|
return this._curves.forEach((e) => {
|
|
3262
|
-
e instanceof
|
|
3284
|
+
e instanceof Q ? e.transform(s) : e.transform(t);
|
|
3263
3285
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3264
3286
|
}
|
|
3287
|
+
clone() {
|
|
3288
|
+
return new F(this._curves.map((t) => t.clone()));
|
|
3289
|
+
}
|
|
3265
3290
|
get closed() {
|
|
3266
3291
|
return !0;
|
|
3267
3292
|
}
|
|
@@ -3269,14 +3294,14 @@ class X extends rt {
|
|
|
3269
3294
|
const s = [];
|
|
3270
3295
|
return this.curves.forEach((e) => {
|
|
3271
3296
|
e.getPoints(t).forEach((n) => {
|
|
3272
|
-
s.push(new
|
|
3297
|
+
s.push(new S(n.x, n.y));
|
|
3273
3298
|
});
|
|
3274
3299
|
}), s;
|
|
3275
3300
|
}
|
|
3276
3301
|
static findConnectingEdge(t, s, e) {
|
|
3277
3302
|
let n = -1, i = !1, r = Number.POSITIVE_INFINITY;
|
|
3278
3303
|
for (let o = 0; o < t.length; o++) {
|
|
3279
|
-
const a = t[o], h =
|
|
3304
|
+
const a = t[o], h = F.getEdgeStartPoint(a), c = F.getEdgeEndPoint(a), l = s.x - h.x, d = s.y - h.y, u = l * l + d * d;
|
|
3280
3305
|
u < r && (r = u, n = o, i = !1);
|
|
3281
3306
|
const x = s.x - c.x, g = s.y - c.y, y = x * x + g * g;
|
|
3282
3307
|
y < r && (r = y, n = o, i = !0);
|
|
@@ -3285,20 +3310,20 @@ class X extends rt {
|
|
|
3285
3310
|
}
|
|
3286
3311
|
static getEdgeStartPoint(t) {
|
|
3287
3312
|
const s = t.startPoint;
|
|
3288
|
-
return new
|
|
3313
|
+
return new S(s.x, s.y);
|
|
3289
3314
|
}
|
|
3290
3315
|
static getEdgeEndPoint(t) {
|
|
3291
3316
|
const s = t.endPoint;
|
|
3292
|
-
return new
|
|
3317
|
+
return new S(s.x, s.y);
|
|
3293
3318
|
}
|
|
3294
3319
|
static reverseEdge(t) {
|
|
3295
|
-
return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof
|
|
3320
|
+
return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof K ? new K(
|
|
3296
3321
|
t.center,
|
|
3297
3322
|
t.radius,
|
|
3298
3323
|
t.endAngle,
|
|
3299
3324
|
t.startAngle,
|
|
3300
3325
|
!t.clockwise
|
|
3301
|
-
) : t instanceof
|
|
3326
|
+
) : t instanceof J ? new J(
|
|
3302
3327
|
t.center,
|
|
3303
3328
|
t.majorAxisRadius,
|
|
3304
3329
|
t.minorAxisRadius,
|
|
@@ -3306,11 +3331,11 @@ class X extends rt {
|
|
|
3306
3331
|
t.startAngle,
|
|
3307
3332
|
!t.clockwise,
|
|
3308
3333
|
t.rotation
|
|
3309
|
-
) : t instanceof
|
|
3334
|
+
) : t instanceof Q ? F.reverseSplineEdge(t) : t;
|
|
3310
3335
|
}
|
|
3311
3336
|
static reverseSplineEdge(t) {
|
|
3312
3337
|
const s = [...t.controlPoints].reverse(), e = t.knots, n = e[0], i = e[e.length - 1], r = e.map((h) => n + i - h).reverse(), o = t.weights, a = o.length > 0 ? [...o].reverse() : void 0;
|
|
3313
|
-
return new
|
|
3338
|
+
return new Q(
|
|
3314
3339
|
s,
|
|
3315
3340
|
r,
|
|
3316
3341
|
a,
|
|
@@ -3319,7 +3344,7 @@ class X extends rt {
|
|
|
3319
3344
|
);
|
|
3320
3345
|
}
|
|
3321
3346
|
}
|
|
3322
|
-
class
|
|
3347
|
+
class Rt {
|
|
3323
3348
|
constructor() {
|
|
3324
3349
|
this.c0 = 0, this.c1 = 0, this.c2 = 0, this.c3 = 0;
|
|
3325
3350
|
}
|
|
@@ -3338,9 +3363,9 @@ class kt {
|
|
|
3338
3363
|
return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
|
|
3339
3364
|
}
|
|
3340
3365
|
}
|
|
3341
|
-
class
|
|
3366
|
+
class Nt extends ot {
|
|
3342
3367
|
constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
|
|
3343
|
-
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new
|
|
3368
|
+
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new Rt(), this._py = new Rt(), this._pz = new Rt(), this._points = t.map((i) => new w(i)), this._closed = s, this._curveType = e, this._tension = n;
|
|
3344
3369
|
}
|
|
3345
3370
|
get points() {
|
|
3346
3371
|
return this._points;
|
|
@@ -3380,12 +3405,12 @@ class Es extends ot {
|
|
|
3380
3405
|
this._closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / i) + 1) * i : a === 0 && o === i - 1 && (o = i - 2, a = 1);
|
|
3381
3406
|
let h, c;
|
|
3382
3407
|
this._closed || o > 0 ? h = n[(o - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), h = new w(this._tmp.x, this._tmp.y, this._tmp.z));
|
|
3383
|
-
const l = n[o % i],
|
|
3408
|
+
const l = n[o % i], d = n[(o + 1) % i];
|
|
3384
3409
|
if (this._closed || o + 2 < i ? c = n[(o + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new w(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
|
|
3385
3410
|
const u = this._curveType === "chordal" ? 0.5 : 0.25;
|
|
3386
|
-
let x = Math.pow(h.distanceToSquared(l), u), g = Math.pow(l.distanceToSquared(
|
|
3387
|
-
g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(h.x, l.x,
|
|
3388
|
-
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(h.x, l.x,
|
|
3411
|
+
let x = Math.pow(h.distanceToSquared(l), u), g = Math.pow(l.distanceToSquared(d), u), y = Math.pow(d.distanceToSquared(c), u);
|
|
3412
|
+
g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(h.x, l.x, d.x, c.x, x, g, y), this._py.initNonuniformCatmullRom(h.y, l.y, d.y, c.y, x, g, y), this._pz.initNonuniformCatmullRom(h.z, l.z, d.z, c.z, x, g, y);
|
|
3413
|
+
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(h.x, l.x, d.x, c.x, this._tension), this._py.initCatmullRom(h.y, l.y, d.y, c.y, this._tension), this._pz.initCatmullRom(h.z, l.z, d.z, c.z, this._tension));
|
|
3389
3414
|
return e.set(
|
|
3390
3415
|
this._px.calc(a),
|
|
3391
3416
|
this._py.calc(a),
|
|
@@ -3410,6 +3435,14 @@ class Es extends ot {
|
|
|
3410
3435
|
setTension(t) {
|
|
3411
3436
|
this._tension = t;
|
|
3412
3437
|
}
|
|
3438
|
+
clone() {
|
|
3439
|
+
return new Nt(
|
|
3440
|
+
this._points.map((t) => t.clone()),
|
|
3441
|
+
this._closed,
|
|
3442
|
+
this._curveType,
|
|
3443
|
+
this._tension
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3413
3446
|
transform(t) {
|
|
3414
3447
|
return this._points = this._points.map((s) => {
|
|
3415
3448
|
const e = new w();
|
|
@@ -3418,14 +3451,14 @@ class Es extends ot {
|
|
|
3418
3451
|
}
|
|
3419
3452
|
calculateBoundingBox() {
|
|
3420
3453
|
if (this._points.length === 0)
|
|
3421
|
-
return new
|
|
3422
|
-
const t = new
|
|
3454
|
+
return new D();
|
|
3455
|
+
const t = new D();
|
|
3423
3456
|
return this._points.forEach((s) => {
|
|
3424
3457
|
t.expandByPoint(s);
|
|
3425
3458
|
}), t;
|
|
3426
3459
|
}
|
|
3427
3460
|
}
|
|
3428
|
-
class
|
|
3461
|
+
class T {
|
|
3429
3462
|
constructor(t, s, e, n) {
|
|
3430
3463
|
this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) => ({ x: i.x, y: i.y, z: i.z })), this._weights = n ? [...n] : new Array(e.length).fill(1);
|
|
3431
3464
|
}
|
|
@@ -3441,6 +3474,14 @@ class j {
|
|
|
3441
3474
|
weights() {
|
|
3442
3475
|
return [...this._weights];
|
|
3443
3476
|
}
|
|
3477
|
+
clone() {
|
|
3478
|
+
return new T(
|
|
3479
|
+
this._degree,
|
|
3480
|
+
this._knots,
|
|
3481
|
+
this._controlPoints,
|
|
3482
|
+
this._weights
|
|
3483
|
+
);
|
|
3484
|
+
}
|
|
3444
3485
|
point(t) {
|
|
3445
3486
|
const s = this._controlPoints.map((e) => [e.x, e.y, e.z]);
|
|
3446
3487
|
return ft(
|
|
@@ -3453,7 +3494,7 @@ class j {
|
|
|
3453
3494
|
}
|
|
3454
3495
|
length() {
|
|
3455
3496
|
const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
|
|
3456
|
-
return
|
|
3497
|
+
return bs(
|
|
3457
3498
|
this._degree,
|
|
3458
3499
|
this._knots,
|
|
3459
3500
|
t,
|
|
@@ -3461,10 +3502,10 @@ class j {
|
|
|
3461
3502
|
);
|
|
3462
3503
|
}
|
|
3463
3504
|
static byKnotsControlPointsWeights(t, s, e, n) {
|
|
3464
|
-
return new
|
|
3505
|
+
return new T(t, s, e, n);
|
|
3465
3506
|
}
|
|
3466
3507
|
static byPoints(t, s, e = "Uniform", n, i) {
|
|
3467
|
-
const r =
|
|
3508
|
+
const r = Ht(
|
|
3468
3509
|
t,
|
|
3469
3510
|
s,
|
|
3470
3511
|
e,
|
|
@@ -3475,7 +3516,7 @@ class j {
|
|
|
3475
3516
|
y: a[1],
|
|
3476
3517
|
z: a[2]
|
|
3477
3518
|
}));
|
|
3478
|
-
return new
|
|
3519
|
+
return new T(
|
|
3479
3520
|
s,
|
|
3480
3521
|
r.knots,
|
|
3481
3522
|
o,
|
|
@@ -3501,7 +3542,7 @@ class j {
|
|
|
3501
3542
|
static createFitPointsForClosedCurve(t) {
|
|
3502
3543
|
if (t.length < 4)
|
|
3503
3544
|
throw new Error("At least 4 points are required for a closed NURBS curve");
|
|
3504
|
-
const s = new
|
|
3545
|
+
const s = new Nt(
|
|
3505
3546
|
t,
|
|
3506
3547
|
!0,
|
|
3507
3548
|
"centripetal"
|
|
@@ -3510,21 +3551,21 @@ class j {
|
|
|
3510
3551
|
}
|
|
3511
3552
|
static createClosedCurve(t, s, e = "Chord") {
|
|
3512
3553
|
const i = this.createFitPointsForClosedCurve(t).map((r) => [r.x, r.y, r.z]);
|
|
3513
|
-
return
|
|
3554
|
+
return T.byPoints(i, s, e);
|
|
3514
3555
|
}
|
|
3515
3556
|
}
|
|
3516
|
-
class
|
|
3557
|
+
class Q extends ot {
|
|
3517
3558
|
constructor(t, s, e, n, i, r) {
|
|
3518
3559
|
super();
|
|
3519
3560
|
const o = arguments.length;
|
|
3520
3561
|
if (this._degree = 3, this._closed = !1, Array.isArray(s)) {
|
|
3521
3562
|
if (o < 2 || o > 5)
|
|
3522
|
-
throw
|
|
3563
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
3523
3564
|
this._controlPoints = t;
|
|
3524
3565
|
let a, h = 3, c = !1;
|
|
3525
3566
|
if (o >= 3 && (Array.isArray(e) ? (a = e, o >= 4 && (h = n || 3), o >= 5 && (c = i)) : e !== void 0 && (h = e || 3, o >= 4 && (c = n))), e === void 0 && o >= 4 && (h = n || 3, o >= 5 && (c = i)), this._degree = h, this._closed = c, this._controlPoints.length < this._degree + 1)
|
|
3526
|
-
throw
|
|
3527
|
-
this._nurbsCurve =
|
|
3567
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
3568
|
+
this._nurbsCurve = T.byKnotsControlPointsWeights(
|
|
3528
3569
|
this._degree,
|
|
3529
3570
|
s,
|
|
3530
3571
|
this._controlPoints,
|
|
@@ -3532,22 +3573,22 @@ class J extends ot {
|
|
|
3532
3573
|
);
|
|
3533
3574
|
} else {
|
|
3534
3575
|
if (o < 2 || o > 6)
|
|
3535
|
-
throw
|
|
3576
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
3536
3577
|
this._fitPoints = t, this._knotParameterization = s, o >= 3 && (this._degree = e || 3);
|
|
3537
3578
|
const a = typeof n == "boolean";
|
|
3538
3579
|
o >= 4 && a && (this._closed = n), a ? (o >= 5 && (this._startTangent = i), o >= 6 && (this._endTangent = r)) : (o >= 4 && (this._startTangent = n), o >= 5 && (this._endTangent = i)), this._closed && (this._startTangent = void 0, this._endTangent = void 0);
|
|
3539
3580
|
const h = (this._startTangent ? 1 : 0) + (this._endTangent ? 1 : 0);
|
|
3540
3581
|
if (this._fitPoints.length + h < this._degree + 1)
|
|
3541
|
-
throw
|
|
3582
|
+
throw U.ILLEGAL_PARAMETERS;
|
|
3542
3583
|
if (this._closed)
|
|
3543
|
-
this._nurbsCurve =
|
|
3584
|
+
this._nurbsCurve = T.createClosedCurve(
|
|
3544
3585
|
this._fitPoints,
|
|
3545
3586
|
this._degree,
|
|
3546
3587
|
this._knotParameterization
|
|
3547
3588
|
);
|
|
3548
3589
|
else {
|
|
3549
3590
|
const c = this.toNurbsPoints(this._fitPoints);
|
|
3550
|
-
this._nurbsCurve =
|
|
3591
|
+
this._nurbsCurve = T.byPoints(
|
|
3551
3592
|
c,
|
|
3552
3593
|
this._degree,
|
|
3553
3594
|
this._knotParameterization,
|
|
@@ -3563,17 +3604,17 @@ class J extends ot {
|
|
|
3563
3604
|
buildCurve() {
|
|
3564
3605
|
if (this._fitPoints && this._knotParameterization) {
|
|
3565
3606
|
if (this._closed) {
|
|
3566
|
-
const t =
|
|
3607
|
+
const t = T.createFitPointsForClosedCurve(
|
|
3567
3608
|
this._fitPoints
|
|
3568
3609
|
), s = this.toNurbsPoints(t);
|
|
3569
|
-
this._nurbsCurve =
|
|
3610
|
+
this._nurbsCurve = T.byPoints(
|
|
3570
3611
|
s,
|
|
3571
3612
|
this._degree,
|
|
3572
3613
|
this._knotParameterization
|
|
3573
3614
|
);
|
|
3574
3615
|
} else {
|
|
3575
3616
|
const t = this.toNurbsPoints(this._fitPoints);
|
|
3576
|
-
this._nurbsCurve =
|
|
3617
|
+
this._nurbsCurve = T.byPoints(
|
|
3577
3618
|
t,
|
|
3578
3619
|
this._degree,
|
|
3579
3620
|
this._knotParameterization,
|
|
@@ -3586,10 +3627,10 @@ class J extends ot {
|
|
|
3586
3627
|
);
|
|
3587
3628
|
} else if (this._controlPoints)
|
|
3588
3629
|
if (this._closed) {
|
|
3589
|
-
const t =
|
|
3630
|
+
const t = T.createFitPointsForClosedCurve(
|
|
3590
3631
|
this._controlPoints
|
|
3591
3632
|
), s = this.toNurbsPoints(t);
|
|
3592
|
-
this._nurbsCurve =
|
|
3633
|
+
this._nurbsCurve = T.byPoints(
|
|
3593
3634
|
s,
|
|
3594
3635
|
this._degree,
|
|
3595
3636
|
this._knotParameterization
|
|
@@ -3598,7 +3639,7 @@ class J extends ot {
|
|
|
3598
3639
|
);
|
|
3599
3640
|
} else {
|
|
3600
3641
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.weights();
|
|
3601
|
-
this._nurbsCurve =
|
|
3642
|
+
this._nurbsCurve = T.byKnotsControlPointsWeights(
|
|
3602
3643
|
this._degree,
|
|
3603
3644
|
t,
|
|
3604
3645
|
this._controlPoints,
|
|
@@ -3675,7 +3716,7 @@ class J extends ot {
|
|
|
3675
3716
|
}
|
|
3676
3717
|
calculateBoundingBox() {
|
|
3677
3718
|
const t = this.getPoints(100);
|
|
3678
|
-
return new
|
|
3719
|
+
return new D().setFromPoints(t);
|
|
3679
3720
|
}
|
|
3680
3721
|
get closed() {
|
|
3681
3722
|
return this._closed;
|
|
@@ -3696,7 +3737,7 @@ class J extends ot {
|
|
|
3696
3737
|
const s = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
|
|
3697
3738
|
this._controlPoints = this._controlPoints.map(
|
|
3698
3739
|
(n) => new w(n).applyMatrix4(t)
|
|
3699
|
-
), this._nurbsCurve =
|
|
3740
|
+
), this._nurbsCurve = T.byKnotsControlPointsWeights(
|
|
3700
3741
|
this._degree,
|
|
3701
3742
|
s,
|
|
3702
3743
|
this._controlPoints,
|
|
@@ -3705,6 +3746,38 @@ class J extends ot {
|
|
|
3705
3746
|
}
|
|
3706
3747
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
3707
3748
|
}
|
|
3749
|
+
clone() {
|
|
3750
|
+
return this._fitPoints && this._knotParameterization ? new Q(
|
|
3751
|
+
this._fitPoints.map((t) => ({
|
|
3752
|
+
x: t.x,
|
|
3753
|
+
y: t.y,
|
|
3754
|
+
z: t.z || 0
|
|
3755
|
+
})),
|
|
3756
|
+
this._knotParameterization,
|
|
3757
|
+
this._degree,
|
|
3758
|
+
this._closed,
|
|
3759
|
+
this._startTangent ? {
|
|
3760
|
+
x: this._startTangent.x,
|
|
3761
|
+
y: this._startTangent.y,
|
|
3762
|
+
z: this._startTangent.z || 0
|
|
3763
|
+
} : void 0,
|
|
3764
|
+
this._endTangent ? {
|
|
3765
|
+
x: this._endTangent.x,
|
|
3766
|
+
y: this._endTangent.y,
|
|
3767
|
+
z: this._endTangent.z || 0
|
|
3768
|
+
} : void 0
|
|
3769
|
+
) : new Q(
|
|
3770
|
+
this._controlPoints.map((t) => ({
|
|
3771
|
+
x: t.x,
|
|
3772
|
+
y: t.y,
|
|
3773
|
+
z: t.z || 0
|
|
3774
|
+
})),
|
|
3775
|
+
this._nurbsCurve.knots(),
|
|
3776
|
+
this._nurbsCurve.weights(),
|
|
3777
|
+
this._degree,
|
|
3778
|
+
this._closed
|
|
3779
|
+
);
|
|
3780
|
+
}
|
|
3708
3781
|
toNurbsPoints(t) {
|
|
3709
3782
|
const s = new Array(t.length);
|
|
3710
3783
|
return t.forEach((e, n) => {
|
|
@@ -3725,79 +3798,79 @@ class J extends ot {
|
|
|
3725
3798
|
throw new Error(
|
|
3726
3799
|
`At least ${e + 1} points are required for a degree ${e} closed spline`
|
|
3727
3800
|
);
|
|
3728
|
-
return new
|
|
3801
|
+
return new Q(t, s, e, !0);
|
|
3729
3802
|
}
|
|
3730
3803
|
}
|
|
3731
3804
|
export {
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3805
|
+
ts as AcGeArea2d,
|
|
3806
|
+
X as AcGeBox2d,
|
|
3807
|
+
D as AcGeBox3d,
|
|
3808
|
+
Nt as AcGeCatmullRomCurve3d,
|
|
3809
|
+
K as AcGeCircArc2d,
|
|
3737
3810
|
At as AcGeCircArc3d,
|
|
3738
3811
|
rt as AcGeCurve2d,
|
|
3739
|
-
|
|
3812
|
+
J as AcGeEllipseArc2d,
|
|
3740
3813
|
zt as AcGeEllipseArc3d,
|
|
3741
|
-
|
|
3742
|
-
|
|
3814
|
+
Ft as AcGeEuler,
|
|
3815
|
+
ws as AcGeGeometryUtil,
|
|
3743
3816
|
Pt as AcGeLine2d,
|
|
3744
3817
|
Mt as AcGeLine3d,
|
|
3745
|
-
|
|
3818
|
+
F as AcGeLoop2d,
|
|
3746
3819
|
M as AcGeMathUtil,
|
|
3747
3820
|
it as AcGeMatrix2d,
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3821
|
+
G as AcGeMatrix3d,
|
|
3822
|
+
T as AcGeNurbsCurve,
|
|
3823
|
+
Ct as AcGePlane,
|
|
3824
|
+
S as AcGePoint2d,
|
|
3752
3825
|
w as AcGePoint3d,
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3826
|
+
ss as AcGePolyline2d,
|
|
3827
|
+
St as AcGeQuaternion,
|
|
3828
|
+
Gt as AcGeShape2d,
|
|
3829
|
+
Q as AcGeSpline3d,
|
|
3830
|
+
bt as AcGeTol,
|
|
3758
3831
|
B as AcGeVector2d,
|
|
3759
3832
|
p as AcGeVector3d,
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3833
|
+
$t as DEFAULT_TOL,
|
|
3834
|
+
Dt as DEG2RAD,
|
|
3835
|
+
W as FLOAT_TOL,
|
|
3836
|
+
Rs as ORIGIN_POINT_2D,
|
|
3837
|
+
Kt as ORIGIN_POINT_3D,
|
|
3838
|
+
Yt as RAD2DEG,
|
|
3766
3839
|
E as TAU,
|
|
3767
3840
|
wt as basisFunction,
|
|
3768
|
-
|
|
3769
|
-
|
|
3841
|
+
bs as calculateCurveLength,
|
|
3842
|
+
ys as ceilPowerOfTwo,
|
|
3770
3843
|
Z as clamp,
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3844
|
+
Ms as computeParameterValues,
|
|
3845
|
+
rs as damp,
|
|
3846
|
+
ms as degToRad,
|
|
3847
|
+
Zt as euclideanModulo,
|
|
3775
3848
|
ft as evaluateNurbsPoint,
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3849
|
+
_s as floorPowerOfTwo,
|
|
3850
|
+
Ps as generateAveragedKnots,
|
|
3851
|
+
Ts as generateChordKnots,
|
|
3852
|
+
js as generateSqrtChordKnots,
|
|
3853
|
+
es as generateUUID,
|
|
3854
|
+
Ns as generateUniformKnots,
|
|
3855
|
+
Qt as intPartLength,
|
|
3856
|
+
Vs as interpolateControlPoints,
|
|
3857
|
+
Ht as interpolateNurbsCurve,
|
|
3858
|
+
is as inverseLerp,
|
|
3859
|
+
ps as isBetween,
|
|
3860
|
+
fs as isBetweenAngle,
|
|
3861
|
+
Wt as isPointInPolygon,
|
|
3862
|
+
zs as isPolygonIntersect,
|
|
3863
|
+
gs as isPowerOfTwo,
|
|
3864
|
+
Ot as lerp,
|
|
3865
|
+
ns as mapLinear,
|
|
3793
3866
|
pt as normalizeAngle,
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3867
|
+
os as pingpong,
|
|
3868
|
+
xs as radToDeg,
|
|
3869
|
+
ls as randFloat,
|
|
3870
|
+
us as randFloatSpread,
|
|
3871
|
+
cs as randInt,
|
|
3872
|
+
As as relativeEps,
|
|
3873
|
+
ds as seededRandom,
|
|
3874
|
+
as as smootherstep,
|
|
3875
|
+
hs as smoothstep
|
|
3803
3876
|
};
|