@solid-labs/fab-one-widget 0.1.11 → 0.1.12
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as F, jsx as i, Fragment as Oe } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as Zn, Component as Kn, useCallback as re, useMemo as j, useState as E, memo as Un, useEffect as ne, useRef as le, forwardRef as Jn, createElement as en } from "react";
|
|
3
3
|
import { useFrame as an, useThree as cn, Canvas as Qn } from "@react-three/fiber";
|
|
4
|
-
import { Html as Xe, Line as
|
|
4
|
+
import { Html as Xe, Line as fe, OrbitControls as dn } from "@react-three/drei";
|
|
5
5
|
import * as O from "three";
|
|
6
|
-
import { Plane as
|
|
6
|
+
import { Plane as ut, Vector3 as C, Box3 as fn, Line3 as un, Raycaster as qn } from "three";
|
|
7
7
|
import { create as eo } from "zustand";
|
|
8
8
|
import { OBJLoader as pn } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
9
9
|
import { STLLoader as to } from "three/examples/jsm/loaders/STLLoader.js";
|
|
10
|
-
import { MeshBVH as
|
|
11
|
-
let mr,
|
|
10
|
+
import { MeshBVH as pt } from "three-mesh-bvh";
|
|
11
|
+
let mr, ct, ir, Cn;
|
|
12
12
|
let __tla = (async () => {
|
|
13
13
|
const no = {
|
|
14
14
|
showDragDrop: true,
|
|
@@ -28,7 +28,7 @@ let __tla = (async () => {
|
|
|
28
28
|
showNavigation: false,
|
|
29
29
|
showToolbar: false,
|
|
30
30
|
showSaveButton: false
|
|
31
|
-
}, ro = Zn(no),
|
|
31
|
+
}, ro = Zn(no), Dt = eo((e, r) => ({
|
|
32
32
|
landmarkPoints: [],
|
|
33
33
|
isAligned: false,
|
|
34
34
|
isCut: false,
|
|
@@ -64,7 +64,7 @@ let __tla = (async () => {
|
|
|
64
64
|
isAligned: false,
|
|
65
65
|
isCut: false
|
|
66
66
|
})
|
|
67
|
-
})), io = 0.45,
|
|
67
|
+
})), io = 0.45, ht = 3, _t = 1e-3, dt = 25.4, so = [
|
|
68
68
|
0.25,
|
|
69
69
|
-0.25,
|
|
70
70
|
0.5,
|
|
@@ -97,27 +97,27 @@ let __tla = (async () => {
|
|
|
97
97
|
const B = r[k * 3] * o, $ = r[k * 3 + 1] * o, N = r[k * 3 + 2] * o;
|
|
98
98
|
B < n && (n = B), B > u && (u = B), $ < h && (h = $), $ > p && (p = $), N < d && (d = N), N > g && (g = N);
|
|
99
99
|
}
|
|
100
|
-
const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6,
|
|
100
|
+
const M = (n + u) * 0.5, f = (h + p) * 0.5, m = (d + g) * 0.5, x = u - n + 1e-6, S = p - h + 1e-6, I = g - d + 1e-6, P = x * 0.5, L = S * 0.5, b = I * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), y = x / z, D = S / z, w = I / z, A = /* @__PURE__ */ new Map();
|
|
101
101
|
for (let k = 0; k < a; k++) {
|
|
102
|
-
const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B +
|
|
103
|
-
let ie = A.get(
|
|
104
|
-
ie || (ie = [], A.set(
|
|
102
|
+
const B = r[k * 3] * o - M, $ = r[k * 3 + 1] * o - f, N = r[k * 3 + 2] * o - m, U = Math.min(z - 1, Math.max(0, Math.floor((B + P) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w))), ue = U * z * z + be * z + ae;
|
|
103
|
+
let ie = A.get(ue);
|
|
104
|
+
ie || (ie = [], A.set(ue, ie)), ie.push(k);
|
|
105
105
|
}
|
|
106
106
|
for (let k = 0; k < s; k++) {
|
|
107
|
-
const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B +
|
|
108
|
-
let
|
|
109
|
-
for (let J = 0; J <= z &&
|
|
110
|
-
for (let Y = -J; Y <= J; Y++) for (let
|
|
111
|
-
if (J > 0 && Math.abs(Y) < J && Math.abs(
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const H = A.get(
|
|
107
|
+
const B = l.getX(k), $ = l.getY(k), N = l.getZ(k), U = Math.min(z - 1, Math.max(0, Math.floor((B + P) / y))), be = Math.min(z - 1, Math.max(0, Math.floor(($ + L) / D))), ae = Math.min(z - 1, Math.max(0, Math.floor((N + b) / w)));
|
|
108
|
+
let ue = 1 / 0, ie = 0;
|
|
109
|
+
for (let J = 0; J <= z && ue > 0; J++) {
|
|
110
|
+
for (let Y = -J; Y <= J; Y++) for (let he = -J; he <= J; he++) for (let Z = -J; Z <= J; Z++) {
|
|
111
|
+
if (J > 0 && Math.abs(Y) < J && Math.abs(he) < J && Math.abs(Z) < J) continue;
|
|
112
|
+
const ge = U + Y, me = be + he, pe = ae + Z;
|
|
113
|
+
if (ge < 0 || ge >= z || me < 0 || me >= z || pe < 0 || pe >= z) continue;
|
|
114
|
+
const H = A.get(ge * z * z + me * z + pe);
|
|
115
115
|
if (H) for (const q of H) {
|
|
116
116
|
const xe = r[q * 3] * o - M, Ce = r[q * 3 + 1] * o - f, we = r[q * 3 + 2] * o - m, oe = (B - xe) ** 2 + ($ - Ce) ** 2 + (N - we) ** 2;
|
|
117
|
-
oe <
|
|
117
|
+
oe < ue && (ue = oe, ie = q);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
if (
|
|
120
|
+
if (ue < 1 / 0) break;
|
|
121
121
|
}
|
|
122
122
|
c[k * 3] = t[ie * 3], c[k * 3 + 1] = t[ie * 3 + 1], c[k * 3 + 2] = t[ie * 3 + 2];
|
|
123
123
|
}
|
|
@@ -130,7 +130,7 @@ let __tla = (async () => {
|
|
|
130
130
|
error: 3
|
|
131
131
|
};
|
|
132
132
|
let hn = "warn", gn = null;
|
|
133
|
-
const
|
|
133
|
+
const de = {
|
|
134
134
|
setLevel(e) {
|
|
135
135
|
hn = e;
|
|
136
136
|
},
|
|
@@ -138,19 +138,19 @@ let __tla = (async () => {
|
|
|
138
138
|
gn = e;
|
|
139
139
|
},
|
|
140
140
|
debug(e, r, t) {
|
|
141
|
-
|
|
141
|
+
at("debug", e, r, t);
|
|
142
142
|
},
|
|
143
143
|
info(e, r, t) {
|
|
144
|
-
|
|
144
|
+
at("info", e, r, t);
|
|
145
145
|
},
|
|
146
146
|
warn(e, r, t) {
|
|
147
|
-
|
|
147
|
+
at("warn", e, r, t);
|
|
148
148
|
},
|
|
149
149
|
error(e, r, t) {
|
|
150
|
-
|
|
150
|
+
at("error", e, r, t);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
function
|
|
153
|
+
function at(e, r, t, o) {
|
|
154
154
|
if (tn[e] < tn[hn]) return;
|
|
155
155
|
const l = `[${r}]`, s = o !== void 0 ? [
|
|
156
156
|
l,
|
|
@@ -176,7 +176,7 @@ let __tla = (async () => {
|
|
|
176
176
|
}
|
|
177
177
|
gn == null ? void 0 : gn(e, r, t, o);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function ft(e) {
|
|
180
180
|
const r = e.getAttribute("position"), t = new Float32Array(r.array), o = e.getIndex();
|
|
181
181
|
if (o) return {
|
|
182
182
|
positions: t,
|
|
@@ -202,14 +202,14 @@ let __tla = (async () => {
|
|
|
202
202
|
if (s.traverse((x) => {
|
|
203
203
|
x.isMesh && !c && (c = x.geometry);
|
|
204
204
|
}), !c) return null;
|
|
205
|
-
const { positions: a, indices: n } =
|
|
206
|
-
if (a.length < 9 || n.length < 3) return
|
|
207
|
-
for (let x = 0; x < Math.min(a.length, 300); x++) if (!isFinite(a[x])) return
|
|
205
|
+
const { positions: a, indices: n } = ft(c);
|
|
206
|
+
if (a.length < 9 || n.length < 3) return de.warn("wasm", `Mesh too small: positions=${a.length} indices=${n.length}`), null;
|
|
207
|
+
for (let x = 0; x < Math.min(a.length, 300); x++) if (!isFinite(a[x])) return de.error("wasm", `Invalid position data: NaN/Infinity at index ${x}`), null;
|
|
208
208
|
const h = a.length / 3;
|
|
209
|
-
for (let x = 0; x < Math.min(n.length, 300); x++) if (n[x] >= h) return
|
|
209
|
+
for (let x = 0; x < Math.min(n.length, 300); x++) if (n[x] >= h) return de.error("wasm", `Out-of-bounds index: ${n[x]} >= ${h}`), null;
|
|
210
210
|
t == null ? void 0 : t("Processing mesh (WASM)...");
|
|
211
211
|
const d = r.preprocess_mesh(a, n, 10, 1e-4, 500), u = d.positions(), p = d.indices(), g = d.unit_converted(), M = d.detected_unit(), f = d.log();
|
|
212
|
-
if (
|
|
212
|
+
if (de.debug("wasm", "preprocess result", f), u.length === 0) return null;
|
|
213
213
|
t == null ? void 0 : t("Building geometry...");
|
|
214
214
|
const m = mn(u, p);
|
|
215
215
|
if (o) {
|
|
@@ -223,7 +223,7 @@ let __tla = (async () => {
|
|
|
223
223
|
detectedUnit: M
|
|
224
224
|
};
|
|
225
225
|
} catch (o) {
|
|
226
|
-
return
|
|
226
|
+
return de.error("wasm", "Processing failed", o), null;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
function fo(e) {
|
|
@@ -307,7 +307,7 @@ let __tla = (async () => {
|
|
|
307
307
|
return h;
|
|
308
308
|
}
|
|
309
309
|
function nn(e, r, t, o = false) {
|
|
310
|
-
const l = new
|
|
310
|
+
const l = new ut(new C(0, 1, 0), -t), s = [], c = new fn();
|
|
311
311
|
c.setFromBufferAttribute(r.getAttribute("position"));
|
|
312
312
|
const a = {
|
|
313
313
|
linePoints: [],
|
|
@@ -326,12 +326,12 @@ let __tla = (async () => {
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
|
-
const d = xn(s,
|
|
329
|
+
const d = xn(s, _t, o);
|
|
330
330
|
if (d.length < 2) return a;
|
|
331
331
|
const u = Ke(d);
|
|
332
332
|
let p = -1 / 0, g = new C(0, t, 0);
|
|
333
333
|
for (const f of d) f.x > p && (p = f.x, g = f.clone());
|
|
334
|
-
const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) <
|
|
334
|
+
const M = d.length > 2 && d[0].distanceTo(d[d.length - 1]) < _t * 10;
|
|
335
335
|
return {
|
|
336
336
|
linePoints: d,
|
|
337
337
|
lineLength: u,
|
|
@@ -342,17 +342,17 @@ let __tla = (async () => {
|
|
|
342
342
|
function Ye(e, r, t, o = false) {
|
|
343
343
|
const l = nn(e, r, t, o);
|
|
344
344
|
if (l.isClosed && l.linePoints.length >= 3) return l;
|
|
345
|
-
|
|
345
|
+
de.debug("slice", `y=${t.toFixed(2)} failed (pts=${l.linePoints.length}, closed=${l.isClosed}), retrying...`);
|
|
346
346
|
let s = l;
|
|
347
347
|
for (const c of so) {
|
|
348
348
|
const a = nn(e, r, t + c, o);
|
|
349
|
-
if (a.isClosed && a.linePoints.length >= 3) return
|
|
349
|
+
if (a.isClosed && a.linePoints.length >= 3) return de.debug("slice", `y=${t.toFixed(2)} recovered with offset ${c > 0 ? "+" : ""}${c}mm (pts=${a.linePoints.length}, len=${a.lineLength.toFixed(1)}mm)`), a;
|
|
350
350
|
a.linePoints.length > s.linePoints.length && (s = a);
|
|
351
351
|
}
|
|
352
|
-
return
|
|
352
|
+
return de.warn("slice", `y=${t.toFixed(2)} all retries exhausted (pts=${s.linePoints.length}, closed=${s.isClosed})`), s;
|
|
353
353
|
}
|
|
354
354
|
function ho(e, r, t, o) {
|
|
355
|
-
const l = new
|
|
355
|
+
const l = new ut().setFromNormalAndCoplanarPoint(o.clone().normalize(), t), s = new fn();
|
|
356
356
|
if (s.setFromBufferAttribute(r.getAttribute("position")), !l.intersectsBox(s)) return 0;
|
|
357
357
|
const c = [], a = new un(), n = new C();
|
|
358
358
|
e.shapecast({
|
|
@@ -365,12 +365,12 @@ let __tla = (async () => {
|
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
});
|
|
368
|
-
const h = xn(c,
|
|
368
|
+
const h = xn(c, _t);
|
|
369
369
|
return Ke(h);
|
|
370
370
|
}
|
|
371
371
|
function yn(e) {
|
|
372
|
-
return new
|
|
373
|
-
maxLeafTris:
|
|
372
|
+
return new pt(e, {
|
|
373
|
+
maxLeafTris: ht
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
function go(e, r, t, o) {
|
|
@@ -388,8 +388,8 @@ let __tla = (async () => {
|
|
|
388
388
|
valid: false,
|
|
389
389
|
reason: `Height too large (${c.toFixed(1)}mm > 1000mm)`
|
|
390
390
|
};
|
|
391
|
-
const a = new
|
|
392
|
-
maxLeafTris:
|
|
391
|
+
const a = new pt(e, {
|
|
392
|
+
maxLeafTris: ht
|
|
393
393
|
}), n = Ye(a, e, r);
|
|
394
394
|
if (n.lineLength === 0) return {
|
|
395
395
|
valid: false,
|
|
@@ -434,16 +434,16 @@ let __tla = (async () => {
|
|
|
434
434
|
let a = e.geometry, n = s.map((H) => new C(H.position.x, H.position.y, H.position.z));
|
|
435
435
|
const h = n[0], d = n[1];
|
|
436
436
|
if (!c) {
|
|
437
|
-
o.onStatus("Aligning mesh (JS fallback)..."),
|
|
437
|
+
o.onStatus("Aligning mesh (JS fallback)..."), de.warn(Fe, "WASM not available, using JS fallback alignment");
|
|
438
438
|
const H = new C(0, 1, 0), q = new C().subVectors(d, h).normalize(), xe = q.dot(H), Ce = new C().crossVectors(q, H);
|
|
439
439
|
if (Ce.length() > 1e-4) {
|
|
440
440
|
Ce.normalize();
|
|
441
441
|
const X = new O.Quaternion().setFromAxisAngle(Ce, Math.acos(Math.min(1, Math.max(-1, xe))));
|
|
442
|
-
a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((
|
|
442
|
+
a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Pe) => Pe.clone().applyQuaternion(X));
|
|
443
443
|
}
|
|
444
444
|
if (n[0].y > n[1].y) {
|
|
445
445
|
const X = new O.Quaternion().setFromAxisAngle(new C(1, 0, 0), Math.PI);
|
|
446
|
-
a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((
|
|
446
|
+
a.applyMatrix4(new O.Matrix4().makeRotationFromQuaternion(X)), n = n.map((Pe) => Pe.clone().applyQuaternion(X));
|
|
447
447
|
}
|
|
448
448
|
const we = n[0].clone();
|
|
449
449
|
a.translate(-we.x, -we.y, -we.z), n = n.map((X) => new C(X.x - we.x, X.y - we.y, X.z - we.z)), a.computeVertexNormals(), a.computeBoundingBox();
|
|
@@ -469,12 +469,12 @@ let __tla = (async () => {
|
|
|
469
469
|
x: X.x,
|
|
470
470
|
y: X.y,
|
|
471
471
|
z: X.z
|
|
472
|
-
}))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 *
|
|
472
|
+
}))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * dt);
|
|
473
473
|
const V = new C();
|
|
474
474
|
a.computeBoundingBox(), a.boundingBox.getSize(V), o.setModelSize(Math.max(V.x, V.y, V.z)), l.dispose();
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
const { positions: u, indices: p } =
|
|
477
|
+
const { positions: u, indices: p } = ft(a), g = new Float32Array([
|
|
478
478
|
h.x,
|
|
479
479
|
h.y,
|
|
480
480
|
h.z
|
|
@@ -485,21 +485,21 @@ let __tla = (async () => {
|
|
|
485
485
|
]);
|
|
486
486
|
o.onStatus("Detecting shell type...");
|
|
487
487
|
const f = c.detect_shell(u, p, M, 40), m = f.is_double_shell(), x = f.surface_normal();
|
|
488
|
-
|
|
488
|
+
de.info(Fe, `Shell: ${m ? "DOUBLE" : "SINGLE"}`, f.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, m), o.onStatus("Finding cross-section plane...");
|
|
489
489
|
const S = new Float32Array([
|
|
490
490
|
x[0],
|
|
491
491
|
x[1],
|
|
492
492
|
x[2]
|
|
493
|
-
]), I = c.find_min_cross_section(u, p, M, S, 10),
|
|
494
|
-
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
]), b = c.align_to_origin(u, g, M,
|
|
493
|
+
]), I = c.find_min_cross_section(u, p, M, S, 10), P = I.plane_normal();
|
|
494
|
+
de.info(Fe, "Cross-section found", I.details()), o.onStatus("Aligning mesh...");
|
|
495
|
+
const L = new Float32Array([
|
|
496
|
+
P[0],
|
|
497
|
+
P[1],
|
|
498
|
+
P[2]
|
|
499
|
+
]), b = c.align_to_origin(u, g, M, L);
|
|
500
500
|
let z = b.positions(), y = b.mpt(), D = b.origin();
|
|
501
501
|
const w = b.transform();
|
|
502
|
-
|
|
502
|
+
de.info(Fe, "Alignment complete", b.details());
|
|
503
503
|
const A = [
|
|
504
504
|
w[3],
|
|
505
505
|
w[4],
|
|
@@ -511,35 +511,35 @@ let __tla = (async () => {
|
|
|
511
511
|
w[10],
|
|
512
512
|
w[11]
|
|
513
513
|
], k = new Float32Array([
|
|
514
|
-
A[0] *
|
|
515
|
-
A[3] *
|
|
516
|
-
A[6] *
|
|
514
|
+
A[0] * P[0] + A[1] * P[1] + A[2] * P[2],
|
|
515
|
+
A[3] * P[0] + A[4] * P[1] + A[5] * P[2],
|
|
516
|
+
A[6] * P[0] + A[7] * P[1] + A[8] * P[2]
|
|
517
517
|
]);
|
|
518
518
|
o.onStatus("Generating measurement points...");
|
|
519
519
|
const B = c.subdivide_origin_to_plane(new Float32Array(D), new Float32Array(y), k);
|
|
520
|
-
|
|
520
|
+
de.debug(Fe, `Subdivide: ${B.count()} pts, spacing=${B.spacing().toFixed(1)}mm`);
|
|
521
521
|
const $ = B.points(), N = B.count(), U = 2, be = 1, ae = [];
|
|
522
522
|
for (let H = U; H < N - be; H++) ae.push($[H * 3 + 1]);
|
|
523
523
|
o.onStatus("Computing cross-sections...");
|
|
524
|
-
let
|
|
524
|
+
let ue = [];
|
|
525
525
|
if (ae.length >= 2) {
|
|
526
526
|
const q = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(z, p, new Float32Array(ae), 10);
|
|
527
|
-
|
|
527
|
+
de.debug(Fe, "Batch (subdivision)", q.details());
|
|
528
528
|
const xe = q.all_loop_points(), Ce = q.offsets(), we = q.circumferences();
|
|
529
529
|
for (let oe = 0; oe < Ce.length - 1; oe++) {
|
|
530
530
|
const V = Ce[oe], X = Ce[oe + 1];
|
|
531
531
|
if (X <= V || we[oe] <= 0) continue;
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
let
|
|
535
|
-
for (let ze = V; ze < X; ze += 3)
|
|
536
|
-
|
|
532
|
+
const Pe = (X - V) / 3;
|
|
533
|
+
if (Pe < 3) continue;
|
|
534
|
+
let Le = 0, Ge = 0, se = 0;
|
|
535
|
+
for (let ze = V; ze < X; ze += 3) Le += xe[ze], Ge += xe[ze + 1], se += xe[ze + 2];
|
|
536
|
+
ue.push(Le / Pe, Ge / Pe, se / Pe);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
if (
|
|
539
|
+
if (ue.length >= 6) {
|
|
540
540
|
o.onStatus("Refining alignment...");
|
|
541
|
-
const H = c.refine_alignment(new Float32Array(
|
|
542
|
-
|
|
541
|
+
const H = c.refine_alignment(new Float32Array(ue), z, new Float32Array(D), new Float32Array(y));
|
|
542
|
+
de.info(Fe, "Refinement complete", H.details()), z = H.positions(), y = H.mpt(), D = H.origin();
|
|
543
543
|
}
|
|
544
544
|
const ie = a.getAttribute("color"), J = mn(z, p);
|
|
545
545
|
ie && J.setAttribute("color", ie), a.dispose(), a = J, e.geometry = a, a.computeVertexNormals(), a.computeBoundingBox(), n[0] = new C(D[0], D[1], D[2]), n[1] = new C(y[0], y[1], y[2]), o.onStatus("Setting blue point...");
|
|
@@ -566,10 +566,10 @@ let __tla = (async () => {
|
|
|
566
566
|
y: H.y,
|
|
567
567
|
z: H.z
|
|
568
568
|
}))), o.setAligned(true);
|
|
569
|
-
const
|
|
570
|
-
|
|
569
|
+
const he = a.boundingBox, Z = new C();
|
|
570
|
+
he.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(n[1].y + 2 * dt), o.onStatus("Computing final measurements...");
|
|
571
571
|
{
|
|
572
|
-
const H =
|
|
572
|
+
const H = ft(a), q = n[1].y, xe = n[0].y;
|
|
573
573
|
let Ce = 1 / 0, we = -1 / 0;
|
|
574
574
|
const oe = H.positions;
|
|
575
575
|
for (let se = 1; se < oe.length; se += 3) oe[se] < Ce && (Ce = oe[se]), oe[se] > we && (we = oe[se]);
|
|
@@ -580,24 +580,24 @@ let __tla = (async () => {
|
|
|
580
580
|
ze < we - 1 && X.push(ze);
|
|
581
581
|
}
|
|
582
582
|
for (let se = q - V; se > xe; se -= V) X.push(se);
|
|
583
|
-
X.sort((se, ze) => se - ze),
|
|
584
|
-
const
|
|
585
|
-
|
|
583
|
+
X.sort((se, ze) => se - ze), de.info(Fe, `Horizontal slices: ${X.length} Y planes, range ${(_b = X[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = X[X.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
|
|
584
|
+
const Le = (m ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(H.positions, H.indices, new Float32Array(X), 10);
|
|
585
|
+
de.info(Fe, `Horizontal slices (${m ? "inner" : "outer"}): ${Le.count()}/${X.length} valid`), de.debug(Fe, "Slice details", Le.details());
|
|
586
586
|
const Ge = {
|
|
587
587
|
yValues: X,
|
|
588
|
-
circumferences: Array.from(
|
|
589
|
-
allLoopPoints: new Float32Array(
|
|
590
|
-
offsets: new Uint32Array(
|
|
588
|
+
circumferences: Array.from(Le.circumferences()),
|
|
589
|
+
allLoopPoints: new Float32Array(Le.all_loop_points()),
|
|
590
|
+
offsets: new Uint32Array(Le.offsets()),
|
|
591
591
|
mptY: q,
|
|
592
592
|
originY: xe
|
|
593
593
|
};
|
|
594
594
|
(_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ge);
|
|
595
595
|
}
|
|
596
596
|
o.onStatus("Validating results...");
|
|
597
|
-
const
|
|
598
|
-
|
|
597
|
+
const ge = n[1].y, me = n[0].y, pe = go(a, ge, me, t);
|
|
598
|
+
pe.valid || de.warn(Fe, `Validation: ${pe.reason}`), o.setClippedReferenceGeometry ? (l.computeVertexNormals(), o.setClippedReferenceGeometry(l)) : l.dispose();
|
|
599
599
|
} catch (a) {
|
|
600
|
-
|
|
600
|
+
de.error(Fe, "Processing failed", a), o.setError(a instanceof Error ? a.message : "Failed to process mesh."), l.dispose();
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
class xo extends Kn {
|
|
@@ -767,7 +767,7 @@ let __tla = (async () => {
|
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
769
|
const wo = ({ mesh: e, maxPoints: r = 2, meshColor: t = "#c8c8c8", meshOpacity: o = 1, frontFaceOnly: l = false, doubleShellTransparency: s = false }) => {
|
|
770
|
-
const { addLandmarkPoint: c, landmarkPoints: a } =
|
|
770
|
+
const { addLandmarkPoint: c, landmarkPoints: a } = Dt(), n = re((g) => {
|
|
771
771
|
if (a.length >= r) return;
|
|
772
772
|
g.stopPropagation();
|
|
773
773
|
const M = g.intersections[0], f = M == null ? void 0 : M.faceIndex;
|
|
@@ -783,9 +783,9 @@ let __tla = (async () => {
|
|
|
783
783
|
f * 3 + 1,
|
|
784
784
|
f * 3 + 2
|
|
785
785
|
];
|
|
786
|
-
const I = m.getAttribute("position"),
|
|
787
|
-
|
|
788
|
-
const z = M.point, y = bo(z,
|
|
786
|
+
const I = m.getAttribute("position"), P = new C().fromBufferAttribute(I, S[0]), L = new C().fromBufferAttribute(I, S[1]), b = new C().fromBufferAttribute(I, S[2]);
|
|
787
|
+
P.applyMatrix4(e.matrixWorld), L.applyMatrix4(e.matrixWorld), b.applyMatrix4(e.matrixWorld);
|
|
788
|
+
const z = M.point, y = bo(z, P, L, b), D = {
|
|
789
789
|
faceIndex: f,
|
|
790
790
|
vertexIndices: S,
|
|
791
791
|
position: {
|
|
@@ -869,7 +869,7 @@ let __tla = (async () => {
|
|
|
869
869
|
]
|
|
870
870
|
}, r);
|
|
871
871
|
}, vo = ({ modelSize: e, labels: r }) => {
|
|
872
|
-
const { landmarkPoints: t } =
|
|
872
|
+
const { landmarkPoints: t } = Dt(), o = e * 0.02, l = [
|
|
873
873
|
"#44ff44",
|
|
874
874
|
"#ff4444",
|
|
875
875
|
"#4444ff"
|
|
@@ -889,8 +889,8 @@ let __tla = (async () => {
|
|
|
889
889
|
});
|
|
890
890
|
};
|
|
891
891
|
function bn(e) {
|
|
892
|
-
return j(() => e ? new
|
|
893
|
-
maxLeafTris:
|
|
892
|
+
return j(() => e ? new pt(e, {
|
|
893
|
+
maxLeafTris: ht
|
|
894
894
|
}) : null, [
|
|
895
895
|
e
|
|
896
896
|
]);
|
|
@@ -936,8 +936,8 @@ let __tla = (async () => {
|
|
|
936
936
|
u
|
|
937
937
|
]), g = d ?? (p == null ? void 0 : p.linePoints) ?? [], M = u ?? (p == null ? void 0 : p.lineLength) ?? 0, f = j(() => {
|
|
938
938
|
if (n == null || M <= 0 || g.length < 2) return null;
|
|
939
|
-
const I = n / M,
|
|
940
|
-
return g.map((b) => new C(
|
|
939
|
+
const I = n / M, P = g.reduce((b, z) => b + z.x, 0) / g.length, L = g.reduce((b, z) => b + z.z, 0) / g.length;
|
|
940
|
+
return g.map((b) => new C(P + (b.x - P) * I, b.y, L + (b.z - L) * I));
|
|
941
941
|
}, [
|
|
942
942
|
g,
|
|
943
943
|
M,
|
|
@@ -954,13 +954,13 @@ let __tla = (async () => {
|
|
|
954
954
|
const x = le(null), S = j(() => {
|
|
955
955
|
const I = new O.BufferGeometry();
|
|
956
956
|
I.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
|
|
957
|
-
const
|
|
957
|
+
const P = new O.LineBasicMaterial({
|
|
958
958
|
color: 6710886,
|
|
959
959
|
depthTest: false,
|
|
960
960
|
depthWrite: false,
|
|
961
961
|
transparent: true
|
|
962
962
|
});
|
|
963
|
-
return new O.Line(I,
|
|
963
|
+
return new O.Line(I, P);
|
|
964
964
|
}, []);
|
|
965
965
|
return ne(() => () => {
|
|
966
966
|
S.geometry.dispose(), S.material.dispose();
|
|
@@ -978,12 +978,12 @@ let __tla = (async () => {
|
|
|
978
978
|
s
|
|
979
979
|
]), an(({ camera: I }) => {
|
|
980
980
|
if (!x.current || g.length < 2) return;
|
|
981
|
-
const
|
|
982
|
-
I.getWorldDirection(
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
|
|
986
|
-
const b = new C().crossVectors(
|
|
981
|
+
const P = new C();
|
|
982
|
+
I.getWorldDirection(P);
|
|
983
|
+
const L = new C(P.x, 0, P.z);
|
|
984
|
+
if (L.lengthSq() < 1e-8) return;
|
|
985
|
+
L.normalize();
|
|
986
|
+
const b = new C().crossVectors(L, new C(0, 1, 0)).normalize();
|
|
987
987
|
let z = -1 / 0, y = g[0];
|
|
988
988
|
for (const k of g) {
|
|
989
989
|
const B = b.x * k.x + b.z * k.z;
|
|
@@ -996,7 +996,7 @@ let __tla = (async () => {
|
|
|
996
996
|
}), g.length < 2 ? null : F("group", {
|
|
997
997
|
renderOrder: 10,
|
|
998
998
|
children: [
|
|
999
|
-
i(
|
|
999
|
+
i(fe, {
|
|
1000
1000
|
points: g,
|
|
1001
1001
|
color: o,
|
|
1002
1002
|
lineWidth: h,
|
|
@@ -1009,7 +1009,7 @@ let __tla = (async () => {
|
|
|
1009
1009
|
object: m,
|
|
1010
1010
|
renderOrder: 10
|
|
1011
1011
|
}),
|
|
1012
|
-
f && n != null && i(
|
|
1012
|
+
f && n != null && i(fe, {
|
|
1013
1013
|
points: f,
|
|
1014
1014
|
color: rn(M, n),
|
|
1015
1015
|
lineWidth: 2.5,
|
|
@@ -1078,7 +1078,7 @@ let __tla = (async () => {
|
|
|
1078
1078
|
]
|
|
1079
1079
|
}),
|
|
1080
1080
|
n != null && M > 0 && (() => {
|
|
1081
|
-
const I = M - n,
|
|
1081
|
+
const I = M - n, P = I > 0.5 ? "\u25B2" : I < -0.5 ? "\u25BC" : "", L = rn(M, n);
|
|
1082
1082
|
return F("div", {
|
|
1083
1083
|
style: {
|
|
1084
1084
|
display: "flex",
|
|
@@ -1090,18 +1090,18 @@ let __tla = (async () => {
|
|
|
1090
1090
|
borderLeft: "1px solid rgba(255,255,255,0.12)"
|
|
1091
1091
|
},
|
|
1092
1092
|
children: [
|
|
1093
|
-
|
|
1093
|
+
P && i("span", {
|
|
1094
1094
|
style: {
|
|
1095
1095
|
fontSize: 10,
|
|
1096
|
-
color:
|
|
1096
|
+
color: L,
|
|
1097
1097
|
lineHeight: 1
|
|
1098
1098
|
},
|
|
1099
|
-
children:
|
|
1099
|
+
children: P
|
|
1100
1100
|
}),
|
|
1101
1101
|
F("span", {
|
|
1102
1102
|
style: {
|
|
1103
1103
|
fontSize: 13,
|
|
1104
|
-
color:
|
|
1104
|
+
color: L,
|
|
1105
1105
|
fontFamily: "monospace",
|
|
1106
1106
|
fontWeight: 600
|
|
1107
1107
|
},
|
|
@@ -1145,10 +1145,10 @@ let __tla = (async () => {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
return c ? z.sort((y, D) => D - y) : z.sort((y, D) => y - D), z;
|
|
1147
1147
|
}
|
|
1148
|
-
const
|
|
1149
|
-
if (c) for (let b = t; b >= r; b -= o)
|
|
1150
|
-
else for (let b = r; b <= t; b += o)
|
|
1151
|
-
return
|
|
1148
|
+
const L = [];
|
|
1149
|
+
if (c) for (let b = t; b >= r; b -= o) L.push(b);
|
|
1150
|
+
else for (let b = r; b <= t; b += o) L.push(b);
|
|
1151
|
+
return L;
|
|
1152
1152
|
}, [
|
|
1153
1153
|
r,
|
|
1154
1154
|
t,
|
|
@@ -1157,22 +1157,22 @@ let __tla = (async () => {
|
|
|
1157
1157
|
u
|
|
1158
1158
|
]), m = j(() => {
|
|
1159
1159
|
if (!u) return null;
|
|
1160
|
-
const
|
|
1160
|
+
const L = /* @__PURE__ */ new Map(), { allLoopPoints: b, offsets: z, yValues: y } = u;
|
|
1161
1161
|
for (let D = 0; D < z.length - 1; D++) {
|
|
1162
1162
|
const w = z[D], A = z[D + 1];
|
|
1163
1163
|
if (A <= w) continue;
|
|
1164
1164
|
const k = [];
|
|
1165
1165
|
for (let B = w; B < A; B += 3) k.push(new C(b[B], b[B + 1], b[B + 2]));
|
|
1166
|
-
k.length >= 3 &&
|
|
1166
|
+
k.length >= 3 && L.set(y[D], k);
|
|
1167
1167
|
}
|
|
1168
|
-
return
|
|
1168
|
+
return L;
|
|
1169
1169
|
}, [
|
|
1170
1170
|
u
|
|
1171
1171
|
]), x = j(() => {
|
|
1172
1172
|
if (!u) return null;
|
|
1173
|
-
const
|
|
1174
|
-
for (let b = 0; b < u.yValues.length; b++)
|
|
1175
|
-
return
|
|
1173
|
+
const L = /* @__PURE__ */ new Map();
|
|
1174
|
+
for (let b = 0; b < u.yValues.length; b++) L.set(u.yValues[b], u.circumferences[b]);
|
|
1175
|
+
return L;
|
|
1176
1176
|
}, [
|
|
1177
1177
|
u
|
|
1178
1178
|
]);
|
|
@@ -1182,12 +1182,12 @@ let __tla = (async () => {
|
|
|
1182
1182
|
f
|
|
1183
1183
|
]), ne(() => {
|
|
1184
1184
|
if (!x || !s) return;
|
|
1185
|
-
const
|
|
1185
|
+
const L = f.filter((b) => (x.get(b) ?? 0) > 0).map((b) => ({
|
|
1186
1186
|
yPosition: b,
|
|
1187
1187
|
originalValue: x.get(b) ?? 0,
|
|
1188
1188
|
modifiedValue: null
|
|
1189
1189
|
}));
|
|
1190
|
-
s(
|
|
1190
|
+
s(L);
|
|
1191
1191
|
}, [
|
|
1192
1192
|
x,
|
|
1193
1193
|
f,
|
|
@@ -1195,9 +1195,9 @@ let __tla = (async () => {
|
|
|
1195
1195
|
]);
|
|
1196
1196
|
const S = [
|
|
1197
1197
|
"#5B9BD5"
|
|
1198
|
-
], I = l * io,
|
|
1198
|
+
], I = l * io, P = re((L) => {
|
|
1199
1199
|
if (x) return;
|
|
1200
|
-
p.current.set(
|
|
1200
|
+
p.current.set(L.yPosition, L);
|
|
1201
1201
|
const b = Array.from(p.current.values()).sort((z, y) => c ? y.yPosition - z.yPosition : z.yPosition - y.yPosition);
|
|
1202
1202
|
s == null ? void 0 : s(b);
|
|
1203
1203
|
}, [
|
|
@@ -1206,22 +1206,22 @@ let __tla = (async () => {
|
|
|
1206
1206
|
x
|
|
1207
1207
|
]);
|
|
1208
1208
|
return M ? i(Oe, {
|
|
1209
|
-
children: f.map((
|
|
1209
|
+
children: f.map((L, b) => i(ko, {
|
|
1210
1210
|
bvh: M,
|
|
1211
1211
|
geometry: g,
|
|
1212
|
-
yPosition:
|
|
1213
|
-
color: d != null && Math.abs(
|
|
1212
|
+
yPosition: L,
|
|
1213
|
+
color: d != null && Math.abs(L - d) < o * 0.5 ? "#44ff44" : S[b % S.length],
|
|
1214
1214
|
labelX: I,
|
|
1215
|
-
onDataChange:
|
|
1215
|
+
onDataChange: P,
|
|
1216
1216
|
displayUnit: a,
|
|
1217
1217
|
useInnerSurface: n,
|
|
1218
1218
|
formValue: h == null ? void 0 : h[b],
|
|
1219
|
-
lineWidth: d != null && Math.abs(
|
|
1220
|
-
wasmLoopPoints: m == null ? void 0 : m.get(
|
|
1221
|
-
wasmCircumference: x == null ? void 0 : x.get(
|
|
1222
|
-
},
|
|
1219
|
+
lineWidth: d != null && Math.abs(L - d) < o * 0.5 ? 4 : 1.5,
|
|
1220
|
+
wasmLoopPoints: m == null ? void 0 : m.get(L),
|
|
1221
|
+
wasmCircumference: x == null ? void 0 : x.get(L)
|
|
1222
|
+
}, L))
|
|
1223
1223
|
}) : null;
|
|
1224
|
-
},
|
|
1224
|
+
}, Po = ({ mesh: e, greenY: r, modelSize: t, displayUnit: o = "mm", bottomY: l }) => {
|
|
1225
1225
|
var _a;
|
|
1226
1226
|
const s = e.geometry;
|
|
1227
1227
|
s.computeBoundingBox();
|
|
@@ -1230,11 +1230,11 @@ let __tla = (async () => {
|
|
|
1230
1230
|
if (!d.current) return;
|
|
1231
1231
|
const I = new C();
|
|
1232
1232
|
S.getWorldDirection(I);
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
d.current.position.set(
|
|
1233
|
+
const P = new C(I.x, 0, I.z);
|
|
1234
|
+
if (P.lengthSq() < 1e-8) return;
|
|
1235
|
+
P.normalize();
|
|
1236
|
+
const L = new C().crossVectors(new C(0, 1, 0), P).normalize();
|
|
1237
|
+
d.current.position.set(L.x * n, 0, L.z * n);
|
|
1238
1238
|
const b = S.position.x - d.current.position.x, z = S.position.z - d.current.position.z;
|
|
1239
1239
|
d.current.rotation.y = Math.atan2(b, z);
|
|
1240
1240
|
});
|
|
@@ -1242,7 +1242,7 @@ let __tla = (async () => {
|
|
|
1242
1242
|
return F("group", {
|
|
1243
1243
|
ref: d,
|
|
1244
1244
|
children: [
|
|
1245
|
-
i(
|
|
1245
|
+
i(fe, {
|
|
1246
1246
|
points: [
|
|
1247
1247
|
u,
|
|
1248
1248
|
p
|
|
@@ -1250,7 +1250,7 @@ let __tla = (async () => {
|
|
|
1250
1250
|
color: "#888888",
|
|
1251
1251
|
lineWidth: 1.5
|
|
1252
1252
|
}),
|
|
1253
|
-
i(
|
|
1253
|
+
i(fe, {
|
|
1254
1254
|
points: [
|
|
1255
1255
|
M,
|
|
1256
1256
|
f
|
|
@@ -1258,7 +1258,7 @@ let __tla = (async () => {
|
|
|
1258
1258
|
color: "#888888",
|
|
1259
1259
|
lineWidth: 1.5
|
|
1260
1260
|
}),
|
|
1261
|
-
i(
|
|
1261
|
+
i(fe, {
|
|
1262
1262
|
points: [
|
|
1263
1263
|
m,
|
|
1264
1264
|
x
|
|
@@ -1300,8 +1300,8 @@ let __tla = (async () => {
|
|
|
1300
1300
|
})
|
|
1301
1301
|
]
|
|
1302
1302
|
});
|
|
1303
|
-
},
|
|
1304
|
-
const { set: h, size: d, camera: u, invalidate: p } = cn(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t),
|
|
1303
|
+
}, Lo = ({ modelSize: e, isAligned: r, isCut: t, mesh: o, viewMode: l, sliceY: s, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: n }) => {
|
|
1304
|
+
const { set: h, size: d, camera: u, invalidate: p } = cn(), g = le(false), M = le(l), f = le(new C()), m = le(null), x = le(c), S = le(r), I = le(t), P = le(a), L = le(0), b = re(() => {
|
|
1305
1305
|
if (!o || e <= 0) return null;
|
|
1306
1306
|
const y = a ?? o.geometry;
|
|
1307
1307
|
y.computeBoundingBox();
|
|
@@ -1310,7 +1310,7 @@ let __tla = (async () => {
|
|
|
1310
1310
|
const A = new C();
|
|
1311
1311
|
D.getSize(A), f.current.copy(A);
|
|
1312
1312
|
const k = d.width / d.height, B = Math.max(A.y, A.x / k) * 1.6, $ = B * k, N = w.y - A.y * 0.05;
|
|
1313
|
-
|
|
1313
|
+
L.current = N;
|
|
1314
1314
|
const U = new O.OrthographicCamera(-$ / 2, $ / 2, B / 2, -B / 2, 0.1, e * 10);
|
|
1315
1315
|
return U.position.set(0, N, e * 2), U.lookAt(0, N, 0), U;
|
|
1316
1316
|
}, [
|
|
@@ -1363,8 +1363,8 @@ let __tla = (async () => {
|
|
|
1363
1363
|
u,
|
|
1364
1364
|
z
|
|
1365
1365
|
]), ne(() => {
|
|
1366
|
-
const y = S.current !== r, D = I.current !== t, w = !
|
|
1367
|
-
if (S.current = r, I.current = t,
|
|
1366
|
+
const y = S.current !== r, D = I.current !== t, w = !P.current && !!a;
|
|
1367
|
+
if (S.current = r, I.current = t, P.current = a, !y && !D && !w || !r || l !== "3D") return;
|
|
1368
1368
|
const A = b();
|
|
1369
1369
|
A && h({
|
|
1370
1370
|
camera: A
|
|
@@ -1384,20 +1384,20 @@ let __tla = (async () => {
|
|
|
1384
1384
|
m.current = u;
|
|
1385
1385
|
const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
|
|
1386
1386
|
let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
|
|
1387
|
-
for (let
|
|
1388
|
-
const H = A[
|
|
1387
|
+
for (let pe = 0; pe < w.count; pe++) if (Math.abs(A[pe * 3 + 1] - s) < k) {
|
|
1388
|
+
const H = A[pe * 3], q = A[pe * 3 + 2];
|
|
1389
1389
|
H < B && (B = H), H > $ && ($ = H), q < N && (N = q), q > U && (U = q), be = true;
|
|
1390
1390
|
}
|
|
1391
1391
|
if (!be) {
|
|
1392
1392
|
D.computeBoundingBox();
|
|
1393
|
-
const
|
|
1394
|
-
B =
|
|
1393
|
+
const pe = D.boundingBox;
|
|
1394
|
+
B = pe.min.x, $ = pe.max.x, N = pe.min.z, U = pe.max.z;
|
|
1395
1395
|
}
|
|
1396
|
-
const ae = (B + $) / 2,
|
|
1397
|
-
let Z,
|
|
1398
|
-
Y /
|
|
1399
|
-
const me = new O.OrthographicCamera(-Z / 2, Z / 2,
|
|
1400
|
-
me.position.set(ae, s + e * 2,
|
|
1396
|
+
const ae = (B + $) / 2, ue = (N + U) / 2, ie = d.width / d.height, J = 1.4, Y = ($ - B) * J, he = (U - N) * J;
|
|
1397
|
+
let Z, ge;
|
|
1398
|
+
Y / he > ie ? (Z = Y, ge = Y / ie) : (ge = he, Z = he * ie);
|
|
1399
|
+
const me = new O.OrthographicCamera(-Z / 2, Z / 2, ge / 2, -ge / 2, 0.1, e * 10);
|
|
1400
|
+
me.position.set(ae, s + e * 2, ue), me.up.set(0, 0, -1), me.lookAt(ae, s, ue), h({
|
|
1401
1401
|
camera: me
|
|
1402
1402
|
});
|
|
1403
1403
|
} else if (y === "2D") if (m.current) h({
|
|
@@ -1428,17 +1428,17 @@ let __tla = (async () => {
|
|
|
1428
1428
|
const D = o.geometry, w = D.getAttribute("position"), A = w.array, k = e * 0.15;
|
|
1429
1429
|
let B = 1 / 0, $ = -1 / 0, N = 1 / 0, U = -1 / 0, be = false;
|
|
1430
1430
|
for (let Z = 0; Z < w.count; Z++) if (Math.abs(A[Z * 3 + 1] - s) < k) {
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1431
|
+
const ge = A[Z * 3], me = A[Z * 3 + 2];
|
|
1432
|
+
ge < B && (B = ge), ge > $ && ($ = ge), me < N && (N = me), me > U && (U = me), be = true;
|
|
1433
1433
|
}
|
|
1434
1434
|
if (!be) {
|
|
1435
1435
|
D.computeBoundingBox();
|
|
1436
1436
|
const Z = D.boundingBox;
|
|
1437
1437
|
B = Z.min.x, $ = Z.max.x, N = Z.min.z, U = Z.max.z;
|
|
1438
1438
|
}
|
|
1439
|
-
const ae = d.width / d.height,
|
|
1440
|
-
let Y,
|
|
1441
|
-
ie / J > ae ? (Y = ie,
|
|
1439
|
+
const ae = d.width / d.height, ue = 1.4, ie = ($ - B) * ue, J = (U - N) * ue;
|
|
1440
|
+
let Y, he;
|
|
1441
|
+
ie / J > ae ? (Y = ie, he = ie / ae) : (he = J, Y = J * ae), y.left = -Y / 2, y.right = Y / 2, y.top = he / 2, y.bottom = -he / 2;
|
|
1442
1442
|
} else {
|
|
1443
1443
|
const D = f.current, w = d.width / d.height, A = Math.max(D.y, D.x / w) * 1.6, k = A * w;
|
|
1444
1444
|
y.left = -k / 2, y.right = k / 2, y.top = A / 2, y.bottom = -A / 2;
|
|
@@ -1618,24 +1618,24 @@ let __tla = (async () => {
|
|
|
1618
1618
|
}, o.number);
|
|
1619
1619
|
})
|
|
1620
1620
|
}), Ro = ({ mesh: e, upperY: r, originY: t, modelSize: o, meshColor: l = "#c8c8c8", displayUnit: s = "mm" }) => {
|
|
1621
|
-
const c = e.geometry, a = j(() => new
|
|
1622
|
-
maxLeafTris:
|
|
1621
|
+
const c = e.geometry, a = j(() => new pt(c, {
|
|
1622
|
+
maxLeafTris: ht
|
|
1623
1623
|
}), [
|
|
1624
1624
|
c
|
|
1625
1625
|
]), n = j(() => Ye(a, c, t), [
|
|
1626
1626
|
a,
|
|
1627
1627
|
c,
|
|
1628
1628
|
t
|
|
1629
|
-
]), h = j(() => new
|
|
1629
|
+
]), h = j(() => new ut(new C(0, -1, 0), r), [
|
|
1630
1630
|
r
|
|
1631
1631
|
]), { mlLine: d, apLine: u, mlWidth: p, apWidth: g } = j(() => {
|
|
1632
1632
|
let m = null, x = null, S = 0, I = 0;
|
|
1633
1633
|
if (n.linePoints.length >= 2) {
|
|
1634
|
-
let
|
|
1635
|
-
for (const y of n.linePoints) y.x <
|
|
1634
|
+
let P = n.linePoints[0], L = n.linePoints[0], b = n.linePoints[0], z = n.linePoints[0];
|
|
1635
|
+
for (const y of n.linePoints) y.x < P.x && (P = y), y.x > L.x && (L = y), y.z < b.z && (b = y), y.z > z.z && (z = y);
|
|
1636
1636
|
m = [
|
|
1637
|
-
new C(
|
|
1638
|
-
new C(
|
|
1637
|
+
new C(P.x, t, P.z),
|
|
1638
|
+
new C(L.x, t, L.z)
|
|
1639
1639
|
], x = [
|
|
1640
1640
|
new C(b.x, t, b.z),
|
|
1641
1641
|
new C(z.x, t, z.z)
|
|
@@ -1666,7 +1666,7 @@ let __tla = (async () => {
|
|
|
1666
1666
|
]
|
|
1667
1667
|
})
|
|
1668
1668
|
}),
|
|
1669
|
-
n.linePoints.length >= 2 && i(
|
|
1669
|
+
n.linePoints.length >= 2 && i(fe, {
|
|
1670
1670
|
points: n.linePoints,
|
|
1671
1671
|
color: "#00ff00",
|
|
1672
1672
|
lineWidth: 3,
|
|
@@ -1676,7 +1676,7 @@ let __tla = (async () => {
|
|
|
1676
1676
|
}),
|
|
1677
1677
|
d && F(Oe, {
|
|
1678
1678
|
children: [
|
|
1679
|
-
i(
|
|
1679
|
+
i(fe, {
|
|
1680
1680
|
points: d,
|
|
1681
1681
|
color: "#ff8800",
|
|
1682
1682
|
lineWidth: 2,
|
|
@@ -1720,7 +1720,7 @@ let __tla = (async () => {
|
|
|
1720
1720
|
}),
|
|
1721
1721
|
u && F(Oe, {
|
|
1722
1722
|
children: [
|
|
1723
|
-
i(
|
|
1723
|
+
i(fe, {
|
|
1724
1724
|
points: u,
|
|
1725
1725
|
color: "#ff00ff",
|
|
1726
1726
|
lineWidth: 2,
|
|
@@ -1765,18 +1765,18 @@ let __tla = (async () => {
|
|
|
1765
1765
|
]
|
|
1766
1766
|
});
|
|
1767
1767
|
}, Wo = ({ mesh: e, yPosition: r, onYChange: t, minY: o, maxY: l, modelSize: s, color: c, hoverColor: a, dragColor: n, label: h, onDragStart: d, onDragEnd: u }) => {
|
|
1768
|
-
const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = cn(), S = le(0), I = e.geometry,
|
|
1768
|
+
const [p, g] = E(false), [M, f] = E(false), { camera: m, gl: x } = cn(), S = le(0), I = e.geometry, P = bn(I), L = j(() => P ? Ye(P, I, r) : {
|
|
1769
1769
|
linePoints: [],
|
|
1770
1770
|
lineLength: 0,
|
|
1771
1771
|
rightmostPoint: new C()
|
|
1772
1772
|
}, [
|
|
1773
|
-
|
|
1773
|
+
P,
|
|
1774
1774
|
I,
|
|
1775
1775
|
r
|
|
1776
1776
|
]), b = re((A, k) => {
|
|
1777
1777
|
const B = x.domElement.getBoundingClientRect(), $ = (A - B.left) / B.width * 2 - 1, N = -((k - B.top) / B.height) * 2 + 1, U = new qn();
|
|
1778
1778
|
U.setFromCamera(new O.Vector2($, N), m);
|
|
1779
|
-
const be = new
|
|
1779
|
+
const be = new ut(new C(0, 0, 1), 0), ae = new C();
|
|
1780
1780
|
return U.ray.intersectPlane(be, ae), ae ? ae.y : r;
|
|
1781
1781
|
}, [
|
|
1782
1782
|
m,
|
|
@@ -1805,13 +1805,13 @@ let __tla = (async () => {
|
|
|
1805
1805
|
x,
|
|
1806
1806
|
u
|
|
1807
1807
|
]);
|
|
1808
|
-
if (
|
|
1808
|
+
if (L.linePoints.length < 2) return null;
|
|
1809
1809
|
const w = p ? n : M ? a : c;
|
|
1810
1810
|
return F("group", {
|
|
1811
1811
|
renderOrder: 10,
|
|
1812
1812
|
children: [
|
|
1813
|
-
i(
|
|
1814
|
-
points:
|
|
1813
|
+
i(fe, {
|
|
1814
|
+
points: L.linePoints,
|
|
1815
1815
|
color: w,
|
|
1816
1816
|
lineWidth: p ? 6 : M ? 5 : 4,
|
|
1817
1817
|
depthTest: false,
|
|
@@ -1830,7 +1830,7 @@ let __tla = (async () => {
|
|
|
1830
1830
|
}),
|
|
1831
1831
|
(M || p) && i("mesh", {
|
|
1832
1832
|
position: [
|
|
1833
|
-
|
|
1833
|
+
L.rightmostPoint.x + s * 0.15,
|
|
1834
1834
|
r,
|
|
1835
1835
|
0
|
|
1836
1836
|
],
|
|
@@ -1893,7 +1893,7 @@ let __tla = (async () => {
|
|
|
1893
1893
|
fontFamily: "system-ui, sans-serif",
|
|
1894
1894
|
letterSpacing: "0.4px",
|
|
1895
1895
|
lineHeight: "36px"
|
|
1896
|
-
},
|
|
1896
|
+
}, It = {
|
|
1897
1897
|
width: "100%",
|
|
1898
1898
|
padding: "10px 12px",
|
|
1899
1899
|
fontSize: 15,
|
|
@@ -1913,7 +1913,7 @@ let __tla = (async () => {
|
|
|
1913
1913
|
a,
|
|
1914
1914
|
c,
|
|
1915
1915
|
n
|
|
1916
|
-
]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [
|
|
1916
|
+
]), [d, u] = E({}), [p, g] = E(""), [M, f] = E(false), [m, x] = E(false), [S, I] = E(null), [P, L] = E(""), b = j(() => {
|
|
1917
1917
|
const w = p !== "" && !isNaN(parseFloat(p)), A = h.some((k) => {
|
|
1918
1918
|
const B = d[k];
|
|
1919
1919
|
return B != null && B !== "" && !isNaN(parseFloat(B));
|
|
@@ -1956,8 +1956,8 @@ let __tla = (async () => {
|
|
|
1956
1956
|
f(false), x(true);
|
|
1957
1957
|
}, []);
|
|
1958
1958
|
if (m) {
|
|
1959
|
-
const w = S != null && (S !== "Other" ||
|
|
1960
|
-
w && s(S === "Other" ? `Other: ${
|
|
1959
|
+
const w = S != null && (S !== "Other" || P.trim() !== ""), A = () => {
|
|
1960
|
+
w && s(S === "Other" ? `Other: ${P.trim()}` : S);
|
|
1961
1961
|
};
|
|
1962
1962
|
return i("div", {
|
|
1963
1963
|
style: {
|
|
@@ -2030,7 +2030,7 @@ let __tla = (async () => {
|
|
|
2030
2030
|
name: "skip-reason",
|
|
2031
2031
|
checked: S === k,
|
|
2032
2032
|
onChange: () => {
|
|
2033
|
-
I(k), k !== "Other" &&
|
|
2033
|
+
I(k), k !== "Other" && L("");
|
|
2034
2034
|
},
|
|
2035
2035
|
style: {
|
|
2036
2036
|
accentColor: "rgb(12, 67, 173)",
|
|
@@ -2053,13 +2053,13 @@ let __tla = (async () => {
|
|
|
2053
2053
|
autoFocus: true,
|
|
2054
2054
|
type: "text",
|
|
2055
2055
|
placeholder: "Please describe...",
|
|
2056
|
-
value:
|
|
2057
|
-
onChange: (k) =>
|
|
2056
|
+
value: P,
|
|
2057
|
+
onChange: (k) => L(k.target.value),
|
|
2058
2058
|
onKeyDown: (k) => {
|
|
2059
2059
|
k.key === "Enter" && A();
|
|
2060
2060
|
},
|
|
2061
2061
|
style: {
|
|
2062
|
-
...
|
|
2062
|
+
...It,
|
|
2063
2063
|
marginTop: 8,
|
|
2064
2064
|
marginLeft: 40,
|
|
2065
2065
|
width: "calc(100% - 40px)",
|
|
@@ -2079,7 +2079,7 @@ let __tla = (async () => {
|
|
|
2079
2079
|
children: [
|
|
2080
2080
|
i("button", {
|
|
2081
2081
|
onClick: () => {
|
|
2082
|
-
x(false), I(null),
|
|
2082
|
+
x(false), I(null), L("");
|
|
2083
2083
|
},
|
|
2084
2084
|
style: {
|
|
2085
2085
|
...Ne,
|
|
@@ -2319,7 +2319,7 @@ let __tla = (async () => {
|
|
|
2319
2319
|
[w]: k.target.value
|
|
2320
2320
|
})),
|
|
2321
2321
|
style: {
|
|
2322
|
-
...
|
|
2322
|
+
...It,
|
|
2323
2323
|
padding: "8px 10px",
|
|
2324
2324
|
fontSize: 14,
|
|
2325
2325
|
borderColor: d[w] ? "rgb(12, 67, 173)" : "#ccc"
|
|
@@ -2370,7 +2370,7 @@ let __tla = (async () => {
|
|
|
2370
2370
|
value: p,
|
|
2371
2371
|
onChange: (w) => g(w.target.value),
|
|
2372
2372
|
style: {
|
|
2373
|
-
...
|
|
2373
|
+
...It,
|
|
2374
2374
|
padding: "8px 10px",
|
|
2375
2375
|
fontSize: 14,
|
|
2376
2376
|
borderColor: p ? "rgb(12, 67, 173)" : "#ccc"
|
|
@@ -2432,12 +2432,12 @@ let __tla = (async () => {
|
|
|
2432
2432
|
const s = 30, c = l / s, a = [];
|
|
2433
2433
|
for (let m = 0; m < s; m++) {
|
|
2434
2434
|
const x = r + m * c, S = r + (m + 1) * c;
|
|
2435
|
-
let I = 0,
|
|
2435
|
+
let I = 0, P = 0, L = 0, b = 0;
|
|
2436
2436
|
for (let z = 0; z < o.count; z++) {
|
|
2437
2437
|
const y = o.getY(z);
|
|
2438
|
-
y >= x && y < S && (I += o.getX(z),
|
|
2438
|
+
y >= x && y < S && (I += o.getX(z), P += y, L += o.getZ(z), b++);
|
|
2439
2439
|
}
|
|
2440
|
-
b > 20 && a.push(new C(I / b,
|
|
2440
|
+
b > 20 && a.push(new C(I / b, P / b, L / b));
|
|
2441
2441
|
}
|
|
2442
2442
|
if (a.length < 5) return null;
|
|
2443
2443
|
const n = new C();
|
|
@@ -2450,9 +2450,9 @@ let __tla = (async () => {
|
|
|
2450
2450
|
}
|
|
2451
2451
|
let f = new C(0.01, 1, 0.01).normalize();
|
|
2452
2452
|
for (let m = 0; m < 30; m++) {
|
|
2453
|
-
const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z,
|
|
2454
|
-
if (
|
|
2455
|
-
f =
|
|
2453
|
+
const x = h * f.x + d * f.y + u * f.z, S = d * f.x + p * f.y + g * f.z, I = u * f.x + g * f.y + M * f.z, P = new C(x, S, I), L = P.length();
|
|
2454
|
+
if (L < 1e-10 || (P.divideScalar(L), f.distanceTo(P) < 1e-8)) break;
|
|
2455
|
+
f = P;
|
|
2456
2456
|
}
|
|
2457
2457
|
return f.y < 0 && f.negate(), f;
|
|
2458
2458
|
}
|
|
@@ -2501,7 +2501,7 @@ let __tla = (async () => {
|
|
|
2501
2501
|
for (let f = 0; f < 3; f++) {
|
|
2502
2502
|
let m = new C(1 + f * 0.1, 1 - f * 0.1, 0.5 + f * 0.3).normalize(), x = 0;
|
|
2503
2503
|
for (let S = 0; S < 100; S++) {
|
|
2504
|
-
const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z,
|
|
2504
|
+
const I = p[0][0] * m.x + p[0][1] * m.y + p[0][2] * m.z, P = p[1][0] * m.x + p[1][1] * m.y + p[1][2] * m.z, L = p[2][0] * m.x + p[2][1] * m.y + p[2][2] * m.z, b = new C(I, P, L);
|
|
2505
2505
|
if (x = b.length(), x < 1e-12) break;
|
|
2506
2506
|
if (b.divideScalar(x), m.distanceTo(b) < 1e-10) {
|
|
2507
2507
|
m = b;
|
|
@@ -2511,16 +2511,16 @@ let __tla = (async () => {
|
|
|
2511
2511
|
}
|
|
2512
2512
|
d.push(m.clone()), u.push(x);
|
|
2513
2513
|
for (let S = 0; S < 3; S++) for (let I = 0; I < 3; I++) {
|
|
2514
|
-
const
|
|
2514
|
+
const P = [
|
|
2515
2515
|
m.x,
|
|
2516
2516
|
m.y,
|
|
2517
2517
|
m.z
|
|
2518
|
-
][S],
|
|
2518
|
+
][S], L = [
|
|
2519
2519
|
m.x,
|
|
2520
2520
|
m.y,
|
|
2521
2521
|
m.z
|
|
2522
2522
|
][I];
|
|
2523
|
-
p[S][I] -= x *
|
|
2523
|
+
p[S][I] -= x * P * L;
|
|
2524
2524
|
}
|
|
2525
2525
|
}
|
|
2526
2526
|
const g = new C();
|
|
@@ -2535,7 +2535,7 @@ let __tla = (async () => {
|
|
|
2535
2535
|
let m = 1 / 0, x = -1 / 0;
|
|
2536
2536
|
const S = d[f];
|
|
2537
2537
|
for (let I = 0; I < t; I++) {
|
|
2538
|
-
const
|
|
2538
|
+
const P = r.getX(I) - g.x, L = r.getY(I) - g.y, b = r.getZ(I) - g.z, z = P * S.x + L * S.y + b * S.z;
|
|
2539
2539
|
z < m && (m = z), z > x && (x = z);
|
|
2540
2540
|
}
|
|
2541
2541
|
M[f] = (x - m) / 2;
|
|
@@ -2551,7 +2551,7 @@ let __tla = (async () => {
|
|
|
2551
2551
|
return i("group", {
|
|
2552
2552
|
children: e.axes.map((r, t) => {
|
|
2553
2553
|
const o = e.center.clone().addScaledVector(r, e.halfExtents[t]), l = e.center.clone().addScaledVector(r, -e.halfExtents[t]);
|
|
2554
|
-
return i(
|
|
2554
|
+
return i(fe, {
|
|
2555
2555
|
points: [
|
|
2556
2556
|
l,
|
|
2557
2557
|
o
|
|
@@ -2623,7 +2623,7 @@ let __tla = (async () => {
|
|
|
2623
2623
|
e
|
|
2624
2624
|
]);
|
|
2625
2625
|
return i("group", {
|
|
2626
|
-
children: r.map((t, o) => i(
|
|
2626
|
+
children: r.map((t, o) => i(fe, {
|
|
2627
2627
|
points: t,
|
|
2628
2628
|
color: "#ffaa00",
|
|
2629
2629
|
lineWidth: 1,
|
|
@@ -2644,7 +2644,7 @@ let __tla = (async () => {
|
|
|
2644
2644
|
]), l = o < 1 ? "#44ff44" : o < 5 ? "#ffcc00" : "#ff4444";
|
|
2645
2645
|
return F("group", {
|
|
2646
2646
|
children: [
|
|
2647
|
-
i(
|
|
2647
|
+
i(fe, {
|
|
2648
2648
|
points: [
|
|
2649
2649
|
e,
|
|
2650
2650
|
r
|
|
@@ -2714,7 +2714,7 @@ let __tla = (async () => {
|
|
|
2714
2714
|
const h = (a.regionMin + a.regionMax) / 2, d = new C(0, h, 0), u = d.clone().addScaledVector(a.axis, s), p = d.clone().addScaledVector(a.axis, -s), g = n / Math.max(1, c.length - 1), M = a.angleDeg < 0.5 ? `hsl(${120 - g * 120}, 80%, 60%)` : `hsl(${40 - a.angleDeg * 2}, 90%, 55%)`;
|
|
2715
2715
|
return F("group", {
|
|
2716
2716
|
children: [
|
|
2717
|
-
i(
|
|
2717
|
+
i(fe, {
|
|
2718
2718
|
points: [
|
|
2719
2719
|
p,
|
|
2720
2720
|
u
|
|
@@ -2724,7 +2724,7 @@ let __tla = (async () => {
|
|
|
2724
2724
|
transparent: true,
|
|
2725
2725
|
opacity: 0.7
|
|
2726
2726
|
}),
|
|
2727
|
-
i(
|
|
2727
|
+
i(fe, {
|
|
2728
2728
|
points: [
|
|
2729
2729
|
new C(-s * 0.3, a.regionMin, 0),
|
|
2730
2730
|
new C(s * 0.3, a.regionMin, 0)
|
|
@@ -2756,7 +2756,7 @@ let __tla = (async () => {
|
|
|
2756
2756
|
if (!l) return null;
|
|
2757
2757
|
const s = (r + t) / 2, c = new C(0, s, 0), a = o * 0.4, n = c.clone().addScaledVector(l.axis, a), h = c.clone().addScaledVector(l.axis, -a), d = l.angleDeg < 0.5 ? "#00ffff" : l.angleDeg < 2 ? "#ffcc00" : "#ff6600";
|
|
2758
2758
|
return i("group", {
|
|
2759
|
-
children: i(
|
|
2759
|
+
children: i(fe, {
|
|
2760
2760
|
points: [
|
|
2761
2761
|
h,
|
|
2762
2762
|
n
|
|
@@ -2771,7 +2771,7 @@ let __tla = (async () => {
|
|
|
2771
2771
|
}
|
|
2772
2772
|
function Ko({ pca: e, modelSize: r }) {
|
|
2773
2773
|
const t = e.axes[0], o = r * 0.6, l = e.center.clone().addScaledVector(t, o), s = e.center.clone().addScaledVector(t, -o);
|
|
2774
|
-
return i(
|
|
2774
|
+
return i(fe, {
|
|
2775
2775
|
points: [
|
|
2776
2776
|
s,
|
|
2777
2777
|
l
|
|
@@ -2794,9 +2794,9 @@ let __tla = (async () => {
|
|
|
2794
2794
|
});
|
|
2795
2795
|
}
|
|
2796
2796
|
if (m.length < 5) return null;
|
|
2797
|
-
const x = t - r, S = r + x * 0.3, I = r + x * 0.7,
|
|
2798
|
-
if (
|
|
2799
|
-
const
|
|
2797
|
+
const x = t - r, S = r + x * 0.3, I = r + x * 0.7, P = m.filter((y) => y.y >= S && y.y <= I);
|
|
2798
|
+
if (P.length < 3) return null;
|
|
2799
|
+
const L = P.map((y) => y.circ).sort((y, D) => y - D), b = L[Math.floor(L.length / 2)], z = Math.max(...m.map((y) => y.circ));
|
|
2800
2800
|
return {
|
|
2801
2801
|
circumferences: m,
|
|
2802
2802
|
baseline: b,
|
|
@@ -2813,7 +2813,7 @@ let __tla = (async () => {
|
|
|
2813
2813
|
children: [
|
|
2814
2814
|
c.map(({ y: d, circ: u }, p) => {
|
|
2815
2815
|
const g = u / a, M = g > 1.6 ? "#ff4444" : g > 1.3 ? "#ffcc00" : "#22cc66", f = u * h;
|
|
2816
|
-
return i(
|
|
2816
|
+
return i(fe, {
|
|
2817
2817
|
points: [
|
|
2818
2818
|
new C(-f, d, 0),
|
|
2819
2819
|
new C(f, d, 0)
|
|
@@ -2828,7 +2828,7 @@ let __tla = (async () => {
|
|
|
2828
2828
|
const d = a * 1.6 * h, u = c[0].y, p = c[c.length - 1].y;
|
|
2829
2829
|
return F(Oe, {
|
|
2830
2830
|
children: [
|
|
2831
|
-
i(
|
|
2831
|
+
i(fe, {
|
|
2832
2832
|
points: [
|
|
2833
2833
|
new C(-d, u, 0),
|
|
2834
2834
|
new C(-d, p, 0)
|
|
@@ -2841,7 +2841,7 @@ let __tla = (async () => {
|
|
|
2841
2841
|
transparent: true,
|
|
2842
2842
|
opacity: 0.4
|
|
2843
2843
|
}),
|
|
2844
|
-
i(
|
|
2844
|
+
i(fe, {
|
|
2845
2845
|
points: [
|
|
2846
2846
|
new C(d, u, 0),
|
|
2847
2847
|
new C(d, p, 0)
|
|
@@ -3032,7 +3032,7 @@ let __tla = (async () => {
|
|
|
3032
3032
|
]);
|
|
3033
3033
|
if (!t) return null;
|
|
3034
3034
|
const o = t.center.clone().addScaledVector(t.axis, t.halfLen), l = t.center.clone().addScaledVector(t.axis, -t.halfLen);
|
|
3035
|
-
return i(
|
|
3035
|
+
return i(fe, {
|
|
3036
3036
|
points: [
|
|
3037
3037
|
l,
|
|
3038
3038
|
o
|
|
@@ -3198,31 +3198,31 @@ let __tla = (async () => {
|
|
|
3198
3198
|
});
|
|
3199
3199
|
}
|
|
3200
3200
|
const or = ({ config: e, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: l, isDebugUser: s = false, onAnalyticsEvent: c, wasmModule: a }) => {
|
|
3201
|
-
const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [
|
|
3202
|
-
if (
|
|
3203
|
-
const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ =
|
|
3201
|
+
const [n, h] = E(null), [d, u] = E(0), [p, g] = E(false), [M, f] = E(false), [m, x] = E(""), [S, I] = E("3D"), [P, L] = E(r === "AK" ? 2 : 1), [b, z] = E(false), [y, D] = E(null), [w, A] = E(r ?? null), [k, B] = E("mm"), [$, N] = E(false), [U, be] = E(""), [ae, ue] = E(false), [ie, J] = E(false), [Y, he] = E(false), [Z, ge] = E(false), [me, pe] = E(null), [H, q] = E(null), [xe, Ce] = E(null), [we, oe] = E(false), [V, X] = E([]), [Pe, Le] = E(null), [Ge, se] = E(null), [ze, Bt] = E(null), [gt, Mn] = E(null), [zn, Rt] = E(false), [Wt, An] = E(null), [mt, _e] = E(null), [Re, kn] = E(false), [Et, Fn] = E(Vo), [$e, Tt] = E("obj"), [Ae, xt] = E(o), [nt, Ot] = E(true), [$t, yt] = E(false), [Ht, Pn] = E(false), [Ie, ot] = E(false), [bt, Ln] = E(null), [Vt] = E("#c8c8c8"), [In] = E(1), [Ze, _n] = E(false), [wt, jt] = E([]), rt = le(null), He = le(null), St = le(false), Dn = le(null), vt = le(null), Ct = le(null), Ue = re(async () => {
|
|
3202
|
+
if (Ct.current) try {
|
|
3203
|
+
const v = (await import("./html2canvas.esm-Dmi1NfiH.js")).default, _ = Ct.current, W = 2, R = async (K = false) => {
|
|
3204
3204
|
const te = await v(_, {
|
|
3205
3205
|
backgroundColor: null,
|
|
3206
3206
|
useCORS: true,
|
|
3207
3207
|
scale: W,
|
|
3208
|
-
ignoreElements: (
|
|
3209
|
-
var _a;
|
|
3210
|
-
return ((_a =
|
|
3208
|
+
ignoreElements: (et) => {
|
|
3209
|
+
var _a, _b;
|
|
3210
|
+
return ((_a = et.style) == null ? void 0 : _a.zIndex) === "10" || ((_b = et.hasAttribute) == null ? void 0 : _b.call(et, "data-finalizing-overlay"));
|
|
3211
3211
|
}
|
|
3212
3212
|
}), Q = _.getBoundingClientRect(), ke = Q.width, We = Q.height;
|
|
3213
3213
|
let ve, Me, ye, Te;
|
|
3214
3214
|
if (K) {
|
|
3215
3215
|
const De = te.getContext("2d").getImageData(0, 0, te.width, te.height).data;
|
|
3216
|
-
let Be = te.width, Ee = te.height,
|
|
3216
|
+
let Be = te.width, Ee = te.height, tt = 0, lt = 0;
|
|
3217
3217
|
for (let Ve = 0; Ve < te.height; Ve++) for (let je = 0; je < te.width; je++) {
|
|
3218
3218
|
const Gn = (Ve * te.width + je) * 4;
|
|
3219
|
-
De[Gn + 3] > 20 && (je < Be && (Be = je), je >
|
|
3219
|
+
De[Gn + 3] > 20 && (je < Be && (Be = je), je > tt && (tt = je), Ve < Ee && (Ee = Ve), Ve > lt && (lt = Ve));
|
|
3220
3220
|
}
|
|
3221
|
-
|
|
3221
|
+
tt <= Be && (Be = 0, Ee = 0, tt = te.width, lt = te.height), ve = Be / W, Me = Ee / W, ye = tt / W, Te = lt / W;
|
|
3222
3222
|
} else {
|
|
3223
|
-
const
|
|
3224
|
-
ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Te = -1 / 0,
|
|
3225
|
-
const De =
|
|
3223
|
+
const et = _.querySelectorAll("[style*='pointer-events: none']");
|
|
3224
|
+
ve = 1 / 0, Me = 1 / 0, ye = -1 / 0, Te = -1 / 0, et.forEach((Pt) => {
|
|
3225
|
+
const De = Pt.getBoundingClientRect();
|
|
3226
3226
|
if (De.width === 0 || De.height === 0) return;
|
|
3227
3227
|
const Be = De.left - Q.left, Ee = De.top - Q.top;
|
|
3228
3228
|
Be < ve && (ve = Be), Ee < Me && (Me = Ee), Be + De.width > ye && (ye = Be + De.width), Ee + De.height > Te && (Te = Ee + De.height);
|
|
@@ -3230,15 +3230,15 @@ let __tla = (async () => {
|
|
|
3230
3230
|
}
|
|
3231
3231
|
const Qt = Math.max(ke, We) * 0.03, qt = Math.max(ke, We) * 0.06;
|
|
3232
3232
|
ve = Math.max(0, ve - Qt), Me = Math.max(0, Me - qt), ye = Math.min(ke, ye + Qt), Te = Math.min(We, Te + qt);
|
|
3233
|
-
const
|
|
3234
|
-
return
|
|
3233
|
+
const kt = (ye - ve) * W, Ft = (Te - Me) * W, Yn = Math.max(0, ve * W), Xn = Math.max(0, Me * W), st = document.createElement("canvas");
|
|
3234
|
+
return st.width = Math.round(kt), st.height = Math.round(Ft), st.getContext("2d").drawImage(te, Math.round(Yn), Math.round(Xn), Math.round(kt), Math.round(Ft), 0, 0, Math.round(kt), Math.round(Ft)), st.toDataURL("image/png");
|
|
3235
3235
|
};
|
|
3236
|
-
|
|
3237
|
-
const
|
|
3236
|
+
vt.current && vt.current(), await new Promise((K) => setTimeout(K, 100)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
|
|
3237
|
+
const ce = await R();
|
|
3238
3238
|
I("2D"), await new Promise((K) => setTimeout(K, 200)), await new Promise((K) => requestAnimationFrame(() => requestAnimationFrame(K)));
|
|
3239
3239
|
const G = await R(true);
|
|
3240
3240
|
return I("3D"), {
|
|
3241
|
-
frontal_view_png:
|
|
3241
|
+
frontal_view_png: ce,
|
|
3242
3242
|
side_view_png: G
|
|
3243
3243
|
};
|
|
3244
3244
|
} catch {
|
|
@@ -3250,13 +3250,13 @@ let __tla = (async () => {
|
|
|
3250
3250
|
...R.slice(-200),
|
|
3251
3251
|
`[${W}] ${v}`
|
|
3252
3252
|
]);
|
|
3253
|
-
}, []), { landmarkPoints: T, clearLandmarkPoints: Bn, addLandmarkPoint: Nt, removeLandmarkPoint: Yt, updateLandmarkPositions: Xt, setAligned: Gt, isAligned: ee, setCut: Zt, isCut:
|
|
3253
|
+
}, []), { landmarkPoints: T, clearLandmarkPoints: Bn, addLandmarkPoint: Nt, removeLandmarkPoint: Yt, updateLandmarkPositions: Xt, setAligned: Gt, isAligned: ee, setCut: Zt, isCut: Mt, reset: Kt } = Dt();
|
|
3254
3254
|
ne(() => {
|
|
3255
3255
|
Kt();
|
|
3256
3256
|
}, [
|
|
3257
3257
|
Kt
|
|
3258
3258
|
]);
|
|
3259
|
-
const
|
|
3259
|
+
const it = P * dt;
|
|
3260
3260
|
ne(() => {
|
|
3261
3261
|
if (!s || T.length === 0) return;
|
|
3262
3262
|
const v = T[T.length - 1];
|
|
@@ -3272,32 +3272,32 @@ let __tla = (async () => {
|
|
|
3272
3272
|
s,
|
|
3273
3273
|
Se
|
|
3274
3274
|
]), ne(() => {
|
|
3275
|
-
s &&
|
|
3275
|
+
s && Mt && Se("STATE: mesh cut");
|
|
3276
3276
|
}, [
|
|
3277
|
-
|
|
3277
|
+
Mt,
|
|
3278
3278
|
s,
|
|
3279
3279
|
Se
|
|
3280
3280
|
]), ne(() => {
|
|
3281
|
-
|
|
3281
|
+
rt.current && (rt.current.scrollTop = rt.current.scrollHeight);
|
|
3282
3282
|
}, [
|
|
3283
|
-
|
|
3283
|
+
wt
|
|
3284
3284
|
]);
|
|
3285
3285
|
const Ut = j(() => xe ? new O.Mesh(xe) : null, [
|
|
3286
3286
|
xe
|
|
3287
3287
|
]);
|
|
3288
3288
|
ne(() => {
|
|
3289
|
-
o &&
|
|
3289
|
+
o && xt(o);
|
|
3290
3290
|
}, [
|
|
3291
3291
|
o
|
|
3292
3292
|
]), ne(() => {
|
|
3293
|
-
o ||
|
|
3293
|
+
o || xt(void 0);
|
|
3294
3294
|
}, [
|
|
3295
|
-
|
|
3295
|
+
P
|
|
3296
3296
|
]);
|
|
3297
|
-
const
|
|
3297
|
+
const zt = le(false);
|
|
3298
3298
|
ne(() => {
|
|
3299
|
-
if (!ee || V.length === 0 ||
|
|
3300
|
-
|
|
3299
|
+
if (!ee || V.length === 0 || zt.current || !c) return;
|
|
3300
|
+
zt.current = true;
|
|
3301
3301
|
const v = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
|
|
3302
3302
|
c("dimensions_calculated", {
|
|
3303
3303
|
spacing_type: w,
|
|
@@ -3326,13 +3326,13 @@ let __tla = (async () => {
|
|
|
3326
3326
|
v.computeBoundingBox();
|
|
3327
3327
|
const W = v.boundingBox, R = new C();
|
|
3328
3328
|
W.getCenter(R), v.translate(-R.x, -R.y, -R.z), v.computeBoundingBox();
|
|
3329
|
-
const
|
|
3330
|
-
|
|
3329
|
+
const ce = v.boundingBox, G = new C();
|
|
3330
|
+
ce.getSize(G), u(Math.max(G.x, G.y, G.z));
|
|
3331
3331
|
const K = new O.Mesh(v, new O.MeshStandardMaterial({
|
|
3332
3332
|
color: 8947848,
|
|
3333
3333
|
side: O.DoubleSide
|
|
3334
3334
|
}));
|
|
3335
|
-
h(K),
|
|
3335
|
+
h(K), ue(_), J(true), ge(false), St.current = false;
|
|
3336
3336
|
}, []), Qe = re(async (v, _) => {
|
|
3337
3337
|
_e(null);
|
|
3338
3338
|
const W = _.toLowerCase(), R = W.endsWith(".stl");
|
|
@@ -3340,7 +3340,7 @@ let __tla = (async () => {
|
|
|
3340
3340
|
_e("Unsupported file format. Please use OBJ or STL.");
|
|
3341
3341
|
return;
|
|
3342
3342
|
}
|
|
3343
|
-
|
|
3343
|
+
Tt(R ? "stl" : "obj"), f(true), x("Processing file..."), Se(`FILE_LOAD: ${_} (${R ? "STL" : "OBJ"})`);
|
|
3344
3344
|
try {
|
|
3345
3345
|
let G;
|
|
3346
3346
|
if (R) if (x("Converting STL..."), v instanceof ArrayBuffer) {
|
|
@@ -3422,7 +3422,7 @@ let __tla = (async () => {
|
|
|
3422
3422
|
return;
|
|
3423
3423
|
}
|
|
3424
3424
|
if (W.endsWith(".stl")) {
|
|
3425
|
-
|
|
3425
|
+
Tt("stl"), f(true), x("Converting STL...");
|
|
3426
3426
|
try {
|
|
3427
3427
|
const R = await Lt(_);
|
|
3428
3428
|
await Qe(R, _.name.replace(/\.stl$/i, ".obj"));
|
|
@@ -3437,7 +3437,7 @@ let __tla = (async () => {
|
|
|
3437
3437
|
Ze,
|
|
3438
3438
|
Qe
|
|
3439
3439
|
]), Tn = re((v) => {
|
|
3440
|
-
A(v),
|
|
3440
|
+
A(v), L(v === "AK" ? 2 : 1), z(false), y && (Je(y.geometry, y.wasScaled), D(null)), c == null ? void 0 : c("file_loaded", {
|
|
3441
3441
|
spacing_type: v,
|
|
3442
3442
|
file_format: $e,
|
|
3443
3443
|
is_double_wall: false
|
|
@@ -3449,14 +3449,14 @@ let __tla = (async () => {
|
|
|
3449
3449
|
$e
|
|
3450
3450
|
]);
|
|
3451
3451
|
ne(() => {
|
|
3452
|
-
if (!n || T.length !== 1 || !He.current ||
|
|
3453
|
-
|
|
3454
|
-
const v = T[0], _ = He.current, W = n.geometry, { positions: R, indices:
|
|
3452
|
+
if (!n || T.length !== 1 || !He.current || St.current) return;
|
|
3453
|
+
St.current = true;
|
|
3454
|
+
const v = T[0], _ = He.current, W = n.geometry, { positions: R, indices: ce } = ft(W), G = new Float32Array([
|
|
3455
3455
|
v.position.x,
|
|
3456
3456
|
v.position.y,
|
|
3457
3457
|
v.position.z
|
|
3458
|
-
]), K = _.detect_shell(R,
|
|
3459
|
-
Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (
|
|
3458
|
+
]), K = _.detect_shell(R, ce, G, 40), te = K.details(), Q = K.is_double_shell();
|
|
3459
|
+
Se(`SHELL_DETECT: ${Q ? "DOUBLE" : "SINGLE"} \u2014 ${te}`), Q && (he(true), oe(true), Se(`SHELL_DETECT: double shell, thickness=${K.thickness().toFixed(1)}mm`));
|
|
3460
3460
|
}, [
|
|
3461
3461
|
n,
|
|
3462
3462
|
T,
|
|
@@ -3472,7 +3472,7 @@ let __tla = (async () => {
|
|
|
3472
3472
|
T[0],
|
|
3473
3473
|
...T.slice(2)
|
|
3474
3474
|
];
|
|
3475
|
-
mo(n, _,
|
|
3475
|
+
mo(n, _, dt, {
|
|
3476
3476
|
onStatus: (W) => {
|
|
3477
3477
|
be(W), Se(`PIPELINE: ${W}`);
|
|
3478
3478
|
},
|
|
@@ -3491,19 +3491,19 @@ let __tla = (async () => {
|
|
|
3491
3491
|
setModelSize: u,
|
|
3492
3492
|
setOriginalEndY: Mn,
|
|
3493
3493
|
setAdjustedStartY: se,
|
|
3494
|
-
setAdjustedEndY:
|
|
3494
|
+
setAdjustedEndY: Bt,
|
|
3495
3495
|
setError: _e,
|
|
3496
3496
|
setDoubleShell: (W) => {
|
|
3497
|
-
|
|
3497
|
+
he(W), oe(true);
|
|
3498
3498
|
},
|
|
3499
3499
|
setAoData: (W, R) => {
|
|
3500
|
-
|
|
3500
|
+
pe(W), q(R ?? null);
|
|
3501
3501
|
},
|
|
3502
|
-
setInnerShellExtracted:
|
|
3502
|
+
setInnerShellExtracted: ge,
|
|
3503
3503
|
setMeasurementGeometry: Ce,
|
|
3504
|
-
setWasmSlices:
|
|
3504
|
+
setWasmSlices: Le,
|
|
3505
3505
|
wasmModule: He.current ?? void 0
|
|
3506
|
-
}), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`),
|
|
3506
|
+
}), Se(`PIPELINE: completed in ${(performance.now() - v).toFixed(0)}ms`), zt.current = false, N(false);
|
|
3507
3507
|
}, 50);
|
|
3508
3508
|
}, [
|
|
3509
3509
|
n,
|
|
@@ -3516,7 +3516,7 @@ let __tla = (async () => {
|
|
|
3516
3516
|
Z
|
|
3517
3517
|
]), Jt = le(false);
|
|
3518
3518
|
ne(() => {
|
|
3519
|
-
ee && V.length > 0 && !Jt.current && (Jt.current = true,
|
|
3519
|
+
ee && V.length > 0 && !Jt.current && (Jt.current = true, yt(true));
|
|
3520
3520
|
}, [
|
|
3521
3521
|
ee,
|
|
3522
3522
|
V.length
|
|
@@ -3534,28 +3534,36 @@ let __tla = (async () => {
|
|
|
3534
3534
|
T,
|
|
3535
3535
|
Y
|
|
3536
3536
|
]), $n = re((v) => {
|
|
3537
|
-
|
|
3537
|
+
Ln(v), xt(v.circumferences), yt(false), Ot(true), Pn(true);
|
|
3538
3538
|
}, []), Hn = re(async (v) => {
|
|
3539
|
-
if (!l || !n || !w)
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3539
|
+
if (!(!l || !n || !w)) {
|
|
3540
|
+
yt(false), ot(true);
|
|
3541
|
+
try {
|
|
3542
|
+
const _ = await Promise.race([
|
|
3543
|
+
Ue(),
|
|
3544
|
+
new Promise((W) => setTimeout(() => W(void 0), 8e3))
|
|
3545
|
+
]);
|
|
3546
|
+
l({
|
|
3547
|
+
spacingType: w,
|
|
3548
|
+
sourceUnit: "mm",
|
|
3549
|
+
fileFormat: $e,
|
|
3550
|
+
measurementSource: "form_provided",
|
|
3551
|
+
isDoubleWall: Y,
|
|
3552
|
+
isUnitConverted: false,
|
|
3553
|
+
formMeasurements: Ae,
|
|
3554
|
+
scanMeasurements: V,
|
|
3555
|
+
frontalHeight: qe,
|
|
3556
|
+
transverseML: 0,
|
|
3557
|
+
transverseAP: 0,
|
|
3558
|
+
scanUrl: t,
|
|
3559
|
+
decision: "skip",
|
|
3560
|
+
skipReason: v,
|
|
3561
|
+
screenshots: _
|
|
3562
|
+
});
|
|
3563
|
+
} finally {
|
|
3564
|
+
ot(false);
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3559
3567
|
}, [
|
|
3560
3568
|
l,
|
|
3561
3569
|
n,
|
|
@@ -3567,40 +3575,48 @@ let __tla = (async () => {
|
|
|
3567
3575
|
qe,
|
|
3568
3576
|
t,
|
|
3569
3577
|
Ue
|
|
3570
|
-
]),
|
|
3571
|
-
if (!l || !n || V.length === 0 || !w)
|
|
3572
|
-
|
|
3573
|
-
let _ = 0, W = 0;
|
|
3574
|
-
if (T.length >= 2) {
|
|
3575
|
-
const ge = n.geometry, K = T[0].position.y;
|
|
3578
|
+
]), At = re(async (v) => {
|
|
3579
|
+
if (!(!l || !n || V.length === 0 || !w)) {
|
|
3580
|
+
ot(true);
|
|
3576
3581
|
try {
|
|
3577
|
-
|
|
3578
|
-
if (
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
+
let _ = 0, W = 0;
|
|
3583
|
+
if (T.length >= 2) {
|
|
3584
|
+
const ce = n.geometry, K = T[0].position.y;
|
|
3585
|
+
try {
|
|
3586
|
+
const te = yn(ce), Q = Ye(te, ce, K);
|
|
3587
|
+
if (Q.linePoints.length >= 2) {
|
|
3588
|
+
let ke = Q.linePoints[0], We = Q.linePoints[0], ve = Q.linePoints[0], Me = Q.linePoints[0];
|
|
3589
|
+
for (const ye of Q.linePoints) ye.x < ke.x && (ke = ye), ye.x > We.x && (We = ye), ye.z < ve.z && (ve = ye), ye.z > Me.z && (Me = ye);
|
|
3590
|
+
_ = new C(ke.x, K, ke.z).distanceTo(new C(We.x, K, We.z)), W = new C(ve.x, K, ve.z).distanceTo(new C(Me.x, K, Me.z));
|
|
3591
|
+
}
|
|
3592
|
+
} catch {
|
|
3593
|
+
}
|
|
3582
3594
|
}
|
|
3583
|
-
|
|
3595
|
+
const R = await Promise.race([
|
|
3596
|
+
Ue(),
|
|
3597
|
+
new Promise((ce) => setTimeout(() => ce(void 0), 8e3))
|
|
3598
|
+
]);
|
|
3599
|
+
l({
|
|
3600
|
+
spacingType: w,
|
|
3601
|
+
sourceUnit: "mm",
|
|
3602
|
+
fileFormat: $e,
|
|
3603
|
+
measurementSource: v === "use_form_measurements" ? "form_provided" : "scan_derived",
|
|
3604
|
+
isDoubleWall: Y,
|
|
3605
|
+
isUnitConverted: false,
|
|
3606
|
+
formMeasurements: Ae,
|
|
3607
|
+
scanMeasurements: V,
|
|
3608
|
+
frontalHeight: (bt == null ? void 0 : bt.frontalHeight) ?? qe,
|
|
3609
|
+
transverseML: _,
|
|
3610
|
+
transverseAP: W,
|
|
3611
|
+
scanUrl: t,
|
|
3612
|
+
decision: v,
|
|
3613
|
+
userEnteredMeasurements: bt ?? void 0,
|
|
3614
|
+
screenshots: R
|
|
3615
|
+
});
|
|
3616
|
+
} finally {
|
|
3617
|
+
ot(false);
|
|
3584
3618
|
}
|
|
3585
3619
|
}
|
|
3586
|
-
const R = await Ue();
|
|
3587
|
-
l({
|
|
3588
|
-
spacingType: w,
|
|
3589
|
-
sourceUnit: "mm",
|
|
3590
|
-
fileFormat: $e,
|
|
3591
|
-
measurementSource: v === "use_form_measurements" ? "form_provided" : "scan_derived",
|
|
3592
|
-
isDoubleWall: Y,
|
|
3593
|
-
isUnitConverted: false,
|
|
3594
|
-
formMeasurements: Ae,
|
|
3595
|
-
scanMeasurements: V,
|
|
3596
|
-
frontalHeight: (yt == null ? void 0 : yt.frontalHeight) ?? qe,
|
|
3597
|
-
transverseML: _,
|
|
3598
|
-
transverseAP: W,
|
|
3599
|
-
scanUrl: t,
|
|
3600
|
-
decision: v,
|
|
3601
|
-
userEnteredMeasurements: yt ?? void 0,
|
|
3602
|
-
screenshots: R
|
|
3603
|
-
});
|
|
3604
3620
|
}, [
|
|
3605
3621
|
l,
|
|
3606
3622
|
n,
|
|
@@ -3611,7 +3627,7 @@ let __tla = (async () => {
|
|
|
3611
3627
|
Y,
|
|
3612
3628
|
Ae,
|
|
3613
3629
|
t,
|
|
3614
|
-
|
|
3630
|
+
bt,
|
|
3615
3631
|
qe,
|
|
3616
3632
|
Ue
|
|
3617
3633
|
]), Vn = j(() => {
|
|
@@ -3621,14 +3637,14 @@ let __tla = (async () => {
|
|
|
3621
3637
|
for (let _ = 0; _ < v; _++) {
|
|
3622
3638
|
const W = Ae[_], R = V[_];
|
|
3623
3639
|
if (!R || W == null || W === 0) continue;
|
|
3624
|
-
const
|
|
3625
|
-
if (Math.abs(
|
|
3640
|
+
const ce = R.modifiedValue ?? R.originalValue;
|
|
3641
|
+
if (Math.abs(ce - W) > 7) return false;
|
|
3626
3642
|
}
|
|
3627
3643
|
return true;
|
|
3628
3644
|
}, [
|
|
3629
3645
|
Ae,
|
|
3630
3646
|
V
|
|
3631
|
-
]), jn =
|
|
3647
|
+
]), jn = Ht ? 5 : ee && $t || ee ? 4 : n ? T.length === 0 ? 2 : 3 : 1, Nn = [
|
|
3632
3648
|
{
|
|
3633
3649
|
label: "Load File",
|
|
3634
3650
|
number: 1
|
|
@@ -3695,7 +3711,7 @@ let __tla = (async () => {
|
|
|
3695
3711
|
},
|
|
3696
3712
|
children: [
|
|
3697
3713
|
F("div", {
|
|
3698
|
-
ref:
|
|
3714
|
+
ref: Ct,
|
|
3699
3715
|
style: {
|
|
3700
3716
|
flex: 1,
|
|
3701
3717
|
position: "relative",
|
|
@@ -3755,7 +3771,7 @@ let __tla = (async () => {
|
|
|
3755
3771
|
]
|
|
3756
3772
|
})
|
|
3757
3773
|
}),
|
|
3758
|
-
!e.showDragDrop && !n && !M && !
|
|
3774
|
+
!e.showDragDrop && !n && !M && !mt && i("div", {
|
|
3759
3775
|
style: {
|
|
3760
3776
|
position: "absolute",
|
|
3761
3777
|
inset: 0,
|
|
@@ -3862,8 +3878,8 @@ let __tla = (async () => {
|
|
|
3862
3878
|
$ && i(on, {
|
|
3863
3879
|
message: U
|
|
3864
3880
|
}),
|
|
3865
|
-
|
|
3866
|
-
message:
|
|
3881
|
+
mt && i(yo, {
|
|
3882
|
+
message: mt,
|
|
3867
3883
|
onDismiss: () => _e(null)
|
|
3868
3884
|
}),
|
|
3869
3885
|
e.showAmputationModal && b && i("div", {
|
|
@@ -4093,16 +4109,16 @@ let __tla = (async () => {
|
|
|
4093
4109
|
"Cut Plane"
|
|
4094
4110
|
]
|
|
4095
4111
|
}),
|
|
4096
|
-
i(
|
|
4112
|
+
i(Lo, {
|
|
4097
4113
|
modelSize: d,
|
|
4098
4114
|
isAligned: ee,
|
|
4099
|
-
isCut:
|
|
4115
|
+
isCut: Mt,
|
|
4100
4116
|
mesh: n,
|
|
4101
4117
|
viewMode: S,
|
|
4102
|
-
sliceY: ee && T.length >= 2 ? ze ??
|
|
4118
|
+
sliceY: ee && T.length >= 2 ? ze ?? gt ?? T[0].position.y : void 0,
|
|
4103
4119
|
landmarkCount: T.length,
|
|
4104
4120
|
measurementGeometry: xe,
|
|
4105
|
-
resetCameraToFrontRef:
|
|
4121
|
+
resetCameraToFrontRef: vt
|
|
4106
4122
|
}),
|
|
4107
4123
|
!ee && i(dn, {
|
|
4108
4124
|
enableDamping: false
|
|
@@ -4114,7 +4130,7 @@ let __tla = (async () => {
|
|
|
4114
4130
|
n && ee && T.length >= 3 && (() => {
|
|
4115
4131
|
const _ = n.geometry.getIndex();
|
|
4116
4132
|
if (!_ || _.count < 30) return null;
|
|
4117
|
-
const W = T[2], R = T[0],
|
|
4133
|
+
const W = T[2], R = T[0], ce = Ge ?? W.position.y, G = ze ?? gt ?? R.position.y;
|
|
4118
4134
|
return S === "2D" ? i(Ro, {
|
|
4119
4135
|
mesh: Ut ?? n,
|
|
4120
4136
|
upperY: G,
|
|
@@ -4126,19 +4142,19 @@ let __tla = (async () => {
|
|
|
4126
4142
|
children: [
|
|
4127
4143
|
i(Fo, {
|
|
4128
4144
|
mesh: Ut ?? n,
|
|
4129
|
-
startY:
|
|
4145
|
+
startY: ce,
|
|
4130
4146
|
endY: G,
|
|
4131
|
-
spacing:
|
|
4147
|
+
spacing: it,
|
|
4132
4148
|
modelSize: d,
|
|
4133
4149
|
onMeasurementsChange: X,
|
|
4134
4150
|
reverseOrder: true,
|
|
4135
4151
|
displayUnit: k,
|
|
4136
4152
|
useInnerSurface: Y && !Z,
|
|
4137
|
-
formMeasurements:
|
|
4138
|
-
originY:
|
|
4139
|
-
wasmSlices:
|
|
4153
|
+
formMeasurements: nt ? Ae : void 0,
|
|
4154
|
+
originY: Wt ?? R.position.y,
|
|
4155
|
+
wasmSlices: Pe
|
|
4140
4156
|
}),
|
|
4141
|
-
i(
|
|
4157
|
+
i(Po, {
|
|
4142
4158
|
mesh: n,
|
|
4143
4159
|
greenY: R.position.y,
|
|
4144
4160
|
modelSize: d,
|
|
@@ -4147,21 +4163,21 @@ let __tla = (async () => {
|
|
|
4147
4163
|
}),
|
|
4148
4164
|
i(Wo, {
|
|
4149
4165
|
mesh: n,
|
|
4150
|
-
yPosition:
|
|
4166
|
+
yPosition: Wt ?? R.position.y,
|
|
4151
4167
|
onYChange: (K) => {
|
|
4152
|
-
An(K),
|
|
4168
|
+
An(K), Le(null);
|
|
4153
4169
|
const te = K - R.position.y;
|
|
4154
|
-
|
|
4170
|
+
Bt((gt ?? R.position.y + it * 2) + te);
|
|
4155
4171
|
},
|
|
4156
|
-
minY: R.position.y -
|
|
4157
|
-
maxY: R.position.y +
|
|
4172
|
+
minY: R.position.y - it,
|
|
4173
|
+
maxY: R.position.y + it,
|
|
4158
4174
|
modelSize: d,
|
|
4159
4175
|
color: "#44ff44",
|
|
4160
4176
|
hoverColor: "#88ff88",
|
|
4161
4177
|
dragColor: "#ffffff",
|
|
4162
4178
|
label: w === "AK" ? "IT" : "MPT",
|
|
4163
|
-
onDragStart: () =>
|
|
4164
|
-
onDragEnd: () =>
|
|
4179
|
+
onDragStart: () => Rt(true),
|
|
4180
|
+
onDragEnd: () => Rt(false)
|
|
4165
4181
|
})
|
|
4166
4182
|
]
|
|
4167
4183
|
});
|
|
@@ -4172,7 +4188,7 @@ let __tla = (async () => {
|
|
|
4172
4188
|
n && e.showDebug && Re && S === "3D" && i(qo, {
|
|
4173
4189
|
mesh: n,
|
|
4174
4190
|
modelSize: d,
|
|
4175
|
-
layers:
|
|
4191
|
+
layers: Et,
|
|
4176
4192
|
landmarkPoints: T,
|
|
4177
4193
|
componentDebug: null,
|
|
4178
4194
|
aoData: me,
|
|
@@ -4235,7 +4251,7 @@ let __tla = (async () => {
|
|
|
4235
4251
|
]
|
|
4236
4252
|
}),
|
|
4237
4253
|
e.showDebug && Re && n && S === "3D" && i(nr, {
|
|
4238
|
-
layers:
|
|
4254
|
+
layers: Et,
|
|
4239
4255
|
onToggleLayer: (v) => Fn((_) => ({
|
|
4240
4256
|
..._,
|
|
4241
4257
|
[v]: !_[v]
|
|
@@ -4342,13 +4358,13 @@ let __tla = (async () => {
|
|
|
4342
4358
|
},
|
|
4343
4359
|
children: [
|
|
4344
4360
|
i("button", {
|
|
4345
|
-
onClick: () =>
|
|
4361
|
+
onClick: () => L(1),
|
|
4346
4362
|
style: {
|
|
4347
4363
|
padding: "6px 14px",
|
|
4348
4364
|
fontSize: 13,
|
|
4349
|
-
fontWeight:
|
|
4350
|
-
backgroundColor:
|
|
4351
|
-
color:
|
|
4365
|
+
fontWeight: P === 1 ? 600 : 400,
|
|
4366
|
+
backgroundColor: P === 1 ? "rgb(12, 67, 173)" : "#fff",
|
|
4367
|
+
color: P === 1 ? "#fff" : "#666",
|
|
4352
4368
|
border: "none",
|
|
4353
4369
|
cursor: "pointer",
|
|
4354
4370
|
fontFamily: "system-ui, sans-serif"
|
|
@@ -4356,13 +4372,13 @@ let __tla = (async () => {
|
|
|
4356
4372
|
children: '1"'
|
|
4357
4373
|
}),
|
|
4358
4374
|
i("button", {
|
|
4359
|
-
onClick: () =>
|
|
4375
|
+
onClick: () => L(2),
|
|
4360
4376
|
style: {
|
|
4361
4377
|
padding: "6px 14px",
|
|
4362
4378
|
fontSize: 13,
|
|
4363
|
-
fontWeight:
|
|
4364
|
-
backgroundColor:
|
|
4365
|
-
color:
|
|
4379
|
+
fontWeight: P === 2 ? 600 : 400,
|
|
4380
|
+
backgroundColor: P === 2 ? "rgb(12, 67, 173)" : "#fff",
|
|
4381
|
+
color: P === 2 ? "#fff" : "#666",
|
|
4366
4382
|
border: "none",
|
|
4367
4383
|
borderLeft: "1px solid #ccc",
|
|
4368
4384
|
cursor: "pointer",
|
|
@@ -4381,13 +4397,13 @@ let __tla = (async () => {
|
|
|
4381
4397
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
4382
4398
|
},
|
|
4383
4399
|
children: i("button", {
|
|
4384
|
-
onClick: () =>
|
|
4400
|
+
onClick: () => Ot((v) => !v),
|
|
4385
4401
|
style: {
|
|
4386
4402
|
padding: "6px 14px",
|
|
4387
4403
|
fontSize: 13,
|
|
4388
|
-
fontWeight:
|
|
4389
|
-
backgroundColor:
|
|
4390
|
-
color:
|
|
4404
|
+
fontWeight: nt ? 600 : 400,
|
|
4405
|
+
backgroundColor: nt ? "rgb(12, 67, 173)" : "#fff",
|
|
4406
|
+
color: nt ? "#fff" : "#666",
|
|
4391
4407
|
border: "none",
|
|
4392
4408
|
cursor: "pointer",
|
|
4393
4409
|
fontFamily: "system-ui, sans-serif"
|
|
@@ -4407,9 +4423,9 @@ let __tla = (async () => {
|
|
|
4407
4423
|
onClick: async () => {
|
|
4408
4424
|
const v = await Ue();
|
|
4409
4425
|
if (!v) return;
|
|
4410
|
-
const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R,
|
|
4426
|
+
const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R, ce) => {
|
|
4411
4427
|
const G = document.createElement("a");
|
|
4412
|
-
G.href = R, G.download =
|
|
4428
|
+
G.href = R, G.download = ce, G.click();
|
|
4413
4429
|
};
|
|
4414
4430
|
W(v.frontal_view_png, `measurements_front_${_}.png`), await new Promise((R) => setTimeout(R, 300)), W(v.side_view_png, `measurements_transverse_${_}.png`);
|
|
4415
4431
|
},
|
|
@@ -4462,10 +4478,11 @@ let __tla = (async () => {
|
|
|
4462
4478
|
]
|
|
4463
4479
|
}),
|
|
4464
4480
|
Ie && F("div", {
|
|
4481
|
+
"data-finalizing-overlay": true,
|
|
4465
4482
|
style: {
|
|
4466
4483
|
position: "absolute",
|
|
4467
4484
|
inset: 0,
|
|
4468
|
-
backgroundColor: "
|
|
4485
|
+
backgroundColor: "#fff",
|
|
4469
4486
|
display: "flex",
|
|
4470
4487
|
flexDirection: "column",
|
|
4471
4488
|
alignItems: "center",
|
|
@@ -4526,9 +4543,9 @@ let __tla = (async () => {
|
|
|
4526
4543
|
},
|
|
4527
4544
|
children: "Next \xBB"
|
|
4528
4545
|
}),
|
|
4529
|
-
ee &&
|
|
4546
|
+
ee && Ht && (Vn ? i("button", {
|
|
4530
4547
|
disabled: Ie,
|
|
4531
|
-
onClick: () =>
|
|
4548
|
+
onClick: () => At("continue"),
|
|
4532
4549
|
style: {
|
|
4533
4550
|
padding: "6px 16px",
|
|
4534
4551
|
borderRadius: 4,
|
|
@@ -4547,7 +4564,7 @@ let __tla = (async () => {
|
|
|
4547
4564
|
children: [
|
|
4548
4565
|
i("button", {
|
|
4549
4566
|
disabled: Ie,
|
|
4550
|
-
onClick: () =>
|
|
4567
|
+
onClick: () => At("use_form_measurements"),
|
|
4551
4568
|
style: {
|
|
4552
4569
|
padding: "6px 16px",
|
|
4553
4570
|
borderRadius: 4,
|
|
@@ -4565,7 +4582,7 @@ let __tla = (async () => {
|
|
|
4565
4582
|
}),
|
|
4566
4583
|
i("button", {
|
|
4567
4584
|
disabled: Ie,
|
|
4568
|
-
onClick: () =>
|
|
4585
|
+
onClick: () => At("use_scan"),
|
|
4569
4586
|
style: {
|
|
4570
4587
|
padding: "6px 16px",
|
|
4571
4588
|
borderRadius: 4,
|
|
@@ -4587,7 +4604,7 @@ let __tla = (async () => {
|
|
|
4587
4604
|
})
|
|
4588
4605
|
]
|
|
4589
4606
|
}),
|
|
4590
|
-
s &&
|
|
4607
|
+
s && wt.length > 0 && F("div", {
|
|
4591
4608
|
style: {
|
|
4592
4609
|
height: 120,
|
|
4593
4610
|
flexShrink: 0,
|
|
@@ -4662,18 +4679,18 @@ let __tla = (async () => {
|
|
|
4662
4679
|
]
|
|
4663
4680
|
}),
|
|
4664
4681
|
i("div", {
|
|
4665
|
-
ref:
|
|
4682
|
+
ref: rt,
|
|
4666
4683
|
style: {
|
|
4667
4684
|
flex: 1,
|
|
4668
4685
|
overflowY: "auto",
|
|
4669
4686
|
padding: "4px 10px",
|
|
4670
4687
|
lineHeight: 1.6
|
|
4671
4688
|
},
|
|
4672
|
-
children:
|
|
4673
|
-
const W = v.includes("ERROR") || v.includes("failed"), R = v.includes("warning") || v.includes("WARN"),
|
|
4689
|
+
children: wt.map((v, _) => {
|
|
4690
|
+
const W = v.includes("ERROR") || v.includes("failed"), R = v.includes("warning") || v.includes("WARN"), ce = v.includes("PIPELINE:"), G = v.includes("STATE:");
|
|
4674
4691
|
return i("div", {
|
|
4675
4692
|
style: {
|
|
4676
|
-
color: W ? "#f85149" : R ? "#d29922" :
|
|
4693
|
+
color: W ? "#f85149" : R ? "#d29922" : ce ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
|
|
4677
4694
|
whiteSpace: "pre"
|
|
4678
4695
|
},
|
|
4679
4696
|
children: v
|
|
@@ -4684,9 +4701,9 @@ let __tla = (async () => {
|
|
|
4684
4701
|
})
|
|
4685
4702
|
]
|
|
4686
4703
|
}),
|
|
4687
|
-
ee &&
|
|
4704
|
+
ee && $t && w && i(Ho, {
|
|
4688
4705
|
amputationType: w,
|
|
4689
|
-
spacingInches:
|
|
4706
|
+
spacingInches: P,
|
|
4690
4707
|
scanMeasurements: V,
|
|
4691
4708
|
scanFrontalHeight: qe,
|
|
4692
4709
|
onSave: $n,
|
|
@@ -4721,7 +4738,7 @@ let __tla = (async () => {
|
|
|
4721
4738
|
]) t.push(`${o}_below`);
|
|
4722
4739
|
return t;
|
|
4723
4740
|
};
|
|
4724
|
-
|
|
4741
|
+
ct = function(e, r) {
|
|
4725
4742
|
const t = Cn(r), o = {};
|
|
4726
4743
|
for (let l = 0; l < Math.min(e.length, t.length); l++) {
|
|
4727
4744
|
const s = e[l];
|
|
@@ -4743,18 +4760,18 @@ let __tla = (async () => {
|
|
|
4743
4760
|
e.spacing_type
|
|
4744
4761
|
]), l = (s) => {
|
|
4745
4762
|
var _a, _b;
|
|
4746
|
-
const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a =
|
|
4763
|
+
const c = s.scanMeasurements.map((f) => +(f.modifiedValue ?? f.originalValue).toFixed(1)), a = ct(c, e.spacing_type);
|
|
4747
4764
|
let n, h;
|
|
4748
4765
|
if (s.formMeasurements) {
|
|
4749
|
-
n =
|
|
4766
|
+
n = ct(s.formMeasurements, e.spacing_type);
|
|
4750
4767
|
const f = s.scanMeasurements.map((m, x) => {
|
|
4751
4768
|
var _a2;
|
|
4752
4769
|
const S = (_a2 = s.formMeasurements) == null ? void 0 : _a2[x];
|
|
4753
4770
|
return S == null || isNaN(S) ? null : +((m.modifiedValue ?? m.originalValue) - S).toFixed(1);
|
|
4754
4771
|
});
|
|
4755
|
-
h =
|
|
4772
|
+
h = ct(f, e.spacing_type);
|
|
4756
4773
|
}
|
|
4757
|
-
const d = s.userEnteredMeasurements ?
|
|
4774
|
+
const d = s.userEnteredMeasurements ? ct(s.userEnteredMeasurements.circumferences, e.spacing_type) : void 0, u = s.decision === "use_scan" || s.decision === "continue", p = u ? a : d ?? n ?? a, g = u ? +s.frontalHeight.toFixed(1) : +(((_a = s.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? s.frontalHeight).toFixed(1), M = {
|
|
4758
4775
|
spacing_type: e.spacing_type,
|
|
4759
4776
|
source_unit: "mm",
|
|
4760
4777
|
file_format: s.fileFormat,
|
|
@@ -4800,7 +4817,7 @@ let __tla = (async () => {
|
|
|
4800
4817
|
export {
|
|
4801
4818
|
mr as G,
|
|
4802
4819
|
__tla,
|
|
4803
|
-
|
|
4820
|
+
ct as a,
|
|
4804
4821
|
ir as c,
|
|
4805
4822
|
Cn as g
|
|
4806
4823
|
};
|