@mlightcad/geometry-engine 1.0.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/geometry-engine.js +296 -301
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/geometry/AcGeEllipseArc3d.d.ts +5 -0
- package/lib/geometry/AcGeEllipseArc3d.d.ts.map +1 -1
- package/lib/geometry/AcGeEllipseArc3d.js +18 -2
- package/lib/geometry/AcGeEllipseArc3d.js.map +1 -1
- package/lib/geometry/AcGeSpline3d.d.ts +5 -5
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
- package/lib/geometry/AcGeSpline3d.js +63 -46
- package/lib/geometry/AcGeSpline3d.js.map +1 -1
- package/package.json +2 -2
package/dist/geometry-engine.js
CHANGED
@@ -258,8 +258,8 @@ const k = [
|
|
258
258
|
"ff"
|
259
259
|
];
|
260
260
|
let St = 1234567;
|
261
|
-
const
|
262
|
-
function
|
261
|
+
const Lt = Math.PI / 180, Tt = 180 / Math.PI;
|
262
|
+
function Ot() {
|
263
263
|
const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
264
264
|
return (k[u & 255] + k[u >> 8 & 255] + k[u >> 16 & 255] + k[u >> 24 & 255] + "-" + k[t & 255] + k[t >> 8 & 255] + "-" + k[t >> 16 & 15 | 64] + k[t >> 24 & 255] + "-" + k[s & 63 | 128] + k[s >> 8 & 255] + "-" + k[s >> 16 & 255] + k[s >> 24 & 255] + k[e & 255] + k[e >> 8 & 255] + k[e >> 16 & 255] + k[e >> 24 & 255]).toLowerCase();
|
265
265
|
}
|
@@ -269,100 +269,100 @@ function j(u, t, s) {
|
|
269
269
|
function Vt(u, t) {
|
270
270
|
return (u % t + t) % t;
|
271
271
|
}
|
272
|
-
function
|
272
|
+
function Wt(u, t, s, e, n) {
|
273
273
|
return e + (u - t) * (n - e) / (s - t);
|
274
274
|
}
|
275
|
-
function
|
275
|
+
function Ht(u, t, s) {
|
276
276
|
return u !== t ? (s - u) / (t - u) : 0;
|
277
277
|
}
|
278
278
|
function Ut(u, t, s) {
|
279
279
|
return (1 - s) * u + s * t;
|
280
280
|
}
|
281
|
-
function
|
281
|
+
function $t(u, t, s, e) {
|
282
282
|
return Ut(u, t, 1 - Math.exp(-s * e));
|
283
283
|
}
|
284
|
-
function
|
284
|
+
function Jt(u, t = 1) {
|
285
285
|
return t - Math.abs(Vt(u, t * 2) - t);
|
286
286
|
}
|
287
|
-
function
|
287
|
+
function vt(u, t, s) {
|
288
288
|
return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * (3 - 2 * u));
|
289
289
|
}
|
290
|
-
function
|
290
|
+
function ts(u, t, s) {
|
291
291
|
return u <= t ? 0 : u >= s ? 1 : (u = (u - t) / (s - t), u * u * u * (u * (u * 6 - 15) + 10));
|
292
292
|
}
|
293
|
-
function
|
293
|
+
function ss(u, t) {
|
294
294
|
return u + Math.floor(Math.random() * (t - u + 1));
|
295
295
|
}
|
296
|
-
function
|
296
|
+
function es(u, t) {
|
297
297
|
return u + Math.random() * (t - u);
|
298
298
|
}
|
299
|
-
function
|
299
|
+
function ns(u) {
|
300
300
|
return u * (0.5 - Math.random());
|
301
301
|
}
|
302
|
-
function
|
302
|
+
function is(u) {
|
303
303
|
u !== void 0 && (St = u);
|
304
304
|
let t = St += 1831565813;
|
305
305
|
return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
|
306
306
|
}
|
307
|
-
function is(u) {
|
308
|
-
return u * Rt;
|
309
|
-
}
|
310
307
|
function rs(u) {
|
311
|
-
return u *
|
308
|
+
return u * Lt;
|
312
309
|
}
|
313
310
|
function hs(u) {
|
314
|
-
return
|
311
|
+
return u * Tt;
|
315
312
|
}
|
316
313
|
function os(u) {
|
317
|
-
return
|
314
|
+
return (u & u - 1) === 0 && u !== 0;
|
318
315
|
}
|
319
316
|
function as(u) {
|
317
|
+
return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
|
318
|
+
}
|
319
|
+
function cs(u) {
|
320
320
|
return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
|
321
321
|
}
|
322
322
|
function mt(u) {
|
323
323
|
const t = Math.PI * 2;
|
324
324
|
return (u % t + t) % t;
|
325
325
|
}
|
326
|
-
function
|
326
|
+
function ls(u, t, s) {
|
327
327
|
return u > t && u < s || u > s && u < t;
|
328
328
|
}
|
329
|
-
function
|
329
|
+
function us(u, t, s, e = !1) {
|
330
330
|
return u = mt(u), t = mt(t), s = mt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
|
331
331
|
}
|
332
332
|
function qt(u) {
|
333
333
|
return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
|
334
334
|
}
|
335
|
-
function
|
335
|
+
function ds(u, t = 1e-7) {
|
336
336
|
const s = qt(u);
|
337
337
|
return Math.max(Math.pow(10, s) * t, t);
|
338
338
|
}
|
339
|
-
const
|
340
|
-
DEG2RAD:
|
339
|
+
const S = {
|
340
|
+
DEG2RAD: Lt,
|
341
341
|
RAD2DEG: Tt,
|
342
|
-
generateUUID:
|
342
|
+
generateUUID: Ot,
|
343
343
|
clamp: j,
|
344
344
|
euclideanModulo: Vt,
|
345
|
-
mapLinear:
|
346
|
-
inverseLerp:
|
345
|
+
mapLinear: Wt,
|
346
|
+
inverseLerp: Ht,
|
347
347
|
lerp: Ut,
|
348
|
-
damp:
|
349
|
-
pingpong:
|
350
|
-
smoothstep:
|
351
|
-
smootherstep:
|
352
|
-
randInt:
|
353
|
-
randFloat:
|
354
|
-
randFloatSpread:
|
355
|
-
seededRandom:
|
356
|
-
degToRad:
|
357
|
-
radToDeg:
|
358
|
-
isPowerOfTwo:
|
359
|
-
ceilPowerOfTwo:
|
360
|
-
floorPowerOfTwo:
|
348
|
+
damp: $t,
|
349
|
+
pingpong: Jt,
|
350
|
+
smoothstep: vt,
|
351
|
+
smootherstep: ts,
|
352
|
+
randInt: ss,
|
353
|
+
randFloat: es,
|
354
|
+
randFloatSpread: ns,
|
355
|
+
seededRandom: is,
|
356
|
+
degToRad: rs,
|
357
|
+
radToDeg: hs,
|
358
|
+
isPowerOfTwo: os,
|
359
|
+
ceilPowerOfTwo: as,
|
360
|
+
floorPowerOfTwo: cs,
|
361
361
|
normalizeAngle: mt,
|
362
|
-
isBetween:
|
363
|
-
isBetweenAngle:
|
362
|
+
isBetween: ls,
|
363
|
+
isBetweenAngle: us,
|
364
364
|
intPartLength: qt,
|
365
|
-
relativeEps:
|
365
|
+
relativeEps: ds
|
366
366
|
}, W = class W {
|
367
367
|
/**
|
368
368
|
* Construct one vector by two numbers
|
@@ -851,8 +851,8 @@ const C = {
|
|
851
851
|
}
|
852
852
|
relativeEps(t = 1e-7) {
|
853
853
|
return Math.min(
|
854
|
-
|
855
|
-
|
854
|
+
S.relativeEps(this.x, t),
|
855
|
+
S.relativeEps(this.y, t)
|
856
856
|
);
|
857
857
|
}
|
858
858
|
*[Symbol.iterator]() {
|
@@ -954,8 +954,8 @@ const H = class H {
|
|
954
954
|
* @returns Return this matrix
|
955
955
|
*/
|
956
956
|
multiplyMatrices(t, s) {
|
957
|
-
const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[3], a = e[6], o = e[1], c = e[4], l = e[7],
|
958
|
-
return i[0] = h * g + r *
|
957
|
+
const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[3], a = e[6], o = e[1], c = e[4], l = e[7], m = e[2], d = e[5], x = e[8], g = n[0], p = n[3], _ = n[6], w = n[1], f = n[4], A = n[7], z = n[2], C = n[5], M = n[8];
|
958
|
+
return i[0] = h * g + r * w + a * z, i[3] = h * p + r * f + a * C, i[6] = h * _ + r * A + a * M, i[1] = o * g + c * w + l * z, i[4] = o * p + c * f + l * C, i[7] = o * _ + c * A + l * M, i[2] = m * g + d * w + x * z, i[5] = m * p + d * f + x * C, i[8] = m * _ + d * A + x * M, this;
|
959
959
|
}
|
960
960
|
/**
|
961
961
|
* Multiply every component of the matrix by the scalar value s.
|
@@ -980,10 +980,10 @@ const H = class H {
|
|
980
980
|
* @returns Return this matrix
|
981
981
|
*/
|
982
982
|
invert() {
|
983
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = c * h - r * o,
|
983
|
+
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = c * h - r * o, m = r * a - c * i, d = o * i - h * a, x = s * l + e * m + n * d;
|
984
984
|
if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
985
985
|
const g = 1 / x;
|
986
|
-
return t[0] = l * g, t[1] = (n * o - c * e) * g, t[2] = (r * e - n * h) * g, t[3] =
|
986
|
+
return t[0] = l * g, t[1] = (n * o - c * e) * g, t[2] = (r * e - n * h) * g, t[3] = m * g, t[4] = (c * s - n * a) * g, t[5] = (n * i - r * s) * g, t[6] = d * g, t[7] = (e * a - o * s) * g, t[8] = (h * s - e * i) * g, this;
|
987
987
|
}
|
988
988
|
/**
|
989
989
|
* Transpose this matrix in place.
|
@@ -1141,7 +1141,7 @@ const At = /* @__PURE__ */ new v(), Q = 1e-6, I = 2 * Math.PI, Ss = {
|
|
1141
1141
|
y: 0,
|
1142
1142
|
z: 0
|
1143
1143
|
};
|
1144
|
-
class
|
1144
|
+
class Ft {
|
1145
1145
|
/**
|
1146
1146
|
* Create tolerance class with default tolerance values
|
1147
1147
|
*/
|
@@ -1210,15 +1210,15 @@ class ds {
|
|
1210
1210
|
return t - s < e;
|
1211
1211
|
}
|
1212
1212
|
}
|
1213
|
-
const
|
1214
|
-
function
|
1213
|
+
const Xt = new Ft();
|
1214
|
+
function Dt(u, t, s = !1) {
|
1215
1215
|
const e = u.x, n = u.y;
|
1216
1216
|
let i = !1;
|
1217
1217
|
const h = t.length;
|
1218
1218
|
for (let r = 0, a = h - 1; r < h; a = r++) {
|
1219
|
-
const o = t[r].x, c = t[r].y, l = t[a].x,
|
1220
|
-
let
|
1221
|
-
s && (
|
1219
|
+
const o = t[r].x, c = t[r].y, l = t[a].x, m = t[a].y;
|
1220
|
+
let d = c > n != m > n;
|
1221
|
+
s && (d = c >= n != m >= n), d && e < (l - o) * (n - c) / (m - c) + o && (i = !i);
|
1222
1222
|
}
|
1223
1223
|
return i;
|
1224
1224
|
}
|
@@ -1229,14 +1229,14 @@ function ms(u, t) {
|
|
1229
1229
|
if (!s.intersectsBox(e))
|
1230
1230
|
return !1;
|
1231
1231
|
for (let n = 0; n < u.length; ) {
|
1232
|
-
if (
|
1232
|
+
if (Dt(u[n], t, !0))
|
1233
1233
|
return !0;
|
1234
|
-
n < u.length - 1 &&
|
1234
|
+
n < u.length - 1 && Xt.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
|
1235
1235
|
}
|
1236
1236
|
return !1;
|
1237
1237
|
}
|
1238
1238
|
const xs = {
|
1239
|
-
isPointInPolygon:
|
1239
|
+
isPointInPolygon: Dt,
|
1240
1240
|
isPolygonIntersect: ms
|
1241
1241
|
};
|
1242
1242
|
function ys(u, t) {
|
@@ -1271,8 +1271,8 @@ function _s(u, t) {
|
|
1271
1271
|
const s = t.length - 1, e = u, n = [0];
|
1272
1272
|
let i = 0;
|
1273
1273
|
for (let r = 1; r <= s; r++) {
|
1274
|
-
const a = t[r][0] - t[r - 1][0], o = t[r][1] - t[r - 1][1], c = t[r][2] - t[r - 1][2], l = Math.sqrt(a * a + o * o + c * c),
|
1275
|
-
i +=
|
1274
|
+
const a = t[r][0] - t[r - 1][0], o = t[r][1] - t[r - 1][1], c = t[r][2] - t[r - 1][2], l = Math.sqrt(a * a + o * o + c * c), m = Math.sqrt(l);
|
1275
|
+
i += m, n.push(i);
|
1276
1276
|
}
|
1277
1277
|
const h = [];
|
1278
1278
|
for (let r = 0; r <= e; r++)
|
@@ -1324,8 +1324,8 @@ function ps(u, t, s, e) {
|
|
1324
1324
|
e
|
1325
1325
|
);
|
1326
1326
|
for (let g = 1; g <= a; g++) {
|
1327
|
-
const p = i + g * o, _ = xt(p, u, t, s, e),
|
1328
|
-
r += Math.sqrt(
|
1327
|
+
const p = i + g * o, _ = xt(p, u, t, s, e), w = _[0] - c[0], f = _[1] - c[1], A = _[2] - c[2];
|
1328
|
+
r += Math.sqrt(w * w + f * f + A * A), c = _;
|
1329
1329
|
}
|
1330
1330
|
const l = xt(
|
1331
1331
|
h,
|
@@ -1333,10 +1333,10 @@ function ps(u, t, s, e) {
|
|
1333
1333
|
t,
|
1334
1334
|
s,
|
1335
1335
|
e
|
1336
|
-
),
|
1337
|
-
return r += Math.sqrt(
|
1336
|
+
), m = l[0] - c[0], d = l[1] - c[1], x = l[2] - c[2];
|
1337
|
+
return r += Math.sqrt(m * m + d * d + x * x), r;
|
1338
1338
|
}
|
1339
|
-
function
|
1339
|
+
function Ms(u) {
|
1340
1340
|
return u.map((t) => [...t]);
|
1341
1341
|
}
|
1342
1342
|
class pt {
|
@@ -1362,26 +1362,26 @@ class pt {
|
|
1362
1362
|
*/
|
1363
1363
|
static slerpFlat(t, s, e, n, i, h, r) {
|
1364
1364
|
let a = e[n + 0], o = e[n + 1], c = e[n + 2], l = e[n + 3];
|
1365
|
-
const
|
1365
|
+
const m = i[h + 0], d = i[h + 1], x = i[h + 2], g = i[h + 3];
|
1366
1366
|
if (r === 0) {
|
1367
1367
|
t[s + 0] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
|
1368
1368
|
return;
|
1369
1369
|
}
|
1370
1370
|
if (r === 1) {
|
1371
|
-
t[s + 0] =
|
1371
|
+
t[s + 0] = m, t[s + 1] = d, t[s + 2] = x, t[s + 3] = g;
|
1372
1372
|
return;
|
1373
1373
|
}
|
1374
|
-
if (l !== g || a !==
|
1374
|
+
if (l !== g || a !== m || o !== d || c !== x) {
|
1375
1375
|
let p = 1 - r;
|
1376
|
-
const _ = a *
|
1377
|
-
if (
|
1378
|
-
const
|
1379
|
-
p = Math.sin(p *
|
1376
|
+
const _ = a * m + o * d + c * x + l * g, w = _ >= 0 ? 1 : -1, f = 1 - _ * _;
|
1377
|
+
if (f > Number.EPSILON) {
|
1378
|
+
const z = Math.sqrt(f), C = Math.atan2(z, _ * w);
|
1379
|
+
p = Math.sin(p * C) / z, r = Math.sin(r * C) / z;
|
1380
1380
|
}
|
1381
|
-
const A = r *
|
1382
|
-
if (a = a * p +
|
1383
|
-
const
|
1384
|
-
a *=
|
1381
|
+
const A = r * w;
|
1382
|
+
if (a = a * p + m * A, o = o * p + d * A, c = c * p + x * A, l = l * p + g * A, p === 1 - r) {
|
1383
|
+
const z = 1 / Math.sqrt(a * a + o * o + c * c + l * l);
|
1384
|
+
a *= z, o *= z, c *= z, l *= z;
|
1385
1385
|
}
|
1386
1386
|
}
|
1387
1387
|
t[s] = a, t[s + 1] = o, t[s + 2] = c, t[s + 3] = l;
|
@@ -1397,8 +1397,8 @@ class pt {
|
|
1397
1397
|
* @returns Return an array
|
1398
1398
|
*/
|
1399
1399
|
static multiplyQuaternionsFlat(t, s, e, n, i, h) {
|
1400
|
-
const r = e[n], a = e[n + 1], o = e[n + 2], c = e[n + 3], l = i[h],
|
1401
|
-
return t[s] = r * x + c * l + a *
|
1400
|
+
const r = e[n], a = e[n + 1], o = e[n + 2], c = e[n + 3], l = i[h], m = i[h + 1], d = i[h + 2], x = i[h + 3];
|
1401
|
+
return t[s] = r * x + c * l + a * d - o * m, t[s + 1] = a * x + c * m + o * l - r * d, t[s + 2] = o * x + c * d + r * m - a * l, t[s + 3] = c * x - r * l - a * m - o * d, t;
|
1402
1402
|
}
|
1403
1403
|
/**
|
1404
1404
|
* X cooridinate
|
@@ -1469,25 +1469,25 @@ class pt {
|
|
1469
1469
|
* @returns Return this quaternion
|
1470
1470
|
*/
|
1471
1471
|
setFromEuler(t, s = !0) {
|
1472
|
-
const e = t.x, n = t.y, i = t.z, h = t.order, r = Math.cos, a = Math.sin, o = r(e / 2), c = r(n / 2), l = r(i / 2),
|
1472
|
+
const e = t.x, n = t.y, i = t.z, h = t.order, r = Math.cos, a = Math.sin, o = r(e / 2), c = r(n / 2), l = r(i / 2), m = a(e / 2), d = a(n / 2), x = a(i / 2);
|
1473
1473
|
switch (h) {
|
1474
1474
|
case "XYZ":
|
1475
|
-
this._x =
|
1475
|
+
this._x = m * c * l + o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l - m * d * x;
|
1476
1476
|
break;
|
1477
1477
|
case "YXZ":
|
1478
|
-
this._x =
|
1478
|
+
this._x = m * c * l + o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l + m * d * x;
|
1479
1479
|
break;
|
1480
1480
|
case "ZXY":
|
1481
|
-
this._x =
|
1481
|
+
this._x = m * c * l - o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l - m * d * x;
|
1482
1482
|
break;
|
1483
1483
|
case "ZYX":
|
1484
|
-
this._x =
|
1484
|
+
this._x = m * c * l - o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l + m * d * x;
|
1485
1485
|
break;
|
1486
1486
|
case "YZX":
|
1487
|
-
this._x =
|
1487
|
+
this._x = m * c * l + o * d * x, this._y = o * d * l + m * c * x, this._z = o * c * x - m * d * l, this._w = o * c * l - m * d * x;
|
1488
1488
|
break;
|
1489
1489
|
case "XZY":
|
1490
|
-
this._x =
|
1490
|
+
this._x = m * c * l - o * d * x, this._y = o * d * l - m * c * x, this._z = o * c * x + m * d * l, this._w = o * c * l + m * d * x;
|
1491
1491
|
break;
|
1492
1492
|
default:
|
1493
1493
|
console.warn(
|
@@ -1513,19 +1513,19 @@ class pt {
|
|
1513
1513
|
* @returns Return this quaternion
|
1514
1514
|
*/
|
1515
1515
|
setFromRotationMatrix(t) {
|
1516
|
-
const s = t.elements, e = s[0], n = s[4], i = s[8], h = s[1], r = s[5], a = s[9], o = s[2], c = s[6], l = s[10],
|
1517
|
-
if (
|
1518
|
-
const
|
1519
|
-
this._w = 0.25 /
|
1516
|
+
const s = t.elements, e = s[0], n = s[4], i = s[8], h = s[1], r = s[5], a = s[9], o = s[2], c = s[6], l = s[10], m = e + r + l;
|
1517
|
+
if (m > 0) {
|
1518
|
+
const d = 0.5 / Math.sqrt(m + 1);
|
1519
|
+
this._w = 0.25 / d, this._x = (c - a) * d, this._y = (i - o) * d, this._z = (h - n) * d;
|
1520
1520
|
} else if (e > r && e > l) {
|
1521
|
-
const
|
1522
|
-
this._w = (c - a) /
|
1521
|
+
const d = 2 * Math.sqrt(1 + e - r - l);
|
1522
|
+
this._w = (c - a) / d, this._x = 0.25 * d, this._y = (n + h) / d, this._z = (i + o) / d;
|
1523
1523
|
} else if (r > l) {
|
1524
|
-
const
|
1525
|
-
this._w = (i - o) /
|
1524
|
+
const d = 2 * Math.sqrt(1 + r - e - l);
|
1525
|
+
this._w = (i - o) / d, this._x = (n + h) / d, this._y = 0.25 * d, this._z = (a + c) / d;
|
1526
1526
|
} else {
|
1527
|
-
const
|
1528
|
-
this._w = (h - n) /
|
1527
|
+
const d = 2 * Math.sqrt(1 + l - e - r);
|
1528
|
+
this._w = (h - n) / d, this._x = (i + o) / d, this._y = (a + c) / d, this._z = 0.25 * d;
|
1529
1529
|
}
|
1530
1530
|
return this._onChangeCallback(), this;
|
1531
1531
|
}
|
@@ -1661,11 +1661,11 @@ class pt {
|
|
1661
1661
|
return this._w = h, this._x = e, this._y = n, this._z = i, this;
|
1662
1662
|
const a = 1 - r * r;
|
1663
1663
|
if (a <= Number.EPSILON) {
|
1664
|
-
const
|
1665
|
-
return this._w =
|
1664
|
+
const d = 1 - s;
|
1665
|
+
return this._w = d * h + s * this._w, this._x = d * e + s * this._x, this._y = d * n + s * this._y, this._z = d * i + s * this._z, this.normalize(), this;
|
1666
1666
|
}
|
1667
|
-
const o = Math.sqrt(a), c = Math.atan2(o, r), l = Math.sin((1 - s) * c) / o,
|
1668
|
-
return this._w = h * l + this._w *
|
1667
|
+
const o = Math.sqrt(a), c = Math.atan2(o, r), l = Math.sin((1 - s) * c) / o, m = Math.sin(s * c) / o;
|
1668
|
+
return this._w = h * l + this._w * m, this._x = e * l + this._x * m, this._y = n * l + this._y * m, this._z = i * l + this._z * m, this._onChangeCallback(), this;
|
1669
1669
|
}
|
1670
1670
|
/**
|
1671
1671
|
* Perform a spherical linear interpolation between the given quaternions and stores the result in
|
@@ -2223,7 +2223,7 @@ const N = class N {
|
|
2223
2223
|
* @returns Return this vector
|
2224
2224
|
*/
|
2225
2225
|
projectOnPlane(t) {
|
2226
|
-
return
|
2226
|
+
return ft.copy(this).projectOnVector(t), this.sub(ft);
|
2227
2227
|
}
|
2228
2228
|
/**
|
2229
2229
|
* Reflect this vector off of plane orthogonal to normal. Normal is assumed to have unit length.
|
@@ -2231,7 +2231,7 @@ const N = class N {
|
|
2231
2231
|
* @returns Return this vector
|
2232
2232
|
*/
|
2233
2233
|
reflect(t) {
|
2234
|
-
return this.sub(
|
2234
|
+
return this.sub(ft.copy(t).multiplyScalar(2 * this.dot(t)));
|
2235
2235
|
}
|
2236
2236
|
/**
|
2237
2237
|
* Return the angle between this vector and vector v in radians.
|
@@ -2374,7 +2374,7 @@ const N = class N {
|
|
2374
2374
|
};
|
2375
2375
|
N.X_AXIS = Object.freeze(new N(1, 0, 0)), N.NEGATIVE_X_AXIS = Object.freeze(new N(-1, 0, 0)), N.Y_AXIS = Object.freeze(new N(0, 1, 0)), N.NEGATIVE_Y_AXIS = Object.freeze(new N(0, -1, 0)), N.Z_AXIS = Object.freeze(new N(0, 0, 1)), N.NEGATIVE_Z_AXIS = Object.freeze(new N(0, 0, -1));
|
2376
2376
|
let y = N;
|
2377
|
-
const
|
2377
|
+
const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
2378
2378
|
/**
|
2379
2379
|
* Create a 4x4 matrix with the given arguments in row-major order. If no arguments are provided,
|
2380
2380
|
* the constructor initializes the Matrix4 to the 4x4 identity matrix.
|
@@ -2396,8 +2396,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2396
2396
|
* @param n43 Input element in the forth row and the third column
|
2397
2397
|
* @param n44 Input element in the forth row and the forth column
|
2398
2398
|
*/
|
2399
|
-
constructor(t, s, e, n, i, h, r, a, o, c, l,
|
2400
|
-
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && h != null && r != null && a != null && o != null && c != null && l != null &&
|
2399
|
+
constructor(t, s, e, n, i, h, r, a, o, c, l, m, d, x, g, p) {
|
2400
|
+
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], t != null && s != null && e != null && n != null && i != null && h != null && r != null && a != null && o != null && c != null && l != null && m != null && d != null && x != null && g != null && p != null && this.set(
|
2401
2401
|
t,
|
2402
2402
|
s,
|
2403
2403
|
e,
|
@@ -2409,8 +2409,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2409
2409
|
o,
|
2410
2410
|
c,
|
2411
2411
|
l,
|
2412
|
-
d,
|
2413
2412
|
m,
|
2413
|
+
d,
|
2414
2414
|
x,
|
2415
2415
|
g,
|
2416
2416
|
p
|
@@ -2437,9 +2437,9 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2437
2437
|
* @param n44 Input element in the forth row and the forth column
|
2438
2438
|
* @returns Return this matrix
|
2439
2439
|
*/
|
2440
|
-
set(t, s, e, n, i, h, r, a, o, c, l,
|
2440
|
+
set(t, s, e, n, i, h, r, a, o, c, l, m, d, x, g, p) {
|
2441
2441
|
const _ = this.elements;
|
2442
|
-
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = h, _[9] = r, _[13] = a, _[2] = o, _[6] = c, _[10] = l, _[14] =
|
2442
|
+
return _[0] = t, _[4] = s, _[8] = e, _[12] = n, _[1] = i, _[5] = h, _[9] = r, _[13] = a, _[2] = o, _[6] = c, _[10] = l, _[14] = m, _[3] = d, _[7] = x, _[11] = g, _[15] = p, this;
|
2443
2443
|
}
|
2444
2444
|
/**
|
2445
2445
|
* Reset this matrix to the identity matrix.
|
@@ -2501,7 +2501,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2501
2501
|
* @returns Return this matrix
|
2502
2502
|
*/
|
2503
2503
|
setFromExtrusionDirection(t) {
|
2504
|
-
if (
|
2504
|
+
if (Xt.equalPoint3d(t, y.Z_AXIS))
|
2505
2505
|
this.identity();
|
2506
2506
|
else {
|
2507
2507
|
const s = new y(1, 0, 0);
|
@@ -2687,7 +2687,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2687
2687
|
* @returns Return this matrix
|
2688
2688
|
*/
|
2689
2689
|
makeRotationFromQuaternion(t) {
|
2690
|
-
return this.compose(
|
2690
|
+
return this.compose(zs, t, As);
|
2691
2691
|
}
|
2692
2692
|
/**
|
2693
2693
|
* Construct a rotation matrix, looking from eye towards target oriented by the up vector.
|
@@ -2698,7 +2698,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2698
2698
|
*/
|
2699
2699
|
lookAt(t, s, e) {
|
2700
2700
|
const n = this.elements;
|
2701
|
-
return
|
2701
|
+
return R.subVectors(t, s), R.lengthSq() === 0 && (R.z = 1), R.normalize(), q.crossVectors(e, R), q.lengthSq() === 0 && (Math.abs(e.z) === 1 ? R.x += 1e-4 : R.z += 1e-4, R.normalize(), q.crossVectors(e, R)), q.normalize(), ut.crossVectors(R, q), n[0] = q.x, n[4] = ut.x, n[8] = R.x, n[1] = q.y, n[5] = ut.y, n[9] = R.y, n[2] = q.z, n[6] = ut.z, n[10] = R.z, this;
|
2702
2702
|
}
|
2703
2703
|
/**
|
2704
2704
|
* Post-multiply this matrix by m.
|
@@ -2723,8 +2723,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2723
2723
|
* @returns Return this matrix
|
2724
2724
|
*/
|
2725
2725
|
multiplyMatrices(t, s) {
|
2726
|
-
const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[4], a = e[8], o = e[12], c = e[1], l = e[5],
|
2727
|
-
return i[0] = h *
|
2726
|
+
const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[4], a = e[8], o = e[12], c = e[1], l = e[5], m = e[9], d = e[13], x = e[2], g = e[6], p = e[10], _ = e[14], w = e[3], f = e[7], A = e[11], z = e[15], C = n[0], M = n[4], E = n[8], Z = n[12], G = n[1], F = n[5], K = n[9], et = n[13], nt = n[2], it = n[6], rt = n[10], ht = n[14], ot = n[3], at = n[7], ct = n[11], lt = n[15];
|
2727
|
+
return i[0] = h * C + r * G + a * nt + o * ot, i[4] = h * M + r * F + a * it + o * at, i[8] = h * E + r * K + a * rt + o * ct, i[12] = h * Z + r * et + a * ht + o * lt, i[1] = c * C + l * G + m * nt + d * ot, i[5] = c * M + l * F + m * it + d * at, i[9] = c * E + l * K + m * rt + d * ct, i[13] = c * Z + l * et + m * ht + d * lt, i[2] = x * C + g * G + p * nt + _ * ot, i[6] = x * M + g * F + p * it + _ * at, i[10] = x * E + g * K + p * rt + _ * ct, i[14] = x * Z + g * et + p * ht + _ * lt, i[3] = w * C + f * G + A * nt + z * ot, i[7] = w * M + f * F + A * it + z * at, i[11] = w * E + f * K + A * rt + z * ct, i[15] = w * Z + f * et + A * ht + z * lt, this;
|
2728
2728
|
}
|
2729
2729
|
/**
|
2730
2730
|
* Multiply every component of the matrix by a scalar value s.
|
@@ -2740,8 +2740,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2740
2740
|
* @returns Return the determinant of this matrix.
|
2741
2741
|
*/
|
2742
2742
|
determinant() {
|
2743
|
-
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], h = t[1], r = t[5], a = t[9], o = t[13], c = t[2], l = t[6],
|
2744
|
-
return x * (+i * a * l - n * o * l - i * r *
|
2743
|
+
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], h = t[1], r = t[5], a = t[9], o = t[13], c = t[2], l = t[6], m = t[10], d = t[14], x = t[3], g = t[7], p = t[11], _ = t[15];
|
2744
|
+
return x * (+i * a * l - n * o * l - i * r * m + e * o * m + n * r * d - e * a * d) + g * (+s * a * d - s * o * m + i * h * m - n * h * d + n * o * c - i * a * c) + p * (+s * o * l - s * r * d - i * h * l + e * h * d + i * r * c - e * o * c) + _ * (-n * r * c - s * a * l + s * r * m + n * h * l - e * h * m + e * a * c);
|
2745
2745
|
}
|
2746
2746
|
/**
|
2747
2747
|
* Transposes this matrix.
|
@@ -2769,11 +2769,11 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2769
2769
|
* @returns Return this matrix
|
2770
2770
|
*/
|
2771
2771
|
invert() {
|
2772
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = t[9],
|
2773
|
-
if (
|
2772
|
+
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], h = t[4], r = t[5], a = t[6], o = t[7], c = t[8], l = t[9], m = t[10], d = t[11], x = t[12], g = t[13], p = t[14], _ = t[15], w = l * p * o - g * m * o + g * a * d - r * p * d - l * a * _ + r * m * _, f = x * m * o - c * p * o - x * a * d + h * p * d + c * a * _ - h * m * _, A = c * g * o - x * l * o + x * r * d - h * g * d - c * r * _ + h * l * _, z = x * l * a - c * g * a - x * r * m + h * g * m + c * r * p - h * l * p, C = s * w + e * f + n * A + i * z;
|
2773
|
+
if (C === 0)
|
2774
2774
|
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
2775
|
-
const
|
2776
|
-
return t[0] =
|
2775
|
+
const M = 1 / C;
|
2776
|
+
return t[0] = w * M, t[1] = (g * m * i - l * p * i - g * n * d + e * p * d + l * n * _ - e * m * _) * M, t[2] = (r * p * i - g * a * i + g * n * o - e * p * o - r * n * _ + e * a * _) * M, t[3] = (l * a * i - r * m * i - l * n * o + e * m * o + r * n * d - e * a * d) * M, t[4] = f * M, t[5] = (c * p * i - x * m * i + x * n * d - s * p * d - c * n * _ + s * m * _) * M, t[6] = (x * a * i - h * p * i - x * n * o + s * p * o + h * n * _ - s * a * _) * M, t[7] = (h * m * i - c * a * i + c * n * o - s * m * o - h * n * d + s * a * d) * M, t[8] = A * M, t[9] = (x * l * i - c * g * i - x * e * d + s * g * d + c * e * _ - s * l * _) * M, t[10] = (h * g * i - x * r * i + x * e * o - s * g * o - h * e * _ + s * r * _) * M, t[11] = (c * r * i - h * l * i - c * e * o + s * l * o + h * e * d - s * r * d) * M, t[12] = z * M, t[13] = (c * g * n - x * l * n + x * e * m - s * g * m - c * e * p + s * l * p) * M, t[14] = (x * r * n - h * g * n - x * e * a + s * g * a + h * e * p - s * r * p) * M, t[15] = (h * l * n - c * r * n + c * e * a - s * l * a - h * e * m + s * r * m) * M, this;
|
2777
2777
|
}
|
2778
2778
|
/**
|
2779
2779
|
* Multiply the columns of this matrix by vector v.
|
@@ -2887,8 +2887,8 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2887
2887
|
* @returns Return this matrix
|
2888
2888
|
*/
|
2889
2889
|
compose(t, s, e) {
|
2890
|
-
const n = this.elements, i = s.x, h = s.y, r = s.z, a = s.w, o = i + i, c = h + h, l = r + r,
|
2891
|
-
return n[0] = (1 - (g + _)) *
|
2890
|
+
const n = this.elements, i = s.x, h = s.y, r = s.z, a = s.w, o = i + i, c = h + h, l = r + r, m = i * o, d = i * c, x = i * l, g = h * c, p = h * l, _ = r * l, w = a * o, f = a * c, A = a * l, z = e.x, C = e.y, M = e.z;
|
2891
|
+
return n[0] = (1 - (g + _)) * z, n[1] = (d + A) * z, n[2] = (x - f) * z, n[3] = 0, n[4] = (d - A) * C, n[5] = (1 - (m + _)) * C, n[6] = (p + w) * C, n[7] = 0, n[8] = (x + f) * M, n[9] = (p - w) * M, n[10] = (1 - (m + g)) * M, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this;
|
2892
2892
|
}
|
2893
2893
|
/**
|
2894
2894
|
* Decompose this matrix into its position, quaternion and scale components.
|
@@ -2905,9 +2905,9 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2905
2905
|
const n = this.elements;
|
2906
2906
|
let i = O.set(n[0], n[1], n[2]).length();
|
2907
2907
|
const h = O.set(n[4], n[5], n[6]).length(), r = O.set(n[8], n[9], n[10]).length();
|
2908
|
-
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14],
|
2908
|
+
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14], L.copy(this);
|
2909
2909
|
const o = 1 / i, c = 1 / h, l = 1 / r;
|
2910
|
-
return
|
2910
|
+
return L.elements[0] *= o, L.elements[1] *= o, L.elements[2] *= o, L.elements[4] *= c, L.elements[5] *= c, L.elements[6] *= c, L.elements[8] *= l, L.elements[9] *= l, L.elements[10] *= l, s.setFromRotationMatrix(L), e.x = i, e.y = h, e.z = r, this;
|
2911
2911
|
}
|
2912
2912
|
// makePerspective(
|
2913
2913
|
// left,
|
@@ -3035,7 +3035,7 @@ const wt = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
3035
3035
|
};
|
3036
3036
|
$.IDENTITY = Object.freeze(new $());
|
3037
3037
|
let tt = $;
|
3038
|
-
const O = /* @__PURE__ */ new y(),
|
3038
|
+
const O = /* @__PURE__ */ new y(), L = /* @__PURE__ */ new tt(), zs = /* @__PURE__ */ new y(0, 0, 0), As = /* @__PURE__ */ new y(1, 1, 1), q = /* @__PURE__ */ new y(), ut = /* @__PURE__ */ new y(), R = /* @__PURE__ */ new y();
|
3039
3039
|
class Y {
|
3040
3040
|
/**
|
3041
3041
|
* Create a 3d box bounded by min and max.
|
@@ -3065,7 +3065,7 @@ class Y {
|
|
3065
3065
|
setFromArray(t) {
|
3066
3066
|
this.makeEmpty();
|
3067
3067
|
for (let s = 0, e = t.length; s < e; s += 3)
|
3068
|
-
this.expandByPoint(
|
3068
|
+
this.expandByPoint(wt.fromArray(t, s));
|
3069
3069
|
return this;
|
3070
3070
|
}
|
3071
3071
|
/**
|
@@ -3086,7 +3086,7 @@ class Y {
|
|
3086
3086
|
* @returns Return this box
|
3087
3087
|
*/
|
3088
3088
|
setFromCenterAndSize(t, s) {
|
3089
|
-
const e =
|
3089
|
+
const e = wt.copy(s).multiplyScalar(0.5);
|
3090
3090
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
3091
3091
|
}
|
3092
3092
|
/**
|
@@ -3237,7 +3237,7 @@ class Y {
|
|
3237
3237
|
* @returns Return the distance from any edge of this box to the specified point.
|
3238
3238
|
*/
|
3239
3239
|
distanceToPoint(t) {
|
3240
|
-
return this.clampPoint(t,
|
3240
|
+
return this.clampPoint(t, wt).distanceTo(t);
|
3241
3241
|
}
|
3242
3242
|
/**
|
3243
3243
|
* Compute the intersection of this and box, setting the upper bound of this box to the lesser of the
|
@@ -3293,7 +3293,7 @@ const U = [
|
|
3293
3293
|
/* @__PURE__ */ new y(),
|
3294
3294
|
/* @__PURE__ */ new y(),
|
3295
3295
|
/* @__PURE__ */ new y()
|
3296
|
-
],
|
3296
|
+
], wt = /* @__PURE__ */ new y(), Bt = /* @__PURE__ */ new P();
|
3297
3297
|
class V {
|
3298
3298
|
/**
|
3299
3299
|
* Create a 2d box bounded by min and max.
|
@@ -3511,8 +3511,8 @@ class V {
|
|
3511
3511
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
3512
3512
|
}
|
3513
3513
|
}
|
3514
|
-
const It = /* @__PURE__ */ new y(),
|
3515
|
-
class
|
3514
|
+
const It = /* @__PURE__ */ new y(), fs = /* @__PURE__ */ new y(), ws = /* @__PURE__ */ new v();
|
3515
|
+
class Mt {
|
3516
3516
|
/**
|
3517
3517
|
* Create one plane
|
3518
3518
|
* @param normal (optional) Input a unit length Vector3 defining the normal of the plane.
|
@@ -3560,7 +3560,7 @@ class zt {
|
|
3560
3560
|
* @returns Return this plane
|
3561
3561
|
*/
|
3562
3562
|
setFromCoplanarPoints(t, s, e) {
|
3563
|
-
const n = It.subVectors(e, s).cross(
|
3563
|
+
const n = It.subVectors(e, s).cross(fs.subVectors(t, s)).normalize();
|
3564
3564
|
return this.setFromNormalAndCoplanarPoint(n, t), this;
|
3565
3565
|
}
|
3566
3566
|
/**
|
@@ -3662,7 +3662,7 @@ class zt {
|
|
3662
3662
|
* @returns Return this plane
|
3663
3663
|
*/
|
3664
3664
|
applyMatrix4(t, s) {
|
3665
|
-
const e = s ||
|
3665
|
+
const e = s || ws.getNormalMatrix(t), n = this.coplanarPoint(It).applyMatrix3d(t), i = this.normal.applyMatrix3(e).normalize();
|
3666
3666
|
return this.constant = -n.dot(i), this;
|
3667
3667
|
}
|
3668
3668
|
/**
|
@@ -3687,7 +3687,7 @@ class zt {
|
|
3687
3687
|
* @returns Return the cloned plane
|
3688
3688
|
*/
|
3689
3689
|
clone() {
|
3690
|
-
return new
|
3690
|
+
return new Mt().copy(this);
|
3691
3691
|
}
|
3692
3692
|
}
|
3693
3693
|
class b extends P {
|
@@ -3703,7 +3703,7 @@ class b extends P {
|
|
3703
3703
|
}), s;
|
3704
3704
|
}
|
3705
3705
|
}
|
3706
|
-
class
|
3706
|
+
class B extends y {
|
3707
3707
|
/**
|
3708
3708
|
* Convert one point array to one number array
|
3709
3709
|
* @param array Input one point array
|
@@ -3809,25 +3809,25 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
|
|
3809
3809
|
* @returns Return this euler
|
3810
3810
|
*/
|
3811
3811
|
setFromRotationMatrix(t, s = this._order, e = !0) {
|
3812
|
-
const n = t.elements, i = n[0], h = n[4], r = n[8], a = n[1], o = n[5], c = n[9], l = n[2],
|
3812
|
+
const n = t.elements, i = n[0], h = n[4], r = n[8], a = n[1], o = n[5], c = n[9], l = n[2], m = n[6], d = n[10];
|
3813
3813
|
switch (s) {
|
3814
3814
|
case "XYZ":
|
3815
|
-
this._y = Math.asin(j(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(-c,
|
3815
|
+
this._y = Math.asin(j(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(-c, d), this._z = Math.atan2(-h, i)) : (this._x = Math.atan2(m, o), this._z = 0);
|
3816
3816
|
break;
|
3817
3817
|
case "YXZ":
|
3818
|
-
this._x = Math.asin(-j(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(r,
|
3818
|
+
this._x = Math.asin(-j(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(r, d), this._z = Math.atan2(a, o)) : (this._y = Math.atan2(-l, i), this._z = 0);
|
3819
3819
|
break;
|
3820
3820
|
case "ZXY":
|
3821
|
-
this._x = Math.asin(j(
|
3821
|
+
this._x = Math.asin(j(m, -1, 1)), Math.abs(m) < 0.9999999 ? (this._y = Math.atan2(-l, d), this._z = Math.atan2(-h, o)) : (this._y = 0, this._z = Math.atan2(a, i));
|
3822
3822
|
break;
|
3823
3823
|
case "ZYX":
|
3824
|
-
this._y = Math.asin(-j(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(
|
3824
|
+
this._y = Math.asin(-j(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(m, d), this._z = Math.atan2(a, i)) : (this._x = 0, this._z = Math.atan2(-h, o));
|
3825
3825
|
break;
|
3826
3826
|
case "YZX":
|
3827
|
-
this._z = Math.asin(j(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, o), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(r,
|
3827
|
+
this._z = Math.asin(j(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-c, o), this._y = Math.atan2(-l, i)) : (this._x = 0, this._y = Math.atan2(r, d));
|
3828
3828
|
break;
|
3829
3829
|
case "XZY":
|
3830
|
-
this._z = Math.asin(-j(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(
|
3830
|
+
this._z = Math.asin(-j(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(m, o), this._y = Math.atan2(r, i)) : (this._x = Math.atan2(-c, d), this._y = 0);
|
3831
3831
|
break;
|
3832
3832
|
default:
|
3833
3833
|
console.warn(
|
@@ -3911,7 +3911,7 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
|
|
3911
3911
|
};
|
3912
3912
|
J.DEFAULT_ORDER = "XYZ";
|
3913
3913
|
let Nt = J;
|
3914
|
-
class
|
3914
|
+
class Yt {
|
3915
3915
|
constructor() {
|
3916
3916
|
this._boundingBoxNeedsUpdate = !1;
|
3917
3917
|
}
|
@@ -3923,7 +3923,7 @@ class Dt {
|
|
3923
3923
|
return this._boundingBoxNeedsUpdate;
|
3924
3924
|
}
|
3925
3925
|
}
|
3926
|
-
class
|
3926
|
+
class Zt extends Yt {
|
3927
3927
|
/**
|
3928
3928
|
* Return new shape translated by given vector.
|
3929
3929
|
*/
|
@@ -3939,7 +3939,7 @@ class Yt extends Dt {
|
|
3939
3939
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
3940
3940
|
}
|
3941
3941
|
}
|
3942
|
-
class Cs extends
|
3942
|
+
class Cs extends Zt {
|
3943
3943
|
/**
|
3944
3944
|
* Create one 2d area defined by one outter loop and multiple inner loops
|
3945
3945
|
*/
|
@@ -4004,18 +4004,18 @@ class Cs extends Yt {
|
|
4004
4004
|
const h = { index: -1, children: [] };
|
4005
4005
|
for (let a = 0; a < i; a++) {
|
4006
4006
|
const o = e[a], c = t[o], l = s[o];
|
4007
|
-
let
|
4008
|
-
for (;
|
4009
|
-
const
|
4010
|
-
if (s[
|
4011
|
-
c[
|
4007
|
+
let m = a + 1;
|
4008
|
+
for (; m < i; m++) {
|
4009
|
+
const d = e[m], x = t[d];
|
4010
|
+
if (s[d].containsBox(l) && xs.isPointInPolygon(
|
4011
|
+
c[S.randInt(0, c.length - 1)],
|
4012
4012
|
x
|
4013
4013
|
)) {
|
4014
|
-
(r = n.get(
|
4014
|
+
(r = n.get(d)) == null || r.children.push(n.get(o));
|
4015
4015
|
break;
|
4016
4016
|
}
|
4017
4017
|
}
|
4018
|
-
|
4018
|
+
m === i && h.children.push(n.get(o));
|
4019
4019
|
}
|
4020
4020
|
return h;
|
4021
4021
|
}
|
@@ -4050,7 +4050,7 @@ class Cs extends Yt {
|
|
4050
4050
|
}), e;
|
4051
4051
|
}
|
4052
4052
|
}
|
4053
|
-
class st extends
|
4053
|
+
class st extends Zt {
|
4054
4054
|
constructor() {
|
4055
4055
|
super(), this.arcLengthDivisions = 100;
|
4056
4056
|
}
|
@@ -4156,8 +4156,8 @@ class st extends Yt {
|
|
4156
4156
|
}
|
4157
4157
|
if (n = a, e[n] === h)
|
4158
4158
|
return n / (i - 1);
|
4159
|
-
const c = e[n],
|
4160
|
-
return (n +
|
4159
|
+
const c = e[n], m = e[n + 1] - c, d = (h - c) / m;
|
4160
|
+
return (n + d) / (i - 1);
|
4161
4161
|
}
|
4162
4162
|
/**
|
4163
4163
|
* Return a unit vector tangent at `t`. If the derived curve does not implement its tangent derivation,
|
@@ -4211,16 +4211,16 @@ class gt extends st {
|
|
4211
4211
|
* @param p3 Input the end point
|
4212
4212
|
*/
|
4213
4213
|
createByThreePoints(t, s, e) {
|
4214
|
-
const n = (
|
4215
|
-
x: (
|
4216
|
-
y: (
|
4217
|
-
}), i = (
|
4218
|
-
const F = (G - E) / (
|
4214
|
+
const n = (M, E) => ({
|
4215
|
+
x: (M.x + E.x) / 2,
|
4216
|
+
y: (M.y + E.y) / 2
|
4217
|
+
}), i = (M, E) => (E.y - M.y) / (E.x - M.x), h = (M) => -1 / M, r = n(t, s), a = n(s, e), o = i(t, s), c = i(s, e), l = h(o), m = h(c), d = (M, E, Z, G) => {
|
4218
|
+
const F = (G - E) / (M - Z), K = M * F + E;
|
4219
4219
|
return { x: F, y: K };
|
4220
|
-
}, x = r.y - l * r.x, g = a.y -
|
4220
|
+
}, x = r.y - l * r.x, g = a.y - m * a.x, p = d(l, x, m, g), _ = Math.sqrt(
|
4221
4221
|
Math.pow(t.x - p.x, 2) + Math.pow(t.y - p.y, 2)
|
4222
|
-
),
|
4223
|
-
this.center = p, this.radius = _, this.startAngle =
|
4222
|
+
), w = (M, E) => Math.atan2(M.y - E.y, M.x - E.x), f = w(t, p), A = w(s, p), z = w(e, p), C = z > f && z < A || f > z && f < A || A > z && A < f;
|
4223
|
+
this.center = p, this.radius = _, this.startAngle = f, this.endAngle = z, this.clockwise = !C;
|
4224
4224
|
}
|
4225
4225
|
/**
|
4226
4226
|
* Create circular arc by two points and one bugle factor
|
@@ -4237,21 +4237,21 @@ class gt extends st {
|
|
4237
4237
|
let n, i, h;
|
4238
4238
|
e < 0 ? (n = Math.atan(-e) * 4, i = new P(t), h = new P(s)) : (n = Math.atan(e) * 4, i = new P(s), h = new P(t));
|
4239
4239
|
const r = new P().subVectors(h, i), a = r.length(), o = new P().addVectors(i, r.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = r.normalize();
|
4240
|
-
let
|
4240
|
+
let m;
|
4241
4241
|
if (n < Math.PI) {
|
4242
|
-
const
|
4242
|
+
const d = new P(
|
4243
4243
|
l.x * Math.cos(Math.PI / 2) - l.y * Math.sin(Math.PI / 2),
|
4244
4244
|
l.y * Math.cos(Math.PI / 2) + l.x * Math.sin(Math.PI / 2)
|
4245
4245
|
);
|
4246
|
-
|
4246
|
+
m = o.add(d.multiplyScalar(-c));
|
4247
4247
|
} else {
|
4248
|
-
const
|
4248
|
+
const d = new P(
|
4249
4249
|
l.x * Math.cos(Math.PI / 2) - l.y * Math.sin(Math.PI / 2),
|
4250
4250
|
l.y * Math.cos(Math.PI / 2) + l.x * Math.sin(Math.PI / 2)
|
4251
4251
|
);
|
4252
|
-
|
4252
|
+
m = o.add(d.multiplyScalar(c));
|
4253
4253
|
}
|
4254
|
-
e < 0 ? (this.startAngle = Math.atan2(i.y -
|
4254
|
+
e < 0 ? (this.startAngle = Math.atan2(i.y - m.y, i.x - m.x), this.endAngle = Math.atan2(h.y - m.y, h.x - m.x)) : (this.startAngle = Math.atan2(h.y - m.y, h.x - m.x), this.endAngle = Math.atan2(i.y - m.y, i.x - m.x)), this.clockwise = e < 0, this.center = m, this.radius = h.sub(m).length();
|
4255
4255
|
}
|
4256
4256
|
/**
|
4257
4257
|
* Center of circular arc
|
@@ -4278,7 +4278,7 @@ class gt extends st {
|
|
4278
4278
|
return this._startAngle;
|
4279
4279
|
}
|
4280
4280
|
set startAngle(t) {
|
4281
|
-
this._startAngle =
|
4281
|
+
this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4282
4282
|
}
|
4283
4283
|
/**
|
4284
4284
|
* End angle in radians of circular arc in the range 0 to 2 * PI.
|
@@ -4287,13 +4287,13 @@ class gt extends st {
|
|
4287
4287
|
return this._endAngle;
|
4288
4288
|
}
|
4289
4289
|
set endAngle(t) {
|
4290
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4290
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4291
4291
|
}
|
4292
4292
|
/**
|
4293
4293
|
* Angle between endAngle and startAngle in range 0 to 2*PI
|
4294
4294
|
*/
|
4295
4295
|
get deltaAngle() {
|
4296
|
-
return this.clockwise ?
|
4296
|
+
return this.clockwise ? S.normalizeAngle(this.startAngle - this.endAngle) : S.normalizeAngle(this.endAngle - this.startAngle);
|
4297
4297
|
}
|
4298
4298
|
/**
|
4299
4299
|
* Rotation direction of the arc.
|
@@ -4320,7 +4320,7 @@ class gt extends st {
|
|
4320
4320
|
* Middle point of circular arc
|
4321
4321
|
*/
|
4322
4322
|
get midPoint() {
|
4323
|
-
const t =
|
4323
|
+
const t = S.normalizeAngle(
|
4324
4324
|
(this.startAngle + this.endAngle) / 2
|
4325
4325
|
);
|
4326
4326
|
return this.getPointAtAngle(t);
|
@@ -4337,7 +4337,7 @@ class gt extends st {
|
|
4337
4337
|
calculateBoundingBox() {
|
4338
4338
|
const t = [this.startPoint, this.endPoint], s = [0, Math.PI / 2, Math.PI, 3 * Math.PI / 2];
|
4339
4339
|
for (const i of s)
|
4340
|
-
|
4340
|
+
S.isBetweenAngle(
|
4341
4341
|
i,
|
4342
4342
|
this.startAngle,
|
4343
4343
|
this.endAngle,
|
@@ -4403,7 +4403,7 @@ class gt extends st {
|
|
4403
4403
|
return s;
|
4404
4404
|
}
|
4405
4405
|
}
|
4406
|
-
class Ps extends
|
4406
|
+
class Ps extends Yt {
|
4407
4407
|
/**
|
4408
4408
|
* Return new shape translated by given vector.
|
4409
4409
|
* Translation vector may be also defined by a pair of numbers.
|
@@ -4420,15 +4420,15 @@ class Ps extends Dt {
|
|
4420
4420
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
4421
4421
|
}
|
4422
4422
|
}
|
4423
|
-
class
|
4423
|
+
class zt extends Ps {
|
4424
4424
|
}
|
4425
|
-
class _t extends
|
4425
|
+
class _t extends zt {
|
4426
4426
|
/**
|
4427
4427
|
* This constructor initializes the line object to use start as the start point, and end
|
4428
4428
|
* as the endpoint. Both points must be in WCS coordinates.
|
4429
4429
|
*/
|
4430
4430
|
constructor(t, s) {
|
4431
|
-
super(), this._start = new
|
4431
|
+
super(), this._start = new B(t), this._end = new B(s);
|
4432
4432
|
}
|
4433
4433
|
/**
|
4434
4434
|
* The line's startpoint in WCS coordinates
|
@@ -4458,7 +4458,7 @@ class _t extends Mt {
|
|
4458
4458
|
* The middle point of this line.
|
4459
4459
|
*/
|
4460
4460
|
get midPoint() {
|
4461
|
-
return new
|
4461
|
+
return new B(
|
4462
4462
|
(this._start.x + this._end.x) / 2,
|
4463
4463
|
(this._start.y + this._end.y) / 2,
|
4464
4464
|
(this._start.z + this._end.z) / 2
|
@@ -4498,10 +4498,10 @@ class _t extends Mt {
|
|
4498
4498
|
atLength(t, s = !1) {
|
4499
4499
|
if (s) {
|
4500
4500
|
const e = this.delta(X).normalize();
|
4501
|
-
return new
|
4501
|
+
return new B(this._start).addScaledVector(e, t);
|
4502
4502
|
} else {
|
4503
4503
|
const e = this.delta(X).normalize();
|
4504
|
-
return new
|
4504
|
+
return new B(this._end).addScaledVector(e, t);
|
4505
4505
|
}
|
4506
4506
|
}
|
4507
4507
|
/**
|
@@ -4514,13 +4514,13 @@ class _t extends Mt {
|
|
4514
4514
|
extend(t, s = !1) {
|
4515
4515
|
if (s) {
|
4516
4516
|
const e = X.subVectors(this._start, this._end).normalize();
|
4517
|
-
this._start = new
|
4517
|
+
this._start = new B(this._start).addScaledVector(
|
4518
4518
|
e,
|
4519
4519
|
t
|
4520
4520
|
);
|
4521
4521
|
} else {
|
4522
4522
|
const e = this.delta(X).normalize();
|
4523
|
-
this._end = new
|
4523
|
+
this._end = new B(this._end).addScaledVector(e, t);
|
4524
4524
|
}
|
4525
4525
|
return this._boundingBoxNeedsUpdate = !0, this;
|
4526
4526
|
}
|
@@ -4532,10 +4532,10 @@ class _t extends Mt {
|
|
4532
4532
|
* @returns Return a point parameter based on the closest point as projected on the line segment.
|
4533
4533
|
*/
|
4534
4534
|
closestPointToPointParameter(t, s) {
|
4535
|
-
|
4535
|
+
Rt.subVectors(t, this._start), dt.subVectors(this.endPoint, this.startPoint);
|
4536
4536
|
const e = dt.dot(dt);
|
4537
|
-
let i = dt.dot(
|
4538
|
-
return s && (i =
|
4537
|
+
let i = dt.dot(Rt) / e;
|
4538
|
+
return s && (i = S.clamp(i, 0, 1)), i;
|
4539
4539
|
}
|
4540
4540
|
/**
|
4541
4541
|
* Return the closets point on the line. If clampToLine is true, then the returned value will be
|
@@ -4578,7 +4578,7 @@ class _t extends Mt {
|
|
4578
4578
|
*/
|
4579
4579
|
project(t) {
|
4580
4580
|
const s = this.direction, n = X.subVectors(t, this.startPoint).dot(s);
|
4581
|
-
return new
|
4581
|
+
return new B().copy(s).multiplyScalar(n).add(this.startPoint);
|
4582
4582
|
}
|
4583
4583
|
/**
|
4584
4584
|
* Finds the point on the line that is perpendicular to the given point. When you need the shortest distance
|
@@ -4589,17 +4589,17 @@ class _t extends Mt {
|
|
4589
4589
|
*/
|
4590
4590
|
perpPoint(t) {
|
4591
4591
|
const s = this.direction, e = this.startPoint, i = X.subVectors(t, e).dot(s), h = X.copy(s).multiplyScalar(i);
|
4592
|
-
return new
|
4592
|
+
return new B().addVectors(e, h);
|
4593
4593
|
}
|
4594
4594
|
/**
|
4595
4595
|
* @inheritdoc
|
4596
4596
|
*/
|
4597
4597
|
calculateBoundingBox() {
|
4598
|
-
const t = new
|
4598
|
+
const t = new B(
|
4599
4599
|
Math.min(this._start.x, this._end.x),
|
4600
4600
|
Math.min(this._start.y, this._end.y),
|
4601
4601
|
Math.min(this._start.z, this._end.z)
|
4602
|
-
), s = new
|
4602
|
+
), s = new B(
|
4603
4603
|
Math.max(this._start.x, this._end.x),
|
4604
4604
|
Math.max(this._start.y, this._end.y),
|
4605
4605
|
Math.max(this._start.z, this._end.z)
|
@@ -4631,8 +4631,8 @@ class _t extends Mt {
|
|
4631
4631
|
return new _t(this._start.clone(), this._end.clone());
|
4632
4632
|
}
|
4633
4633
|
}
|
4634
|
-
const X = /* @__PURE__ */ new y(),
|
4635
|
-
class yt extends
|
4634
|
+
const X = /* @__PURE__ */ new y(), Rt = /* @__PURE__ */ new y(), dt = /* @__PURE__ */ new y();
|
4635
|
+
class yt extends zt {
|
4636
4636
|
/**
|
4637
4637
|
* Compute center point of the arc given three points
|
4638
4638
|
* @param startPoint Input start point of the arc
|
@@ -4644,8 +4644,8 @@ class yt extends Mt {
|
|
4644
4644
|
const n = new y().addVectors(t, s).multiplyScalar(0.5), i = new y().addVectors(t, e).multiplyScalar(0.5), h = new y().subVectors(s, t), r = new y().subVectors(e, t), a = new y().crossVectors(h, r).normalize();
|
4645
4645
|
if (a.lengthSq() === 0)
|
4646
4646
|
return console.error("Points are collinear and cannot form a valid arc."), null;
|
4647
|
-
const o = new y().crossVectors(h, a).normalize(), c = new y().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),
|
4648
|
-
return
|
4647
|
+
const o = new y().crossVectors(h, a).normalize(), c = new y().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = new _t(n, n.clone().add(l)), x = new _t(i, i.clone().add(m)), g = new y();
|
4648
|
+
return d.closestPointToPoint(x.startPoint, !0, g) ? g : (console.error("Cannot find a valid center for the arc."), null);
|
4649
4649
|
}
|
4650
4650
|
/**
|
4651
4651
|
* Create arc by three points
|
@@ -4689,7 +4689,7 @@ class yt extends Mt {
|
|
4689
4689
|
return this._center;
|
4690
4690
|
}
|
4691
4691
|
set center(t) {
|
4692
|
-
this._center = new
|
4692
|
+
this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4693
4693
|
}
|
4694
4694
|
/**
|
4695
4695
|
* Radius of circular arc
|
@@ -4708,7 +4708,7 @@ class yt extends Mt {
|
|
4708
4708
|
return this._startAngle;
|
4709
4709
|
}
|
4710
4710
|
set startAngle(t) {
|
4711
|
-
this._startAngle =
|
4711
|
+
this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4712
4712
|
}
|
4713
4713
|
/**
|
4714
4714
|
* End angle in radians of circular arc in the range 0 to 2 * PI.
|
@@ -4717,13 +4717,13 @@ class yt extends Mt {
|
|
4717
4717
|
return this._endAngle;
|
4718
4718
|
}
|
4719
4719
|
set endAngle(t) {
|
4720
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4720
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4721
4721
|
}
|
4722
4722
|
/**
|
4723
4723
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
4724
4724
|
*/
|
4725
4725
|
get deltaAngle() {
|
4726
|
-
return
|
4726
|
+
return S.normalizeAngle(this.endAngle - this.startAngle);
|
4727
4727
|
}
|
4728
4728
|
/**
|
4729
4729
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -4779,7 +4779,7 @@ class yt extends Mt {
|
|
4779
4779
|
calculateBoundingBox() {
|
4780
4780
|
const t = [this.startAngle, this.endAngle];
|
4781
4781
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
4782
|
-
|
4782
|
+
S.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
4783
4783
|
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
4784
4784
|
for (const a of t) {
|
4785
4785
|
const o = this.getPointAtAngle(a);
|
@@ -4859,7 +4859,7 @@ class yt extends Mt {
|
|
4859
4859
|
y: s.z * e.x - s.x * e.z,
|
4860
4860
|
z: s.x * e.y - s.y * e.x
|
4861
4861
|
}, i = this.center, h = this.radius;
|
4862
|
-
return new
|
4862
|
+
return new B(
|
4863
4863
|
i.x + h * (e.x * Math.cos(t) + n.x * Math.sin(t)),
|
4864
4864
|
i.y + h * (e.y * Math.cos(t) + n.y * Math.sin(t)),
|
4865
4865
|
i.z + h * (e.z * Math.cos(t) + n.z * Math.sin(t))
|
@@ -4870,11 +4870,11 @@ class yt extends Mt {
|
|
4870
4870
|
*/
|
4871
4871
|
get plane() {
|
4872
4872
|
const t = new y(this.center).distanceTo(jt);
|
4873
|
-
return new
|
4873
|
+
return new Mt(this.normal, t);
|
4874
4874
|
}
|
4875
4875
|
}
|
4876
4876
|
const Pt = /* @__PURE__ */ new y();
|
4877
|
-
class
|
4877
|
+
class Gt extends st {
|
4878
4878
|
/**
|
4879
4879
|
* Construct an instance of the ellipse arc.
|
4880
4880
|
* @param center Center point of the ellipse.
|
@@ -4896,7 +4896,7 @@ class Zt extends st {
|
|
4896
4896
|
return this._center;
|
4897
4897
|
}
|
4898
4898
|
set center(t) {
|
4899
|
-
this._center = new
|
4899
|
+
this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4900
4900
|
}
|
4901
4901
|
/**
|
4902
4902
|
* Major axis radius of the ellipse
|
@@ -4925,7 +4925,7 @@ class Zt extends st {
|
|
4925
4925
|
return this._startAngle;
|
4926
4926
|
}
|
4927
4927
|
set startAngle(t) {
|
4928
|
-
this._startAngle =
|
4928
|
+
this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4929
4929
|
}
|
4930
4930
|
/**
|
4931
4931
|
* End angle of the ellipse arc in radians in the range -pi to pi.
|
@@ -4934,7 +4934,7 @@ class Zt extends st {
|
|
4934
4934
|
return this._endAngle;
|
4935
4935
|
}
|
4936
4936
|
set endAngle(t) {
|
4937
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
4937
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
4938
4938
|
}
|
4939
4939
|
/**
|
4940
4940
|
* The flag Whether the ellipse arc is drawn clockwise. Default is false.
|
@@ -4959,7 +4959,7 @@ class Zt extends st {
|
|
4959
4959
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
4960
4960
|
*/
|
4961
4961
|
get deltaAngle() {
|
4962
|
-
return
|
4962
|
+
return S.normalizeAngle(this.endAngle - this.startAngle);
|
4963
4963
|
}
|
4964
4964
|
/**
|
4965
4965
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -5022,7 +5022,7 @@ class Zt extends st {
|
|
5022
5022
|
* @inheritdoc
|
5023
5023
|
*/
|
5024
5024
|
clone() {
|
5025
|
-
return new
|
5025
|
+
return new Gt(
|
5026
5026
|
this.center,
|
5027
5027
|
this.majorAxisRadius,
|
5028
5028
|
this.minorAxisRadius,
|
@@ -5033,7 +5033,7 @@ class Zt extends st {
|
|
5033
5033
|
);
|
5034
5034
|
}
|
5035
5035
|
}
|
5036
|
-
class
|
5036
|
+
class Kt extends zt {
|
5037
5037
|
/**
|
5038
5038
|
* Construct an instance of the ellipse arc.
|
5039
5039
|
* @param center Center point of the ellipse.
|
@@ -5056,7 +5056,7 @@ class Gt extends Mt {
|
|
5056
5056
|
return this._center;
|
5057
5057
|
}
|
5058
5058
|
set center(t) {
|
5059
|
-
this._center = new
|
5059
|
+
this._center = new B(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
5060
5060
|
}
|
5061
5061
|
/**
|
5062
5062
|
* Major axis radius of the ellipse
|
@@ -5085,7 +5085,7 @@ class Gt extends Mt {
|
|
5085
5085
|
return this._startAngle;
|
5086
5086
|
}
|
5087
5087
|
set startAngle(t) {
|
5088
|
-
this._startAngle =
|
5088
|
+
this._startAngle = S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
5089
5089
|
}
|
5090
5090
|
/**
|
5091
5091
|
* End angle of the ellipse arc in radians in the range -pi to pi.
|
@@ -5094,14 +5094,14 @@ class Gt extends Mt {
|
|
5094
5094
|
return this._endAngle;
|
5095
5095
|
}
|
5096
5096
|
set endAngle(t) {
|
5097
|
-
this._endAngle = this.startAngle == 0 && t == I ? t :
|
5097
|
+
this._endAngle = this.startAngle == 0 && t == I ? t : S.normalizeAngle(t), this._boundingBoxNeedsUpdate = !0;
|
5098
5098
|
}
|
5099
5099
|
/**
|
5100
5100
|
* Return angle between endAngle and startAngle in range 0 to 2*PI
|
5101
5101
|
*/
|
5102
5102
|
get deltaAngle() {
|
5103
5103
|
const t = this.endAngle - this.startAngle;
|
5104
|
-
return Math.abs(t - I) < 1e-10 ? I :
|
5104
|
+
return Math.abs(t - I) < 1e-10 ? I : S.normalizeAngle(t);
|
5105
5105
|
}
|
5106
5106
|
/**
|
5107
5107
|
* Return true if the arc is a large arc whose delta angle value is greater than PI.
|
@@ -5157,10 +5157,19 @@ class Gt extends Mt {
|
|
5157
5157
|
/**
|
5158
5158
|
* @inheritdoc
|
5159
5159
|
*/
|
5160
|
+
/**
|
5161
|
+
* Check if this ellipse arc is actually a circular arc (major and minor radii are equal)
|
5162
|
+
* @returns True if the ellipse arc is circular
|
5163
|
+
*/
|
5164
|
+
get isCircular() {
|
5165
|
+
return Ft.equal(this.majorAxisRadius, this.minorAxisRadius);
|
5166
|
+
}
|
5160
5167
|
get length() {
|
5161
|
-
|
5168
|
+
if (this.isCircular)
|
5169
|
+
return this.majorAxisRadius * Math.abs(this.deltaAngle);
|
5170
|
+
const t = 1e3, s = this.deltaAngle / t;
|
5162
5171
|
let e = 0, n = this.getPointAtAngle(this.startAngle);
|
5163
|
-
for (let i = 1; i <=
|
5172
|
+
for (let i = 1; i <= t; i++) {
|
5164
5173
|
const h = this.startAngle + i * s, r = this.getPointAtAngle(h), a = r.x - n.x, o = r.y - n.y, c = r.z - n.z;
|
5165
5174
|
e += Math.sqrt(a * a + o * o + c * c), n = r;
|
5166
5175
|
}
|
@@ -5175,7 +5184,7 @@ class Gt extends Mt {
|
|
5175
5184
|
if (this.majorAxis.equals(y.X_AXIS) || this.majorAxis.equals(y.Y_AXIS) || this.majorAxis.isParallelTo(y.X_AXIS) || this.majorAxis.isParallelTo(y.Y_AXIS)) {
|
5176
5185
|
const t = [this.startAngle, this.endAngle];
|
5177
5186
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
5178
|
-
|
5187
|
+
S.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
5179
5188
|
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5180
5189
|
for (const a of t) {
|
5181
5190
|
const o = this.getPointAtAngle(a);
|
@@ -5220,7 +5229,7 @@ class Gt extends Mt {
|
|
5220
5229
|
*/
|
5221
5230
|
getPointAtAngle(t) {
|
5222
5231
|
const s = Math.cos(t), e = Math.sin(t), n = this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(e), i = this.majorAxis.clone().multiplyScalar(s * this.majorAxisRadius).add(n);
|
5223
|
-
return new
|
5232
|
+
return new B(
|
5224
5233
|
this.center.x + i.x,
|
5225
5234
|
this.center.y + i.y,
|
5226
5235
|
this.center.z + i.z
|
@@ -5251,7 +5260,7 @@ class Gt extends Mt {
|
|
5251
5260
|
* @inheritdoc
|
5252
5261
|
*/
|
5253
5262
|
clone() {
|
5254
|
-
return new
|
5263
|
+
return new Kt(
|
5255
5264
|
this.center,
|
5256
5265
|
this.normal,
|
5257
5266
|
this.majorAxis,
|
@@ -5266,7 +5275,7 @@ class Gt extends Mt {
|
|
5266
5275
|
*/
|
5267
5276
|
get plane() {
|
5268
5277
|
const t = new y(this.center).distanceTo(jt);
|
5269
|
-
return new
|
5278
|
+
return new Mt(this.normal, t);
|
5270
5279
|
}
|
5271
5280
|
}
|
5272
5281
|
class Bs extends st {
|
@@ -5379,7 +5388,7 @@ class Bs extends st {
|
|
5379
5388
|
getPoints3d(t, s) {
|
5380
5389
|
const e = [];
|
5381
5390
|
return this.getPoints(t).forEach(
|
5382
|
-
(i) => e.push(new
|
5391
|
+
(i) => e.push(new B().set(i.x, i.y, s))
|
5383
5392
|
), e;
|
5384
5393
|
}
|
5385
5394
|
/**
|
@@ -5406,7 +5415,7 @@ class Bs extends st {
|
|
5406
5415
|
return s;
|
5407
5416
|
}
|
5408
5417
|
}
|
5409
|
-
class
|
5418
|
+
class Qt extends st {
|
5410
5419
|
/**
|
5411
5420
|
* This constructor initializes the line object to use start as the start point, and end
|
5412
5421
|
* as the endpoint. Both points must be in WCS coordinates.
|
@@ -5482,7 +5491,7 @@ class Kt extends st {
|
|
5482
5491
|
* @inheritdoc
|
5483
5492
|
*/
|
5484
5493
|
clone() {
|
5485
|
-
return new
|
5494
|
+
return new Qt(this._start.clone(), this._end.clone());
|
5486
5495
|
}
|
5487
5496
|
}
|
5488
5497
|
class Is extends st {
|
@@ -5629,37 +5638,38 @@ class D {
|
|
5629
5638
|
n = ys(s, t.length);
|
5630
5639
|
break;
|
5631
5640
|
}
|
5632
|
-
const i =
|
5641
|
+
const i = Ms(t), h = new Array(i.length).fill(1);
|
5633
5642
|
return new D(s, n, i, h);
|
5634
5643
|
}
|
5635
5644
|
}
|
5636
|
-
class Es extends
|
5637
|
-
constructor(t, s, e) {
|
5645
|
+
class Es extends zt {
|
5646
|
+
constructor(t, s, e, n) {
|
5638
5647
|
super();
|
5639
|
-
const
|
5640
|
-
if (
|
5648
|
+
const i = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0);
|
5649
|
+
if (i < 2 || i > 4)
|
5641
5650
|
throw T.ILLEGAL_PARAMETERS;
|
5642
|
-
const
|
5643
|
-
if (this._closed = !1,
|
5644
|
-
if (this.
|
5645
|
-
throw T.ILLEGAL_PARAMETERS;
|
5646
|
-
const h = this.toNurbsPoints(this._fitPoints);
|
5647
|
-
this._nurbsCurve = D.byPoints(
|
5648
|
-
h,
|
5649
|
-
i,
|
5650
|
-
this._knotParameterization
|
5651
|
-
), this._controlPoints = this.toGePoints(this._nurbsCurve.controlPoints()), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = [...this._nurbsCurve.weights()];
|
5652
|
-
} else {
|
5653
|
-
if (this._controlPoints = t, this._controlPoints.length < 4)
|
5651
|
+
const h = 3;
|
5652
|
+
if (this._closed = n || !1, Array.isArray(s)) {
|
5653
|
+
if (this._controlPoints = t, i >= 4 && (this._closed = n), this._controlPoints.length < 4)
|
5654
5654
|
throw T.ILLEGAL_PARAMETERS;
|
5655
|
-
const
|
5655
|
+
const r = this.toNurbsPoints(this._controlPoints);
|
5656
5656
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5657
|
-
i,
|
5658
|
-
s,
|
5659
5657
|
h,
|
5658
|
+
s,
|
5659
|
+
r,
|
5660
5660
|
e
|
5661
5661
|
), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = e ? [...e] : new Array(this._controlPoints.length).fill(1);
|
5662
|
+
} else {
|
5663
|
+
if (this._fitPoints = t, this._knotParameterization = s, i >= 3 && (this._closed = e), this._fitPoints.length < 4)
|
5664
|
+
throw T.ILLEGAL_PARAMETERS;
|
5665
|
+
const r = this.toNurbsPoints(this._fitPoints);
|
5666
|
+
this._nurbsCurve = D.byPoints(
|
5667
|
+
r,
|
5668
|
+
h,
|
5669
|
+
this._knotParameterization
|
5670
|
+
), this._controlPoints = this.toGePoints(this._nurbsCurve.controlPoints()), this._originalControlPoints = [...this._controlPoints], this._originalKnots = [...this._nurbsCurve.knots()], this._originalWeights = [...this._nurbsCurve.weights()];
|
5662
5671
|
}
|
5672
|
+
this._closed && this.makeClosed();
|
5663
5673
|
}
|
5664
5674
|
/**
|
5665
5675
|
* Set the closed property and rebuild the curve if necessary
|
@@ -5671,13 +5681,10 @@ class Es extends Mt {
|
|
5671
5681
|
* Make the spline closed by adding control points and adjusting knots
|
5672
5682
|
*/
|
5673
5683
|
makeClosed() {
|
5674
|
-
const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.
|
5675
|
-
|
5676
|
-
...s.
|
5677
|
-
|
5678
|
-
...e,
|
5679
|
-
...e.slice(0, t)
|
5680
|
-
], r = this.createClosedKnotVector(n, t);
|
5684
|
+
const t = this._nurbsCurve.degree(), s = this._nurbsCurve.controlPoints(), e = this._nurbsCurve.knots(), n = this._nurbsCurve.weights(), i = [...s], h = [...n];
|
5685
|
+
for (let a = 0; a < t; a++)
|
5686
|
+
i.push([...s[0]]), h.push(n[0]);
|
5687
|
+
const r = this.createClosedKnotVector(e, t);
|
5681
5688
|
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5682
5689
|
t,
|
5683
5690
|
r,
|
@@ -5700,13 +5707,13 @@ class Es extends Mt {
|
|
5700
5707
|
), this._controlPoints = [...this._originalControlPoints];
|
5701
5708
|
}
|
5702
5709
|
/**
|
5703
|
-
* Create
|
5710
|
+
* Create knot vector for closed curve
|
5704
5711
|
*/
|
5705
5712
|
createClosedKnotVector(t, s) {
|
5706
|
-
const e = t
|
5707
|
-
for (let
|
5708
|
-
|
5709
|
-
return
|
5713
|
+
const e = [...t], n = t[t.length - 1], i = s;
|
5714
|
+
for (let h = 1; h <= i; h++)
|
5715
|
+
e.push(n + h);
|
5716
|
+
return e;
|
5710
5717
|
}
|
5711
5718
|
/**
|
5712
5719
|
* Degree of the spline to be created.
|
@@ -5722,16 +5729,14 @@ class Es extends Mt {
|
|
5722
5729
|
*/
|
5723
5730
|
get startPoint() {
|
5724
5731
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
|
5725
|
-
return new
|
5732
|
+
return new B(n[0], n[1], n[2]);
|
5726
5733
|
}
|
5727
5734
|
/**
|
5728
5735
|
* The end point of this spline
|
5729
5736
|
*/
|
5730
5737
|
get endPoint() {
|
5731
|
-
if (this._closed)
|
5732
|
-
return this.startPoint;
|
5733
5738
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
|
5734
|
-
return new
|
5739
|
+
return new B(n[0], n[1], n[2]);
|
5735
5740
|
}
|
5736
5741
|
/**
|
5737
5742
|
* @inheritdoc
|
@@ -5764,26 +5769,16 @@ class Es extends Mt {
|
|
5764
5769
|
return this._controlPoints[e];
|
5765
5770
|
}
|
5766
5771
|
/**
|
5767
|
-
* Divide this spline into the specified
|
5772
|
+
* Divide this spline into the specified nubmer of points
|
5768
5773
|
* those points as an array of points.
|
5769
|
-
* @param numPoints Input the
|
5774
|
+
* @param numPoints Input the nubmer of points returned
|
5770
5775
|
* @returns Return an array of point
|
5771
5776
|
*/
|
5772
5777
|
getPoints(t = 100) {
|
5773
|
-
const s = this._nurbsCurve, e = [], n = s.knots(), i =
|
5774
|
-
|
5775
|
-
const
|
5776
|
-
|
5777
|
-
const l = h + c * o, d = s.point(l);
|
5778
|
-
e.push(new S(d[0], d[1], d[2]));
|
5779
|
-
}
|
5780
|
-
e.push(e[0]);
|
5781
|
-
} else {
|
5782
|
-
const a = (r - h) / (t - 1);
|
5783
|
-
for (let o = 0; o < t; o++) {
|
5784
|
-
const c = o === t - 1 ? r : h + o * a, l = s.point(c);
|
5785
|
-
e.push(new S(l[0], l[1], l[2]));
|
5786
|
-
}
|
5778
|
+
const s = this._nurbsCurve, e = [], n = s.knots(), i = this._nurbsCurve.degree(), h = n[i], r = n[n.length - i - 1], a = (r - h) / (t - 1);
|
5779
|
+
for (let o = 0; o < t; o++) {
|
5780
|
+
const c = o === t - 1 ? r : h + o * a, l = s.point(c);
|
5781
|
+
e.push(new B(l[0], l[1], l[2]));
|
5787
5782
|
}
|
5788
5783
|
return e;
|
5789
5784
|
}
|
@@ -5844,28 +5839,28 @@ export {
|
|
5844
5839
|
gt as AcGeCircArc2d,
|
5845
5840
|
yt as AcGeCircArc3d,
|
5846
5841
|
st as AcGeCurve2d,
|
5847
|
-
|
5848
|
-
|
5842
|
+
Gt as AcGeEllipseArc2d,
|
5843
|
+
Kt as AcGeEllipseArc3d,
|
5849
5844
|
Nt as AcGeEuler,
|
5850
5845
|
xs as AcGeGeometryUtil,
|
5851
|
-
|
5846
|
+
Qt as AcGeLine2d,
|
5852
5847
|
_t as AcGeLine3d,
|
5853
5848
|
Is as AcGeLoop2d,
|
5854
|
-
|
5849
|
+
S as AcGeMathUtil,
|
5855
5850
|
v as AcGeMatrix2d,
|
5856
5851
|
tt as AcGeMatrix3d,
|
5857
|
-
|
5852
|
+
Mt as AcGePlane,
|
5858
5853
|
b as AcGePoint2d,
|
5859
|
-
|
5854
|
+
B as AcGePoint3d,
|
5860
5855
|
Bs as AcGePolyline2d,
|
5861
5856
|
pt as AcGeQuaternion,
|
5862
|
-
|
5857
|
+
Zt as AcGeShape2d,
|
5863
5858
|
Es as AcGeSpline3d,
|
5864
|
-
|
5859
|
+
Ft as AcGeTol,
|
5865
5860
|
P as AcGeVector2d,
|
5866
5861
|
y as AcGeVector3d,
|
5867
|
-
|
5868
|
-
|
5862
|
+
Xt as DEFAULT_TOL,
|
5863
|
+
Lt as DEG2RAD,
|
5869
5864
|
Q as FLOAT_TOL,
|
5870
5865
|
Ss as ORIGIN_POINT_2D,
|
5871
5866
|
jt as ORIGIN_POINT_3D,
|
@@ -5873,35 +5868,35 @@ export {
|
|
5873
5868
|
I as TAU,
|
5874
5869
|
bt as basisFunction,
|
5875
5870
|
ps as calculateCurveLength,
|
5876
|
-
|
5871
|
+
as as ceilPowerOfTwo,
|
5877
5872
|
j as clamp,
|
5878
|
-
|
5879
|
-
|
5873
|
+
$t as damp,
|
5874
|
+
rs as degToRad,
|
5880
5875
|
Vt as euclideanModulo,
|
5881
5876
|
xt as evaluateNurbsPoint,
|
5882
|
-
|
5877
|
+
cs as floorPowerOfTwo,
|
5883
5878
|
gs as generateChordKnots,
|
5884
5879
|
_s as generateSqrtChordKnots,
|
5885
|
-
|
5880
|
+
Ot as generateUUID,
|
5886
5881
|
ys as generateUniformKnots,
|
5887
5882
|
qt as intPartLength,
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5883
|
+
Ms as interpolateControlPoints,
|
5884
|
+
Ht as inverseLerp,
|
5885
|
+
ls as isBetween,
|
5886
|
+
us as isBetweenAngle,
|
5887
|
+
Dt as isPointInPolygon,
|
5893
5888
|
ms as isPolygonIntersect,
|
5894
|
-
|
5889
|
+
os as isPowerOfTwo,
|
5895
5890
|
Ut as lerp,
|
5896
|
-
|
5891
|
+
Wt as mapLinear,
|
5897
5892
|
mt as normalizeAngle,
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
5902
|
-
|
5903
|
-
|
5904
|
-
|
5905
|
-
|
5906
|
-
|
5893
|
+
Jt as pingpong,
|
5894
|
+
hs as radToDeg,
|
5895
|
+
es as randFloat,
|
5896
|
+
ns as randFloatSpread,
|
5897
|
+
ss as randInt,
|
5898
|
+
ds as relativeEps,
|
5899
|
+
is as seededRandom,
|
5900
|
+
ts as smootherstep,
|
5901
|
+
vt as smoothstep
|
5907
5902
|
};
|