@mlightcad/geometry-engine 3.2.16 → 3.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/geometry-engine.js +801 -652
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/geometry/AcGeArea2d.d.ts +1 -1
- package/lib/geometry/AcGeArea2d.d.ts.map +1 -1
- package/lib/geometry/AcGeArea2d.js +4 -2
- package/lib/geometry/AcGeArea2d.js.map +1 -1
- package/lib/geometry/AcGeCircArc2d.d.ts.map +1 -1
- package/lib/geometry/AcGeCircArc2d.js +27 -1
- package/lib/geometry/AcGeCircArc2d.js.map +1 -1
- package/lib/geometry/AcGeCircArc3d.d.ts.map +1 -1
- package/lib/geometry/AcGeCircArc3d.js +26 -15
- package/lib/geometry/AcGeCircArc3d.js.map +1 -1
- package/lib/geometry/AcGeEllipseArc2d.d.ts +1 -0
- package/lib/geometry/AcGeEllipseArc2d.d.ts.map +1 -1
- package/lib/geometry/AcGeEllipseArc2d.js +38 -0
- package/lib/geometry/AcGeEllipseArc2d.js.map +1 -1
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -1
- package/lib/geometry/AcGeEllipseArc3d.js +39 -0
- package/lib/geometry/AcGeEllipseArc3d.js.map +1 -1
- package/lib/geometry/AcGeLoop2d.d.ts +1 -1
- package/lib/geometry/AcGeLoop2d.d.ts.map +1 -1
- package/lib/geometry/AcGeLoop2d.js +11 -3
- package/lib/geometry/AcGeLoop2d.js.map +1 -1
- package/lib/geometry/AcGePolyline2d.d.ts +1 -1
- package/lib/geometry/AcGePolyline2d.d.ts.map +1 -1
- package/lib/geometry/AcGePolyline2d.js +10 -2
- package/lib/geometry/AcGePolyline2d.js.map +1 -1
- package/lib/geometry/AcGeSpline3d.d.ts +1 -1
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
- package/lib/geometry/AcGeSpline3d.js +21 -2
- package/lib/geometry/AcGeSpline3d.js.map +1 -1
- package/package.json +2 -2
package/dist/geometry-engine.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AcCmErrors as
|
|
2
|
-
const
|
|
1
|
+
import { AcCmErrors as L } from "@mlightcad/common";
|
|
2
|
+
const N = [
|
|
3
3
|
"00",
|
|
4
4
|
"01",
|
|
5
5
|
"02",
|
|
@@ -257,100 +257,100 @@ const R = [
|
|
|
257
257
|
"fe",
|
|
258
258
|
"ff"
|
|
259
259
|
];
|
|
260
|
-
let
|
|
261
|
-
const
|
|
260
|
+
let Rt = 1234567;
|
|
261
|
+
const Xt = Math.PI / 180, Dt = 180 / Math.PI;
|
|
262
262
|
function Jt() {
|
|
263
|
-
const
|
|
264
|
-
return (
|
|
263
|
+
const d = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
|
264
|
+
return (N[d & 255] + N[d >> 8 & 255] + N[d >> 16 & 255] + N[d >> 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
|
|
267
|
-
return Math.max(t, Math.min(s,
|
|
266
|
+
function Z(d, t, s) {
|
|
267
|
+
return Math.max(t, Math.min(s, d));
|
|
268
268
|
}
|
|
269
|
-
function Yt(
|
|
270
|
-
return (
|
|
269
|
+
function Yt(d, t) {
|
|
270
|
+
return (d % t + t) % t;
|
|
271
271
|
}
|
|
272
|
-
function ts(
|
|
273
|
-
return e + (
|
|
272
|
+
function ts(d, t, s, e, n) {
|
|
273
|
+
return e + (d - t) * (n - e) / (s - t);
|
|
274
274
|
}
|
|
275
|
-
function ss(
|
|
276
|
-
return
|
|
275
|
+
function ss(d, t, s) {
|
|
276
|
+
return d !== t ? (s - d) / (t - d) : 0;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
return (1 - s) *
|
|
278
|
+
function vt(d, t, s) {
|
|
279
|
+
return (1 - s) * d + s * t;
|
|
280
280
|
}
|
|
281
|
-
function es(
|
|
282
|
-
return
|
|
281
|
+
function es(d, t, s, e) {
|
|
282
|
+
return vt(d, t, 1 - Math.exp(-s * e));
|
|
283
283
|
}
|
|
284
|
-
function ns(
|
|
285
|
-
return t - Math.abs(Yt(
|
|
284
|
+
function ns(d, t = 1) {
|
|
285
|
+
return t - Math.abs(Yt(d, t * 2) - t);
|
|
286
286
|
}
|
|
287
|
-
function is(
|
|
288
|
-
return
|
|
287
|
+
function is(d, t, s) {
|
|
288
|
+
return d <= t ? 0 : d >= s ? 1 : (d = (d - t) / (s - t), d * d * (3 - 2 * d));
|
|
289
289
|
}
|
|
290
|
-
function rs(
|
|
291
|
-
return
|
|
290
|
+
function rs(d, t, s) {
|
|
291
|
+
return d <= t ? 0 : d >= s ? 1 : (d = (d - t) / (s - t), d * d * d * (d * (d * 6 - 15) + 10));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return
|
|
293
|
+
function os(d, t) {
|
|
294
|
+
return d + Math.floor(Math.random() * (t - d + 1));
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return
|
|
296
|
+
function hs(d, t) {
|
|
297
|
+
return d + Math.random() * (t - d);
|
|
298
298
|
}
|
|
299
|
-
function as(
|
|
300
|
-
return
|
|
299
|
+
function as(d) {
|
|
300
|
+
return d * (0.5 - Math.random());
|
|
301
301
|
}
|
|
302
|
-
function cs(
|
|
303
|
-
|
|
304
|
-
let t =
|
|
302
|
+
function cs(d) {
|
|
303
|
+
d !== void 0 && (Rt = d);
|
|
304
|
+
let t = Rt += 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 ls(
|
|
308
|
-
return
|
|
307
|
+
function ls(d) {
|
|
308
|
+
return d * Xt;
|
|
309
309
|
}
|
|
310
|
-
function us(
|
|
311
|
-
return
|
|
310
|
+
function us(d) {
|
|
311
|
+
return d * Dt;
|
|
312
312
|
}
|
|
313
|
-
function ds(
|
|
314
|
-
return (
|
|
313
|
+
function ds(d) {
|
|
314
|
+
return (d & d - 1) === 0 && d !== 0;
|
|
315
315
|
}
|
|
316
|
-
function ms(
|
|
317
|
-
return Math.pow(2, Math.ceil(Math.log(
|
|
316
|
+
function ms(d) {
|
|
317
|
+
return Math.pow(2, Math.ceil(Math.log(d) / Math.LN2));
|
|
318
318
|
}
|
|
319
|
-
function xs(
|
|
320
|
-
return Math.pow(2, Math.floor(Math.log(
|
|
319
|
+
function xs(d) {
|
|
320
|
+
return Math.pow(2, Math.floor(Math.log(d) / Math.LN2));
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function pt(d) {
|
|
323
323
|
const t = Math.PI * 2;
|
|
324
|
-
return (
|
|
324
|
+
return (d % t + t) % t;
|
|
325
325
|
}
|
|
326
|
-
function gs(
|
|
327
|
-
return
|
|
326
|
+
function gs(d, t, s) {
|
|
327
|
+
return d > t && d < s || d > s && d < t;
|
|
328
328
|
}
|
|
329
|
-
function ys(
|
|
330
|
-
return
|
|
329
|
+
function ys(d, t, s, e = !1) {
|
|
330
|
+
return d = pt(d), t = pt(t), s = pt(s), e ? t > s ? d <= t && d >= s : d <= t || d >= s : t < s ? d >= t && d <= s : d >= t || d <= s;
|
|
331
331
|
}
|
|
332
|
-
function Zt(
|
|
333
|
-
return
|
|
332
|
+
function Zt(d) {
|
|
333
|
+
return d = Math.abs(d), d < 1 ? 0 : Math.ceil(Math.log10(Math.abs(d) + 1));
|
|
334
334
|
}
|
|
335
|
-
function _s(
|
|
336
|
-
const s = Zt(
|
|
335
|
+
function _s(d, t = 1e-7) {
|
|
336
|
+
const s = Zt(d);
|
|
337
337
|
return Math.max(Math.pow(10, s) * t, t);
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
DEG2RAD:
|
|
341
|
-
RAD2DEG:
|
|
339
|
+
const M = {
|
|
340
|
+
DEG2RAD: Xt,
|
|
341
|
+
RAD2DEG: Dt,
|
|
342
342
|
generateUUID: Jt,
|
|
343
|
-
clamp:
|
|
343
|
+
clamp: Z,
|
|
344
344
|
euclideanModulo: Yt,
|
|
345
345
|
mapLinear: ts,
|
|
346
346
|
inverseLerp: ss,
|
|
347
|
-
lerp:
|
|
347
|
+
lerp: vt,
|
|
348
348
|
damp: es,
|
|
349
349
|
pingpong: ns,
|
|
350
350
|
smoothstep: is,
|
|
351
351
|
smootherstep: rs,
|
|
352
|
-
randInt:
|
|
353
|
-
randFloat:
|
|
352
|
+
randInt: os,
|
|
353
|
+
randFloat: hs,
|
|
354
354
|
randFloatSpread: as,
|
|
355
355
|
seededRandom: cs,
|
|
356
356
|
degToRad: ls,
|
|
@@ -358,12 +358,12 @@ const b = {
|
|
|
358
358
|
isPowerOfTwo: ds,
|
|
359
359
|
ceilPowerOfTwo: ms,
|
|
360
360
|
floorPowerOfTwo: xs,
|
|
361
|
-
normalizeAngle:
|
|
361
|
+
normalizeAngle: pt,
|
|
362
362
|
isBetween: gs,
|
|
363
363
|
isBetweenAngle: ys,
|
|
364
364
|
intPartLength: Zt,
|
|
365
365
|
relativeEps: _s
|
|
366
|
-
},
|
|
366
|
+
}, tt = class tt {
|
|
367
367
|
constructor(t, s) {
|
|
368
368
|
this.x = 0, this.y = 0;
|
|
369
369
|
const e = +(t !== void 0) + +(s !== void 0);
|
|
@@ -381,7 +381,7 @@ const b = {
|
|
|
381
381
|
this.x = t, this.y = s;
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
throw
|
|
384
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
get width() {
|
|
@@ -432,7 +432,7 @@ const b = {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
clone() {
|
|
435
|
-
return new
|
|
435
|
+
return new tt(this.x, this.y);
|
|
436
436
|
}
|
|
437
437
|
copy(t) {
|
|
438
438
|
return this.x = t.x, this.y = t.y, this;
|
|
@@ -571,23 +571,23 @@ const b = {
|
|
|
571
571
|
}
|
|
572
572
|
relativeEps(t = 1e-7) {
|
|
573
573
|
return Math.min(
|
|
574
|
-
|
|
575
|
-
|
|
574
|
+
M.relativeEps(this.x, t),
|
|
575
|
+
M.relativeEps(this.y, t)
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
578
|
*[Symbol.iterator]() {
|
|
579
579
|
yield this.x, yield this.y;
|
|
580
580
|
}
|
|
581
581
|
};
|
|
582
|
-
|
|
583
|
-
let B =
|
|
584
|
-
const
|
|
585
|
-
constructor(t, s, e, n, i, r,
|
|
586
|
-
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null &&
|
|
582
|
+
tt.EMPTY = Object.freeze(new tt(0, 0));
|
|
583
|
+
let B = tt;
|
|
584
|
+
const st = class st {
|
|
585
|
+
constructor(t, s, e, n, i, r, o, a, h) {
|
|
586
|
+
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && this.set(t, s, e, n, i, r, o, a, h);
|
|
587
587
|
}
|
|
588
|
-
set(t, s, e, n, i, r,
|
|
588
|
+
set(t, s, e, n, i, r, o, a, h) {
|
|
589
589
|
const c = this.elements;
|
|
590
|
-
return c[0] = t, c[1] = n, c[2] =
|
|
590
|
+
return c[0] = t, c[1] = n, c[2] = o, c[3] = s, c[4] = i, c[5] = a, c[6] = e, c[7] = r, c[8] = h, this;
|
|
591
591
|
}
|
|
592
592
|
identity() {
|
|
593
593
|
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
|
|
@@ -610,22 +610,22 @@ const W = class W {
|
|
|
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],
|
|
614
|
-
return i[0] = r * g +
|
|
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], u = e[5], x = e[8], g = n[0], y = n[3], _ = n[6], z = n[1], f = n[4], b = n[7], P = n[2], I = n[5], A = n[8];
|
|
614
|
+
return i[0] = r * g + o * z + a * P, i[3] = r * y + o * f + a * I, i[6] = r * _ + o * b + a * A, i[1] = h * g + c * z + l * P, i[4] = h * y + c * f + l * I, i[7] = h * _ + c * b + l * A, i[2] = m * g + u * z + x * P, i[5] = m * y + u * f + x * I, i[8] = m * _ + u * b + x * A, this;
|
|
615
615
|
}
|
|
616
616
|
multiplyScalar(t) {
|
|
617
617
|
const s = this.elements;
|
|
618
618
|
return s[0] *= t, s[3] *= t, s[6] *= t, s[1] *= t, s[4] *= t, s[7] *= t, s[2] *= t, s[5] *= t, s[8] *= t, this;
|
|
619
619
|
}
|
|
620
620
|
determinant() {
|
|
621
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4],
|
|
622
|
-
return s * r * c - s *
|
|
621
|
+
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];
|
|
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],
|
|
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, u = h * i - r * a, x = s * l + e * m + n * u;
|
|
626
626
|
if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
627
627
|
const g = 1 / x;
|
|
628
|
-
return t[0] = l * g, t[1] = (n *
|
|
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] = u * g, t[7] = (e * a - h * s) * g, t[8] = (r * s - e * i) * g, this;
|
|
629
629
|
}
|
|
630
630
|
transpose() {
|
|
631
631
|
let t;
|
|
@@ -639,28 +639,28 @@ const W = class W {
|
|
|
639
639
|
const s = this.elements;
|
|
640
640
|
return t.elements[0] = s[0], t.elements[1] = s[3], t.elements[2] = s[6], t.elements[3] = s[1], t.elements[4] = s[4], t.elements[5] = s[7], t.elements[6] = s[2], t.elements[7] = s[5], t.elements[8] = s[8], this;
|
|
641
641
|
}
|
|
642
|
-
setUvTransform(t, s, e, n, i, r,
|
|
643
|
-
const a = Math.cos(i),
|
|
642
|
+
setUvTransform(t, s, e, n, i, r, o) {
|
|
643
|
+
const a = Math.cos(i), h = Math.sin(i);
|
|
644
644
|
return this.set(
|
|
645
645
|
e * a,
|
|
646
|
-
e *
|
|
647
|
-
-e * (a * r +
|
|
648
|
-
-n *
|
|
646
|
+
e * h,
|
|
647
|
+
-e * (a * r + h * o) + r + t,
|
|
648
|
+
-n * h,
|
|
649
649
|
n * a,
|
|
650
|
-
-n * (-
|
|
650
|
+
-n * (-h * r + a * o) + o + s,
|
|
651
651
|
0,
|
|
652
652
|
0,
|
|
653
653
|
1
|
|
654
654
|
), this;
|
|
655
655
|
}
|
|
656
656
|
scale(t, s) {
|
|
657
|
-
return this.premultiply(
|
|
657
|
+
return this.premultiply(Ct.makeScale(t, s)), this;
|
|
658
658
|
}
|
|
659
659
|
rotate(t) {
|
|
660
|
-
return this.premultiply(
|
|
660
|
+
return this.premultiply(Ct.makeRotation(-t)), this;
|
|
661
661
|
}
|
|
662
662
|
translate(t, s) {
|
|
663
|
-
return this.premultiply(
|
|
663
|
+
return this.premultiply(Ct.makeTranslation(t, s)), this;
|
|
664
664
|
}
|
|
665
665
|
makeTranslation(t, s) {
|
|
666
666
|
return t instanceof B ? this.set(1, 0, t.x, 0, 1, t.y, 0, 0, 1) : this.set(1, 0, t, 0, 1, s, 0, 0, 1), this;
|
|
@@ -688,22 +688,22 @@ const W = class W {
|
|
|
688
688
|
return t[s] = e[0], t[s + 1] = e[1], t[s + 2] = e[2], t[s + 3] = e[3], t[s + 4] = e[4], t[s + 5] = e[5], t[s + 6] = e[6], t[s + 7] = e[7], t[s + 8] = e[8], t;
|
|
689
689
|
}
|
|
690
690
|
clone() {
|
|
691
|
-
return new
|
|
691
|
+
return new st().fromArray(this.elements);
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
-
|
|
695
|
-
let
|
|
696
|
-
const
|
|
694
|
+
st.IDENTITY = Object.freeze(new st());
|
|
695
|
+
let it = st;
|
|
696
|
+
const Ct = new it(), G = 1e-6, E = 2 * Math.PI, Bs = {
|
|
697
697
|
x: 0,
|
|
698
698
|
y: 0
|
|
699
|
-
},
|
|
699
|
+
}, Ot = {
|
|
700
700
|
x: 0,
|
|
701
701
|
y: 0,
|
|
702
702
|
z: 0
|
|
703
703
|
};
|
|
704
|
-
class
|
|
704
|
+
class Qt {
|
|
705
705
|
constructor() {
|
|
706
|
-
this.equalPointTol =
|
|
706
|
+
this.equalPointTol = G, this.equalVectorTol = G;
|
|
707
707
|
}
|
|
708
708
|
equalPoint2d(t, s) {
|
|
709
709
|
return new B(t).sub(s).length() < this.equalPointTol;
|
|
@@ -711,50 +711,50 @@ class Gt {
|
|
|
711
711
|
equalPoint3d(t, s) {
|
|
712
712
|
return new p(t).sub(s).length() < this.equalPointTol;
|
|
713
713
|
}
|
|
714
|
-
static equalToZero(t, s =
|
|
714
|
+
static equalToZero(t, s = G) {
|
|
715
715
|
return t < s && t > -s;
|
|
716
716
|
}
|
|
717
|
-
static equal(t, s, e =
|
|
717
|
+
static equal(t, s, e = G) {
|
|
718
718
|
return Math.abs(t - s) < e;
|
|
719
719
|
}
|
|
720
|
-
static great(t, s, e =
|
|
720
|
+
static great(t, s, e = G) {
|
|
721
721
|
return t - s > e;
|
|
722
722
|
}
|
|
723
|
-
static less(t, s, e =
|
|
723
|
+
static less(t, s, e = G) {
|
|
724
724
|
return t - s < e;
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
const
|
|
728
|
-
function
|
|
729
|
-
const e =
|
|
727
|
+
const Kt = new Qt();
|
|
728
|
+
function Gt(d, t, s = !1) {
|
|
729
|
+
const e = d.x, n = d.y;
|
|
730
730
|
let i = !1;
|
|
731
731
|
const r = t.length;
|
|
732
|
-
for (let
|
|
733
|
-
const
|
|
734
|
-
let
|
|
735
|
-
s && (
|
|
732
|
+
for (let o = 0, a = r - 1; o < r; a = o++) {
|
|
733
|
+
const h = t[o].x, c = t[o].y, l = t[a].x, m = t[a].y;
|
|
734
|
+
let u = c > n != m > n;
|
|
735
|
+
s && (u = c >= n != m >= n), u && e < (l - h) * (n - c) / (m - c) + h && (i = !i);
|
|
736
736
|
}
|
|
737
737
|
return i;
|
|
738
738
|
}
|
|
739
|
-
function ps(
|
|
740
|
-
if (
|
|
739
|
+
function ps(d, t) {
|
|
740
|
+
if (d.length === 0 || t.length === 0)
|
|
741
741
|
return !1;
|
|
742
|
-
const s = new F().setFromPoints(
|
|
742
|
+
const s = new F().setFromPoints(d), e = new F().setFromPoints(t);
|
|
743
743
|
if (!s.intersectsBox(e))
|
|
744
744
|
return !1;
|
|
745
|
-
for (let n = 0; n <
|
|
746
|
-
if (
|
|
745
|
+
for (let n = 0; n < d.length; ) {
|
|
746
|
+
if (Gt(d[n], t, !0))
|
|
747
747
|
return !0;
|
|
748
|
-
n <
|
|
748
|
+
n < d.length - 1 && Kt.equalPoint2d(d[n + 1], d[n]) && ++n, ++n;
|
|
749
749
|
}
|
|
750
750
|
return !1;
|
|
751
751
|
}
|
|
752
|
-
const
|
|
753
|
-
isPointInPolygon:
|
|
752
|
+
const fs = {
|
|
753
|
+
isPointInPolygon: Gt,
|
|
754
754
|
isPolygonIntersect: ps
|
|
755
755
|
};
|
|
756
|
-
function ks(
|
|
757
|
-
const s = [], e = t - 1, n =
|
|
756
|
+
function ks(d, t) {
|
|
757
|
+
const s = [], e = t - 1, n = d;
|
|
758
758
|
for (let i = 0; i <= n; i++)
|
|
759
759
|
s.push(0);
|
|
760
760
|
for (let i = 1; i <= e - n; i++)
|
|
@@ -763,230 +763,230 @@ function ks(u, t) {
|
|
|
763
763
|
s.push(e - n + 1);
|
|
764
764
|
return s;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
const s = t.length - 1, e =
|
|
766
|
+
function Rs(d, t) {
|
|
767
|
+
const s = t.length - 1, e = d, n = [0];
|
|
768
768
|
let i = 0;
|
|
769
|
-
for (let
|
|
770
|
-
const a = t[
|
|
769
|
+
for (let o = 1; o <= s; o++) {
|
|
770
|
+
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);
|
|
771
771
|
i += l, n.push(i);
|
|
772
772
|
}
|
|
773
773
|
const r = [];
|
|
774
|
-
for (let
|
|
774
|
+
for (let o = 0; o <= e; o++)
|
|
775
775
|
r.push(0);
|
|
776
|
-
for (let
|
|
777
|
-
const a = n[
|
|
776
|
+
for (let o = 1; o <= s - e; o++) {
|
|
777
|
+
const a = n[o] / i;
|
|
778
778
|
r.push(a * (s - e + 1));
|
|
779
779
|
}
|
|
780
|
-
for (let
|
|
780
|
+
for (let o = 0; o <= e; o++)
|
|
781
781
|
r.push(s - e + 1);
|
|
782
782
|
return r;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
const s =
|
|
784
|
+
function As(d, t = "Uniform") {
|
|
785
|
+
const s = d.length;
|
|
786
786
|
if (s === 0)
|
|
787
787
|
return [];
|
|
788
788
|
if (s === 1)
|
|
789
789
|
return [0];
|
|
790
790
|
const e = s - 1;
|
|
791
791
|
if (t === "Uniform")
|
|
792
|
-
return new Array(s).fill(0).map((r,
|
|
792
|
+
return new Array(s).fill(0).map((r, o) => o / e);
|
|
793
793
|
const n = [0];
|
|
794
794
|
let i = 0;
|
|
795
795
|
for (let r = 1; r <= e; r++) {
|
|
796
|
-
const
|
|
796
|
+
const o = d[r][0] - d[r - 1][0], a = d[r][1] - d[r - 1][1], h = d[r][2] - d[r - 1][2], c = Math.sqrt(o * o + a * a + h * h), l = t === "SqrtChord" ? Math.sqrt(c) : c;
|
|
797
797
|
i += l, n.push(i);
|
|
798
798
|
}
|
|
799
|
-
return i < 1e-12 ? new Array(s).fill(0).map((r,
|
|
799
|
+
return i < 1e-12 ? new Array(s).fill(0).map((r, o) => o / e) : n.map((r) => r / i);
|
|
800
800
|
}
|
|
801
|
-
function zs(
|
|
802
|
-
const s = t.length - 1, e =
|
|
803
|
-
for (let
|
|
804
|
-
i[
|
|
805
|
-
for (let
|
|
801
|
+
function zs(d, t) {
|
|
802
|
+
const s = t.length - 1, e = d, n = s + e + 1, i = new Array(n + 1).fill(0), r = t[t.length - 1];
|
|
803
|
+
for (let o = n - e; o <= n; o++)
|
|
804
|
+
i[o] = r;
|
|
805
|
+
for (let o = 1; o <= s - e; o++) {
|
|
806
806
|
let a = 0;
|
|
807
|
-
for (let
|
|
808
|
-
a += t[
|
|
809
|
-
i[
|
|
807
|
+
for (let h = o; h < o + e; h++)
|
|
808
|
+
a += t[h];
|
|
809
|
+
i[o + e] = a / e;
|
|
810
810
|
}
|
|
811
811
|
return i;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
const s = t.length - 1, e =
|
|
813
|
+
function Ns(d, t) {
|
|
814
|
+
const s = t.length - 1, e = d, n = [0];
|
|
815
815
|
let i = 0;
|
|
816
|
-
for (let
|
|
817
|
-
const a = t[
|
|
816
|
+
for (let o = 1; o <= s; o++) {
|
|
817
|
+
const a = t[o][0] - t[o - 1][0], h = t[o][1] - t[o - 1][1], c = t[o][2] - t[o - 1][2], l = Math.sqrt(a * a + h * h + c * c), m = Math.sqrt(l);
|
|
818
818
|
i += m, n.push(i);
|
|
819
819
|
}
|
|
820
820
|
const r = [];
|
|
821
|
-
for (let
|
|
821
|
+
for (let o = 0; o <= e; o++)
|
|
822
822
|
r.push(0);
|
|
823
|
-
for (let
|
|
824
|
-
const a = n[
|
|
823
|
+
for (let o = 1; o <= s - e; o++) {
|
|
824
|
+
const a = n[o] / i;
|
|
825
825
|
r.push(a * (s - e + 1));
|
|
826
826
|
}
|
|
827
|
-
for (let
|
|
827
|
+
for (let o = 0; o <= e; o++)
|
|
828
828
|
r.push(s - e + 1);
|
|
829
829
|
return r;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
832
|
-
const s =
|
|
831
|
+
function Et(d, t) {
|
|
832
|
+
const s = d.length, e = d.map((r) => r.slice()), n = t.slice();
|
|
833
833
|
for (let r = 0; r < s; r++) {
|
|
834
|
-
let
|
|
835
|
-
for (let
|
|
836
|
-
const c = Math.abs(e[
|
|
837
|
-
c > a && (a = c,
|
|
834
|
+
let o = r, a = Math.abs(e[r][r]);
|
|
835
|
+
for (let h = r + 1; h < s; h++) {
|
|
836
|
+
const c = Math.abs(e[h][r]);
|
|
837
|
+
c > a && (a = c, o = h);
|
|
838
838
|
}
|
|
839
839
|
if (a < 1e-12)
|
|
840
840
|
throw new Error("Interpolation matrix is singular.");
|
|
841
|
-
if (
|
|
842
|
-
const
|
|
843
|
-
e[r] = e[
|
|
841
|
+
if (o !== r) {
|
|
842
|
+
const h = e[r];
|
|
843
|
+
e[r] = e[o], e[o] = h;
|
|
844
844
|
const c = n[r];
|
|
845
|
-
n[r] = n[
|
|
845
|
+
n[r] = n[o], n[o] = c;
|
|
846
846
|
}
|
|
847
|
-
for (let
|
|
848
|
-
const c = e[
|
|
847
|
+
for (let h = r + 1; h < s; h++) {
|
|
848
|
+
const c = e[h][r] / e[r][r];
|
|
849
849
|
if (!(Math.abs(c) < 1e-14)) {
|
|
850
850
|
for (let l = r; l < s; l++)
|
|
851
|
-
e[
|
|
852
|
-
n[
|
|
851
|
+
e[h][l] -= c * e[r][l];
|
|
852
|
+
n[h] -= c * n[r];
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
856
|
const i = new Array(s).fill(0);
|
|
857
857
|
for (let r = s - 1; r >= 0; r--) {
|
|
858
|
-
let
|
|
858
|
+
let o = n[r];
|
|
859
859
|
for (let a = r + 1; a < s; a++)
|
|
860
|
-
|
|
861
|
-
i[r] =
|
|
860
|
+
o -= e[r][a] * i[a];
|
|
861
|
+
i[r] = o / e[r][r];
|
|
862
862
|
}
|
|
863
863
|
return i;
|
|
864
864
|
}
|
|
865
|
-
function
|
|
866
|
-
if (
|
|
865
|
+
function $t(d, t, s = "Uniform", e, n) {
|
|
866
|
+
if (d.length === 0)
|
|
867
867
|
return { controlPoints: [], knots: [], weights: [] };
|
|
868
|
-
const i =
|
|
868
|
+
const i = d.map((S) => [S[0], S[1], S[2] ?? 0]), r = !!e, o = !!n, a = (r ? 1 : 0) + (o ? 1 : 0), h = i.length - 1, c = h + a;
|
|
869
869
|
if (c < t)
|
|
870
870
|
throw new Error("Not enough points to interpolate a curve of this degree.");
|
|
871
|
-
const l =
|
|
872
|
-
r && m.unshift(l[0]),
|
|
873
|
-
const
|
|
874
|
-
let
|
|
875
|
-
g[
|
|
876
|
-
for (let
|
|
877
|
-
const T = l[
|
|
878
|
-
g[
|
|
879
|
-
for (let
|
|
880
|
-
g[
|
|
881
|
-
y[
|
|
882
|
-
}
|
|
883
|
-
if (g[
|
|
884
|
-
const
|
|
885
|
-
g[
|
|
886
|
-
}
|
|
887
|
-
if (
|
|
888
|
-
const
|
|
889
|
-
g[
|
|
890
|
-
}
|
|
891
|
-
const
|
|
892
|
-
for (let
|
|
893
|
-
|
|
871
|
+
const l = As(i, s), m = l.slice();
|
|
872
|
+
r && m.unshift(l[0]), o && m.push(l[l.length - 1]);
|
|
873
|
+
const u = zs(t, m), x = c + 1, g = new Array(x), y = new Array(x), _ = new Array(x), z = new Array(x);
|
|
874
|
+
let f = 0;
|
|
875
|
+
g[f] = new Array(x).fill(0), g[f][0] = 1, y[f] = i[0][0], _[f] = i[0][1], z[f] = i[0][2], f++;
|
|
876
|
+
for (let S = 1; S <= h - 1; S++) {
|
|
877
|
+
const T = l[S];
|
|
878
|
+
g[f] = new Array(x).fill(0);
|
|
879
|
+
for (let U = 0; U <= c; U++)
|
|
880
|
+
g[f][U] = wt(U, t, T, u);
|
|
881
|
+
y[f] = i[S][0], _[f] = i[S][1], z[f] = i[S][2], f++;
|
|
882
|
+
}
|
|
883
|
+
if (g[f] = new Array(x).fill(0), g[f][c] = 1, y[f] = i[h][0], _[f] = i[h][1], z[f] = i[h][2], f++, r) {
|
|
884
|
+
const S = u[t + 1] - u[0], T = S !== 0 ? t / S : 0;
|
|
885
|
+
g[f] = new Array(x).fill(0), g[f][0] = -T, g[f][1] = T, y[f] = (e == null ? void 0 : e[0]) ?? 0, _[f] = (e == null ? void 0 : e[1]) ?? 0, z[f] = (e == null ? void 0 : e[2]) ?? 0, f++;
|
|
886
|
+
}
|
|
887
|
+
if (o) {
|
|
888
|
+
const S = u[c + t + 1] - u[c], T = S !== 0 ? t / S : 0;
|
|
889
|
+
g[f] = new Array(x).fill(0), g[f][c - 1] = -T, g[f][c] = T, y[f] = (n == null ? void 0 : n[0]) ?? 0, _[f] = (n == null ? void 0 : n[1]) ?? 0, z[f] = (n == null ? void 0 : n[2]) ?? 0, f++;
|
|
890
|
+
}
|
|
891
|
+
const b = Et(g, y), P = Et(g, _), I = Et(g, z), A = new Array(x);
|
|
892
|
+
for (let S = 0; S < x; S++)
|
|
893
|
+
A[S] = [b[S], P[S], I[S]];
|
|
894
894
|
const k = new Array(x).fill(1);
|
|
895
|
-
return { controlPoints:
|
|
895
|
+
return { controlPoints: A, knots: u, weights: k };
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function wt(d, t, s, e) {
|
|
898
898
|
if (t === 0)
|
|
899
|
-
return s >= e[
|
|
900
|
-
const n = e[
|
|
901
|
-
return r *
|
|
899
|
+
return s >= e[d] && s < e[d + 1] ? 1 : 0;
|
|
900
|
+
const n = e[d + t] - e[d], i = e[d + t + 1] - e[d + 1], r = n > 1e-10 ? (s - e[d]) / n : 0, o = i > 1e-10 ? (e[d + t + 1] - s) / i : 0;
|
|
901
|
+
return r * wt(d, t - 1, s, e) + o * wt(d + 1, t - 1, s, e);
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function ft(d, t, s, e, n) {
|
|
904
904
|
const i = e.length - 1, r = t;
|
|
905
|
-
if (
|
|
905
|
+
if (d = Math.max(s[r], Math.min(s[i + 1], d)), Math.abs(d - s[i + 1]) < 1e-8)
|
|
906
906
|
return [...e[i]];
|
|
907
|
-
if (Math.abs(
|
|
907
|
+
if (Math.abs(d - s[r]) < 1e-8)
|
|
908
908
|
return [...e[0]];
|
|
909
|
-
const
|
|
909
|
+
const o = [0, 0, 0];
|
|
910
910
|
let a = 0;
|
|
911
|
-
for (let
|
|
912
|
-
const c =
|
|
913
|
-
|
|
911
|
+
for (let h = 0; h <= i; h++) {
|
|
912
|
+
const c = wt(h, r, d, s), l = n[h] * c;
|
|
913
|
+
o[0] += e[h][0] * l, o[1] += e[h][1] * l, o[2] += e[h][2] * l, a += l;
|
|
914
914
|
}
|
|
915
915
|
if (Math.abs(a) < 1e-10) {
|
|
916
|
-
const
|
|
917
|
-
if (Math.abs(
|
|
916
|
+
const h = s[s.length - r - 1];
|
|
917
|
+
if (Math.abs(d - h) < 1e-8)
|
|
918
918
|
return [...e[i]];
|
|
919
|
-
if (Math.abs(
|
|
919
|
+
if (Math.abs(d - s[r]) < 1e-8)
|
|
920
920
|
return [...e[0]];
|
|
921
921
|
}
|
|
922
|
-
return Math.abs(a) >= 1e-10 && (
|
|
922
|
+
return Math.abs(a) >= 1e-10 && (o[0] /= a, o[1] /= a, o[2] /= a), o;
|
|
923
923
|
}
|
|
924
|
-
function
|
|
925
|
-
const n =
|
|
926
|
-
let
|
|
927
|
-
const a = 1e3,
|
|
928
|
-
let c =
|
|
924
|
+
function ws(d, t, s, e) {
|
|
925
|
+
const n = d, i = t[n], r = t[t.length - n - 1];
|
|
926
|
+
let o = 0;
|
|
927
|
+
const a = 1e3, h = (r - i) / a;
|
|
928
|
+
let c = ft(
|
|
929
929
|
i,
|
|
930
|
-
|
|
930
|
+
d,
|
|
931
931
|
t,
|
|
932
932
|
s,
|
|
933
933
|
e
|
|
934
934
|
);
|
|
935
935
|
for (let g = 1; g <= a; g++) {
|
|
936
|
-
const y = i + g *
|
|
937
|
-
|
|
936
|
+
const y = i + g * h, _ = ft(y, d, t, s, e), z = _[0] - c[0], f = _[1] - c[1], b = _[2] - c[2];
|
|
937
|
+
o += Math.sqrt(z * z + f * f + b * b), c = _;
|
|
938
938
|
}
|
|
939
|
-
const l =
|
|
939
|
+
const l = ft(
|
|
940
940
|
r,
|
|
941
|
-
|
|
941
|
+
d,
|
|
942
942
|
t,
|
|
943
943
|
s,
|
|
944
944
|
e
|
|
945
|
-
), m = l[0] - c[0],
|
|
946
|
-
return
|
|
945
|
+
), m = l[0] - c[0], u = l[1] - c[1], x = l[2] - c[2];
|
|
946
|
+
return o += Math.sqrt(m * m + u * u + x * x), o;
|
|
947
947
|
}
|
|
948
|
-
function Ts(
|
|
949
|
-
return
|
|
950
|
-
|
|
948
|
+
function Ts(d, t = 3, s = "Uniform", e, n) {
|
|
949
|
+
return d.length === 0 ? [] : $t(
|
|
950
|
+
d,
|
|
951
951
|
t,
|
|
952
952
|
s,
|
|
953
953
|
e,
|
|
954
954
|
n
|
|
955
955
|
).controlPoints;
|
|
956
956
|
}
|
|
957
|
-
class
|
|
957
|
+
class bt {
|
|
958
958
|
constructor(t = 0, s = 0, e = 0, n = 1) {
|
|
959
959
|
this._x = t, this._y = s, this._z = e, this._w = n;
|
|
960
960
|
}
|
|
961
|
-
static slerpFlat(t, s, e, n, i, r,
|
|
962
|
-
let a = e[n + 0],
|
|
963
|
-
const m = i[r + 0],
|
|
964
|
-
if (
|
|
965
|
-
t[s + 0] = a, t[s + 1] =
|
|
961
|
+
static slerpFlat(t, s, e, n, i, r, o) {
|
|
962
|
+
let a = e[n + 0], h = e[n + 1], c = e[n + 2], l = e[n + 3];
|
|
963
|
+
const m = i[r + 0], u = i[r + 1], x = i[r + 2], g = i[r + 3];
|
|
964
|
+
if (o === 0) {
|
|
965
|
+
t[s + 0] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
966
966
|
return;
|
|
967
967
|
}
|
|
968
|
-
if (
|
|
969
|
-
t[s + 0] = m, t[s + 1] =
|
|
968
|
+
if (o === 1) {
|
|
969
|
+
t[s + 0] = m, t[s + 1] = u, t[s + 2] = x, t[s + 3] = g;
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
|
-
if (l !== g || a !== m ||
|
|
973
|
-
let y = 1 -
|
|
974
|
-
const _ = a * m +
|
|
975
|
-
if (
|
|
976
|
-
const
|
|
977
|
-
y = Math.sin(y *
|
|
972
|
+
if (l !== g || a !== m || h !== u || c !== x) {
|
|
973
|
+
let y = 1 - o;
|
|
974
|
+
const _ = a * m + h * u + c * x + l * g, z = _ >= 0 ? 1 : -1, f = 1 - _ * _;
|
|
975
|
+
if (f > Number.EPSILON) {
|
|
976
|
+
const P = Math.sqrt(f), I = Math.atan2(P, _ * z);
|
|
977
|
+
y = Math.sin(y * I) / P, o = Math.sin(o * I) / P;
|
|
978
978
|
}
|
|
979
|
-
const
|
|
980
|
-
if (a = a * y + m *
|
|
981
|
-
const
|
|
982
|
-
a *=
|
|
979
|
+
const b = o * z;
|
|
980
|
+
if (a = a * y + m * b, h = h * y + u * b, c = c * y + x * b, l = l * y + g * b, y === 1 - o) {
|
|
981
|
+
const P = 1 / Math.sqrt(a * a + h * h + c * c + l * l);
|
|
982
|
+
a *= P, h *= P, c *= P, l *= P;
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
|
-
t[s] = a, t[s + 1] =
|
|
985
|
+
t[s] = a, t[s + 1] = h, t[s + 2] = c, t[s + 3] = l;
|
|
986
986
|
}
|
|
987
987
|
static multiplyQuaternionsFlat(t, s, e, n, i, r) {
|
|
988
|
-
const
|
|
989
|
-
return t[s] =
|
|
988
|
+
const o = e[n], a = e[n + 1], h = e[n + 2], c = e[n + 3], l = i[r], m = i[r + 1], u = i[r + 2], x = i[r + 3];
|
|
989
|
+
return t[s] = o * x + c * l + a * u - h * m, t[s + 1] = a * x + c * m + h * l - o * u, t[s + 2] = h * x + c * u + o * m - a * l, t[s + 3] = c * x - o * l - a * m - h * u, t;
|
|
990
990
|
}
|
|
991
991
|
get x() {
|
|
992
992
|
return this._x;
|
|
@@ -1016,31 +1016,31 @@ class Pt {
|
|
|
1016
1016
|
return this._x = t, this._y = s, this._z = e, this._w = n, this._onChangeCallback(), this;
|
|
1017
1017
|
}
|
|
1018
1018
|
clone() {
|
|
1019
|
-
return new
|
|
1019
|
+
return new bt(this._x, this._y, this._z, this._w);
|
|
1020
1020
|
}
|
|
1021
1021
|
copy(t) {
|
|
1022
1022
|
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
1023
1023
|
}
|
|
1024
1024
|
setFromEuler(t, s = !0) {
|
|
1025
|
-
const e = t.x, n = t.y, i = t.z, r = t.order,
|
|
1025
|
+
const e = t.x, n = t.y, i = t.z, r = t.order, o = Math.cos, a = Math.sin, h = o(e / 2), c = o(n / 2), l = o(i / 2), m = a(e / 2), u = a(n / 2), x = a(i / 2);
|
|
1026
1026
|
switch (r) {
|
|
1027
1027
|
case "XYZ":
|
|
1028
|
-
this._x = m * c * l +
|
|
1028
|
+
this._x = m * c * l + h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l - m * u * x;
|
|
1029
1029
|
break;
|
|
1030
1030
|
case "YXZ":
|
|
1031
|
-
this._x = m * c * l +
|
|
1031
|
+
this._x = m * c * l + h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l + m * u * x;
|
|
1032
1032
|
break;
|
|
1033
1033
|
case "ZXY":
|
|
1034
|
-
this._x = m * c * l -
|
|
1034
|
+
this._x = m * c * l - h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l - m * u * x;
|
|
1035
1035
|
break;
|
|
1036
1036
|
case "ZYX":
|
|
1037
|
-
this._x = m * c * l -
|
|
1037
|
+
this._x = m * c * l - h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l + m * u * x;
|
|
1038
1038
|
break;
|
|
1039
1039
|
case "YZX":
|
|
1040
|
-
this._x = m * c * l +
|
|
1040
|
+
this._x = m * c * l + h * u * x, this._y = h * u * l + m * c * x, this._z = h * c * x - m * u * l, this._w = h * c * l - m * u * x;
|
|
1041
1041
|
break;
|
|
1042
1042
|
case "XZY":
|
|
1043
|
-
this._x = m * c * l -
|
|
1043
|
+
this._x = m * c * l - h * u * x, this._y = h * u * l - m * c * x, this._z = h * c * x + m * u * l, this._w = h * c * l + m * u * x;
|
|
1044
1044
|
break;
|
|
1045
1045
|
}
|
|
1046
1046
|
return s === !0 && this._onChangeCallback(), this;
|
|
@@ -1050,19 +1050,19 @@ class Pt {
|
|
|
1050
1050
|
return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(e), this._onChangeCallback(), this;
|
|
1051
1051
|
}
|
|
1052
1052
|
setFromRotationMatrix(t) {
|
|
1053
|
-
const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1],
|
|
1053
|
+
const s = t.elements, e = s[0], n = s[4], i = s[8], r = s[1], o = s[5], a = s[9], h = s[2], c = s[6], l = s[10], m = e + o + l;
|
|
1054
1054
|
if (m > 0) {
|
|
1055
|
-
const
|
|
1056
|
-
this._w = 0.25 /
|
|
1057
|
-
} else if (e >
|
|
1058
|
-
const
|
|
1059
|
-
this._w = (c - a) /
|
|
1060
|
-
} else if (
|
|
1061
|
-
const
|
|
1062
|
-
this._w = (i -
|
|
1055
|
+
const u = 0.5 / Math.sqrt(m + 1);
|
|
1056
|
+
this._w = 0.25 / u, this._x = (c - a) * u, this._y = (i - h) * u, this._z = (r - n) * u;
|
|
1057
|
+
} else if (e > o && e > l) {
|
|
1058
|
+
const u = 2 * Math.sqrt(1 + e - o - l);
|
|
1059
|
+
this._w = (c - a) / u, this._x = 0.25 * u, this._y = (n + r) / u, this._z = (i + h) / u;
|
|
1060
|
+
} else if (o > l) {
|
|
1061
|
+
const u = 2 * Math.sqrt(1 + o - e - l);
|
|
1062
|
+
this._w = (i - h) / u, this._x = (n + r) / u, this._y = 0.25 * u, this._z = (a + c) / u;
|
|
1063
1063
|
} else {
|
|
1064
|
-
const
|
|
1065
|
-
this._w = (r - n) /
|
|
1064
|
+
const u = 2 * Math.sqrt(1 + l - e - o);
|
|
1065
|
+
this._w = (r - n) / u, this._x = (i + h) / u, this._y = (a + c) / u, this._z = 0.25 * u;
|
|
1066
1066
|
}
|
|
1067
1067
|
return this._onChangeCallback(), this;
|
|
1068
1068
|
}
|
|
@@ -1071,7 +1071,7 @@ class Pt {
|
|
|
1071
1071
|
return e < Number.EPSILON ? (e = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = e) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = e)) : (this._x = t.y * s.z - t.z * s.y, this._y = t.z * s.x - t.x * s.z, this._z = t.x * s.y - t.y * s.x, this._w = e), this.normalize();
|
|
1072
1072
|
}
|
|
1073
1073
|
angleTo(t) {
|
|
1074
|
-
return 2 * Math.acos(Math.abs(
|
|
1074
|
+
return 2 * Math.acos(Math.abs(Z(this.dot(t), -1, 1)));
|
|
1075
1075
|
}
|
|
1076
1076
|
rotateTowards(t, s) {
|
|
1077
1077
|
const e = this.angleTo(t);
|
|
@@ -1110,22 +1110,22 @@ class Pt {
|
|
|
1110
1110
|
return this.multiplyQuaternions(t, this);
|
|
1111
1111
|
}
|
|
1112
1112
|
multiplyQuaternions(t, s) {
|
|
1113
|
-
const e = t._x, n = t._y, i = t._z, r = t._w,
|
|
1114
|
-
return this._x = e * c + r *
|
|
1113
|
+
const e = t._x, n = t._y, i = t._z, r = t._w, o = s._x, a = s._y, h = s._z, c = s._w;
|
|
1114
|
+
return this._x = e * c + r * o + n * h - i * a, this._y = n * c + r * a + i * o - e * h, this._z = i * c + r * h + e * a - n * o, this._w = r * c - e * o - n * a - i * h, this._onChangeCallback(), this;
|
|
1115
1115
|
}
|
|
1116
1116
|
slerp(t, s) {
|
|
1117
1117
|
if (s === 0) return this;
|
|
1118
1118
|
if (s === 1) return this.copy(t);
|
|
1119
1119
|
const e = this._x, n = this._y, i = this._z, r = this._w;
|
|
1120
|
-
let
|
|
1121
|
-
if (
|
|
1120
|
+
let o = r * t._w + e * t._x + n * t._y + i * t._z;
|
|
1121
|
+
if (o < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, o = -o) : this.copy(t), o >= 1)
|
|
1122
1122
|
return this._w = r, this._x = e, this._y = n, this._z = i, this;
|
|
1123
|
-
const a = 1 -
|
|
1123
|
+
const a = 1 - o * o;
|
|
1124
1124
|
if (a <= Number.EPSILON) {
|
|
1125
|
-
const
|
|
1126
|
-
return this._w =
|
|
1125
|
+
const u = 1 - s;
|
|
1126
|
+
return this._w = u * r + s * this._w, this._x = u * e + s * this._x, this._y = u * n + s * this._y, this._z = u * i + s * this._z, this.normalize(), this;
|
|
1127
1127
|
}
|
|
1128
|
-
const
|
|
1128
|
+
const h = Math.sqrt(a), c = Math.atan2(h, o), l = Math.sin((1 - s) * c) / h, m = Math.sin(s * c) / h;
|
|
1129
1129
|
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;
|
|
1130
1130
|
}
|
|
1131
1131
|
slerpQuaternions(t, s, e) {
|
|
@@ -1161,7 +1161,7 @@ class Pt {
|
|
|
1161
1161
|
yield this._x, yield this._y, yield this._z, yield this._w;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
const
|
|
1164
|
+
const R = class R {
|
|
1165
1165
|
constructor(t, s, e) {
|
|
1166
1166
|
this.x = 0, this.y = 0, this.z = 0;
|
|
1167
1167
|
const n = +(t !== void 0) + +(s !== void 0) + +(e !== void 0);
|
|
@@ -1171,15 +1171,15 @@ const N = class N {
|
|
|
1171
1171
|
return;
|
|
1172
1172
|
}
|
|
1173
1173
|
if (n === 1) {
|
|
1174
|
-
const { x: i, y: r, z:
|
|
1175
|
-
this.x = i, this.y = r, this.z =
|
|
1174
|
+
const { x: i, y: r, z: o } = t;
|
|
1175
|
+
this.x = i, this.y = r, this.z = o || 0;
|
|
1176
1176
|
return;
|
|
1177
1177
|
}
|
|
1178
1178
|
if (n === 3) {
|
|
1179
1179
|
this.x = t, this.y = s, this.z = e;
|
|
1180
1180
|
return;
|
|
1181
1181
|
}
|
|
1182
|
-
throw
|
|
1182
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
1185
|
set(t, s, e) {
|
|
@@ -1226,7 +1226,7 @@ const N = class N {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
clone() {
|
|
1229
|
-
return new
|
|
1229
|
+
return new R(this.x, this.y, this.z);
|
|
1230
1230
|
}
|
|
1231
1231
|
copy(t) {
|
|
1232
1232
|
return this.x = t.x, this.y = t.y, this.z = t.z || 0, this;
|
|
@@ -1262,10 +1262,10 @@ const N = class N {
|
|
|
1262
1262
|
return this.x = t.x * s.x, this.y = t.y * s.y, this.z = t.z * s.z, this;
|
|
1263
1263
|
}
|
|
1264
1264
|
applyEuler(t) {
|
|
1265
|
-
return this.applyQuaternion(
|
|
1265
|
+
return this.applyQuaternion(Nt.setFromEuler(t));
|
|
1266
1266
|
}
|
|
1267
1267
|
applyAxisAngle(t, s) {
|
|
1268
|
-
return this.applyQuaternion(
|
|
1268
|
+
return this.applyQuaternion(Nt.setFromAxisAngle(t, s));
|
|
1269
1269
|
}
|
|
1270
1270
|
applyMatrix3(t) {
|
|
1271
1271
|
const s = this.x, e = this.y, n = this.z, i = t.elements;
|
|
@@ -1279,8 +1279,8 @@ const N = class N {
|
|
|
1279
1279
|
return this.x = (i[0] * s + i[4] * e + i[8] * n + i[12]) * r, this.y = (i[1] * s + i[5] * e + i[9] * n + i[13]) * r, this.z = (i[2] * s + i[6] * e + i[10] * n + i[14]) * r, this;
|
|
1280
1280
|
}
|
|
1281
1281
|
applyQuaternion(t) {
|
|
1282
|
-
const s = this.x, e = this.y, n = this.z, i = t.x, r = t.y,
|
|
1283
|
-
return this.x = s + a *
|
|
1282
|
+
const s = this.x, e = this.y, n = this.z, i = t.x, r = t.y, o = t.z, a = t.w, h = 2 * (r * n - o * e), c = 2 * (o * s - i * n), l = 2 * (i * e - r * s);
|
|
1283
|
+
return this.x = s + a * h + r * l - o * c, this.y = e + a * c + o * h - i * l, this.z = n + a * l + i * c - r * h, this;
|
|
1284
1284
|
}
|
|
1285
1285
|
transformDirection(t) {
|
|
1286
1286
|
const s = this.x, e = this.y, n = this.z, i = t.elements;
|
|
@@ -1357,8 +1357,8 @@ const N = class N {
|
|
|
1357
1357
|
return this.crossVectors(this, t);
|
|
1358
1358
|
}
|
|
1359
1359
|
crossVectors(t, s) {
|
|
1360
|
-
const e = t.x, n = t.y, i = t.z, r = s.x,
|
|
1361
|
-
return this.x = n * a - i *
|
|
1360
|
+
const e = t.x, n = t.y, i = t.z, r = s.x, o = s.y, a = s.z;
|
|
1361
|
+
return this.x = n * a - i * o, this.y = i * r - e * a, this.z = e * o - n * r, this;
|
|
1362
1362
|
}
|
|
1363
1363
|
projectOnVector(t) {
|
|
1364
1364
|
const s = t.lengthSq();
|
|
@@ -1367,10 +1367,10 @@ const N = class N {
|
|
|
1367
1367
|
return this.copy(t).multiplyScalar(e);
|
|
1368
1368
|
}
|
|
1369
1369
|
projectOnPlane(t) {
|
|
1370
|
-
return
|
|
1370
|
+
return It.copy(this).projectOnVector(t), this.sub(It);
|
|
1371
1371
|
}
|
|
1372
1372
|
reflect(t) {
|
|
1373
|
-
return this.sub(
|
|
1373
|
+
return this.sub(It.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
1374
1374
|
}
|
|
1375
1375
|
angleTo(t) {
|
|
1376
1376
|
const s = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
@@ -1422,38 +1422,38 @@ const N = class N {
|
|
|
1422
1422
|
yield this.x, yield this.y, yield this.z;
|
|
1423
1423
|
}
|
|
1424
1424
|
};
|
|
1425
|
-
|
|
1426
|
-
let p =
|
|
1427
|
-
const
|
|
1428
|
-
constructor(t, s, e, n, i, r,
|
|
1429
|
-
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null &&
|
|
1425
|
+
R.ORIGIN = Object.freeze(new R(0, 0, 0)), R.X_AXIS = Object.freeze(new R(1, 0, 0)), R.NEGATIVE_X_AXIS = Object.freeze(new R(-1, 0, 0)), R.Y_AXIS = Object.freeze(new R(0, 1, 0)), R.NEGATIVE_Y_AXIS = Object.freeze(new R(0, -1, 0)), R.Z_AXIS = Object.freeze(new R(0, 0, 1)), R.NEGATIVE_Z_AXIS = Object.freeze(new R(0, 0, -1));
|
|
1426
|
+
let p = R;
|
|
1427
|
+
const It = new p(), Nt = new bt(), et = class et {
|
|
1428
|
+
constructor(t, s, e, n, i, r, o, a, h, c, l, m, u, x, g, y) {
|
|
1429
|
+
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && r != null && o != null && a != null && h != null && c != null && l != null && m != null && u != null && x != null && g != null && y != null && this.set(
|
|
1430
1430
|
t,
|
|
1431
1431
|
s,
|
|
1432
1432
|
e,
|
|
1433
1433
|
n,
|
|
1434
1434
|
i,
|
|
1435
1435
|
r,
|
|
1436
|
-
h,
|
|
1437
|
-
a,
|
|
1438
1436
|
o,
|
|
1437
|
+
a,
|
|
1438
|
+
h,
|
|
1439
1439
|
c,
|
|
1440
1440
|
l,
|
|
1441
1441
|
m,
|
|
1442
|
-
|
|
1442
|
+
u,
|
|
1443
1443
|
x,
|
|
1444
1444
|
g,
|
|
1445
1445
|
y
|
|
1446
1446
|
);
|
|
1447
1447
|
}
|
|
1448
|
-
set(t, s, e, n, i, r,
|
|
1448
|
+
set(t, s, e, n, i, r, o, a, h, c, l, m, u, x, g, y) {
|
|
1449
1449
|
const _ = this.elements;
|
|
1450
|
-
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] =
|
|
1450
|
+
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = r, _[9] = o, _[13] = a, _[2] = h, _[6] = c, _[10] = l, _[14] = m, _[3] = u, _[7] = x, _[11] = g, _[15] = y, this;
|
|
1451
1451
|
}
|
|
1452
1452
|
identity() {
|
|
1453
1453
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
1454
1454
|
}
|
|
1455
1455
|
clone() {
|
|
1456
|
-
return new
|
|
1456
|
+
return new et().fromArray(this.elements);
|
|
1457
1457
|
}
|
|
1458
1458
|
copy(t) {
|
|
1459
1459
|
const s = this.elements, e = t.elements;
|
|
@@ -1485,7 +1485,7 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1485
1485
|
), this;
|
|
1486
1486
|
}
|
|
1487
1487
|
setFromExtrusionDirection(t) {
|
|
1488
|
-
if (
|
|
1488
|
+
if (Kt.equalPoint3d(t, p.Z_AXIS))
|
|
1489
1489
|
this.identity();
|
|
1490
1490
|
else {
|
|
1491
1491
|
const s = new p(1, 0, 0);
|
|
@@ -1536,15 +1536,15 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1536
1536
|
), this;
|
|
1537
1537
|
}
|
|
1538
1538
|
extractRotation(t) {
|
|
1539
|
-
const s = this.elements, e = t.elements, n = 1 /
|
|
1539
|
+
const s = this.elements, e = t.elements, n = 1 / $.setFromMatrixColumn(t, 0).length(), i = 1 / $.setFromMatrixColumn(t, 1).length(), r = 1 / $.setFromMatrixColumn(t, 2).length();
|
|
1540
1540
|
return s[0] = e[0] * n, s[1] = e[1] * n, s[2] = e[2] * n, s[3] = 0, s[4] = e[4] * i, s[5] = e[5] * i, s[6] = e[6] * i, s[7] = 0, s[8] = e[8] * r, s[9] = e[9] * r, s[10] = e[10] * r, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, this;
|
|
1541
1541
|
}
|
|
1542
1542
|
makeRotationFromQuaternion(t) {
|
|
1543
|
-
return this.compose(
|
|
1543
|
+
return this.compose(Ms, t, Ps);
|
|
1544
1544
|
}
|
|
1545
1545
|
lookAt(t, s, e) {
|
|
1546
1546
|
const n = this.elements;
|
|
1547
|
-
return
|
|
1547
|
+
return V.subVectors(t, s), V.lengthSq() === 0 && (V.z = 1), V.normalize(), v.crossVectors(e, V), v.lengthSq() === 0 && (Math.abs(e.z) === 1 ? V.x += 1e-4 : V.z += 1e-4, V.normalize(), v.crossVectors(e, V)), v.normalize(), yt.crossVectors(V, v), n[0] = v.x, n[4] = yt.x, n[8] = V.x, n[1] = v.y, n[5] = yt.y, n[9] = V.y, n[2] = v.z, n[6] = yt.z, n[10] = V.z, this;
|
|
1548
1548
|
}
|
|
1549
1549
|
multiply(t) {
|
|
1550
1550
|
return this.multiplyMatrices(this, t);
|
|
@@ -1553,16 +1553,16 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1553
1553
|
return this.multiplyMatrices(t, this);
|
|
1554
1554
|
}
|
|
1555
1555
|
multiplyMatrices(t, s) {
|
|
1556
|
-
const e = t.elements, n = s.elements, i = this.elements, r = e[0],
|
|
1557
|
-
return i[0] = r *
|
|
1556
|
+
const e = t.elements, n = s.elements, i = this.elements, r = e[0], o = e[4], a = e[8], h = e[12], c = e[1], l = e[5], m = e[9], u = e[13], x = e[2], g = e[6], y = e[10], _ = e[14], z = e[3], f = e[7], b = e[11], P = e[15], I = n[0], A = n[4], k = n[8], S = n[12], T = n[1], U = n[5], K = 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];
|
|
1557
|
+
return i[0] = r * I + o * T + a * at + h * dt, i[4] = r * A + o * U + a * ct + h * mt, i[8] = r * k + o * K + a * lt + h * xt, i[12] = r * S + o * ht + a * ut + h * gt, i[1] = c * I + l * T + m * at + u * dt, i[5] = c * A + l * U + m * ct + u * mt, i[9] = c * k + l * K + m * lt + u * xt, i[13] = c * S + l * ht + m * ut + u * gt, i[2] = x * I + g * T + y * at + _ * dt, i[6] = x * A + g * U + y * ct + _ * mt, i[10] = x * k + g * K + y * lt + _ * xt, i[14] = x * S + g * ht + y * ut + _ * gt, i[3] = z * I + f * T + b * at + P * dt, i[7] = z * A + f * U + b * ct + P * mt, i[11] = z * k + f * K + b * lt + P * xt, i[15] = z * S + f * ht + b * ut + P * gt, this;
|
|
1558
1558
|
}
|
|
1559
1559
|
multiplyScalar(t) {
|
|
1560
1560
|
const s = this.elements;
|
|
1561
1561
|
return s[0] *= t, s[4] *= t, s[8] *= t, s[12] *= t, s[1] *= t, s[5] *= t, s[9] *= t, s[13] *= t, s[2] *= t, s[6] *= t, s[10] *= t, s[14] *= t, s[3] *= t, s[7] *= t, s[11] *= t, s[15] *= t, this;
|
|
1562
1562
|
}
|
|
1563
1563
|
determinant() {
|
|
1564
|
-
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1],
|
|
1565
|
-
return x * (+i * a * l - n *
|
|
1564
|
+
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], r = t[1], o = t[5], a = t[9], h = t[13], c = t[2], l = t[6], m = t[10], u = t[14], x = t[3], g = t[7], y = t[11], _ = t[15];
|
|
1565
|
+
return x * (+i * a * l - n * h * l - i * o * m + e * h * m + n * o * u - e * a * u) + g * (+s * a * u - s * h * m + i * r * m - n * r * u + n * h * c - i * a * c) + y * (+s * h * l - s * o * u - i * r * l + e * r * u + i * o * c - e * h * c) + _ * (-n * o * c - s * a * l + s * o * m + n * r * l - e * r * m + e * a * c);
|
|
1566
1566
|
}
|
|
1567
1567
|
transpose() {
|
|
1568
1568
|
const t = this.elements;
|
|
@@ -1574,11 +1574,11 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1574
1574
|
return t instanceof p ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
|
|
1575
1575
|
}
|
|
1576
1576
|
invert() {
|
|
1577
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4],
|
|
1578
|
-
if (
|
|
1577
|
+
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], r = t[4], o = t[5], a = t[6], h = t[7], c = t[8], l = t[9], m = t[10], u = t[11], x = t[12], g = t[13], y = t[14], _ = t[15], z = l * y * h - g * m * h + g * a * u - o * y * u - l * a * _ + o * m * _, f = x * m * h - c * y * h - x * a * u + r * y * u + c * a * _ - r * m * _, b = c * g * h - x * l * h + x * o * u - r * g * u - c * o * _ + r * l * _, P = x * l * a - c * g * a - x * o * m + r * g * m + c * o * y - r * l * y, I = s * z + e * f + n * b + i * P;
|
|
1578
|
+
if (I === 0)
|
|
1579
1579
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
1580
|
-
const
|
|
1581
|
-
return t[0] =
|
|
1580
|
+
const A = 1 / I;
|
|
1581
|
+
return t[0] = z * A, t[1] = (g * m * i - l * y * i - g * n * u + e * y * u + l * n * _ - e * m * _) * A, t[2] = (o * y * i - g * a * i + g * n * h - e * y * h - o * n * _ + e * a * _) * A, t[3] = (l * a * i - o * m * i - l * n * h + e * m * h + o * n * u - e * a * u) * A, t[4] = f * A, t[5] = (c * y * i - x * m * i + x * n * u - s * y * u - c * n * _ + s * m * _) * A, t[6] = (x * a * i - r * y * i - x * n * h + s * y * h + r * n * _ - s * a * _) * A, t[7] = (r * m * i - c * a * i + c * n * h - s * m * h - r * n * u + s * a * u) * A, t[8] = b * A, t[9] = (x * l * i - c * g * i - x * e * u + s * g * u + c * e * _ - s * l * _) * A, t[10] = (r * g * i - x * o * i + x * e * h - s * g * h - r * e * _ + s * o * _) * A, t[11] = (c * o * i - r * l * i - c * e * h + s * l * h + r * e * u - s * o * u) * A, t[12] = P * A, t[13] = (c * g * n - x * l * n + x * e * 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;
|
|
1582
1582
|
}
|
|
1583
1583
|
scale(t) {
|
|
1584
1584
|
const s = this.elements, e = t.x, n = t.y, i = t.z;
|
|
@@ -1604,17 +1604,17 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1604
1604
|
return this.set(s, -e, 0, 0, e, s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
|
1605
1605
|
}
|
|
1606
1606
|
makeRotationAxis(t, s) {
|
|
1607
|
-
const e = Math.cos(s), n = Math.sin(s), i = 1 - e, r = t.x,
|
|
1607
|
+
const e = Math.cos(s), n = Math.sin(s), i = 1 - e, r = t.x, o = t.y, a = t.z, h = i * r, c = i * o;
|
|
1608
1608
|
return this.set(
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1609
|
+
h * r + e,
|
|
1610
|
+
h * o - n * a,
|
|
1611
|
+
h * a + n * o,
|
|
1612
1612
|
0,
|
|
1613
|
-
|
|
1614
|
-
c *
|
|
1613
|
+
h * o + n * a,
|
|
1614
|
+
c * o + e,
|
|
1615
1615
|
c * a - n * r,
|
|
1616
1616
|
0,
|
|
1617
|
-
|
|
1617
|
+
h * a - n * o,
|
|
1618
1618
|
c * a + n * r,
|
|
1619
1619
|
i * a * a + e,
|
|
1620
1620
|
0,
|
|
@@ -1631,16 +1631,16 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1631
1631
|
return this.set(1, e, i, 0, t, 1, r, 0, s, n, 1, 0, 0, 0, 0, 1), this;
|
|
1632
1632
|
}
|
|
1633
1633
|
compose(t, s, e) {
|
|
1634
|
-
const n = this.elements, i = s.x, r = s.y,
|
|
1635
|
-
return n[0] = (1 - (g + _)) *
|
|
1634
|
+
const n = this.elements, i = s.x, r = s.y, o = s.z, a = s.w, h = i + i, c = r + r, l = o + o, m = i * h, u = i * c, x = i * l, g = r * c, y = r * l, _ = o * l, z = a * h, f = a * c, b = a * l, P = e.x, I = e.y, A = e.z;
|
|
1635
|
+
return n[0] = (1 - (g + _)) * P, n[1] = (u + b) * P, n[2] = (x - f) * P, n[3] = 0, n[4] = (u - b) * I, n[5] = (1 - (m + _)) * 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;
|
|
1636
1636
|
}
|
|
1637
1637
|
decompose(t, s, e) {
|
|
1638
1638
|
const n = this.elements;
|
|
1639
|
-
let i =
|
|
1640
|
-
const r =
|
|
1641
|
-
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14],
|
|
1642
|
-
const
|
|
1643
|
-
return
|
|
1639
|
+
let i = $.set(n[0], n[1], n[2]).length();
|
|
1640
|
+
const r = $.set(n[4], n[5], n[6]).length(), o = $.set(n[8], n[9], n[10]).length();
|
|
1641
|
+
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], q.copy(this);
|
|
1642
|
+
const h = 1 / i, c = 1 / r, l = 1 / o;
|
|
1643
|
+
return q.elements[0] *= h, q.elements[1] *= h, q.elements[2] *= h, q.elements[4] *= c, q.elements[5] *= c, q.elements[6] *= c, q.elements[8] *= l, q.elements[9] *= l, q.elements[10] *= l, s.setFromRotationMatrix(q), e.x = i, e.y = r, e.z = o, this;
|
|
1644
1644
|
}
|
|
1645
1645
|
equals(t) {
|
|
1646
1646
|
const s = this.elements, e = t.elements;
|
|
@@ -1658,10 +1658,10 @@ const Et = new p(), Rt = new Pt(), J = class J {
|
|
|
1658
1658
|
return t[s] = e[0], t[s + 1] = e[1], t[s + 2] = e[2], t[s + 3] = e[3], t[s + 4] = e[4], t[s + 5] = e[5], t[s + 6] = e[6], t[s + 7] = e[7], t[s + 8] = e[8], t[s + 9] = e[9], t[s + 10] = e[10], t[s + 11] = e[11], t[s + 12] = e[12], t[s + 13] = e[13], t[s + 14] = e[14], t[s + 15] = e[15], t;
|
|
1659
1659
|
}
|
|
1660
1660
|
};
|
|
1661
|
-
|
|
1662
|
-
let
|
|
1663
|
-
const
|
|
1664
|
-
class
|
|
1661
|
+
et.IDENTITY = Object.freeze(new et());
|
|
1662
|
+
let H = et;
|
|
1663
|
+
const $ = new p(), q = new H(), Ms = new p(0, 0, 0), Ps = new p(1, 1, 1), v = new p(), yt = new p(), V = new p();
|
|
1664
|
+
class Y {
|
|
1665
1665
|
constructor(t = void 0, s = void 0) {
|
|
1666
1666
|
this.min = t == null ? new p(1 / 0, 1 / 0, 1 / 0) : new p(t.x, t.y, t.z), this.max = s == null ? new p(-1 / 0, -1 / 0, -1 / 0) : new p(s.x, s.y, s.z);
|
|
1667
1667
|
}
|
|
@@ -1671,7 +1671,7 @@ class D {
|
|
|
1671
1671
|
setFromArray(t) {
|
|
1672
1672
|
this.makeEmpty();
|
|
1673
1673
|
for (let s = 0, e = t.length; s < e; s += 3)
|
|
1674
|
-
this.expandByPoint(
|
|
1674
|
+
this.expandByPoint(Bt.fromArray(t, s));
|
|
1675
1675
|
return this;
|
|
1676
1676
|
}
|
|
1677
1677
|
setFromPoints(t) {
|
|
@@ -1681,11 +1681,11 @@ class D {
|
|
|
1681
1681
|
return this;
|
|
1682
1682
|
}
|
|
1683
1683
|
setFromCenterAndSize(t, s) {
|
|
1684
|
-
const e =
|
|
1684
|
+
const e = Bt.copy(s).multiplyScalar(0.5);
|
|
1685
1685
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
|
1686
1686
|
}
|
|
1687
1687
|
clone() {
|
|
1688
|
-
return new
|
|
1688
|
+
return new Y().copy(this);
|
|
1689
1689
|
}
|
|
1690
1690
|
copy(t) {
|
|
1691
1691
|
return this.min.copy(t.min), this.max.copy(t.max), this;
|
|
@@ -1741,7 +1741,7 @@ class D {
|
|
|
1741
1741
|
return s.copy(t).clamp(this.min, this.max);
|
|
1742
1742
|
}
|
|
1743
1743
|
distanceToPoint(t) {
|
|
1744
|
-
return this.clampPoint(t,
|
|
1744
|
+
return this.clampPoint(t, Bt).distanceTo(t);
|
|
1745
1745
|
}
|
|
1746
1746
|
intersect(t) {
|
|
1747
1747
|
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this;
|
|
@@ -1750,7 +1750,7 @@ class D {
|
|
|
1750
1750
|
return this.min.min(t.min), this.max.max(t.max), this;
|
|
1751
1751
|
}
|
|
1752
1752
|
applyMatrix4(t) {
|
|
1753
|
-
return this.isEmpty() ? this : (
|
|
1753
|
+
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);
|
|
1754
1754
|
}
|
|
1755
1755
|
translate(t) {
|
|
1756
1756
|
return this.min.add(t), this.max.add(t), this;
|
|
@@ -1759,7 +1759,7 @@ class D {
|
|
|
1759
1759
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1760
1760
|
}
|
|
1761
1761
|
}
|
|
1762
|
-
const
|
|
1762
|
+
const D = [
|
|
1763
1763
|
new p(),
|
|
1764
1764
|
new p(),
|
|
1765
1765
|
new p(),
|
|
@@ -1768,7 +1768,7 @@ const Y = [
|
|
|
1768
1768
|
new p(),
|
|
1769
1769
|
new p(),
|
|
1770
1770
|
new p()
|
|
1771
|
-
],
|
|
1771
|
+
], Bt = new p(), Tt = new B();
|
|
1772
1772
|
class F {
|
|
1773
1773
|
constructor(t = void 0, s = void 0) {
|
|
1774
1774
|
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);
|
|
@@ -1853,8 +1853,8 @@ class F {
|
|
|
1853
1853
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
|
-
const
|
|
1857
|
-
class
|
|
1856
|
+
const jt = new p(), bs = new p(), Ss = new it();
|
|
1857
|
+
class St {
|
|
1858
1858
|
constructor(t = new p(1, 0, 0), s = 0) {
|
|
1859
1859
|
this.normal = t, this.constant = s;
|
|
1860
1860
|
}
|
|
@@ -1868,7 +1868,7 @@ class bt {
|
|
|
1868
1868
|
return this.normal.copy(t), this.constant = -s.dot(this.normal), this;
|
|
1869
1869
|
}
|
|
1870
1870
|
setFromCoplanarPoints(t, s, e) {
|
|
1871
|
-
const n =
|
|
1871
|
+
const n = jt.subVectors(e, s).cross(bs.subVectors(t, s)).normalize();
|
|
1872
1872
|
return this.setFromNormalAndCoplanarPoint(n, t), this;
|
|
1873
1873
|
}
|
|
1874
1874
|
copy(t) {
|
|
@@ -1894,7 +1894,7 @@ class bt {
|
|
|
1894
1894
|
return t.copy(this.normal).multiplyScalar(-this.constant);
|
|
1895
1895
|
}
|
|
1896
1896
|
applyMatrix4(t, s) {
|
|
1897
|
-
const e = s || Ss.getNormalMatrix(t), n = this.coplanarPoint(
|
|
1897
|
+
const e = s || Ss.getNormalMatrix(t), n = this.coplanarPoint(jt).applyMatrix4(t), i = this.normal.applyMatrix3(e).normalize();
|
|
1898
1898
|
return this.constant = -n.dot(i), this;
|
|
1899
1899
|
}
|
|
1900
1900
|
translate(t) {
|
|
@@ -1904,7 +1904,7 @@ class bt {
|
|
|
1904
1904
|
return t.normal.equals(this.normal) && t.constant === this.constant;
|
|
1905
1905
|
}
|
|
1906
1906
|
clone() {
|
|
1907
|
-
return new
|
|
1907
|
+
return new St().copy(this);
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
1910
|
class C extends B {
|
|
@@ -1915,7 +1915,7 @@ class C extends B {
|
|
|
1915
1915
|
}), s;
|
|
1916
1916
|
}
|
|
1917
1917
|
}
|
|
1918
|
-
class
|
|
1918
|
+
class w extends p {
|
|
1919
1919
|
static pointArrayToNumberArray(t, s = !0) {
|
|
1920
1920
|
const e = s ? 3 : 2, n = new Array(t.length * e);
|
|
1921
1921
|
return t.forEach((i, r) => {
|
|
@@ -1923,8 +1923,8 @@ class S extends p {
|
|
|
1923
1923
|
}), n;
|
|
1924
1924
|
}
|
|
1925
1925
|
}
|
|
1926
|
-
const
|
|
1927
|
-
constructor(t = 0, s = 0, e = 0, n =
|
|
1926
|
+
const Vt = new H(), Ut = new bt(), nt = class nt {
|
|
1927
|
+
constructor(t = 0, s = 0, e = 0, n = nt.DEFAULT_ORDER) {
|
|
1928
1928
|
this._x = t, this._y = s, this._z = e, this._order = n;
|
|
1929
1929
|
}
|
|
1930
1930
|
get x() {
|
|
@@ -1955,43 +1955,43 @@ const Ut = new et(), Vt = new Pt(), tt = class tt {
|
|
|
1955
1955
|
return this._x = t, this._y = s, this._z = e, this._order = n, this._onChangeCallback(), this;
|
|
1956
1956
|
}
|
|
1957
1957
|
clone() {
|
|
1958
|
-
return new
|
|
1958
|
+
return new nt(this._x, this._y, this._z, this._order);
|
|
1959
1959
|
}
|
|
1960
1960
|
copy(t) {
|
|
1961
1961
|
return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this._onChangeCallback(), this;
|
|
1962
1962
|
}
|
|
1963
1963
|
setFromRotationMatrix(t, s = this._order, e = !0) {
|
|
1964
|
-
const n = t.elements, i = n[0], r = n[4],
|
|
1964
|
+
const n = t.elements, i = n[0], r = n[4], o = n[8], a = n[1], h = n[5], c = n[9], l = n[2], m = n[6], u = n[10];
|
|
1965
1965
|
switch (s) {
|
|
1966
1966
|
case "XYZ":
|
|
1967
|
-
this._y = Math.asin(
|
|
1967
|
+
this._y = Math.asin(Z(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(-c, u), this._z = Math.atan2(-r, i)) : (this._x = Math.atan2(m, h), this._z = 0);
|
|
1968
1968
|
break;
|
|
1969
1969
|
case "YXZ":
|
|
1970
|
-
this._x = Math.asin(-
|
|
1970
|
+
this._x = Math.asin(-Z(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(o, u), this._z = Math.atan2(a, h)) : (this._y = Math.atan2(-l, i), this._z = 0);
|
|
1971
1971
|
break;
|
|
1972
1972
|
case "ZXY":
|
|
1973
|
-
this._x = Math.asin(
|
|
1973
|
+
this._x = Math.asin(Z(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, u), this._z = Math.atan2(-r, h)) : (this._y = 0, this._z = Math.atan2(a, i));
|
|
1974
1974
|
break;
|
|
1975
1975
|
case "ZYX":
|
|
1976
|
-
this._y = Math.asin(-
|
|
1976
|
+
this._y = Math.asin(-Z(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, u), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-r, h));
|
|
1977
1977
|
break;
|
|
1978
1978
|
case "YZX":
|
|
1979
|
-
this._z = Math.asin(
|
|
1979
|
+
this._z = Math.asin(Z(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, h), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(o, u));
|
|
1980
1980
|
break;
|
|
1981
1981
|
case "XZY":
|
|
1982
|
-
this._z = Math.asin(-
|
|
1982
|
+
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, u), this._y = 0);
|
|
1983
1983
|
break;
|
|
1984
1984
|
}
|
|
1985
1985
|
return this._order = s, e === !0 && this._onChangeCallback(), this;
|
|
1986
1986
|
}
|
|
1987
1987
|
setFromQuaternion(t, s, e = !0) {
|
|
1988
|
-
return
|
|
1988
|
+
return Vt.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Vt, s, e);
|
|
1989
1989
|
}
|
|
1990
1990
|
setFromVector3(t, s = this._order) {
|
|
1991
1991
|
return this.set(t.x, t.y, t.z, s);
|
|
1992
1992
|
}
|
|
1993
1993
|
reorder(t) {
|
|
1994
|
-
return
|
|
1994
|
+
return Ut.setFromEuler(this), this.setFromQuaternion(Ut, t);
|
|
1995
1995
|
}
|
|
1996
1996
|
equals(t) {
|
|
1997
1997
|
return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order;
|
|
@@ -2011,9 +2011,9 @@ const Ut = new et(), Vt = new Pt(), tt = class tt {
|
|
|
2011
2011
|
yield this._x, yield this._y, yield this._z, yield this._order;
|
|
2012
2012
|
}
|
|
2013
2013
|
};
|
|
2014
|
-
|
|
2015
|
-
let
|
|
2016
|
-
class
|
|
2014
|
+
nt.DEFAULT_ORDER = "XYZ";
|
|
2015
|
+
let Lt = nt;
|
|
2016
|
+
class Wt {
|
|
2017
2017
|
constructor() {
|
|
2018
2018
|
this._boundingBoxNeedsUpdate = !1;
|
|
2019
2019
|
}
|
|
@@ -2021,15 +2021,15 @@ class $t {
|
|
|
2021
2021
|
return this._boundingBoxNeedsUpdate;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
|
-
class Ht extends
|
|
2024
|
+
class Ht extends Wt {
|
|
2025
2025
|
translate(t) {
|
|
2026
|
-
return this.transform(new
|
|
2026
|
+
return this.transform(new it().makeTranslation(t.x, t.y));
|
|
2027
2027
|
}
|
|
2028
2028
|
get box() {
|
|
2029
2029
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2030
2030
|
}
|
|
2031
2031
|
}
|
|
2032
|
-
class
|
|
2032
|
+
class js extends Ht {
|
|
2033
2033
|
constructor() {
|
|
2034
2034
|
super(), this._loops = [];
|
|
2035
2035
|
}
|
|
@@ -2048,7 +2048,9 @@ class Ls extends Ht {
|
|
|
2048
2048
|
return t ? t.box : new F();
|
|
2049
2049
|
}
|
|
2050
2050
|
transform(t) {
|
|
2051
|
-
return this.
|
|
2051
|
+
return this._loops.forEach((s) => {
|
|
2052
|
+
s.transform(t);
|
|
2053
|
+
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
2052
2054
|
}
|
|
2053
2055
|
getPoints(t) {
|
|
2054
2056
|
const s = [];
|
|
@@ -2059,7 +2061,7 @@ class Ls extends Ht {
|
|
|
2059
2061
|
return s;
|
|
2060
2062
|
}
|
|
2061
2063
|
buildHierarchy() {
|
|
2062
|
-
var
|
|
2064
|
+
var o;
|
|
2063
2065
|
const t = this.getPoints(100), s = this.calculateBoundaryBoxes(t), e = this.sortBoundaryBoxesByAreas(s), n = /* @__PURE__ */ new Map(), i = e.length;
|
|
2064
2066
|
for (let a = 0; a < i; a++)
|
|
2065
2067
|
n.set(e[a], {
|
|
@@ -2068,19 +2070,19 @@ class Ls extends Ht {
|
|
|
2068
2070
|
});
|
|
2069
2071
|
const r = { index: -1, children: [] };
|
|
2070
2072
|
for (let a = 0; a < i; a++) {
|
|
2071
|
-
const
|
|
2073
|
+
const h = e[a], c = t[h], l = s[h];
|
|
2072
2074
|
let m = a + 1;
|
|
2073
2075
|
for (; m < i; m++) {
|
|
2074
|
-
const
|
|
2075
|
-
if (s[
|
|
2076
|
-
c[
|
|
2076
|
+
const u = e[m], x = t[u];
|
|
2077
|
+
if (s[u].containsBox(l) && fs.isPointInPolygon(
|
|
2078
|
+
c[M.randInt(0, c.length - 1)],
|
|
2077
2079
|
x
|
|
2078
2080
|
)) {
|
|
2079
|
-
(
|
|
2081
|
+
(o = n.get(u)) == null || o.children.push(n.get(h));
|
|
2080
2082
|
break;
|
|
2081
2083
|
}
|
|
2082
2084
|
}
|
|
2083
|
-
m === i && r.children.push(n.get(
|
|
2085
|
+
m === i && r.children.push(n.get(h));
|
|
2084
2086
|
}
|
|
2085
2087
|
return r;
|
|
2086
2088
|
}
|
|
@@ -2098,8 +2100,8 @@ class Ls extends Ht {
|
|
|
2098
2100
|
if (s < 3) return 0;
|
|
2099
2101
|
let e = 0;
|
|
2100
2102
|
for (let n = 0, i = s - 1; n < s; i = n++) {
|
|
2101
|
-
const r = t[i],
|
|
2102
|
-
e += r.x *
|
|
2103
|
+
const r = t[i], o = t[n];
|
|
2104
|
+
e += r.x * o.y - o.x * r.y;
|
|
2103
2105
|
}
|
|
2104
2106
|
return e * 0.5;
|
|
2105
2107
|
}
|
|
@@ -2112,9 +2114,9 @@ class Ls extends Ht {
|
|
|
2112
2114
|
sortBoundaryBoxesByAreas(t) {
|
|
2113
2115
|
const s = [];
|
|
2114
2116
|
t.forEach((n, i) => {
|
|
2115
|
-
const r = n.size,
|
|
2117
|
+
const r = n.size, o = r.width * r.height;
|
|
2116
2118
|
s.push({
|
|
2117
|
-
area:
|
|
2119
|
+
area: o,
|
|
2118
2120
|
index: i
|
|
2119
2121
|
});
|
|
2120
2122
|
}), s.sort((n, i) => n.area - i.area);
|
|
@@ -2124,7 +2126,7 @@ class Ls extends Ht {
|
|
|
2124
2126
|
}), e;
|
|
2125
2127
|
}
|
|
2126
2128
|
}
|
|
2127
|
-
class
|
|
2129
|
+
class rt extends Ht {
|
|
2128
2130
|
constructor() {
|
|
2129
2131
|
super(), this.arcLengthDivisions = 100;
|
|
2130
2132
|
}
|
|
@@ -2174,11 +2176,11 @@ class nt extends Ht {
|
|
|
2174
2176
|
const i = e.length;
|
|
2175
2177
|
let r;
|
|
2176
2178
|
s ? r = s : r = t * e[i - 1];
|
|
2177
|
-
let
|
|
2178
|
-
for (;
|
|
2179
|
-
if (n = Math.floor(
|
|
2180
|
-
|
|
2181
|
-
else if (
|
|
2179
|
+
let o = 0, a = i - 1, h;
|
|
2180
|
+
for (; o <= a; )
|
|
2181
|
+
if (n = Math.floor(o + (a - o) / 2), h = e[n] - r, h < 0)
|
|
2182
|
+
o = n + 1;
|
|
2183
|
+
else if (h > 0)
|
|
2182
2184
|
a = n - 1;
|
|
2183
2185
|
else {
|
|
2184
2186
|
a = n;
|
|
@@ -2186,21 +2188,21 @@ class nt extends Ht {
|
|
|
2186
2188
|
}
|
|
2187
2189
|
if (n = a, e[n] === r)
|
|
2188
2190
|
return n / (i - 1);
|
|
2189
|
-
const c = e[n], m = e[n + 1] - c,
|
|
2190
|
-
return (n +
|
|
2191
|
+
const c = e[n], m = e[n + 1] - c, u = (r - c) / m;
|
|
2192
|
+
return (n + u) / (i - 1);
|
|
2191
2193
|
}
|
|
2192
2194
|
getTangent(t) {
|
|
2193
2195
|
let e = t - 1e-4, n = t + 1e-4;
|
|
2194
2196
|
e < 0 && (e = 0), n > 1 && (n = 1);
|
|
2195
|
-
const i = this.getPoint(e), r = this.getPoint(n),
|
|
2196
|
-
return
|
|
2197
|
+
const i = this.getPoint(e), r = this.getPoint(n), o = new C();
|
|
2198
|
+
return o.copy(r).sub(i).normalize(), o;
|
|
2197
2199
|
}
|
|
2198
2200
|
getTangentAt(t) {
|
|
2199
2201
|
const s = this.getUtoTmapping(t);
|
|
2200
2202
|
return this.getTangent(s);
|
|
2201
2203
|
}
|
|
2202
2204
|
}
|
|
2203
|
-
class
|
|
2205
|
+
class Q extends rt {
|
|
2204
2206
|
constructor(t, s, e, n, i) {
|
|
2205
2207
|
super();
|
|
2206
2208
|
const r = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
|
|
@@ -2215,32 +2217,32 @@ class $ extends nt {
|
|
|
2215
2217
|
e
|
|
2216
2218
|
);
|
|
2217
2219
|
else if (r == 5) {
|
|
2218
|
-
const
|
|
2219
|
-
this.center = new C(
|
|
2220
|
+
const o = t;
|
|
2221
|
+
this.center = new C(o.x, o.y), this.radius = s, this._clockwise = i, this._startAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(e)) : M.normalizeAngle(e), this._endAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(n)) : M.normalizeAngle(n);
|
|
2220
2222
|
} else
|
|
2221
|
-
throw
|
|
2223
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
2222
2224
|
}
|
|
2223
2225
|
createByThreePoints(t, s, e) {
|
|
2224
|
-
const n = (
|
|
2225
|
-
x: (
|
|
2226
|
-
y: (
|
|
2227
|
-
}), i = (
|
|
2228
|
-
const
|
|
2229
|
-
return { x:
|
|
2230
|
-
}, x =
|
|
2226
|
+
const n = (A, k) => ({
|
|
2227
|
+
x: (A.x + k.x) / 2,
|
|
2228
|
+
y: (A.y + k.y) / 2
|
|
2229
|
+
}), i = (A, k) => (k.y - A.y) / (k.x - A.x), r = (A) => -1 / A, o = n(t, s), a = n(s, e), h = i(t, s), c = i(s, e), l = r(h), m = r(c), u = (A, k, S, T) => {
|
|
2230
|
+
const U = (T - k) / (A - S), K = A * U + k;
|
|
2231
|
+
return { x: U, y: K };
|
|
2232
|
+
}, x = o.y - l * o.x, g = a.y - m * a.x, y = u(l, x, m, g), _ = Math.sqrt(
|
|
2231
2233
|
Math.pow(t.x - y.x, 2) + Math.pow(t.y - y.y, 2)
|
|
2232
|
-
),
|
|
2233
|
-
this.center = y, this.radius = _, this._clockwise = !
|
|
2234
|
+
), z = (A, k) => Math.atan2(A.y - k.y, A.x - k.x), f = z(t, y), b = z(s, y), P = z(e, y), I = P > f && P < b || f > P && f < b || b > P && b < f;
|
|
2235
|
+
this.center = y, this.radius = _, this._clockwise = !I, this._startAngle = f, this._endAngle = P;
|
|
2234
2236
|
}
|
|
2235
2237
|
createByStartEndPointsAndBulge(t, s, e) {
|
|
2236
2238
|
let n, i, r;
|
|
2237
2239
|
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));
|
|
2238
|
-
const
|
|
2240
|
+
const o = new B().subVectors(r, i), a = o.length(), h = new B().addVectors(i, o.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = o.normalize(), m = e < 0 ? -Math.PI / 2 : Math.PI / 2, u = new B(
|
|
2239
2241
|
l.x * Math.cos(m) - l.y * Math.sin(m),
|
|
2240
2242
|
l.y * Math.cos(m) + l.x * Math.sin(m)
|
|
2241
2243
|
);
|
|
2242
2244
|
let x;
|
|
2243
|
-
n < Math.PI ? e < 0 ? x =
|
|
2245
|
+
n < Math.PI ? e < 0 ? x = h.add(u.multiplyScalar(c)) : x = h.add(u.multiplyScalar(-c)) : e < 0 ? x = h.add(u.multiplyScalar(-c)) : x = h.add(u.multiplyScalar(c)), e < 0 ? (this._startAngle = Math.atan2(i.y - x.y, i.x - x.x), this._endAngle = Math.atan2(r.y - x.y, r.x - x.x)) : (this._startAngle = Math.atan2(r.y - x.y, r.x - x.x), this._endAngle = Math.atan2(i.y - x.y, i.x - x.x)), this._clockwise = e < 0, this.center = x, this.radius = r.sub(x).length();
|
|
2244
2246
|
}
|
|
2245
2247
|
get center() {
|
|
2246
2248
|
return this._center;
|
|
@@ -2258,13 +2260,13 @@ class $ extends nt {
|
|
|
2258
2260
|
return this._clockwise ? this._mirrorAngle(this._startAngle) : this._startAngle;
|
|
2259
2261
|
}
|
|
2260
2262
|
set startAngle(t) {
|
|
2261
|
-
this._startAngle = this._clockwise ? this._mirrorAngle(
|
|
2263
|
+
this._startAngle = this._clockwise ? this._mirrorAngle(M.normalizeAngle(t)) : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2262
2264
|
}
|
|
2263
2265
|
get endAngle() {
|
|
2264
2266
|
return this._clockwise ? this._mirrorAngle(this._endAngle) : this._endAngle;
|
|
2265
2267
|
}
|
|
2266
2268
|
set endAngle(t) {
|
|
2267
|
-
const s = this.startAngle == 0 && t ==
|
|
2269
|
+
const s = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t);
|
|
2268
2270
|
this._endAngle = this._clockwise ? this._mirrorAngle(s) : s, this._boundingBoxNeedsUpdate = !0;
|
|
2269
2271
|
}
|
|
2270
2272
|
_mirrorAngle(t) {
|
|
@@ -2275,7 +2277,7 @@ class $ extends nt {
|
|
|
2275
2277
|
}
|
|
2276
2278
|
get deltaAngle() {
|
|
2277
2279
|
const t = this._getInternalAngle(this.startAngle), s = this._getInternalAngle(this.endAngle);
|
|
2278
|
-
return this.clockwise ?
|
|
2280
|
+
return this.clockwise ? M.normalizeAngle(t - s) : M.normalizeAngle(s - t);
|
|
2279
2281
|
}
|
|
2280
2282
|
get clockwise() {
|
|
2281
2283
|
return this._clockwise;
|
|
@@ -2290,7 +2292,7 @@ class $ extends nt {
|
|
|
2290
2292
|
return this.getPointAtAngle(this.endAngle);
|
|
2291
2293
|
}
|
|
2292
2294
|
get midPoint() {
|
|
2293
|
-
const t = this._getInternalAngle(this.startAngle), s = this._clockwise ?
|
|
2295
|
+
const t = this._getInternalAngle(this.startAngle), s = this._clockwise ? M.normalizeAngle(t - this.deltaAngle / 2) : M.normalizeAngle(t + this.deltaAngle / 2), e = this._clockwise ? this._mirrorAngle(s) : s;
|
|
2294
2296
|
return this.getPointAtAngle(e);
|
|
2295
2297
|
}
|
|
2296
2298
|
get closed() {
|
|
@@ -2301,7 +2303,7 @@ class $ extends nt {
|
|
|
2301
2303
|
const t = [this.startPoint, this.endPoint], s = [0, Math.PI / 2, Math.PI, 3 * Math.PI / 2];
|
|
2302
2304
|
for (const i of s) {
|
|
2303
2305
|
const r = this._getInternalAngle(i);
|
|
2304
|
-
|
|
2306
|
+
M.isBetweenAngle(
|
|
2305
2307
|
r,
|
|
2306
2308
|
this._getInternalAngle(this.startAngle),
|
|
2307
2309
|
this._getInternalAngle(this.endAngle),
|
|
@@ -2318,10 +2320,34 @@ class $ extends nt {
|
|
|
2318
2320
|
return Math.abs(this.deltaAngle * this.radius);
|
|
2319
2321
|
}
|
|
2320
2322
|
transform(t) {
|
|
2321
|
-
|
|
2323
|
+
const s = t, e = this.center.clone().applyMatrix2d(s), n = this.startPoint.clone().applyMatrix2d(s);
|
|
2324
|
+
if (this.closed)
|
|
2325
|
+
return this.center = e, this.radius = e.distanceTo(n), this._startAngle = Math.atan2(
|
|
2326
|
+
n.y - e.y,
|
|
2327
|
+
n.x - e.x
|
|
2328
|
+
), this._endAngle = this._startAngle, this._clockwise = s.determinant() < 0 ? !this._clockwise : this._clockwise, this._boundingBoxNeedsUpdate = !0, this;
|
|
2329
|
+
const i = this.midPoint.clone().applyMatrix2d(s), r = this.endPoint.clone().applyMatrix2d(s), o = new Q(
|
|
2330
|
+
n,
|
|
2331
|
+
i,
|
|
2332
|
+
r
|
|
2333
|
+
), a = s.determinant() < 0 ? !this.clockwise : this.clockwise, h = (c) => {
|
|
2334
|
+
const l = M.normalizeAngle(c);
|
|
2335
|
+
return a ? this._mirrorAngle(l) : l;
|
|
2336
|
+
};
|
|
2337
|
+
return this.center = o.center, this.radius = o.radius, this.clockwise = a, this.startAngle = h(
|
|
2338
|
+
Math.atan2(
|
|
2339
|
+
n.y - o.center.y,
|
|
2340
|
+
n.x - o.center.x
|
|
2341
|
+
)
|
|
2342
|
+
), this.endAngle = h(
|
|
2343
|
+
Math.atan2(
|
|
2344
|
+
r.y - o.center.y,
|
|
2345
|
+
r.x - o.center.x
|
|
2346
|
+
)
|
|
2347
|
+
), this._boundingBoxNeedsUpdate = !0, this;
|
|
2322
2348
|
}
|
|
2323
2349
|
clone() {
|
|
2324
|
-
return new
|
|
2350
|
+
return new Q(
|
|
2325
2351
|
this.center.clone(),
|
|
2326
2352
|
this.radius,
|
|
2327
2353
|
this._startAngle,
|
|
@@ -2336,32 +2362,32 @@ class $ extends nt {
|
|
|
2336
2362
|
getPoints(t = 100) {
|
|
2337
2363
|
const s = [];
|
|
2338
2364
|
let e = this.deltaAngle, n = this._getInternalAngle(this.startAngle);
|
|
2339
|
-
if (this.closed && (e =
|
|
2365
|
+
if (this.closed && (e = E, n = 0), this.clockwise)
|
|
2340
2366
|
for (let i = 0; i <= t; i++) {
|
|
2341
|
-
const r = n - e * (i / t),
|
|
2367
|
+
const r = n - e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
|
|
2342
2368
|
s.push(new C(a.x, a.y));
|
|
2343
2369
|
}
|
|
2344
2370
|
else
|
|
2345
2371
|
for (let i = 0; i <= t; i++) {
|
|
2346
|
-
const r = n + e * (i / t),
|
|
2372
|
+
const r = n + e * (i / t), o = this._clockwise ? this._mirrorAngle(r) : r, a = this.getPointAtAngle(o);
|
|
2347
2373
|
s.push(new C(a.x, a.y));
|
|
2348
2374
|
}
|
|
2349
2375
|
return s;
|
|
2350
2376
|
}
|
|
2351
2377
|
}
|
|
2352
|
-
class Cs extends
|
|
2378
|
+
class Cs extends Wt {
|
|
2353
2379
|
translate(t) {
|
|
2354
|
-
return this.transform(new
|
|
2380
|
+
return this.transform(new H().makeTranslation(t.x, t.y, t.z));
|
|
2355
2381
|
}
|
|
2356
2382
|
get box() {
|
|
2357
2383
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
|
2358
2384
|
}
|
|
2359
2385
|
}
|
|
2360
|
-
class
|
|
2386
|
+
class ot extends Cs {
|
|
2361
2387
|
}
|
|
2362
|
-
class
|
|
2388
|
+
class Mt extends ot {
|
|
2363
2389
|
constructor(t, s) {
|
|
2364
|
-
super(), this._start = new
|
|
2390
|
+
super(), this._start = new w(t), this._end = new w(s);
|
|
2365
2391
|
}
|
|
2366
2392
|
get startPoint() {
|
|
2367
2393
|
return this._start;
|
|
@@ -2379,7 +2405,7 @@ class ft extends it {
|
|
|
2379
2405
|
return new p().subVectors(this.endPoint, this.startPoint).normalize();
|
|
2380
2406
|
}
|
|
2381
2407
|
get midPoint() {
|
|
2382
|
-
return new
|
|
2408
|
+
return new w(
|
|
2383
2409
|
(this._start.x + this._end.x) / 2,
|
|
2384
2410
|
(this._start.y + this._end.y) / 2,
|
|
2385
2411
|
(this._start.z + this._end.z) / 2
|
|
@@ -2399,31 +2425,31 @@ class ft extends it {
|
|
|
2399
2425
|
}
|
|
2400
2426
|
atLength(t, s = !1) {
|
|
2401
2427
|
if (s) {
|
|
2402
|
-
const e = this.delta(
|
|
2403
|
-
return new
|
|
2428
|
+
const e = this.delta(O).normalize();
|
|
2429
|
+
return new w(this._start).addScaledVector(e, t);
|
|
2404
2430
|
} else {
|
|
2405
|
-
const e = this.delta(
|
|
2406
|
-
return new
|
|
2431
|
+
const e = this.delta(O).normalize();
|
|
2432
|
+
return new w(this._end).addScaledVector(e, t);
|
|
2407
2433
|
}
|
|
2408
2434
|
}
|
|
2409
2435
|
extend(t, s = !1) {
|
|
2410
2436
|
if (s) {
|
|
2411
|
-
const e =
|
|
2412
|
-
this._start = new
|
|
2437
|
+
const e = O.subVectors(this._start, this._end).normalize();
|
|
2438
|
+
this._start = new w(this._start).addScaledVector(
|
|
2413
2439
|
e,
|
|
2414
2440
|
t
|
|
2415
2441
|
);
|
|
2416
2442
|
} else {
|
|
2417
|
-
const e = this.delta(
|
|
2418
|
-
this._end = new
|
|
2443
|
+
const e = this.delta(O).normalize();
|
|
2444
|
+
this._end = new w(this._end).addScaledVector(e, t);
|
|
2419
2445
|
}
|
|
2420
2446
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
2421
2447
|
}
|
|
2422
2448
|
closestPointToPointParameter(t, s) {
|
|
2423
|
-
|
|
2424
|
-
const e =
|
|
2425
|
-
let i =
|
|
2426
|
-
return s && (i =
|
|
2449
|
+
qt.subVectors(t, this._start), _t.subVectors(this.endPoint, this.startPoint);
|
|
2450
|
+
const e = _t.dot(_t);
|
|
2451
|
+
let i = _t.dot(qt) / e;
|
|
2452
|
+
return s && (i = M.clamp(i, 0, 1)), i;
|
|
2427
2453
|
}
|
|
2428
2454
|
closestPointToPoint(t, s, e) {
|
|
2429
2455
|
const n = this.closestPointToPointParameter(t, s);
|
|
@@ -2439,24 +2465,24 @@ class ft extends it {
|
|
|
2439
2465
|
return this._start.distanceTo(this._end);
|
|
2440
2466
|
}
|
|
2441
2467
|
project(t) {
|
|
2442
|
-
const s = this.direction, n =
|
|
2443
|
-
return new
|
|
2468
|
+
const s = this.direction, n = O.subVectors(t, this.startPoint).dot(s);
|
|
2469
|
+
return new w().copy(s).multiplyScalar(n).add(this.startPoint);
|
|
2444
2470
|
}
|
|
2445
2471
|
perpPoint(t) {
|
|
2446
|
-
const s = this.direction, e = this.startPoint, i =
|
|
2447
|
-
return new
|
|
2472
|
+
const s = this.direction, e = this.startPoint, i = O.subVectors(t, e).dot(s), r = O.copy(s).multiplyScalar(i);
|
|
2473
|
+
return new w().addVectors(e, r);
|
|
2448
2474
|
}
|
|
2449
2475
|
calculateBoundingBox() {
|
|
2450
|
-
const t = new
|
|
2476
|
+
const t = new w(
|
|
2451
2477
|
Math.min(this._start.x, this._end.x),
|
|
2452
2478
|
Math.min(this._start.y, this._end.y),
|
|
2453
2479
|
Math.min(this._start.z, this._end.z)
|
|
2454
|
-
), s = new
|
|
2480
|
+
), s = new w(
|
|
2455
2481
|
Math.max(this._start.x, this._end.x),
|
|
2456
2482
|
Math.max(this._start.y, this._end.y),
|
|
2457
2483
|
Math.max(this._start.z, this._end.z)
|
|
2458
2484
|
);
|
|
2459
|
-
return new
|
|
2485
|
+
return new Y(t, s);
|
|
2460
2486
|
}
|
|
2461
2487
|
transform(t) {
|
|
2462
2488
|
return this._start.applyMatrix4(t), this._end.applyMatrix4(t), this._boundingBoxNeedsUpdate = !0, this;
|
|
@@ -2468,65 +2494,65 @@ class ft extends it {
|
|
|
2468
2494
|
return this.startPoint = t.startPoint, this.endPoint = t.endPoint, this._boundingBoxNeedsUpdate = !0, this;
|
|
2469
2495
|
}
|
|
2470
2496
|
clone() {
|
|
2471
|
-
return new
|
|
2497
|
+
return new Mt(this._start.clone(), this._end.clone());
|
|
2472
2498
|
}
|
|
2473
2499
|
}
|
|
2474
|
-
const
|
|
2475
|
-
class
|
|
2500
|
+
const O = new p(), qt = new p(), _t = new p();
|
|
2501
|
+
class At extends ot {
|
|
2476
2502
|
static computeCenterPoint(t, s, e) {
|
|
2477
|
-
const n = new p().addVectors(t, s).multiplyScalar(0.5), i = new p().addVectors(t, e).multiplyScalar(0.5), r = new p().subVectors(s, t),
|
|
2503
|
+
const n = new p().addVectors(t, s).multiplyScalar(0.5), i = new p().addVectors(t, e).multiplyScalar(0.5), r = new p().subVectors(s, t), o = new p().subVectors(e, t), a = new p().crossVectors(r, o).normalize();
|
|
2478
2504
|
if (a.lengthSq() === 0)
|
|
2479
2505
|
return null;
|
|
2480
|
-
const
|
|
2481
|
-
return
|
|
2506
|
+
const h = new p().crossVectors(r, a).normalize(), c = new p().crossVectors(o, a).normalize(), l = h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), u = new Mt(n, n.clone().add(l)), x = new Mt(i, i.clone().add(m)), g = new p();
|
|
2507
|
+
return u.closestPointToPoint(x.startPoint, !0, g) ? g : null;
|
|
2482
2508
|
}
|
|
2483
2509
|
static createByThreePoints(t, s, e) {
|
|
2484
|
-
const n =
|
|
2510
|
+
const n = At.computeCenterPoint(
|
|
2485
2511
|
t,
|
|
2486
2512
|
s,
|
|
2487
2513
|
e
|
|
2488
2514
|
);
|
|
2489
2515
|
if (n) {
|
|
2490
|
-
const i = n.distanceTo(t), r = new p().subVectors(t, n),
|
|
2491
|
-
return new
|
|
2516
|
+
const i = n.distanceTo(t), r = new p().subVectors(t, n), o = new p().subVectors(s, n), a = Math.atan2(r.y, r.x), h = Math.atan2(o.y, o.x);
|
|
2517
|
+
return new At(
|
|
2492
2518
|
n,
|
|
2493
2519
|
i,
|
|
2494
2520
|
a,
|
|
2495
|
-
|
|
2521
|
+
h,
|
|
2496
2522
|
p.Z_AXIS
|
|
2497
2523
|
);
|
|
2498
2524
|
}
|
|
2499
2525
|
}
|
|
2500
2526
|
constructor(t, s, e, n, i, r = p.X_AXIS) {
|
|
2501
|
-
super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = r, (n - e) %
|
|
2527
|
+
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);
|
|
2502
2528
|
}
|
|
2503
2529
|
get center() {
|
|
2504
2530
|
return this._center;
|
|
2505
2531
|
}
|
|
2506
2532
|
set center(t) {
|
|
2507
|
-
this._center = new
|
|
2533
|
+
this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
|
2508
2534
|
}
|
|
2509
2535
|
get radius() {
|
|
2510
2536
|
return this._radius;
|
|
2511
2537
|
}
|
|
2512
2538
|
set radius(t) {
|
|
2513
|
-
if (t < 0) throw
|
|
2539
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
|
2514
2540
|
this._radius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2515
2541
|
}
|
|
2516
2542
|
get startAngle() {
|
|
2517
2543
|
return this._startAngle;
|
|
2518
2544
|
}
|
|
2519
2545
|
set startAngle(t) {
|
|
2520
|
-
this._startAngle =
|
|
2546
|
+
this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2521
2547
|
}
|
|
2522
2548
|
get endAngle() {
|
|
2523
2549
|
return this._endAngle;
|
|
2524
2550
|
}
|
|
2525
2551
|
set endAngle(t) {
|
|
2526
|
-
this._endAngle = this.startAngle == 0 && t ==
|
|
2552
|
+
this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2527
2553
|
}
|
|
2528
2554
|
get deltaAngle() {
|
|
2529
|
-
return
|
|
2555
|
+
return M.normalizeAngle(this.endAngle - this.startAngle);
|
|
2530
2556
|
}
|
|
2531
2557
|
get isLargeArc() {
|
|
2532
2558
|
return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
|
|
@@ -2554,7 +2580,7 @@ class pt extends it {
|
|
|
2554
2580
|
}
|
|
2555
2581
|
get midPoint() {
|
|
2556
2582
|
let t = this.startAngle, s = this.deltaAngle;
|
|
2557
|
-
this.closed && (t = 0, s =
|
|
2583
|
+
this.closed && (t = 0, s = E);
|
|
2558
2584
|
const e = t + s * 0.5;
|
|
2559
2585
|
return this.getPointAtAngle(e);
|
|
2560
2586
|
}
|
|
@@ -2569,18 +2595,18 @@ class pt extends it {
|
|
|
2569
2595
|
if (a.lengthSq() === 0)
|
|
2570
2596
|
return this.startPoint.clone();
|
|
2571
2597
|
a.normalize().multiplyScalar(this.radius);
|
|
2572
|
-
const
|
|
2573
|
-
let
|
|
2574
|
-
|
|
2575
|
-
const x = this.getPointAtAngle(l +
|
|
2598
|
+
const h = e.clone().add(a), c = this.getAngle(h.clone()), l = this.startAngle, m = this.deltaAngle;
|
|
2599
|
+
let u = M.normalizeAngle(c - l);
|
|
2600
|
+
u < 0 && (u = 0), u > m && (u = m);
|
|
2601
|
+
const x = this.getPointAtAngle(l + u), g = x.distanceTo(s), y = this.startPoint.distanceTo(s), _ = this.endPoint.distanceTo(s);
|
|
2576
2602
|
return y < g && y <= _ ? this.startPoint.clone() : _ < g && _ < y ? this.endPoint.clone() : x;
|
|
2577
2603
|
}
|
|
2578
2604
|
tangentPoints(t) {
|
|
2579
|
-
const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i),
|
|
2605
|
+
const s = [], e = new p(t.x, t.y, t.z || 0), n = this.center, i = this.normal, r = this.radius, a = e.clone().sub(n).dot(i), h = e.clone().sub(i.clone().multiplyScalar(a)), c = n.clone(), m = h.clone().sub(c).length();
|
|
2580
2606
|
if (m < r) return s;
|
|
2581
|
-
const
|
|
2607
|
+
const u = Math.acos(r / m), x = this.getAngle(h.clone()), g = [x + u, x - u];
|
|
2582
2608
|
for (const y of g) {
|
|
2583
|
-
const _ =
|
|
2609
|
+
const _ = M.normalizeAngle(y - this.startAngle);
|
|
2584
2610
|
_ >= 0 && _ <= this.deltaAngle && s.push(this.getPointAtAngle(this.startAngle + _));
|
|
2585
2611
|
}
|
|
2586
2612
|
return s;
|
|
@@ -2588,21 +2614,21 @@ class pt extends it {
|
|
|
2588
2614
|
nearestTangentPoint(t) {
|
|
2589
2615
|
const s = this.tangentPoints(t);
|
|
2590
2616
|
if (s.length === 0) return null;
|
|
2591
|
-
const e = new
|
|
2617
|
+
const e = new w(t.x, t.y, t.z || 0);
|
|
2592
2618
|
return s.length === 1 || s[0].distanceTo(e) < s[1].distanceTo(e) ? s[0] : s[1];
|
|
2593
2619
|
}
|
|
2594
2620
|
calculateBoundingBox() {
|
|
2595
2621
|
const t = [this.startAngle, this.endAngle];
|
|
2596
2622
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
|
2597
|
-
|
|
2598
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0,
|
|
2623
|
+
M.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
|
2624
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
|
|
2599
2625
|
for (const a of t) {
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2626
|
+
const h = this.getPointAtAngle(a);
|
|
2627
|
+
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);
|
|
2602
2628
|
}
|
|
2603
|
-
return new
|
|
2629
|
+
return new Y(
|
|
2604
2630
|
{ x: s, y: e, z: n },
|
|
2605
|
-
{ x: i, y: r, z:
|
|
2631
|
+
{ x: i, y: r, z: o }
|
|
2606
2632
|
);
|
|
2607
2633
|
}
|
|
2608
2634
|
get closed() {
|
|
@@ -2611,22 +2637,36 @@ class pt extends it {
|
|
|
2611
2637
|
getPoints(t) {
|
|
2612
2638
|
const s = [];
|
|
2613
2639
|
let e = this.deltaAngle, n = this.startAngle;
|
|
2614
|
-
this.closed && (e =
|
|
2640
|
+
this.closed && (e = E, n = 0);
|
|
2615
2641
|
for (let i = 0; i <= t; i++) {
|
|
2616
|
-
const r = n + e * (i / t),
|
|
2617
|
-
s.push(
|
|
2642
|
+
const r = n + e * (i / t), o = this.getPointAtAngle(r);
|
|
2643
|
+
s.push(o);
|
|
2618
2644
|
}
|
|
2619
2645
|
return s;
|
|
2620
2646
|
}
|
|
2621
2647
|
transform(t) {
|
|
2622
|
-
const s =
|
|
2623
|
-
|
|
2648
|
+
const s = this.center.clone().applyMatrix4(t), e = this.startPoint.clone().applyMatrix4(t), n = this.endPoint.clone().applyMatrix4(t), i = this.getPointAtAngle(
|
|
2649
|
+
this.closed ? Math.PI / 2 : this.startAngle + this.deltaAngle / 2
|
|
2650
|
+
).clone().applyMatrix4(t), r = new p(e).sub(s).normalize(), o = s.distanceTo(e);
|
|
2651
|
+
let a = new p().crossVectors(
|
|
2652
|
+
new p(e).sub(s),
|
|
2653
|
+
new p(i).sub(s)
|
|
2654
|
+
).normalize();
|
|
2655
|
+
a.lengthSq() === 0 && (a = this.normal.clone().transformDirection(t));
|
|
2656
|
+
const h = (c) => {
|
|
2657
|
+
const l = new p(c).sub(s);
|
|
2658
|
+
return Math.atan2(
|
|
2659
|
+
l.dot(Ft.crossVectors(a, r)),
|
|
2660
|
+
l.dot(r)
|
|
2661
|
+
);
|
|
2662
|
+
};
|
|
2663
|
+
return this.center = s, this.radius = o, this.normal = a, this.refVec = r, this.startAngle = 0, this.endAngle = this.closed ? E : h(n), this._boundingBoxNeedsUpdate = !0, this;
|
|
2624
2664
|
}
|
|
2625
2665
|
copy(t) {
|
|
2626
2666
|
return this.center = t.center, this.radius = t.radius, this.startAngle = t.startAngle, this.endAngle = t.endAngle, this.normal = t.normal, this.refVec = t.refVec, this._boundingBoxNeedsUpdate = !0, this;
|
|
2627
2667
|
}
|
|
2628
2668
|
clone() {
|
|
2629
|
-
return new
|
|
2669
|
+
return new At(
|
|
2630
2670
|
this.center.clone(),
|
|
2631
2671
|
this.radius,
|
|
2632
2672
|
this.startAngle,
|
|
@@ -2637,7 +2677,7 @@ class pt extends it {
|
|
|
2637
2677
|
}
|
|
2638
2678
|
getAngle(t) {
|
|
2639
2679
|
return t.sub(this.center), Math.atan2(
|
|
2640
|
-
t.dot(
|
|
2680
|
+
t.dot(Ft.crossVectors(this.refVec, this.normal)),
|
|
2641
2681
|
t.dot(this.refVec)
|
|
2642
2682
|
);
|
|
2643
2683
|
}
|
|
@@ -2647,53 +2687,53 @@ class pt extends it {
|
|
|
2647
2687
|
y: s.z * e.x - s.x * e.z,
|
|
2648
2688
|
z: s.x * e.y - s.y * e.x
|
|
2649
2689
|
}, i = this.center, r = this.radius;
|
|
2650
|
-
return new
|
|
2690
|
+
return new w(
|
|
2651
2691
|
i.x + r * (e.x * Math.cos(t) + n.x * Math.sin(t)),
|
|
2652
2692
|
i.y + r * (e.y * Math.cos(t) + n.y * Math.sin(t)),
|
|
2653
2693
|
i.z + r * (e.z * Math.cos(t) + n.z * Math.sin(t))
|
|
2654
2694
|
);
|
|
2655
2695
|
}
|
|
2656
2696
|
get plane() {
|
|
2657
|
-
const t = new p(this.center).distanceTo(
|
|
2658
|
-
return new
|
|
2697
|
+
const t = new p(this.center).distanceTo(Ot);
|
|
2698
|
+
return new St(this.normal, t);
|
|
2659
2699
|
}
|
|
2660
2700
|
}
|
|
2661
|
-
const
|
|
2662
|
-
class
|
|
2663
|
-
constructor(t, s, e, n = 0, i =
|
|
2664
|
-
super(), this.center = t, this.majorAxisRadius = s, this.minorAxisRadius = e, (i - n) %
|
|
2701
|
+
const Ft = new p();
|
|
2702
|
+
class W extends rt {
|
|
2703
|
+
constructor(t, s, e, n = 0, i = E, r = !1, o = 0) {
|
|
2704
|
+
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;
|
|
2665
2705
|
}
|
|
2666
2706
|
get center() {
|
|
2667
2707
|
return this._center;
|
|
2668
2708
|
}
|
|
2669
2709
|
set center(t) {
|
|
2670
|
-
this._center = new
|
|
2710
|
+
this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
|
2671
2711
|
}
|
|
2672
2712
|
get majorAxisRadius() {
|
|
2673
2713
|
return this._majorAxisRadius;
|
|
2674
2714
|
}
|
|
2675
2715
|
set majorAxisRadius(t) {
|
|
2676
|
-
if (t < 0) throw
|
|
2716
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
|
2677
2717
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2678
2718
|
}
|
|
2679
2719
|
get minorAxisRadius() {
|
|
2680
2720
|
return this._minorAxisRadius;
|
|
2681
2721
|
}
|
|
2682
2722
|
set minorAxisRadius(t) {
|
|
2683
|
-
if (t < 0) throw
|
|
2723
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
|
2684
2724
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2685
2725
|
}
|
|
2686
2726
|
get startAngle() {
|
|
2687
2727
|
return this._startAngle;
|
|
2688
2728
|
}
|
|
2689
2729
|
set startAngle(t) {
|
|
2690
|
-
this._startAngle =
|
|
2730
|
+
this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2691
2731
|
}
|
|
2692
2732
|
get endAngle() {
|
|
2693
2733
|
return this._endAngle;
|
|
2694
2734
|
}
|
|
2695
2735
|
set endAngle(t) {
|
|
2696
|
-
this._endAngle = this.startAngle == 0 && t ==
|
|
2736
|
+
this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2697
2737
|
}
|
|
2698
2738
|
get clockwise() {
|
|
2699
2739
|
return this._clockwise;
|
|
@@ -2708,7 +2748,7 @@ class zt extends nt {
|
|
|
2708
2748
|
this._rotation = t, this._boundingBoxNeedsUpdate = !0;
|
|
2709
2749
|
}
|
|
2710
2750
|
get deltaAngle() {
|
|
2711
|
-
return
|
|
2751
|
+
return M.normalizeAngle(this.endAngle - this.startAngle);
|
|
2712
2752
|
}
|
|
2713
2753
|
get isLargeArc() {
|
|
2714
2754
|
return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
|
|
@@ -2716,8 +2756,8 @@ class zt extends nt {
|
|
|
2716
2756
|
calculateBoundingBox() {
|
|
2717
2757
|
let s = 1 / 0, e = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2718
2758
|
for (let r = 0; r <= 100; r++) {
|
|
2719
|
-
const
|
|
2720
|
-
s = Math.min(s,
|
|
2759
|
+
const o = this.getPoint(r / 100);
|
|
2760
|
+
s = Math.min(s, o.x), e = Math.min(e, o.y), n = Math.max(n, o.x), i = Math.max(i, o.y);
|
|
2721
2761
|
}
|
|
2722
2762
|
return new F({ x: s, y: e }, { x: n, y: i });
|
|
2723
2763
|
}
|
|
@@ -2732,21 +2772,58 @@ class zt extends nt {
|
|
|
2732
2772
|
for (; e > s; ) e -= s;
|
|
2733
2773
|
e < Number.EPSILON && (n ? e = 0 : e = s), this.clockwise === !0 && !n && (e === s ? e = -s : e = e - s);
|
|
2734
2774
|
const i = this.startAngle + t * e;
|
|
2735
|
-
let r = this.center.x + this.majorAxisRadius * Math.cos(i),
|
|
2775
|
+
let r = this.center.x + this.majorAxisRadius * Math.cos(i), o = this.center.y + this.minorAxisRadius * Math.sin(i);
|
|
2736
2776
|
if (this.rotation !== 0) {
|
|
2737
|
-
const a = Math.cos(this.rotation),
|
|
2738
|
-
r = c * a - l *
|
|
2777
|
+
const a = Math.cos(this.rotation), h = Math.sin(this.rotation), c = r - this.center.x, l = o - this.center.y;
|
|
2778
|
+
r = c * a - l * h + this.center.x, o = c * h + l * a + this.center.y;
|
|
2739
2779
|
}
|
|
2740
|
-
return new C(r,
|
|
2780
|
+
return new C(r, o);
|
|
2741
2781
|
}
|
|
2742
2782
|
transform(t) {
|
|
2743
|
-
|
|
2783
|
+
const s = t, e = new C(this.center).applyMatrix2d(
|
|
2784
|
+
s
|
|
2785
|
+
), n = new w(
|
|
2786
|
+
e.x,
|
|
2787
|
+
e.y,
|
|
2788
|
+
this.center.z
|
|
2789
|
+
), i = this.getPointAtAngle(0).clone().applyMatrix2d(s), r = this.getPointAtAngle(Math.PI / 2).clone().applyMatrix2d(s), o = new C(i).sub(
|
|
2790
|
+
e
|
|
2791
|
+
), a = new C(r).sub(
|
|
2792
|
+
e
|
|
2793
|
+
), h = o.length(), c = a.length(), l = Math.atan2(o.y, o.x), m = o.clone().normalize(), u = a.clone().normalize(), x = (_) => {
|
|
2794
|
+
const z = new C(_).sub(e), f = z.dot(m), b = z.dot(u);
|
|
2795
|
+
return M.normalizeAngle(
|
|
2796
|
+
Math.atan2(b / c, f / h)
|
|
2797
|
+
);
|
|
2798
|
+
}, g = s.determinant() < 0 ? !this.clockwise : this.clockwise, y = this.closed ? new W(
|
|
2799
|
+
n,
|
|
2800
|
+
h,
|
|
2801
|
+
c,
|
|
2802
|
+
0,
|
|
2803
|
+
E,
|
|
2804
|
+
g,
|
|
2805
|
+
l
|
|
2806
|
+
) : new W(
|
|
2807
|
+
n,
|
|
2808
|
+
h,
|
|
2809
|
+
c,
|
|
2810
|
+
x(this.startPoint.clone().applyMatrix2d(s)),
|
|
2811
|
+
x(this.endPoint.clone().applyMatrix2d(s)),
|
|
2812
|
+
g,
|
|
2813
|
+
l
|
|
2814
|
+
);
|
|
2815
|
+
return this.center = y.center, this.majorAxisRadius = y.majorAxisRadius, this.minorAxisRadius = y.minorAxisRadius, this._startAngle = y._startAngle, this._endAngle = y._endAngle, this._clockwise = y._clockwise, this.rotation = y.rotation, this._boundingBoxNeedsUpdate = !0, this;
|
|
2816
|
+
}
|
|
2817
|
+
getPointAtAngle(t) {
|
|
2818
|
+
return this.getPoint(
|
|
2819
|
+
this.closed ? t / E : M.normalizeAngle(t - this.startAngle) / this.deltaAngle
|
|
2820
|
+
);
|
|
2744
2821
|
}
|
|
2745
2822
|
copy(t) {
|
|
2746
2823
|
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;
|
|
2747
2824
|
}
|
|
2748
2825
|
clone() {
|
|
2749
|
-
return new
|
|
2826
|
+
return new W(
|
|
2750
2827
|
this.center,
|
|
2751
2828
|
this.majorAxisRadius,
|
|
2752
2829
|
this.minorAxisRadius,
|
|
@@ -2757,47 +2834,47 @@ class zt extends nt {
|
|
|
2757
2834
|
);
|
|
2758
2835
|
}
|
|
2759
2836
|
}
|
|
2760
|
-
class
|
|
2761
|
-
constructor(t, s, e, n, i, r = 0,
|
|
2837
|
+
class zt extends ot {
|
|
2838
|
+
constructor(t, s, e, n, i, r = 0, o = E) {
|
|
2762
2839
|
super(), this.center = t, this.normal = s, this.majorAxis = e, this.majorAxisRadius = n, this.minorAxisRadius = i;
|
|
2763
|
-
const a = Math.abs(
|
|
2764
|
-
Math.abs(a -
|
|
2840
|
+
const a = Math.abs(o - r);
|
|
2841
|
+
Math.abs(a - E) < 1e-10 || Math.abs(a - 2 * E) < 1e-10 ? (this.startAngle = 0, this.endAngle = E) : (this.startAngle = r, this.endAngle = o);
|
|
2765
2842
|
}
|
|
2766
2843
|
get center() {
|
|
2767
2844
|
return this._center;
|
|
2768
2845
|
}
|
|
2769
2846
|
set center(t) {
|
|
2770
|
-
this._center = new
|
|
2847
|
+
this._center = new w(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
|
2771
2848
|
}
|
|
2772
2849
|
get majorAxisRadius() {
|
|
2773
2850
|
return this._majorAxisRadius;
|
|
2774
2851
|
}
|
|
2775
2852
|
set majorAxisRadius(t) {
|
|
2776
|
-
if (t < 0) throw
|
|
2853
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
|
2777
2854
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2778
2855
|
}
|
|
2779
2856
|
get minorAxisRadius() {
|
|
2780
2857
|
return this._minorAxisRadius;
|
|
2781
2858
|
}
|
|
2782
2859
|
set minorAxisRadius(t) {
|
|
2783
|
-
if (t < 0) throw
|
|
2860
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
|
2784
2861
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
|
2785
2862
|
}
|
|
2786
2863
|
get startAngle() {
|
|
2787
2864
|
return this._startAngle;
|
|
2788
2865
|
}
|
|
2789
2866
|
set startAngle(t) {
|
|
2790
|
-
this._startAngle =
|
|
2867
|
+
this._startAngle = M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2791
2868
|
}
|
|
2792
2869
|
get endAngle() {
|
|
2793
2870
|
return this._endAngle;
|
|
2794
2871
|
}
|
|
2795
2872
|
set endAngle(t) {
|
|
2796
|
-
this._endAngle = this.startAngle == 0 && t ==
|
|
2873
|
+
this._endAngle = this.startAngle == 0 && t == E ? t : M.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
|
2797
2874
|
}
|
|
2798
2875
|
get deltaAngle() {
|
|
2799
2876
|
const t = this.endAngle - this.startAngle;
|
|
2800
|
-
return Math.abs(t -
|
|
2877
|
+
return Math.abs(t - E) < 1e-10 ? E : M.normalizeAngle(t);
|
|
2801
2878
|
}
|
|
2802
2879
|
get isLargeArc() {
|
|
2803
2880
|
return Math.abs(this.deltaAngle) > Math.PI ? 1 : 0;
|
|
@@ -2828,12 +2905,12 @@ class Wt extends it {
|
|
|
2828
2905
|
}
|
|
2829
2906
|
get midPoint() {
|
|
2830
2907
|
let t = this.startAngle, s = this.deltaAngle;
|
|
2831
|
-
(this.closed || Math.abs(s -
|
|
2908
|
+
(this.closed || Math.abs(s - E) < 1e-10) && (t = 0, s = E);
|
|
2832
2909
|
const e = t + s / 2;
|
|
2833
2910
|
return this.getPointAtAngle(e);
|
|
2834
2911
|
}
|
|
2835
2912
|
get isCircular() {
|
|
2836
|
-
return
|
|
2913
|
+
return Qt.equal(this.majorAxisRadius, this.minorAxisRadius);
|
|
2837
2914
|
}
|
|
2838
2915
|
get length() {
|
|
2839
2916
|
if (this.isCircular)
|
|
@@ -2841,14 +2918,14 @@ class Wt extends it {
|
|
|
2841
2918
|
const t = 1e3, s = this.deltaAngle / t;
|
|
2842
2919
|
let e = 0, n = this.getPointAtAngle(this.startAngle);
|
|
2843
2920
|
for (let i = 1; i <= t; i++) {
|
|
2844
|
-
const r = this.startAngle + i * s,
|
|
2845
|
-
e += Math.sqrt(a * a +
|
|
2921
|
+
const r = this.startAngle + i * s, o = this.getPointAtAngle(r), a = o.x - n.x, h = o.y - n.y, c = o.z - n.z;
|
|
2922
|
+
e += Math.sqrt(a * a + h * h + c * c), n = o;
|
|
2846
2923
|
}
|
|
2847
2924
|
return e;
|
|
2848
2925
|
}
|
|
2849
2926
|
get area() {
|
|
2850
2927
|
const t = this.majorAxisRadius, s = this.minorAxisRadius, e = this.startAngle, n = e + this.deltaAngle;
|
|
2851
|
-
if (Math.abs(this.deltaAngle -
|
|
2928
|
+
if (Math.abs(this.deltaAngle - E) < 1e-10)
|
|
2852
2929
|
return Math.PI * t * s;
|
|
2853
2930
|
const i = t * s / 2 * (n - e - (Math.sin(n) * Math.cos(n) - Math.sin(e) * Math.cos(e)));
|
|
2854
2931
|
return Math.abs(i);
|
|
@@ -2857,25 +2934,25 @@ class Wt extends it {
|
|
|
2857
2934
|
if (this.majorAxis.equals(p.X_AXIS) || this.majorAxis.equals(p.Y_AXIS) || this.majorAxis.isParallelTo(p.X_AXIS) || this.majorAxis.isParallelTo(p.Y_AXIS)) {
|
|
2858
2935
|
const t = [this.startAngle, this.endAngle];
|
|
2859
2936
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
|
2860
|
-
|
|
2861
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0,
|
|
2937
|
+
M.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
|
2938
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
|
|
2862
2939
|
for (const a of t) {
|
|
2863
|
-
const
|
|
2864
|
-
|
|
2940
|
+
const h = this.getPointAtAngle(a);
|
|
2941
|
+
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);
|
|
2865
2942
|
}
|
|
2866
|
-
return new
|
|
2943
|
+
return new Y(
|
|
2867
2944
|
{ x: s, y: e, z: n },
|
|
2868
|
-
{ x: i, y: r, z:
|
|
2945
|
+
{ x: i, y: r, z: o }
|
|
2869
2946
|
);
|
|
2870
2947
|
} else {
|
|
2871
|
-
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0,
|
|
2948
|
+
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, r = -1 / 0, o = -1 / 0;
|
|
2872
2949
|
for (let a = 0; a <= 100; a++) {
|
|
2873
|
-
const
|
|
2874
|
-
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),
|
|
2950
|
+
const h = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(h);
|
|
2951
|
+
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);
|
|
2875
2952
|
}
|
|
2876
|
-
return new
|
|
2953
|
+
return new Y(
|
|
2877
2954
|
{ x: s, y: e, z: n },
|
|
2878
|
-
{ x: i, y: r, z:
|
|
2955
|
+
{ x: i, y: r, z: o }
|
|
2879
2956
|
);
|
|
2880
2957
|
}
|
|
2881
2958
|
}
|
|
@@ -2885,16 +2962,16 @@ class Wt extends it {
|
|
|
2885
2962
|
getPoints(t = 100) {
|
|
2886
2963
|
const s = [];
|
|
2887
2964
|
let e = this.deltaAngle, n = this.startAngle;
|
|
2888
|
-
this.closed && (e =
|
|
2965
|
+
this.closed && (e = E, n = 0);
|
|
2889
2966
|
for (let i = 0; i <= t; i++) {
|
|
2890
|
-
const r = n + e * (i / t),
|
|
2891
|
-
s.push(
|
|
2967
|
+
const r = n + e * (i / t), o = this.getPointAtAngle(r);
|
|
2968
|
+
s.push(o);
|
|
2892
2969
|
}
|
|
2893
2970
|
return s;
|
|
2894
2971
|
}
|
|
2895
2972
|
getPointAtAngle(t) {
|
|
2896
2973
|
const s = Math.cos(t), e = Math.sin(t), n = this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e), i = this.majorAxis.clone().multiplyScalar(s * this.majorAxisRadius).add(n);
|
|
2897
|
-
return new
|
|
2974
|
+
return new w(
|
|
2898
2975
|
this.center.x + i.x,
|
|
2899
2976
|
this.center.y + i.y,
|
|
2900
2977
|
this.center.z + i.z
|
|
@@ -2905,13 +2982,42 @@ class Wt extends it {
|
|
|
2905
2982
|
return i * i + r * r <= 1;
|
|
2906
2983
|
}
|
|
2907
2984
|
transform(t) {
|
|
2908
|
-
|
|
2985
|
+
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 p(n).sub(
|
|
2986
|
+
e
|
|
2987
|
+
), o = new p(i).sub(
|
|
2988
|
+
e
|
|
2989
|
+
), a = r.length(), h = o.length(), c = r.clone().normalize(), l = new p().crossVectors(r, o).normalize();
|
|
2990
|
+
let m = new p().crossVectors(l, c).normalize();
|
|
2991
|
+
m.dot(o) < 0 && (l.negate(), m = new p().crossVectors(l, c).normalize());
|
|
2992
|
+
const u = (g) => {
|
|
2993
|
+
const y = new p(g).sub(e), _ = y.dot(c), z = y.dot(m);
|
|
2994
|
+
return M.normalizeAngle(
|
|
2995
|
+
Math.atan2(z / h, _ / a)
|
|
2996
|
+
);
|
|
2997
|
+
}, x = this.closed ? new zt(
|
|
2998
|
+
e,
|
|
2999
|
+
l,
|
|
3000
|
+
c,
|
|
3001
|
+
a,
|
|
3002
|
+
h,
|
|
3003
|
+
0,
|
|
3004
|
+
E
|
|
3005
|
+
) : new zt(
|
|
3006
|
+
e,
|
|
3007
|
+
l,
|
|
3008
|
+
c,
|
|
3009
|
+
a,
|
|
3010
|
+
h,
|
|
3011
|
+
u(this.startPoint.clone().applyMatrix4(s)),
|
|
3012
|
+
u(this.endPoint.clone().applyMatrix4(s))
|
|
3013
|
+
);
|
|
3014
|
+
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;
|
|
2909
3015
|
}
|
|
2910
3016
|
copy(t) {
|
|
2911
3017
|
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;
|
|
2912
3018
|
}
|
|
2913
3019
|
clone() {
|
|
2914
|
-
return new
|
|
3020
|
+
return new zt(
|
|
2915
3021
|
this.center,
|
|
2916
3022
|
this.normal,
|
|
2917
3023
|
this.majorAxis,
|
|
@@ -2922,11 +3028,11 @@ class Wt extends it {
|
|
|
2922
3028
|
);
|
|
2923
3029
|
}
|
|
2924
3030
|
get plane() {
|
|
2925
|
-
const t = new p(this.center).distanceTo(
|
|
2926
|
-
return new
|
|
3031
|
+
const t = new p(this.center).distanceTo(Ot);
|
|
3032
|
+
return new St(this.normal, t);
|
|
2927
3033
|
}
|
|
2928
3034
|
}
|
|
2929
|
-
class
|
|
3035
|
+
class Vs extends rt {
|
|
2930
3036
|
constructor(t = null, s = !1) {
|
|
2931
3037
|
super(), this._vertices = t || new Array(), this._closed = s;
|
|
2932
3038
|
}
|
|
@@ -2966,7 +3072,7 @@ class Us extends nt {
|
|
|
2966
3072
|
let i = null;
|
|
2967
3073
|
if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
|
|
2968
3074
|
if (n.bulge) {
|
|
2969
|
-
const r = new
|
|
3075
|
+
const r = new Q(n, i, n.bulge);
|
|
2970
3076
|
t += r.length;
|
|
2971
3077
|
} else
|
|
2972
3078
|
t += new C(n.x, n.y).distanceTo(i);
|
|
@@ -2998,12 +3104,16 @@ class Us extends nt {
|
|
|
2998
3104
|
return new F().setFromPoints(t);
|
|
2999
3105
|
}
|
|
3000
3106
|
transform(t) {
|
|
3001
|
-
|
|
3107
|
+
const s = t.determinant() < 0;
|
|
3108
|
+
return this._vertices.forEach((e) => {
|
|
3109
|
+
const n = new C(e).applyMatrix2d(t);
|
|
3110
|
+
e.x = n.x, e.y = n.y, s && e.bulge != null && (e.bulge = -e.bulge);
|
|
3111
|
+
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3002
3112
|
}
|
|
3003
3113
|
getPoints3d(t, s) {
|
|
3004
3114
|
const e = [];
|
|
3005
3115
|
return this.getPoints(t).forEach(
|
|
3006
|
-
(i) => e.push(new
|
|
3116
|
+
(i) => e.push(new w().set(i.x, i.y, s))
|
|
3007
3117
|
), e;
|
|
3008
3118
|
}
|
|
3009
3119
|
getPoints(t) {
|
|
@@ -3013,8 +3123,8 @@ class Us extends nt {
|
|
|
3013
3123
|
if (i.bulge) {
|
|
3014
3124
|
let r = null;
|
|
3015
3125
|
if (n < e - 1 ? r = this._vertices[n + 1] : n == e - 1 && this.closed && (r = this._vertices[0]), r) {
|
|
3016
|
-
const a = new
|
|
3017
|
-
for (let c = 0; c <
|
|
3126
|
+
const a = new Q(i, r, i.bulge).getPoints(t), h = a.length;
|
|
3127
|
+
for (let c = 0; c < h; ++c) {
|
|
3018
3128
|
const l = a[c];
|
|
3019
3129
|
s.push(new C(l.x, l.y));
|
|
3020
3130
|
}
|
|
@@ -3025,7 +3135,7 @@ class Us extends nt {
|
|
|
3025
3135
|
return s;
|
|
3026
3136
|
}
|
|
3027
3137
|
}
|
|
3028
|
-
class
|
|
3138
|
+
class Pt extends rt {
|
|
3029
3139
|
constructor(t, s) {
|
|
3030
3140
|
super(), this._start = new C(t), this._end = new C(s);
|
|
3031
3141
|
}
|
|
@@ -3067,10 +3177,10 @@ class Mt extends nt {
|
|
|
3067
3177
|
return this.startPoint = t.startPoint, this.endPoint = t.endPoint, this._boundingBoxNeedsUpdate = !0, this;
|
|
3068
3178
|
}
|
|
3069
3179
|
clone() {
|
|
3070
|
-
return new
|
|
3180
|
+
return new Pt(this._start.clone(), this._end.clone());
|
|
3071
3181
|
}
|
|
3072
3182
|
}
|
|
3073
|
-
class X extends
|
|
3183
|
+
class X extends rt {
|
|
3074
3184
|
constructor(t = []) {
|
|
3075
3185
|
super(), this._curves = t;
|
|
3076
3186
|
}
|
|
@@ -3079,16 +3189,16 @@ class X extends nt {
|
|
|
3079
3189
|
}
|
|
3080
3190
|
static buildFromEdges(t, s = 1e-3) {
|
|
3081
3191
|
if (t.length === 0) return [];
|
|
3082
|
-
const e = [...t], n = [], i = s * s, r = (
|
|
3083
|
-
const
|
|
3084
|
-
return
|
|
3192
|
+
const e = [...t], n = [], i = s * s, r = (o, a) => {
|
|
3193
|
+
const h = o.x - a.x, c = o.y - a.y;
|
|
3194
|
+
return h * h + c * c <= i;
|
|
3085
3195
|
};
|
|
3086
3196
|
for (; e.length > 0; ) {
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3089
|
-
const
|
|
3197
|
+
const o = [], a = e.shift();
|
|
3198
|
+
o.push(a);
|
|
3199
|
+
const h = X.getEdgeStartPoint(a);
|
|
3090
3200
|
let c = X.getEdgeEndPoint(a);
|
|
3091
|
-
if (!r(
|
|
3201
|
+
if (!r(h, c))
|
|
3092
3202
|
for (; e.length > 0; ) {
|
|
3093
3203
|
const l = X.findConnectingEdge(
|
|
3094
3204
|
e,
|
|
@@ -3097,9 +3207,9 @@ class X extends nt {
|
|
|
3097
3207
|
);
|
|
3098
3208
|
if (l.index < 0) break;
|
|
3099
3209
|
let m = e.splice(l.index, 1)[0];
|
|
3100
|
-
if (l.reverse && (m = X.reverseEdge(m)),
|
|
3210
|
+
if (l.reverse && (m = X.reverseEdge(m)), o.push(m), c = X.getEdgeEndPoint(m), r(c, h)) break;
|
|
3101
3211
|
}
|
|
3102
|
-
n.push(new X(
|
|
3212
|
+
n.push(new X(o));
|
|
3103
3213
|
}
|
|
3104
3214
|
return n;
|
|
3105
3215
|
}
|
|
@@ -3130,7 +3240,27 @@ class X extends nt {
|
|
|
3130
3240
|
return s.setFromPoints(t), s;
|
|
3131
3241
|
}
|
|
3132
3242
|
transform(t) {
|
|
3133
|
-
|
|
3243
|
+
const s = new H().set(
|
|
3244
|
+
t.elements[0],
|
|
3245
|
+
t.elements[3],
|
|
3246
|
+
0,
|
|
3247
|
+
t.elements[6],
|
|
3248
|
+
t.elements[1],
|
|
3249
|
+
t.elements[4],
|
|
3250
|
+
0,
|
|
3251
|
+
t.elements[7],
|
|
3252
|
+
0,
|
|
3253
|
+
0,
|
|
3254
|
+
1,
|
|
3255
|
+
0,
|
|
3256
|
+
0,
|
|
3257
|
+
0,
|
|
3258
|
+
0,
|
|
3259
|
+
1
|
|
3260
|
+
);
|
|
3261
|
+
return this._curves.forEach((e) => {
|
|
3262
|
+
e instanceof J ? e.transform(s) : e.transform(t);
|
|
3263
|
+
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3134
3264
|
}
|
|
3135
3265
|
get closed() {
|
|
3136
3266
|
return !0;
|
|
@@ -3145,11 +3275,11 @@ class X extends nt {
|
|
|
3145
3275
|
}
|
|
3146
3276
|
static findConnectingEdge(t, s, e) {
|
|
3147
3277
|
let n = -1, i = !1, r = Number.POSITIVE_INFINITY;
|
|
3148
|
-
for (let
|
|
3149
|
-
const a = t[
|
|
3150
|
-
|
|
3278
|
+
for (let o = 0; o < t.length; o++) {
|
|
3279
|
+
const a = t[o], h = X.getEdgeStartPoint(a), c = X.getEdgeEndPoint(a), l = s.x - h.x, m = s.y - h.y, u = l * l + m * m;
|
|
3280
|
+
u < r && (r = u, n = o, i = !1);
|
|
3151
3281
|
const x = s.x - c.x, g = s.y - c.y, y = x * x + g * g;
|
|
3152
|
-
y < r && (r = y, n =
|
|
3282
|
+
y < r && (r = y, n = o, i = !0);
|
|
3153
3283
|
}
|
|
3154
3284
|
return r > e ? { index: -1, reverse: !1 } : { index: n, reverse: i };
|
|
3155
3285
|
}
|
|
@@ -3162,13 +3292,13 @@ class X extends nt {
|
|
|
3162
3292
|
return new C(s.x, s.y);
|
|
3163
3293
|
}
|
|
3164
3294
|
static reverseEdge(t) {
|
|
3165
|
-
return t instanceof
|
|
3295
|
+
return t instanceof Pt ? new Pt(t.endPoint, t.startPoint) : t instanceof Q ? new Q(
|
|
3166
3296
|
t.center,
|
|
3167
3297
|
t.radius,
|
|
3168
3298
|
t.endAngle,
|
|
3169
3299
|
t.startAngle,
|
|
3170
3300
|
!t.clockwise
|
|
3171
|
-
) : t instanceof
|
|
3301
|
+
) : t instanceof W ? new W(
|
|
3172
3302
|
t.center,
|
|
3173
3303
|
t.majorAxisRadius,
|
|
3174
3304
|
t.minorAxisRadius,
|
|
@@ -3176,11 +3306,11 @@ class X extends nt {
|
|
|
3176
3306
|
t.startAngle,
|
|
3177
3307
|
!t.clockwise,
|
|
3178
3308
|
t.rotation
|
|
3179
|
-
) : t instanceof
|
|
3309
|
+
) : t instanceof J ? X.reverseSplineEdge(t) : t;
|
|
3180
3310
|
}
|
|
3181
3311
|
static reverseSplineEdge(t) {
|
|
3182
|
-
const s = [...t.controlPoints].reverse(), e = t.knots, n = e[0], i = e[e.length - 1], r = e.map((
|
|
3183
|
-
return new
|
|
3312
|
+
const s = [...t.controlPoints].reverse(), e = t.knots, n = e[0], i = e[e.length - 1], r = e.map((h) => n + i - h).reverse(), o = t.weights, a = o.length > 0 ? [...o].reverse() : void 0;
|
|
3313
|
+
return new J(
|
|
3184
3314
|
s,
|
|
3185
3315
|
r,
|
|
3186
3316
|
a,
|
|
@@ -3199,18 +3329,18 @@ class kt {
|
|
|
3199
3329
|
initCatmullRom(t, s, e, n, i) {
|
|
3200
3330
|
this.init(s, e, i * (e - t), i * (n - s));
|
|
3201
3331
|
}
|
|
3202
|
-
initNonuniformCatmullRom(t, s, e, n, i, r,
|
|
3203
|
-
let a = (s - t) / i - (e - t) / (i + r) + (e - s) / r,
|
|
3204
|
-
a *= r,
|
|
3332
|
+
initNonuniformCatmullRom(t, s, e, n, i, r, o) {
|
|
3333
|
+
let a = (s - t) / i - (e - t) / (i + r) + (e - s) / r, h = (e - s) / r - (n - s) / (r + o) + (n - e) / o;
|
|
3334
|
+
a *= r, h *= r, this.init(s, e, a, h);
|
|
3205
3335
|
}
|
|
3206
3336
|
calc(t) {
|
|
3207
3337
|
const s = t * t, e = s * t;
|
|
3208
3338
|
return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
|
|
3209
3339
|
}
|
|
3210
3340
|
}
|
|
3211
|
-
class Es extends
|
|
3341
|
+
class Es extends ot {
|
|
3212
3342
|
constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
|
|
3213
|
-
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new kt(), this._py = new kt(), this._pz = new kt(), this._points = t.map((i) => new
|
|
3343
|
+
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new p(), this._px = new kt(), this._py = new kt(), this._pz = new kt(), this._points = t.map((i) => new w(i)), this._closed = s, this._curveType = e, this._tension = n;
|
|
3214
3344
|
}
|
|
3215
3345
|
get points() {
|
|
3216
3346
|
return this._points;
|
|
@@ -3225,10 +3355,10 @@ class Es extends it {
|
|
|
3225
3355
|
return this._tension;
|
|
3226
3356
|
}
|
|
3227
3357
|
get startPoint() {
|
|
3228
|
-
return this._points.length > 0 ? this._points[0] : new
|
|
3358
|
+
return this._points.length > 0 ? this._points[0] : new w();
|
|
3229
3359
|
}
|
|
3230
3360
|
get endPoint() {
|
|
3231
|
-
return this._points.length > 0 ? this._points[this._points.length - 1] : new
|
|
3361
|
+
return this._points.length > 0 ? this._points[this._points.length - 1] : new w();
|
|
3232
3362
|
}
|
|
3233
3363
|
get length() {
|
|
3234
3364
|
if (this._points.length < 2) return 0;
|
|
@@ -3239,23 +3369,23 @@ class Es extends it {
|
|
|
3239
3369
|
this._points[0]
|
|
3240
3370
|
)), t;
|
|
3241
3371
|
}
|
|
3242
|
-
getPoint(t, s = new
|
|
3372
|
+
getPoint(t, s = new w()) {
|
|
3243
3373
|
const e = s, n = this._points, i = n.length;
|
|
3244
3374
|
if (i === 0)
|
|
3245
3375
|
return e.set(0, 0, 0);
|
|
3246
3376
|
if (i === 1)
|
|
3247
3377
|
return e.copy(n[0]);
|
|
3248
3378
|
const r = (i - (this._closed ? 0 : 1)) * t;
|
|
3249
|
-
let
|
|
3250
|
-
this._closed ?
|
|
3251
|
-
let
|
|
3252
|
-
this._closed ||
|
|
3253
|
-
const l = n[
|
|
3254
|
-
if (this._closed ||
|
|
3255
|
-
const
|
|
3256
|
-
let x = Math.pow(
|
|
3257
|
-
g < 1e-4 && (g = 1), x < 1e-4 && (x = g), y < 1e-4 && (y = g), this._px.initNonuniformCatmullRom(
|
|
3258
|
-
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(
|
|
3379
|
+
let o = Math.floor(r), a = r - o;
|
|
3380
|
+
this._closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / i) + 1) * i : a === 0 && o === i - 1 && (o = i - 2, a = 1);
|
|
3381
|
+
let h, c;
|
|
3382
|
+
this._closed || o > 0 ? h = n[(o - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), h = new w(this._tmp.x, this._tmp.y, this._tmp.z));
|
|
3383
|
+
const l = n[o % i], m = n[(o + 1) % i];
|
|
3384
|
+
if (this._closed || o + 2 < i ? c = n[(o + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new w(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
|
|
3385
|
+
const u = this._curveType === "chordal" ? 0.5 : 0.25;
|
|
3386
|
+
let x = Math.pow(h.distanceToSquared(l), u), g = Math.pow(l.distanceToSquared(m), u), y = Math.pow(m.distanceToSquared(c), u);
|
|
3387
|
+
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);
|
|
3388
|
+
} 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));
|
|
3259
3389
|
return e.set(
|
|
3260
3390
|
this._px.calc(a),
|
|
3261
3391
|
this._py.calc(a),
|
|
@@ -3269,7 +3399,7 @@ class Es extends it {
|
|
|
3269
3399
|
return s;
|
|
3270
3400
|
}
|
|
3271
3401
|
setPoints(t) {
|
|
3272
|
-
this._points = t.map((s) => new
|
|
3402
|
+
this._points = t.map((s) => new w(s)), this._boundingBoxNeedsUpdate = !0;
|
|
3273
3403
|
}
|
|
3274
3404
|
setClosed(t) {
|
|
3275
3405
|
this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0);
|
|
@@ -3282,20 +3412,20 @@ class Es extends it {
|
|
|
3282
3412
|
}
|
|
3283
3413
|
transform(t) {
|
|
3284
3414
|
return this._points = this._points.map((s) => {
|
|
3285
|
-
const e = new
|
|
3415
|
+
const e = new w();
|
|
3286
3416
|
return e.copy(s), e.applyMatrix4(t), e;
|
|
3287
3417
|
}), this._boundingBoxNeedsUpdate = !0, this;
|
|
3288
3418
|
}
|
|
3289
3419
|
calculateBoundingBox() {
|
|
3290
3420
|
if (this._points.length === 0)
|
|
3291
|
-
return new
|
|
3292
|
-
const t = new
|
|
3421
|
+
return new Y();
|
|
3422
|
+
const t = new Y();
|
|
3293
3423
|
return this._points.forEach((s) => {
|
|
3294
3424
|
t.expandByPoint(s);
|
|
3295
3425
|
}), t;
|
|
3296
3426
|
}
|
|
3297
3427
|
}
|
|
3298
|
-
class
|
|
3428
|
+
class j {
|
|
3299
3429
|
constructor(t, s, e, n) {
|
|
3300
3430
|
this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) => ({ x: i.x, y: i.y, z: i.z })), this._weights = n ? [...n] : new Array(e.length).fill(1);
|
|
3301
3431
|
}
|
|
@@ -3313,7 +3443,7 @@ class U {
|
|
|
3313
3443
|
}
|
|
3314
3444
|
point(t) {
|
|
3315
3445
|
const s = this._controlPoints.map((e) => [e.x, e.y, e.z]);
|
|
3316
|
-
return
|
|
3446
|
+
return ft(
|
|
3317
3447
|
t,
|
|
3318
3448
|
this._degree,
|
|
3319
3449
|
this._knots,
|
|
@@ -3323,7 +3453,7 @@ class U {
|
|
|
3323
3453
|
}
|
|
3324
3454
|
length() {
|
|
3325
3455
|
const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
|
|
3326
|
-
return
|
|
3456
|
+
return ws(
|
|
3327
3457
|
this._degree,
|
|
3328
3458
|
this._knots,
|
|
3329
3459
|
t,
|
|
@@ -3331,24 +3461,24 @@ class U {
|
|
|
3331
3461
|
);
|
|
3332
3462
|
}
|
|
3333
3463
|
static byKnotsControlPointsWeights(t, s, e, n) {
|
|
3334
|
-
return new
|
|
3464
|
+
return new j(t, s, e, n);
|
|
3335
3465
|
}
|
|
3336
3466
|
static byPoints(t, s, e = "Uniform", n, i) {
|
|
3337
|
-
const r =
|
|
3467
|
+
const r = $t(
|
|
3338
3468
|
t,
|
|
3339
3469
|
s,
|
|
3340
3470
|
e,
|
|
3341
3471
|
n,
|
|
3342
3472
|
i
|
|
3343
|
-
),
|
|
3473
|
+
), o = r.controlPoints.map((a) => ({
|
|
3344
3474
|
x: a[0],
|
|
3345
3475
|
y: a[1],
|
|
3346
3476
|
z: a[2]
|
|
3347
3477
|
}));
|
|
3348
|
-
return new
|
|
3478
|
+
return new j(
|
|
3349
3479
|
s,
|
|
3350
3480
|
r.knots,
|
|
3351
|
-
|
|
3481
|
+
o,
|
|
3352
3482
|
r.weights
|
|
3353
3483
|
);
|
|
3354
3484
|
}
|
|
@@ -3365,8 +3495,8 @@ class U {
|
|
|
3365
3495
|
return s;
|
|
3366
3496
|
}
|
|
3367
3497
|
isClosed(t = 1e-6) {
|
|
3368
|
-
const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), r = n[0] - i[0],
|
|
3369
|
-
return Math.sqrt(r * r +
|
|
3498
|
+
const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), r = n[0] - i[0], o = n[1] - i[1], a = n[2] - i[2];
|
|
3499
|
+
return Math.sqrt(r * r + o * o + a * a) < t;
|
|
3370
3500
|
}
|
|
3371
3501
|
static createFitPointsForClosedCurve(t) {
|
|
3372
3502
|
if (t.length < 4)
|
|
@@ -3380,44 +3510,44 @@ class U {
|
|
|
3380
3510
|
}
|
|
3381
3511
|
static createClosedCurve(t, s, e = "Chord") {
|
|
3382
3512
|
const i = this.createFitPointsForClosedCurve(t).map((r) => [r.x, r.y, r.z]);
|
|
3383
|
-
return
|
|
3513
|
+
return j.byPoints(i, s, e);
|
|
3384
3514
|
}
|
|
3385
3515
|
}
|
|
3386
|
-
class
|
|
3516
|
+
class J extends ot {
|
|
3387
3517
|
constructor(t, s, e, n, i, r) {
|
|
3388
3518
|
super();
|
|
3389
|
-
const
|
|
3519
|
+
const o = arguments.length;
|
|
3390
3520
|
if (this._degree = 3, this._closed = !1, Array.isArray(s)) {
|
|
3391
|
-
if (
|
|
3392
|
-
throw
|
|
3521
|
+
if (o < 2 || o > 5)
|
|
3522
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
3393
3523
|
this._controlPoints = t;
|
|
3394
|
-
let a,
|
|
3395
|
-
if (
|
|
3396
|
-
throw
|
|
3397
|
-
this._nurbsCurve =
|
|
3524
|
+
let a, h = 3, c = !1;
|
|
3525
|
+
if (o >= 3 && (Array.isArray(e) ? (a = e, o >= 4 && (h = n || 3), o >= 5 && (c = i)) : e !== void 0 && (h = e || 3, o >= 4 && (c = n))), e === void 0 && o >= 4 && (h = n || 3, o >= 5 && (c = i)), this._degree = h, this._closed = c, this._controlPoints.length < this._degree + 1)
|
|
3526
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
3527
|
+
this._nurbsCurve = j.byKnotsControlPointsWeights(
|
|
3398
3528
|
this._degree,
|
|
3399
3529
|
s,
|
|
3400
3530
|
this._controlPoints,
|
|
3401
3531
|
a
|
|
3402
3532
|
);
|
|
3403
3533
|
} else {
|
|
3404
|
-
if (
|
|
3405
|
-
throw
|
|
3406
|
-
this._fitPoints = t, this._knotParameterization = s,
|
|
3534
|
+
if (o < 2 || o > 6)
|
|
3535
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
3536
|
+
this._fitPoints = t, this._knotParameterization = s, o >= 3 && (this._degree = e || 3);
|
|
3407
3537
|
const a = typeof n == "boolean";
|
|
3408
|
-
|
|
3409
|
-
const
|
|
3410
|
-
if (this._fitPoints.length +
|
|
3411
|
-
throw
|
|
3538
|
+
o >= 4 && a && (this._closed = n), a ? (o >= 5 && (this._startTangent = i), o >= 6 && (this._endTangent = r)) : (o >= 4 && (this._startTangent = n), o >= 5 && (this._endTangent = i)), this._closed && (this._startTangent = void 0, this._endTangent = void 0);
|
|
3539
|
+
const h = (this._startTangent ? 1 : 0) + (this._endTangent ? 1 : 0);
|
|
3540
|
+
if (this._fitPoints.length + h < this._degree + 1)
|
|
3541
|
+
throw L.ILLEGAL_PARAMETERS;
|
|
3412
3542
|
if (this._closed)
|
|
3413
|
-
this._nurbsCurve =
|
|
3543
|
+
this._nurbsCurve = j.createClosedCurve(
|
|
3414
3544
|
this._fitPoints,
|
|
3415
3545
|
this._degree,
|
|
3416
3546
|
this._knotParameterization
|
|
3417
3547
|
);
|
|
3418
3548
|
else {
|
|
3419
3549
|
const c = this.toNurbsPoints(this._fitPoints);
|
|
3420
|
-
this._nurbsCurve =
|
|
3550
|
+
this._nurbsCurve = j.byPoints(
|
|
3421
3551
|
c,
|
|
3422
3552
|
this._degree,
|
|
3423
3553
|
this._knotParameterization,
|
|
@@ -3433,17 +3563,17 @@ class wt extends it {
|
|
|
3433
3563
|
buildCurve() {
|
|
3434
3564
|
if (this._fitPoints && this._knotParameterization) {
|
|
3435
3565
|
if (this._closed) {
|
|
3436
|
-
const t =
|
|
3566
|
+
const t = j.createFitPointsForClosedCurve(
|
|
3437
3567
|
this._fitPoints
|
|
3438
3568
|
), s = this.toNurbsPoints(t);
|
|
3439
|
-
this._nurbsCurve =
|
|
3569
|
+
this._nurbsCurve = j.byPoints(
|
|
3440
3570
|
s,
|
|
3441
3571
|
this._degree,
|
|
3442
3572
|
this._knotParameterization
|
|
3443
3573
|
);
|
|
3444
3574
|
} else {
|
|
3445
3575
|
const t = this.toNurbsPoints(this._fitPoints);
|
|
3446
|
-
this._nurbsCurve =
|
|
3576
|
+
this._nurbsCurve = j.byPoints(
|
|
3447
3577
|
t,
|
|
3448
3578
|
this._degree,
|
|
3449
3579
|
this._knotParameterization,
|
|
@@ -3456,10 +3586,10 @@ class wt extends it {
|
|
|
3456
3586
|
);
|
|
3457
3587
|
} else if (this._controlPoints)
|
|
3458
3588
|
if (this._closed) {
|
|
3459
|
-
const t =
|
|
3589
|
+
const t = j.createFitPointsForClosedCurve(
|
|
3460
3590
|
this._controlPoints
|
|
3461
3591
|
), s = this.toNurbsPoints(t);
|
|
3462
|
-
this._nurbsCurve =
|
|
3592
|
+
this._nurbsCurve = j.byPoints(
|
|
3463
3593
|
s,
|
|
3464
3594
|
this._degree,
|
|
3465
3595
|
this._knotParameterization
|
|
@@ -3468,7 +3598,7 @@ class wt extends it {
|
|
|
3468
3598
|
);
|
|
3469
3599
|
} else {
|
|
3470
3600
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.weights();
|
|
3471
|
-
this._nurbsCurve =
|
|
3601
|
+
this._nurbsCurve = j.byKnotsControlPointsWeights(
|
|
3472
3602
|
this._degree,
|
|
3473
3603
|
t,
|
|
3474
3604
|
this._controlPoints,
|
|
@@ -3508,11 +3638,11 @@ class wt extends it {
|
|
|
3508
3638
|
}
|
|
3509
3639
|
get startPoint() {
|
|
3510
3640
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
|
|
3511
|
-
return new
|
|
3641
|
+
return new w(n[0], n[1], n[2]);
|
|
3512
3642
|
}
|
|
3513
3643
|
get endPoint() {
|
|
3514
3644
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
|
|
3515
|
-
return new
|
|
3645
|
+
return new w(n[0], n[1], n[2]);
|
|
3516
3646
|
}
|
|
3517
3647
|
get length() {
|
|
3518
3648
|
return this._nurbsCurve.length();
|
|
@@ -3528,24 +3658,24 @@ class wt extends it {
|
|
|
3528
3658
|
return this._controlPoints[e];
|
|
3529
3659
|
}
|
|
3530
3660
|
getPoints(t = 100) {
|
|
3531
|
-
const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i],
|
|
3532
|
-
for (let
|
|
3533
|
-
const c =
|
|
3534
|
-
e.push(new
|
|
3661
|
+
const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), r = n[i], o = n[n.length - i - 1], a = (o - r) / (t - 1);
|
|
3662
|
+
for (let h = 0; h < t; h++) {
|
|
3663
|
+
const c = h === t - 1 ? o : r + h * a, l = s.point(c);
|
|
3664
|
+
e.push(new w(l[0], l[1], l[2]));
|
|
3535
3665
|
}
|
|
3536
3666
|
return e;
|
|
3537
3667
|
}
|
|
3538
3668
|
getCurvePoints(t, s) {
|
|
3539
3669
|
const e = [], n = t.knots(), i = t.degree(), r = n[i], a = (n[n.length - i - 1] - r) / (s - 1);
|
|
3540
|
-
for (let
|
|
3541
|
-
const c = r +
|
|
3670
|
+
for (let h = 0; h < s; h++) {
|
|
3671
|
+
const c = r + h * a;
|
|
3542
3672
|
e.push(t.point(c));
|
|
3543
3673
|
}
|
|
3544
3674
|
return e;
|
|
3545
3675
|
}
|
|
3546
3676
|
calculateBoundingBox() {
|
|
3547
3677
|
const t = this.getPoints(100);
|
|
3548
|
-
return new
|
|
3678
|
+
return new Y().setFromPoints(t);
|
|
3549
3679
|
}
|
|
3550
3680
|
get closed() {
|
|
3551
3681
|
return this._closed;
|
|
@@ -3554,6 +3684,25 @@ class wt extends it {
|
|
|
3554
3684
|
this.setClosed(t);
|
|
3555
3685
|
}
|
|
3556
3686
|
transform(t) {
|
|
3687
|
+
if (this._fitPoints && this._knotParameterization)
|
|
3688
|
+
this._fitPoints = this._fitPoints.map(
|
|
3689
|
+
(s) => new w(s).applyMatrix4(t)
|
|
3690
|
+
), this._startTangent && (this._startTangent = new w(
|
|
3691
|
+
this._startTangent
|
|
3692
|
+
).transformDirection(t)), this._endTangent && (this._endTangent = new w(this._endTangent).transformDirection(
|
|
3693
|
+
t
|
|
3694
|
+
)), this.buildCurve();
|
|
3695
|
+
else {
|
|
3696
|
+
const s = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
|
|
3697
|
+
this._controlPoints = this._controlPoints.map(
|
|
3698
|
+
(n) => new w(n).applyMatrix4(t)
|
|
3699
|
+
), this._nurbsCurve = j.byKnotsControlPointsWeights(
|
|
3700
|
+
this._degree,
|
|
3701
|
+
s,
|
|
3702
|
+
this._controlPoints,
|
|
3703
|
+
e.length > 0 ? e : void 0
|
|
3704
|
+
);
|
|
3705
|
+
}
|
|
3557
3706
|
return this._boundingBoxNeedsUpdate = !0, this;
|
|
3558
3707
|
}
|
|
3559
3708
|
toNurbsPoints(t) {
|
|
@@ -3576,77 +3725,77 @@ class wt extends it {
|
|
|
3576
3725
|
throw new Error(
|
|
3577
3726
|
`At least ${e + 1} points are required for a degree ${e} closed spline`
|
|
3578
3727
|
);
|
|
3579
|
-
return new
|
|
3728
|
+
return new J(t, s, e, !0);
|
|
3580
3729
|
}
|
|
3581
3730
|
}
|
|
3582
3731
|
export {
|
|
3583
|
-
|
|
3732
|
+
js as AcGeArea2d,
|
|
3584
3733
|
F as AcGeBox2d,
|
|
3585
|
-
|
|
3734
|
+
Y as AcGeBox3d,
|
|
3586
3735
|
Es as AcGeCatmullRomCurve3d,
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3736
|
+
Q as AcGeCircArc2d,
|
|
3737
|
+
At as AcGeCircArc3d,
|
|
3738
|
+
rt as AcGeCurve2d,
|
|
3739
|
+
W as AcGeEllipseArc2d,
|
|
3740
|
+
zt as AcGeEllipseArc3d,
|
|
3741
|
+
Lt as AcGeEuler,
|
|
3742
|
+
fs as AcGeGeometryUtil,
|
|
3743
|
+
Pt as AcGeLine2d,
|
|
3744
|
+
Mt as AcGeLine3d,
|
|
3596
3745
|
X as AcGeLoop2d,
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3746
|
+
M as AcGeMathUtil,
|
|
3747
|
+
it as AcGeMatrix2d,
|
|
3748
|
+
H as AcGeMatrix3d,
|
|
3749
|
+
j as AcGeNurbsCurve,
|
|
3750
|
+
St as AcGePlane,
|
|
3602
3751
|
C as AcGePoint2d,
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3752
|
+
w as AcGePoint3d,
|
|
3753
|
+
Vs as AcGePolyline2d,
|
|
3754
|
+
bt as AcGeQuaternion,
|
|
3606
3755
|
Ht as AcGeShape2d,
|
|
3607
|
-
|
|
3608
|
-
|
|
3756
|
+
J as AcGeSpline3d,
|
|
3757
|
+
Qt as AcGeTol,
|
|
3609
3758
|
B as AcGeVector2d,
|
|
3610
3759
|
p as AcGeVector3d,
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3760
|
+
Kt as DEFAULT_TOL,
|
|
3761
|
+
Xt as DEG2RAD,
|
|
3762
|
+
G as FLOAT_TOL,
|
|
3614
3763
|
Bs as ORIGIN_POINT_2D,
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3764
|
+
Ot as ORIGIN_POINT_3D,
|
|
3765
|
+
Dt as RAD2DEG,
|
|
3766
|
+
E as TAU,
|
|
3767
|
+
wt as basisFunction,
|
|
3768
|
+
ws as calculateCurveLength,
|
|
3620
3769
|
ms as ceilPowerOfTwo,
|
|
3621
|
-
|
|
3622
|
-
|
|
3770
|
+
Z as clamp,
|
|
3771
|
+
As as computeParameterValues,
|
|
3623
3772
|
es as damp,
|
|
3624
3773
|
ls as degToRad,
|
|
3625
3774
|
Yt as euclideanModulo,
|
|
3626
|
-
|
|
3775
|
+
ft as evaluateNurbsPoint,
|
|
3627
3776
|
xs as floorPowerOfTwo,
|
|
3628
3777
|
zs as generateAveragedKnots,
|
|
3629
|
-
|
|
3630
|
-
|
|
3778
|
+
Rs as generateChordKnots,
|
|
3779
|
+
Ns as generateSqrtChordKnots,
|
|
3631
3780
|
Jt as generateUUID,
|
|
3632
3781
|
ks as generateUniformKnots,
|
|
3633
3782
|
Zt as intPartLength,
|
|
3634
3783
|
Ts as interpolateControlPoints,
|
|
3635
|
-
|
|
3784
|
+
$t as interpolateNurbsCurve,
|
|
3636
3785
|
ss as inverseLerp,
|
|
3637
3786
|
gs as isBetween,
|
|
3638
3787
|
ys as isBetweenAngle,
|
|
3639
|
-
|
|
3788
|
+
Gt as isPointInPolygon,
|
|
3640
3789
|
ps as isPolygonIntersect,
|
|
3641
3790
|
ds as isPowerOfTwo,
|
|
3642
|
-
|
|
3791
|
+
vt as lerp,
|
|
3643
3792
|
ts as mapLinear,
|
|
3644
|
-
|
|
3793
|
+
pt as normalizeAngle,
|
|
3645
3794
|
ns as pingpong,
|
|
3646
3795
|
us as radToDeg,
|
|
3647
|
-
|
|
3796
|
+
hs as randFloat,
|
|
3648
3797
|
as as randFloatSpread,
|
|
3649
|
-
|
|
3798
|
+
os as randInt,
|
|
3650
3799
|
_s as relativeEps,
|
|
3651
3800
|
cs as seededRandom,
|
|
3652
3801
|
rs as smootherstep,
|