@solid-labs/fab-one-widget 1.0.15 → 1.0.16
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,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as F, jsx as i, Fragment as Ee } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as co, Component as fo, useCallback as Q, useMemo as j, useState as W, memo as uo, useEffect as U, useRef as le, forwardRef as po, createElement as fn } from "react";
|
|
3
|
-
import { useFrame as
|
|
4
|
-
import { Html as
|
|
3
|
+
import { useFrame as yn, useThree as wn, Canvas as ho } from "@react-three/fiber";
|
|
4
|
+
import { Html as je, Line as de, OrbitControls as Sn } from "@react-three/drei";
|
|
5
5
|
import * as $ from "three";
|
|
6
6
|
import { Plane as xt, Vector3 as M, Box3 as vn, Line3 as Cn, Raycaster as go } from "three";
|
|
7
7
|
import { create as mo } from "zustand";
|
|
8
8
|
import { OBJLoader as zn } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
9
9
|
import { STLLoader as xo } from "three/examples/jsm/loaders/STLLoader.js";
|
|
10
|
-
import { MeshBVH as
|
|
10
|
+
import { MeshBVH as bt } from "three-mesh-bvh";
|
|
11
11
|
let Rr, ht, vr, Rn;
|
|
12
12
|
let __tla = (async () => {
|
|
13
|
-
const
|
|
13
|
+
const bo = {
|
|
14
14
|
showDragDrop: true,
|
|
15
15
|
showStartOver: true,
|
|
16
16
|
showDebug: true,
|
|
@@ -19,7 +19,7 @@ let __tla = (async () => {
|
|
|
19
19
|
showNavigation: true,
|
|
20
20
|
showToolbar: false,
|
|
21
21
|
showSaveButton: true
|
|
22
|
-
},
|
|
22
|
+
}, yo = {
|
|
23
23
|
showDragDrop: false,
|
|
24
24
|
showStartOver: false,
|
|
25
25
|
showDebug: false,
|
|
@@ -28,7 +28,7 @@ let __tla = (async () => {
|
|
|
28
28
|
showNavigation: false,
|
|
29
29
|
showToolbar: false,
|
|
30
30
|
showSaveButton: false
|
|
31
|
-
}, wo = co(
|
|
31
|
+
}, wo = co(bo), Ht = mo((n, 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
|
-
})), So = 0.45,
|
|
67
|
+
})), So = 0.45, yt = 3, $t = 1e-3, gt = 25.4, vo = [
|
|
68
68
|
0.25,
|
|
69
69
|
-0.25,
|
|
70
70
|
0.5,
|
|
@@ -97,23 +97,23 @@ let __tla = (async () => {
|
|
|
97
97
|
const E = r[D * 3] * o, V = r[D * 3 + 1] * o, G = r[D * 3 + 2] * o;
|
|
98
98
|
E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), G < d && (d = G), G > x && (x = G);
|
|
99
99
|
}
|
|
100
|
-
const C = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5,
|
|
100
|
+
const C = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, P = u - m + 1e-6, v = x - d + 1e-6, S = b * 0.5, A = P * 0.5, w = v * 0.5, k = Math.min(128, Math.max(16, Math.round(Math.cbrt(a)))), h = b / k, z = P / k, L = v / k, _ = /* @__PURE__ */ new Map();
|
|
101
101
|
for (let D = 0; D < a; D++) {
|
|
102
|
-
const E = r[D * 3] * o - C, V = r[D * 3 + 1] * o - p, G = r[D * 3 + 2] * o - g, q = Math.min(k - 1, Math.max(0, Math.floor((E + S) / h))),
|
|
102
|
+
const E = r[D * 3] * o - C, V = r[D * 3 + 1] * o - p, G = r[D * 3 + 2] * o - g, q = Math.min(k - 1, Math.max(0, Math.floor((E + S) / h))), be = Math.min(k - 1, Math.max(0, Math.floor((V + A) / z))), ae = Math.min(k - 1, Math.max(0, Math.floor((G + w) / L))), fe = q * k * k + be * k + ae;
|
|
103
103
|
let re = _.get(fe);
|
|
104
104
|
re || (re = [], _.set(fe, re)), re.push(D);
|
|
105
105
|
}
|
|
106
106
|
for (let D = 0; D < l; D++) {
|
|
107
|
-
const E = s.getX(D), V = s.getY(D), G = s.getZ(D), q = Math.min(k - 1, Math.max(0, Math.floor((E + S) / h))),
|
|
107
|
+
const E = s.getX(D), V = s.getY(D), G = s.getZ(D), q = Math.min(k - 1, Math.max(0, Math.floor((E + S) / h))), be = Math.min(k - 1, Math.max(0, Math.floor((V + A) / z))), ae = Math.min(k - 1, Math.max(0, Math.floor((G + w) / L)));
|
|
108
108
|
let fe = 1 / 0, re = 0;
|
|
109
109
|
for (let ee = 0; ee <= k && fe > 0; ee++) {
|
|
110
110
|
for (let Y = -ee; Y <= ee; Y++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
|
|
111
111
|
if (ee > 0 && Math.abs(Y) < ee && Math.abs(ue) < ee && Math.abs(Z) < ee) continue;
|
|
112
|
-
const pe = q + Y, me =
|
|
112
|
+
const pe = q + Y, me = be + ue, he = ae + Z;
|
|
113
113
|
if (pe < 0 || pe >= k || me < 0 || me >= k || he < 0 || he >= k) continue;
|
|
114
114
|
const H = _.get(pe * k * k + me * k + he);
|
|
115
115
|
if (H) for (const ne of H) {
|
|
116
|
-
const xe = r[ne * 3] * o - C, we = r[ne * 3 + 1] * o - p,
|
|
116
|
+
const xe = r[ne * 3] * o - C, we = r[ne * 3 + 1] * o - p, ye = r[ne * 3 + 2] * o - g, oe = (E - xe) ** 2 + (V - we) ** 2 + (G - ye) ** 2;
|
|
117
117
|
oe < fe && (fe = oe, re = ne);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -199,22 +199,22 @@ let __tla = (async () => {
|
|
|
199
199
|
t == null ? void 0 : t("Parsing mesh...");
|
|
200
200
|
const l = new zn().parse(n);
|
|
201
201
|
let c = null;
|
|
202
|
-
if (l.traverse((
|
|
203
|
-
|
|
202
|
+
if (l.traverse((b) => {
|
|
203
|
+
b.isMesh && !c && (c = b.geometry);
|
|
204
204
|
}), !c) return null;
|
|
205
205
|
const { positions: a, indices: e } = mt(c);
|
|
206
206
|
if (a.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${a.length} indices=${e.length}`), null;
|
|
207
|
-
for (let
|
|
207
|
+
for (let b = 0; b < Math.min(a.length, 300); b++) if (!isFinite(a[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
|
|
208
208
|
const m = a.length / 3;
|
|
209
|
-
for (let
|
|
209
|
+
for (let b = 0; b < Math.min(e.length, 300); b++) if (e[b] >= m) return ce.error("wasm", `Out-of-bounds index: ${e[b]} >= ${m}`), null;
|
|
210
210
|
t == null ? void 0 : t("Processing mesh (WASM)...");
|
|
211
211
|
const d = r.preprocess_mesh(a, e, 10, 1e-4, 500), f = d.positions(), u = d.indices(), x = d.unit_converted(), C = d.detected_unit(), p = d.log();
|
|
212
212
|
if (ce.debug("wasm", "preprocess result", p), f.length === 0) return null;
|
|
213
213
|
t == null ? void 0 : t("Building geometry...");
|
|
214
214
|
const g = kn(f, u);
|
|
215
215
|
if (o) {
|
|
216
|
-
const
|
|
217
|
-
zo(g, o.positions, o.colors,
|
|
216
|
+
const b = x ? 1e3 : 1;
|
|
217
|
+
zo(g, o.positions, o.colors, b);
|
|
218
218
|
}
|
|
219
219
|
return {
|
|
220
220
|
geometry: g,
|
|
@@ -276,11 +276,11 @@ let __tla = (async () => {
|
|
|
276
276
|
for (; x; ) {
|
|
277
277
|
x = false;
|
|
278
278
|
for (let p = l.length - 1; p >= 0; p--) {
|
|
279
|
-
const { a: g, b
|
|
280
|
-
if (g.equals(u[u.length - 1])) u.push(
|
|
281
|
-
else if (
|
|
282
|
-
else if (g.equals(u[0])) u.unshift(
|
|
283
|
-
else if (
|
|
279
|
+
const { a: g, b } = l[p];
|
|
280
|
+
if (g.equals(u[u.length - 1])) u.push(b);
|
|
281
|
+
else if (b.equals(u[u.length - 1])) u.push(g);
|
|
282
|
+
else if (g.equals(u[0])) u.unshift(b);
|
|
283
|
+
else if (b.equals(u[0])) u.unshift(g);
|
|
284
284
|
else continue;
|
|
285
285
|
l.splice(p, 1), x = true;
|
|
286
286
|
}
|
|
@@ -339,7 +339,7 @@ let __tla = (async () => {
|
|
|
339
339
|
isClosed: C
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function He(n, r, t, o = false) {
|
|
343
343
|
const s = pn(n, r, t, o);
|
|
344
344
|
if (s.isClosed && s.linePoints.length >= 3) return s;
|
|
345
345
|
ce.debug("slice", `y=${t.toFixed(2)} failed (pts=${s.linePoints.length}, closed=${s.isClosed}), retrying...`);
|
|
@@ -369,8 +369,8 @@ let __tla = (async () => {
|
|
|
369
369
|
return Ge(m);
|
|
370
370
|
}
|
|
371
371
|
function Ot(n) {
|
|
372
|
-
return new
|
|
373
|
-
maxLeafTris:
|
|
372
|
+
return new bt(n, {
|
|
373
|
+
maxLeafTris: yt
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
function Lo(n, r, t, o) {
|
|
@@ -388,9 +388,9 @@ 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:
|
|
393
|
-
}), e =
|
|
391
|
+
const a = new bt(n, {
|
|
392
|
+
maxLeafTris: yt
|
|
393
|
+
}), e = He(a, n, r);
|
|
394
394
|
if (e.lineLength === 0) return {
|
|
395
395
|
valid: false,
|
|
396
396
|
reason: "No circumference at green point \u2014 mesh may be empty at that height"
|
|
@@ -400,7 +400,7 @@ let __tla = (async () => {
|
|
|
400
400
|
valid: true,
|
|
401
401
|
reason: ""
|
|
402
402
|
};
|
|
403
|
-
const d =
|
|
403
|
+
const d = He(a, n, m);
|
|
404
404
|
if (e.lineLength > 0 && d.lineLength > 0) {
|
|
405
405
|
const u = e.lineLength / d.lineLength;
|
|
406
406
|
if (u < 0.5) return {
|
|
@@ -410,7 +410,7 @@ let __tla = (async () => {
|
|
|
410
410
|
}
|
|
411
411
|
const f = r - o * 2;
|
|
412
412
|
if (f > t) {
|
|
413
|
-
const u =
|
|
413
|
+
const u = He(a, n, f);
|
|
414
414
|
if (d.lineLength > 0 && u.lineLength > 0) {
|
|
415
415
|
const x = d.lineLength / u.lineLength;
|
|
416
416
|
if (x < 0.5) return {
|
|
@@ -445,8 +445,8 @@ let __tla = (async () => {
|
|
|
445
445
|
const X = new $.Quaternion().setFromAxisAngle(new M(1, 0, 0), Math.PI);
|
|
446
446
|
a.applyMatrix4(new $.Matrix4().makeRotationFromQuaternion(X)), e = e.map((Pe) => Pe.clone().applyQuaternion(X));
|
|
447
447
|
}
|
|
448
|
-
const
|
|
449
|
-
a.translate(-
|
|
448
|
+
const ye = e[0].clone();
|
|
449
|
+
a.translate(-ye.x, -ye.y, -ye.z), e = e.map((X) => new M(X.x - ye.x, X.y - ye.y, X.z - ye.z)), a.computeVertexNormals(), a.computeBoundingBox();
|
|
450
450
|
const oe = new M(e[0].x, e[0].y, e[0].z);
|
|
451
451
|
e.push(oe), o.addLandmarkPoint({
|
|
452
452
|
faceIndex: -1,
|
|
@@ -484,12 +484,12 @@ let __tla = (async () => {
|
|
|
484
484
|
d.z
|
|
485
485
|
]);
|
|
486
486
|
o.onStatus("Detecting shell type...");
|
|
487
|
-
const p = c.detect_shell(f, u, C, 40), g = p.is_double_shell(),
|
|
487
|
+
const p = c.detect_shell(f, u, C, 40), g = p.is_double_shell(), b = p.surface_normal();
|
|
488
488
|
ce.info(Fe, `Shell: ${g ? "DOUBLE" : "SINGLE"}`, p.details()), (_a = o.setDoubleShell) == null ? void 0 : _a.call(o, g), o.onStatus("Finding cross-section plane...");
|
|
489
489
|
const P = new Float32Array([
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
490
|
+
b[0],
|
|
491
|
+
b[1],
|
|
492
|
+
b[2]
|
|
493
493
|
]), v = c.find_min_cross_section(f, u, C, P, 10), S = v.plane_normal();
|
|
494
494
|
ce.info(Fe, "Cross-section found", v.details()), o.onStatus("Aligning mesh...");
|
|
495
495
|
const A = new Float32Array([
|
|
@@ -518,22 +518,22 @@ let __tla = (async () => {
|
|
|
518
518
|
o.onStatus("Generating measurement points...");
|
|
519
519
|
const E = c.subdivide_origin_to_plane(new Float32Array(z), new Float32Array(h), D);
|
|
520
520
|
ce.debug(Fe, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
|
|
521
|
-
const V = E.points(), G = E.count(), q = 2,
|
|
522
|
-
for (let H = q; H < G -
|
|
521
|
+
const V = E.points(), G = E.count(), q = 2, be = 1, ae = [];
|
|
522
|
+
for (let H = q; H < G - be; H++) ae.push(V[H * 3 + 1]);
|
|
523
523
|
o.onStatus("Computing cross-sections...");
|
|
524
524
|
let fe = [];
|
|
525
525
|
if (ae.length >= 2) {
|
|
526
526
|
const ne = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(k, u, new Float32Array(ae), 10);
|
|
527
527
|
ce.debug(Fe, "Batch (subdivision)", ne.details());
|
|
528
|
-
const xe = ne.all_loop_points(), we = ne.offsets(),
|
|
528
|
+
const xe = ne.all_loop_points(), we = ne.offsets(), ye = ne.circumferences();
|
|
529
529
|
for (let oe = 0; oe < we.length - 1; oe++) {
|
|
530
530
|
const N = we[oe], X = we[oe + 1];
|
|
531
|
-
if (X <= N ||
|
|
531
|
+
if (X <= N || ye[oe] <= 0) continue;
|
|
532
532
|
const Pe = (X - N) / 3;
|
|
533
533
|
if (Pe < 3) continue;
|
|
534
|
-
let ke = 0,
|
|
535
|
-
for (let Ae = N; Ae < X; Ae += 3) ke += xe[Ae],
|
|
536
|
-
fe.push(ke / Pe,
|
|
534
|
+
let ke = 0, Ve = 0, ie = 0;
|
|
535
|
+
for (let Ae = N; Ae < X; Ae += 3) ke += xe[Ae], Ve += xe[Ae + 1], ie += xe[Ae + 2];
|
|
536
|
+
fe.push(ke / Pe, Ve / Pe, ie / Pe);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
if (fe.length >= 6) {
|
|
@@ -570,20 +570,20 @@ let __tla = (async () => {
|
|
|
570
570
|
ue.getSize(Z), o.setModelSize(Math.max(Z.x, Z.y, Z.z)), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * gt), o.onStatus("Computing final measurements...");
|
|
571
571
|
{
|
|
572
572
|
const H = mt(a), ne = e[1].y, xe = e[0].y;
|
|
573
|
-
let we = 1 / 0,
|
|
573
|
+
let we = 1 / 0, ye = -1 / 0;
|
|
574
574
|
const oe = H.positions;
|
|
575
|
-
for (let ie = 1; ie < oe.length; ie += 3) oe[ie] < we && (we = oe[ie]), oe[ie] >
|
|
575
|
+
for (let ie = 1; ie < oe.length; ie += 3) oe[ie] < we && (we = oe[ie]), oe[ie] > ye && (ye = oe[ie]);
|
|
576
576
|
const N = 25.4, X = [];
|
|
577
577
|
X.push(ne);
|
|
578
578
|
for (let ie = 1; ie <= 2; ie++) {
|
|
579
579
|
const Ae = ne + ie * N;
|
|
580
|
-
Ae <
|
|
580
|
+
Ae < ye - 1 && X.push(Ae);
|
|
581
581
|
}
|
|
582
582
|
for (let ie = ne - N; ie > xe; ie -= N) X.push(ie);
|
|
583
583
|
X.sort((ie, Ae) => ie - Ae), ce.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
584
|
const ke = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))(H.positions, H.indices, new Float32Array(X), 10);
|
|
585
585
|
ce.info(Fe, `Horizontal slices (${g ? "inner" : "outer"}): ${ke.count()}/${X.length} valid`), ce.debug(Fe, "Slice details", ke.details());
|
|
586
|
-
const
|
|
586
|
+
const Ve = {
|
|
587
587
|
yValues: X,
|
|
588
588
|
circumferences: Array.from(ke.circumferences()),
|
|
589
589
|
allLoopPoints: new Float32Array(ke.all_loop_points()),
|
|
@@ -591,7 +591,7 @@ let __tla = (async () => {
|
|
|
591
591
|
mptY: ne,
|
|
592
592
|
originY: xe
|
|
593
593
|
};
|
|
594
|
-
(_d = o.setWasmSlices) == null ? void 0 : _d.call(o,
|
|
594
|
+
(_d = o.setWasmSlices) == null ? void 0 : _d.call(o, Ve);
|
|
595
595
|
}
|
|
596
596
|
o.onStatus("Validating results...");
|
|
597
597
|
const pe = e[1].y, me = e[0].y, he = Lo(a, pe, me, t);
|
|
@@ -772,12 +772,12 @@ let __tla = (async () => {
|
|
|
772
772
|
x.stopPropagation();
|
|
773
773
|
const C = x.intersections[0], p = C == null ? void 0 : C.faceIndex;
|
|
774
774
|
if (!C || p == null) return;
|
|
775
|
-
const g = n.geometry,
|
|
775
|
+
const g = n.geometry, b = g.index;
|
|
776
776
|
let P;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
777
|
+
b ? P = [
|
|
778
|
+
b.getX(p * 3),
|
|
779
|
+
b.getX(p * 3 + 1),
|
|
780
|
+
b.getX(p * 3 + 2)
|
|
781
781
|
] : P = [
|
|
782
782
|
p * 3,
|
|
783
783
|
p * 3 + 1,
|
|
@@ -847,7 +847,7 @@ let __tla = (async () => {
|
|
|
847
847
|
i("meshBasicMaterial", {
|
|
848
848
|
color: o
|
|
849
849
|
}),
|
|
850
|
-
l && i(
|
|
850
|
+
l && i(je, {
|
|
851
851
|
center: true,
|
|
852
852
|
style: {
|
|
853
853
|
pointerEvents: "none"
|
|
@@ -889,8 +889,8 @@ let __tla = (async () => {
|
|
|
889
889
|
});
|
|
890
890
|
};
|
|
891
891
|
function Pn(n) {
|
|
892
|
-
return j(() => n ? new
|
|
893
|
-
maxLeafTris:
|
|
892
|
+
return j(() => n ? new bt(n, {
|
|
893
|
+
maxLeafTris: yt
|
|
894
894
|
}) : null, [
|
|
895
895
|
n
|
|
896
896
|
]);
|
|
@@ -927,7 +927,7 @@ let __tla = (async () => {
|
|
|
927
927
|
});
|
|
928
928
|
return new $.Mesh(c, a);
|
|
929
929
|
}, Ho = ({ bvh: n, geometry: r, yPosition: t, color: o = "#00ff00", labelX: s, onDataChange: l, displayUnit: c = "mm", useInnerSurface: a = false, formValue: e, lineWidth: m = 1.5, wasmLoopPoints: d, wasmCircumference: f }) => {
|
|
930
|
-
const u = j(() => d && f != null ? null :
|
|
930
|
+
const u = j(() => d && f != null ? null : He(n, r, t, a), [
|
|
931
931
|
n,
|
|
932
932
|
r,
|
|
933
933
|
t,
|
|
@@ -951,7 +951,7 @@ let __tla = (async () => {
|
|
|
951
951
|
}, [
|
|
952
952
|
g
|
|
953
953
|
]);
|
|
954
|
-
const
|
|
954
|
+
const b = le(null), P = j(() => {
|
|
955
955
|
const v = new $.BufferGeometry();
|
|
956
956
|
v.setAttribute("position", new $.Float32BufferAttribute(new Float32Array(6), 3));
|
|
957
957
|
const S = new $.LineBasicMaterial({
|
|
@@ -976,8 +976,8 @@ let __tla = (async () => {
|
|
|
976
976
|
C,
|
|
977
977
|
t,
|
|
978
978
|
l
|
|
979
|
-
]),
|
|
980
|
-
if (!
|
|
979
|
+
]), yn(({ camera: v }) => {
|
|
980
|
+
if (!b.current || x.length < 2) return;
|
|
981
981
|
const S = new M();
|
|
982
982
|
v.getWorldDirection(S);
|
|
983
983
|
const A = new M(S.x, 0, S.z);
|
|
@@ -990,7 +990,7 @@ let __tla = (async () => {
|
|
|
990
990
|
E > k && (k = E, h = D);
|
|
991
991
|
}
|
|
992
992
|
const z = s * 0.35, L = new M(h.x + w.x * z, t, h.z + w.z * z);
|
|
993
|
-
|
|
993
|
+
b.current.position.copy(L);
|
|
994
994
|
const _ = P.geometry.getAttribute("position");
|
|
995
995
|
_.setXYZ(0, h.x, h.y, h.z), _.setXYZ(1, L.x, L.y, L.z), _.needsUpdate = true;
|
|
996
996
|
}), x.length < 2 ? null : F("group", {
|
|
@@ -1027,8 +1027,8 @@ let __tla = (async () => {
|
|
|
1027
1027
|
renderOrder: 10
|
|
1028
1028
|
}),
|
|
1029
1029
|
i("group", {
|
|
1030
|
-
ref:
|
|
1031
|
-
children: i(
|
|
1030
|
+
ref: b,
|
|
1031
|
+
children: i(je, {
|
|
1032
1032
|
zIndexRange: [
|
|
1033
1033
|
100,
|
|
1034
1034
|
0
|
|
@@ -1168,7 +1168,7 @@ let __tla = (async () => {
|
|
|
1168
1168
|
return A;
|
|
1169
1169
|
}, [
|
|
1170
1170
|
f
|
|
1171
|
-
]),
|
|
1171
|
+
]), b = j(() => {
|
|
1172
1172
|
if (!f) return null;
|
|
1173
1173
|
const A = /* @__PURE__ */ new Map();
|
|
1174
1174
|
for (let w = 0; w < f.yValues.length; w++) A.set(f.yValues[w], f.circumferences[w]);
|
|
@@ -1181,29 +1181,29 @@ let __tla = (async () => {
|
|
|
1181
1181
|
}, [
|
|
1182
1182
|
p
|
|
1183
1183
|
]), U(() => {
|
|
1184
|
-
if (!
|
|
1185
|
-
const A = p.filter((w) => (
|
|
1184
|
+
if (!b || !l) return;
|
|
1185
|
+
const A = p.filter((w) => (b.get(w) ?? 0) > 0).map((w) => ({
|
|
1186
1186
|
yPosition: w,
|
|
1187
|
-
originalValue:
|
|
1187
|
+
originalValue: b.get(w) ?? 0,
|
|
1188
1188
|
modifiedValue: null
|
|
1189
1189
|
}));
|
|
1190
1190
|
l(A);
|
|
1191
1191
|
}, [
|
|
1192
|
-
|
|
1192
|
+
b,
|
|
1193
1193
|
p,
|
|
1194
1194
|
l
|
|
1195
1195
|
]);
|
|
1196
1196
|
const P = [
|
|
1197
1197
|
"#5B9BD5"
|
|
1198
1198
|
], v = s * So, S = Q((A) => {
|
|
1199
|
-
if (
|
|
1199
|
+
if (b) return;
|
|
1200
1200
|
u.current.set(A.yPosition, A);
|
|
1201
1201
|
const w = Array.from(u.current.values()).sort((k, h) => c ? h.yPosition - k.yPosition : k.yPosition - h.yPosition);
|
|
1202
1202
|
l == null ? void 0 : l(w);
|
|
1203
1203
|
}, [
|
|
1204
1204
|
l,
|
|
1205
1205
|
c,
|
|
1206
|
-
|
|
1206
|
+
b
|
|
1207
1207
|
]);
|
|
1208
1208
|
return C ? i(Ee, {
|
|
1209
1209
|
children: p.map((A, w) => i(jo, {
|
|
@@ -1218,7 +1218,7 @@ let __tla = (async () => {
|
|
|
1218
1218
|
formValue: m == null ? void 0 : m[w],
|
|
1219
1219
|
lineWidth: d != null && Math.abs(A - d) < o * 0.5 ? 4 : 1.5,
|
|
1220
1220
|
wasmLoopPoints: g == null ? void 0 : g.get(A),
|
|
1221
|
-
wasmCircumference:
|
|
1221
|
+
wasmCircumference: b == null ? void 0 : b.get(A)
|
|
1222
1222
|
}, A))
|
|
1223
1223
|
}) : null;
|
|
1224
1224
|
}, No = (n, r) => {
|
|
@@ -1229,7 +1229,7 @@ let __tla = (async () => {
|
|
|
1229
1229
|
const c = n.geometry;
|
|
1230
1230
|
c.computeBoundingBox();
|
|
1231
1231
|
const a = s ?? ((_a = c.boundingBox) == null ? void 0 : _a.min.y) ?? 0, e = r - a, m = t * 0.4, d = t * 0.03, f = le(null);
|
|
1232
|
-
|
|
1232
|
+
yn(({ camera: w }) => {
|
|
1233
1233
|
if (!f.current) return;
|
|
1234
1234
|
const k = new M();
|
|
1235
1235
|
w.getWorldDirection(k);
|
|
@@ -1241,7 +1241,7 @@ let __tla = (async () => {
|
|
|
1241
1241
|
const L = w.position.x - f.current.position.x, _ = w.position.z - f.current.position.z;
|
|
1242
1242
|
f.current.rotation.y = Math.atan2(L, _);
|
|
1243
1243
|
});
|
|
1244
|
-
const u = new M(0, r, 0), x = new M(0, a, 0), C = new M(0, (r + a) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0),
|
|
1244
|
+
const u = new M(0, r, 0), x = new M(0, a, 0), C = new M(0, (r + a) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, a, 0), P = new M(d, a, 0), v = l != null && l > 0, S = v ? e - l : 0, A = v ? No(e, l) : "#fff";
|
|
1245
1245
|
return F("group", {
|
|
1246
1246
|
ref: f,
|
|
1247
1247
|
children: [
|
|
@@ -1263,7 +1263,7 @@ let __tla = (async () => {
|
|
|
1263
1263
|
}),
|
|
1264
1264
|
i(de, {
|
|
1265
1265
|
points: [
|
|
1266
|
-
|
|
1266
|
+
b,
|
|
1267
1267
|
P
|
|
1268
1268
|
],
|
|
1269
1269
|
color: "#888888",
|
|
@@ -1271,7 +1271,7 @@ let __tla = (async () => {
|
|
|
1271
1271
|
}),
|
|
1272
1272
|
i("mesh", {
|
|
1273
1273
|
position: C,
|
|
1274
|
-
children: i(
|
|
1274
|
+
children: i(je, {
|
|
1275
1275
|
center: true,
|
|
1276
1276
|
style: {
|
|
1277
1277
|
pointerEvents: "none"
|
|
@@ -1361,7 +1361,7 @@ let __tla = (async () => {
|
|
|
1361
1361
|
]
|
|
1362
1362
|
});
|
|
1363
1363
|
}, Go = ({ modelSize: n, isAligned: r, isCut: t, mesh: o, viewMode: s, sliceY: l, landmarkCount: c = 0, measurementGeometry: a, resetCameraToFrontRef: e }) => {
|
|
1364
|
-
const { set: m, size: d, camera: f, invalidate: u } = wn(), x = le(false), C = le(s), p = le(new M()), g = le(null),
|
|
1364
|
+
const { set: m, size: d, camera: f, invalidate: u } = wn(), x = le(false), C = le(s), p = le(new M()), g = le(null), b = le(c), P = le(r), v = le(t), S = le(a), A = le(0), w = Q(() => {
|
|
1365
1365
|
if (!o || n <= 0) return null;
|
|
1366
1366
|
const h = a ?? o.geometry;
|
|
1367
1367
|
h.computeBoundingBox();
|
|
@@ -1415,8 +1415,8 @@ let __tla = (async () => {
|
|
|
1415
1415
|
r,
|
|
1416
1416
|
k
|
|
1417
1417
|
]), U(() => {
|
|
1418
|
-
const h =
|
|
1419
|
-
|
|
1418
|
+
const h = b.current;
|
|
1419
|
+
b.current = c, h === 0 && c === 1 && !r && requestAnimationFrame(() => k(f));
|
|
1420
1420
|
}, [
|
|
1421
1421
|
c,
|
|
1422
1422
|
r,
|
|
@@ -1443,12 +1443,12 @@ let __tla = (async () => {
|
|
|
1443
1443
|
if (s === "2D" && l != null) {
|
|
1444
1444
|
g.current = f;
|
|
1445
1445
|
const z = o.geometry, L = z.getAttribute("position"), _ = L.array, D = n * 0.15;
|
|
1446
|
-
let E = 1 / 0, V = -1 / 0, G = 1 / 0, q = -1 / 0,
|
|
1446
|
+
let E = 1 / 0, V = -1 / 0, G = 1 / 0, q = -1 / 0, be = false;
|
|
1447
1447
|
for (let he = 0; he < L.count; he++) if (Math.abs(_[he * 3 + 1] - l) < D) {
|
|
1448
1448
|
const H = _[he * 3], ne = _[he * 3 + 2];
|
|
1449
|
-
H < E && (E = H), H > V && (V = H), ne < G && (G = ne), ne > q && (q = ne),
|
|
1449
|
+
H < E && (E = H), H > V && (V = H), ne < G && (G = ne), ne > q && (q = ne), be = true;
|
|
1450
1450
|
}
|
|
1451
|
-
if (!
|
|
1451
|
+
if (!be) {
|
|
1452
1452
|
z.computeBoundingBox();
|
|
1453
1453
|
const he = z.boundingBox;
|
|
1454
1454
|
E = he.min.x, V = he.max.x, G = he.min.z, q = he.max.z;
|
|
@@ -1486,12 +1486,12 @@ let __tla = (async () => {
|
|
|
1486
1486
|
if (s === "2D") {
|
|
1487
1487
|
if (!o || l == null) return;
|
|
1488
1488
|
const z = o.geometry, L = z.getAttribute("position"), _ = L.array, D = n * 0.15;
|
|
1489
|
-
let E = 1 / 0, V = -1 / 0, G = 1 / 0, q = -1 / 0,
|
|
1489
|
+
let E = 1 / 0, V = -1 / 0, G = 1 / 0, q = -1 / 0, be = false;
|
|
1490
1490
|
for (let Z = 0; Z < L.count; Z++) if (Math.abs(_[Z * 3 + 1] - l) < D) {
|
|
1491
1491
|
const pe = _[Z * 3], me = _[Z * 3 + 2];
|
|
1492
|
-
pe < E && (E = pe), pe > V && (V = pe), me < G && (G = me), me > q && (q = me),
|
|
1492
|
+
pe < E && (E = pe), pe > V && (V = pe), me < G && (G = me), me > q && (q = me), be = true;
|
|
1493
1493
|
}
|
|
1494
|
-
if (!
|
|
1494
|
+
if (!be) {
|
|
1495
1495
|
z.computeBoundingBox();
|
|
1496
1496
|
const Z = z.boundingBox;
|
|
1497
1497
|
E = Z.min.x, V = Z.max.x, G = Z.min.z, q = Z.max.z;
|
|
@@ -1678,32 +1678,32 @@ let __tla = (async () => {
|
|
|
1678
1678
|
}, o.number);
|
|
1679
1679
|
})
|
|
1680
1680
|
}), Jo = ({ mesh: n, upperY: r, originY: t, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: l = "mm" }) => {
|
|
1681
|
-
const c = n.geometry, a = j(() => new
|
|
1682
|
-
maxLeafTris:
|
|
1681
|
+
const c = n.geometry, a = j(() => new bt(c, {
|
|
1682
|
+
maxLeafTris: yt
|
|
1683
1683
|
}), [
|
|
1684
1684
|
c
|
|
1685
|
-
]), e = j(() =>
|
|
1685
|
+
]), e = j(() => He(a, c, t), [
|
|
1686
1686
|
a,
|
|
1687
1687
|
c,
|
|
1688
1688
|
t
|
|
1689
1689
|
]), m = j(() => new xt(new M(0, -1, 0), r), [
|
|
1690
1690
|
r
|
|
1691
1691
|
]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = j(() => {
|
|
1692
|
-
let g = null,
|
|
1692
|
+
let g = null, b = null, P = 0, v = 0;
|
|
1693
1693
|
if (e.linePoints.length >= 2) {
|
|
1694
1694
|
let S = e.linePoints[0], A = e.linePoints[0], w = e.linePoints[0], k = e.linePoints[0];
|
|
1695
1695
|
for (const h of e.linePoints) h.x < S.x && (S = h), h.x > A.x && (A = h), h.z < w.z && (w = h), h.z > k.z && (k = h);
|
|
1696
1696
|
g = [
|
|
1697
1697
|
new M(S.x, t, S.z),
|
|
1698
1698
|
new M(A.x, t, A.z)
|
|
1699
|
-
],
|
|
1699
|
+
], b = [
|
|
1700
1700
|
new M(w.x, t, w.z),
|
|
1701
1701
|
new M(k.x, t, k.z)
|
|
1702
|
-
], P = g[0].distanceTo(g[1]), v =
|
|
1702
|
+
], P = g[0].distanceTo(g[1]), v = b[0].distanceTo(b[1]);
|
|
1703
1703
|
}
|
|
1704
1704
|
return {
|
|
1705
1705
|
mlLine: g,
|
|
1706
|
-
apLine:
|
|
1706
|
+
apLine: b,
|
|
1707
1707
|
mlWidth: P,
|
|
1708
1708
|
apWidth: v
|
|
1709
1709
|
};
|
|
@@ -1744,7 +1744,7 @@ let __tla = (async () => {
|
|
|
1744
1744
|
depthWrite: false,
|
|
1745
1745
|
transparent: true
|
|
1746
1746
|
}),
|
|
1747
|
-
i(
|
|
1747
|
+
i(je, {
|
|
1748
1748
|
position: [
|
|
1749
1749
|
d[0].x,
|
|
1750
1750
|
t,
|
|
@@ -1788,7 +1788,7 @@ let __tla = (async () => {
|
|
|
1788
1788
|
depthWrite: false,
|
|
1789
1789
|
transparent: true
|
|
1790
1790
|
}),
|
|
1791
|
-
i(
|
|
1791
|
+
i(je, {
|
|
1792
1792
|
position: [
|
|
1793
1793
|
Math.max(f[0].x, f[1].x) + o * 0.02,
|
|
1794
1794
|
t,
|
|
@@ -1825,7 +1825,7 @@ let __tla = (async () => {
|
|
|
1825
1825
|
]
|
|
1826
1826
|
});
|
|
1827
1827
|
}, Qo = ({ mesh: n, yPosition: r, onYChange: t, minY: o, maxY: s, modelSize: l, color: c, hoverColor: a, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
|
|
1828
|
-
const [u, x] = W(false), [C, p] = W(false), { camera: g, gl:
|
|
1828
|
+
const [u, x] = W(false), [C, p] = W(false), { camera: g, gl: b } = wn(), P = le(0), v = n.geometry, S = Pn(v), A = j(() => S ? He(S, v, r) : {
|
|
1829
1829
|
linePoints: [],
|
|
1830
1830
|
lineLength: 0,
|
|
1831
1831
|
rightmostPoint: new M()
|
|
@@ -1834,19 +1834,19 @@ let __tla = (async () => {
|
|
|
1834
1834
|
v,
|
|
1835
1835
|
r
|
|
1836
1836
|
]), w = Q((_, D) => {
|
|
1837
|
-
const E =
|
|
1837
|
+
const E = b.domElement.getBoundingClientRect(), V = (_ - E.left) / E.width * 2 - 1, G = -((D - E.top) / E.height) * 2 + 1, q = new go();
|
|
1838
1838
|
q.setFromCamera(new $.Vector2(V, G), g);
|
|
1839
|
-
const
|
|
1840
|
-
return q.ray.intersectPlane(
|
|
1839
|
+
const be = new xt(new M(0, 0, 1), 0), ae = new M();
|
|
1840
|
+
return q.ray.intersectPlane(be, ae), ae ? ae.y : r;
|
|
1841
1841
|
}, [
|
|
1842
1842
|
g,
|
|
1843
|
-
|
|
1843
|
+
b,
|
|
1844
1844
|
r
|
|
1845
1845
|
]), k = Q((_) => {
|
|
1846
|
-
_.stopPropagation(), x(true),
|
|
1846
|
+
_.stopPropagation(), x(true), b.domElement.style.cursor = "ns-resize", P.current = r - w(_.clientX, _.clientY), _.target.setPointerCapture(_.pointerId), d == null ? void 0 : d();
|
|
1847
1847
|
}, [
|
|
1848
1848
|
r,
|
|
1849
|
-
|
|
1849
|
+
b,
|
|
1850
1850
|
w,
|
|
1851
1851
|
d
|
|
1852
1852
|
]), h = Q((_) => {
|
|
@@ -1860,9 +1860,9 @@ let __tla = (async () => {
|
|
|
1860
1860
|
o,
|
|
1861
1861
|
s
|
|
1862
1862
|
]), z = Q((_) => {
|
|
1863
|
-
x(false),
|
|
1863
|
+
x(false), b.domElement.style.cursor = "auto", _.target.releasePointerCapture(_.pointerId), f == null ? void 0 : f();
|
|
1864
1864
|
}, [
|
|
1865
|
-
|
|
1865
|
+
b,
|
|
1866
1866
|
f
|
|
1867
1867
|
]);
|
|
1868
1868
|
if (A.linePoints.length < 2) return null;
|
|
@@ -1882,10 +1882,10 @@ let __tla = (async () => {
|
|
|
1882
1882
|
onPointerMove: h,
|
|
1883
1883
|
onPointerUp: z,
|
|
1884
1884
|
onPointerEnter: () => {
|
|
1885
|
-
p(true),
|
|
1885
|
+
p(true), b.domElement.style.cursor = "ns-resize";
|
|
1886
1886
|
},
|
|
1887
1887
|
onPointerLeave: () => {
|
|
1888
|
-
u || (p(false),
|
|
1888
|
+
u || (p(false), b.domElement.style.cursor = "auto");
|
|
1889
1889
|
}
|
|
1890
1890
|
}),
|
|
1891
1891
|
(C || u) && i("mesh", {
|
|
@@ -1894,7 +1894,7 @@ let __tla = (async () => {
|
|
|
1894
1894
|
r,
|
|
1895
1895
|
0
|
|
1896
1896
|
],
|
|
1897
|
-
children: i(
|
|
1897
|
+
children: i(je, {
|
|
1898
1898
|
center: true,
|
|
1899
1899
|
children: i("div", {
|
|
1900
1900
|
style: {
|
|
@@ -1940,7 +1940,7 @@ let __tla = (async () => {
|
|
|
1940
1940
|
});
|
|
1941
1941
|
const nr = [
|
|
1942
1942
|
"Scan doesn't load properly",
|
|
1943
|
-
"
|
|
1943
|
+
"Modified CAD",
|
|
1944
1944
|
"I don't want to",
|
|
1945
1945
|
"I want a second opinion",
|
|
1946
1946
|
"I measured from IT"
|
|
@@ -2202,7 +2202,7 @@ let __tla = (async () => {
|
|
|
2202
2202
|
fontFamily: "system-ui, sans-serif",
|
|
2203
2203
|
letterSpacing: "0.4px",
|
|
2204
2204
|
lineHeight: "36px"
|
|
2205
|
-
},
|
|
2205
|
+
}, bn = {
|
|
2206
2206
|
width: "100%",
|
|
2207
2207
|
padding: "10px 12px",
|
|
2208
2208
|
fontSize: 15,
|
|
@@ -2228,7 +2228,7 @@ let __tla = (async () => {
|
|
|
2228
2228
|
return x.forEach((z, L) => {
|
|
2229
2229
|
e[L] != null && e[L] !== 0 && (h[z] = e[L].toFixed(1));
|
|
2230
2230
|
}), h;
|
|
2231
|
-
}), [g,
|
|
2231
|
+
}), [g, b] = W(m && m > 0 ? m.toFixed(1) : ""), [P, v] = W(false), S = j(() => x.map((h) => {
|
|
2232
2232
|
const z = C[h];
|
|
2233
2233
|
return z != null && z !== "" && !isNaN(parseFloat(z)) ? parseFloat(z) : 0;
|
|
2234
2234
|
}), [
|
|
@@ -2273,7 +2273,7 @@ let __tla = (async () => {
|
|
|
2273
2273
|
const D = _.modifiedValue ?? _.originalValue;
|
|
2274
2274
|
h[z] = D.toFixed(1);
|
|
2275
2275
|
}
|
|
2276
|
-
}), p(h), o > 0 &&
|
|
2276
|
+
}), p(h), o > 0 && b(o.toFixed(1));
|
|
2277
2277
|
}, [
|
|
2278
2278
|
x,
|
|
2279
2279
|
t,
|
|
@@ -2408,7 +2408,7 @@ let __tla = (async () => {
|
|
|
2408
2408
|
[h]: L.target.value
|
|
2409
2409
|
})),
|
|
2410
2410
|
style: {
|
|
2411
|
-
...
|
|
2411
|
+
...bn,
|
|
2412
2412
|
padding: "6px 8px",
|
|
2413
2413
|
fontSize: 13,
|
|
2414
2414
|
borderColor: C[h] ? "rgb(12, 67, 173)" : "#ccc",
|
|
@@ -2449,9 +2449,9 @@ let __tla = (async () => {
|
|
|
2449
2449
|
type: "number",
|
|
2450
2450
|
step: "0.1",
|
|
2451
2451
|
value: g,
|
|
2452
|
-
onChange: (h) =>
|
|
2452
|
+
onChange: (h) => b(h.target.value),
|
|
2453
2453
|
style: {
|
|
2454
|
-
...
|
|
2454
|
+
...bn,
|
|
2455
2455
|
padding: "6px 8px",
|
|
2456
2456
|
fontSize: 13,
|
|
2457
2457
|
borderColor: g ? "rgb(12, 67, 173)" : "#ccc",
|
|
@@ -2512,11 +2512,11 @@ let __tla = (async () => {
|
|
|
2512
2512
|
if (s < 1) return null;
|
|
2513
2513
|
const l = 30, c = s / l, a = [];
|
|
2514
2514
|
for (let g = 0; g < l; g++) {
|
|
2515
|
-
const
|
|
2515
|
+
const b = r + g * c, P = r + (g + 1) * c;
|
|
2516
2516
|
let v = 0, S = 0, A = 0, w = 0;
|
|
2517
2517
|
for (let k = 0; k < o.count; k++) {
|
|
2518
2518
|
const h = o.getY(k);
|
|
2519
|
-
h >=
|
|
2519
|
+
h >= b && h < P && (v += o.getX(k), S += h, A += o.getZ(k), w++);
|
|
2520
2520
|
}
|
|
2521
2521
|
w > 20 && a.push(new M(v / w, S / w, A / w));
|
|
2522
2522
|
}
|
|
@@ -2526,12 +2526,12 @@ let __tla = (async () => {
|
|
|
2526
2526
|
e.divideScalar(a.length);
|
|
2527
2527
|
let m = 0, d = 0, f = 0, u = 0, x = 0, C = 0;
|
|
2528
2528
|
for (const g of a) {
|
|
2529
|
-
const
|
|
2530
|
-
m +=
|
|
2529
|
+
const b = g.x - e.x, P = g.y - e.y, v = g.z - e.z;
|
|
2530
|
+
m += b * b, d += b * P, f += b * v, u += P * P, x += P * v, C += v * v;
|
|
2531
2531
|
}
|
|
2532
2532
|
let p = new M(0.01, 1, 0.01).normalize();
|
|
2533
2533
|
for (let g = 0; g < 30; g++) {
|
|
2534
|
-
const
|
|
2534
|
+
const b = m * p.x + d * p.y + f * p.z, P = d * p.x + u * p.y + x * p.z, v = f * p.x + x * p.y + C * p.z, S = new M(b, P, v), A = S.length();
|
|
2535
2535
|
if (A < 1e-10 || (S.divideScalar(A), p.distanceTo(S) < 1e-8)) break;
|
|
2536
2536
|
p = S;
|
|
2537
2537
|
}
|
|
@@ -2558,8 +2558,8 @@ let __tla = (async () => {
|
|
|
2558
2558
|
o.divideScalar(t);
|
|
2559
2559
|
let s = 0, l = 0, c = 0, a = 0, e = 0, m = 0;
|
|
2560
2560
|
for (let p = 0; p < t; p++) {
|
|
2561
|
-
const g = r.getX(p) - o.x,
|
|
2562
|
-
s += g * g, l += g *
|
|
2561
|
+
const g = r.getX(p) - o.x, b = r.getY(p) - o.y, P = r.getZ(p) - o.z;
|
|
2562
|
+
s += g * g, l += g * b, c += g * P, a += b * b, e += b * P, m += P * P;
|
|
2563
2563
|
}
|
|
2564
2564
|
s /= t, l /= t, c /= t, a /= t, e /= t, m /= t;
|
|
2565
2565
|
const d = [], f = [], u = [
|
|
@@ -2580,17 +2580,17 @@ let __tla = (async () => {
|
|
|
2580
2580
|
]
|
|
2581
2581
|
];
|
|
2582
2582
|
for (let p = 0; p < 3; p++) {
|
|
2583
|
-
let g = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(),
|
|
2583
|
+
let g = new M(1 + p * 0.1, 1 - p * 0.1, 0.5 + p * 0.3).normalize(), b = 0;
|
|
2584
2584
|
for (let P = 0; P < 100; P++) {
|
|
2585
2585
|
const v = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, S = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, A = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new M(v, S, A);
|
|
2586
|
-
if (
|
|
2587
|
-
if (w.divideScalar(
|
|
2586
|
+
if (b = w.length(), b < 1e-12) break;
|
|
2587
|
+
if (w.divideScalar(b), g.distanceTo(w) < 1e-10) {
|
|
2588
2588
|
g = w;
|
|
2589
2589
|
break;
|
|
2590
2590
|
}
|
|
2591
2591
|
g = w;
|
|
2592
2592
|
}
|
|
2593
|
-
d.push(g.clone()), f.push(
|
|
2593
|
+
d.push(g.clone()), f.push(b);
|
|
2594
2594
|
for (let P = 0; P < 3; P++) for (let v = 0; v < 3; v++) {
|
|
2595
2595
|
const S = [
|
|
2596
2596
|
g.x,
|
|
@@ -2601,7 +2601,7 @@ let __tla = (async () => {
|
|
|
2601
2601
|
g.y,
|
|
2602
2602
|
g.z
|
|
2603
2603
|
][v];
|
|
2604
|
-
u[P][v] -=
|
|
2604
|
+
u[P][v] -= b * S * A;
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
2607
|
const x = new M();
|
|
@@ -2613,13 +2613,13 @@ let __tla = (async () => {
|
|
|
2613
2613
|
0
|
|
2614
2614
|
];
|
|
2615
2615
|
for (let p = 0; p < 3; p++) {
|
|
2616
|
-
let g = 1 / 0,
|
|
2616
|
+
let g = 1 / 0, b = -1 / 0;
|
|
2617
2617
|
const P = d[p];
|
|
2618
2618
|
for (let v = 0; v < t; v++) {
|
|
2619
2619
|
const S = r.getX(v) - x.x, A = r.getY(v) - x.y, w = r.getZ(v) - x.z, k = S * P.x + A * P.y + w * P.z;
|
|
2620
|
-
k < g && (g = k), k >
|
|
2620
|
+
k < g && (g = k), k > b && (b = k);
|
|
2621
2621
|
}
|
|
2622
|
-
C[p] = (
|
|
2622
|
+
C[p] = (b - g) / 2;
|
|
2623
2623
|
}
|
|
2624
2624
|
return {
|
|
2625
2625
|
axes: d,
|
|
@@ -2875,7 +2875,7 @@ let __tla = (async () => {
|
|
|
2875
2875
|
});
|
|
2876
2876
|
}
|
|
2877
2877
|
if (g.length < 5) return null;
|
|
2878
|
-
const
|
|
2878
|
+
const b = t - r, P = r + b * 0.3, v = r + b * 0.7, S = g.filter((h) => h.y >= P && h.y <= v);
|
|
2879
2879
|
if (S.length < 3) return null;
|
|
2880
2880
|
const A = S.map((h) => h.circ).sort((h, z) => h - z), w = A[Math.floor(A.length / 2)], k = Math.max(...g.map((h) => h.circ));
|
|
2881
2881
|
return {
|
|
@@ -2975,7 +2975,7 @@ let __tla = (async () => {
|
|
|
2975
2975
|
}),
|
|
2976
2976
|
i("group", {
|
|
2977
2977
|
position: l,
|
|
2978
|
-
children: i(
|
|
2978
|
+
children: i(je, {
|
|
2979
2979
|
center: true,
|
|
2980
2980
|
style: {
|
|
2981
2981
|
pointerEvents: "none"
|
|
@@ -3185,10 +3185,10 @@ let __tla = (async () => {
|
|
|
3185
3185
|
color: "#00ffff",
|
|
3186
3186
|
group: "Alignment"
|
|
3187
3187
|
}
|
|
3188
|
-
],
|
|
3188
|
+
], br = [
|
|
3189
3189
|
...new Set(Dn.map((n) => n.group))
|
|
3190
3190
|
];
|
|
3191
|
-
function
|
|
3191
|
+
function yr({ layers: n, onToggleLayer: r, isDoubleShell: t }) {
|
|
3192
3192
|
return F("div", {
|
|
3193
3193
|
style: {
|
|
3194
3194
|
position: "absolute",
|
|
@@ -3217,7 +3217,7 @@ let __tla = (async () => {
|
|
|
3217
3217
|
},
|
|
3218
3218
|
children: "Debug Layers"
|
|
3219
3219
|
}),
|
|
3220
|
-
|
|
3220
|
+
br.map((o) => {
|
|
3221
3221
|
const s = Dn.filter((l) => l.group === o && !(l.hideWhenDoubleShell && t));
|
|
3222
3222
|
return s.length === 0 ? null : F("div", {
|
|
3223
3223
|
children: [
|
|
@@ -3279,15 +3279,15 @@ let __tla = (async () => {
|
|
|
3279
3279
|
});
|
|
3280
3280
|
}
|
|
3281
3281
|
const wr = ({ config: n, spacingType: r, scanUrl: t, formMeasurements: o, onComplete: s, isDebugUser: l = false, onAnalyticsEvent: c, wasmModule: a }) => {
|
|
3282
|
-
const [e, m] = W(null), [d, f] = W(0), [u, x] = W(false), [C, p] = W(false), [g,
|
|
3282
|
+
const [e, m] = W(null), [d, f] = W(0), [u, x] = W(false), [C, p] = W(false), [g, b] = W(""), [P, v] = W("3D"), [S, A] = W(r === "AK" ? 2 : 1), [w, k] = W(false), [h, z] = W(null), [L, _] = W(r ?? null), [D, E] = W("mm"), [V, G] = W(false), [q, be] = W(""), [ae, fe] = W(false), [re, ee] = W(false), [Y, ue] = W(false), [Z, pe] = W(false), [me, he] = W(null), [H, ne] = W(null), [xe, we] = W(null), [ye, oe] = W(false), [N, X] = W([]), [Pe, ke] = W(null), [Ve, ie] = W(null), [Ae, wt] = W(null), [St, jt] = W(null), [Wn, Vt] = W(false), [vt, Nt] = W(null), [Ct, Le] = W(null), [De, Bn] = W(false), [Xt, En] = W(ir), [Te, Gt] = W("obj"), [Se, zt] = W(o), [Ye, Mt] = W(true), [Ne, tt] = W(false), [nt, Yt] = W(false), [ze, ot] = W(false), [Tn, At] = W(false), [Ze, $n] = W(null), [On, Hn] = W(void 0), [jn, Vn] = W(void 0), [Zt] = W("#c8c8c8"), [Nn] = W(1), [We, Xn] = W(false), [kt, Kt] = W([]), rt = le(null), $e = le(null), it = le(false), Gn = le(null), Ft = le(null), Pt = le(null), Ke = Q(async () => {
|
|
3283
3283
|
if (Pt.current) try {
|
|
3284
|
-
const
|
|
3285
|
-
const J =
|
|
3284
|
+
const y = Pt.current, I = () => {
|
|
3285
|
+
const J = y.querySelector("canvas");
|
|
3286
3286
|
if (!J) return;
|
|
3287
|
-
const O =
|
|
3287
|
+
const O = y.getBoundingClientRect(), ge = J.width, Ce = J.height, te = ge / O.width, Me = Ce / O.height, Re = document.createElement("canvas");
|
|
3288
3288
|
Re.width = ge, Re.height = Ce;
|
|
3289
3289
|
const se = Re.getContext("2d");
|
|
3290
|
-
return se.drawImage(J, 0, 0),
|
|
3290
|
+
return se.drawImage(J, 0, 0), y.querySelectorAll("[style*='pointer-events']").forEach((_e) => {
|
|
3291
3291
|
const nn = _e;
|
|
3292
3292
|
if (nn.hasAttribute("data-finalizing-overlay")) return;
|
|
3293
3293
|
const on = nn.querySelectorAll("div[style*='background']");
|
|
@@ -3296,7 +3296,7 @@ let __tla = (async () => {
|
|
|
3296
3296
|
const Ie = Xe.getBoundingClientRect();
|
|
3297
3297
|
if (Ie.width === 0 || Ie.height === 0) return;
|
|
3298
3298
|
let Rt = 0, qe = Xe;
|
|
3299
|
-
for (; qe && qe !==
|
|
3299
|
+
for (; qe && qe !== y; ) {
|
|
3300
3300
|
const ft = (qe.style.transform || "").match(/rotate\((-?\d+)deg\)/);
|
|
3301
3301
|
if (ft) {
|
|
3302
3302
|
Rt = parseFloat(ft[1]);
|
|
@@ -3337,11 +3337,11 @@ let __tla = (async () => {
|
|
|
3337
3337
|
} catch {
|
|
3338
3338
|
return;
|
|
3339
3339
|
}
|
|
3340
|
-
}, []), ve = Q((
|
|
3340
|
+
}, []), ve = Q((y) => {
|
|
3341
3341
|
const I = /* @__PURE__ */ new Date(), B = `${String(I.getHours()).padStart(2, "0")}:${String(I.getMinutes()).padStart(2, "0")}:${String(I.getSeconds()).padStart(2, "0")}.${String(I.getMilliseconds()).padStart(3, "0")}`;
|
|
3342
3342
|
Kt((R) => [
|
|
3343
3343
|
...R.slice(-200),
|
|
3344
|
-
`[${B}] ${
|
|
3344
|
+
`[${B}] ${y}`
|
|
3345
3345
|
]);
|
|
3346
3346
|
}, []), { landmarkPoints: T, clearLandmarkPoints: Yn, addLandmarkPoint: Ut, removeLandmarkPoint: Jt, updateLandmarkPositions: Qt, setAligned: qt, isAligned: K, setCut: en, isCut: Lt, reset: st } = Ht();
|
|
3347
3347
|
U(() => {
|
|
@@ -3352,8 +3352,8 @@ let __tla = (async () => {
|
|
|
3352
3352
|
const lt = S * gt;
|
|
3353
3353
|
U(() => {
|
|
3354
3354
|
if (!l || T.length === 0) return;
|
|
3355
|
-
const
|
|
3356
|
-
ve(`LANDMARK[${T.length - 1}]: placed at (${
|
|
3355
|
+
const y = T[T.length - 1];
|
|
3356
|
+
ve(`LANDMARK[${T.length - 1}]: placed at (${y.position.x.toFixed(1)}, ${y.position.y.toFixed(1)}, ${y.position.z.toFixed(1)}) face=${y.faceIndex}`);
|
|
3357
3357
|
}, [
|
|
3358
3358
|
T.length,
|
|
3359
3359
|
l,
|
|
@@ -3375,7 +3375,7 @@ let __tla = (async () => {
|
|
|
3375
3375
|
}, [
|
|
3376
3376
|
kt
|
|
3377
3377
|
]);
|
|
3378
|
-
const
|
|
3378
|
+
const Oe = j(() => xe ? new $.Mesh(xe) : null, [
|
|
3379
3379
|
xe
|
|
3380
3380
|
]);
|
|
3381
3381
|
U(() => {
|
|
@@ -3391,7 +3391,7 @@ let __tla = (async () => {
|
|
|
3391
3391
|
U(() => {
|
|
3392
3392
|
if (!K || N.length === 0 || at.current || !c) return;
|
|
3393
3393
|
at.current = true;
|
|
3394
|
-
const
|
|
3394
|
+
const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
|
|
3395
3395
|
c("dimensions_calculated", {
|
|
3396
3396
|
spacing_type: L,
|
|
3397
3397
|
source_unit: "mm",
|
|
@@ -3405,59 +3405,59 @@ let __tla = (async () => {
|
|
|
3405
3405
|
const R = Se[B];
|
|
3406
3406
|
return R == null ? null : +((I.modifiedValue ?? I.originalValue) - R).toFixed(1);
|
|
3407
3407
|
}) : null,
|
|
3408
|
-
frontal_height:
|
|
3408
|
+
frontal_height: y !== null ? +y.toFixed(1) : null
|
|
3409
3409
|
});
|
|
3410
3410
|
}, [
|
|
3411
3411
|
K,
|
|
3412
3412
|
N
|
|
3413
3413
|
]), U(() => {
|
|
3414
|
-
a !== void 0 && (
|
|
3414
|
+
a !== void 0 && ($e.current = a), a !== void 0 && Xn(true);
|
|
3415
3415
|
}, [
|
|
3416
3416
|
a
|
|
3417
3417
|
]);
|
|
3418
|
-
const Ue = Q((
|
|
3419
|
-
|
|
3420
|
-
const B =
|
|
3421
|
-
B.getCenter(R),
|
|
3422
|
-
const J =
|
|
3418
|
+
const Ue = Q((y, I) => {
|
|
3419
|
+
y.computeBoundingBox();
|
|
3420
|
+
const B = y.boundingBox, R = new M();
|
|
3421
|
+
B.getCenter(R), y.translate(-R.x, -R.y, -R.z), y.computeBoundingBox();
|
|
3422
|
+
const J = y.boundingBox, O = new M();
|
|
3423
3423
|
J.getSize(O), f(Math.max(O.x, O.y, O.z));
|
|
3424
|
-
const ge = new $.Mesh(
|
|
3424
|
+
const ge = new $.Mesh(y, new $.MeshStandardMaterial({
|
|
3425
3425
|
color: 8947848,
|
|
3426
3426
|
side: $.DoubleSide
|
|
3427
3427
|
}));
|
|
3428
3428
|
m(ge), fe(I), ee(true), pe(false), it.current = false;
|
|
3429
|
-
}, []), Be = Q(async (
|
|
3429
|
+
}, []), Be = Q(async (y, I) => {
|
|
3430
3430
|
Le(null);
|
|
3431
3431
|
const B = I.toLowerCase(), R = B.endsWith(".stl");
|
|
3432
3432
|
if (!B.endsWith(".obj") && !R) {
|
|
3433
3433
|
Le("Unsupported file format. Please use OBJ or STL.");
|
|
3434
3434
|
return;
|
|
3435
3435
|
}
|
|
3436
|
-
Gt(R ? "stl" : "obj"), p(true),
|
|
3436
|
+
Gt(R ? "stl" : "obj"), p(true), b("Processing file..."), ve(`FILE_LOAD: ${I} (${R ? "STL" : "OBJ"})`);
|
|
3437
3437
|
try {
|
|
3438
3438
|
let O;
|
|
3439
|
-
if (R) if (
|
|
3439
|
+
if (R) if (b("Converting STL..."), y instanceof ArrayBuffer) {
|
|
3440
3440
|
const te = new Blob([
|
|
3441
|
-
|
|
3441
|
+
y
|
|
3442
3442
|
]), Me = new File([
|
|
3443
3443
|
te
|
|
3444
3444
|
], I);
|
|
3445
3445
|
O = await Et(Me);
|
|
3446
3446
|
} else {
|
|
3447
3447
|
const te = new Blob([
|
|
3448
|
-
|
|
3448
|
+
y
|
|
3449
3449
|
]), Me = new File([
|
|
3450
3450
|
te
|
|
3451
3451
|
], I);
|
|
3452
3452
|
O = await Et(Me);
|
|
3453
3453
|
}
|
|
3454
|
-
else O = typeof
|
|
3455
|
-
const ge = performance.now(), Ce =
|
|
3456
|
-
|
|
3454
|
+
else O = typeof y == "string" ? y : new TextDecoder().decode(y);
|
|
3455
|
+
const ge = performance.now(), Ce = $e.current ? await Mo(O, $e.current, (te) => {
|
|
3456
|
+
b(te), ve(`PREPROCESS: ${te}`);
|
|
3457
3457
|
}) : null;
|
|
3458
3458
|
if (Ce) ve(`PREPROCESS: done in ${(performance.now() - ge).toFixed(0)}ms \u2014 unit=${Ce.detectedUnit}, scaled=${Ce.wasScaled}`), n.showAmputationModal && !r ? (z(Ce), k(true)) : Ue(Ce.geometry, Ce.wasScaled);
|
|
3459
3459
|
else {
|
|
3460
|
-
|
|
3460
|
+
b("Using fallback loader...");
|
|
3461
3461
|
const te = Ao(O);
|
|
3462
3462
|
te ? n.showAmputationModal && !r ? (z({
|
|
3463
3463
|
geometry: te,
|
|
@@ -3467,7 +3467,7 @@ let __tla = (async () => {
|
|
|
3467
3467
|
} catch (O) {
|
|
3468
3468
|
Le(O instanceof Error ? O.message : "Failed to process the mesh file.");
|
|
3469
3469
|
} finally {
|
|
3470
|
-
p(false),
|
|
3470
|
+
p(false), b("");
|
|
3471
3471
|
}
|
|
3472
3472
|
}, [
|
|
3473
3473
|
We,
|
|
@@ -3478,7 +3478,7 @@ let __tla = (async () => {
|
|
|
3478
3478
|
U(() => {
|
|
3479
3479
|
if (!t || !We) return;
|
|
3480
3480
|
(async () => {
|
|
3481
|
-
p(true),
|
|
3481
|
+
p(true), b("Loading scan...");
|
|
3482
3482
|
try {
|
|
3483
3483
|
const I = await fetch(t);
|
|
3484
3484
|
if (!I.ok) throw new Error(`Failed to download scan: ${I.status}`);
|
|
@@ -3491,23 +3491,23 @@ let __tla = (async () => {
|
|
|
3491
3491
|
await Be(O, R);
|
|
3492
3492
|
}
|
|
3493
3493
|
} catch (I) {
|
|
3494
|
-
Le(I instanceof Error ? I.message : "Failed to load scan from URL."), p(false),
|
|
3494
|
+
Le(I instanceof Error ? I.message : "Failed to load scan from URL."), p(false), b("");
|
|
3495
3495
|
}
|
|
3496
3496
|
})();
|
|
3497
3497
|
}, [
|
|
3498
3498
|
t,
|
|
3499
3499
|
We
|
|
3500
3500
|
]);
|
|
3501
|
-
const Zn = Q((
|
|
3502
|
-
|
|
3503
|
-
}, []), Kn = Q((
|
|
3504
|
-
|
|
3505
|
-
}, []), Un = Q(async (
|
|
3506
|
-
if (
|
|
3501
|
+
const Zn = Q((y) => {
|
|
3502
|
+
y.preventDefault(), x(true);
|
|
3503
|
+
}, []), Kn = Q((y) => {
|
|
3504
|
+
y.preventDefault(), x(false);
|
|
3505
|
+
}, []), Un = Q(async (y) => {
|
|
3506
|
+
if (y.preventDefault(), x(false), !We) {
|
|
3507
3507
|
Le("WASM module is still loading. Please wait.");
|
|
3508
3508
|
return;
|
|
3509
3509
|
}
|
|
3510
|
-
const I =
|
|
3510
|
+
const I = y.dataTransfer.files[0];
|
|
3511
3511
|
if (!I) return;
|
|
3512
3512
|
const B = I.name.toLowerCase();
|
|
3513
3513
|
if (!B.endsWith(".obj") && !B.endsWith(".stl")) {
|
|
@@ -3515,12 +3515,12 @@ let __tla = (async () => {
|
|
|
3515
3515
|
return;
|
|
3516
3516
|
}
|
|
3517
3517
|
if (B.endsWith(".stl")) {
|
|
3518
|
-
Gt("stl"), p(true),
|
|
3518
|
+
Gt("stl"), p(true), b("Converting STL...");
|
|
3519
3519
|
try {
|
|
3520
3520
|
const R = await Et(I);
|
|
3521
3521
|
await Be(R, I.name.replace(/\.stl$/i, ".obj"));
|
|
3522
3522
|
} catch (R) {
|
|
3523
|
-
Le(R instanceof Error ? R.message : "Failed to process STL file."), p(false),
|
|
3523
|
+
Le(R instanceof Error ? R.message : "Failed to process STL file."), p(false), b("");
|
|
3524
3524
|
}
|
|
3525
3525
|
} else {
|
|
3526
3526
|
const R = await I.text();
|
|
@@ -3529,9 +3529,9 @@ let __tla = (async () => {
|
|
|
3529
3529
|
}, [
|
|
3530
3530
|
We,
|
|
3531
3531
|
Be
|
|
3532
|
-
]), Jn = Q((
|
|
3533
|
-
_(
|
|
3534
|
-
spacing_type:
|
|
3532
|
+
]), Jn = Q((y) => {
|
|
3533
|
+
_(y), A(y === "AK" ? 2 : 1), k(false), h && (Ue(h.geometry, h.wasScaled), z(null)), c == null ? void 0 : c("file_loaded", {
|
|
3534
|
+
spacing_type: y,
|
|
3535
3535
|
file_format: Te,
|
|
3536
3536
|
is_double_wall: false
|
|
3537
3537
|
});
|
|
@@ -3542,12 +3542,12 @@ let __tla = (async () => {
|
|
|
3542
3542
|
Te
|
|
3543
3543
|
]);
|
|
3544
3544
|
U(() => {
|
|
3545
|
-
if (!e || T.length !== 1 ||
|
|
3545
|
+
if (!e || T.length !== 1 || !$e.current || it.current) return;
|
|
3546
3546
|
it.current = true;
|
|
3547
|
-
const
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3547
|
+
const y = T[0], I = $e.current, B = e.geometry, { positions: R, indices: J } = mt(B), O = new Float32Array([
|
|
3548
|
+
y.position.x,
|
|
3549
|
+
y.position.y,
|
|
3550
|
+
y.position.z
|
|
3551
3551
|
]), ge = I.detect_shell(R, J, O, 40), Ce = ge.details(), te = ge.is_double_shell();
|
|
3552
3552
|
ve(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${Ce}`), te && (ue(true), oe(true), ve(`SHELL_DETECT: double shell, thickness=${ge.thickness().toFixed(1)}mm`));
|
|
3553
3553
|
}, [
|
|
@@ -3557,8 +3557,8 @@ let __tla = (async () => {
|
|
|
3557
3557
|
]);
|
|
3558
3558
|
const Qn = Q(() => {
|
|
3559
3559
|
if (!e || T.length < 2) return;
|
|
3560
|
-
G(true),
|
|
3561
|
-
const
|
|
3560
|
+
G(true), be("Please wait..."), ve("PIPELINE: starting processing pipeline...");
|
|
3561
|
+
const y = performance.now();
|
|
3562
3562
|
setTimeout(() => {
|
|
3563
3563
|
const I = [
|
|
3564
3564
|
T[1],
|
|
@@ -3567,7 +3567,7 @@ let __tla = (async () => {
|
|
|
3567
3567
|
];
|
|
3568
3568
|
_o(e, I, gt, {
|
|
3569
3569
|
onStatus: (B) => {
|
|
3570
|
-
|
|
3570
|
+
be(B), ve(`PIPELINE: ${B}`);
|
|
3571
3571
|
},
|
|
3572
3572
|
addLandmarkPoint: Ut,
|
|
3573
3573
|
removeLandmarkPoint: Jt,
|
|
@@ -3595,8 +3595,8 @@ let __tla = (async () => {
|
|
|
3595
3595
|
setInnerShellExtracted: pe,
|
|
3596
3596
|
setMeasurementGeometry: we,
|
|
3597
3597
|
setWasmSlices: ke,
|
|
3598
|
-
wasmModule:
|
|
3599
|
-
}), ve(`PIPELINE: completed in ${(performance.now() -
|
|
3598
|
+
wasmModule: $e.current ?? void 0
|
|
3599
|
+
}), ve(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), at.current = false, G(false);
|
|
3600
3600
|
}, 50);
|
|
3601
3601
|
}, [
|
|
3602
3602
|
e,
|
|
@@ -3611,12 +3611,12 @@ let __tla = (async () => {
|
|
|
3611
3611
|
if (st(), X([]), ke(null), we(null), ie(null), wt(null), Nt(null), jt(null), tt(false), Yt(false), Mt(true), ue(false), pe(false), it.current = false, _t.current = false, at.current = false, v("3D"), t && We) {
|
|
3612
3612
|
m(null);
|
|
3613
3613
|
try {
|
|
3614
|
-
const
|
|
3615
|
-
if (!
|
|
3614
|
+
const y = await fetch(t);
|
|
3615
|
+
if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
|
|
3616
3616
|
const B = new URL(t).pathname.split("/").pop() || "scan.obj";
|
|
3617
|
-
B.toLowerCase().endsWith(".stl") ? await Be(await
|
|
3618
|
-
} catch (
|
|
3619
|
-
Le(
|
|
3617
|
+
B.toLowerCase().endsWith(".stl") ? await Be(await y.arrayBuffer(), B) : await Be(await y.text(), B);
|
|
3618
|
+
} catch (y) {
|
|
3619
|
+
Le(y instanceof Error ? y.message : "Failed to reload scan.");
|
|
3620
3620
|
}
|
|
3621
3621
|
}
|
|
3622
3622
|
}, [
|
|
@@ -3635,17 +3635,17 @@ let __tla = (async () => {
|
|
|
3635
3635
|
var _a;
|
|
3636
3636
|
if (!e || T.length < 3) return 0;
|
|
3637
3637
|
if (Y) return Math.abs(T[0].position.y - T[2].position.y);
|
|
3638
|
-
const
|
|
3639
|
-
|
|
3640
|
-
const I = ((_a =
|
|
3638
|
+
const y = e.geometry;
|
|
3639
|
+
y.computeBoundingBox();
|
|
3640
|
+
const I = ((_a = y.boundingBox) == null ? void 0 : _a.min.y) ?? 0;
|
|
3641
3641
|
return Math.abs(T[0].position.y - I);
|
|
3642
3642
|
}, [
|
|
3643
3643
|
e,
|
|
3644
3644
|
T,
|
|
3645
3645
|
Y
|
|
3646
|
-
]), eo = Q((
|
|
3647
|
-
$n(
|
|
3648
|
-
}, []), tn = Q(async (
|
|
3646
|
+
]), eo = Q((y) => {
|
|
3647
|
+
$n(y), zt(y.circumferences), Mt(true), Yt(true);
|
|
3648
|
+
}, []), tn = Q(async (y) => {
|
|
3649
3649
|
if (!s) return;
|
|
3650
3650
|
tt(false), At(false), ot(true);
|
|
3651
3651
|
const I = e ? await Ke().catch(() => {
|
|
@@ -3665,7 +3665,7 @@ let __tla = (async () => {
|
|
|
3665
3665
|
transverseAP: 0,
|
|
3666
3666
|
scanUrl: t,
|
|
3667
3667
|
decision: "skip",
|
|
3668
|
-
skipReason:
|
|
3668
|
+
skipReason: y,
|
|
3669
3669
|
screenshots: I,
|
|
3670
3670
|
alignedGeometry: e == null ? void 0 : e.geometry
|
|
3671
3671
|
});
|
|
@@ -3689,14 +3689,14 @@ let __tla = (async () => {
|
|
|
3689
3689
|
It.current = null;
|
|
3690
3690
|
return;
|
|
3691
3691
|
}
|
|
3692
|
-
const
|
|
3693
|
-
It.current = Ot(
|
|
3692
|
+
const y = (Oe ?? e).geometry;
|
|
3693
|
+
It.current = Ot(y);
|
|
3694
3694
|
}, [
|
|
3695
3695
|
e,
|
|
3696
3696
|
K,
|
|
3697
|
-
|
|
3697
|
+
Oe
|
|
3698
3698
|
]);
|
|
3699
|
-
const Dt = Q(async (
|
|
3699
|
+
const Dt = Q(async (y) => {
|
|
3700
3700
|
if (!s || !e || N.length === 0 || !L) return;
|
|
3701
3701
|
ot(true);
|
|
3702
3702
|
const I = await Ke().catch(() => {
|
|
@@ -3704,9 +3704,9 @@ let __tla = (async () => {
|
|
|
3704
3704
|
try {
|
|
3705
3705
|
let B = 0, R = 0;
|
|
3706
3706
|
if (T.length >= 2) {
|
|
3707
|
-
const J = (
|
|
3707
|
+
const J = (Oe ?? e).geometry, ge = T[0].position.y;
|
|
3708
3708
|
try {
|
|
3709
|
-
const Ce = It.current ?? Ot(J), te =
|
|
3709
|
+
const Ce = It.current ?? Ot(J), te = He(Ce, J, ge);
|
|
3710
3710
|
if (te.linePoints.length >= 2) {
|
|
3711
3711
|
let Me = te.linePoints[0], Re = te.linePoints[0], se = te.linePoints[0], Qe = te.linePoints[0];
|
|
3712
3712
|
for (const _e of te.linePoints) _e.x < Me.x && (Me = _e), _e.x > Re.x && (Re = _e), _e.z < se.z && (se = _e), _e.z > Qe.z && (Qe = _e);
|
|
@@ -3719,7 +3719,7 @@ let __tla = (async () => {
|
|
|
3719
3719
|
spacingType: L,
|
|
3720
3720
|
sourceUnit: "mm",
|
|
3721
3721
|
fileFormat: Te,
|
|
3722
|
-
measurementSource:
|
|
3722
|
+
measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
|
|
3723
3723
|
isDoubleWall: Y,
|
|
3724
3724
|
isUnitConverted: false,
|
|
3725
3725
|
formMeasurements: Se,
|
|
@@ -3728,10 +3728,10 @@ let __tla = (async () => {
|
|
|
3728
3728
|
transverseML: B,
|
|
3729
3729
|
transverseAP: R,
|
|
3730
3730
|
scanUrl: t,
|
|
3731
|
-
decision:
|
|
3731
|
+
decision: y,
|
|
3732
3732
|
userEnteredMeasurements: Ze ?? void 0,
|
|
3733
3733
|
screenshots: I,
|
|
3734
|
-
alignedGeometry: (
|
|
3734
|
+
alignedGeometry: (Oe ?? e).geometry
|
|
3735
3735
|
});
|
|
3736
3736
|
} finally {
|
|
3737
3737
|
ot(false);
|
|
@@ -3739,7 +3739,7 @@ let __tla = (async () => {
|
|
|
3739
3739
|
}, [
|
|
3740
3740
|
s,
|
|
3741
3741
|
e,
|
|
3742
|
-
|
|
3742
|
+
Oe,
|
|
3743
3743
|
N,
|
|
3744
3744
|
L,
|
|
3745
3745
|
T,
|
|
@@ -3752,9 +3752,9 @@ let __tla = (async () => {
|
|
|
3752
3752
|
Ke
|
|
3753
3753
|
]), to = j(() => {
|
|
3754
3754
|
if (!Se || N.length === 0) return false;
|
|
3755
|
-
const
|
|
3756
|
-
if (
|
|
3757
|
-
for (let I = 0; I <
|
|
3755
|
+
const y = Math.min(Se.length, N.length);
|
|
3756
|
+
if (y === 0) return false;
|
|
3757
|
+
for (let I = 0; I < y; I++) {
|
|
3758
3758
|
const B = Se[I], R = N[I];
|
|
3759
3759
|
if (!R || B == null || B === 0) continue;
|
|
3760
3760
|
const J = R.modifiedValue ?? R.originalValue;
|
|
@@ -3764,7 +3764,7 @@ let __tla = (async () => {
|
|
|
3764
3764
|
}, [
|
|
3765
3765
|
Se,
|
|
3766
3766
|
N
|
|
3767
|
-
]), no = nt ? 5 : K &&
|
|
3767
|
+
]), no = nt ? 5 : K && Ne || K ? 4 : e ? T.length === 0 ? 2 : 3 : 1, oo = [
|
|
3768
3768
|
{
|
|
3769
3769
|
label: "Load File",
|
|
3770
3770
|
number: 1
|
|
@@ -3838,7 +3838,7 @@ let __tla = (async () => {
|
|
|
3838
3838
|
minHeight: 0
|
|
3839
3839
|
},
|
|
3840
3840
|
children: [
|
|
3841
|
-
K &&
|
|
3841
|
+
K && Ne && L && i("div", {
|
|
3842
3842
|
style: {
|
|
3843
3843
|
width: 340,
|
|
3844
3844
|
flexShrink: 0,
|
|
@@ -4081,8 +4081,8 @@ let __tla = (async () => {
|
|
|
4081
4081
|
children: [
|
|
4082
4082
|
"AK",
|
|
4083
4083
|
"BK"
|
|
4084
|
-
].map((
|
|
4085
|
-
onClick: () => _(
|
|
4084
|
+
].map((y) => F("label", {
|
|
4085
|
+
onClick: () => _(y),
|
|
4086
4086
|
style: {
|
|
4087
4087
|
flex: 1,
|
|
4088
4088
|
display: "flex",
|
|
@@ -4091,16 +4091,16 @@ let __tla = (async () => {
|
|
|
4091
4091
|
border: "2px solid",
|
|
4092
4092
|
borderRadius: 4,
|
|
4093
4093
|
cursor: "pointer",
|
|
4094
|
-
borderColor: L ===
|
|
4095
|
-
backgroundColor: L ===
|
|
4094
|
+
borderColor: L === y ? "rgb(12, 67, 173)" : "#e0e0e0",
|
|
4095
|
+
backgroundColor: L === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
|
|
4096
4096
|
transition: "border-color 0.15s, background-color 0.15s"
|
|
4097
4097
|
},
|
|
4098
4098
|
children: [
|
|
4099
4099
|
i("input", {
|
|
4100
4100
|
type: "radio",
|
|
4101
4101
|
name: "ampType",
|
|
4102
|
-
checked: L ===
|
|
4103
|
-
onChange: () => _(
|
|
4102
|
+
checked: L === y,
|
|
4103
|
+
onChange: () => _(y),
|
|
4104
4104
|
style: {
|
|
4105
4105
|
accentColor: "rgb(12, 67, 173)",
|
|
4106
4106
|
marginBottom: 12,
|
|
@@ -4115,7 +4115,7 @@ let __tla = (async () => {
|
|
|
4115
4115
|
color: "rgba(0,0,0,0.87)",
|
|
4116
4116
|
marginBottom: 4
|
|
4117
4117
|
},
|
|
4118
|
-
children:
|
|
4118
|
+
children: y
|
|
4119
4119
|
}),
|
|
4120
4120
|
F("span", {
|
|
4121
4121
|
style: {
|
|
@@ -4123,12 +4123,12 @@ let __tla = (async () => {
|
|
|
4123
4123
|
color: "rgba(0,0,0,0.54)"
|
|
4124
4124
|
},
|
|
4125
4125
|
children: [
|
|
4126
|
-
|
|
4126
|
+
y === "AK" ? "2" : "1",
|
|
4127
4127
|
"-inch measurement spacing"
|
|
4128
4128
|
]
|
|
4129
4129
|
})
|
|
4130
4130
|
]
|
|
4131
|
-
},
|
|
4131
|
+
}, y))
|
|
4132
4132
|
})
|
|
4133
4133
|
]
|
|
4134
4134
|
}),
|
|
@@ -4278,9 +4278,9 @@ let __tla = (async () => {
|
|
|
4278
4278
|
e && K && T.length >= 3 && (() => {
|
|
4279
4279
|
const I = e.geometry.getIndex();
|
|
4280
4280
|
if (!I || I.count < 30) return null;
|
|
4281
|
-
const B = T[2], R = T[0], J =
|
|
4281
|
+
const B = T[2], R = T[0], J = Ve ?? B.position.y, O = Ae ?? St ?? R.position.y;
|
|
4282
4282
|
return P === "2D" ? i(Jo, {
|
|
4283
|
-
mesh:
|
|
4283
|
+
mesh: Oe ?? e,
|
|
4284
4284
|
upperY: O,
|
|
4285
4285
|
originY: R.position.y,
|
|
4286
4286
|
modelSize: d,
|
|
@@ -4289,7 +4289,7 @@ let __tla = (async () => {
|
|
|
4289
4289
|
}) : F(Ee, {
|
|
4290
4290
|
children: [
|
|
4291
4291
|
i(Vo, {
|
|
4292
|
-
mesh:
|
|
4292
|
+
mesh: Oe ?? e,
|
|
4293
4293
|
startY: J,
|
|
4294
4294
|
endY: O,
|
|
4295
4295
|
spacing: lt,
|
|
@@ -4298,7 +4298,7 @@ let __tla = (async () => {
|
|
|
4298
4298
|
reverseOrder: true,
|
|
4299
4299
|
displayUnit: D,
|
|
4300
4300
|
useInnerSurface: Y && !Z,
|
|
4301
|
-
formMeasurements:
|
|
4301
|
+
formMeasurements: Ne ? On ?? Se : Ye ? Se : void 0,
|
|
4302
4302
|
originY: vt ?? R.position.y,
|
|
4303
4303
|
wasmSlices: Pe
|
|
4304
4304
|
}),
|
|
@@ -4308,7 +4308,7 @@ let __tla = (async () => {
|
|
|
4308
4308
|
modelSize: d,
|
|
4309
4309
|
displayUnit: D,
|
|
4310
4310
|
bottomY: Y ? B.position.y : void 0,
|
|
4311
|
-
formHeight:
|
|
4311
|
+
formHeight: Ne ? jn : Ye ? Ze == null ? void 0 : Ze.frontalHeight : void 0
|
|
4312
4312
|
}),
|
|
4313
4313
|
i(Qo, {
|
|
4314
4314
|
mesh: e,
|
|
@@ -4416,11 +4416,11 @@ let __tla = (async () => {
|
|
|
4416
4416
|
})
|
|
4417
4417
|
]
|
|
4418
4418
|
}),
|
|
4419
|
-
n.showDebug && De && e && P === "3D" && i(
|
|
4419
|
+
n.showDebug && De && e && P === "3D" && i(yr, {
|
|
4420
4420
|
layers: Xt,
|
|
4421
|
-
onToggleLayer: (
|
|
4421
|
+
onToggleLayer: (y) => En((I) => ({
|
|
4422
4422
|
...I,
|
|
4423
|
-
[
|
|
4423
|
+
[y]: !I[y]
|
|
4424
4424
|
})),
|
|
4425
4425
|
isDoubleShell: Y
|
|
4426
4426
|
}),
|
|
@@ -4563,7 +4563,7 @@ let __tla = (async () => {
|
|
|
4563
4563
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
4564
4564
|
},
|
|
4565
4565
|
children: i("button", {
|
|
4566
|
-
onClick: () => Mt((
|
|
4566
|
+
onClick: () => Mt((y) => !y),
|
|
4567
4567
|
style: {
|
|
4568
4568
|
padding: "6px 14px",
|
|
4569
4569
|
fontSize: 13,
|
|
@@ -4587,13 +4587,13 @@ let __tla = (async () => {
|
|
|
4587
4587
|
},
|
|
4588
4588
|
children: i("button", {
|
|
4589
4589
|
onClick: async () => {
|
|
4590
|
-
const
|
|
4591
|
-
if (!
|
|
4590
|
+
const y = await Ke();
|
|
4591
|
+
if (!y) return;
|
|
4592
4592
|
const I = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), B = (R, J) => {
|
|
4593
4593
|
const O = document.createElement("a");
|
|
4594
4594
|
O.href = R, O.download = J, O.click();
|
|
4595
4595
|
};
|
|
4596
|
-
B(
|
|
4596
|
+
B(y.frontal_view_png, `measurements_front_${I}.png`), await new Promise((R) => setTimeout(R, 300)), B(y.side_view_png, `measurements_transverse_${I}.png`);
|
|
4597
4597
|
},
|
|
4598
4598
|
style: {
|
|
4599
4599
|
padding: "6px 14px",
|
|
@@ -4617,7 +4617,7 @@ let __tla = (async () => {
|
|
|
4617
4617
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
4618
4618
|
},
|
|
4619
4619
|
children: i("button", {
|
|
4620
|
-
onClick: () => Bn((
|
|
4620
|
+
onClick: () => Bn((y) => !y),
|
|
4621
4621
|
style: {
|
|
4622
4622
|
padding: "6px 14px",
|
|
4623
4623
|
fontSize: 13,
|
|
@@ -4637,9 +4637,31 @@ let __tla = (async () => {
|
|
|
4637
4637
|
wasAutoScaled: ae,
|
|
4638
4638
|
onDismiss: () => ee(false)
|
|
4639
4639
|
}),
|
|
4640
|
-
e &&
|
|
4640
|
+
e && ye && K && i(Ko, {
|
|
4641
4641
|
isDoubleShell: Y,
|
|
4642
4642
|
onDismiss: () => oe(false)
|
|
4643
|
+
}),
|
|
4644
|
+
!Ne && s && i("button", {
|
|
4645
|
+
disabled: ze,
|
|
4646
|
+
onClick: () => At(true),
|
|
4647
|
+
style: {
|
|
4648
|
+
position: "absolute",
|
|
4649
|
+
bottom: 60,
|
|
4650
|
+
left: 16,
|
|
4651
|
+
zIndex: 10,
|
|
4652
|
+
padding: "6px 16px",
|
|
4653
|
+
borderRadius: 4,
|
|
4654
|
+
fontSize: 13,
|
|
4655
|
+
fontWeight: 500,
|
|
4656
|
+
backgroundColor: "#fff",
|
|
4657
|
+
border: "1px solid #bdbdbd",
|
|
4658
|
+
color: ze ? "#999" : "#666",
|
|
4659
|
+
cursor: ze ? "not-allowed" : "pointer",
|
|
4660
|
+
fontFamily: "system-ui, sans-serif",
|
|
4661
|
+
letterSpacing: "0.4px",
|
|
4662
|
+
lineHeight: "36px"
|
|
4663
|
+
},
|
|
4664
|
+
children: "Have Galileo Check My Measurements"
|
|
4643
4665
|
})
|
|
4644
4666
|
]
|
|
4645
4667
|
})
|
|
@@ -4688,31 +4710,13 @@ let __tla = (async () => {
|
|
|
4688
4710
|
backgroundColor: "#fff",
|
|
4689
4711
|
borderTop: "1px solid #e0e0e0",
|
|
4690
4712
|
display: "flex",
|
|
4691
|
-
alignItems: "
|
|
4713
|
+
alignItems: "flex-start",
|
|
4692
4714
|
justifyContent: "space-between",
|
|
4693
4715
|
gap: 8,
|
|
4694
4716
|
flexShrink: 0
|
|
4695
4717
|
},
|
|
4696
4718
|
children: [
|
|
4697
|
-
|
|
4698
|
-
disabled: ze,
|
|
4699
|
-
onClick: () => At(true),
|
|
4700
|
-
style: {
|
|
4701
|
-
padding: "6px 16px",
|
|
4702
|
-
borderRadius: 4,
|
|
4703
|
-
fontSize: 13,
|
|
4704
|
-
fontWeight: 500,
|
|
4705
|
-
backgroundColor: "#fff",
|
|
4706
|
-
border: "1px solid #bdbdbd",
|
|
4707
|
-
color: ze ? "#999" : "#666",
|
|
4708
|
-
cursor: ze ? "not-allowed" : "pointer",
|
|
4709
|
-
fontFamily: "system-ui, sans-serif",
|
|
4710
|
-
letterSpacing: "0.4px",
|
|
4711
|
-
lineHeight: "36px"
|
|
4712
|
-
},
|
|
4713
|
-
children: "Have Galileo Check My Measurements"
|
|
4714
|
-
}),
|
|
4715
|
-
$e && i("div", {}),
|
|
4719
|
+
i("div", {}),
|
|
4716
4720
|
F("div", {
|
|
4717
4721
|
style: {
|
|
4718
4722
|
display: "flex",
|
|
@@ -4736,7 +4740,7 @@ let __tla = (async () => {
|
|
|
4736
4740
|
},
|
|
4737
4741
|
children: "Next \xBB"
|
|
4738
4742
|
}),
|
|
4739
|
-
K && nt &&
|
|
4743
|
+
K && nt && !Ne && i("button", {
|
|
4740
4744
|
onClick: () => tt(true),
|
|
4741
4745
|
style: {
|
|
4742
4746
|
padding: "6px 16px",
|
|
@@ -4863,7 +4867,7 @@ let __tla = (async () => {
|
|
|
4863
4867
|
},
|
|
4864
4868
|
children: [
|
|
4865
4869
|
"WASM ",
|
|
4866
|
-
|
|
4870
|
+
$e.current ? "v2" : "N/A",
|
|
4867
4871
|
" | ",
|
|
4868
4872
|
T.length,
|
|
4869
4873
|
" pts | ",
|
|
@@ -4898,14 +4902,14 @@ let __tla = (async () => {
|
|
|
4898
4902
|
padding: "4px 10px",
|
|
4899
4903
|
lineHeight: 1.6
|
|
4900
4904
|
},
|
|
4901
|
-
children: kt.map((
|
|
4902
|
-
const B =
|
|
4905
|
+
children: kt.map((y, I) => {
|
|
4906
|
+
const B = y.includes("ERROR") || y.includes("failed"), R = y.includes("warning") || y.includes("WARN"), J = y.includes("PIPELINE:"), O = y.includes("STATE:");
|
|
4903
4907
|
return i("div", {
|
|
4904
4908
|
style: {
|
|
4905
4909
|
color: B ? "#f85149" : R ? "#d29922" : J ? "#58a6ff" : O ? "#3fb950" : "#8b949e",
|
|
4906
4910
|
whiteSpace: "pre"
|
|
4907
4911
|
},
|
|
4908
|
-
children:
|
|
4912
|
+
children: y
|
|
4909
4913
|
}, I);
|
|
4910
4914
|
})
|
|
4911
4915
|
})
|
|
@@ -5061,8 +5065,8 @@ let __tla = (async () => {
|
|
|
5061
5065
|
u = ht(v, n.spacing_type);
|
|
5062
5066
|
}
|
|
5063
5067
|
const x = e.userEnteredMeasurements ? ht(e.userEnteredMeasurements.circumferences, n.spacing_type) : void 0, C = e.decision === "use_scan" || e.decision === "continue", p = C ? d : x ?? f ?? d, g = C ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1);
|
|
5064
|
-
let
|
|
5065
|
-
if (n.upload_url) if (!e.alignedGeometry)
|
|
5068
|
+
let b;
|
|
5069
|
+
if (n.upload_url) if (!e.alignedGeometry) b = {
|
|
5066
5070
|
success: false,
|
|
5067
5071
|
url: n.upload_url,
|
|
5068
5072
|
message: "No aligned geometry available \u2014 mesh processing may not have completed."
|
|
@@ -5071,13 +5075,13 @@ let __tla = (async () => {
|
|
|
5071
5075
|
const v = Cr(e.alignedGeometry), S = new Blob([
|
|
5072
5076
|
v
|
|
5073
5077
|
]), A = await zr(n.upload_url, S);
|
|
5074
|
-
|
|
5078
|
+
b = {
|
|
5075
5079
|
...A,
|
|
5076
5080
|
url: n.upload_url,
|
|
5077
5081
|
message: A.success ? "Cleaned mesh uploaded successfully." : `Upload failed: ${A.error ?? "unknown error"}`
|
|
5078
5082
|
};
|
|
5079
5083
|
} catch (v) {
|
|
5080
|
-
|
|
5084
|
+
b = {
|
|
5081
5085
|
success: false,
|
|
5082
5086
|
url: n.upload_url,
|
|
5083
5087
|
message: `Upload failed: ${v instanceof Error ? v.message : String(v)}`,
|
|
@@ -5107,7 +5111,7 @@ let __tla = (async () => {
|
|
|
5107
5111
|
final_transverse_ml: +e.transverseML.toFixed(1),
|
|
5108
5112
|
final_transverse_ap: +e.transverseAP.toFixed(1),
|
|
5109
5113
|
screenshots: e.screenshots,
|
|
5110
|
-
upload:
|
|
5114
|
+
upload: b
|
|
5111
5115
|
};
|
|
5112
5116
|
r == null ? void 0 : r(P);
|
|
5113
5117
|
};
|
|
@@ -5118,7 +5122,7 @@ let __tla = (async () => {
|
|
|
5118
5122
|
display: "flex"
|
|
5119
5123
|
},
|
|
5120
5124
|
children: i(wr, {
|
|
5121
|
-
config:
|
|
5125
|
+
config: yo,
|
|
5122
5126
|
spacingType: n.spacing_type,
|
|
5123
5127
|
scanUrl: n.scan_url,
|
|
5124
5128
|
formMeasurements: c,
|