@mlightcad/geometry-engine 3.2.23 → 3.2.25
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/LICENSE +21 -21
- package/README.md +174 -174
- package/dist/geometry-engine.js +628 -595
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/math/AcGeEuler.js +1 -1
- package/lib/math/AcGeEuler.js.map +1 -1
- package/lib/math/AcGeMatrix3d.js +1 -1
- package/lib/math/AcGeMatrix3d.js.map +1 -1
- package/lib/math/AcGeQuaternion.js +2 -2
- package/lib/math/AcGeQuaternion.js.map +1 -1
- package/lib/util/AcGeOcsUtil.d.ts +7 -0
- package/lib/util/AcGeOcsUtil.d.ts.map +1 -0
- package/lib/util/AcGeOcsUtil.js +33 -0
- package/lib/util/AcGeOcsUtil.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/package.json +2 -2
package/dist/geometry-engine.js
CHANGED
|
@@ -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 jt = 1234567;
|
|
261
|
+
const Qt = Math.PI / 180, Kt = 180 / Math.PI;
|
|
262
|
+
function hs() {
|
|
263
|
+
const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
|
264
|
+
return (N[u & 255] + N[u >> 8 & 255] + N[u >> 16 & 255] + N[u >> 24 & 255] + "-" + N[t & 255] + N[t >> 8 & 255] + "-" + N[t >> 16 & 15 | 64] + N[t >> 24 & 255] + "-" + N[s & 63 | 128] + N[s >> 8 & 255] + "-" + N[s >> 16 & 255] + N[s >> 24 & 255] + N[e & 255] + N[e >> 8 & 255] + N[e >> 16 & 255] + N[e >> 24 & 255]).toLowerCase();
|
|
265
265
|
}
|
|
266
|
-
function Z(
|
|
267
|
-
return Math.max(t, Math.min(s,
|
|
266
|
+
function Z(u, t, s) {
|
|
267
|
+
return Math.max(t, Math.min(s, u));
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
return (
|
|
269
|
+
function $t(u, t) {
|
|
270
|
+
return (u % t + t) % t;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return e + (
|
|
272
|
+
function as(u, t, s, e, n) {
|
|
273
|
+
return e + (u - t) * (n - e) / (s - t);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
275
|
+
function cs(u, t, s) {
|
|
276
|
+
return u !== t ? (s - u) / (t - u) : 0;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
return (1 - s) *
|
|
278
|
+
function Wt(u, t, s) {
|
|
279
|
+
return (1 - s) * u + s * t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return
|
|
281
|
+
function ls(u, t, s, e) {
|
|
282
|
+
return Wt(u, t, 1 - Math.exp(-s * e));
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return t - Math.abs(
|
|
284
|
+
function us(u, t = 1) {
|
|
285
|
+
return t - Math.abs($t(u, t * 2) - t);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
return
|
|
287
|
+
function ds(u, t, s) {
|
|
288
|
+
return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * (3 - 2 * u));
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
return
|
|
290
|
+
function ms(u, t, s) {
|
|
291
|
+
return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * u * (u * (u * 6 - 15) + 10));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return
|
|
293
|
+
function xs(u, t) {
|
|
294
|
+
return u + Math.floor(Math.random() * (t - u + 1));
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return
|
|
296
|
+
function gs(u, t) {
|
|
297
|
+
return u + Math.random() * (t - u);
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
return
|
|
299
|
+
function ys(u) {
|
|
300
|
+
return u * (0.5 - Math.random());
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
|
|
304
|
-
let t =
|
|
302
|
+
function _s(u) {
|
|
303
|
+
u !== void 0 && (jt = u);
|
|
304
|
+
let t = jt += 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 ps(u) {
|
|
308
|
+
return u * Qt;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
return
|
|
310
|
+
function fs(u) {
|
|
311
|
+
return u * Kt;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
return (
|
|
313
|
+
function As(u) {
|
|
314
|
+
return (u & u - 1) === 0 && u !== 0;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
return Math.pow(2, Math.ceil(Math.log(
|
|
316
|
+
function ws(u) {
|
|
317
|
+
return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
return Math.pow(2, Math.floor(Math.log(
|
|
319
|
+
function zs(u) {
|
|
320
|
+
return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
|
|
321
321
|
}
|
|
322
|
-
function pt(
|
|
322
|
+
function pt(u) {
|
|
323
323
|
const t = Math.PI * 2;
|
|
324
|
-
return (
|
|
324
|
+
return (u % t + t) % t;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
327
|
-
return
|
|
326
|
+
function Ms(u, t, s) {
|
|
327
|
+
return u > t && u < s || u > s && u < t;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
return
|
|
329
|
+
function Ps(u, t, s, e = !1) {
|
|
330
|
+
return u = pt(u), t = pt(t), s = pt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
return
|
|
332
|
+
function Ht(u) {
|
|
333
|
+
return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const s =
|
|
335
|
+
function bs(u, t = 1e-7) {
|
|
336
|
+
const s = Ht(u);
|
|
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: Qt,
|
|
341
|
+
RAD2DEG: Kt,
|
|
342
|
+
generateUUID: hs,
|
|
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: $t,
|
|
345
|
+
mapLinear: as,
|
|
346
|
+
inverseLerp: cs,
|
|
347
|
+
lerp: Wt,
|
|
348
|
+
damp: ls,
|
|
349
|
+
pingpong: us,
|
|
350
|
+
smoothstep: ds,
|
|
351
|
+
smootherstep: ms,
|
|
352
|
+
randInt: xs,
|
|
353
|
+
randFloat: gs,
|
|
354
|
+
randFloatSpread: ys,
|
|
355
|
+
seededRandom: _s,
|
|
356
|
+
degToRad: ps,
|
|
357
|
+
radToDeg: fs,
|
|
358
|
+
isPowerOfTwo: As,
|
|
359
|
+
ceilPowerOfTwo: ws,
|
|
360
|
+
floorPowerOfTwo: zs,
|
|
361
361
|
normalizeAngle: pt,
|
|
362
|
-
isBetween:
|
|
363
|
-
isBetweenAngle:
|
|
364
|
-
intPartLength:
|
|
365
|
-
relativeEps:
|
|
362
|
+
isBetween: Ms,
|
|
363
|
+
isBetweenAngle: Ps,
|
|
364
|
+
intPartLength: Ht,
|
|
365
|
+
relativeEps: bs
|
|
366
366
|
}, tt = class tt {
|
|
367
367
|
constructor(t, s) {
|
|
368
368
|
this.x = 0, this.y = 0;
|
|
@@ -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 *
|
|
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], m = e[2], d = e[5], x = e[8], g = n[0], y = n[3], p = 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 * p + o * b + a * A, i[1] = h * g + c * z + l * P, i[4] = h * y + c * f + l * I, i[7] = h * p + c * b + l * A, i[2] = m * g + d * z + x * P, i[5] = m * y + d * f + x * I, i[8] = m * p + d * 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, m = o * a - c * i, d = h * i - r * a, x = s * l + e * m + n * d;
|
|
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] = m * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - o * s) * g, t[6] = d * 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;
|
|
@@ -693,17 +693,17 @@ const st = class st {
|
|
|
693
693
|
};
|
|
694
694
|
st.IDENTITY = Object.freeze(new st());
|
|
695
695
|
let it = st;
|
|
696
|
-
const Et = new it(),
|
|
696
|
+
const Et = new it(), H = 1e-6, E = 2 * Math.PI, Ls = {
|
|
697
697
|
x: 0,
|
|
698
698
|
y: 0
|
|
699
|
-
},
|
|
699
|
+
}, Jt = {
|
|
700
700
|
x: 0,
|
|
701
701
|
y: 0,
|
|
702
702
|
z: 0
|
|
703
703
|
};
|
|
704
704
|
class bt {
|
|
705
705
|
constructor() {
|
|
706
|
-
this.equalPointTol =
|
|
706
|
+
this.equalPointTol = H, this.equalVectorTol = H;
|
|
707
707
|
}
|
|
708
708
|
clone() {
|
|
709
709
|
const t = new bt();
|
|
@@ -713,275 +713,46 @@ class bt {
|
|
|
713
713
|
return new B(t).sub(s).length() < this.equalPointTol;
|
|
714
714
|
}
|
|
715
715
|
equalPoint3d(t, s) {
|
|
716
|
-
return new
|
|
716
|
+
return new _(t).sub(s).length() < this.equalPointTol;
|
|
717
717
|
}
|
|
718
|
-
static equalToZero(t, s =
|
|
718
|
+
static equalToZero(t, s = H) {
|
|
719
719
|
return t < s && t > -s;
|
|
720
720
|
}
|
|
721
|
-
static equal(t, s, e =
|
|
721
|
+
static equal(t, s, e = H) {
|
|
722
722
|
return Math.abs(t - s) < e;
|
|
723
723
|
}
|
|
724
|
-
static great(t, s, e =
|
|
724
|
+
static great(t, s, e = H) {
|
|
725
725
|
return t - s > e;
|
|
726
726
|
}
|
|
727
|
-
static less(t, s, e =
|
|
727
|
+
static less(t, s, e = H) {
|
|
728
728
|
return t - s < e;
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
|
-
const
|
|
732
|
-
function Wt(m, t, s = !1) {
|
|
733
|
-
const e = m.x, n = m.y;
|
|
734
|
-
let i = !1;
|
|
735
|
-
const r = t.length;
|
|
736
|
-
for (let o = 0, a = r - 1; o < r; a = o++) {
|
|
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);
|
|
740
|
-
}
|
|
741
|
-
return i;
|
|
742
|
-
}
|
|
743
|
-
function zs(m, t) {
|
|
744
|
-
if (m.length === 0 || t.length === 0)
|
|
745
|
-
return !1;
|
|
746
|
-
const s = new X().setFromPoints(m), e = new X().setFromPoints(t);
|
|
747
|
-
if (!s.intersectsBox(e))
|
|
748
|
-
return !1;
|
|
749
|
-
for (let n = 0; n < m.length; ) {
|
|
750
|
-
if (Wt(m[n], t, !0))
|
|
751
|
-
return !0;
|
|
752
|
-
n < m.length - 1 && $t.equalPoint2d(m[n + 1], m[n]) && ++n, ++n;
|
|
753
|
-
}
|
|
754
|
-
return !1;
|
|
755
|
-
}
|
|
756
|
-
const ws = {
|
|
757
|
-
isPointInPolygon: Wt,
|
|
758
|
-
isPolygonIntersect: zs
|
|
759
|
-
};
|
|
760
|
-
function Ns(m, t) {
|
|
761
|
-
const s = [], e = t - 1, n = m;
|
|
762
|
-
for (let i = 0; i <= n; i++)
|
|
763
|
-
s.push(0);
|
|
764
|
-
for (let i = 1; i <= e - n; i++)
|
|
765
|
-
s.push(i);
|
|
766
|
-
for (let i = 0; i <= n; i++)
|
|
767
|
-
s.push(e - n + 1);
|
|
768
|
-
return s;
|
|
769
|
-
}
|
|
770
|
-
function Ts(m, t) {
|
|
771
|
-
const s = t.length - 1, e = m, n = [0];
|
|
772
|
-
let i = 0;
|
|
773
|
-
for (let o = 1; o <= s; o++) {
|
|
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);
|
|
775
|
-
i += l, n.push(i);
|
|
776
|
-
}
|
|
777
|
-
const r = [];
|
|
778
|
-
for (let o = 0; o <= e; o++)
|
|
779
|
-
r.push(0);
|
|
780
|
-
for (let o = 1; o <= s - e; o++) {
|
|
781
|
-
const a = n[o] / i;
|
|
782
|
-
r.push(a * (s - e + 1));
|
|
783
|
-
}
|
|
784
|
-
for (let o = 0; o <= e; o++)
|
|
785
|
-
r.push(s - e + 1);
|
|
786
|
-
return r;
|
|
787
|
-
}
|
|
788
|
-
function Ms(m, t = "Uniform") {
|
|
789
|
-
const s = m.length;
|
|
790
|
-
if (s === 0)
|
|
791
|
-
return [];
|
|
792
|
-
if (s === 1)
|
|
793
|
-
return [0];
|
|
794
|
-
const e = s - 1;
|
|
795
|
-
if (t === "Uniform")
|
|
796
|
-
return new Array(s).fill(0).map((r, o) => o / e);
|
|
797
|
-
const n = [0];
|
|
798
|
-
let i = 0;
|
|
799
|
-
for (let r = 1; r <= e; r++) {
|
|
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;
|
|
801
|
-
i += l, n.push(i);
|
|
802
|
-
}
|
|
803
|
-
return i < 1e-12 ? new Array(s).fill(0).map((r, o) => o / e) : n.map((r) => r / i);
|
|
804
|
-
}
|
|
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];
|
|
807
|
-
for (let o = n - e; o <= n; o++)
|
|
808
|
-
i[o] = r;
|
|
809
|
-
for (let o = 1; o <= s - e; o++) {
|
|
810
|
-
let a = 0;
|
|
811
|
-
for (let h = o; h < o + e; h++)
|
|
812
|
-
a += t[h];
|
|
813
|
-
i[o + e] = a / e;
|
|
814
|
-
}
|
|
815
|
-
return i;
|
|
816
|
-
}
|
|
817
|
-
function js(m, t) {
|
|
818
|
-
const s = t.length - 1, e = m, n = [0];
|
|
819
|
-
let i = 0;
|
|
820
|
-
for (let o = 1; o <= s; o++) {
|
|
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);
|
|
823
|
-
}
|
|
824
|
-
const r = [];
|
|
825
|
-
for (let o = 0; o <= e; o++)
|
|
826
|
-
r.push(0);
|
|
827
|
-
for (let o = 1; o <= s - e; o++) {
|
|
828
|
-
const a = n[o] / i;
|
|
829
|
-
r.push(a * (s - e + 1));
|
|
830
|
-
}
|
|
831
|
-
for (let o = 0; o <= e; o++)
|
|
832
|
-
r.push(s - e + 1);
|
|
833
|
-
return r;
|
|
834
|
-
}
|
|
835
|
-
function It(m, t) {
|
|
836
|
-
const s = m.length, e = m.map((r) => r.slice()), n = t.slice();
|
|
837
|
-
for (let r = 0; r < s; r++) {
|
|
838
|
-
let o = r, a = Math.abs(e[r][r]);
|
|
839
|
-
for (let h = r + 1; h < s; h++) {
|
|
840
|
-
const c = Math.abs(e[h][r]);
|
|
841
|
-
c > a && (a = c, o = h);
|
|
842
|
-
}
|
|
843
|
-
if (a < 1e-12)
|
|
844
|
-
throw new Error("Interpolation matrix is singular.");
|
|
845
|
-
if (o !== r) {
|
|
846
|
-
const h = e[r];
|
|
847
|
-
e[r] = e[o], e[o] = h;
|
|
848
|
-
const c = n[r];
|
|
849
|
-
n[r] = n[o], n[o] = c;
|
|
850
|
-
}
|
|
851
|
-
for (let h = r + 1; h < s; h++) {
|
|
852
|
-
const c = e[h][r] / e[r][r];
|
|
853
|
-
if (!(Math.abs(c) < 1e-14)) {
|
|
854
|
-
for (let l = r; l < s; l++)
|
|
855
|
-
e[h][l] -= c * e[r][l];
|
|
856
|
-
n[h] -= c * n[r];
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
const i = new Array(s).fill(0);
|
|
861
|
-
for (let r = s - 1; r >= 0; r--) {
|
|
862
|
-
let o = n[r];
|
|
863
|
-
for (let a = r + 1; a < s; a++)
|
|
864
|
-
o -= e[r][a] * i[a];
|
|
865
|
-
i[r] = o / e[r][r];
|
|
866
|
-
}
|
|
867
|
-
return i;
|
|
868
|
-
}
|
|
869
|
-
function Ht(m, t, s = "Uniform", e, n) {
|
|
870
|
-
if (m.length === 0)
|
|
871
|
-
return { controlPoints: [], knots: [], weights: [] };
|
|
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;
|
|
873
|
-
if (c < t)
|
|
874
|
-
throw new Error("Not enough points to interpolate a curve of this degree.");
|
|
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);
|
|
878
|
-
let f = 0;
|
|
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++;
|
|
880
|
-
for (let C = 1; C <= h - 1; C++) {
|
|
881
|
-
const j = l[C];
|
|
882
|
-
g[f] = new Array(x).fill(0);
|
|
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++;
|
|
886
|
-
}
|
|
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) {
|
|
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++;
|
|
890
|
-
}
|
|
891
|
-
if (o) {
|
|
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++;
|
|
894
|
-
}
|
|
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]];
|
|
898
|
-
const k = new Array(x).fill(1);
|
|
899
|
-
return { controlPoints: A, knots: u, weights: k };
|
|
900
|
-
}
|
|
901
|
-
function wt(m, t, s, e) {
|
|
902
|
-
if (t === 0)
|
|
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);
|
|
906
|
-
}
|
|
907
|
-
function ft(m, t, s, e, n) {
|
|
908
|
-
const i = e.length - 1, r = t;
|
|
909
|
-
if (m = Math.max(s[r], Math.min(s[i + 1], m)), Math.abs(m - s[i + 1]) < 1e-8)
|
|
910
|
-
return [...e[i]];
|
|
911
|
-
if (Math.abs(m - s[r]) < 1e-8)
|
|
912
|
-
return [...e[0]];
|
|
913
|
-
const o = [0, 0, 0];
|
|
914
|
-
let a = 0;
|
|
915
|
-
for (let h = 0; h <= i; h++) {
|
|
916
|
-
const c = wt(h, r, m, s), l = n[h] * c;
|
|
917
|
-
o[0] += e[h][0] * l, o[1] += e[h][1] * l, o[2] += e[h][2] * l, a += l;
|
|
918
|
-
}
|
|
919
|
-
if (Math.abs(a) < 1e-10) {
|
|
920
|
-
const h = s[s.length - r - 1];
|
|
921
|
-
if (Math.abs(m - h) < 1e-8)
|
|
922
|
-
return [...e[i]];
|
|
923
|
-
if (Math.abs(m - s[r]) < 1e-8)
|
|
924
|
-
return [...e[0]];
|
|
925
|
-
}
|
|
926
|
-
return Math.abs(a) >= 1e-10 && (o[0] /= a, o[1] /= a, o[2] /= a), o;
|
|
927
|
-
}
|
|
928
|
-
function bs(m, t, s, e) {
|
|
929
|
-
const n = m, i = t[n], r = t[t.length - n - 1];
|
|
930
|
-
let o = 0;
|
|
931
|
-
const a = 1e3, h = (r - i) / a;
|
|
932
|
-
let c = ft(
|
|
933
|
-
i,
|
|
934
|
-
m,
|
|
935
|
-
t,
|
|
936
|
-
s,
|
|
937
|
-
e
|
|
938
|
-
);
|
|
939
|
-
for (let g = 1; g <= a; g++) {
|
|
940
|
-
const y = i + g * h, _ = ft(y, m, t, s, e), z = _[0] - c[0], f = _[1] - c[1], b = _[2] - c[2];
|
|
941
|
-
o += Math.sqrt(z * z + f * f + b * b), c = _;
|
|
942
|
-
}
|
|
943
|
-
const l = ft(
|
|
944
|
-
r,
|
|
945
|
-
m,
|
|
946
|
-
t,
|
|
947
|
-
s,
|
|
948
|
-
e
|
|
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;
|
|
951
|
-
}
|
|
952
|
-
function Vs(m, t = 3, s = "Uniform", e, n) {
|
|
953
|
-
return m.length === 0 ? [] : Ht(
|
|
954
|
-
m,
|
|
955
|
-
t,
|
|
956
|
-
s,
|
|
957
|
-
e,
|
|
958
|
-
n
|
|
959
|
-
).controlPoints;
|
|
960
|
-
}
|
|
731
|
+
const Gt = new bt();
|
|
961
732
|
class St {
|
|
962
733
|
constructor(t = 0, s = 0, e = 0, n = 1) {
|
|
963
734
|
this._x = t, this._y = s, this._z = e, this._w = n;
|
|
964
735
|
}
|
|
965
736
|
static slerpFlat(t, s, e, n, i, r, o) {
|
|
966
737
|
let a = e[n + 0], h = e[n + 1], c = e[n + 2], l = e[n + 3];
|
|
967
|
-
const
|
|
738
|
+
const m = i[r + 0], d = i[r + 1], x = i[r + 2], g = i[r + 3];
|
|
968
739
|
if (o === 0) {
|
|
969
740
|
t[s + 0] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
970
741
|
return;
|
|
971
742
|
}
|
|
972
743
|
if (o === 1) {
|
|
973
|
-
t[s + 0] =
|
|
744
|
+
t[s + 0] = m, t[s + 1] = d, t[s + 2] = x, t[s + 3] = g;
|
|
974
745
|
return;
|
|
975
746
|
}
|
|
976
|
-
if (l !== g || a !==
|
|
747
|
+
if (l !== g || a !== m || h !== d || c !== x) {
|
|
977
748
|
let y = 1 - o;
|
|
978
|
-
const
|
|
749
|
+
const p = a * m + h * d + c * x + l * g, z = p >= 0 ? 1 : -1, f = 1 - p * p;
|
|
979
750
|
if (f > Number.EPSILON) {
|
|
980
|
-
const P = Math.sqrt(f), I = Math.atan2(P,
|
|
751
|
+
const P = Math.sqrt(f), I = Math.atan2(P, p * z);
|
|
981
752
|
y = Math.sin(y * I) / P, o = Math.sin(o * I) / P;
|
|
982
753
|
}
|
|
983
754
|
const b = o * z;
|
|
984
|
-
if (a = a * y +
|
|
755
|
+
if (a = a * y + m * b, h = h * y + d * b, c = c * y + x * b, l = l * y + g * b, y === 1 - o) {
|
|
985
756
|
const P = 1 / Math.sqrt(a * a + h * h + c * c + l * l);
|
|
986
757
|
a *= P, h *= P, c *= P, l *= P;
|
|
987
758
|
}
|
|
@@ -989,8 +760,8 @@ class St {
|
|
|
989
760
|
t[s] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
990
761
|
}
|
|
991
762
|
static multiplyQuaternionsFlat(t, s, e, n, i, r) {
|
|
992
|
-
const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r],
|
|
993
|
-
return t[s] = o * x + c * l + a *
|
|
763
|
+
const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r], m = i[r + 1], d = i[r + 2], x = i[r + 3];
|
|
764
|
+
return t[s] = o * x + c * l + a * d - h * m, t[s + 1] = a * x + c * m + h * l - o * d, t[s + 2] = h * x + c * d + o * m - a * l, t[s + 3] = c * x - o * l - a * m - h * d, t;
|
|
994
765
|
}
|
|
995
766
|
get x() {
|
|
996
767
|
return this._x;
|
|
@@ -1026,25 +797,25 @@ class St {
|
|
|
1026
797
|
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
1027
798
|
}
|
|
1028
799
|
setFromEuler(t, s = !0) {
|
|
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),
|
|
800
|
+
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), m = a(e / 2), d = a(n / 2), x = a(i / 2);
|
|
1030
801
|
switch (r) {
|
|
1031
802
|
case "XYZ":
|
|
1032
|
-
this._x =
|
|
803
|
+
this._x = m * c * l + h * d * x, this._y = h * d * l - m * c * x, this._z = h * c * x + m * d * l, this._w = h * c * l - m * d * x;
|
|
1033
804
|
break;
|
|
1034
805
|
case "YXZ":
|
|
1035
|
-
this._x =
|
|
806
|
+
this._x = m * c * l + h * d * x, this._y = h * d * l - m * c * x, this._z = h * c * x - m * d * l, this._w = h * c * l + m * d * x;
|
|
1036
807
|
break;
|
|
1037
808
|
case "ZXY":
|
|
1038
|
-
this._x =
|
|
809
|
+
this._x = m * c * l - h * d * x, this._y = h * d * l + m * c * x, this._z = h * c * x + m * d * l, this._w = h * c * l - m * d * x;
|
|
1039
810
|
break;
|
|
1040
811
|
case "ZYX":
|
|
1041
|
-
this._x =
|
|
812
|
+
this._x = m * c * l - h * d * x, this._y = h * d * l + m * c * x, this._z = h * c * x - m * d * l, this._w = h * c * l + m * d * x;
|
|
1042
813
|
break;
|
|
1043
814
|
case "YZX":
|
|
1044
|
-
this._x =
|
|
815
|
+
this._x = m * c * l + h * d * x, this._y = h * d * l + m * c * x, this._z = h * c * x - m * d * l, this._w = h * c * l - m * d * x;
|
|
1045
816
|
break;
|
|
1046
817
|
case "XZY":
|
|
1047
|
-
this._x =
|
|
818
|
+
this._x = m * c * l - h * d * x, this._y = h * d * l - m * c * x, this._z = h * c * x + m * d * l, this._w = h * c * l + m * d * x;
|
|
1048
819
|
break;
|
|
1049
820
|
}
|
|
1050
821
|
return s === !0 && this._onChangeCallback(), this;
|
|
@@ -1054,19 +825,19 @@ class St {
|
|
|
1054
825
|
return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(e), this._onChangeCallback(), this;
|
|
1055
826
|
}
|
|
1056
827
|
setFromRotationMatrix(t) {
|
|
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],
|
|
1058
|
-
if (
|
|
1059
|
-
const
|
|
1060
|
-
this._w = 0.25 /
|
|
828
|
+
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], m = e + o + l;
|
|
829
|
+
if (m > 0) {
|
|
830
|
+
const d = 0.5 / Math.sqrt(m + 1);
|
|
831
|
+
this._w = 0.25 / d, this._x = (c - a) * d, this._y = (i - h) * d, this._z = (r - n) * d;
|
|
1061
832
|
} else if (e > o && e > l) {
|
|
1062
|
-
const
|
|
1063
|
-
this._w = (c - a) /
|
|
833
|
+
const d = 2 * Math.sqrt(1 + e - o - l);
|
|
834
|
+
this._w = (c - a) / d, this._x = 0.25 * d, this._y = (n + r) / d, this._z = (i + h) / d;
|
|
1064
835
|
} else if (o > l) {
|
|
1065
|
-
const
|
|
1066
|
-
this._w = (i - h) /
|
|
836
|
+
const d = 2 * Math.sqrt(1 + o - e - l);
|
|
837
|
+
this._w = (i - h) / d, this._x = (n + r) / d, this._y = 0.25 * d, this._z = (a + c) / d;
|
|
1067
838
|
} else {
|
|
1068
|
-
const
|
|
1069
|
-
this._w = (r - n) /
|
|
839
|
+
const d = 2 * Math.sqrt(1 + l - e - o);
|
|
840
|
+
this._w = (r - n) / d, this._x = (i + h) / d, this._y = (a + c) / d, this._z = 0.25 * d;
|
|
1070
841
|
}
|
|
1071
842
|
return this._onChangeCallback(), this;
|
|
1072
843
|
}
|
|
@@ -1126,11 +897,11 @@ class St {
|
|
|
1126
897
|
return this._w = r, this._x = e, this._y = n, this._z = i, this;
|
|
1127
898
|
const a = 1 - o * o;
|
|
1128
899
|
if (a <= Number.EPSILON) {
|
|
1129
|
-
const
|
|
1130
|
-
return this._w =
|
|
900
|
+
const d = 1 - s;
|
|
901
|
+
return this._w = d * r + s * this._w, this._x = d * e + s * this._x, this._y = d * n + s * this._y, this._z = d * i + s * this._z, this.normalize(), this;
|
|
1131
902
|
}
|
|
1132
|
-
const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h,
|
|
1133
|
-
return this._w = r * l + this._w *
|
|
903
|
+
const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h, m = Math.sin(s * c) / h;
|
|
904
|
+
return this._w = r * l + this._w * m, this._x = e * l + this._x * m, this._y = n * l + this._y * m, this._z = i * l + this._z * m, this._onChangeCallback(), this;
|
|
1134
905
|
}
|
|
1135
906
|
slerpQuaternions(t, s, e) {
|
|
1136
907
|
return this.copy(t).slerp(s, e);
|
|
@@ -1266,10 +1037,10 @@ const R = class R {
|
|
|
1266
1037
|
return this.x = t.x * s.x, this.y = t.y * s.y, this.z = t.z * s.z, this;
|
|
1267
1038
|
}
|
|
1268
1039
|
applyEuler(t) {
|
|
1269
|
-
return this.applyQuaternion(
|
|
1040
|
+
return this.applyQuaternion(Vt.setFromEuler(t));
|
|
1270
1041
|
}
|
|
1271
1042
|
applyAxisAngle(t, s) {
|
|
1272
|
-
return this.applyQuaternion(
|
|
1043
|
+
return this.applyQuaternion(Vt.setFromAxisAngle(t, s));
|
|
1273
1044
|
}
|
|
1274
1045
|
applyMatrix3(t) {
|
|
1275
1046
|
const s = this.x, e = this.y, n = this.z, i = t.elements;
|
|
@@ -1371,10 +1142,10 @@ const R = class R {
|
|
|
1371
1142
|
return this.copy(t).multiplyScalar(e);
|
|
1372
1143
|
}
|
|
1373
1144
|
projectOnPlane(t) {
|
|
1374
|
-
return
|
|
1145
|
+
return It.copy(this).projectOnVector(t), this.sub(It);
|
|
1375
1146
|
}
|
|
1376
1147
|
reflect(t) {
|
|
1377
|
-
return this.sub(
|
|
1148
|
+
return this.sub(It.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
1378
1149
|
}
|
|
1379
1150
|
angleTo(t) {
|
|
1380
1151
|
const s = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
@@ -1427,10 +1198,10 @@ const R = class R {
|
|
|
1427
1198
|
}
|
|
1428
1199
|
};
|
|
1429
1200
|
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));
|
|
1430
|
-
let
|
|
1431
|
-
const
|
|
1432
|
-
constructor(t, s, e, n, i, r, o, a, h, c, l,
|
|
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 &&
|
|
1201
|
+
let _ = R;
|
|
1202
|
+
const It = new _(), Vt = new St(), et = class et {
|
|
1203
|
+
constructor(t, s, e, n, i, r, o, a, h, c, l, m, d, x, g, y) {
|
|
1204
|
+
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 && m != null && d != null && x != null && g != null && y != null && this.set(
|
|
1434
1205
|
t,
|
|
1435
1206
|
s,
|
|
1436
1207
|
e,
|
|
@@ -1442,16 +1213,16 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1442
1213
|
h,
|
|
1443
1214
|
c,
|
|
1444
1215
|
l,
|
|
1216
|
+
m,
|
|
1445
1217
|
d,
|
|
1446
|
-
u,
|
|
1447
1218
|
x,
|
|
1448
1219
|
g,
|
|
1449
1220
|
y
|
|
1450
1221
|
);
|
|
1451
1222
|
}
|
|
1452
|
-
set(t, s, e, n, i, r, o, a, h, c, l,
|
|
1453
|
-
const
|
|
1454
|
-
return
|
|
1223
|
+
set(t, s, e, n, i, r, o, a, h, c, l, m, d, x, g, y) {
|
|
1224
|
+
const p = this.elements;
|
|
1225
|
+
return p[0] = t, p[4] = s, p[8] = e, p[12] = n, p[1] = i, p[5] = r, p[9] = o, p[13] = a, p[2] = h, p[6] = c, p[10] = l, p[14] = m, p[3] = d, p[7] = x, p[11] = g, p[15] = y, this;
|
|
1455
1226
|
}
|
|
1456
1227
|
identity() {
|
|
1457
1228
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
@@ -1489,11 +1260,11 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1489
1260
|
), this;
|
|
1490
1261
|
}
|
|
1491
1262
|
setFromExtrusionDirection(t) {
|
|
1492
|
-
if (
|
|
1263
|
+
if (Gt.equalPoint3d(t, _.Z_AXIS))
|
|
1493
1264
|
this.identity();
|
|
1494
1265
|
else {
|
|
1495
|
-
const s = new
|
|
1496
|
-
Math.abs(t.x) < 1 / 64 && Math.abs(t.y) < 1 / 64 ? s.crossVectors(
|
|
1266
|
+
const s = new _(1, 0, 0);
|
|
1267
|
+
Math.abs(t.x) < 1 / 64 && Math.abs(t.y) < 1 / 64 ? s.crossVectors(_.Y_AXIS, t).normalize() : s.crossVectors(_.Z_AXIS, t).normalize();
|
|
1497
1268
|
const e = t.clone().cross(s).normalize();
|
|
1498
1269
|
this.set(
|
|
1499
1270
|
s.x,
|
|
@@ -1540,7 +1311,7 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1540
1311
|
), this;
|
|
1541
1312
|
}
|
|
1542
1313
|
extractRotation(t) {
|
|
1543
|
-
const s = this.elements, e = t.elements, n = 1 /
|
|
1314
|
+
const s = this.elements, e = t.elements, n = 1 / J.setFromMatrixColumn(t, 0).length(), i = 1 / J.setFromMatrixColumn(t, 1).length(), r = 1 / J.setFromMatrixColumn(t, 2).length();
|
|
1544
1315
|
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;
|
|
1545
1316
|
}
|
|
1546
1317
|
makeRotationFromQuaternion(t) {
|
|
@@ -1557,16 +1328,16 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1557
1328
|
return this.multiplyMatrices(t, this);
|
|
1558
1329
|
}
|
|
1559
1330
|
multiplyMatrices(t, s) {
|
|
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],
|
|
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 *
|
|
1331
|
+
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], m = e[9], d = e[13], x = e[2], g = e[6], y = e[10], p = 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], W = 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];
|
|
1332
|
+
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 * W + a * lt + h * xt, i[12] = r * C + o * ht + a * ut + h * gt, i[1] = c * I + l * j + m * at + d * dt, i[5] = c * A + l * q + m * ct + d * mt, i[9] = c * k + l * W + m * lt + d * xt, i[13] = c * C + l * ht + m * ut + d * gt, i[2] = x * I + g * j + y * at + p * dt, i[6] = x * A + g * q + y * ct + p * mt, i[10] = x * k + g * W + y * lt + p * xt, i[14] = x * C + g * ht + y * ut + p * 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 * W + b * lt + P * xt, i[15] = z * C + f * ht + b * ut + P * gt, this;
|
|
1562
1333
|
}
|
|
1563
1334
|
multiplyScalar(t) {
|
|
1564
1335
|
const s = this.elements;
|
|
1565
1336
|
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;
|
|
1566
1337
|
}
|
|
1567
1338
|
determinant() {
|
|
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],
|
|
1569
|
-
return x * (+i * a * l - n * h * l - i * o *
|
|
1339
|
+
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], m = t[10], d = t[14], x = t[3], g = t[7], y = t[11], p = t[15];
|
|
1340
|
+
return x * (+i * a * l - n * h * l - i * o * m + e * h * m + n * o * d - e * a * d) + g * (+s * a * d - s * h * m + i * r * m - n * r * d + n * h * c - i * a * c) + y * (+s * h * l - s * o * d - i * r * l + e * r * d + i * o * c - e * h * c) + p * (-n * o * c - s * a * l + s * o * m + n * r * l - e * r * m + e * a * c);
|
|
1570
1341
|
}
|
|
1571
1342
|
transpose() {
|
|
1572
1343
|
const t = this.elements;
|
|
@@ -1575,14 +1346,14 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1575
1346
|
}
|
|
1576
1347
|
setPosition(t, s, e) {
|
|
1577
1348
|
const n = this.elements;
|
|
1578
|
-
return t instanceof
|
|
1349
|
+
return t instanceof _ ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
|
|
1579
1350
|
}
|
|
1580
1351
|
invert() {
|
|
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],
|
|
1352
|
+
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], m = t[10], d = t[11], x = t[12], g = t[13], y = t[14], p = t[15], z = l * y * h - g * m * h + g * a * d - o * y * d - l * a * p + o * m * p, f = x * m * h - c * y * h - x * a * d + r * y * d + c * a * p - r * m * p, b = c * g * h - x * l * h + x * o * d - r * g * d - c * o * p + r * l * p, P = x * l * a - c * g * a - x * o * m + r * g * m + c * o * y - r * l * y, I = s * z + e * f + n * b + i * P;
|
|
1582
1353
|
if (I === 0)
|
|
1583
1354
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1584
1355
|
const A = 1 / I;
|
|
1585
|
-
return t[0] = z * A, t[1] = (g *
|
|
1356
|
+
return t[0] = z * A, t[1] = (g * m * i - l * y * i - g * n * d + e * y * d + l * n * p - e * m * p) * A, t[2] = (o * y * i - g * a * i + g * n * h - e * y * h - o * n * p + e * a * p) * A, t[3] = (l * a * i - o * m * i - l * n * h + e * m * h + o * n * d - e * a * d) * A, t[4] = f * A, t[5] = (c * y * i - x * m * i + x * n * d - s * y * d - c * n * p + s * m * p) * A, t[6] = (x * a * i - r * y * i - x * n * h + s * y * h + r * n * p - s * a * p) * A, t[7] = (r * m * i - c * a * i + c * n * h - s * m * h - r * n * d + s * a * d) * A, t[8] = b * A, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * p - s * l * p) * A, t[10] = (r * g * i - x * o * i + x * e * h - s * g * h - r * e * p + s * o * p) * A, t[11] = (c * o * i - r * l * i - c * e * h + s * l * h + r * e * d - s * o * d) * A, t[12] = P * A, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - 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 * m + s * o * m) * A, this;
|
|
1586
1357
|
}
|
|
1587
1358
|
scale(t) {
|
|
1588
1359
|
const s = this.elements, e = t.x, n = t.y, i = t.z;
|
|
@@ -1593,7 +1364,7 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1593
1364
|
return Math.sqrt(Math.max(s, e, n));
|
|
1594
1365
|
}
|
|
1595
1366
|
makeTranslation(t, s, e) {
|
|
1596
|
-
return t instanceof
|
|
1367
|
+
return t instanceof _ ? this.set(1, 0, 0, t.x, 0, 1, 0, t.y, 0, 0, 1, t.z, 0, 0, 0, 1) : this.set(1, 0, 0, t, 0, 1, 0, s, 0, 0, 1, e, 0, 0, 0, 1), this;
|
|
1597
1368
|
}
|
|
1598
1369
|
makeRotationX(t) {
|
|
1599
1370
|
const s = Math.cos(t), e = Math.sin(t);
|
|
@@ -1635,13 +1406,13 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1635
1406
|
return this.set(1, e, i, 0, t, 1, r, 0, s, n, 1, 0, 0, 0, 0, 1), this;
|
|
1636
1407
|
}
|
|
1637
1408
|
compose(t, s, e) {
|
|
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,
|
|
1639
|
-
return n[0] = (1 - (g +
|
|
1409
|
+
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, m = i * h, d = i * c, x = i * l, g = r * c, y = r * l, p = o * l, z = a * h, f = a * c, b = a * l, P = e.x, I = e.y, A = e.z;
|
|
1410
|
+
return n[0] = (1 - (g + p)) * P, n[1] = (d + b) * P, n[2] = (x - f) * P, n[3] = 0, n[4] = (d - b) * I, n[5] = (1 - (m + p)) * I, n[6] = (y + z) * I, n[7] = 0, n[8] = (x + f) * A, n[9] = (y - z) * A, n[10] = (1 - (m + g)) * A, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
|
|
1640
1411
|
}
|
|
1641
1412
|
decompose(t, s, e) {
|
|
1642
1413
|
const n = this.elements;
|
|
1643
|
-
let i =
|
|
1644
|
-
const r =
|
|
1414
|
+
let i = J.set(n[0], n[1], n[2]).length();
|
|
1415
|
+
const r = J.set(n[4], n[5], n[6]).length(), o = J.set(n[8], n[9], n[10]).length();
|
|
1645
1416
|
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], L.copy(this);
|
|
1646
1417
|
const h = 1 / i, c = 1 / r, l = 1 / o;
|
|
1647
1418
|
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;
|
|
@@ -1663,11 +1434,11 @@ const Bt = new p(), jt = new St(), et = class et {
|
|
|
1663
1434
|
}
|
|
1664
1435
|
};
|
|
1665
1436
|
et.IDENTITY = Object.freeze(new et());
|
|
1666
|
-
let
|
|
1667
|
-
const
|
|
1668
|
-
class
|
|
1437
|
+
let O = et;
|
|
1438
|
+
const J = new _(), L = new O(), Ss = new _(0, 0, 0), Cs = new _(1, 1, 1), Y = new _(), yt = new _(), V = new _();
|
|
1439
|
+
class v {
|
|
1669
1440
|
constructor(t = void 0, s = void 0) {
|
|
1670
|
-
this.min = t == null ? new
|
|
1441
|
+
this.min = t == null ? new _(1 / 0, 1 / 0, 1 / 0) : new _(t.x, t.y, t.z), this.max = s == null ? new _(-1 / 0, -1 / 0, -1 / 0) : new _(s.x, s.y, s.z);
|
|
1671
1442
|
}
|
|
1672
1443
|
set(t, s) {
|
|
1673
1444
|
return this.min.copy(t), this.max.copy(s), this;
|
|
@@ -1675,7 +1446,7 @@ class D {
|
|
|
1675
1446
|
setFromArray(t) {
|
|
1676
1447
|
this.makeEmpty();
|
|
1677
1448
|
for (let s = 0, e = t.length; s < e; s += 3)
|
|
1678
|
-
this.expandByPoint(
|
|
1449
|
+
this.expandByPoint(Bt.fromArray(t, s));
|
|
1679
1450
|
return this;
|
|
1680
1451
|
}
|
|
1681
1452
|
setFromPoints(t) {
|
|
@@ -1685,11 +1456,11 @@ class D {
|
|
|
1685
1456
|
return this;
|
|
1686
1457
|
}
|
|
1687
1458
|
setFromCenterAndSize(t, s) {
|
|
1688
|
-
const e =
|
|
1459
|
+
const e = Bt.copy(s).multiplyScalar(0.5);
|
|
1689
1460
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
|
1690
1461
|
}
|
|
1691
1462
|
clone() {
|
|
1692
|
-
return new
|
|
1463
|
+
return new v().copy(this);
|
|
1693
1464
|
}
|
|
1694
1465
|
copy(t) {
|
|
1695
1466
|
return this.min.copy(t.min), this.max.copy(t.max), this;
|
|
@@ -1707,10 +1478,10 @@ class D {
|
|
|
1707
1478
|
return this.isEmpty() ? t.set(0, 0, 0) : t.subVectors(this.max, this.min);
|
|
1708
1479
|
}
|
|
1709
1480
|
get center() {
|
|
1710
|
-
return this.isEmpty() ? new
|
|
1481
|
+
return this.isEmpty() ? new _(0, 0, 0) : new _(0, 0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
|
|
1711
1482
|
}
|
|
1712
1483
|
get size() {
|
|
1713
|
-
return this.isEmpty() ? new
|
|
1484
|
+
return this.isEmpty() ? new _(0, 0, 0) : new _(0, 0, 0).subVectors(this.max, this.min);
|
|
1714
1485
|
}
|
|
1715
1486
|
expandByPoint(t) {
|
|
1716
1487
|
return this.min.min(t), this.max.max(t), this;
|
|
@@ -1745,7 +1516,7 @@ class D {
|
|
|
1745
1516
|
return s.copy(t).clamp(this.min, this.max);
|
|
1746
1517
|
}
|
|
1747
1518
|
distanceToPoint(t) {
|
|
1748
|
-
return this.clampPoint(t,
|
|
1519
|
+
return this.clampPoint(t, Bt).distanceTo(t);
|
|
1749
1520
|
}
|
|
1750
1521
|
intersect(t) {
|
|
1751
1522
|
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
|
|
@@ -1754,7 +1525,7 @@ class D {
|
|
|
1754
1525
|
return this.min.min(t.min), this.max.max(t.max), this;
|
|
1755
1526
|
}
|
|
1756
1527
|
applyMatrix4(t) {
|
|
1757
|
-
return this.isEmpty() ? this : (
|
|
1528
|
+
return this.isEmpty() ? this : (D[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), D[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), D[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), D[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), D[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), D[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), D[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), D[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(D), this);
|
|
1758
1529
|
}
|
|
1759
1530
|
translate(t) {
|
|
1760
1531
|
return this.min.add(t), this.max.add(t), this;
|
|
@@ -1763,16 +1534,16 @@ class D {
|
|
|
1763
1534
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1764
1535
|
}
|
|
1765
1536
|
}
|
|
1766
|
-
const
|
|
1767
|
-
new
|
|
1768
|
-
new
|
|
1769
|
-
new
|
|
1770
|
-
new
|
|
1771
|
-
new
|
|
1772
|
-
new
|
|
1773
|
-
new
|
|
1774
|
-
new
|
|
1775
|
-
],
|
|
1537
|
+
const D = [
|
|
1538
|
+
new _(),
|
|
1539
|
+
new _(),
|
|
1540
|
+
new _(),
|
|
1541
|
+
new _(),
|
|
1542
|
+
new _(),
|
|
1543
|
+
new _(),
|
|
1544
|
+
new _(),
|
|
1545
|
+
new _()
|
|
1546
|
+
], Bt = new _(), qt = new B();
|
|
1776
1547
|
class X {
|
|
1777
1548
|
constructor(t = void 0, s = void 0) {
|
|
1778
1549
|
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);
|
|
@@ -1787,7 +1558,7 @@ class X {
|
|
|
1787
1558
|
return this;
|
|
1788
1559
|
}
|
|
1789
1560
|
setFromCenterAndSize(t, s) {
|
|
1790
|
-
const e =
|
|
1561
|
+
const e = qt.copy(s).multiplyScalar(0.5);
|
|
1791
1562
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
|
1792
1563
|
}
|
|
1793
1564
|
clone() {
|
|
@@ -1842,7 +1613,7 @@ class X {
|
|
|
1842
1613
|
return s.copy(t).clamp(this.min, this.max);
|
|
1843
1614
|
}
|
|
1844
1615
|
distanceToPoint(t) {
|
|
1845
|
-
return this.clampPoint(t,
|
|
1616
|
+
return this.clampPoint(t, qt).distanceTo(t);
|
|
1846
1617
|
}
|
|
1847
1618
|
intersect(t) {
|
|
1848
1619
|
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
|
|
@@ -1857,9 +1628,9 @@ class X {
|
|
|
1857
1628
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1858
1629
|
}
|
|
1859
1630
|
}
|
|
1860
|
-
const
|
|
1631
|
+
const Ut = new _(), Es = new _(), Is = new it();
|
|
1861
1632
|
class Ct {
|
|
1862
|
-
constructor(t = new
|
|
1633
|
+
constructor(t = new _(1, 0, 0), s = 0) {
|
|
1863
1634
|
this.normal = t, this.constant = s;
|
|
1864
1635
|
}
|
|
1865
1636
|
set(t, s) {
|
|
@@ -1872,7 +1643,7 @@ class Ct {
|
|
|
1872
1643
|
return this.normal.copy(t), this.constant = -s.dot(this.normal), this;
|
|
1873
1644
|
}
|
|
1874
1645
|
setFromCoplanarPoints(t, s, e) {
|
|
1875
|
-
const n =
|
|
1646
|
+
const n = Ut.subVectors(e, s).cross(Es.subVectors(t, s)).normalize();
|
|
1876
1647
|
return this.setFromNormalAndCoplanarPoint(n, t), this;
|
|
1877
1648
|
}
|
|
1878
1649
|
copy(t) {
|
|
@@ -1898,7 +1669,7 @@ class Ct {
|
|
|
1898
1669
|
return t.copy(this.normal).multiplyScalar(-this.constant);
|
|
1899
1670
|
}
|
|
1900
1671
|
applyMatrix4(t, s) {
|
|
1901
|
-
const e = s || Is.getNormalMatrix(t), n = this.coplanarPoint(
|
|
1672
|
+
const e = s || Is.getNormalMatrix(t), n = this.coplanarPoint(Ut).applyMatrix4(t), i = this.normal.applyMatrix3(e).normalize();
|
|
1902
1673
|
return this.constant = -n.dot(i), this;
|
|
1903
1674
|
}
|
|
1904
1675
|
translate(t) {
|
|
@@ -1922,7 +1693,7 @@ class S extends B {
|
|
|
1922
1693
|
}), s;
|
|
1923
1694
|
}
|
|
1924
1695
|
}
|
|
1925
|
-
class w extends
|
|
1696
|
+
class w extends _ {
|
|
1926
1697
|
clone() {
|
|
1927
1698
|
return new w(this.x, this.y, this.z);
|
|
1928
1699
|
}
|
|
@@ -1933,7 +1704,7 @@ class w extends p {
|
|
|
1933
1704
|
}), n;
|
|
1934
1705
|
}
|
|
1935
1706
|
}
|
|
1936
|
-
const
|
|
1707
|
+
const Lt = new O(), Ft = new St(), nt = class nt {
|
|
1937
1708
|
constructor(t = 0, s = 0, e = 0, n = nt.DEFAULT_ORDER) {
|
|
1938
1709
|
this._x = t, this._y = s, this._z = e, this._order = n;
|
|
1939
1710
|
}
|
|
@@ -1971,37 +1742,37 @@ const Ut = new G(), Lt = new St(), nt = class nt {
|
|
|
1971
1742
|
return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this._onChangeCallback(), this;
|
|
1972
1743
|
}
|
|
1973
1744
|
setFromRotationMatrix(t, s = this._order, e = !0) {
|
|
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],
|
|
1745
|
+
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], m = n[6], d = n[10];
|
|
1975
1746
|
switch (s) {
|
|
1976
1747
|
case "XYZ":
|
|
1977
|
-
this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c,
|
|
1748
|
+
this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c, d), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(m, h), this._z = 0);
|
|
1978
1749
|
break;
|
|
1979
1750
|
case "YXZ":
|
|
1980
|
-
this._x = Math.asin(-Z(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(o,
|
|
1751
|
+
this._x = Math.asin(-Z(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(o, d), this._z = Math.atan2(a, h)) : (this._y = Math.atan2(-l, i), this._z = 0);
|
|
1981
1752
|
break;
|
|
1982
1753
|
case "ZXY":
|
|
1983
|
-
this._x = Math.asin(Z(
|
|
1754
|
+
this._x = Math.asin(Z(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, d), this._z = Math.atan2(-r, h)) : (this._y = 0, this._z = Math.atan2(a, i));
|
|
1984
1755
|
break;
|
|
1985
1756
|
case "ZYX":
|
|
1986
|
-
this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(
|
|
1757
|
+
this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, d), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-r, h));
|
|
1987
1758
|
break;
|
|
1988
1759
|
case "YZX":
|
|
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,
|
|
1760
|
+
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, d));
|
|
1990
1761
|
break;
|
|
1991
1762
|
case "XZY":
|
|
1992
|
-
this._z = Math.asin(-Z(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(
|
|
1763
|
+
this._z = Math.asin(-Z(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(m, h), this._y = Math.atan2(o, i)) : (this._x = Math.atan2(-c, d), this._y = 0);
|
|
1993
1764
|
break;
|
|
1994
1765
|
}
|
|
1995
1766
|
return this._order = s, e === !0 && this._onChangeCallback(), this;
|
|
1996
1767
|
}
|
|
1997
1768
|
setFromQuaternion(t, s, e = !0) {
|
|
1998
|
-
return
|
|
1769
|
+
return Lt.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Lt, s, e);
|
|
1999
1770
|
}
|
|
2000
1771
|
setFromVector3(t, s = this._order) {
|
|
2001
1772
|
return this.set(t.x, t.y, t.z, s);
|
|
2002
1773
|
}
|
|
2003
1774
|
reorder(t) {
|
|
2004
|
-
return
|
|
1775
|
+
return Ft.setFromEuler(this), this.setFromQuaternion(Ft, t);
|
|
2005
1776
|
}
|
|
2006
1777
|
equals(t) {
|
|
2007
1778
|
return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order;
|
|
@@ -2022,8 +1793,266 @@ const Ut = new G(), Lt = new St(), nt = class nt {
|
|
|
2022
1793
|
}
|
|
2023
1794
|
};
|
|
2024
1795
|
nt.DEFAULT_ORDER = "XYZ";
|
|
2025
|
-
let
|
|
2026
|
-
|
|
1796
|
+
let Xt = nt;
|
|
1797
|
+
function ts(u, t, s = !1) {
|
|
1798
|
+
const e = u.x, n = u.y;
|
|
1799
|
+
let i = !1;
|
|
1800
|
+
const r = t.length;
|
|
1801
|
+
for (let o = 0, a = r - 1; o < r; a = o++) {
|
|
1802
|
+
const h = t[o].x, c = t[o].y, l = t[a].x, m = t[a].y;
|
|
1803
|
+
let d = c > n != m > n;
|
|
1804
|
+
s && (d = c >= n != m >= n), d && e < (l - h) * (n - c) / (m - c) + h && (i = !i);
|
|
1805
|
+
}
|
|
1806
|
+
return i;
|
|
1807
|
+
}
|
|
1808
|
+
function Bs(u, t) {
|
|
1809
|
+
if (u.length === 0 || t.length === 0)
|
|
1810
|
+
return !1;
|
|
1811
|
+
const s = new X().setFromPoints(u), e = new X().setFromPoints(t);
|
|
1812
|
+
if (!s.intersectsBox(e))
|
|
1813
|
+
return !1;
|
|
1814
|
+
for (let n = 0; n < u.length; ) {
|
|
1815
|
+
if (ts(u[n], t, !0))
|
|
1816
|
+
return !0;
|
|
1817
|
+
n < u.length - 1 && Gt.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
|
|
1818
|
+
}
|
|
1819
|
+
return !1;
|
|
1820
|
+
}
|
|
1821
|
+
const ks = {
|
|
1822
|
+
isPointInPolygon: ts,
|
|
1823
|
+
isPolygonIntersect: Bs
|
|
1824
|
+
};
|
|
1825
|
+
function Fs(u, t) {
|
|
1826
|
+
const s = [], e = t - 1, n = u;
|
|
1827
|
+
for (let i = 0; i <= n; i++)
|
|
1828
|
+
s.push(0);
|
|
1829
|
+
for (let i = 1; i <= e - n; i++)
|
|
1830
|
+
s.push(i);
|
|
1831
|
+
for (let i = 0; i <= n; i++)
|
|
1832
|
+
s.push(e - n + 1);
|
|
1833
|
+
return s;
|
|
1834
|
+
}
|
|
1835
|
+
function Xs(u, t) {
|
|
1836
|
+
const s = t.length - 1, e = u, n = [0];
|
|
1837
|
+
let i = 0;
|
|
1838
|
+
for (let o = 1; o <= s; o++) {
|
|
1839
|
+
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);
|
|
1840
|
+
i += l, n.push(i);
|
|
1841
|
+
}
|
|
1842
|
+
const r = [];
|
|
1843
|
+
for (let o = 0; o <= e; o++)
|
|
1844
|
+
r.push(0);
|
|
1845
|
+
for (let o = 1; o <= s - e; o++) {
|
|
1846
|
+
const a = n[o] / i;
|
|
1847
|
+
r.push(a * (s - e + 1));
|
|
1848
|
+
}
|
|
1849
|
+
for (let o = 0; o <= e; o++)
|
|
1850
|
+
r.push(s - e + 1);
|
|
1851
|
+
return r;
|
|
1852
|
+
}
|
|
1853
|
+
function Rs(u, t = "Uniform") {
|
|
1854
|
+
const s = u.length;
|
|
1855
|
+
if (s === 0)
|
|
1856
|
+
return [];
|
|
1857
|
+
if (s === 1)
|
|
1858
|
+
return [0];
|
|
1859
|
+
const e = s - 1;
|
|
1860
|
+
if (t === "Uniform")
|
|
1861
|
+
return new Array(s).fill(0).map((r, o) => o / e);
|
|
1862
|
+
const n = [0];
|
|
1863
|
+
let i = 0;
|
|
1864
|
+
for (let r = 1; r <= e; r++) {
|
|
1865
|
+
const o = u[r][0] - u[r - 1][0], a = u[r][1] - u[r - 1][1], h = u[r][2] - u[r - 1][2], c = Math.sqrt(o * o + a * a + h * h), l = t === "SqrtChord" ? Math.sqrt(c) : c;
|
|
1866
|
+
i += l, n.push(i);
|
|
1867
|
+
}
|
|
1868
|
+
return i < 1e-12 ? new Array(s).fill(0).map((r, o) => o / e) : n.map((r) => r / i);
|
|
1869
|
+
}
|
|
1870
|
+
function Ns(u, t) {
|
|
1871
|
+
const s = t.length - 1, e = u, n = s + e + 1, i = new Array(n + 1).fill(0), r = t[t.length - 1];
|
|
1872
|
+
for (let o = n - e; o <= n; o++)
|
|
1873
|
+
i[o] = r;
|
|
1874
|
+
for (let o = 1; o <= s - e; o++) {
|
|
1875
|
+
let a = 0;
|
|
1876
|
+
for (let h = o; h < o + e; h++)
|
|
1877
|
+
a += t[h];
|
|
1878
|
+
i[o + e] = a / e;
|
|
1879
|
+
}
|
|
1880
|
+
return i;
|
|
1881
|
+
}
|
|
1882
|
+
function Ds(u, t) {
|
|
1883
|
+
const s = t.length - 1, e = u, n = [0];
|
|
1884
|
+
let i = 0;
|
|
1885
|
+
for (let o = 1; o <= s; o++) {
|
|
1886
|
+
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), m = Math.sqrt(l);
|
|
1887
|
+
i += m, n.push(i);
|
|
1888
|
+
}
|
|
1889
|
+
const r = [];
|
|
1890
|
+
for (let o = 0; o <= e; o++)
|
|
1891
|
+
r.push(0);
|
|
1892
|
+
for (let o = 1; o <= s - e; o++) {
|
|
1893
|
+
const a = n[o] / i;
|
|
1894
|
+
r.push(a * (s - e + 1));
|
|
1895
|
+
}
|
|
1896
|
+
for (let o = 0; o <= e; o++)
|
|
1897
|
+
r.push(s - e + 1);
|
|
1898
|
+
return r;
|
|
1899
|
+
}
|
|
1900
|
+
function kt(u, t) {
|
|
1901
|
+
const s = u.length, e = u.map((r) => r.slice()), n = t.slice();
|
|
1902
|
+
for (let r = 0; r < s; r++) {
|
|
1903
|
+
let o = r, a = Math.abs(e[r][r]);
|
|
1904
|
+
for (let h = r + 1; h < s; h++) {
|
|
1905
|
+
const c = Math.abs(e[h][r]);
|
|
1906
|
+
c > a && (a = c, o = h);
|
|
1907
|
+
}
|
|
1908
|
+
if (a < 1e-12)
|
|
1909
|
+
throw new Error("Interpolation matrix is singular.");
|
|
1910
|
+
if (o !== r) {
|
|
1911
|
+
const h = e[r];
|
|
1912
|
+
e[r] = e[o], e[o] = h;
|
|
1913
|
+
const c = n[r];
|
|
1914
|
+
n[r] = n[o], n[o] = c;
|
|
1915
|
+
}
|
|
1916
|
+
for (let h = r + 1; h < s; h++) {
|
|
1917
|
+
const c = e[h][r] / e[r][r];
|
|
1918
|
+
if (!(Math.abs(c) < 1e-14)) {
|
|
1919
|
+
for (let l = r; l < s; l++)
|
|
1920
|
+
e[h][l] -= c * e[r][l];
|
|
1921
|
+
n[h] -= c * n[r];
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
const i = new Array(s).fill(0);
|
|
1926
|
+
for (let r = s - 1; r >= 0; r--) {
|
|
1927
|
+
let o = n[r];
|
|
1928
|
+
for (let a = r + 1; a < s; a++)
|
|
1929
|
+
o -= e[r][a] * i[a];
|
|
1930
|
+
i[r] = o / e[r][r];
|
|
1931
|
+
}
|
|
1932
|
+
return i;
|
|
1933
|
+
}
|
|
1934
|
+
function ss(u, t, s = "Uniform", e, n) {
|
|
1935
|
+
if (u.length === 0)
|
|
1936
|
+
return { controlPoints: [], knots: [], weights: [] };
|
|
1937
|
+
const i = u.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;
|
|
1938
|
+
if (c < t)
|
|
1939
|
+
throw new Error("Not enough points to interpolate a curve of this degree.");
|
|
1940
|
+
const l = Rs(i, s), m = l.slice();
|
|
1941
|
+
r && m.unshift(l[0]), o && m.push(l[l.length - 1]);
|
|
1942
|
+
const d = Ns(t, m), x = c + 1, g = new Array(x), y = new Array(x), p = new Array(x), z = new Array(x);
|
|
1943
|
+
let f = 0;
|
|
1944
|
+
g[f] = new Array(x).fill(0), g[f][0] = 1, y[f] = i[0][0], p[f] = i[0][1], z[f] = i[0][2], f++;
|
|
1945
|
+
for (let C = 1; C <= h - 1; C++) {
|
|
1946
|
+
const j = l[C];
|
|
1947
|
+
g[f] = new Array(x).fill(0);
|
|
1948
|
+
for (let q = 0; q <= c; q++)
|
|
1949
|
+
g[f][q] = zt(q, t, j, d);
|
|
1950
|
+
y[f] = i[C][0], p[f] = i[C][1], z[f] = i[C][2], f++;
|
|
1951
|
+
}
|
|
1952
|
+
if (g[f] = new Array(x).fill(0), g[f][c] = 1, y[f] = i[h][0], p[f] = i[h][1], z[f] = i[h][2], f++, r) {
|
|
1953
|
+
const C = d[t + 1] - d[0], j = C !== 0 ? t / C : 0;
|
|
1954
|
+
g[f] = new Array(x).fill(0), g[f][0] = -j, g[f][1] = j, y[f] = (e == null ? void 0 : e[0]) ?? 0, p[f] = (e == null ? void 0 : e[1]) ?? 0, z[f] = (e == null ? void 0 : e[2]) ?? 0, f++;
|
|
1955
|
+
}
|
|
1956
|
+
if (o) {
|
|
1957
|
+
const C = d[c + t + 1] - d[c], j = C !== 0 ? t / C : 0;
|
|
1958
|
+
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, p[f] = (n == null ? void 0 : n[1]) ?? 0, z[f] = (n == null ? void 0 : n[2]) ?? 0, f++;
|
|
1959
|
+
}
|
|
1960
|
+
const b = kt(g, y), P = kt(g, p), I = kt(g, z), A = new Array(x);
|
|
1961
|
+
for (let C = 0; C < x; C++)
|
|
1962
|
+
A[C] = [b[C], P[C], I[C]];
|
|
1963
|
+
const k = new Array(x).fill(1);
|
|
1964
|
+
return { controlPoints: A, knots: d, weights: k };
|
|
1965
|
+
}
|
|
1966
|
+
function zt(u, t, s, e) {
|
|
1967
|
+
if (t === 0)
|
|
1968
|
+
return s >= e[u] && s < e[u + 1] ? 1 : 0;
|
|
1969
|
+
const n = e[u + t] - e[u], i = e[u + t + 1] - e[u + 1], r = n > 1e-10 ? (s - e[u]) / n : 0, o = i > 1e-10 ? (e[u + t + 1] - s) / i : 0;
|
|
1970
|
+
return r * zt(u, t - 1, s, e) + o * zt(u + 1, t - 1, s, e);
|
|
1971
|
+
}
|
|
1972
|
+
function ft(u, t, s, e, n) {
|
|
1973
|
+
const i = e.length - 1, r = t;
|
|
1974
|
+
if (u = Math.max(s[r], Math.min(s[i + 1], u)), Math.abs(u - s[i + 1]) < 1e-8)
|
|
1975
|
+
return [...e[i]];
|
|
1976
|
+
if (Math.abs(u - s[r]) < 1e-8)
|
|
1977
|
+
return [...e[0]];
|
|
1978
|
+
const o = [0, 0, 0];
|
|
1979
|
+
let a = 0;
|
|
1980
|
+
for (let h = 0; h <= i; h++) {
|
|
1981
|
+
const c = zt(h, r, u, s), l = n[h] * c;
|
|
1982
|
+
o[0] += e[h][0] * l, o[1] += e[h][1] * l, o[2] += e[h][2] * l, a += l;
|
|
1983
|
+
}
|
|
1984
|
+
if (Math.abs(a) < 1e-10) {
|
|
1985
|
+
const h = s[s.length - r - 1];
|
|
1986
|
+
if (Math.abs(u - h) < 1e-8)
|
|
1987
|
+
return [...e[i]];
|
|
1988
|
+
if (Math.abs(u - s[r]) < 1e-8)
|
|
1989
|
+
return [...e[0]];
|
|
1990
|
+
}
|
|
1991
|
+
return Math.abs(a) >= 1e-10 && (o[0] /= a, o[1] /= a, o[2] /= a), o;
|
|
1992
|
+
}
|
|
1993
|
+
function Ts(u, t, s, e) {
|
|
1994
|
+
const n = u, i = t[n], r = t[t.length - n - 1];
|
|
1995
|
+
let o = 0;
|
|
1996
|
+
const a = 1e3, h = (r - i) / a;
|
|
1997
|
+
let c = ft(
|
|
1998
|
+
i,
|
|
1999
|
+
u,
|
|
2000
|
+
t,
|
|
2001
|
+
s,
|
|
2002
|
+
e
|
|
2003
|
+
);
|
|
2004
|
+
for (let g = 1; g <= a; g++) {
|
|
2005
|
+
const y = i + g * h, p = ft(y, u, t, s, e), z = p[0] - c[0], f = p[1] - c[1], b = p[2] - c[2];
|
|
2006
|
+
o += Math.sqrt(z * z + f * f + b * b), c = p;
|
|
2007
|
+
}
|
|
2008
|
+
const l = ft(
|
|
2009
|
+
r,
|
|
2010
|
+
u,
|
|
2011
|
+
t,
|
|
2012
|
+
s,
|
|
2013
|
+
e
|
|
2014
|
+
), m = l[0] - c[0], d = l[1] - c[1], x = l[2] - c[2];
|
|
2015
|
+
return o += Math.sqrt(m * m + d * d + x * x), o;
|
|
2016
|
+
}
|
|
2017
|
+
function vs(u, t = 3, s = "Uniform", e, n) {
|
|
2018
|
+
return u.length === 0 ? [] : ss(
|
|
2019
|
+
u,
|
|
2020
|
+
t,
|
|
2021
|
+
s,
|
|
2022
|
+
e,
|
|
2023
|
+
n
|
|
2024
|
+
).controlPoints;
|
|
2025
|
+
}
|
|
2026
|
+
const Dt = new O(), vt = new _(), js = new _(), Vs = new _(), Rt = new w();
|
|
2027
|
+
function es(u) {
|
|
2028
|
+
return new O().setFromExtrusionDirection(
|
|
2029
|
+
new _(u.x, u.y, u.z)
|
|
2030
|
+
);
|
|
2031
|
+
}
|
|
2032
|
+
function Ys(u) {
|
|
2033
|
+
return Dt.setFromExtrusionDirection(
|
|
2034
|
+
new _(u.x, u.y, u.z)
|
|
2035
|
+
), Dt.extractBasis(vt, js, Vs), vt.clone();
|
|
2036
|
+
}
|
|
2037
|
+
function Zs(u, t) {
|
|
2038
|
+
return new w(u.x, u.y, u.z ?? 0).applyMatrix4(
|
|
2039
|
+
es(t)
|
|
2040
|
+
);
|
|
2041
|
+
}
|
|
2042
|
+
function Yt(u, t) {
|
|
2043
|
+
return new w(u.x, u.y, u.z ?? 0).applyMatrix4(
|
|
2044
|
+
es(t).invert()
|
|
2045
|
+
);
|
|
2046
|
+
}
|
|
2047
|
+
function Os(u, t, s) {
|
|
2048
|
+
const e = Yt(u, s), n = Yt(t, s);
|
|
2049
|
+
return Rt.set(
|
|
2050
|
+
n.x - e.x,
|
|
2051
|
+
n.y - e.y,
|
|
2052
|
+
(n.z ?? 0) - (e.z ?? 0)
|
|
2053
|
+
), M.normalizeAngle(Math.atan2(Rt.y, Rt.x));
|
|
2054
|
+
}
|
|
2055
|
+
class ns {
|
|
2027
2056
|
constructor() {
|
|
2028
2057
|
this._boundingBoxNeedsUpdate = !1;
|
|
2029
2058
|
}
|
|
@@ -2031,7 +2060,7 @@ class Jt {
|
|
|
2031
2060
|
return this._boundingBoxNeedsUpdate;
|
|
2032
2061
|
}
|
|
2033
2062
|
}
|
|
2034
|
-
class
|
|
2063
|
+
class is extends ns {
|
|
2035
2064
|
translate(t) {
|
|
2036
2065
|
return this.transform(new it().makeTranslation(t.x, t.y));
|
|
2037
2066
|
}
|
|
@@ -2039,7 +2068,7 @@ class Gt extends Jt {
|
|
|
2039
2068
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2040
2069
|
}
|
|
2041
2070
|
}
|
|
2042
|
-
class
|
|
2071
|
+
class rs extends is {
|
|
2043
2072
|
constructor() {
|
|
2044
2073
|
super(), this._loops = [];
|
|
2045
2074
|
}
|
|
@@ -2063,7 +2092,7 @@ class ts extends Gt {
|
|
|
2063
2092
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
2064
2093
|
}
|
|
2065
2094
|
clone() {
|
|
2066
|
-
const t = new
|
|
2095
|
+
const t = new rs();
|
|
2067
2096
|
return this._loops.forEach((s) => {
|
|
2068
2097
|
t.add(s.clone());
|
|
2069
2098
|
}), t;
|
|
@@ -2087,18 +2116,18 @@ class ts extends Gt {
|
|
|
2087
2116
|
const r = { index: -1, children: [] };
|
|
2088
2117
|
for (let a = 0; a < i; a++) {
|
|
2089
2118
|
const h = e[a], c = t[h], l = s[h];
|
|
2090
|
-
let
|
|
2091
|
-
for (;
|
|
2092
|
-
const
|
|
2093
|
-
if (s[
|
|
2119
|
+
let m = a + 1;
|
|
2120
|
+
for (; m < i; m++) {
|
|
2121
|
+
const d = e[m], x = t[d];
|
|
2122
|
+
if (s[d].containsBox(l) && ks.isPointInPolygon(
|
|
2094
2123
|
c[M.randInt(0, c.length - 1)],
|
|
2095
2124
|
x
|
|
2096
2125
|
)) {
|
|
2097
|
-
(o = n.get(
|
|
2126
|
+
(o = n.get(d)) == null || o.children.push(n.get(h));
|
|
2098
2127
|
break;
|
|
2099
2128
|
}
|
|
2100
2129
|
}
|
|
2101
|
-
|
|
2130
|
+
m === i && r.children.push(n.get(h));
|
|
2102
2131
|
}
|
|
2103
2132
|
return r;
|
|
2104
2133
|
}
|
|
@@ -2142,7 +2171,7 @@ class ts extends Gt {
|
|
|
2142
2171
|
}), e;
|
|
2143
2172
|
}
|
|
2144
2173
|
}
|
|
2145
|
-
class rt extends
|
|
2174
|
+
class rt extends is {
|
|
2146
2175
|
constructor() {
|
|
2147
2176
|
super(), this.arcLengthDivisions = 100;
|
|
2148
2177
|
}
|
|
@@ -2204,8 +2233,8 @@ class rt extends Gt {
|
|
|
2204
2233
|
}
|
|
2205
2234
|
if (n = a, e[n] === r)
|
|
2206
2235
|
return n / (i - 1);
|
|
2207
|
-
const c = e[n],
|
|
2208
|
-
return (n +
|
|
2236
|
+
const c = e[n], m = e[n + 1] - c, d = (r - c) / m;
|
|
2237
|
+
return (n + d) / (i - 1);
|
|
2209
2238
|
}
|
|
2210
2239
|
getTangent(t) {
|
|
2211
2240
|
let e = t - 1e-4, n = t + 1e-4;
|
|
@@ -2218,7 +2247,7 @@ class rt extends Gt {
|
|
|
2218
2247
|
return this.getTangent(s);
|
|
2219
2248
|
}
|
|
2220
2249
|
}
|
|
2221
|
-
class
|
|
2250
|
+
class $ extends rt {
|
|
2222
2251
|
constructor(t, s, e, n, i) {
|
|
2223
2252
|
super();
|
|
2224
2253
|
const r = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
|
|
@@ -2242,23 +2271,23 @@ class K extends rt {
|
|
|
2242
2271
|
const n = (A, k) => ({
|
|
2243
2272
|
x: (A.x + k.x) / 2,
|
|
2244
2273
|
y: (A.y + k.y) / 2
|
|
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),
|
|
2246
|
-
const q = (j - k) / (A - C),
|
|
2247
|
-
return { x: q, y:
|
|
2248
|
-
}, x = o.y - l * o.x, g = a.y -
|
|
2274
|
+
}), 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), m = r(c), d = (A, k, C, j) => {
|
|
2275
|
+
const q = (j - k) / (A - C), W = A * q + k;
|
|
2276
|
+
return { x: q, y: W };
|
|
2277
|
+
}, x = o.y - l * o.x, g = a.y - m * a.x, y = d(l, x, m, g), p = Math.sqrt(
|
|
2249
2278
|
Math.pow(t.x - y.x, 2) + Math.pow(t.y - y.y, 2)
|
|
2250
2279
|
), 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;
|
|
2251
|
-
this.center = y, this.radius =
|
|
2280
|
+
this.center = y, this.radius = p, this._clockwise = !I, this._startAngle = f, this._endAngle = P;
|
|
2252
2281
|
}
|
|
2253
2282
|
createByStartEndPointsAndBulge(t, s, e) {
|
|
2254
2283
|
let n, i, r;
|
|
2255
2284
|
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));
|
|
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(),
|
|
2257
|
-
l.x * Math.cos(
|
|
2258
|
-
l.y * Math.cos(
|
|
2285
|
+
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(), m = e < 0 ? -Math.PI / 2 : Math.PI / 2, d = new B(
|
|
2286
|
+
l.x * Math.cos(m) - l.y * Math.sin(m),
|
|
2287
|
+
l.y * Math.cos(m) + l.x * Math.sin(m)
|
|
2259
2288
|
);
|
|
2260
2289
|
let x;
|
|
2261
|
-
n < Math.PI ? e < 0 ? x = h.add(
|
|
2290
|
+
n < Math.PI ? e < 0 ? x = h.add(d.multiplyScalar(c)) : x = h.add(d.multiplyScalar(-c)) : e < 0 ? x = h.add(d.multiplyScalar(-c)) : x = h.add(d.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();
|
|
2262
2291
|
}
|
|
2263
2292
|
get center() {
|
|
2264
2293
|
return this._center;
|
|
@@ -2342,7 +2371,7 @@ class K extends rt {
|
|
|
2342
2371
|
n.y - e.y,
|
|
2343
2372
|
n.x - e.x
|
|
2344
2373
|
), this._endAngle = this._startAngle, this._clockwise = s.determinant() < 0 ? !this._clockwise : this._clockwise, this._boundingBoxNeedsUpdate = !0, this;
|
|
2345
|
-
const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new
|
|
2374
|
+
const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new $(
|
|
2346
2375
|
n,
|
|
2347
2376
|
i,
|
|
2348
2377
|
r
|
|
@@ -2363,7 +2392,7 @@ class K extends rt {
|
|
|
2363
2392
|
), this._boundingBoxNeedsUpdate = !0, this;
|
|
2364
2393
|
}
|
|
2365
2394
|
clone() {
|
|
2366
|
-
return new
|
|
2395
|
+
return new $(
|
|
2367
2396
|
this.center.clone(),
|
|
2368
2397
|
this.radius,
|
|
2369
2398
|
this._startAngle,
|
|
@@ -2391,15 +2420,15 @@ class K extends rt {
|
|
|
2391
2420
|
return s;
|
|
2392
2421
|
}
|
|
2393
2422
|
}
|
|
2394
|
-
class
|
|
2423
|
+
class qs extends ns {
|
|
2395
2424
|
translate(t) {
|
|
2396
|
-
return this.transform(new
|
|
2425
|
+
return this.transform(new O().makeTranslation(t.x, t.y, t.z));
|
|
2397
2426
|
}
|
|
2398
2427
|
get box() {
|
|
2399
2428
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2400
2429
|
}
|
|
2401
2430
|
}
|
|
2402
|
-
class ot extends
|
|
2431
|
+
class ot extends qs {
|
|
2403
2432
|
}
|
|
2404
2433
|
class Mt extends ot {
|
|
2405
2434
|
constructor(t, s) {
|
|
@@ -2418,7 +2447,7 @@ class Mt extends ot {
|
|
|
2418
2447
|
this._end.copy(t), this._boundingBoxNeedsUpdate = !0;
|
|
2419
2448
|
}
|
|
2420
2449
|
get direction() {
|
|
2421
|
-
return new
|
|
2450
|
+
return new _().subVectors(this.endPoint, this.startPoint).normalize();
|
|
2422
2451
|
}
|
|
2423
2452
|
get midPoint() {
|
|
2424
2453
|
return new w(
|
|
@@ -2441,30 +2470,30 @@ class Mt extends ot {
|
|
|
2441
2470
|
}
|
|
2442
2471
|
atLength(t, s = !1) {
|
|
2443
2472
|
if (s) {
|
|
2444
|
-
const e = this.delta(
|
|
2473
|
+
const e = this.delta(Q).normalize();
|
|
2445
2474
|
return new w(this._start).addScaledVector(e, t);
|
|
2446
2475
|
} else {
|
|
2447
|
-
const e = this.delta(
|
|
2476
|
+
const e = this.delta(Q).normalize();
|
|
2448
2477
|
return new w(this._end).addScaledVector(e, t);
|
|
2449
2478
|
}
|
|
2450
2479
|
}
|
|
2451
2480
|
extend(t, s = !1) {
|
|
2452
2481
|
if (s) {
|
|
2453
|
-
const e =
|
|
2482
|
+
const e = Q.subVectors(this._start, this._end).normalize();
|
|
2454
2483
|
this._start = new w(this._start).addScaledVector(
|
|
2455
2484
|
e,
|
|
2456
2485
|
t
|
|
2457
2486
|
);
|
|
2458
2487
|
} else {
|
|
2459
|
-
const e = this.delta(
|
|
2488
|
+
const e = this.delta(Q).normalize();
|
|
2460
2489
|
this._end = new w(this._end).addScaledVector(e, t);
|
|
2461
2490
|
}
|
|
2462
2491
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
2463
2492
|
}
|
|
2464
2493
|
closestPointToPointParameter(t, s) {
|
|
2465
|
-
|
|
2494
|
+
Zt.subVectors(t, this._start), _t.subVectors(this.endPoint, this.startPoint);
|
|
2466
2495
|
const e = _t.dot(_t);
|
|
2467
|
-
let i = _t.dot(
|
|
2496
|
+
let i = _t.dot(Zt) / e;
|
|
2468
2497
|
return s && (i = M.clamp(i, 0, 1)), i;
|
|
2469
2498
|
}
|
|
2470
2499
|
closestPointToPoint(t, s, e) {
|
|
@@ -2481,11 +2510,11 @@ class Mt extends ot {
|
|
|
2481
2510
|
return this._start.distanceTo(this._end);
|
|
2482
2511
|
}
|
|
2483
2512
|
project(t) {
|
|
2484
|
-
const s = this.direction, n =
|
|
2513
|
+
const s = this.direction, n = Q.subVectors(t, this.startPoint).dot(s);
|
|
2485
2514
|
return new w().copy(s).multiplyScalar(n).add(this.startPoint);
|
|
2486
2515
|
}
|
|
2487
2516
|
perpPoint(t) {
|
|
2488
|
-
const s = this.direction, e = this.startPoint, i =
|
|
2517
|
+
const s = this.direction, e = this.startPoint, i = Q.subVectors(t, e).dot(s), r = Q.copy(s).multiplyScalar(i);
|
|
2489
2518
|
return new w().addVectors(e, r);
|
|
2490
2519
|
}
|
|
2491
2520
|
calculateBoundingBox() {
|
|
@@ -2498,7 +2527,7 @@ class Mt extends ot {
|
|
|
2498
2527
|
Math.max(this._start.y, this._end.y),
|
|
2499
2528
|
Math.max(this._start.z, this._end.z)
|
|
2500
2529
|
);
|
|
2501
|
-
return new
|
|
2530
|
+
return new v(t, s);
|
|
2502
2531
|
}
|
|
2503
2532
|
transform(t) {
|
|
2504
2533
|
return this._start.applyMatrix4(t), this._end.applyMatrix4(t), this._boundingBoxNeedsUpdate = !0, this;
|
|
@@ -2513,14 +2542,14 @@ class Mt extends ot {
|
|
|
2513
2542
|
return new Mt(this._start.clone(), this._end.clone());
|
|
2514
2543
|
}
|
|
2515
2544
|
}
|
|
2516
|
-
const
|
|
2545
|
+
const Q = new _(), Zt = new _(), _t = new _();
|
|
2517
2546
|
class At extends ot {
|
|
2518
2547
|
static computeCenterPoint(t, s, e) {
|
|
2519
|
-
const n = new
|
|
2548
|
+
const n = new _().addVectors(t, s).multiplyScalar(0.5), i = new _().addVectors(t, e).multiplyScalar(0.5), r = new _().subVectors(s, t), o = new _().subVectors(e, t), a = new _().crossVectors(r, o).normalize();
|
|
2520
2549
|
if (a.lengthSq() === 0)
|
|
2521
2550
|
return null;
|
|
2522
|
-
const h = new
|
|
2523
|
-
return
|
|
2551
|
+
const h = new _().crossVectors(r, a).normalize(), c = new _().crossVectors(o, a).normalize(), l = h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = new Mt(n, n.clone().add(l)), x = new Mt(i, i.clone().add(m)), g = new _();
|
|
2552
|
+
return d.closestPointToPoint(x.startPoint, !0, g) ? g : null;
|
|
2524
2553
|
}
|
|
2525
2554
|
static createByThreePoints(t, s, e) {
|
|
2526
2555
|
const n = At.computeCenterPoint(
|
|
@@ -2529,17 +2558,17 @@ class At extends ot {
|
|
|
2529
2558
|
e
|
|
2530
2559
|
);
|
|
2531
2560
|
if (n) {
|
|
2532
|
-
const i = n.distanceTo(t), r = new
|
|
2561
|
+
const i = n.distanceTo(t), r = new _().subVectors(t, n), o = new _().subVectors(s, n), a = Math.atan2(r.y, r.x), h = Math.atan2(o.y, o.x);
|
|
2533
2562
|
return new At(
|
|
2534
2563
|
n,
|
|
2535
2564
|
i,
|
|
2536
2565
|
a,
|
|
2537
2566
|
h,
|
|
2538
|
-
|
|
2567
|
+
_.Z_AXIS
|
|
2539
2568
|
);
|
|
2540
2569
|
}
|
|
2541
2570
|
}
|
|
2542
|
-
constructor(t, s, e, n, i, r =
|
|
2571
|
+
constructor(t, s, e, n, i, r = _.X_AXIS) {
|
|
2543
2572
|
super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = r, (n - e) % E == 0 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = e, this.endAngle = n);
|
|
2544
2573
|
}
|
|
2545
2574
|
get center() {
|
|
@@ -2580,13 +2609,13 @@ class At extends ot {
|
|
|
2580
2609
|
return this._normal;
|
|
2581
2610
|
}
|
|
2582
2611
|
set normal(t) {
|
|
2583
|
-
this._normal = new
|
|
2612
|
+
this._normal = new _(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
|
|
2584
2613
|
}
|
|
2585
2614
|
get refVec() {
|
|
2586
2615
|
return this._refVec;
|
|
2587
2616
|
}
|
|
2588
2617
|
set refVec(t) {
|
|
2589
|
-
this._refVec = new
|
|
2618
|
+
this._refVec = new _(t.x, t.y, t.z), this._refVec.normalize(), this._boundingBoxNeedsUpdate = !0;
|
|
2590
2619
|
}
|
|
2591
2620
|
get startPoint() {
|
|
2592
2621
|
return this.getPointAtAngle(this._startAngle);
|
|
@@ -2607,23 +2636,23 @@ class At extends ot {
|
|
|
2607
2636
|
return this.closed ? Math.PI * this.radius * this.radius : Math.abs(this.deltaAngle * this.radius * this.radius);
|
|
2608
2637
|
}
|
|
2609
2638
|
nearestPoint(t) {
|
|
2610
|
-
const s = new
|
|
2639
|
+
const s = new _(t.x, t.y, t.z || 0), e = this.center, n = this.normal, r = s.clone().sub(e).dot(n), a = s.clone().sub(n.clone().multiplyScalar(r)).clone().sub(e);
|
|
2611
2640
|
if (a.lengthSq() === 0)
|
|
2612
2641
|
return this.startPoint.clone();
|
|
2613
2642
|
a.normalize().multiplyScalar(this.radius);
|
|
2614
|
-
const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle,
|
|
2615
|
-
let
|
|
2616
|
-
|
|
2617
|
-
const x = this.getPointAtAngle(l +
|
|
2618
|
-
return y < g && y <=
|
|
2643
|
+
const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle, m = this.deltaAngle;
|
|
2644
|
+
let d = M.normalizeAngle(c - l);
|
|
2645
|
+
d < 0 && (d = 0), d > m && (d = m);
|
|
2646
|
+
const x = this.getPointAtAngle(l + d), g = x.distanceTo(s), y = this.startPoint.distanceTo(s), p = this.endPoint.distanceTo(s);
|
|
2647
|
+
return y < g && y <= p ? this.startPoint.clone() : p < g && p < y ? this.endPoint.clone() : x;
|
|
2619
2648
|
}
|
|
2620
2649
|
tangentPoints(t) {
|
|
2621
|
-
const s = [], e = new
|
|
2622
|
-
if (
|
|
2623
|
-
const
|
|
2650
|
+
const s = [], e = new _(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(), m = h.clone().sub(c).length();
|
|
2651
|
+
if (m < r) return s;
|
|
2652
|
+
const d = Math.acos(r / m), x = this.getAngle(h.clone()), g = [x + d, x - d];
|
|
2624
2653
|
for (const y of g) {
|
|
2625
|
-
const
|
|
2626
|
-
|
|
2654
|
+
const p = M.normalizeAngle(y - this.startAngle);
|
|
2655
|
+
p >= 0 && p <= this.deltaAngle && s.push(this.getPointAtAngle(this.startAngle + p));
|
|
2627
2656
|
}
|
|
2628
2657
|
return s;
|
|
2629
2658
|
}
|
|
@@ -2642,7 +2671,7 @@ class At extends ot {
|
|
|
2642
2671
|
const h = this.getPointAtAngle(a);
|
|
2643
2672
|
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);
|
|
2644
2673
|
}
|
|
2645
|
-
return new
|
|
2674
|
+
return new v(
|
|
2646
2675
|
{ x: s, y: e, z: n },
|
|
2647
2676
|
{ x: i, y: r, z: o }
|
|
2648
2677
|
);
|
|
@@ -2663,16 +2692,16 @@ class At extends ot {
|
|
|
2663
2692
|
transform(t) {
|
|
2664
2693
|
const s = this.center.clone().applyMatrix4(t), e = this.startPoint.clone().applyMatrix4(t), n = this.endPoint.clone().applyMatrix4(t), i = this.getPointAtAngle(
|
|
2665
2694
|
this.closed ? Math.PI / 2 : this.startAngle + this.deltaAngle / 2
|
|
2666
|
-
).clone().applyMatrix4(t), r = new
|
|
2667
|
-
let a = new
|
|
2668
|
-
new
|
|
2669
|
-
new
|
|
2695
|
+
).clone().applyMatrix4(t), r = new _(e).sub(s).normalize(), o = s.distanceTo(e);
|
|
2696
|
+
let a = new _().crossVectors(
|
|
2697
|
+
new _(e).sub(s),
|
|
2698
|
+
new _(i).sub(s)
|
|
2670
2699
|
).normalize();
|
|
2671
2700
|
a.lengthSq() === 0 && (a = this.normal.clone().transformDirection(t));
|
|
2672
2701
|
const h = (c) => {
|
|
2673
|
-
const l = new
|
|
2702
|
+
const l = new _(c).sub(s);
|
|
2674
2703
|
return Math.atan2(
|
|
2675
|
-
l.dot(
|
|
2704
|
+
l.dot(Ot.crossVectors(a, r)),
|
|
2676
2705
|
l.dot(r)
|
|
2677
2706
|
);
|
|
2678
2707
|
};
|
|
@@ -2693,7 +2722,7 @@ class At extends ot {
|
|
|
2693
2722
|
}
|
|
2694
2723
|
getAngle(t) {
|
|
2695
2724
|
return t.sub(this.center), Math.atan2(
|
|
2696
|
-
t.dot(
|
|
2725
|
+
t.dot(Ot.crossVectors(this.refVec, this.normal)),
|
|
2697
2726
|
t.dot(this.refVec)
|
|
2698
2727
|
);
|
|
2699
2728
|
}
|
|
@@ -2710,12 +2739,12 @@ class At extends ot {
|
|
|
2710
2739
|
);
|
|
2711
2740
|
}
|
|
2712
2741
|
get plane() {
|
|
2713
|
-
const t = new
|
|
2742
|
+
const t = new _(this.center).distanceTo(Jt);
|
|
2714
2743
|
return new Ct(this.normal, t);
|
|
2715
2744
|
}
|
|
2716
2745
|
}
|
|
2717
|
-
const
|
|
2718
|
-
class
|
|
2746
|
+
const Ot = new _();
|
|
2747
|
+
class G extends rt {
|
|
2719
2748
|
constructor(t, s, e, n = 0, i = E, r = !1, o = 0) {
|
|
2720
2749
|
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;
|
|
2721
2750
|
}
|
|
@@ -2806,12 +2835,12 @@ class J extends rt {
|
|
|
2806
2835
|
e
|
|
2807
2836
|
), a = new S(r).sub(
|
|
2808
2837
|
e
|
|
2809
|
-
), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x),
|
|
2810
|
-
const z = new S(
|
|
2838
|
+
), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x), m = o.clone().normalize(), d = a.clone().normalize(), x = (p) => {
|
|
2839
|
+
const z = new S(p).sub(e), f = z.dot(m), b = z.dot(d);
|
|
2811
2840
|
return M.normalizeAngle(
|
|
2812
2841
|
Math.atan2(b / c, f / h)
|
|
2813
2842
|
);
|
|
2814
|
-
}, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new
|
|
2843
|
+
}, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new G(
|
|
2815
2844
|
n,
|
|
2816
2845
|
h,
|
|
2817
2846
|
c,
|
|
@@ -2819,7 +2848,7 @@ class J extends rt {
|
|
|
2819
2848
|
E,
|
|
2820
2849
|
g,
|
|
2821
2850
|
l
|
|
2822
|
-
) : new
|
|
2851
|
+
) : new G(
|
|
2823
2852
|
n,
|
|
2824
2853
|
h,
|
|
2825
2854
|
c,
|
|
@@ -2839,7 +2868,7 @@ class J extends rt {
|
|
|
2839
2868
|
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;
|
|
2840
2869
|
}
|
|
2841
2870
|
clone() {
|
|
2842
|
-
return new
|
|
2871
|
+
return new G(
|
|
2843
2872
|
this.center,
|
|
2844
2873
|
this.majorAxisRadius,
|
|
2845
2874
|
this.minorAxisRadius,
|
|
@@ -2850,7 +2879,7 @@ class J extends rt {
|
|
|
2850
2879
|
);
|
|
2851
2880
|
}
|
|
2852
2881
|
}
|
|
2853
|
-
class
|
|
2882
|
+
class wt extends ot {
|
|
2854
2883
|
constructor(t, s, e, n, i, r = 0, o = E) {
|
|
2855
2884
|
super(), this.center = t, this.normal = s, this.majorAxis = e, this.majorAxisRadius = n, this.minorAxisRadius = i;
|
|
2856
2885
|
const a = Math.abs(o - r);
|
|
@@ -2902,16 +2931,16 @@ class zt extends ot {
|
|
|
2902
2931
|
return this._normal;
|
|
2903
2932
|
}
|
|
2904
2933
|
set normal(t) {
|
|
2905
|
-
this._normal = new
|
|
2934
|
+
this._normal = new _(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
|
|
2906
2935
|
}
|
|
2907
2936
|
get majorAxis() {
|
|
2908
2937
|
return this._majorAxis;
|
|
2909
2938
|
}
|
|
2910
2939
|
set majorAxis(t) {
|
|
2911
|
-
this._majorAxis = new
|
|
2940
|
+
this._majorAxis = new _(t.x, t.y, t.z), this._majorAxis.normalize(), this._boundingBoxNeedsUpdate = !0;
|
|
2912
2941
|
}
|
|
2913
2942
|
get minorAxis() {
|
|
2914
|
-
return new
|
|
2943
|
+
return new _().crossVectors(this.normal, this.majorAxis).normalize();
|
|
2915
2944
|
}
|
|
2916
2945
|
get startPoint() {
|
|
2917
2946
|
return this.getPointAtAngle(this._startAngle);
|
|
@@ -2947,7 +2976,7 @@ class zt extends ot {
|
|
|
2947
2976
|
return Math.abs(i);
|
|
2948
2977
|
}
|
|
2949
2978
|
calculateBoundingBox() {
|
|
2950
|
-
if (this.majorAxis.equals(
|
|
2979
|
+
if (this.majorAxis.equals(_.X_AXIS) || this.majorAxis.equals(_.Y_AXIS) || this.majorAxis.isParallelTo(_.X_AXIS) || this.majorAxis.isParallelTo(_.Y_AXIS)) {
|
|
2951
2980
|
const t = [this.startAngle, this.endAngle];
|
|
2952
2981
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
|
2953
2982
|
M.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
|
@@ -2956,7 +2985,7 @@ class zt extends ot {
|
|
|
2956
2985
|
const h = this.getPointAtAngle(a);
|
|
2957
2986
|
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);
|
|
2958
2987
|
}
|
|
2959
|
-
return new
|
|
2988
|
+
return new v(
|
|
2960
2989
|
{ x: s, y: e, z: n },
|
|
2961
2990
|
{ x: i, y: r, z: o }
|
|
2962
2991
|
);
|
|
@@ -2966,7 +2995,7 @@ class zt extends ot {
|
|
|
2966
2995
|
const h = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(h);
|
|
2967
2996
|
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);
|
|
2968
2997
|
}
|
|
2969
|
-
return new
|
|
2998
|
+
return new v(
|
|
2970
2999
|
{ x: s, y: e, z: n },
|
|
2971
3000
|
{ x: i, y: r, z: o }
|
|
2972
3001
|
);
|
|
@@ -2994,23 +3023,23 @@ class zt extends ot {
|
|
|
2994
3023
|
);
|
|
2995
3024
|
}
|
|
2996
3025
|
contains(t) {
|
|
2997
|
-
const s = new
|
|
3026
|
+
const s = new _(t).sub(this.center), e = s.dot(this.majorAxis), n = s.dot(this.minorAxis), i = e / this.majorAxisRadius, r = n / this.minorAxisRadius;
|
|
2998
3027
|
return i * i + r * r <= 1;
|
|
2999
3028
|
}
|
|
3000
3029
|
transform(t) {
|
|
3001
|
-
const s = t, e = this.center.clone().applyMatrix4(s), n = this.getPointAtAngle(0).clone().applyMatrix4(s), i = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix4(s), r = new
|
|
3030
|
+
const s = t, e = this.center.clone().applyMatrix4(s), n = this.getPointAtAngle(0).clone().applyMatrix4(s), i = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix4(s), r = new _(n).sub(
|
|
3002
3031
|
e
|
|
3003
|
-
), o = new
|
|
3032
|
+
), o = new _(i).sub(
|
|
3004
3033
|
e
|
|
3005
|
-
), a = r.length(), h = o.length(), c = r.clone().normalize(), l = new
|
|
3006
|
-
let
|
|
3007
|
-
|
|
3008
|
-
const
|
|
3009
|
-
const y = new
|
|
3034
|
+
), a = r.length(), h = o.length(), c = r.clone().normalize(), l = new _().crossVectors(r, o).normalize();
|
|
3035
|
+
let m = new _().crossVectors(l, c).normalize();
|
|
3036
|
+
m.dot(o) < 0 && (l.negate(), m = new _().crossVectors(l, c).normalize());
|
|
3037
|
+
const d = (g) => {
|
|
3038
|
+
const y = new _(g).sub(e), p = y.dot(c), z = y.dot(m);
|
|
3010
3039
|
return M.normalizeAngle(
|
|
3011
|
-
Math.atan2(z / h,
|
|
3040
|
+
Math.atan2(z / h, p / a)
|
|
3012
3041
|
);
|
|
3013
|
-
}, x = this.closed ? new
|
|
3042
|
+
}, x = this.closed ? new wt(
|
|
3014
3043
|
e,
|
|
3015
3044
|
l,
|
|
3016
3045
|
c,
|
|
@@ -3018,14 +3047,14 @@ class zt extends ot {
|
|
|
3018
3047
|
h,
|
|
3019
3048
|
0,
|
|
3020
3049
|
E
|
|
3021
|
-
) : new
|
|
3050
|
+
) : new wt(
|
|
3022
3051
|
e,
|
|
3023
3052
|
l,
|
|
3024
3053
|
c,
|
|
3025
3054
|
a,
|
|
3026
3055
|
h,
|
|
3027
|
-
|
|
3028
|
-
|
|
3056
|
+
d(this.startPoint.clone().applyMatrix4(s)),
|
|
3057
|
+
d(this.endPoint.clone().applyMatrix4(s))
|
|
3029
3058
|
);
|
|
3030
3059
|
return this.center = x.center, this.normal = x.normal, this.majorAxis = x.majorAxis, this.majorAxisRadius = x.majorAxisRadius, this.minorAxisRadius = x.minorAxisRadius, this._startAngle = x._startAngle, this._endAngle = x._endAngle, this._boundingBoxNeedsUpdate = !0, this;
|
|
3031
3060
|
}
|
|
@@ -3033,7 +3062,7 @@ class zt extends ot {
|
|
|
3033
3062
|
return this.center = t.center, this.normal = t.normal, this.majorAxis = t.majorAxis, this.majorAxisRadius = t.majorAxisRadius, this.minorAxisRadius = t.minorAxisRadius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this._boundingBoxNeedsUpdate = !0, this;
|
|
3034
3063
|
}
|
|
3035
3064
|
clone() {
|
|
3036
|
-
return new
|
|
3065
|
+
return new wt(
|
|
3037
3066
|
this.center,
|
|
3038
3067
|
this.normal,
|
|
3039
3068
|
this.majorAxis,
|
|
@@ -3044,11 +3073,11 @@ class zt extends ot {
|
|
|
3044
3073
|
);
|
|
3045
3074
|
}
|
|
3046
3075
|
get plane() {
|
|
3047
|
-
const t = new
|
|
3076
|
+
const t = new _(this.center).distanceTo(Jt);
|
|
3048
3077
|
return new Ct(this.normal, t);
|
|
3049
3078
|
}
|
|
3050
3079
|
}
|
|
3051
|
-
class
|
|
3080
|
+
class os extends rt {
|
|
3052
3081
|
constructor(t = null, s = !1) {
|
|
3053
3082
|
super(), this._vertices = t || new Array(), this._closed = s;
|
|
3054
3083
|
}
|
|
@@ -3088,7 +3117,7 @@ class ss extends rt {
|
|
|
3088
3117
|
let i = null;
|
|
3089
3118
|
if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
|
|
3090
3119
|
if (n.bulge) {
|
|
3091
|
-
const r = new
|
|
3120
|
+
const r = new $(n, i, n.bulge);
|
|
3092
3121
|
t += r.length;
|
|
3093
3122
|
} else
|
|
3094
3123
|
t += new S(n.x, n.y).distanceTo(i);
|
|
@@ -3127,7 +3156,7 @@ class ss extends rt {
|
|
|
3127
3156
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3128
3157
|
}
|
|
3129
3158
|
clone() {
|
|
3130
|
-
return new
|
|
3159
|
+
return new os(
|
|
3131
3160
|
this._vertices.map((t) => ({ ...t })),
|
|
3132
3161
|
this._closed
|
|
3133
3162
|
);
|
|
@@ -3145,7 +3174,7 @@ class ss extends rt {
|
|
|
3145
3174
|
if (i.bulge) {
|
|
3146
3175
|
let r = null;
|
|
3147
3176
|
if (n < e - 1 ? r = this._vertices[n + 1] : n == e - 1 && this.closed && (r = this._vertices[0]), r) {
|
|
3148
|
-
const a = new
|
|
3177
|
+
const a = new $(i, r, i.bulge).getPoints(t), h = a.length;
|
|
3149
3178
|
for (let c = 0; c < h; ++c) {
|
|
3150
3179
|
const l = a[c];
|
|
3151
3180
|
s.push(new S(l.x, l.y));
|
|
@@ -3228,8 +3257,8 @@ class F extends rt {
|
|
|
3228
3257
|
i
|
|
3229
3258
|
);
|
|
3230
3259
|
if (l.index < 0) break;
|
|
3231
|
-
let
|
|
3232
|
-
if (l.reverse && (
|
|
3260
|
+
let m = e.splice(l.index, 1)[0];
|
|
3261
|
+
if (l.reverse && (m = F.reverseEdge(m)), o.push(m), c = F.getEdgeEndPoint(m), r(c, h)) break;
|
|
3233
3262
|
}
|
|
3234
3263
|
n.push(new F(o));
|
|
3235
3264
|
}
|
|
@@ -3262,7 +3291,7 @@ class F extends rt {
|
|
|
3262
3291
|
return s.setFromPoints(t), s;
|
|
3263
3292
|
}
|
|
3264
3293
|
transform(t) {
|
|
3265
|
-
const s = new
|
|
3294
|
+
const s = new O().set(
|
|
3266
3295
|
t.elements[0],
|
|
3267
3296
|
t.elements[3],
|
|
3268
3297
|
0,
|
|
@@ -3281,7 +3310,7 @@ class F extends rt {
|
|
|
3281
3310
|
1
|
|
3282
3311
|
);
|
|
3283
3312
|
return this._curves.forEach((e) => {
|
|
3284
|
-
e instanceof
|
|
3313
|
+
e instanceof K ? e.transform(s) : e.transform(t);
|
|
3285
3314
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3286
3315
|
}
|
|
3287
3316
|
clone() {
|
|
@@ -3301,8 +3330,8 @@ class F extends rt {
|
|
|
3301
3330
|
static findConnectingEdge(t, s, e) {
|
|
3302
3331
|
let n = -1, i = !1, r = Number.POSITIVE_INFINITY;
|
|
3303
3332
|
for (let o = 0; o < t.length; o++) {
|
|
3304
|
-
const a = t[o], h = F.getEdgeStartPoint(a), c = F.getEdgeEndPoint(a), l = s.x - h.x,
|
|
3305
|
-
|
|
3333
|
+
const a = t[o], h = F.getEdgeStartPoint(a), c = F.getEdgeEndPoint(a), l = s.x - h.x, m = s.y - h.y, d = l * l + m * m;
|
|
3334
|
+
d < r && (r = d, n = o, i = !1);
|
|
3306
3335
|
const x = s.x - c.x, g = s.y - c.y, y = x * x + g * g;
|
|
3307
3336
|
y < r && (r = y, n = o, i = !0);
|
|
3308
3337
|
}
|
|
@@ -3317,13 +3346,13 @@ class F extends rt {
|
|
|
3317
3346
|
return new S(s.x, s.y);
|
|
3318
3347
|
}
|
|
3319
3348
|
static reverseEdge(t) {
|
|
3320
|
-
return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof
|
|
3349
|
+
return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof $ ? new $(
|
|
3321
3350
|
t.center,
|
|
3322
3351
|
t.radius,
|
|
3323
3352
|
t.endAngle,
|
|
3324
3353
|
t.startAngle,
|
|
3325
3354
|
!t.clockwise
|
|
3326
|
-
) : t instanceof
|
|
3355
|
+
) : t instanceof G ? new G(
|
|
3327
3356
|
t.center,
|
|
3328
3357
|
t.majorAxisRadius,
|
|
3329
3358
|
t.minorAxisRadius,
|
|
@@ -3331,11 +3360,11 @@ class F extends rt {
|
|
|
3331
3360
|
t.startAngle,
|
|
3332
3361
|
!t.clockwise,
|
|
3333
3362
|
t.rotation
|
|
3334
|
-
) : t instanceof
|
|
3363
|
+
) : t instanceof K ? F.reverseSplineEdge(t) : t;
|
|
3335
3364
|
}
|
|
3336
3365
|
static reverseSplineEdge(t) {
|
|
3337
3366
|
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;
|
|
3338
|
-
return new
|
|
3367
|
+
return new K(
|
|
3339
3368
|
s,
|
|
3340
3369
|
r,
|
|
3341
3370
|
a,
|
|
@@ -3344,7 +3373,7 @@ class F extends rt {
|
|
|
3344
3373
|
);
|
|
3345
3374
|
}
|
|
3346
3375
|
}
|
|
3347
|
-
class
|
|
3376
|
+
class Nt {
|
|
3348
3377
|
constructor() {
|
|
3349
3378
|
this.c0 = 0, this.c1 = 0, this.c2 = 0, this.c3 = 0;
|
|
3350
3379
|
}
|
|
@@ -3363,9 +3392,9 @@ class Rt {
|
|
|
3363
3392
|
return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
|
|
3364
3393
|
}
|
|
3365
3394
|
}
|
|
3366
|
-
class
|
|
3395
|
+
class Tt extends ot {
|
|
3367
3396
|
constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
|
|
3368
|
-
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new
|
|
3397
|
+
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new _(), this._px = new Nt(), this._py = new Nt(), this._pz = new Nt(), this._points = t.map((i) => new w(i)), this._closed = s, this._curveType = e, this._tension = n;
|
|
3369
3398
|
}
|
|
3370
3399
|
get points() {
|
|
3371
3400
|
return this._points;
|
|
@@ -3405,12 +3434,12 @@ class Nt extends ot {
|
|
|
3405
3434
|
this._closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / i) + 1) * i : a === 0 && o === i - 1 && (o = i - 2, a = 1);
|
|
3406
3435
|
let h, c;
|
|
3407
3436
|
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));
|
|
3408
|
-
const l = n[o % i],
|
|
3437
|
+
const l = n[o % i], m = n[(o + 1) % i];
|
|
3409
3438
|
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") {
|
|
3410
|
-
const
|
|
3411
|
-
let x = Math.pow(h.distanceToSquared(l),
|
|
3412
|
-
g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(h.x, l.x,
|
|
3413
|
-
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(h.x, l.x,
|
|
3439
|
+
const d = this._curveType === "chordal" ? 0.5 : 0.25;
|
|
3440
|
+
let x = Math.pow(h.distanceToSquared(l), d), g = Math.pow(l.distanceToSquared(m), d), y = Math.pow(m.distanceToSquared(c), d);
|
|
3441
|
+
g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(h.x, l.x, m.x, c.x, x, g, y), this._py.initNonuniformCatmullRom(h.y, l.y, m.y, c.y, x, g, y), this._pz.initNonuniformCatmullRom(h.z, l.z, m.z, c.z, x, g, y);
|
|
3442
|
+
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(h.x, l.x, m.x, c.x, this._tension), this._py.initCatmullRom(h.y, l.y, m.y, c.y, this._tension), this._pz.initCatmullRom(h.z, l.z, m.z, c.z, this._tension));
|
|
3414
3443
|
return e.set(
|
|
3415
3444
|
this._px.calc(a),
|
|
3416
3445
|
this._py.calc(a),
|
|
@@ -3436,7 +3465,7 @@ class Nt extends ot {
|
|
|
3436
3465
|
this._tension = t;
|
|
3437
3466
|
}
|
|
3438
3467
|
clone() {
|
|
3439
|
-
return new
|
|
3468
|
+
return new Tt(
|
|
3440
3469
|
this._points.map((t) => t.clone()),
|
|
3441
3470
|
this._closed,
|
|
3442
3471
|
this._curveType,
|
|
@@ -3451,8 +3480,8 @@ class Nt extends ot {
|
|
|
3451
3480
|
}
|
|
3452
3481
|
calculateBoundingBox() {
|
|
3453
3482
|
if (this._points.length === 0)
|
|
3454
|
-
return new
|
|
3455
|
-
const t = new
|
|
3483
|
+
return new v();
|
|
3484
|
+
const t = new v();
|
|
3456
3485
|
return this._points.forEach((s) => {
|
|
3457
3486
|
t.expandByPoint(s);
|
|
3458
3487
|
}), t;
|
|
@@ -3494,7 +3523,7 @@ class T {
|
|
|
3494
3523
|
}
|
|
3495
3524
|
length() {
|
|
3496
3525
|
const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
|
|
3497
|
-
return
|
|
3526
|
+
return Ts(
|
|
3498
3527
|
this._degree,
|
|
3499
3528
|
this._knots,
|
|
3500
3529
|
t,
|
|
@@ -3505,7 +3534,7 @@ class T {
|
|
|
3505
3534
|
return new T(t, s, e, n);
|
|
3506
3535
|
}
|
|
3507
3536
|
static byPoints(t, s, e = "Uniform", n, i) {
|
|
3508
|
-
const r =
|
|
3537
|
+
const r = ss(
|
|
3509
3538
|
t,
|
|
3510
3539
|
s,
|
|
3511
3540
|
e,
|
|
@@ -3542,7 +3571,7 @@ class T {
|
|
|
3542
3571
|
static createFitPointsForClosedCurve(t) {
|
|
3543
3572
|
if (t.length < 4)
|
|
3544
3573
|
throw new Error("At least 4 points are required for a closed NURBS curve");
|
|
3545
|
-
const s = new
|
|
3574
|
+
const s = new Tt(
|
|
3546
3575
|
t,
|
|
3547
3576
|
!0,
|
|
3548
3577
|
"centripetal"
|
|
@@ -3554,7 +3583,7 @@ class T {
|
|
|
3554
3583
|
return T.byPoints(i, s, e);
|
|
3555
3584
|
}
|
|
3556
3585
|
}
|
|
3557
|
-
class
|
|
3586
|
+
class K extends ot {
|
|
3558
3587
|
constructor(t, s, e, n, i, r) {
|
|
3559
3588
|
super();
|
|
3560
3589
|
const o = arguments.length;
|
|
@@ -3716,7 +3745,7 @@ class Q extends ot {
|
|
|
3716
3745
|
}
|
|
3717
3746
|
calculateBoundingBox() {
|
|
3718
3747
|
const t = this.getPoints(100);
|
|
3719
|
-
return new
|
|
3748
|
+
return new v().setFromPoints(t);
|
|
3720
3749
|
}
|
|
3721
3750
|
get closed() {
|
|
3722
3751
|
return this._closed;
|
|
@@ -3747,7 +3776,7 @@ class Q extends ot {
|
|
|
3747
3776
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
3748
3777
|
}
|
|
3749
3778
|
clone() {
|
|
3750
|
-
return this._fitPoints && this._knotParameterization ? new
|
|
3779
|
+
return this._fitPoints && this._knotParameterization ? new K(
|
|
3751
3780
|
this._fitPoints.map((t) => ({
|
|
3752
3781
|
x: t.x,
|
|
3753
3782
|
y: t.y,
|
|
@@ -3766,7 +3795,7 @@ class Q extends ot {
|
|
|
3766
3795
|
y: this._endTangent.y,
|
|
3767
3796
|
z: this._endTangent.z || 0
|
|
3768
3797
|
} : void 0
|
|
3769
|
-
) : new
|
|
3798
|
+
) : new K(
|
|
3770
3799
|
this._controlPoints.map((t) => ({
|
|
3771
3800
|
x: t.x,
|
|
3772
3801
|
y: t.y,
|
|
@@ -3798,79 +3827,83 @@ class Q extends ot {
|
|
|
3798
3827
|
throw new Error(
|
|
3799
3828
|
`At least ${e + 1} points are required for a degree ${e} closed spline`
|
|
3800
3829
|
);
|
|
3801
|
-
return new
|
|
3830
|
+
return new K(t, s, e, !0);
|
|
3802
3831
|
}
|
|
3803
3832
|
}
|
|
3804
3833
|
export {
|
|
3805
|
-
|
|
3834
|
+
rs as AcGeArea2d,
|
|
3806
3835
|
X as AcGeBox2d,
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3836
|
+
v as AcGeBox3d,
|
|
3837
|
+
Tt as AcGeCatmullRomCurve3d,
|
|
3838
|
+
$ as AcGeCircArc2d,
|
|
3810
3839
|
At as AcGeCircArc3d,
|
|
3811
3840
|
rt as AcGeCurve2d,
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3841
|
+
G as AcGeEllipseArc2d,
|
|
3842
|
+
wt as AcGeEllipseArc3d,
|
|
3843
|
+
Xt as AcGeEuler,
|
|
3844
|
+
ks as AcGeGeometryUtil,
|
|
3816
3845
|
Pt as AcGeLine2d,
|
|
3817
3846
|
Mt as AcGeLine3d,
|
|
3818
3847
|
F as AcGeLoop2d,
|
|
3819
3848
|
M as AcGeMathUtil,
|
|
3820
3849
|
it as AcGeMatrix2d,
|
|
3821
|
-
|
|
3850
|
+
O as AcGeMatrix3d,
|
|
3822
3851
|
T as AcGeNurbsCurve,
|
|
3823
3852
|
Ct as AcGePlane,
|
|
3824
3853
|
S as AcGePoint2d,
|
|
3825
3854
|
w as AcGePoint3d,
|
|
3826
|
-
|
|
3855
|
+
os as AcGePolyline2d,
|
|
3827
3856
|
St as AcGeQuaternion,
|
|
3828
|
-
|
|
3829
|
-
|
|
3857
|
+
is as AcGeShape2d,
|
|
3858
|
+
K as AcGeSpline3d,
|
|
3830
3859
|
bt as AcGeTol,
|
|
3831
3860
|
B as AcGeVector2d,
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3861
|
+
_ as AcGeVector3d,
|
|
3862
|
+
Gt as DEFAULT_TOL,
|
|
3863
|
+
Qt as DEG2RAD,
|
|
3864
|
+
H as FLOAT_TOL,
|
|
3865
|
+
Ls as ORIGIN_POINT_2D,
|
|
3866
|
+
Jt as ORIGIN_POINT_3D,
|
|
3867
|
+
Kt as RAD2DEG,
|
|
3839
3868
|
E as TAU,
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3869
|
+
zt as basisFunction,
|
|
3870
|
+
Ts as calculateCurveLength,
|
|
3871
|
+
ws as ceilPowerOfTwo,
|
|
3843
3872
|
Z as clamp,
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3873
|
+
Rs as computeParameterValues,
|
|
3874
|
+
ls as damp,
|
|
3875
|
+
ps as degToRad,
|
|
3876
|
+
$t as euclideanModulo,
|
|
3848
3877
|
ft as evaluateNurbsPoint,
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
Ht as
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3878
|
+
zs as floorPowerOfTwo,
|
|
3879
|
+
Ns as generateAveragedKnots,
|
|
3880
|
+
Xs as generateChordKnots,
|
|
3881
|
+
Ds as generateSqrtChordKnots,
|
|
3882
|
+
hs as generateUUID,
|
|
3883
|
+
Fs as generateUniformKnots,
|
|
3884
|
+
Os as getOcsAngle,
|
|
3885
|
+
Ys as getOcsReferenceVector,
|
|
3886
|
+
Ht as intPartLength,
|
|
3887
|
+
vs as interpolateControlPoints,
|
|
3888
|
+
ss as interpolateNurbsCurve,
|
|
3889
|
+
cs as inverseLerp,
|
|
3890
|
+
Ms as isBetween,
|
|
3891
|
+
Ps as isBetweenAngle,
|
|
3892
|
+
ts as isPointInPolygon,
|
|
3893
|
+
Bs as isPolygonIntersect,
|
|
3894
|
+
As as isPowerOfTwo,
|
|
3895
|
+
Wt as lerp,
|
|
3896
|
+
as as mapLinear,
|
|
3866
3897
|
pt as normalizeAngle,
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3898
|
+
us as pingpong,
|
|
3899
|
+
fs as radToDeg,
|
|
3900
|
+
gs as randFloat,
|
|
3901
|
+
ys as randFloatSpread,
|
|
3902
|
+
xs as randInt,
|
|
3903
|
+
bs as relativeEps,
|
|
3904
|
+
_s as seededRandom,
|
|
3905
|
+
ms as smootherstep,
|
|
3906
|
+
ds as smoothstep,
|
|
3907
|
+
Zs as transformOcsPointToWcs,
|
|
3908
|
+
Yt as transformWcsPointToOcs
|
|
3876
3909
|
};
|