@mlightcad/geometry-engine 2.0.0 → 2.0.1
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 +761 -517
- package/dist/geometry-engine.umd.cjs +1 -1
- package/lib/geometry/AcGeCatmullRomCurve3d.d.ts +146 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.d.ts.map +1 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.js +358 -0
- package/lib/geometry/AcGeCatmullRomCurve3d.js.map +1 -0
- package/lib/geometry/AcGeNurbsCurve.d.ts +69 -0
- package/lib/geometry/AcGeNurbsCurve.d.ts.map +1 -0
- package/lib/geometry/AcGeNurbsCurve.js +166 -0
- package/lib/geometry/AcGeNurbsCurve.js.map +1 -0
- package/lib/geometry/AcGeSpline3d.d.ts +13 -54
- package/lib/geometry/AcGeSpline3d.d.ts.map +1 -1
- package/lib/geometry/AcGeSpline3d.js +52 -181
- package/lib/geometry/AcGeSpline3d.js.map +1 -1
- package/lib/geometry/index.d.ts +2 -0
- package/lib/geometry/index.d.ts.map +1 -1
- package/lib/geometry/index.js +2 -0
- package/lib/geometry/index.js.map +1 -1
- package/lib/util/AcGeSplineUtil.d.ts +36 -0
- package/lib/util/AcGeSplineUtil.d.ts.map +1 -0
- package/lib/util/AcGeSplineUtil.js +491 -0
- package/lib/util/AcGeSplineUtil.js.map +1 -0
- package/package.json +1 -1
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 R = [
|
3
3
|
"00",
|
4
4
|
"01",
|
5
5
|
"02",
|
@@ -257,113 +257,113 @@ const k = [
|
|
257
257
|
"fe",
|
258
258
|
"ff"
|
259
259
|
];
|
260
|
-
let
|
261
|
-
const Lt = Math.PI / 180,
|
262
|
-
function
|
260
|
+
let Ct = 1234567;
|
261
|
+
const Lt = Math.PI / 180, Ut = 180 / Math.PI;
|
262
|
+
function $t() {
|
263
263
|
const u = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, s = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0;
|
264
|
-
return (
|
264
|
+
return (R[u & 255] + R[u >> 8 & 255] + R[u >> 16 & 255] + R[u >> 24 & 255] + "-" + R[t & 255] + R[t >> 8 & 255] + "-" + R[t >> 16 & 15 | 64] + R[t >> 24 & 255] + "-" + R[s & 63 | 128] + R[s >> 8 & 255] + "-" + R[s >> 16 & 255] + R[s >> 24 & 255] + R[e & 255] + R[e >> 8 & 255] + R[e >> 16 & 255] + R[e >> 24 & 255]).toLowerCase();
|
265
265
|
}
|
266
|
-
function
|
266
|
+
function X(u, t, s) {
|
267
267
|
return Math.max(t, Math.min(s, u));
|
268
268
|
}
|
269
|
-
function
|
269
|
+
function qt(u, t) {
|
270
270
|
return (u % t + t) % t;
|
271
271
|
}
|
272
272
|
function Wt(u, t, s, e, n) {
|
273
273
|
return e + (u - t) * (n - e) / (s - t);
|
274
274
|
}
|
275
|
-
function
|
275
|
+
function Jt(u, t, s) {
|
276
276
|
return u !== t ? (s - u) / (t - u) : 0;
|
277
277
|
}
|
278
|
-
function
|
278
|
+
function Vt(u, t, s) {
|
279
279
|
return (1 - s) * u + s * t;
|
280
280
|
}
|
281
|
-
function
|
282
|
-
return
|
281
|
+
function vt(u, t, s, e) {
|
282
|
+
return Vt(u, t, 1 - Math.exp(-s * e));
|
283
283
|
}
|
284
|
-
function
|
285
|
-
return t - Math.abs(
|
284
|
+
function ts(u, t = 1) {
|
285
|
+
return t - Math.abs(qt(u, t * 2) - t);
|
286
286
|
}
|
287
|
-
function
|
287
|
+
function ss(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 es(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 ns(u, t) {
|
294
294
|
return u + Math.floor(Math.random() * (t - u + 1));
|
295
295
|
}
|
296
|
-
function
|
296
|
+
function is(u, t) {
|
297
297
|
return u + Math.random() * (t - u);
|
298
298
|
}
|
299
|
-
function
|
299
|
+
function rs(u) {
|
300
300
|
return u * (0.5 - Math.random());
|
301
301
|
}
|
302
|
-
function
|
303
|
-
u !== void 0 && (
|
304
|
-
let t =
|
302
|
+
function hs(u) {
|
303
|
+
u !== void 0 && (Ct = u);
|
304
|
+
let t = Ct += 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
|
307
|
+
function os(u) {
|
308
308
|
return u * Lt;
|
309
309
|
}
|
310
|
-
function
|
311
|
-
return u *
|
310
|
+
function as(u) {
|
311
|
+
return u * Ut;
|
312
312
|
}
|
313
|
-
function
|
313
|
+
function cs(u) {
|
314
314
|
return (u & u - 1) === 0 && u !== 0;
|
315
315
|
}
|
316
|
-
function
|
316
|
+
function ls(u) {
|
317
317
|
return Math.pow(2, Math.ceil(Math.log(u) / Math.LN2));
|
318
318
|
}
|
319
|
-
function
|
319
|
+
function us(u) {
|
320
320
|
return Math.pow(2, Math.floor(Math.log(u) / Math.LN2));
|
321
321
|
}
|
322
|
-
function
|
322
|
+
function xt(u) {
|
323
323
|
const t = Math.PI * 2;
|
324
324
|
return (u % t + t) % t;
|
325
325
|
}
|
326
|
-
function
|
326
|
+
function ds(u, t, s) {
|
327
327
|
return u > t && u < s || u > s && u < t;
|
328
328
|
}
|
329
|
-
function
|
330
|
-
return u =
|
329
|
+
function ms(u, t, s, e = !1) {
|
330
|
+
return u = xt(u), t = xt(t), s = xt(s), e ? t > s ? u <= t && u >= s : u <= t || u >= s : t < s ? u >= t && u <= s : u >= t || u <= s;
|
331
331
|
}
|
332
|
-
function
|
332
|
+
function jt(u) {
|
333
333
|
return u = Math.abs(u), u < 1 ? 0 : Math.ceil(Math.log10(Math.abs(u) + 1));
|
334
334
|
}
|
335
|
-
function
|
336
|
-
const s =
|
335
|
+
function xs(u, t = 1e-7) {
|
336
|
+
const s = jt(u);
|
337
337
|
return Math.max(Math.pow(10, s) * t, t);
|
338
338
|
}
|
339
|
-
const
|
339
|
+
const C = {
|
340
340
|
DEG2RAD: Lt,
|
341
|
-
RAD2DEG:
|
342
|
-
generateUUID:
|
343
|
-
clamp:
|
344
|
-
euclideanModulo:
|
341
|
+
RAD2DEG: Ut,
|
342
|
+
generateUUID: $t,
|
343
|
+
clamp: X,
|
344
|
+
euclideanModulo: qt,
|
345
345
|
mapLinear: Wt,
|
346
|
-
inverseLerp:
|
347
|
-
lerp:
|
348
|
-
damp:
|
349
|
-
pingpong:
|
350
|
-
smoothstep:
|
351
|
-
smootherstep:
|
352
|
-
randInt:
|
353
|
-
randFloat:
|
354
|
-
randFloatSpread:
|
355
|
-
seededRandom:
|
356
|
-
degToRad:
|
357
|
-
radToDeg:
|
358
|
-
isPowerOfTwo:
|
359
|
-
ceilPowerOfTwo:
|
360
|
-
floorPowerOfTwo:
|
361
|
-
normalizeAngle:
|
362
|
-
isBetween:
|
363
|
-
isBetweenAngle:
|
364
|
-
intPartLength:
|
365
|
-
relativeEps:
|
366
|
-
},
|
346
|
+
inverseLerp: Jt,
|
347
|
+
lerp: Vt,
|
348
|
+
damp: vt,
|
349
|
+
pingpong: ts,
|
350
|
+
smoothstep: ss,
|
351
|
+
smootherstep: es,
|
352
|
+
randInt: ns,
|
353
|
+
randFloat: is,
|
354
|
+
randFloatSpread: rs,
|
355
|
+
seededRandom: hs,
|
356
|
+
degToRad: os,
|
357
|
+
radToDeg: as,
|
358
|
+
isPowerOfTwo: cs,
|
359
|
+
ceilPowerOfTwo: ls,
|
360
|
+
floorPowerOfTwo: us,
|
361
|
+
normalizeAngle: xt,
|
362
|
+
isBetween: ds,
|
363
|
+
isBetweenAngle: ms,
|
364
|
+
intPartLength: jt,
|
365
|
+
relativeEps: xs
|
366
|
+
}, K = class K {
|
367
367
|
/**
|
368
368
|
* Construct one vector by two numbers
|
369
369
|
*/
|
@@ -384,7 +384,7 @@ const S = {
|
|
384
384
|
this.x = t, this.y = s;
|
385
385
|
return;
|
386
386
|
}
|
387
|
-
throw
|
387
|
+
throw L.ILLEGAL_PARAMETERS;
|
388
388
|
}
|
389
389
|
}
|
390
390
|
/**
|
@@ -479,7 +479,7 @@ const S = {
|
|
479
479
|
* @returns Return the cloned vector
|
480
480
|
*/
|
481
481
|
clone() {
|
482
|
-
return new
|
482
|
+
return new K(this.x, this.y);
|
483
483
|
}
|
484
484
|
/**
|
485
485
|
* Copy the values of the passed vector's x and y properties to this vector.
|
@@ -851,17 +851,17 @@ const S = {
|
|
851
851
|
}
|
852
852
|
relativeEps(t = 1e-7) {
|
853
853
|
return Math.min(
|
854
|
-
|
855
|
-
|
854
|
+
C.relativeEps(this.x, t),
|
855
|
+
C.relativeEps(this.y, t)
|
856
856
|
);
|
857
857
|
}
|
858
858
|
*[Symbol.iterator]() {
|
859
859
|
yield this.x, yield this.y;
|
860
860
|
}
|
861
861
|
};
|
862
|
-
|
863
|
-
let
|
864
|
-
const
|
862
|
+
K.EMPTY = Object.freeze(new K(0, 0));
|
863
|
+
let b = K;
|
864
|
+
const $ = class $ {
|
865
865
|
/**
|
866
866
|
* Create a 3x3 matrix with the given arguments in row-major order. If no arguments are provided,
|
867
867
|
* the constructor initializes the Matrix3 to the 3x3 identity matrix.
|
@@ -954,8 +954,8 @@ const H = class H {
|
|
954
954
|
* @returns Return this matrix
|
955
955
|
*/
|
956
956
|
multiplyMatrices(t, s) {
|
957
|
-
const e = t.elements, n = s.elements, i = this.elements, h = e[0], r = e[3], a = e[6], o = e[1], c = e[4], l = e[7],
|
958
|
-
return i[0] = h *
|
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], d = e[2], m = e[5], x = e[8], y = n[0], _ = n[3], p = n[6], P = n[1], w = n[4], f = n[7], M = n[2], B = n[5], z = n[8];
|
958
|
+
return i[0] = h * y + r * P + a * M, i[3] = h * _ + r * w + a * B, i[6] = h * p + r * f + a * z, i[1] = o * y + c * P + l * M, i[4] = o * _ + c * w + l * B, i[7] = o * p + c * f + l * z, i[2] = d * y + m * P + x * M, i[5] = d * _ + m * w + x * B, i[8] = d * p + m * f + x * z, 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, d = r * a - c * i, m = o * i - h * a, x = s * l + e * d + n * m;
|
984
984
|
if (x === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
985
|
-
const
|
986
|
-
return t[0] = l *
|
985
|
+
const y = 1 / x;
|
986
|
+
return t[0] = l * y, t[1] = (n * o - c * e) * y, t[2] = (r * e - n * h) * y, t[3] = d * y, t[4] = (c * s - n * a) * y, t[5] = (n * i - r * s) * y, t[6] = m * y, t[7] = (e * a - o * s) * y, t[8] = (h * s - e * i) * y, this;
|
987
987
|
}
|
988
988
|
/**
|
989
989
|
* Transpose this matrix in place.
|
@@ -1071,7 +1071,7 @@ const H = class H {
|
|
1071
1071
|
* @returns Return this matrix
|
1072
1072
|
*/
|
1073
1073
|
makeTranslation(t, s) {
|
1074
|
-
return t instanceof
|
1074
|
+
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;
|
1075
1075
|
}
|
1076
1076
|
/**
|
1077
1077
|
* Set this matrix as a 2D rotational transformation by theta radians
|
@@ -1128,25 +1128,25 @@ const H = class H {
|
|
1128
1128
|
* @returns Return the cloned matrix
|
1129
1129
|
*/
|
1130
1130
|
clone() {
|
1131
|
-
return new
|
1131
|
+
return new $().fromArray(this.elements);
|
1132
1132
|
}
|
1133
1133
|
};
|
1134
|
-
|
1135
|
-
let v =
|
1136
|
-
const At = /* @__PURE__ */ new v(),
|
1134
|
+
$.IDENTITY = Object.freeze(new $());
|
1135
|
+
let v = $;
|
1136
|
+
const At = /* @__PURE__ */ new v(), O = 1e-6, I = 2 * Math.PI, Bs = {
|
1137
1137
|
x: 0,
|
1138
1138
|
y: 0
|
1139
|
-
},
|
1139
|
+
}, Ft = {
|
1140
1140
|
x: 0,
|
1141
1141
|
y: 0,
|
1142
1142
|
z: 0
|
1143
1143
|
};
|
1144
|
-
class
|
1144
|
+
class Xt {
|
1145
1145
|
/**
|
1146
1146
|
* Create tolerance class with default tolerance values
|
1147
1147
|
*/
|
1148
1148
|
constructor() {
|
1149
|
-
this.equalPointTol =
|
1149
|
+
this.equalPointTol = O, this.equalVectorTol = O;
|
1150
1150
|
}
|
1151
1151
|
/**
|
1152
1152
|
* Return true if two points are equal with the specified tolerance.
|
@@ -1155,7 +1155,7 @@ class Ft {
|
|
1155
1155
|
* @returns Return true if two poitns are equal with the specified tolerance.
|
1156
1156
|
*/
|
1157
1157
|
equalPoint2d(t, s) {
|
1158
|
-
return new
|
1158
|
+
return new b(t).sub(s).length() < this.equalPointTol;
|
1159
1159
|
}
|
1160
1160
|
/**
|
1161
1161
|
* Return true if two points are equal with the specified tolerance.
|
@@ -1164,12 +1164,12 @@ class Ft {
|
|
1164
1164
|
* @returns Return true if two poitns are equal with the specified tolerance.
|
1165
1165
|
*/
|
1166
1166
|
equalPoint3d(t, s) {
|
1167
|
-
return new
|
1167
|
+
return new g(t).sub(s).length() < this.equalPointTol;
|
1168
1168
|
}
|
1169
1169
|
/**
|
1170
1170
|
* Return true if the value is equal to zero with the specified tolerance.
|
1171
1171
|
*/
|
1172
|
-
static equalToZero(t, s =
|
1172
|
+
static equalToZero(t, s = O) {
|
1173
1173
|
return t < s && t > -s;
|
1174
1174
|
}
|
1175
1175
|
/**
|
@@ -1180,7 +1180,7 @@ class Ft {
|
|
1180
1180
|
* @param tol Input the tolerance value
|
1181
1181
|
* @returns Return true if two values are equal with the sepcified tolerance
|
1182
1182
|
*/
|
1183
|
-
static equal(t, s, e =
|
1183
|
+
static equal(t, s, e = O) {
|
1184
1184
|
return Math.abs(t - s) < e;
|
1185
1185
|
}
|
1186
1186
|
/**
|
@@ -1193,7 +1193,7 @@ class Ft {
|
|
1193
1193
|
* @returns Return true if the first argument are greater than the second argument with the
|
1194
1194
|
* sepcified tolerance.
|
1195
1195
|
*/
|
1196
|
-
static great(t, s, e =
|
1196
|
+
static great(t, s, e = O) {
|
1197
1197
|
return t - s > e;
|
1198
1198
|
}
|
1199
1199
|
/**
|
@@ -1206,40 +1206,40 @@ class Ft {
|
|
1206
1206
|
* @returns Return *true* if the first argument less than the second argument with the specified
|
1207
1207
|
* tolerance value
|
1208
1208
|
*/
|
1209
|
-
static less(t, s, e =
|
1209
|
+
static less(t, s, e = O) {
|
1210
1210
|
return t - s < e;
|
1211
1211
|
}
|
1212
1212
|
}
|
1213
|
-
const
|
1214
|
-
function
|
1213
|
+
const Dt = new Xt();
|
1214
|
+
function Yt(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, d = t[a].y;
|
1220
|
+
let m = c > n != d > n;
|
1221
|
+
s && (m = c >= n != d >= n), m && e < (l - o) * (n - c) / (d - c) + o && (i = !i);
|
1222
1222
|
}
|
1223
1223
|
return i;
|
1224
1224
|
}
|
1225
|
-
function
|
1225
|
+
function ys(u, t) {
|
1226
1226
|
if (u.length === 0 || t.length === 0)
|
1227
1227
|
return !1;
|
1228
|
-
const s = new
|
1228
|
+
const s = new U().setFromPoints(u), e = new U().setFromPoints(t);
|
1229
1229
|
if (!s.intersectsBox(e))
|
1230
1230
|
return !1;
|
1231
1231
|
for (let n = 0; n < u.length; ) {
|
1232
|
-
if (
|
1232
|
+
if (Yt(u[n], t, !0))
|
1233
1233
|
return !0;
|
1234
|
-
n < u.length - 1 &&
|
1234
|
+
n < u.length - 1 && Dt.equalPoint2d(u[n + 1], u[n]) && ++n, ++n;
|
1235
1235
|
}
|
1236
1236
|
return !1;
|
1237
1237
|
}
|
1238
|
-
const
|
1239
|
-
isPointInPolygon:
|
1240
|
-
isPolygonIntersect:
|
1238
|
+
const gs = {
|
1239
|
+
isPointInPolygon: Yt,
|
1240
|
+
isPolygonIntersect: ys
|
1241
1241
|
};
|
1242
|
-
function
|
1242
|
+
function _s(u, t) {
|
1243
1243
|
const s = [], e = t - 1, n = u;
|
1244
1244
|
for (let i = 0; i <= n; i++)
|
1245
1245
|
s.push(0);
|
@@ -1249,7 +1249,7 @@ function ys(u, t) {
|
|
1249
1249
|
s.push(e - n + 1);
|
1250
1250
|
return s;
|
1251
1251
|
}
|
1252
|
-
function
|
1252
|
+
function ps(u, t) {
|
1253
1253
|
const s = t.length - 1, e = u, n = [0];
|
1254
1254
|
let i = 0;
|
1255
1255
|
for (let r = 1; r <= s; r++) {
|
@@ -1267,12 +1267,12 @@ function gs(u, t) {
|
|
1267
1267
|
h.push(s - e + 1);
|
1268
1268
|
return h;
|
1269
1269
|
}
|
1270
|
-
function
|
1270
|
+
function zs(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), d = Math.sqrt(l);
|
1275
|
+
i += d, n.push(i);
|
1276
1276
|
}
|
1277
1277
|
const h = [];
|
1278
1278
|
for (let r = 0; r <= e; r++)
|
@@ -1285,13 +1285,13 @@ function _s(u, t) {
|
|
1285
1285
|
h.push(s - e + 1);
|
1286
1286
|
return h;
|
1287
1287
|
}
|
1288
|
-
function
|
1288
|
+
function St(u, t, s, e) {
|
1289
1289
|
if (t === 0)
|
1290
1290
|
return s >= e[u] && s < e[u + 1] ? 1 : 0;
|
1291
1291
|
const n = e[u + t] - e[u], i = e[u + t + 1] - e[u + 1], h = n > 1e-10 ? (s - e[u]) / n : 0, r = i > 1e-10 ? (e[u + t + 1] - s) / i : 0;
|
1292
|
-
return h *
|
1292
|
+
return h * St(u, t - 1, s, e) + r * St(u + 1, t - 1, s, e);
|
1293
1293
|
}
|
1294
|
-
function
|
1294
|
+
function yt(u, t, s, e, n) {
|
1295
1295
|
const i = e.length - 1, h = t;
|
1296
1296
|
if (u = Math.max(s[h], Math.min(s[i + 1], u)), Math.abs(u - s[i + 1]) < 1e-8)
|
1297
1297
|
return [...e[i]];
|
@@ -1300,7 +1300,7 @@ function xt(u, t, s, e, n) {
|
|
1300
1300
|
const r = [0, 0, 0];
|
1301
1301
|
let a = 0;
|
1302
1302
|
for (let o = 0; o <= i; o++) {
|
1303
|
-
const c =
|
1303
|
+
const c = St(o, h, u, s), l = n[o] * c;
|
1304
1304
|
r[0] += e[o][0] * l, r[1] += e[o][1] * l, r[2] += e[o][2] * l, a += l;
|
1305
1305
|
}
|
1306
1306
|
if (a < 1e-10) {
|
@@ -1312,34 +1312,34 @@ function xt(u, t, s, e, n) {
|
|
1312
1312
|
}
|
1313
1313
|
return a > 1e-10 && (r[0] /= a, r[1] /= a, r[2] /= a), r;
|
1314
1314
|
}
|
1315
|
-
function
|
1315
|
+
function Ms(u, t, s, e) {
|
1316
1316
|
const n = u, i = t[n], h = t[t.length - n - 1];
|
1317
1317
|
let r = 0;
|
1318
1318
|
const a = 1e3, o = (h - i) / a;
|
1319
|
-
let c =
|
1319
|
+
let c = yt(
|
1320
1320
|
i,
|
1321
1321
|
u,
|
1322
1322
|
t,
|
1323
1323
|
s,
|
1324
1324
|
e
|
1325
1325
|
);
|
1326
|
-
for (let
|
1327
|
-
const
|
1328
|
-
r += Math.sqrt(
|
1326
|
+
for (let y = 1; y <= a; y++) {
|
1327
|
+
const _ = i + y * o, p = yt(_, u, t, s, e), P = p[0] - c[0], w = p[1] - c[1], f = p[2] - c[2];
|
1328
|
+
r += Math.sqrt(P * P + w * w + f * f), c = p;
|
1329
1329
|
}
|
1330
|
-
const l =
|
1330
|
+
const l = yt(
|
1331
1331
|
h,
|
1332
1332
|
u,
|
1333
1333
|
t,
|
1334
1334
|
s,
|
1335
1335
|
e
|
1336
|
-
),
|
1337
|
-
return r += Math.sqrt(
|
1336
|
+
), d = l[0] - c[0], m = l[1] - c[1], x = l[2] - c[2];
|
1337
|
+
return r += Math.sqrt(d * d + m * m + x * x), r;
|
1338
1338
|
}
|
1339
|
-
function
|
1339
|
+
function Is(u) {
|
1340
1340
|
return u.map((t) => [...t]);
|
1341
1341
|
}
|
1342
|
-
class
|
1342
|
+
class zt {
|
1343
1343
|
/**
|
1344
1344
|
* Create one instance of this class
|
1345
1345
|
* @param x Input x coordinate
|
@@ -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 d = i[h + 0], m = i[h + 1], x = i[h + 2], y = 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] = d, t[s + 1] = m, t[s + 2] = x, t[s + 3] = y;
|
1372
1372
|
return;
|
1373
1373
|
}
|
1374
|
-
if (l !==
|
1375
|
-
let
|
1376
|
-
const
|
1377
|
-
if (
|
1378
|
-
const
|
1379
|
-
|
1374
|
+
if (l !== y || a !== d || o !== m || c !== x) {
|
1375
|
+
let _ = 1 - r;
|
1376
|
+
const p = a * d + o * m + c * x + l * y, P = p >= 0 ? 1 : -1, w = 1 - p * p;
|
1377
|
+
if (w > Number.EPSILON) {
|
1378
|
+
const M = Math.sqrt(w), B = Math.atan2(M, p * P);
|
1379
|
+
_ = Math.sin(_ * B) / M, r = Math.sin(r * B) / M;
|
1380
1380
|
}
|
1381
|
-
const
|
1382
|
-
if (a = a *
|
1383
|
-
const
|
1384
|
-
a *=
|
1381
|
+
const f = r * P;
|
1382
|
+
if (a = a * _ + d * f, o = o * _ + m * f, c = c * _ + x * f, l = l * _ + y * f, _ === 1 - r) {
|
1383
|
+
const M = 1 / Math.sqrt(a * a + o * o + c * c + l * l);
|
1384
|
+
a *= M, o *= M, c *= M, l *= M;
|
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], d = i[h + 1], m = i[h + 2], x = i[h + 3];
|
1401
|
+
return t[s] = r * x + c * l + a * m - o * d, t[s + 1] = a * x + c * d + o * l - r * m, t[s + 2] = o * x + c * m + r * d - a * l, t[s + 3] = c * x - r * l - a * d - o * m, t;
|
1402
1402
|
}
|
1403
1403
|
/**
|
1404
1404
|
* X cooridinate
|
@@ -1452,7 +1452,7 @@ class pt {
|
|
1452
1452
|
* @returns Return cloned instance
|
1453
1453
|
*/
|
1454
1454
|
clone() {
|
1455
|
-
return new
|
1455
|
+
return new zt(this._x, this._y, this._z, this._w);
|
1456
1456
|
}
|
1457
1457
|
/**
|
1458
1458
|
* Copy the x, y, z and w properties of q into this quaternion.
|
@@ -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), d = a(e / 2), m = a(n / 2), x = a(i / 2);
|
1473
1473
|
switch (h) {
|
1474
1474
|
case "XYZ":
|
1475
|
-
this._x =
|
1475
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l - d * m * x;
|
1476
1476
|
break;
|
1477
1477
|
case "YXZ":
|
1478
|
-
this._x =
|
1478
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l + d * m * x;
|
1479
1479
|
break;
|
1480
1480
|
case "ZXY":
|
1481
|
-
this._x =
|
1481
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l - d * m * x;
|
1482
1482
|
break;
|
1483
1483
|
case "ZYX":
|
1484
|
-
this._x =
|
1484
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l + d * m * x;
|
1485
1485
|
break;
|
1486
1486
|
case "YZX":
|
1487
|
-
this._x =
|
1487
|
+
this._x = d * c * l + o * m * x, this._y = o * m * l + d * c * x, this._z = o * c * x - d * m * l, this._w = o * c * l - d * m * x;
|
1488
1488
|
break;
|
1489
1489
|
case "XZY":
|
1490
|
-
this._x =
|
1490
|
+
this._x = d * c * l - o * m * x, this._y = o * m * l - d * c * x, this._z = o * c * x + d * m * l, this._w = o * c * l + d * m * 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], d = e + r + l;
|
1517
|
+
if (d > 0) {
|
1518
|
+
const m = 0.5 / Math.sqrt(d + 1);
|
1519
|
+
this._w = 0.25 / m, this._x = (c - a) * m, this._y = (i - o) * m, this._z = (h - n) * m;
|
1520
1520
|
} else if (e > r && e > l) {
|
1521
|
-
const
|
1522
|
-
this._w = (c - a) /
|
1521
|
+
const m = 2 * Math.sqrt(1 + e - r - l);
|
1522
|
+
this._w = (c - a) / m, this._x = 0.25 * m, this._y = (n + h) / m, this._z = (i + o) / m;
|
1523
1523
|
} else if (r > l) {
|
1524
|
-
const
|
1525
|
-
this._w = (i - o) /
|
1524
|
+
const m = 2 * Math.sqrt(1 + r - e - l);
|
1525
|
+
this._w = (i - o) / m, this._x = (n + h) / m, this._y = 0.25 * m, this._z = (a + c) / m;
|
1526
1526
|
} else {
|
1527
|
-
const
|
1528
|
-
this._w = (h - n) /
|
1527
|
+
const m = 2 * Math.sqrt(1 + l - e - r);
|
1528
|
+
this._w = (h - n) / m, this._x = (i + o) / m, this._y = (a + c) / m, this._z = 0.25 * m;
|
1529
1529
|
}
|
1530
1530
|
return this._onChangeCallback(), this;
|
1531
1531
|
}
|
@@ -1545,7 +1545,7 @@ class pt {
|
|
1545
1545
|
* @returns Return the angle between this quaternion and quaternion q in radians.
|
1546
1546
|
*/
|
1547
1547
|
angleTo(t) {
|
1548
|
-
return 2 * Math.acos(Math.abs(
|
1548
|
+
return 2 * Math.acos(Math.abs(X(this.dot(t), -1, 1)));
|
1549
1549
|
}
|
1550
1550
|
/**
|
1551
1551
|
* Rotate this quaternion by a given angular step to the defined quaternion q. The method ensures
|
@@ -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 m = 1 - s;
|
1665
|
+
return this._w = m * h + s * this._w, this._x = m * e + s * this._x, this._y = m * n + s * this._y, this._z = m * 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, d = Math.sin(s * c) / o;
|
1668
|
+
return this._w = h * l + this._w * d, this._x = e * l + this._x * d, this._y = n * l + this._y * d, this._z = i * l + this._z * d, this._onChangeCallback(), this;
|
1669
1669
|
}
|
1670
1670
|
/**
|
1671
1671
|
* Perform a spherical linear interpolation between the given quaternions and stores the result in
|
@@ -1730,7 +1730,7 @@ class pt {
|
|
1730
1730
|
yield this._x, yield this._y, yield this._z, yield this._w;
|
1731
1731
|
}
|
1732
1732
|
}
|
1733
|
-
const
|
1733
|
+
const k = class k {
|
1734
1734
|
/**
|
1735
1735
|
* Vector may be constructed by three points, or by three float numbers,
|
1736
1736
|
* or by array of three numbers
|
@@ -1752,7 +1752,7 @@ const N = class N {
|
|
1752
1752
|
this.x = t, this.y = s, this.z = e;
|
1753
1753
|
return;
|
1754
1754
|
}
|
1755
|
-
throw
|
1755
|
+
throw L.ILLEGAL_PARAMETERS;
|
1756
1756
|
}
|
1757
1757
|
}
|
1758
1758
|
/**
|
@@ -1847,7 +1847,7 @@ const N = class N {
|
|
1847
1847
|
* @returns Return a new vector3 with the same x, y and z values as this one.
|
1848
1848
|
*/
|
1849
1849
|
clone() {
|
1850
|
-
return new
|
1850
|
+
return new k(this.x, this.y, this.z);
|
1851
1851
|
}
|
1852
1852
|
/**
|
1853
1853
|
* Copy the values of the passed vector3's x, y and z properties to this vector3.
|
@@ -1947,7 +1947,7 @@ const N = class N {
|
|
1947
1947
|
* @returns Return this vector
|
1948
1948
|
*/
|
1949
1949
|
applyEuler(t) {
|
1950
|
-
return this.applyQuaternion(
|
1950
|
+
return this.applyQuaternion(Bt.setFromEuler(t));
|
1951
1951
|
}
|
1952
1952
|
/**
|
1953
1953
|
* Apply a rotation specified by an axis and an angle to this vector.
|
@@ -1956,7 +1956,7 @@ const N = class N {
|
|
1956
1956
|
* @returns Return this vector
|
1957
1957
|
*/
|
1958
1958
|
applyAxisAngle(t, s) {
|
1959
|
-
return this.applyQuaternion(
|
1959
|
+
return this.applyQuaternion(Bt.setFromAxisAngle(t, s));
|
1960
1960
|
}
|
1961
1961
|
/**
|
1962
1962
|
* Multipliy this vector by m
|
@@ -2372,9 +2372,9 @@ const N = class N {
|
|
2372
2372
|
yield this.x, yield this.y, yield this.z;
|
2373
2373
|
}
|
2374
2374
|
};
|
2375
|
-
|
2376
|
-
let
|
2377
|
-
const ft = /* @__PURE__ */ new
|
2375
|
+
k.X_AXIS = Object.freeze(new k(1, 0, 0)), k.NEGATIVE_X_AXIS = Object.freeze(new k(-1, 0, 0)), k.Y_AXIS = Object.freeze(new k(0, 1, 0)), k.NEGATIVE_Y_AXIS = Object.freeze(new k(0, -1, 0)), k.Z_AXIS = Object.freeze(new k(0, 0, 1)), k.NEGATIVE_Z_AXIS = Object.freeze(new k(0, 0, -1));
|
2376
|
+
let g = k;
|
2377
|
+
const ft = /* @__PURE__ */ new g(), Bt = /* @__PURE__ */ new zt(), W = class W {
|
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 ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2396
2396
|
* @param n43 Input element in the forth row and the third column
|
2397
2397
|
* @param n44 Input element in the forth row and the forth column
|
2398
2398
|
*/
|
2399
|
-
constructor(t, s, e, n, i, 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, d, m, x, y, _) {
|
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 && d != null && m != null && x != null && y != null && _ != null && this.set(
|
2401
2401
|
t,
|
2402
2402
|
s,
|
2403
2403
|
e,
|
@@ -2409,11 +2409,11 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2409
2409
|
o,
|
2410
2410
|
c,
|
2411
2411
|
l,
|
2412
|
-
m,
|
2413
2412
|
d,
|
2413
|
+
m,
|
2414
2414
|
x,
|
2415
|
-
|
2416
|
-
|
2415
|
+
y,
|
2416
|
+
_
|
2417
2417
|
);
|
2418
2418
|
}
|
2419
2419
|
/**
|
@@ -2437,9 +2437,9 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2437
2437
|
* @param n44 Input element in the forth row and the forth column
|
2438
2438
|
* @returns Return this matrix
|
2439
2439
|
*/
|
2440
|
-
set(t, s, e, n, i, h, r, a, o, c, l,
|
2441
|
-
const
|
2442
|
-
return
|
2440
|
+
set(t, s, e, n, i, h, r, a, o, c, l, d, m, x, y, _) {
|
2441
|
+
const p = this.elements;
|
2442
|
+
return p[0] = t, p[4] = s, p[8] = e, p[12] = n, p[1] = i, p[5] = h, p[9] = r, p[13] = a, p[2] = o, p[6] = c, p[10] = l, p[14] = d, p[3] = m, p[7] = x, p[11] = y, p[15] = _, this;
|
2443
2443
|
}
|
2444
2444
|
/**
|
2445
2445
|
* Reset this matrix to the identity matrix.
|
@@ -2449,7 +2449,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2449
2449
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
|
2450
2450
|
}
|
2451
2451
|
clone() {
|
2452
|
-
return new
|
2452
|
+
return new W().fromArray(this.elements);
|
2453
2453
|
}
|
2454
2454
|
/**
|
2455
2455
|
* Copy the elements of matrix m into this matrix.
|
@@ -2501,11 +2501,11 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2501
2501
|
* @returns Return this matrix
|
2502
2502
|
*/
|
2503
2503
|
setFromExtrusionDirection(t) {
|
2504
|
-
if (
|
2504
|
+
if (Dt.equalPoint3d(t, g.Z_AXIS))
|
2505
2505
|
this.identity();
|
2506
2506
|
else {
|
2507
|
-
const s = new
|
2508
|
-
Math.abs(t.x) < 1 / 64 && Math.abs(t.y) < 1 / 64 ? s.crossVectors(
|
2507
|
+
const s = new g(1, 0, 0);
|
2508
|
+
Math.abs(t.x) < 1 / 64 && Math.abs(t.y) < 1 / 64 ? s.crossVectors(g.Y_AXIS, t).normalize() : s.crossVectors(g.Z_AXIS, t).normalize();
|
2509
2509
|
const e = t.clone().cross(s).normalize();
|
2510
2510
|
this.set(
|
2511
2511
|
s.x,
|
@@ -2571,7 +2571,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2571
2571
|
* @returns Return this matrix
|
2572
2572
|
*/
|
2573
2573
|
extractRotation(t) {
|
2574
|
-
const s = this.elements, e = t.elements, n = 1 /
|
2574
|
+
const s = this.elements, e = t.elements, n = 1 / H.setFromMatrixColumn(t, 0).length(), i = 1 / H.setFromMatrixColumn(t, 1).length(), h = 1 / H.setFromMatrixColumn(t, 2).length();
|
2575
2575
|
return s[0] = e[0] * n, s[1] = e[1] * n, s[2] = e[2] * n, s[3] = 0, s[4] = e[4] * i, s[5] = e[5] * i, s[6] = e[6] * i, s[7] = 0, s[8] = e[8] * h, s[9] = e[9] * h, s[10] = e[10] * h, s[11] = 0, s[12] = 0, s[13] = 0, s[14] = 0, s[15] = 1, this;
|
2576
2576
|
}
|
2577
2577
|
// makeRotationFromEuler(euler) {
|
@@ -2687,7 +2687,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2687
2687
|
* @returns Return this matrix
|
2688
2688
|
*/
|
2689
2689
|
makeRotationFromQuaternion(t) {
|
2690
|
-
return this.compose(
|
2690
|
+
return this.compose(As, t, fs);
|
2691
2691
|
}
|
2692
2692
|
/**
|
2693
2693
|
* Construct a rotation matrix, looking from eye towards target oriented by the up vector.
|
@@ -2698,7 +2698,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2698
2698
|
*/
|
2699
2699
|
lookAt(t, s, e) {
|
2700
2700
|
const n = this.elements;
|
2701
|
-
return
|
2701
|
+
return N.subVectors(t, s), N.lengthSq() === 0 && (N.z = 1), N.normalize(), F.crossVectors(e, N), F.lengthSq() === 0 && (Math.abs(e.z) === 1 ? N.x += 1e-4 : N.z += 1e-4, N.normalize(), F.crossVectors(e, N)), F.normalize(), dt.crossVectors(N, F), n[0] = F.x, n[4] = dt.x, n[8] = N.x, n[1] = F.y, n[5] = dt.y, n[9] = N.y, n[2] = F.z, n[6] = dt.z, n[10] = N.z, this;
|
2702
2702
|
}
|
2703
2703
|
/**
|
2704
2704
|
* Post-multiply this matrix by m.
|
@@ -2723,8 +2723,8 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2723
2723
|
* @returns Return this matrix
|
2724
2724
|
*/
|
2725
2725
|
multiplyMatrices(t, s) {
|
2726
|
-
const e = t.elements, n = s.elements, i = this.elements, 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], d = e[9], m = e[13], x = e[2], y = e[6], _ = e[10], p = e[14], P = e[3], w = e[7], f = e[11], M = e[15], B = n[0], z = n[4], E = n[8], Z = n[12], G = n[1], D = n[5], Q = n[9], nt = n[13], it = n[2], rt = n[6], ht = n[10], ot = n[14], at = n[3], ct = n[7], lt = n[11], ut = n[15];
|
2727
|
+
return i[0] = h * B + r * G + a * it + o * at, i[4] = h * z + r * D + a * rt + o * ct, i[8] = h * E + r * Q + a * ht + o * lt, i[12] = h * Z + r * nt + a * ot + o * ut, i[1] = c * B + l * G + d * it + m * at, i[5] = c * z + l * D + d * rt + m * ct, i[9] = c * E + l * Q + d * ht + m * lt, i[13] = c * Z + l * nt + d * ot + m * ut, i[2] = x * B + y * G + _ * it + p * at, i[6] = x * z + y * D + _ * rt + p * ct, i[10] = x * E + y * Q + _ * ht + p * lt, i[14] = x * Z + y * nt + _ * ot + p * ut, i[3] = P * B + w * G + f * it + M * at, i[7] = P * z + w * D + f * rt + M * ct, i[11] = P * E + w * Q + f * ht + M * lt, i[15] = P * Z + w * nt + f * ot + M * ut, this;
|
2728
2728
|
}
|
2729
2729
|
/**
|
2730
2730
|
* Multiply every component of the matrix by a scalar value s.
|
@@ -2740,8 +2740,8 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2740
2740
|
* @returns Return the determinant of this matrix.
|
2741
2741
|
*/
|
2742
2742
|
determinant() {
|
2743
|
-
const t = this.elements, s = t[0], e = t[4], n = t[8], i = t[12], 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], d = t[10], m = t[14], x = t[3], y = t[7], _ = t[11], p = t[15];
|
2744
|
+
return x * (+i * a * l - n * o * l - i * r * d + e * o * d + n * r * m - e * a * m) + y * (+s * a * m - s * o * d + i * h * d - n * h * m + n * o * c - i * a * c) + _ * (+s * o * l - s * r * m - i * h * l + e * h * m + i * r * c - e * o * c) + p * (-n * r * c - s * a * l + s * r * d + n * h * l - e * h * d + e * a * c);
|
2745
2745
|
}
|
2746
2746
|
/**
|
2747
2747
|
* Transposes this matrix.
|
@@ -2761,7 +2761,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2761
2761
|
*/
|
2762
2762
|
setPosition(t, s, e) {
|
2763
2763
|
const n = this.elements;
|
2764
|
-
return t instanceof
|
2764
|
+
return t instanceof g ? (n[12] = t.x, n[13] = t.y, n[14] = t.z) : (n[12] = t, n[13] = s, n[14] = e), this;
|
2765
2765
|
}
|
2766
2766
|
/**
|
2767
2767
|
* Invert this matrix, using the analytic method. You can not invert with a determinant of zero.
|
@@ -2769,11 +2769,11 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2769
2769
|
* @returns Return this matrix
|
2770
2770
|
*/
|
2771
2771
|
invert() {
|
2772
|
-
const t = this.elements, s = t[0], e = t[1], n = t[2], i = t[3], 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], d = t[10], m = t[11], x = t[12], y = t[13], _ = t[14], p = t[15], P = l * _ * o - y * d * o + y * a * m - r * _ * m - l * a * p + r * d * p, w = x * d * o - c * _ * o - x * a * m + h * _ * m + c * a * p - h * d * p, f = c * y * o - x * l * o + x * r * m - h * y * m - c * r * p + h * l * p, M = x * l * a - c * y * a - x * r * d + h * y * d + c * r * _ - h * l * _, B = s * P + e * w + n * f + i * M;
|
2773
|
+
if (B === 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 z = 1 / B;
|
2776
|
+
return t[0] = P * z, t[1] = (y * d * i - l * _ * i - y * n * m + e * _ * m + l * n * p - e * d * p) * z, t[2] = (r * _ * i - y * a * i + y * n * o - e * _ * o - r * n * p + e * a * p) * z, t[3] = (l * a * i - r * d * i - l * n * o + e * d * o + r * n * m - e * a * m) * z, t[4] = w * z, t[5] = (c * _ * i - x * d * i + x * n * m - s * _ * m - c * n * p + s * d * p) * z, t[6] = (x * a * i - h * _ * i - x * n * o + s * _ * o + h * n * p - s * a * p) * z, t[7] = (h * d * i - c * a * i + c * n * o - s * d * o - h * n * m + s * a * m) * z, t[8] = f * z, t[9] = (x * l * i - c * y * i - x * e * m + s * y * m + c * e * p - s * l * p) * z, t[10] = (h * y * i - x * r * i + x * e * o - s * y * o - h * e * p + s * r * p) * z, t[11] = (c * r * i - h * l * i - c * e * o + s * l * o + h * e * m - s * r * m) * z, t[12] = M * z, t[13] = (c * y * n - x * l * n + x * e * d - s * y * d - c * e * _ + s * l * _) * z, t[14] = (x * r * n - h * y * n - x * e * a + s * y * a + h * e * _ - s * r * _) * z, t[15] = (h * l * n - c * r * n + c * e * a - s * l * a - h * e * d + s * r * d) * z, this;
|
2777
2777
|
}
|
2778
2778
|
/**
|
2779
2779
|
* Multiply the columns of this matrix by vector v.
|
@@ -2800,7 +2800,7 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2800
2800
|
* @returns Return this matrix
|
2801
2801
|
*/
|
2802
2802
|
makeTranslation(t, s, e) {
|
2803
|
-
return t instanceof
|
2803
|
+
return t instanceof g ? this.set(1, 0, 0, t.x, 0, 1, 0, t.y, 0, 0, 1, t.z, 0, 0, 0, 1) : this.set(1, 0, 0, t, 0, 1, 0, s, 0, 0, 1, e, 0, 0, 0, 1), this;
|
2804
2804
|
}
|
2805
2805
|
/**
|
2806
2806
|
* Set this matrix as a rotational transformation around the X axis by theta (θ) radians.
|
@@ -2887,8 +2887,8 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2887
2887
|
* @returns Return this matrix
|
2888
2888
|
*/
|
2889
2889
|
compose(t, s, e) {
|
2890
|
-
const n = this.elements, i = s.x, h = s.y, r = s.z, a = s.w, o = i + i, c = h + h, l = r + r,
|
2891
|
-
return n[0] = (1 - (
|
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, d = i * o, m = i * c, x = i * l, y = h * c, _ = h * l, p = r * l, P = a * o, w = a * c, f = a * l, M = e.x, B = e.y, z = e.z;
|
2891
|
+
return n[0] = (1 - (y + p)) * M, n[1] = (m + f) * M, n[2] = (x - w) * M, n[3] = 0, n[4] = (m - f) * B, n[5] = (1 - (d + p)) * B, n[6] = (_ + P) * B, n[7] = 0, n[8] = (x + w) * z, n[9] = (_ - P) * z, n[10] = (1 - (d + y)) * z, 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.
|
@@ -2903,11 +2903,11 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
2903
2903
|
*/
|
2904
2904
|
decompose(t, s, e) {
|
2905
2905
|
const n = this.elements;
|
2906
|
-
let i =
|
2907
|
-
const h =
|
2908
|
-
this.determinant() < 0 && (i = -i), t.x = n[12], t.y = n[13], t.z = n[14],
|
2906
|
+
let i = H.set(n[0], n[1], n[2]).length();
|
2907
|
+
const h = H.set(n[4], n[5], n[6]).length(), r = H.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], T.copy(this);
|
2909
2909
|
const o = 1 / i, c = 1 / h, l = 1 / r;
|
2910
|
-
return
|
2910
|
+
return T.elements[0] *= o, T.elements[1] *= o, T.elements[2] *= o, T.elements[4] *= c, T.elements[5] *= c, T.elements[6] *= c, T.elements[8] *= l, T.elements[9] *= l, T.elements[10] *= l, s.setFromRotationMatrix(T), e.x = i, e.y = h, e.z = r, this;
|
2911
2911
|
}
|
2912
2912
|
// makePerspective(
|
2913
2913
|
// left,
|
@@ -3033,10 +3033,10 @@ const ft = /* @__PURE__ */ new y(), Ct = /* @__PURE__ */ new pt(), $ = class $ {
|
|
3033
3033
|
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;
|
3034
3034
|
}
|
3035
3035
|
};
|
3036
|
-
|
3037
|
-
let tt =
|
3038
|
-
const
|
3039
|
-
class
|
3036
|
+
W.IDENTITY = Object.freeze(new W());
|
3037
|
+
let tt = W;
|
3038
|
+
const H = /* @__PURE__ */ new g(), T = /* @__PURE__ */ new tt(), As = /* @__PURE__ */ new g(0, 0, 0), fs = /* @__PURE__ */ new g(1, 1, 1), F = /* @__PURE__ */ new g(), dt = /* @__PURE__ */ new g(), N = /* @__PURE__ */ new g();
|
3039
|
+
class j {
|
3040
3040
|
/**
|
3041
3041
|
* Create a 3d box bounded by min and max.
|
3042
3042
|
* @param min (optional) Input the lower (x, y, z) boundary of the box.
|
@@ -3045,7 +3045,7 @@ class Y {
|
|
3045
3045
|
* Set it to ( - Infinity, - Infinity, - Infinity ) if undefined or null provided.
|
3046
3046
|
*/
|
3047
3047
|
constructor(t = void 0, s = void 0) {
|
3048
|
-
this.min = t == null ? new
|
3048
|
+
this.min = t == null ? new g(1 / 0, 1 / 0, 1 / 0) : new g(t.x, t.y, t.z), this.max = s == null ? new g(-1 / 0, -1 / 0, -1 / 0) : new g(s.x, s.y, s.z);
|
3049
3049
|
}
|
3050
3050
|
/**
|
3051
3051
|
* Set the lower and upper (x, y, z) boundaries of this box.
|
@@ -3094,7 +3094,7 @@ class Y {
|
|
3094
3094
|
* @returns Return a new box with the same min and max as this one.
|
3095
3095
|
*/
|
3096
3096
|
clone() {
|
3097
|
-
return new
|
3097
|
+
return new j().copy(this);
|
3098
3098
|
}
|
3099
3099
|
/**
|
3100
3100
|
* Copy the min and max from box to this box.
|
@@ -3139,13 +3139,13 @@ class Y {
|
|
3139
3139
|
* Center point of this box
|
3140
3140
|
*/
|
3141
3141
|
get center() {
|
3142
|
-
return this.isEmpty() ? new
|
3142
|
+
return this.isEmpty() ? new g(0, 0, 0) : new g(0, 0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
|
3143
3143
|
}
|
3144
3144
|
/**
|
3145
3145
|
* Return the width, height and depth of this box.
|
3146
3146
|
*/
|
3147
3147
|
get size() {
|
3148
|
-
return this.isEmpty() ? new
|
3148
|
+
return this.isEmpty() ? new g(0, 0, 0) : new g(0, 0, 0).subVectors(this.max, this.min);
|
3149
3149
|
}
|
3150
3150
|
/**
|
3151
3151
|
* Expand the boundaries of this box to include point.
|
@@ -3264,7 +3264,7 @@ class Y {
|
|
3264
3264
|
* @returns Return this box
|
3265
3265
|
*/
|
3266
3266
|
applyMatrix4(t) {
|
3267
|
-
return this.isEmpty() ? this : (
|
3267
|
+
return this.isEmpty() ? this : (V[0].set(this.min.x, this.min.y, this.min.z).applyMatrix3d(t), V[1].set(this.min.x, this.min.y, this.max.z).applyMatrix3d(t), V[2].set(this.min.x, this.max.y, this.min.z).applyMatrix3d(t), V[3].set(this.min.x, this.max.y, this.max.z).applyMatrix3d(t), V[4].set(this.max.x, this.min.y, this.min.z).applyMatrix3d(t), V[5].set(this.max.x, this.min.y, this.max.z).applyMatrix3d(t), V[6].set(this.max.x, this.max.y, this.min.z).applyMatrix3d(t), V[7].set(this.max.x, this.max.y, this.max.z).applyMatrix3d(t), this.setFromPoints(V), this);
|
3268
3268
|
}
|
3269
3269
|
/**
|
3270
3270
|
* Add offset to both the upper and lower bounds of this box, effectively moving this box offset units
|
@@ -3284,17 +3284,17 @@ class Y {
|
|
3284
3284
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
3285
3285
|
}
|
3286
3286
|
}
|
3287
|
-
const
|
3288
|
-
/* @__PURE__ */ new
|
3289
|
-
/* @__PURE__ */ new
|
3290
|
-
/* @__PURE__ */ new
|
3291
|
-
/* @__PURE__ */ new
|
3292
|
-
/* @__PURE__ */ new
|
3293
|
-
/* @__PURE__ */ new
|
3294
|
-
/* @__PURE__ */ new
|
3295
|
-
/* @__PURE__ */ new
|
3296
|
-
], wt = /* @__PURE__ */ new
|
3297
|
-
class
|
3287
|
+
const V = [
|
3288
|
+
/* @__PURE__ */ new g(),
|
3289
|
+
/* @__PURE__ */ new g(),
|
3290
|
+
/* @__PURE__ */ new g(),
|
3291
|
+
/* @__PURE__ */ new g(),
|
3292
|
+
/* @__PURE__ */ new g(),
|
3293
|
+
/* @__PURE__ */ new g(),
|
3294
|
+
/* @__PURE__ */ new g(),
|
3295
|
+
/* @__PURE__ */ new g()
|
3296
|
+
], wt = /* @__PURE__ */ new g(), It = /* @__PURE__ */ new b();
|
3297
|
+
class U {
|
3298
3298
|
/**
|
3299
3299
|
* Create a 2d box bounded by min and max.
|
3300
3300
|
* @param min (optional) Input 2d vector representing the lower (x, y) boundary of the box.
|
@@ -3303,7 +3303,7 @@ class V {
|
|
3303
3303
|
* Set it to ( - Infinity, - Infinity ) if undefined or null provided.
|
3304
3304
|
*/
|
3305
3305
|
constructor(t = void 0, s = void 0) {
|
3306
|
-
this.min = t == null ? new
|
3306
|
+
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);
|
3307
3307
|
}
|
3308
3308
|
/**
|
3309
3309
|
* Set the lower and upper (x, y) boundaries of this box.
|
@@ -3333,7 +3333,7 @@ class V {
|
|
3333
3333
|
* @returns Return this box
|
3334
3334
|
*/
|
3335
3335
|
setFromCenterAndSize(t, s) {
|
3336
|
-
const e =
|
3336
|
+
const e = It.copy(s).multiplyScalar(0.5);
|
3337
3337
|
return this.min.copy(t).sub(e), this.max.copy(t).add(e), this;
|
3338
3338
|
}
|
3339
3339
|
/**
|
@@ -3341,7 +3341,7 @@ class V {
|
|
3341
3341
|
* @returns Return a new 2d box with the same min and max as this one.
|
3342
3342
|
*/
|
3343
3343
|
clone() {
|
3344
|
-
return new
|
3344
|
+
return new U().copy(this);
|
3345
3345
|
}
|
3346
3346
|
/**
|
3347
3347
|
* Copy the min and max from box to this box.
|
@@ -3386,13 +3386,13 @@ class V {
|
|
3386
3386
|
* Center point of this box
|
3387
3387
|
*/
|
3388
3388
|
get center() {
|
3389
|
-
return this.isEmpty() ? new
|
3389
|
+
return this.isEmpty() ? new b(0, 0) : new b(0, 0).addVectors(this.min, this.max).multiplyScalar(0.5);
|
3390
3390
|
}
|
3391
3391
|
/**
|
3392
3392
|
* Return the width, height and depth of this box.
|
3393
3393
|
*/
|
3394
3394
|
get size() {
|
3395
|
-
return this.isEmpty() ? new
|
3395
|
+
return this.isEmpty() ? new b(0, 0) : new b(0, 0).subVectors(this.max, this.min);
|
3396
3396
|
}
|
3397
3397
|
/**
|
3398
3398
|
* Expand the boundaries of this box to include point.
|
@@ -3473,7 +3473,7 @@ class V {
|
|
3473
3473
|
* @returns Return the distance from any edge of this box to the specified point.
|
3474
3474
|
*/
|
3475
3475
|
distanceToPoint(t) {
|
3476
|
-
return this.clampPoint(t,
|
3476
|
+
return this.clampPoint(t, It).distanceTo(t);
|
3477
3477
|
}
|
3478
3478
|
/**
|
3479
3479
|
* Return the intersection of this and box, setting the upper bound of this box to the lesser of the
|
@@ -3511,7 +3511,7 @@ class V {
|
|
3511
3511
|
return t.min.equals(this.min) && t.max.equals(this.max);
|
3512
3512
|
}
|
3513
3513
|
}
|
3514
|
-
const
|
3514
|
+
const Et = /* @__PURE__ */ new g(), ws = /* @__PURE__ */ new g(), Ps = /* @__PURE__ */ new v();
|
3515
3515
|
class Mt {
|
3516
3516
|
/**
|
3517
3517
|
* Create one plane
|
@@ -3519,7 +3519,7 @@ class Mt {
|
|
3519
3519
|
* Default is (1, 0, 0).
|
3520
3520
|
* @param constant (optional) Input the signed distance from the origin to the plane. Default is 0.
|
3521
3521
|
*/
|
3522
|
-
constructor(t = new
|
3522
|
+
constructor(t = new g(1, 0, 0), s = 0) {
|
3523
3523
|
this.normal = t, this.constant = s;
|
3524
3524
|
}
|
3525
3525
|
/**
|
@@ -3560,7 +3560,7 @@ class Mt {
|
|
3560
3560
|
* @returns Return this plane
|
3561
3561
|
*/
|
3562
3562
|
setFromCoplanarPoints(t, s, e) {
|
3563
|
-
const n =
|
3563
|
+
const n = Et.subVectors(e, s).cross(ws.subVectors(t, s)).normalize();
|
3564
3564
|
return this.setFromNormalAndCoplanarPoint(n, t), this;
|
3565
3565
|
}
|
3566
3566
|
/**
|
@@ -3662,7 +3662,7 @@ class Mt {
|
|
3662
3662
|
* @returns Return this plane
|
3663
3663
|
*/
|
3664
3664
|
applyMatrix4(t, s) {
|
3665
|
-
const e = s ||
|
3665
|
+
const e = s || Ps.getNormalMatrix(t), n = this.coplanarPoint(Et).applyMatrix3d(t), i = this.normal.applyMatrix3(e).normalize();
|
3666
3666
|
return this.constant = -n.dot(i), this;
|
3667
3667
|
}
|
3668
3668
|
/**
|
@@ -3690,7 +3690,7 @@ class Mt {
|
|
3690
3690
|
return new Mt().copy(this);
|
3691
3691
|
}
|
3692
3692
|
}
|
3693
|
-
class
|
3693
|
+
class S extends b {
|
3694
3694
|
/**
|
3695
3695
|
* Convert one point array to one number array
|
3696
3696
|
* @param array Input one point array
|
@@ -3703,7 +3703,7 @@ class b extends P {
|
|
3703
3703
|
}), s;
|
3704
3704
|
}
|
3705
3705
|
}
|
3706
|
-
class
|
3706
|
+
class A extends g {
|
3707
3707
|
/**
|
3708
3708
|
* Convert one point array to one number array
|
3709
3709
|
* @param array Input one point array
|
@@ -3717,7 +3717,7 @@ class B extends y {
|
|
3717
3717
|
}), n;
|
3718
3718
|
}
|
3719
3719
|
}
|
3720
|
-
const
|
3720
|
+
const Rt = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new zt(), J = class J {
|
3721
3721
|
/**
|
3722
3722
|
* Create one instance of this class
|
3723
3723
|
* @param x (optional) the angle of the x axis in radians. Default is 0.
|
@@ -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], d = n[6], m = n[10];
|
3813
3813
|
switch (s) {
|
3814
3814
|
case "XYZ":
|
3815
|
-
this._y = Math.asin(
|
3815
|
+
this._y = Math.asin(X(r, -1, 1)), Math.abs(r) < 0.9999999 ? (this._x = Math.atan2(-c, m), this._z = Math.atan2(-h, i)) : (this._x = Math.atan2(d, o), this._z = 0);
|
3816
3816
|
break;
|
3817
3817
|
case "YXZ":
|
3818
|
-
this._x = Math.asin(-
|
3818
|
+
this._x = Math.asin(-X(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._y = Math.atan2(r, m), 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(
|
3821
|
+
this._x = Math.asin(X(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(-l, m), 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(-
|
3824
|
+
this._y = Math.asin(-X(l, -1, 1)), Math.abs(l) < 0.9999999 ? (this._x = Math.atan2(d, m), 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(
|
3827
|
+
this._z = Math.asin(X(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, m));
|
3828
3828
|
break;
|
3829
3829
|
case "XZY":
|
3830
|
-
this._z = Math.asin(-
|
3830
|
+
this._z = Math.asin(-X(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(d, o), this._y = Math.atan2(r, i)) : (this._x = Math.atan2(-c, m), this._y = 0);
|
3831
3831
|
break;
|
3832
3832
|
default:
|
3833
3833
|
console.warn(
|
@@ -3846,7 +3846,7 @@ const Et = /* @__PURE__ */ new tt(), kt = /* @__PURE__ */ new pt(), J = class J
|
|
3846
3846
|
* @returns Return this euler
|
3847
3847
|
*/
|
3848
3848
|
setFromQuaternion(t, s, e = !0) {
|
3849
|
-
return
|
3849
|
+
return Rt.makeRotationFromQuaternion(t), this.setFromRotationMatrix(Rt, s, e);
|
3850
3850
|
}
|
3851
3851
|
/**
|
3852
3852
|
* Set the x, y and z, and optionally update the order.
|
@@ -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 Zt {
|
3915
3915
|
constructor() {
|
3916
3916
|
this._boundingBoxNeedsUpdate = !1;
|
3917
3917
|
}
|
@@ -3923,7 +3923,7 @@ class Yt {
|
|
3923
3923
|
return this._boundingBoxNeedsUpdate;
|
3924
3924
|
}
|
3925
3925
|
}
|
3926
|
-
class
|
3926
|
+
class Gt extends Zt {
|
3927
3927
|
/**
|
3928
3928
|
* Return new shape translated by given vector.
|
3929
3929
|
*/
|
@@ -3939,7 +3939,7 @@ class Zt extends Yt {
|
|
3939
3939
|
return (this._box == null || this._boundingBoxNeedsUpdate) && (this._box = this.calculateBoundingBox(), this._boundingBoxNeedsUpdate = !1), this._box;
|
3940
3940
|
}
|
3941
3941
|
}
|
3942
|
-
class
|
3942
|
+
class Es extends Gt {
|
3943
3943
|
/**
|
3944
3944
|
* Create one 2d area defined by one outter loop and multiple inner loops
|
3945
3945
|
*/
|
@@ -3972,7 +3972,7 @@ class Cs extends Zt {
|
|
3972
3972
|
*/
|
3973
3973
|
calculateBoundingBox() {
|
3974
3974
|
const t = this.outter;
|
3975
|
-
return t ? t.box : new
|
3975
|
+
return t ? t.box : new U();
|
3976
3976
|
}
|
3977
3977
|
/**
|
3978
3978
|
* @inheritdoc
|
@@ -4004,18 +4004,18 @@ class Cs extends Zt {
|
|
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 d = a + 1;
|
4008
|
+
for (; d < i; d++) {
|
4009
|
+
const m = e[d], x = t[m];
|
4010
|
+
if (s[m].containsBox(l) && gs.isPointInPolygon(
|
4011
|
+
c[C.randInt(0, c.length - 1)],
|
4012
4012
|
x
|
4013
4013
|
)) {
|
4014
|
-
(r = n.get(
|
4014
|
+
(r = n.get(m)) == null || r.children.push(n.get(o));
|
4015
4015
|
break;
|
4016
4016
|
}
|
4017
4017
|
}
|
4018
|
-
|
4018
|
+
d === i && h.children.push(n.get(o));
|
4019
4019
|
}
|
4020
4020
|
return h;
|
4021
4021
|
}
|
@@ -4027,7 +4027,7 @@ class Cs extends Zt {
|
|
4027
4027
|
calculateBoundaryBoxes(t) {
|
4028
4028
|
const s = [];
|
4029
4029
|
return t.forEach((e) => {
|
4030
|
-
s.push(new
|
4030
|
+
s.push(new U().setFromPoints(e));
|
4031
4031
|
}), s;
|
4032
4032
|
}
|
4033
4033
|
/**
|
@@ -4050,7 +4050,7 @@ class Cs extends Zt {
|
|
4050
4050
|
}), e;
|
4051
4051
|
}
|
4052
4052
|
}
|
4053
|
-
class st extends
|
4053
|
+
class st extends Gt {
|
4054
4054
|
constructor() {
|
4055
4055
|
super(), this.arcLengthDivisions = 100;
|
4056
4056
|
}
|
@@ -4156,8 +4156,8 @@ class st extends Zt {
|
|
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], d = e[n + 1] - c, m = (h - c) / d;
|
4160
|
+
return (n + m) / (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,
|
@@ -4169,7 +4169,7 @@ class st extends Zt {
|
|
4169
4169
|
getTangent(t) {
|
4170
4170
|
let e = t - 1e-4, n = t + 1e-4;
|
4171
4171
|
e < 0 && (e = 0), n > 1 && (n = 1);
|
4172
|
-
const i = this.getPoint(e), h = this.getPoint(n), r = new
|
4172
|
+
const i = this.getPoint(e), h = this.getPoint(n), r = new S();
|
4173
4173
|
return r.copy(h).sub(i).normalize(), r;
|
4174
4174
|
}
|
4175
4175
|
/**
|
@@ -4184,7 +4184,7 @@ class st extends Zt {
|
|
4184
4184
|
return this.getTangent(s);
|
4185
4185
|
}
|
4186
4186
|
}
|
4187
|
-
class
|
4187
|
+
class _t extends st {
|
4188
4188
|
constructor(t, s, e, n, i) {
|
4189
4189
|
super();
|
4190
4190
|
const h = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0) + +(i !== void 0);
|
@@ -4200,9 +4200,9 @@ class gt extends st {
|
|
4200
4200
|
);
|
4201
4201
|
else if (h == 5) {
|
4202
4202
|
const r = t;
|
4203
|
-
this.center = new
|
4203
|
+
this.center = new S(r.x, r.y), this.radius = s, this.startAngle = e, this.endAngle = n, this.clockwise = i;
|
4204
4204
|
} else
|
4205
|
-
throw
|
4205
|
+
throw L.ILLEGAL_PARAMETERS;
|
4206
4206
|
}
|
4207
4207
|
/**
|
4208
4208
|
* Create arc by three points
|
@@ -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
|
4219
|
-
return { x:
|
4220
|
-
}, x = r.y - l * r.x,
|
4221
|
-
Math.pow(t.x -
|
4222
|
-
),
|
4223
|
-
this.center =
|
4214
|
+
const n = (z, E) => ({
|
4215
|
+
x: (z.x + E.x) / 2,
|
4216
|
+
y: (z.y + E.y) / 2
|
4217
|
+
}), i = (z, E) => (E.y - z.y) / (E.x - z.x), h = (z) => -1 / z, r = n(t, s), a = n(s, e), o = i(t, s), c = i(s, e), l = h(o), d = h(c), m = (z, E, Z, G) => {
|
4218
|
+
const D = (G - E) / (z - Z), Q = z * D + E;
|
4219
|
+
return { x: D, y: Q };
|
4220
|
+
}, x = r.y - l * r.x, y = a.y - d * a.x, _ = m(l, x, d, y), p = Math.sqrt(
|
4221
|
+
Math.pow(t.x - _.x, 2) + Math.pow(t.y - _.y, 2)
|
4222
|
+
), P = (z, E) => Math.atan2(z.y - E.y, z.x - E.x), w = P(t, _), f = P(s, _), M = P(e, _), B = M > w && M < f || w > M && w < f || f > M && f < w;
|
4223
|
+
this.center = _, this.radius = p, this.startAngle = w, this.endAngle = M, this.clockwise = !B;
|
4224
4224
|
}
|
4225
4225
|
/**
|
4226
4226
|
* Create circular arc by two points and one bugle factor
|
@@ -4235,23 +4235,23 @@ class gt extends st {
|
|
4235
4235
|
*/
|
4236
4236
|
createByStartEndPointsAndBulge(t, s, e) {
|
4237
4237
|
let n, i, h;
|
4238
|
-
e < 0 ? (n = Math.atan(-e) * 4, i = new
|
4239
|
-
const r = new
|
4240
|
-
let
|
4238
|
+
e < 0 ? (n = Math.atan(-e) * 4, i = new b(t), h = new b(s)) : (n = Math.atan(e) * 4, i = new b(s), h = new b(t));
|
4239
|
+
const r = new b().subVectors(h, i), a = r.length(), o = new b().addVectors(i, r.multiplyScalar(0.5)), c = Math.abs(a / 2 / Math.tan(n / 2)), l = r.normalize();
|
4240
|
+
let d;
|
4241
4241
|
if (n < Math.PI) {
|
4242
|
-
const
|
4242
|
+
const m = new b(
|
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
|
+
d = o.add(m.multiplyScalar(-c));
|
4247
4247
|
} else {
|
4248
|
-
const
|
4248
|
+
const m = new b(
|
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
|
+
d = o.add(m.multiplyScalar(c));
|
4253
4253
|
}
|
4254
|
-
e < 0 ? (this.startAngle = Math.atan2(i.y -
|
4254
|
+
e < 0 ? (this.startAngle = Math.atan2(i.y - d.y, i.x - d.x), this.endAngle = Math.atan2(h.y - d.y, h.x - d.x)) : (this.startAngle = Math.atan2(h.y - d.y, h.x - d.x), this.endAngle = Math.atan2(i.y - d.y, i.x - d.x)), this.clockwise = e < 0, this.center = d, this.radius = h.sub(d).length();
|
4255
4255
|
}
|
4256
4256
|
/**
|
4257
4257
|
* Center of circular arc
|
@@ -4260,7 +4260,7 @@ class gt extends st {
|
|
4260
4260
|
return this._center;
|
4261
4261
|
}
|
4262
4262
|
set center(t) {
|
4263
|
-
this._center = new
|
4263
|
+
this._center = new S(t.x, t.y), this._boundingBoxNeedsUpdate = !0;
|
4264
4264
|
}
|
4265
4265
|
/**
|
4266
4266
|
* Radius 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 = C.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 : C.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 ? C.normalizeAngle(this.startAngle - this.endAngle) : C.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 = C.normalizeAngle(
|
4324
4324
|
(this.startAngle + this.endAngle) / 2
|
4325
4325
|
);
|
4326
4326
|
return this.getPointAtAngle(t);
|
@@ -4337,16 +4337,16 @@ 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
|
+
C.isBetweenAngle(
|
4341
4341
|
i,
|
4342
4342
|
this.startAngle,
|
4343
4343
|
this.endAngle,
|
4344
4344
|
this.clockwise
|
4345
4345
|
) && t.push(this.getPointAtAngle(i));
|
4346
4346
|
const e = t.map((i) => i.x), n = t.map((i) => i.y);
|
4347
|
-
return new
|
4348
|
-
new
|
4349
|
-
new
|
4347
|
+
return new U(
|
4348
|
+
new S(Math.min(...e), Math.min(...n)),
|
4349
|
+
new S(Math.max(...e), Math.max(...n))
|
4350
4350
|
);
|
4351
4351
|
}
|
4352
4352
|
/**
|
@@ -4365,7 +4365,7 @@ class gt extends st {
|
|
4365
4365
|
* @inheritdoc
|
4366
4366
|
*/
|
4367
4367
|
clone() {
|
4368
|
-
return new
|
4368
|
+
return new _t(
|
4369
4369
|
this.center.clone(),
|
4370
4370
|
this.radius,
|
4371
4371
|
this.startAngle,
|
@@ -4380,7 +4380,7 @@ class gt extends st {
|
|
4380
4380
|
*/
|
4381
4381
|
getPointAtAngle(t) {
|
4382
4382
|
const s = this.center.x + this.radius * Math.cos(t), e = this.center.y + this.radius * Math.sin(t);
|
4383
|
-
return new
|
4383
|
+
return new S(s, e);
|
4384
4384
|
}
|
4385
4385
|
/**
|
4386
4386
|
* Divide this arc into the specified nubmer of points and return those points as an array of points.
|
@@ -4393,17 +4393,17 @@ class gt extends st {
|
|
4393
4393
|
if (this.closed && (e = I, n = 0), this.clockwise)
|
4394
4394
|
for (let i = 0; i <= t; i++) {
|
4395
4395
|
const h = n - e * (i / t), r = this.getPointAtAngle(h);
|
4396
|
-
s.push(new
|
4396
|
+
s.push(new S(r.x, r.y));
|
4397
4397
|
}
|
4398
4398
|
else
|
4399
4399
|
for (let i = 0; i <= t; i++) {
|
4400
4400
|
const h = n + e * (i / t), r = this.getPointAtAngle(h);
|
4401
|
-
s.push(new
|
4401
|
+
s.push(new S(r.x, r.y));
|
4402
4402
|
}
|
4403
4403
|
return s;
|
4404
4404
|
}
|
4405
4405
|
}
|
4406
|
-
class
|
4406
|
+
class bs extends Zt {
|
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 Yt {
|
|
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 et extends bs {
|
4424
4424
|
}
|
4425
|
-
class
|
4425
|
+
class pt extends et {
|
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 A(t), this._end = new A(s);
|
4432
4432
|
}
|
4433
4433
|
/**
|
4434
4434
|
* The line's startpoint in WCS coordinates
|
@@ -4452,13 +4452,13 @@ class _t extends zt {
|
|
4452
4452
|
* Normalized direction vector of this line
|
4453
4453
|
*/
|
4454
4454
|
get direction() {
|
4455
|
-
return new
|
4455
|
+
return new g().subVectors(this.endPoint, this.startPoint).normalize();
|
4456
4456
|
}
|
4457
4457
|
/**
|
4458
4458
|
* The middle point of this line.
|
4459
4459
|
*/
|
4460
4460
|
get midPoint() {
|
4461
|
-
return new
|
4461
|
+
return new A(
|
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
|
@@ -4497,11 +4497,11 @@ class _t extends zt {
|
|
4497
4497
|
*/
|
4498
4498
|
atLength(t, s = !1) {
|
4499
4499
|
if (s) {
|
4500
|
-
const e = this.delta(
|
4501
|
-
return new
|
4500
|
+
const e = this.delta(Y).normalize();
|
4501
|
+
return new A(this._start).addScaledVector(e, t);
|
4502
4502
|
} else {
|
4503
|
-
const e = this.delta(
|
4504
|
-
return new
|
4503
|
+
const e = this.delta(Y).normalize();
|
4504
|
+
return new A(this._end).addScaledVector(e, t);
|
4505
4505
|
}
|
4506
4506
|
}
|
4507
4507
|
/**
|
@@ -4513,14 +4513,14 @@ class _t extends zt {
|
|
4513
4513
|
*/
|
4514
4514
|
extend(t, s = !1) {
|
4515
4515
|
if (s) {
|
4516
|
-
const e =
|
4517
|
-
this._start = new
|
4516
|
+
const e = Y.subVectors(this._start, this._end).normalize();
|
4517
|
+
this._start = new A(this._start).addScaledVector(
|
4518
4518
|
e,
|
4519
4519
|
t
|
4520
4520
|
);
|
4521
4521
|
} else {
|
4522
|
-
const e = this.delta(
|
4523
|
-
this._end = new
|
4522
|
+
const e = this.delta(Y).normalize();
|
4523
|
+
this._end = new A(this._end).addScaledVector(e, t);
|
4524
4524
|
}
|
4525
4525
|
return this._boundingBoxNeedsUpdate = !0, this;
|
4526
4526
|
}
|
@@ -4532,10 +4532,10 @@ class _t extends zt {
|
|
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
|
-
|
4536
|
-
const e =
|
4537
|
-
let i =
|
4538
|
-
return s && (i =
|
4535
|
+
Tt.subVectors(t, this._start), mt.subVectors(this.endPoint, this.startPoint);
|
4536
|
+
const e = mt.dot(mt);
|
4537
|
+
let i = mt.dot(Tt) / e;
|
4538
|
+
return s && (i = C.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
|
@@ -4577,8 +4577,8 @@ class _t extends zt {
|
|
4577
4577
|
* Project a 3d point onto this line
|
4578
4578
|
*/
|
4579
4579
|
project(t) {
|
4580
|
-
const s = this.direction, n =
|
4581
|
-
return new
|
4580
|
+
const s = this.direction, n = Y.subVectors(t, this.startPoint).dot(s);
|
4581
|
+
return new A().copy(s).multiplyScalar(n).add(this.startPoint);
|
4582
4582
|
}
|
4583
4583
|
/**
|
4584
4584
|
* Finds the point on the line that is perpendicular to the given point. When you need the shortest distance
|
@@ -4588,23 +4588,23 @@ class _t extends zt {
|
|
4588
4588
|
* @returns Return the point on the line that is the closest to the given point.
|
4589
4589
|
*/
|
4590
4590
|
perpPoint(t) {
|
4591
|
-
const s = this.direction, e = this.startPoint, i =
|
4592
|
-
return new
|
4591
|
+
const s = this.direction, e = this.startPoint, i = Y.subVectors(t, e).dot(s), h = Y.copy(s).multiplyScalar(i);
|
4592
|
+
return new A().addVectors(e, h);
|
4593
4593
|
}
|
4594
4594
|
/**
|
4595
4595
|
* @inheritdoc
|
4596
4596
|
*/
|
4597
4597
|
calculateBoundingBox() {
|
4598
|
-
const t = new
|
4598
|
+
const t = new A(
|
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 A(
|
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)
|
4606
4606
|
);
|
4607
|
-
return new
|
4607
|
+
return new j(t, s);
|
4608
4608
|
}
|
4609
4609
|
/**
|
4610
4610
|
* @inheritdoc
|
@@ -4628,11 +4628,11 @@ class _t extends zt {
|
|
4628
4628
|
* @inheritdoc
|
4629
4629
|
*/
|
4630
4630
|
clone() {
|
4631
|
-
return new
|
4631
|
+
return new pt(this._start.clone(), this._end.clone());
|
4632
4632
|
}
|
4633
4633
|
}
|
4634
|
-
const
|
4635
|
-
class
|
4634
|
+
const Y = /* @__PURE__ */ new g(), Tt = /* @__PURE__ */ new g(), mt = /* @__PURE__ */ new g();
|
4635
|
+
class gt extends et {
|
4636
4636
|
/**
|
4637
4637
|
* Compute center point of the arc given three points
|
4638
4638
|
* @param startPoint Input start point of the arc
|
@@ -4641,11 +4641,11 @@ class yt extends zt {
|
|
4641
4641
|
* @returns Return center point of the arc
|
4642
4642
|
*/
|
4643
4643
|
static computeCenterPoint(t, s, e) {
|
4644
|
-
const n = new
|
4644
|
+
const n = new g().addVectors(t, s).multiplyScalar(0.5), i = new g().addVectors(t, e).multiplyScalar(0.5), h = new g().subVectors(s, t), r = new g().subVectors(e, t), a = new g().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
|
4648
|
-
return
|
4647
|
+
const o = new g().crossVectors(h, a).normalize(), c = new g().crossVectors(r, a).normalize(), l = o.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), d = c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER), m = new pt(n, n.clone().add(l)), x = new pt(i, i.clone().add(d)), y = new g();
|
4648
|
+
return m.closestPointToPoint(x.startPoint, !0, y) ? y : (console.error("Cannot find a valid center for the arc."), null);
|
4649
4649
|
}
|
4650
4650
|
/**
|
4651
4651
|
* Create arc by three points
|
@@ -4654,19 +4654,19 @@ class yt extends zt {
|
|
4654
4654
|
* @param pointOnArc Input one point between the start point and the end point
|
4655
4655
|
*/
|
4656
4656
|
static createByThreePoints(t, s, e) {
|
4657
|
-
const n =
|
4657
|
+
const n = gt.computeCenterPoint(
|
4658
4658
|
t,
|
4659
4659
|
s,
|
4660
4660
|
e
|
4661
4661
|
);
|
4662
4662
|
if (n) {
|
4663
|
-
const i = n.distanceTo(t), h = new
|
4664
|
-
return new
|
4663
|
+
const i = n.distanceTo(t), h = new g().subVectors(t, n), r = new g().subVectors(s, n), a = Math.atan2(h.y, h.x), o = Math.atan2(r.y, r.x);
|
4664
|
+
return new gt(
|
4665
4665
|
n,
|
4666
4666
|
i,
|
4667
4667
|
a,
|
4668
4668
|
o,
|
4669
|
-
|
4669
|
+
g.Z_AXIS
|
4670
4670
|
);
|
4671
4671
|
}
|
4672
4672
|
}
|
@@ -4679,7 +4679,7 @@ class yt extends zt {
|
|
4679
4679
|
* @param normal The normal vector of the plane in which the arc lies.
|
4680
4680
|
* @param refVec The reference vector from which angles are measured. Default value is x axis.
|
4681
4681
|
*/
|
4682
|
-
constructor(t, s, e, n, i, h =
|
4682
|
+
constructor(t, s, e, n, i, h = g.X_AXIS) {
|
4683
4683
|
super(), this.center = t, this.radius = s, this.startAngle = e, this.endAngle = n, this.normal = i, this.refVec = h, (n - e) % I == 0 ? (this.startAngle = 0, this.endAngle = I) : (this.startAngle = e, this.endAngle = n);
|
4684
4684
|
}
|
4685
4685
|
/**
|
@@ -4689,7 +4689,7 @@ class yt extends zt {
|
|
4689
4689
|
return this._center;
|
4690
4690
|
}
|
4691
4691
|
set center(t) {
|
4692
|
-
this._center = new
|
4692
|
+
this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4693
4693
|
}
|
4694
4694
|
/**
|
4695
4695
|
* Radius of circular arc
|
@@ -4698,7 +4698,7 @@ class yt extends zt {
|
|
4698
4698
|
return this._radius;
|
4699
4699
|
}
|
4700
4700
|
set radius(t) {
|
4701
|
-
if (t < 0) throw
|
4701
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
4702
4702
|
this._radius = t, this._boundingBoxNeedsUpdate = !0;
|
4703
4703
|
}
|
4704
4704
|
/**
|
@@ -4708,7 +4708,7 @@ class yt extends zt {
|
|
4708
4708
|
return this._startAngle;
|
4709
4709
|
}
|
4710
4710
|
set startAngle(t) {
|
4711
|
-
this._startAngle =
|
4711
|
+
this._startAngle = C.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 zt {
|
|
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 : C.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 C.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.
|
@@ -4744,7 +4744,7 @@ class yt extends zt {
|
|
4744
4744
|
return this._normal;
|
4745
4745
|
}
|
4746
4746
|
set normal(t) {
|
4747
|
-
this._normal = new
|
4747
|
+
this._normal = new g(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
|
4748
4748
|
}
|
4749
4749
|
/**
|
4750
4750
|
* The unit reference vector of circular arc
|
@@ -4753,7 +4753,7 @@ class yt extends zt {
|
|
4753
4753
|
return this._refVec;
|
4754
4754
|
}
|
4755
4755
|
set refVec(t) {
|
4756
|
-
this._refVec = new
|
4756
|
+
this._refVec = new g(t.x, t.y, t.z), this._refVec.normalize(), this._boundingBoxNeedsUpdate = !0;
|
4757
4757
|
}
|
4758
4758
|
/**
|
4759
4759
|
* The start point of circular arc
|
@@ -4779,13 +4779,13 @@ class yt extends zt {
|
|
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
|
+
C.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);
|
4786
4786
|
o.x < s && (s = o.x), o.y < e && (e = o.y), o.z < n && (n = o.z), o.x > i && (i = o.x), o.y > h && (h = o.y), o.z > r && (r = o.z);
|
4787
4787
|
}
|
4788
|
-
return new
|
4788
|
+
return new j(
|
4789
4789
|
{ x: s, y: e, z: n },
|
4790
4790
|
{ x: i, y: h, z: r }
|
4791
4791
|
);
|
@@ -4829,7 +4829,7 @@ class yt extends zt {
|
|
4829
4829
|
* @inheritdoc
|
4830
4830
|
*/
|
4831
4831
|
clone() {
|
4832
|
-
return new
|
4832
|
+
return new gt(
|
4833
4833
|
this.center.clone(),
|
4834
4834
|
this.radius,
|
4835
4835
|
this.startAngle,
|
@@ -4859,7 +4859,7 @@ class yt extends zt {
|
|
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 A(
|
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))
|
@@ -4869,12 +4869,12 @@ class yt extends zt {
|
|
4869
4869
|
* Return the plane in which the circular arc lies.
|
4870
4870
|
*/
|
4871
4871
|
get plane() {
|
4872
|
-
const t = new
|
4872
|
+
const t = new g(this.center).distanceTo(Ft);
|
4873
4873
|
return new Mt(this.normal, t);
|
4874
4874
|
}
|
4875
4875
|
}
|
4876
|
-
const Pt = /* @__PURE__ */ new
|
4877
|
-
class
|
4876
|
+
const Pt = /* @__PURE__ */ new g();
|
4877
|
+
class Qt 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 Gt extends st {
|
|
4896
4896
|
return this._center;
|
4897
4897
|
}
|
4898
4898
|
set center(t) {
|
4899
|
-
this._center = new
|
4899
|
+
this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
4900
4900
|
}
|
4901
4901
|
/**
|
4902
4902
|
* Major axis radius of the ellipse
|
@@ -4905,7 +4905,7 @@ class Gt extends st {
|
|
4905
4905
|
return this._majorAxisRadius;
|
4906
4906
|
}
|
4907
4907
|
set majorAxisRadius(t) {
|
4908
|
-
if (t < 0) throw
|
4908
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
4909
4909
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
4910
4910
|
}
|
4911
4911
|
/**
|
@@ -4915,7 +4915,7 @@ class Gt extends st {
|
|
4915
4915
|
return this._minorAxisRadius;
|
4916
4916
|
}
|
4917
4917
|
set minorAxisRadius(t) {
|
4918
|
-
if (t < 0) throw
|
4918
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
4919
4919
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
4920
4920
|
}
|
4921
4921
|
/**
|
@@ -4925,7 +4925,7 @@ class Gt extends st {
|
|
4925
4925
|
return this._startAngle;
|
4926
4926
|
}
|
4927
4927
|
set startAngle(t) {
|
4928
|
-
this._startAngle =
|
4928
|
+
this._startAngle = C.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 Gt 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 : C.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 Gt 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 C.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.
|
@@ -4978,7 +4978,7 @@ class Gt extends st {
|
|
4978
4978
|
const r = this.getPoint(h / 100);
|
4979
4979
|
s = Math.min(s, r.x), e = Math.min(e, r.y), n = Math.max(n, r.x), i = Math.max(i, r.y);
|
4980
4980
|
}
|
4981
|
-
return new
|
4981
|
+
return new U({ x: s, y: e }, { x: n, y: i });
|
4982
4982
|
}
|
4983
4983
|
/**
|
4984
4984
|
* Return true if its start point is identical to its end point. Otherwise, return false.
|
@@ -5004,7 +5004,7 @@ class Gt extends st {
|
|
5004
5004
|
const a = Math.cos(this.rotation), o = Math.sin(this.rotation), c = h - this.center.x, l = r - this.center.y;
|
5005
5005
|
h = c * a - l * o + this.center.x, r = c * o + l * a + this.center.y;
|
5006
5006
|
}
|
5007
|
-
return new
|
5007
|
+
return new S(h, r);
|
5008
5008
|
}
|
5009
5009
|
/**
|
5010
5010
|
* @inheritdoc
|
@@ -5022,7 +5022,7 @@ class Gt extends st {
|
|
5022
5022
|
* @inheritdoc
|
5023
5023
|
*/
|
5024
5024
|
clone() {
|
5025
|
-
return new
|
5025
|
+
return new Qt(
|
5026
5026
|
this.center,
|
5027
5027
|
this.majorAxisRadius,
|
5028
5028
|
this.minorAxisRadius,
|
@@ -5033,7 +5033,7 @@ class Gt extends st {
|
|
5033
5033
|
);
|
5034
5034
|
}
|
5035
5035
|
}
|
5036
|
-
class
|
5036
|
+
class Ot extends et {
|
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 Kt extends zt {
|
|
5056
5056
|
return this._center;
|
5057
5057
|
}
|
5058
5058
|
set center(t) {
|
5059
|
-
this._center = new
|
5059
|
+
this._center = new A(t.x, t.y, t.z || 0), this._boundingBoxNeedsUpdate = !0;
|
5060
5060
|
}
|
5061
5061
|
/**
|
5062
5062
|
* Major axis radius of the ellipse
|
@@ -5065,7 +5065,7 @@ class Kt extends zt {
|
|
5065
5065
|
return this._majorAxisRadius;
|
5066
5066
|
}
|
5067
5067
|
set majorAxisRadius(t) {
|
5068
|
-
if (t < 0) throw
|
5068
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
5069
5069
|
this._majorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
5070
5070
|
}
|
5071
5071
|
/**
|
@@ -5075,7 +5075,7 @@ class Kt extends zt {
|
|
5075
5075
|
return this._minorAxisRadius;
|
5076
5076
|
}
|
5077
5077
|
set minorAxisRadius(t) {
|
5078
|
-
if (t < 0) throw
|
5078
|
+
if (t < 0) throw L.ILLEGAL_PARAMETERS;
|
5079
5079
|
this._minorAxisRadius = t, this._boundingBoxNeedsUpdate = !0;
|
5080
5080
|
}
|
5081
5081
|
/**
|
@@ -5085,7 +5085,7 @@ class Kt extends zt {
|
|
5085
5085
|
return this._startAngle;
|
5086
5086
|
}
|
5087
5087
|
set startAngle(t) {
|
5088
|
-
this._startAngle =
|
5088
|
+
this._startAngle = C.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 Kt extends zt {
|
|
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 : C.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 : C.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.
|
@@ -5122,7 +5122,7 @@ class Kt extends zt {
|
|
5122
5122
|
return this._normal;
|
5123
5123
|
}
|
5124
5124
|
set normal(t) {
|
5125
|
-
this._normal = new
|
5125
|
+
this._normal = new g(t.x, t.y, t.z), this._normal.normalize(), this._boundingBoxNeedsUpdate = !0;
|
5126
5126
|
}
|
5127
5127
|
/**
|
5128
5128
|
* Unit major axis vector (in WCS coordinates) of the ellipse. The major axis vector is the vector from the
|
@@ -5132,13 +5132,13 @@ class Kt extends zt {
|
|
5132
5132
|
return this._majorAxis;
|
5133
5133
|
}
|
5134
5134
|
set majorAxis(t) {
|
5135
|
-
this._majorAxis = new
|
5135
|
+
this._majorAxis = new g(t.x, t.y, t.z), this._majorAxis.normalize(), this._boundingBoxNeedsUpdate = !0;
|
5136
5136
|
}
|
5137
5137
|
/**
|
5138
5138
|
* Unit minor axis vector (in WCS coordinates) of the ellipse.
|
5139
5139
|
*/
|
5140
5140
|
get minorAxis() {
|
5141
|
-
return new
|
5141
|
+
return new g().crossVectors(this.normal, this.majorAxis).normalize();
|
5142
5142
|
}
|
5143
5143
|
/**
|
5144
5144
|
* Compute the start point of the ellipse arc.
|
@@ -5162,7 +5162,7 @@ class Kt extends zt {
|
|
5162
5162
|
* @returns True if the ellipse arc is circular
|
5163
5163
|
*/
|
5164
5164
|
get isCircular() {
|
5165
|
-
return
|
5165
|
+
return Xt.equal(this.majorAxisRadius, this.minorAxisRadius);
|
5166
5166
|
}
|
5167
5167
|
get length() {
|
5168
5168
|
if (this.isCircular)
|
@@ -5181,16 +5181,16 @@ class Kt extends zt {
|
|
5181
5181
|
* @returns Return bounding box containing the min and max coordinates
|
5182
5182
|
*/
|
5183
5183
|
calculateBoundingBox() {
|
5184
|
-
if (this.majorAxis.equals(
|
5184
|
+
if (this.majorAxis.equals(g.X_AXIS) || this.majorAxis.equals(g.Y_AXIS) || this.majorAxis.isParallelTo(g.X_AXIS) || this.majorAxis.isParallelTo(g.Y_AXIS)) {
|
5185
5185
|
const t = [this.startAngle, this.endAngle];
|
5186
5186
|
for (let a = 0; a < 2 * Math.PI; a += Math.PI / 2)
|
5187
|
-
|
5187
|
+
C.isBetweenAngle(a, this.startAngle, this.endAngle) && t.push(a);
|
5188
5188
|
let s = 1 / 0, e = 1 / 0, n = 1 / 0, i = -1 / 0, h = -1 / 0, r = -1 / 0;
|
5189
5189
|
for (const a of t) {
|
5190
5190
|
const o = this.getPointAtAngle(a);
|
5191
5191
|
o.x < s && (s = o.x), o.y < e && (e = o.y), o.z < n && (n = o.z), o.x > i && (i = o.x), o.y > h && (h = o.y), o.z > r && (r = o.z);
|
5192
5192
|
}
|
5193
|
-
return new
|
5193
|
+
return new j(
|
5194
5194
|
{ x: s, y: e, z: n },
|
5195
5195
|
{ x: i, y: h, z: r }
|
5196
5196
|
);
|
@@ -5200,7 +5200,7 @@ class Kt extends zt {
|
|
5200
5200
|
const o = this.startAngle + this.deltaAngle * (a / 100), c = this.getPointAtAngle(o);
|
5201
5201
|
s = Math.min(s, c.x), e = Math.min(e, c.y), n = Math.min(n, c.z), i = Math.max(i, c.x), h = Math.max(h, c.y), r = Math.max(r, c.z);
|
5202
5202
|
}
|
5203
|
-
return new
|
5203
|
+
return new j(
|
5204
5204
|
{ x: s, y: e, z: n },
|
5205
5205
|
{ x: i, y: h, z: r }
|
5206
5206
|
);
|
@@ -5229,7 +5229,7 @@ class Kt extends zt {
|
|
5229
5229
|
*/
|
5230
5230
|
getPointAtAngle(t) {
|
5231
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);
|
5232
|
-
return new
|
5232
|
+
return new A(
|
5233
5233
|
this.center.x + i.x,
|
5234
5234
|
this.center.y + i.y,
|
5235
5235
|
this.center.z + i.z
|
@@ -5241,7 +5241,7 @@ class Kt extends zt {
|
|
5241
5241
|
* @returns - True if the point is inside the ellipse, false otherwise.
|
5242
5242
|
*/
|
5243
5243
|
contains(t) {
|
5244
|
-
const s = new
|
5244
|
+
const s = new g(t).sub(this.center), e = s.dot(this.majorAxis), n = s.dot(this.minorAxis), i = e / this.majorAxisRadius, h = n / this.minorAxisRadius;
|
5245
5245
|
return i * i + h * h <= 1;
|
5246
5246
|
}
|
5247
5247
|
/**
|
@@ -5260,7 +5260,7 @@ class Kt extends zt {
|
|
5260
5260
|
* @inheritdoc
|
5261
5261
|
*/
|
5262
5262
|
clone() {
|
5263
|
-
return new
|
5263
|
+
return new Ot(
|
5264
5264
|
this.center,
|
5265
5265
|
this.normal,
|
5266
5266
|
this.majorAxis,
|
@@ -5274,11 +5274,11 @@ class Kt extends zt {
|
|
5274
5274
|
* Return the plane in which the ellipse arc lies.
|
5275
5275
|
*/
|
5276
5276
|
get plane() {
|
5277
|
-
const t = new
|
5277
|
+
const t = new g(this.center).distanceTo(Ft);
|
5278
5278
|
return new Mt(this.normal, t);
|
5279
5279
|
}
|
5280
5280
|
}
|
5281
|
-
class
|
5281
|
+
class Rs extends st {
|
5282
5282
|
constructor(t = null, s = !1) {
|
5283
5283
|
super(), this._vertices = t || new Array(), this._closed = s;
|
5284
5284
|
}
|
@@ -5300,7 +5300,7 @@ class Bs extends st {
|
|
5300
5300
|
get startPoint() {
|
5301
5301
|
if (this.numberOfVertices > 0) {
|
5302
5302
|
const t = this._vertices[0];
|
5303
|
-
return new
|
5303
|
+
return new S(t.x, t.y);
|
5304
5304
|
}
|
5305
5305
|
throw new Error("Start point does not exist in an empty polyline.");
|
5306
5306
|
}
|
@@ -5312,10 +5312,10 @@ class Bs extends st {
|
|
5312
5312
|
if (t > 0)
|
5313
5313
|
if (this.closed) {
|
5314
5314
|
const s = this._vertices[0];
|
5315
|
-
return new
|
5315
|
+
return new S(s.x, s.y);
|
5316
5316
|
} else {
|
5317
5317
|
const s = this._vertices[t - 1];
|
5318
|
-
return new
|
5318
|
+
return new S(s.x, s.y);
|
5319
5319
|
}
|
5320
5320
|
throw new Error("End point does not exist in an empty polyline.");
|
5321
5321
|
}
|
@@ -5330,10 +5330,10 @@ class Bs extends st {
|
|
5330
5330
|
let i = null;
|
5331
5331
|
if (e < s - 1 ? i = this._vertices[e + 1] : e == s - 1 && this.closed && (i = this._vertices[0]), i)
|
5332
5332
|
if (n.bulge) {
|
5333
|
-
const h = new
|
5333
|
+
const h = new _t(n, i, n.bulge);
|
5334
5334
|
t += h.length;
|
5335
5335
|
} else
|
5336
|
-
t += new
|
5336
|
+
t += new S(n.x, n.y).distanceTo(i);
|
5337
5337
|
}
|
5338
5338
|
return t;
|
5339
5339
|
}
|
@@ -5364,14 +5364,14 @@ class Bs extends st {
|
|
5364
5364
|
*/
|
5365
5365
|
getPointAt(t) {
|
5366
5366
|
const s = this._vertices[t];
|
5367
|
-
return new
|
5367
|
+
return new S(s.x, s.y);
|
5368
5368
|
}
|
5369
5369
|
/**
|
5370
5370
|
* @inheritdoc
|
5371
5371
|
*/
|
5372
5372
|
calculateBoundingBox() {
|
5373
5373
|
const t = this.getPoints(100);
|
5374
|
-
return new
|
5374
|
+
return new U().setFromPoints(t);
|
5375
5375
|
}
|
5376
5376
|
/**
|
5377
5377
|
* @inheritdoc
|
@@ -5388,7 +5388,7 @@ class Bs extends st {
|
|
5388
5388
|
getPoints3d(t, s) {
|
5389
5389
|
const e = [];
|
5390
5390
|
return this.getPoints(t).forEach(
|
5391
|
-
(i) => e.push(new
|
5391
|
+
(i) => e.push(new A().set(i.x, i.y, s))
|
5392
5392
|
), e;
|
5393
5393
|
}
|
5394
5394
|
/**
|
@@ -5403,25 +5403,25 @@ class Bs extends st {
|
|
5403
5403
|
if (i.bulge) {
|
5404
5404
|
let h = null;
|
5405
5405
|
if (n < e - 1 ? h = this._vertices[n + 1] : n == e - 1 && this.closed && (h = this._vertices[0]), h) {
|
5406
|
-
const a = new
|
5406
|
+
const a = new _t(i, h, i.bulge).getPoints(t), o = a.length;
|
5407
5407
|
for (let c = 0; c < o; ++c) {
|
5408
5408
|
const l = a[c];
|
5409
|
-
s.push(new
|
5409
|
+
s.push(new S(l.x, l.y));
|
5410
5410
|
}
|
5411
5411
|
}
|
5412
5412
|
} else
|
5413
|
-
s.push(new
|
5413
|
+
s.push(new S(i.x, i.y)), n == e - 1 && this.closed && s.push(s[0]);
|
5414
5414
|
}
|
5415
5415
|
return s;
|
5416
5416
|
}
|
5417
5417
|
}
|
5418
|
-
class
|
5418
|
+
class Ht extends st {
|
5419
5419
|
/**
|
5420
5420
|
* This constructor initializes the line object to use start as the start point, and end
|
5421
5421
|
* as the endpoint. Both points must be in WCS coordinates.
|
5422
5422
|
*/
|
5423
5423
|
constructor(t, s) {
|
5424
|
-
super(), this._start = new
|
5424
|
+
super(), this._start = new S(t), this._end = new S(s);
|
5425
5425
|
}
|
5426
5426
|
/**
|
5427
5427
|
* The line's startpoint in WCS coordinates
|
@@ -5460,14 +5460,14 @@ class Qt extends st {
|
|
5460
5460
|
* @inheritdoc
|
5461
5461
|
*/
|
5462
5462
|
calculateBoundingBox() {
|
5463
|
-
const t = new
|
5463
|
+
const t = new S(
|
5464
5464
|
Math.min(this._start.x, this._end.x),
|
5465
5465
|
Math.min(this._start.y, this._end.y)
|
5466
|
-
), s = new
|
5466
|
+
), s = new S(
|
5467
5467
|
Math.max(this._start.x, this._end.x),
|
5468
5468
|
Math.max(this._start.y, this._end.y)
|
5469
5469
|
);
|
5470
|
-
return new
|
5470
|
+
return new U(t, s);
|
5471
5471
|
}
|
5472
5472
|
/**
|
5473
5473
|
* @inheritdoc
|
@@ -5491,10 +5491,10 @@ class Qt extends st {
|
|
5491
5491
|
* @inheritdoc
|
5492
5492
|
*/
|
5493
5493
|
clone() {
|
5494
|
-
return new
|
5494
|
+
return new Ht(this._start.clone(), this._end.clone());
|
5495
5495
|
}
|
5496
5496
|
}
|
5497
|
-
class
|
5497
|
+
class ks extends st {
|
5498
5498
|
/**
|
5499
5499
|
* Create one loop by connected curves
|
5500
5500
|
* @param curves Input one array of connected curves
|
@@ -5524,7 +5524,7 @@ class Is extends st {
|
|
5524
5524
|
get startPoint() {
|
5525
5525
|
if (this._curves.length > 0) {
|
5526
5526
|
const t = this._curves[0].startPoint;
|
5527
|
-
return new
|
5527
|
+
return new S(t.x, t.y);
|
5528
5528
|
}
|
5529
5529
|
throw new Error("Start point does not exist in an empty loop.");
|
5530
5530
|
}
|
@@ -5547,7 +5547,7 @@ class Is extends st {
|
|
5547
5547
|
* @inheritdoc
|
5548
5548
|
*/
|
5549
5549
|
calculateBoundingBox() {
|
5550
|
-
const t = this.getPoints(100), s = new
|
5550
|
+
const t = this.getPoints(100), s = new U();
|
5551
5551
|
return s.setFromPoints(t), s;
|
5552
5552
|
}
|
5553
5553
|
/**
|
@@ -5571,24 +5571,225 @@ class Is extends st {
|
|
5571
5571
|
const s = [];
|
5572
5572
|
return this.curves.forEach((e) => {
|
5573
5573
|
e.getPoints(t).forEach((n) => {
|
5574
|
-
s.push(new
|
5574
|
+
s.push(new S(n.x, n.y));
|
5575
5575
|
});
|
5576
5576
|
}), s;
|
5577
5577
|
}
|
5578
5578
|
}
|
5579
|
-
class
|
5579
|
+
class bt {
|
5580
|
+
constructor() {
|
5581
|
+
this.c0 = 0, this.c1 = 0, this.c2 = 0, this.c3 = 0;
|
5582
|
+
}
|
5583
|
+
/**
|
5584
|
+
* Compute coefficients for a cubic polynomial
|
5585
|
+
* p(s) = c0 + c1*s + c2*s^2 + c3*s^3
|
5586
|
+
* such that
|
5587
|
+
* p(0) = x0, p(1) = x1
|
5588
|
+
* and
|
5589
|
+
* p'(0) = t0, p'(1) = t1.
|
5590
|
+
*/
|
5591
|
+
init(t, s, e, n) {
|
5592
|
+
this.c0 = t, this.c1 = e, this.c2 = -3 * t + 3 * s - 2 * e - n, this.c3 = 2 * t - 2 * s + e + n;
|
5593
|
+
}
|
5594
|
+
/**
|
5595
|
+
* Initialize for Catmull-Rom interpolation
|
5596
|
+
*/
|
5597
|
+
initCatmullRom(t, s, e, n, i) {
|
5598
|
+
this.init(s, e, i * (e - t), i * (n - s));
|
5599
|
+
}
|
5600
|
+
/**
|
5601
|
+
* Initialize for non-uniform Catmull-Rom interpolation
|
5602
|
+
*/
|
5603
|
+
initNonuniformCatmullRom(t, s, e, n, i, h, r) {
|
5604
|
+
let a = (s - t) / i - (e - t) / (i + h) + (e - s) / h, o = (e - s) / h - (n - s) / (h + r) + (n - e) / r;
|
5605
|
+
a *= h, o *= h, this.init(s, e, a, o);
|
5606
|
+
}
|
5607
|
+
/**
|
5608
|
+
* Calculate the polynomial value at parameter t
|
5609
|
+
*/
|
5610
|
+
calc(t) {
|
5611
|
+
const s = t * t, e = s * t;
|
5612
|
+
return this.c0 + this.c1 * t + this.c2 * s + this.c3 * e;
|
5613
|
+
}
|
5614
|
+
}
|
5615
|
+
class Ss extends et {
|
5616
|
+
/**
|
5617
|
+
* Constructs a new Catmull-Rom curve.
|
5618
|
+
*
|
5619
|
+
* @param points - An array of 3D points defining the curve.
|
5620
|
+
* @param closed - Whether the curve is closed or not.
|
5621
|
+
* @param curveType - The curve type.
|
5622
|
+
* @param tension - Tension of the curve.
|
5623
|
+
*/
|
5624
|
+
constructor(t = [], s = !1, e = "centripetal", n = 0.5) {
|
5625
|
+
super(), this.isCatmullRomCurve3d = !0, this.type = "CatmullRomCurve3d", this._tmp = new g(), this._px = new bt(), this._py = new bt(), this._pz = new bt(), this._points = t.map((i) => new A(i)), this._closed = s, this._curveType = e, this._tension = n;
|
5626
|
+
}
|
5627
|
+
/**
|
5628
|
+
* An array of 3D points defining the curve.
|
5629
|
+
*/
|
5630
|
+
get points() {
|
5631
|
+
return this._points;
|
5632
|
+
}
|
5633
|
+
/**
|
5634
|
+
* Whether the curve is closed or not.
|
5635
|
+
*/
|
5636
|
+
get closed() {
|
5637
|
+
return this._closed;
|
5638
|
+
}
|
5639
|
+
/**
|
5640
|
+
* The curve type.
|
5641
|
+
*/
|
5642
|
+
get curveType() {
|
5643
|
+
return this._curveType;
|
5644
|
+
}
|
5645
|
+
/**
|
5646
|
+
* Tension of the curve.
|
5647
|
+
*/
|
5648
|
+
get tension() {
|
5649
|
+
return this._tension;
|
5650
|
+
}
|
5651
|
+
/**
|
5652
|
+
* Start point of this curve.
|
5653
|
+
*/
|
5654
|
+
get startPoint() {
|
5655
|
+
return this._points.length > 0 ? this._points[0] : new A();
|
5656
|
+
}
|
5657
|
+
/**
|
5658
|
+
* End point of this curve.
|
5659
|
+
*/
|
5660
|
+
get endPoint() {
|
5661
|
+
return this._points.length > 0 ? this._points[this._points.length - 1] : new A();
|
5662
|
+
}
|
5663
|
+
/**
|
5664
|
+
* Length of this curve (approximated).
|
5665
|
+
*/
|
5666
|
+
get length() {
|
5667
|
+
if (this._points.length < 2) return 0;
|
5668
|
+
let t = 0;
|
5669
|
+
for (let s = 1; s < this._points.length; s++)
|
5670
|
+
t += this._points[s - 1].distanceTo(this._points[s]);
|
5671
|
+
return this._closed && this._points.length > 2 && (t += this._points[this._points.length - 1].distanceTo(
|
5672
|
+
this._points[0]
|
5673
|
+
)), t;
|
5674
|
+
}
|
5675
|
+
/**
|
5676
|
+
* Returns a point on the curve.
|
5677
|
+
*
|
5678
|
+
* @param t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`.
|
5679
|
+
* @param optionalTarget - The optional target vector the result is written to.
|
5680
|
+
* @return The position on the curve.
|
5681
|
+
*/
|
5682
|
+
getPoint(t, s = new A()) {
|
5683
|
+
const e = s, n = this._points, i = n.length;
|
5684
|
+
if (i === 0)
|
5685
|
+
return e.set(0, 0, 0);
|
5686
|
+
if (i === 1)
|
5687
|
+
return e.copy(n[0]);
|
5688
|
+
const h = (i - (this._closed ? 0 : 1)) * t;
|
5689
|
+
let r = Math.floor(h), a = h - r;
|
5690
|
+
this._closed ? r += r > 0 ? 0 : (Math.floor(Math.abs(r) / i) + 1) * i : a === 0 && r === i - 1 && (r = i - 2, a = 1);
|
5691
|
+
let o, c;
|
5692
|
+
this._closed || r > 0 ? o = n[(r - 1) % i] : (this._tmp.subVectors(n[0], n[1]).add(n[0]), o = new A(this._tmp.x, this._tmp.y, this._tmp.z));
|
5693
|
+
const l = n[r % i], d = n[(r + 1) % i];
|
5694
|
+
if (this._closed || r + 2 < i ? c = n[(r + 2) % i] : (this._tmp.subVectors(n[i - 1], n[i - 2]).add(n[i - 1]), c = new A(this._tmp.x, this._tmp.y, this._tmp.z)), this._curveType === "centripetal" || this._curveType === "chordal") {
|
5695
|
+
const m = this._curveType === "chordal" ? 0.5 : 0.25;
|
5696
|
+
let x = Math.pow(o.distanceToSquared(l), m), y = Math.pow(l.distanceToSquared(d), m), _ = Math.pow(d.distanceToSquared(c), m);
|
5697
|
+
y < 1e-4 && (y = 1), x < 1e-4 && (x = y), _ < 1e-4 && (_ = y), this._px.initNonuniformCatmullRom(o.x, l.x, d.x, c.x, x, y, _), this._py.initNonuniformCatmullRom(o.y, l.y, d.y, c.y, x, y, _), this._pz.initNonuniformCatmullRom(o.z, l.z, d.z, c.z, x, y, _);
|
5698
|
+
} else this._curveType === "catmullrom" && (this._px.initCatmullRom(o.x, l.x, d.x, c.x, this._tension), this._py.initCatmullRom(o.y, l.y, d.y, c.y, this._tension), this._pz.initCatmullRom(o.z, l.z, d.z, c.z, this._tension));
|
5699
|
+
return e.set(
|
5700
|
+
this._px.calc(a),
|
5701
|
+
this._py.calc(a),
|
5702
|
+
this._pz.calc(a)
|
5703
|
+
), e;
|
5704
|
+
}
|
5705
|
+
/**
|
5706
|
+
* Get an array of points along the curve
|
5707
|
+
* @param divisions - Number of divisions to create
|
5708
|
+
* @returns Array of points along the curve
|
5709
|
+
*/
|
5710
|
+
getPoints(t) {
|
5711
|
+
const s = [];
|
5712
|
+
for (let e = 0; e <= t; e++)
|
5713
|
+
s.push(this.getPoint(e / t));
|
5714
|
+
return s;
|
5715
|
+
}
|
5716
|
+
/**
|
5717
|
+
* Set the points defining the curve
|
5718
|
+
* @param points - Array of points
|
5719
|
+
*/
|
5720
|
+
setPoints(t) {
|
5721
|
+
this._points = t.map((s) => new A(s)), this._boundingBoxNeedsUpdate = !0;
|
5722
|
+
}
|
5723
|
+
/**
|
5724
|
+
* Set whether the curve is closed
|
5725
|
+
* @param closed - Whether the curve should be closed
|
5726
|
+
*/
|
5727
|
+
setClosed(t) {
|
5728
|
+
this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0);
|
5729
|
+
}
|
5730
|
+
/**
|
5731
|
+
* Set the curve type
|
5732
|
+
* @param curveType - The curve type
|
5733
|
+
*/
|
5734
|
+
setCurveType(t) {
|
5735
|
+
this._curveType = t;
|
5736
|
+
}
|
5737
|
+
/**
|
5738
|
+
* Set the tension of the curve
|
5739
|
+
* @param tension - The tension value
|
5740
|
+
*/
|
5741
|
+
setTension(t) {
|
5742
|
+
this._tension = t;
|
5743
|
+
}
|
5744
|
+
/**
|
5745
|
+
* Transforms the curve by applying the input matrix.
|
5746
|
+
* @param matrix Input transformation matrix
|
5747
|
+
* @return Return this curve
|
5748
|
+
*/
|
5749
|
+
transform(t) {
|
5750
|
+
return this._points = this._points.map((s) => {
|
5751
|
+
const e = new A();
|
5752
|
+
return e.copy(s), e.applyMatrix3d(t), e;
|
5753
|
+
}), this._boundingBoxNeedsUpdate = !0, this;
|
5754
|
+
}
|
5755
|
+
/**
|
5756
|
+
* Calculate the bounding box of this curve.
|
5757
|
+
* @return The bounding box
|
5758
|
+
*/
|
5759
|
+
calculateBoundingBox() {
|
5760
|
+
if (this._points.length === 0)
|
5761
|
+
return new j();
|
5762
|
+
const t = new j();
|
5763
|
+
return this._points.forEach((s) => {
|
5764
|
+
t.expandByPoint(s);
|
5765
|
+
}), t;
|
5766
|
+
}
|
5767
|
+
}
|
5768
|
+
class q {
|
5580
5769
|
constructor(t, s, e, n) {
|
5581
|
-
this._degree = t, this._knots = [...s], this._controlPoints = e.map((i) =>
|
5770
|
+
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);
|
5582
5771
|
}
|
5772
|
+
/**
|
5773
|
+
* Get the degree of the NURBS curve
|
5774
|
+
*/
|
5583
5775
|
degree() {
|
5584
5776
|
return this._degree;
|
5585
5777
|
}
|
5778
|
+
/**
|
5779
|
+
* Get the knot vector
|
5780
|
+
*/
|
5586
5781
|
knots() {
|
5587
5782
|
return [...this._knots];
|
5588
5783
|
}
|
5784
|
+
/**
|
5785
|
+
* Get the control points
|
5786
|
+
*/
|
5589
5787
|
controlPoints() {
|
5590
|
-
return this._controlPoints.map((t) =>
|
5788
|
+
return this._controlPoints.map((t) => ({ x: t.x, y: t.y, z: t.z }));
|
5591
5789
|
}
|
5790
|
+
/**
|
5791
|
+
* Get the weights
|
5792
|
+
*/
|
5592
5793
|
weights() {
|
5593
5794
|
return [...this._weights];
|
5594
5795
|
}
|
@@ -5596,11 +5797,12 @@ class D {
|
|
5596
5797
|
* Calculate a point on the curve at parameter u
|
5597
5798
|
*/
|
5598
5799
|
point(t) {
|
5599
|
-
|
5800
|
+
const s = this._controlPoints.map((e) => [e.x, e.y, e.z]);
|
5801
|
+
return yt(
|
5600
5802
|
t,
|
5601
5803
|
this._degree,
|
5602
5804
|
this._knots,
|
5603
|
-
|
5805
|
+
s,
|
5604
5806
|
this._weights
|
5605
5807
|
);
|
5606
5808
|
}
|
@@ -5608,10 +5810,11 @@ class D {
|
|
5608
5810
|
* Calculate curve length using numerical integration
|
5609
5811
|
*/
|
5610
5812
|
length() {
|
5611
|
-
|
5813
|
+
const t = this._controlPoints.map((s) => [s.x, s.y, s.z]);
|
5814
|
+
return Ms(
|
5612
5815
|
this._degree,
|
5613
5816
|
this._knots,
|
5614
|
-
|
5817
|
+
t,
|
5615
5818
|
this._weights
|
5616
5819
|
);
|
5617
5820
|
}
|
@@ -5619,7 +5822,7 @@ class D {
|
|
5619
5822
|
* Create a NURBS curve from control points and knots
|
5620
5823
|
*/
|
5621
5824
|
static byKnotsControlPointsWeights(t, s, e, n) {
|
5622
|
-
return new
|
5825
|
+
return new q(t, s, e, n);
|
5623
5826
|
}
|
5624
5827
|
/**
|
5625
5828
|
* Create a NURBS curve from fit points using interpolation
|
@@ -5628,92 +5831,131 @@ class D {
|
|
5628
5831
|
let n;
|
5629
5832
|
switch (e) {
|
5630
5833
|
case "Chord":
|
5631
|
-
n =
|
5834
|
+
n = ps(s, t);
|
5632
5835
|
break;
|
5633
5836
|
case "SqrtChord":
|
5634
|
-
n =
|
5837
|
+
n = zs(s, t);
|
5635
5838
|
break;
|
5636
5839
|
case "Uniform":
|
5637
5840
|
default:
|
5638
|
-
n =
|
5841
|
+
n = _s(s, t.length);
|
5639
5842
|
break;
|
5640
5843
|
}
|
5641
|
-
const i =
|
5642
|
-
return new
|
5844
|
+
const i = t.map((r) => ({ x: r[0], y: r[1], z: r[2] })), h = new Array(i.length).fill(1);
|
5845
|
+
return new q(s, n, i, h);
|
5846
|
+
}
|
5847
|
+
/**
|
5848
|
+
* Get the valid parameter range for this curve
|
5849
|
+
*/
|
5850
|
+
getParameterRange() {
|
5851
|
+
const t = this._knots[this._degree], s = this._knots[this._knots.length - this._degree - 1];
|
5852
|
+
return { start: t, end: s };
|
5853
|
+
}
|
5854
|
+
/**
|
5855
|
+
* Get points along the curve
|
5856
|
+
* @param divisions - Number of divisions to create
|
5857
|
+
* @returns Array of points along the curve
|
5858
|
+
*/
|
5859
|
+
getPoints(t) {
|
5860
|
+
const s = [], { start: e, end: n } = this.getParameterRange();
|
5861
|
+
for (let i = 0; i <= t; i++) {
|
5862
|
+
const h = e + (n - e) * (i / t);
|
5863
|
+
s.push(this.point(h));
|
5864
|
+
}
|
5865
|
+
return s;
|
5866
|
+
}
|
5867
|
+
/**
|
5868
|
+
* Check if the curve is closed by comparing start and end points
|
5869
|
+
*/
|
5870
|
+
isClosed(t = 1e-6) {
|
5871
|
+
const { start: s, end: e } = this.getParameterRange(), n = this.point(s), i = this.point(e), h = n[0] - i[0], r = n[1] - i[1], a = n[2] - i[2];
|
5872
|
+
return Math.sqrt(h * h + r * r + a * a) < t;
|
5873
|
+
}
|
5874
|
+
/**
|
5875
|
+
* Create a closed NURBS curve using Catmull-Rom interpolation for smooth closure
|
5876
|
+
*/
|
5877
|
+
static createClosedCurve(t, s, e = "Chord") {
|
5878
|
+
if (t.length < 4)
|
5879
|
+
throw new Error("At least 4 points are required for a closed NURBS curve");
|
5880
|
+
const n = new Ss(
|
5881
|
+
t,
|
5882
|
+
!0,
|
5883
|
+
"centripetal"
|
5884
|
+
), i = Math.max(50, t.length * 2), r = n.getPoints(i).map((a) => [a.x, a.y, a.z]);
|
5885
|
+
return q.byPoints(r, s, e);
|
5643
5886
|
}
|
5644
5887
|
}
|
5645
|
-
class
|
5888
|
+
class Kt extends et {
|
5646
5889
|
constructor(t, s, e, n) {
|
5647
5890
|
super();
|
5648
5891
|
const i = +(t !== void 0) + +(s !== void 0) + +(e !== void 0) + +(n !== void 0);
|
5649
5892
|
if (i < 2 || i > 4)
|
5650
|
-
throw
|
5893
|
+
throw L.ILLEGAL_PARAMETERS;
|
5651
5894
|
const h = 3;
|
5652
5895
|
if (this._closed = n || !1, Array.isArray(s)) {
|
5653
5896
|
if (this._controlPoints = t, i >= 4 && (this._closed = n), this._controlPoints.length < 4)
|
5654
|
-
throw
|
5655
|
-
|
5656
|
-
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5897
|
+
throw L.ILLEGAL_PARAMETERS;
|
5898
|
+
this._nurbsCurve = q.byKnotsControlPointsWeights(
|
5657
5899
|
h,
|
5658
5900
|
s,
|
5659
|
-
|
5901
|
+
this._controlPoints,
|
5660
5902
|
e
|
5661
|
-
)
|
5903
|
+
);
|
5662
5904
|
} else {
|
5663
5905
|
if (this._fitPoints = t, this._knotParameterization = s, i >= 3 && (this._closed = e), this._fitPoints.length < 4)
|
5664
|
-
throw
|
5906
|
+
throw L.ILLEGAL_PARAMETERS;
|
5665
5907
|
const r = this.toNurbsPoints(this._fitPoints);
|
5666
|
-
this._nurbsCurve =
|
5908
|
+
this._nurbsCurve = q.byPoints(
|
5667
5909
|
r,
|
5668
5910
|
h,
|
5669
5911
|
this._knotParameterization
|
5670
|
-
), this._controlPoints = this.
|
5912
|
+
), this._controlPoints = this._nurbsCurve.controlPoints();
|
5671
5913
|
}
|
5672
|
-
this._closed && this.
|
5673
|
-
}
|
5674
|
-
/**
|
5675
|
-
* Set the closed property and rebuild the curve if necessary
|
5676
|
-
*/
|
5677
|
-
setClosed(t) {
|
5678
|
-
this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0, t ? this.makeClosed() : this.makeOpen());
|
5679
|
-
}
|
5680
|
-
/**
|
5681
|
-
* Make the spline closed by adding control points and adjusting knots
|
5682
|
-
*/
|
5683
|
-
makeClosed() {
|
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);
|
5688
|
-
this._nurbsCurve = D.byKnotsControlPointsWeights(
|
5689
|
-
t,
|
5690
|
-
r,
|
5691
|
-
i,
|
5692
|
-
h
|
5693
|
-
), this._controlPoints = this.toGePoints(i);
|
5914
|
+
this._closed && this.buildCurve();
|
5694
5915
|
}
|
5695
5916
|
/**
|
5696
|
-
*
|
5917
|
+
* Build the NURBS curve using stored data
|
5697
5918
|
*/
|
5698
|
-
|
5699
|
-
if (
|
5700
|
-
|
5701
|
-
|
5702
|
-
|
5703
|
-
|
5704
|
-
|
5705
|
-
|
5706
|
-
|
5707
|
-
|
5919
|
+
buildCurve() {
|
5920
|
+
if (this._fitPoints && this._knotParameterization) {
|
5921
|
+
if (this._closed)
|
5922
|
+
this._nurbsCurve = q.createClosedCurve(
|
5923
|
+
this._fitPoints,
|
5924
|
+
3,
|
5925
|
+
this._knotParameterization
|
5926
|
+
);
|
5927
|
+
else {
|
5928
|
+
const s = this.toNurbsPoints(this._fitPoints);
|
5929
|
+
this._nurbsCurve = q.byPoints(
|
5930
|
+
s,
|
5931
|
+
3,
|
5932
|
+
this._knotParameterization
|
5933
|
+
);
|
5934
|
+
}
|
5935
|
+
this._controlPoints = this._nurbsCurve.controlPoints();
|
5936
|
+
} else if (this._controlPoints)
|
5937
|
+
if (this._closed) {
|
5938
|
+
const s = this._knotParameterization || "Chord";
|
5939
|
+
this._nurbsCurve = q.createClosedCurve(
|
5940
|
+
this._controlPoints,
|
5941
|
+
3,
|
5942
|
+
s
|
5943
|
+
), this._controlPoints = this._nurbsCurve.controlPoints();
|
5944
|
+
} else {
|
5945
|
+
const s = this._nurbsCurve.knots(), e = this._nurbsCurve.weights();
|
5946
|
+
this._nurbsCurve = q.byKnotsControlPointsWeights(
|
5947
|
+
3,
|
5948
|
+
s,
|
5949
|
+
this._controlPoints,
|
5950
|
+
e
|
5951
|
+
);
|
5952
|
+
}
|
5708
5953
|
}
|
5709
5954
|
/**
|
5710
|
-
*
|
5955
|
+
* Set the closed property and rebuild the curve if necessary
|
5711
5956
|
*/
|
5712
|
-
|
5713
|
-
|
5714
|
-
for (let h = 1; h <= i; h++)
|
5715
|
-
e.push(n + h);
|
5716
|
-
return e;
|
5957
|
+
setClosed(t) {
|
5958
|
+
this._closed !== t && (this._closed = t, this._boundingBoxNeedsUpdate = !0, this.buildCurve());
|
5717
5959
|
}
|
5718
5960
|
/**
|
5719
5961
|
* Degree of the spline to be created.
|
@@ -5729,14 +5971,14 @@ class Es extends zt {
|
|
5729
5971
|
*/
|
5730
5972
|
get startPoint() {
|
5731
5973
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[s], n = this._nurbsCurve.point(e);
|
5732
|
-
return new
|
5974
|
+
return new A(n[0], n[1], n[2]);
|
5733
5975
|
}
|
5734
5976
|
/**
|
5735
5977
|
* The end point of this spline
|
5736
5978
|
*/
|
5737
5979
|
get endPoint() {
|
5738
5980
|
const t = this._nurbsCurve.knots(), s = this._nurbsCurve.degree(), e = t[t.length - s - 1], n = this._nurbsCurve.point(e);
|
5739
|
-
return new
|
5981
|
+
return new A(n[0], n[1], n[2]);
|
5740
5982
|
}
|
5741
5983
|
/**
|
5742
5984
|
* @inheritdoc
|
@@ -5778,7 +6020,7 @@ class Es extends zt {
|
|
5778
6020
|
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
6021
|
for (let o = 0; o < t; o++) {
|
5780
6022
|
const c = o === t - 1 ? r : h + o * a, l = s.point(c);
|
5781
|
-
e.push(new
|
6023
|
+
e.push(new A(l[0], l[1], l[2]));
|
5782
6024
|
}
|
5783
6025
|
return e;
|
5784
6026
|
}
|
@@ -5795,7 +6037,7 @@ class Es extends zt {
|
|
5795
6037
|
*/
|
5796
6038
|
calculateBoundingBox() {
|
5797
6039
|
const t = this.getPoints(100);
|
5798
|
-
return new
|
6040
|
+
return new j().setFromPoints(t);
|
5799
6041
|
}
|
5800
6042
|
get closed() {
|
5801
6043
|
return this._closed;
|
@@ -5821,82 +6063,84 @@ class Es extends zt {
|
|
5821
6063
|
}), s;
|
5822
6064
|
}
|
5823
6065
|
/**
|
5824
|
-
*
|
5825
|
-
* @param
|
5826
|
-
* @
|
6066
|
+
* Create a closed spline from fit points using AcGeNurbsCurve.createClosedCurve
|
6067
|
+
* @param fitPoints - Array of fit points defining the curve
|
6068
|
+
* @param parameterization - Knot parameterization type for NURBS
|
6069
|
+
* @returns A closed spline
|
5827
6070
|
*/
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5831
|
-
|
5832
|
-
}), s;
|
6071
|
+
static createClosedSpline(t, s = "Uniform") {
|
6072
|
+
if (t.length < 4)
|
6073
|
+
throw new Error("At least 4 points are required for a closed spline");
|
6074
|
+
return new Kt(t, s, !0);
|
5833
6075
|
}
|
5834
6076
|
}
|
5835
6077
|
export {
|
5836
|
-
|
5837
|
-
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
6078
|
+
Es as AcGeArea2d,
|
6079
|
+
U as AcGeBox2d,
|
6080
|
+
j as AcGeBox3d,
|
6081
|
+
Ss as AcGeCatmullRomCurve3d,
|
6082
|
+
_t as AcGeCircArc2d,
|
6083
|
+
gt as AcGeCircArc3d,
|
5841
6084
|
st as AcGeCurve2d,
|
5842
|
-
|
5843
|
-
|
6085
|
+
Qt as AcGeEllipseArc2d,
|
6086
|
+
Ot as AcGeEllipseArc3d,
|
5844
6087
|
Nt as AcGeEuler,
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
6088
|
+
gs as AcGeGeometryUtil,
|
6089
|
+
Ht as AcGeLine2d,
|
6090
|
+
pt as AcGeLine3d,
|
6091
|
+
ks as AcGeLoop2d,
|
6092
|
+
C as AcGeMathUtil,
|
5850
6093
|
v as AcGeMatrix2d,
|
5851
6094
|
tt as AcGeMatrix3d,
|
6095
|
+
q as AcGeNurbsCurve,
|
5852
6096
|
Mt as AcGePlane,
|
5853
|
-
|
5854
|
-
|
5855
|
-
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5860
|
-
|
5861
|
-
|
5862
|
-
|
6097
|
+
S as AcGePoint2d,
|
6098
|
+
A as AcGePoint3d,
|
6099
|
+
Rs as AcGePolyline2d,
|
6100
|
+
zt as AcGeQuaternion,
|
6101
|
+
Gt as AcGeShape2d,
|
6102
|
+
Kt as AcGeSpline3d,
|
6103
|
+
Xt as AcGeTol,
|
6104
|
+
b as AcGeVector2d,
|
6105
|
+
g as AcGeVector3d,
|
6106
|
+
Dt as DEFAULT_TOL,
|
5863
6107
|
Lt as DEG2RAD,
|
5864
|
-
|
5865
|
-
|
5866
|
-
|
5867
|
-
|
6108
|
+
O as FLOAT_TOL,
|
6109
|
+
Bs as ORIGIN_POINT_2D,
|
6110
|
+
Ft as ORIGIN_POINT_3D,
|
6111
|
+
Ut as RAD2DEG,
|
5868
6112
|
I as TAU,
|
5869
|
-
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
|
5874
|
-
|
5875
|
-
|
5876
|
-
|
5877
|
-
|
5878
|
-
|
5879
|
-
|
5880
|
-
|
5881
|
-
|
5882
|
-
|
5883
|
-
|
5884
|
-
|
5885
|
-
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
6113
|
+
St as basisFunction,
|
6114
|
+
Ms as calculateCurveLength,
|
6115
|
+
ls as ceilPowerOfTwo,
|
6116
|
+
X as clamp,
|
6117
|
+
vt as damp,
|
6118
|
+
os as degToRad,
|
6119
|
+
qt as euclideanModulo,
|
6120
|
+
yt as evaluateNurbsPoint,
|
6121
|
+
us as floorPowerOfTwo,
|
6122
|
+
ps as generateChordKnots,
|
6123
|
+
zs as generateSqrtChordKnots,
|
6124
|
+
$t as generateUUID,
|
6125
|
+
_s as generateUniformKnots,
|
6126
|
+
jt as intPartLength,
|
6127
|
+
Is as interpolateControlPoints,
|
6128
|
+
Jt as inverseLerp,
|
6129
|
+
ds as isBetween,
|
6130
|
+
ms as isBetweenAngle,
|
6131
|
+
Yt as isPointInPolygon,
|
6132
|
+
ys as isPolygonIntersect,
|
6133
|
+
cs as isPowerOfTwo,
|
6134
|
+
Vt as lerp,
|
5891
6135
|
Wt as mapLinear,
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
|
5896
|
-
|
5897
|
-
|
5898
|
-
|
5899
|
-
|
5900
|
-
|
5901
|
-
|
6136
|
+
xt as normalizeAngle,
|
6137
|
+
ts as pingpong,
|
6138
|
+
as as radToDeg,
|
6139
|
+
is as randFloat,
|
6140
|
+
rs as randFloatSpread,
|
6141
|
+
ns as randInt,
|
6142
|
+
xs as relativeEps,
|
6143
|
+
hs as seededRandom,
|
6144
|
+
es as smootherstep,
|
6145
|
+
ss as smoothstep
|
5902
6146
|
};
|