@solid-labs/fab-one-widget 1.0.7 → 1.0.9
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.
|
@@ -3,12 +3,12 @@ import { createContext as io, Component as so, useCallback as Q, useMemo as H, u
|
|
|
3
3
|
import { useFrame as xn, useThree as bn, Canvas as co } from "@react-three/fiber";
|
|
4
4
|
import { Html as Ze, Line as de, OrbitControls as yn } from "@react-three/drei";
|
|
5
5
|
import * as O from "three";
|
|
6
|
-
import { Plane as
|
|
6
|
+
import { Plane as St, Vector3 as M, Box3 as wn, Line3 as Sn, Raycaster as fo } from "three";
|
|
7
7
|
import { create as uo } from "zustand";
|
|
8
8
|
import { OBJLoader as vn } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
9
9
|
import { STLLoader as po } from "three/examples/jsm/loaders/STLLoader.js";
|
|
10
|
-
import { MeshBVH as
|
|
11
|
-
let
|
|
10
|
+
import { MeshBVH as vt } from "three-mesh-bvh";
|
|
11
|
+
let Lr, bt, br, Dn;
|
|
12
12
|
let __tla = (async () => {
|
|
13
13
|
const ho = {
|
|
14
14
|
showDragDrop: true,
|
|
@@ -64,7 +64,7 @@ let __tla = (async () => {
|
|
|
64
64
|
isAligned: false,
|
|
65
65
|
isCut: false
|
|
66
66
|
})
|
|
67
|
-
})), xo = 0.45,
|
|
67
|
+
})), xo = 0.45, Ct = 3, Vt = 1e-3, yt = 25.4, bo = [
|
|
68
68
|
0.25,
|
|
69
69
|
-0.25,
|
|
70
70
|
0.5,
|
|
@@ -97,14 +97,14 @@ let __tla = (async () => {
|
|
|
97
97
|
const E = r[_ * 3] * o, V = r[_ * 3 + 1] * o, Y = r[_ * 3 + 2] * o;
|
|
98
98
|
E < e && (e = E), E > f && (f = E), V < m && (m = V), V > u && (u = V), Y < d && (d = Y), Y > x && (x = Y);
|
|
99
99
|
}
|
|
100
|
-
const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6,
|
|
100
|
+
const S = (e + f) * 0.5, p = (m + u) * 0.5, g = (d + x) * 0.5, b = f - e + 1e-6, A = u - m + 1e-6, P = x - d + 1e-6, v = b * 0.5, k = A * 0.5, w = P * 0.5, z = Math.min(128, Math.max(16, Math.round(Math.cbrt(l)))), h = b / z, C = A / z, L = P / z, I = /* @__PURE__ */ new Map();
|
|
101
101
|
for (let _ = 0; _ < l; _++) {
|
|
102
|
-
const E = r[_ * 3] * o - S, V = r[_ * 3 + 1] * o - p, Y = r[_ * 3 + 2] * o - g, q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) /
|
|
102
|
+
const E = r[_ * 3] * o - S, V = r[_ * 3 + 1] * o - p, Y = r[_ * 3 + 2] * o - g, q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / L))), fe = q * z * z + ye * z + ae;
|
|
103
103
|
let se = I.get(fe);
|
|
104
104
|
se || (se = [], I.set(fe, se)), se.push(_);
|
|
105
105
|
}
|
|
106
106
|
for (let _ = 0; _ < a; _++) {
|
|
107
|
-
const E = s.getX(_), V = s.getY(_), Y = s.getZ(_), q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) /
|
|
107
|
+
const E = s.getX(_), V = s.getY(_), Y = s.getZ(_), q = Math.min(z - 1, Math.max(0, Math.floor((E + v) / h))), ye = Math.min(z - 1, Math.max(0, Math.floor((V + k) / C))), ae = Math.min(z - 1, Math.max(0, Math.floor((Y + w) / L)));
|
|
108
108
|
let fe = 1 / 0, se = 0;
|
|
109
109
|
for (let ee = 0; ee <= z && fe > 0; ee++) {
|
|
110
110
|
for (let X = -ee; X <= ee; X++) for (let ue = -ee; ue <= ee; ue++) for (let Z = -ee; Z <= ee; Z++) {
|
|
@@ -138,19 +138,19 @@ let __tla = (async () => {
|
|
|
138
138
|
Mn = t;
|
|
139
139
|
},
|
|
140
140
|
debug(t, r, n) {
|
|
141
|
-
|
|
141
|
+
mt("debug", t, r, n);
|
|
142
142
|
},
|
|
143
143
|
info(t, r, n) {
|
|
144
|
-
|
|
144
|
+
mt("info", t, r, n);
|
|
145
145
|
},
|
|
146
146
|
warn(t, r, n) {
|
|
147
|
-
|
|
147
|
+
mt("warn", t, r, n);
|
|
148
148
|
},
|
|
149
149
|
error(t, r, n) {
|
|
150
|
-
|
|
150
|
+
mt("error", t, r, n);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
function
|
|
153
|
+
function mt(t, r, n, o) {
|
|
154
154
|
if (dn[t] < dn[Cn]) return;
|
|
155
155
|
const s = `[${r}]`, a = o !== void 0 ? [
|
|
156
156
|
s,
|
|
@@ -176,7 +176,7 @@ let __tla = (async () => {
|
|
|
176
176
|
}
|
|
177
177
|
Mn == null ? void 0 : Mn(t, r, n, o);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function wt(t) {
|
|
180
180
|
const r = t.getAttribute("position"), n = new Float32Array(r.array), o = t.getIndex();
|
|
181
181
|
if (o) return {
|
|
182
182
|
positions: n,
|
|
@@ -202,7 +202,7 @@ let __tla = (async () => {
|
|
|
202
202
|
if (a.traverse((b) => {
|
|
203
203
|
b.isMesh && !c && (c = b.geometry);
|
|
204
204
|
}), !c) return null;
|
|
205
|
-
const { positions: l, indices: e } =
|
|
205
|
+
const { positions: l, indices: e } = wt(c);
|
|
206
206
|
if (l.length < 9 || e.length < 3) return ce.warn("wasm", `Mesh too small: positions=${l.length} indices=${e.length}`), null;
|
|
207
207
|
for (let b = 0; b < Math.min(l.length, 300); b++) if (!isFinite(l[b])) return ce.error("wasm", `Invalid position data: NaN/Infinity at index ${b}`), null;
|
|
208
208
|
const m = l.length / 3;
|
|
@@ -307,7 +307,7 @@ let __tla = (async () => {
|
|
|
307
307
|
return m;
|
|
308
308
|
}
|
|
309
309
|
function fn(t, r, n, o = false) {
|
|
310
|
-
const s = new
|
|
310
|
+
const s = new St(new M(0, 1, 0), -n), a = [], c = new wn();
|
|
311
311
|
c.setFromBufferAttribute(r.getAttribute("position"));
|
|
312
312
|
const l = {
|
|
313
313
|
linePoints: [],
|
|
@@ -352,7 +352,7 @@ let __tla = (async () => {
|
|
|
352
352
|
return ce.warn("slice", `y=${n.toFixed(2)} all retries exhausted (pts=${a.linePoints.length}, closed=${a.isClosed})`), a;
|
|
353
353
|
}
|
|
354
354
|
function zo(t, r, n, o) {
|
|
355
|
-
const s = new
|
|
355
|
+
const s = new St().setFromNormalAndCoplanarPoint(o.clone().normalize(), n), a = new wn();
|
|
356
356
|
if (a.setFromBufferAttribute(r.getAttribute("position")), !s.intersectsBox(a)) return 0;
|
|
357
357
|
const c = [], l = new Sn(), e = new M();
|
|
358
358
|
t.shapecast({
|
|
@@ -369,8 +369,8 @@ let __tla = (async () => {
|
|
|
369
369
|
return Je(m);
|
|
370
370
|
}
|
|
371
371
|
function jt(t) {
|
|
372
|
-
return new
|
|
373
|
-
maxLeafTris:
|
|
372
|
+
return new vt(t, {
|
|
373
|
+
maxLeafTris: Ct
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
function Ao(t, r, n, 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 l = new
|
|
392
|
-
maxLeafTris:
|
|
391
|
+
const l = new vt(t, {
|
|
392
|
+
maxLeafTris: Ct
|
|
393
393
|
}), e = Ge(l, t, r);
|
|
394
394
|
if (e.lineLength === 0) return {
|
|
395
395
|
valid: false,
|
|
@@ -424,7 +424,7 @@ let __tla = (async () => {
|
|
|
424
424
|
reason: ""
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
const
|
|
427
|
+
const Pe = "pipeline";
|
|
428
428
|
function ko(t, r, n, o) {
|
|
429
429
|
var _a, _b, _c, _d;
|
|
430
430
|
const s = t.geometry.clone(), a = r.map((l) => ({
|
|
@@ -434,7 +434,7 @@ let __tla = (async () => {
|
|
|
434
434
|
let l = t.geometry, e = a.map(($) => new M($.position.x, $.position.y, $.position.z));
|
|
435
435
|
const m = e[0], d = e[1];
|
|
436
436
|
if (!c) {
|
|
437
|
-
o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(
|
|
437
|
+
o.onStatus("Aligning mesh (JS fallback)..."), ce.warn(Pe, "WASM not available, using JS fallback alignment");
|
|
438
438
|
const $ = new M(0, 1, 0), ne = new M().subVectors(d, m).normalize(), xe = ne.dot($), Se = new M().crossVectors(ne, $);
|
|
439
439
|
if (Se.length() > 1e-4) {
|
|
440
440
|
Se.normalize();
|
|
@@ -469,12 +469,12 @@ let __tla = (async () => {
|
|
|
469
469
|
x: N.x,
|
|
470
470
|
y: N.y,
|
|
471
471
|
z: N.z
|
|
472
|
-
}))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 *
|
|
472
|
+
}))), o.setAligned(true), o.setCut(true), o.setAdjustedStartY(null), o.setAdjustedEndY(null), o.setOriginalEndY(e[1].y + 2 * yt);
|
|
473
473
|
const j = new M();
|
|
474
474
|
l.computeBoundingBox(), l.boundingBox.getSize(j), o.setModelSize(Math.max(j.x, j.y, j.z)), s.dispose();
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
const { positions: f, indices: u } =
|
|
477
|
+
const { positions: f, indices: u } = wt(l), x = new Float32Array([
|
|
478
478
|
m.x,
|
|
479
479
|
m.y,
|
|
480
480
|
m.z
|
|
@@ -485,31 +485,31 @@ let __tla = (async () => {
|
|
|
485
485
|
]);
|
|
486
486
|
o.onStatus("Detecting shell type...");
|
|
487
487
|
const p = c.detect_shell(f, u, S, 40), g = p.is_double_shell(), b = p.surface_normal();
|
|
488
|
-
ce.info(
|
|
488
|
+
ce.info(Pe, `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 A = new Float32Array([
|
|
490
490
|
b[0],
|
|
491
491
|
b[1],
|
|
492
492
|
b[2]
|
|
493
|
-
]),
|
|
494
|
-
ce.info(
|
|
493
|
+
]), P = c.find_min_cross_section(f, u, S, A, 10), v = P.plane_normal();
|
|
494
|
+
ce.info(Pe, "Cross-section found", P.details()), o.onStatus("Aligning mesh...");
|
|
495
495
|
const k = new Float32Array([
|
|
496
496
|
v[0],
|
|
497
497
|
v[1],
|
|
498
498
|
v[2]
|
|
499
499
|
]), w = c.align_to_origin(f, x, S, k);
|
|
500
500
|
let z = w.positions(), h = w.mpt(), C = w.origin();
|
|
501
|
-
const
|
|
502
|
-
ce.info(
|
|
501
|
+
const L = w.transform();
|
|
502
|
+
ce.info(Pe, "Alignment complete", w.details());
|
|
503
503
|
const I = [
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
504
|
+
L[3],
|
|
505
|
+
L[4],
|
|
506
|
+
L[5],
|
|
507
|
+
L[6],
|
|
508
|
+
L[7],
|
|
509
|
+
L[8],
|
|
510
|
+
L[9],
|
|
511
|
+
L[10],
|
|
512
|
+
L[11]
|
|
513
513
|
], _ = new Float32Array([
|
|
514
514
|
I[0] * v[0] + I[1] * v[1] + I[2] * v[2],
|
|
515
515
|
I[3] * v[0] + I[4] * v[1] + I[5] * v[2],
|
|
@@ -517,29 +517,29 @@ let __tla = (async () => {
|
|
|
517
517
|
]);
|
|
518
518
|
o.onStatus("Generating measurement points...");
|
|
519
519
|
const E = c.subdivide_origin_to_plane(new Float32Array(C), new Float32Array(h), _);
|
|
520
|
-
ce.debug(
|
|
520
|
+
ce.debug(Pe, `Subdivide: ${E.count()} pts, spacing=${E.spacing().toFixed(1)}mm`);
|
|
521
521
|
const V = E.points(), Y = E.count(), q = 2, ye = 1, ae = [];
|
|
522
522
|
for (let $ = q; $ < Y - ye; $++) ae.push(V[$ * 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))(z, u, new Float32Array(ae), 10);
|
|
527
|
-
ce.debug(
|
|
527
|
+
ce.debug(Pe, "Batch (subdivision)", ne.details());
|
|
528
528
|
const xe = ne.all_loop_points(), Se = ne.offsets(), we = ne.circumferences();
|
|
529
529
|
for (let re = 0; re < Se.length - 1; re++) {
|
|
530
530
|
const j = Se[re], N = Se[re + 1];
|
|
531
531
|
if (N <= j || we[re] <= 0) continue;
|
|
532
532
|
const Ie = (N - j) / 3;
|
|
533
533
|
if (Ie < 3) continue;
|
|
534
|
-
let
|
|
535
|
-
for (let ke = j; ke < N; ke += 3)
|
|
536
|
-
fe.push(
|
|
534
|
+
let Le = 0, Ke = 0, le = 0;
|
|
535
|
+
for (let ke = j; ke < N; ke += 3) Le += xe[ke], Ke += xe[ke + 1], le += xe[ke + 2];
|
|
536
|
+
fe.push(Le / Ie, Ke / Ie, le / Ie);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
if (fe.length >= 6) {
|
|
540
540
|
o.onStatus("Refining alignment...");
|
|
541
541
|
const $ = c.refine_alignment(new Float32Array(fe), z, new Float32Array(C), new Float32Array(h));
|
|
542
|
-
ce.info(
|
|
542
|
+
ce.info(Pe, "Refinement complete", $.details()), z = $.positions(), h = $.mpt(), C = $.origin();
|
|
543
543
|
}
|
|
544
544
|
const se = l.getAttribute("color"), ee = zn(z, u);
|
|
545
545
|
se && ee.setAttribute("color", se), l.dispose(), l = ee, t.geometry = l, l.computeVertexNormals(), l.computeBoundingBox(), e[0] = new M(C[0], C[1], C[2]), e[1] = new M(h[0], h[1], h[2]), o.onStatus("Setting blue point...");
|
|
@@ -567,9 +567,9 @@ let __tla = (async () => {
|
|
|
567
567
|
z: $.z
|
|
568
568
|
}))), o.setAligned(true);
|
|
569
569
|
const ue = l.boundingBox, Z = new M();
|
|
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 *
|
|
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 * yt), o.onStatus("Computing final measurements...");
|
|
571
571
|
{
|
|
572
|
-
const $ =
|
|
572
|
+
const $ = wt(l), ne = e[1].y, xe = e[0].y;
|
|
573
573
|
let Se = 1 / 0, we = -1 / 0;
|
|
574
574
|
const re = $.positions;
|
|
575
575
|
for (let le = 1; le < re.length; le += 3) re[le] < Se && (Se = re[le]), re[le] > we && (we = re[le]);
|
|
@@ -580,14 +580,14 @@ let __tla = (async () => {
|
|
|
580
580
|
ke < we - 1 && N.push(ke);
|
|
581
581
|
}
|
|
582
582
|
for (let le = ne - j; le > xe; le -= j) N.push(le);
|
|
583
|
-
N.sort((le, ke) => le - ke), ce.info(
|
|
584
|
-
const
|
|
585
|
-
ce.info(
|
|
583
|
+
N.sort((le, ke) => le - ke), ce.info(Pe, `Horizontal slices: ${N.length} Y planes, range ${(_b = N[0]) == null ? void 0 : _b.toFixed(1)} \u2192 ${(_c = N[N.length - 1]) == null ? void 0 : _c.toFixed(1)} mm`);
|
|
584
|
+
const Le = (g ? c.batch_cross_sections_y_inner.bind(c) : c.batch_cross_sections_y.bind(c))($.positions, $.indices, new Float32Array(N), 10);
|
|
585
|
+
ce.info(Pe, `Horizontal slices (${g ? "inner" : "outer"}): ${Le.count()}/${N.length} valid`), ce.debug(Pe, "Slice details", Le.details());
|
|
586
586
|
const Ke = {
|
|
587
587
|
yValues: N,
|
|
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: ne,
|
|
592
592
|
originY: xe
|
|
593
593
|
};
|
|
@@ -595,9 +595,9 @@ let __tla = (async () => {
|
|
|
595
595
|
}
|
|
596
596
|
o.onStatus("Validating results...");
|
|
597
597
|
const pe = e[1].y, me = e[0].y, he = Ao(l, pe, me, n);
|
|
598
|
-
he.valid || ce.warn(
|
|
598
|
+
he.valid || ce.warn(Pe, `Validation: ${he.reason}`), o.setClippedReferenceGeometry ? (s.computeVertexNormals(), o.setClippedReferenceGeometry(s)) : s.dispose();
|
|
599
599
|
} catch (l) {
|
|
600
|
-
ce.error(
|
|
600
|
+
ce.error(Pe, "Processing failed", l), o.setError(l instanceof Error ? l.message : "Failed to process mesh."), s.dispose();
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
class Fo extends so {
|
|
@@ -667,7 +667,7 @@ let __tla = (async () => {
|
|
|
667
667
|
}) : this.props.children;
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
const
|
|
670
|
+
const Lo = ({ message: t, onDismiss: r }) => F("div", {
|
|
671
671
|
style: {
|
|
672
672
|
position: "absolute",
|
|
673
673
|
top: 16,
|
|
@@ -758,7 +758,7 @@ let __tla = (async () => {
|
|
|
758
758
|
})
|
|
759
759
|
]
|
|
760
760
|
});
|
|
761
|
-
function
|
|
761
|
+
function Po(t, r, n, o) {
|
|
762
762
|
const s = new M().subVectors(n, r), a = new M().subVectors(o, r), c = new M().subVectors(t, r), l = s.dot(s), e = s.dot(a), m = s.dot(c), d = a.dot(a), f = a.dot(c), u = 1 / (l * d - e * e), x = (d * m - e * f) * u, S = (l * f - e * m) * u;
|
|
763
763
|
return {
|
|
764
764
|
u: 1 - x - S,
|
|
@@ -783,9 +783,9 @@ let __tla = (async () => {
|
|
|
783
783
|
p * 3 + 1,
|
|
784
784
|
p * 3 + 2
|
|
785
785
|
];
|
|
786
|
-
const
|
|
786
|
+
const P = g.getAttribute("position"), v = new M().fromBufferAttribute(P, A[0]), k = new M().fromBufferAttribute(P, A[1]), w = new M().fromBufferAttribute(P, A[2]);
|
|
787
787
|
v.applyMatrix4(t.matrixWorld), k.applyMatrix4(t.matrixWorld), w.applyMatrix4(t.matrixWorld);
|
|
788
|
-
const z = S.point, h =
|
|
788
|
+
const z = S.point, h = Po(z, v, k, w), C = {
|
|
789
789
|
faceIndex: p,
|
|
790
790
|
vertexIndices: A,
|
|
791
791
|
position: {
|
|
@@ -889,8 +889,8 @@ let __tla = (async () => {
|
|
|
889
889
|
});
|
|
890
890
|
};
|
|
891
891
|
function kn(t) {
|
|
892
|
-
return H(() => t ? new
|
|
893
|
-
maxLeafTris:
|
|
892
|
+
return H(() => t ? new vt(t, {
|
|
893
|
+
maxLeafTris: Ct
|
|
894
894
|
}) : null, [
|
|
895
895
|
t
|
|
896
896
|
]);
|
|
@@ -936,8 +936,8 @@ let __tla = (async () => {
|
|
|
936
936
|
f
|
|
937
937
|
]), x = d ?? (u == null ? void 0 : u.linePoints) ?? [], S = f ?? (u == null ? void 0 : u.lineLength) ?? 0, p = H(() => {
|
|
938
938
|
if (e == null || e === 0 || S <= 0 || x.length < 2) return null;
|
|
939
|
-
const
|
|
940
|
-
return x.map((w) => new M(v + (w.x - v) *
|
|
939
|
+
const P = e / S, v = x.reduce((w, z) => w + z.x, 0) / x.length, k = x.reduce((w, z) => w + z.z, 0) / x.length;
|
|
940
|
+
return x.map((w) => new M(v + (w.x - v) * P, w.y, k + (w.z - k) * P));
|
|
941
941
|
}, [
|
|
942
942
|
x,
|
|
943
943
|
S,
|
|
@@ -952,15 +952,15 @@ let __tla = (async () => {
|
|
|
952
952
|
g
|
|
953
953
|
]);
|
|
954
954
|
const b = ie(null), A = H(() => {
|
|
955
|
-
const
|
|
956
|
-
|
|
955
|
+
const P = new O.BufferGeometry();
|
|
956
|
+
P.setAttribute("position", new O.Float32BufferAttribute(new Float32Array(6), 3));
|
|
957
957
|
const v = 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(
|
|
963
|
+
return new O.Line(P, v);
|
|
964
964
|
}, []);
|
|
965
965
|
return K(() => () => {
|
|
966
966
|
A.geometry.dispose(), A.material.dispose();
|
|
@@ -976,10 +976,10 @@ let __tla = (async () => {
|
|
|
976
976
|
S,
|
|
977
977
|
n,
|
|
978
978
|
a
|
|
979
|
-
]), xn(({ camera:
|
|
979
|
+
]), xn(({ camera: P }) => {
|
|
980
980
|
if (!b.current || x.length < 2) return;
|
|
981
981
|
const v = new M();
|
|
982
|
-
|
|
982
|
+
P.getWorldDirection(v);
|
|
983
983
|
const k = new M(v.x, 0, v.z);
|
|
984
984
|
if (k.lengthSq() < 1e-8) return;
|
|
985
985
|
k.normalize();
|
|
@@ -989,10 +989,10 @@ let __tla = (async () => {
|
|
|
989
989
|
const E = w.x * _.x + w.z * _.z;
|
|
990
990
|
E > z && (z = E, h = _);
|
|
991
991
|
}
|
|
992
|
-
const C = s * 0.35,
|
|
993
|
-
b.current.position.copy(
|
|
992
|
+
const C = s * 0.35, L = new M(h.x + w.x * C, n, h.z + w.z * C);
|
|
993
|
+
b.current.position.copy(L);
|
|
994
994
|
const I = A.geometry.getAttribute("position");
|
|
995
|
-
I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1,
|
|
995
|
+
I.setXYZ(0, h.x, h.y, h.z), I.setXYZ(1, L.x, L.y, L.z), I.needsUpdate = true;
|
|
996
996
|
}), x.length < 2 ? null : F("group", {
|
|
997
997
|
renderOrder: 10,
|
|
998
998
|
children: [
|
|
@@ -1078,7 +1078,7 @@ let __tla = (async () => {
|
|
|
1078
1078
|
]
|
|
1079
1079
|
}),
|
|
1080
1080
|
e != null && e !== 0 && S > 0 && (() => {
|
|
1081
|
-
const
|
|
1081
|
+
const P = S - e, v = P > 0.5 ? "\u25B2" : P < -0.5 ? "\u25BC" : "", k = pn(S, e);
|
|
1082
1082
|
return F("div", {
|
|
1083
1083
|
style: {
|
|
1084
1084
|
display: "flex",
|
|
@@ -1106,8 +1106,8 @@ let __tla = (async () => {
|
|
|
1106
1106
|
fontWeight: 600
|
|
1107
1107
|
},
|
|
1108
1108
|
children: [
|
|
1109
|
-
|
|
1110
|
-
c === "inch" ? (
|
|
1109
|
+
P > 0 ? "+" : "",
|
|
1110
|
+
c === "inch" ? (P / 25.4).toFixed(2) : P.toFixed(1)
|
|
1111
1111
|
]
|
|
1112
1112
|
}),
|
|
1113
1113
|
F("span", {
|
|
@@ -1139,8 +1139,8 @@ let __tla = (async () => {
|
|
|
1139
1139
|
if (o > 25.4 + 0.1) {
|
|
1140
1140
|
const h = f.mptY;
|
|
1141
1141
|
z = z.filter((C) => {
|
|
1142
|
-
const
|
|
1143
|
-
return
|
|
1142
|
+
const L = Math.abs(C - h);
|
|
1143
|
+
return L < 0.5 || Math.abs(Math.round(L / o) * o - L) < 0.5;
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
1146
|
return c ? z.sort((h, C) => C - h) : z.sort((h, C) => h - C), z;
|
|
@@ -1159,10 +1159,10 @@ let __tla = (async () => {
|
|
|
1159
1159
|
if (!f) return null;
|
|
1160
1160
|
const k = /* @__PURE__ */ new Map(), { allLoopPoints: w, offsets: z, yValues: h } = f;
|
|
1161
1161
|
for (let C = 0; C < z.length - 1; C++) {
|
|
1162
|
-
const
|
|
1163
|
-
if (I <=
|
|
1162
|
+
const L = z[C], I = z[C + 1];
|
|
1163
|
+
if (I <= L) continue;
|
|
1164
1164
|
const _ = [];
|
|
1165
|
-
for (let E =
|
|
1165
|
+
for (let E = L; E < I; E += 3) _.push(new M(w[E], w[E + 1], w[E + 2]));
|
|
1166
1166
|
_.length >= 3 && k.set(h[C], _);
|
|
1167
1167
|
}
|
|
1168
1168
|
return k;
|
|
@@ -1195,7 +1195,7 @@ let __tla = (async () => {
|
|
|
1195
1195
|
]);
|
|
1196
1196
|
const A = [
|
|
1197
1197
|
"#5B9BD5"
|
|
1198
|
-
],
|
|
1198
|
+
], P = s * xo, v = Q((k) => {
|
|
1199
1199
|
if (b) return;
|
|
1200
1200
|
u.current.set(k.yPosition, k);
|
|
1201
1201
|
const w = Array.from(u.current.values()).sort((z, h) => c ? h.yPosition - z.yPosition : z.yPosition - h.yPosition);
|
|
@@ -1211,7 +1211,7 @@ let __tla = (async () => {
|
|
|
1211
1211
|
geometry: x,
|
|
1212
1212
|
yPosition: k,
|
|
1213
1213
|
color: d != null && Math.abs(k - d) < o * 0.5 ? "#44ff44" : A[w % A.length],
|
|
1214
|
-
labelX:
|
|
1214
|
+
labelX: P,
|
|
1215
1215
|
onDataChange: v,
|
|
1216
1216
|
displayUnit: l,
|
|
1217
1217
|
useInnerSurface: e,
|
|
@@ -1238,10 +1238,10 @@ let __tla = (async () => {
|
|
|
1238
1238
|
h.normalize();
|
|
1239
1239
|
const C = new M().crossVectors(new M(0, 1, 0), h).normalize();
|
|
1240
1240
|
f.current.position.set(C.x * m, 0, C.z * m);
|
|
1241
|
-
const
|
|
1242
|
-
f.current.rotation.y = Math.atan2(
|
|
1241
|
+
const L = w.position.x - f.current.position.x, I = w.position.z - f.current.position.z;
|
|
1242
|
+
f.current.rotation.y = Math.atan2(L, I);
|
|
1243
1243
|
});
|
|
1244
|
-
const u = new M(0, r, 0), x = new M(0, l, 0), S = new M(0, (r + l) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, l, 0), A = new M(d, l, 0),
|
|
1244
|
+
const u = new M(0, r, 0), x = new M(0, l, 0), S = new M(0, (r + l) / 2, 0), p = new M(-d, r, 0), g = new M(d, r, 0), b = new M(-d, l, 0), A = new M(d, l, 0), P = a != null && a > 0, v = P ? e - a : 0, k = P ? $o(e, a) : "#fff";
|
|
1245
1245
|
return F("group", {
|
|
1246
1246
|
ref: f,
|
|
1247
1247
|
children: [
|
|
@@ -1295,7 +1295,7 @@ let __tla = (async () => {
|
|
|
1295
1295
|
style: {
|
|
1296
1296
|
padding: "4px 8px",
|
|
1297
1297
|
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
1298
|
-
borderRadius:
|
|
1298
|
+
borderRadius: P ? "4px 4px 0 0" : 4,
|
|
1299
1299
|
color: "#fff",
|
|
1300
1300
|
fontSize: 16,
|
|
1301
1301
|
fontFamily: "monospace",
|
|
@@ -1308,7 +1308,7 @@ let __tla = (async () => {
|
|
|
1308
1308
|
o === "inch" ? "in" : "mm"
|
|
1309
1309
|
]
|
|
1310
1310
|
}),
|
|
1311
|
-
|
|
1311
|
+
P && F("div", {
|
|
1312
1312
|
style: {
|
|
1313
1313
|
display: "flex",
|
|
1314
1314
|
alignItems: "center",
|
|
@@ -1361,15 +1361,15 @@ let __tla = (async () => {
|
|
|
1361
1361
|
]
|
|
1362
1362
|
});
|
|
1363
1363
|
}, Vo = ({ modelSize: t, isAligned: r, isCut: n, mesh: o, viewMode: s, sliceY: a, landmarkCount: c = 0, measurementGeometry: l, resetCameraToFrontRef: e }) => {
|
|
1364
|
-
const { set: m, size: d, camera: f, invalidate: u } = bn(), x = ie(false), S = ie(s), p = ie(new M()), g = ie(null), b = ie(c), A = ie(r),
|
|
1364
|
+
const { set: m, size: d, camera: f, invalidate: u } = bn(), x = ie(false), S = ie(s), p = ie(new M()), g = ie(null), b = ie(c), A = ie(r), P = ie(n), v = ie(l), k = ie(0), w = Q(() => {
|
|
1365
1365
|
if (!o || t <= 0) return null;
|
|
1366
1366
|
const h = l ?? o.geometry;
|
|
1367
1367
|
h.computeBoundingBox();
|
|
1368
|
-
const C = h.boundingBox,
|
|
1369
|
-
C.getCenter(
|
|
1368
|
+
const C = h.boundingBox, L = new M();
|
|
1369
|
+
C.getCenter(L);
|
|
1370
1370
|
const I = new M();
|
|
1371
1371
|
C.getSize(I), p.current.copy(I);
|
|
1372
|
-
const _ = d.width / d.height, E = Math.max(I.y, I.x / _) * 1.6, V = E * _, Y =
|
|
1372
|
+
const _ = d.width / d.height, E = Math.max(I.y, I.x / _) * 1.6, V = E * _, Y = L.y - I.y * 0.05;
|
|
1373
1373
|
k.current = Y;
|
|
1374
1374
|
const q = new O.OrthographicCamera(-V / 2, V / 2, E / 2, -E / 2, 0.1, t * 10);
|
|
1375
1375
|
return q.position.set(0, Y, t * 2), q.lookAt(0, Y, 0), q;
|
|
@@ -1395,8 +1395,8 @@ let __tla = (async () => {
|
|
|
1395
1395
|
u
|
|
1396
1396
|
]);
|
|
1397
1397
|
const z = Q((h) => {
|
|
1398
|
-
const C = h.position.clone(),
|
|
1399
|
-
h.position.set(
|
|
1398
|
+
const C = h.position.clone(), L = C.length(), I = Math.atan2(C.x, C.z), _ = Math.acos(C.y / L), V = I + 0.02;
|
|
1399
|
+
h.position.set(L * Math.sin(_) * Math.sin(V), L * Math.cos(_), L * Math.sin(_) * Math.cos(V)), h.lookAt(0, 0, 0), h.updateMatrixWorld(true), u();
|
|
1400
1400
|
}, [
|
|
1401
1401
|
u
|
|
1402
1402
|
]);
|
|
@@ -1423,8 +1423,8 @@ let __tla = (async () => {
|
|
|
1423
1423
|
f,
|
|
1424
1424
|
z
|
|
1425
1425
|
]), K(() => {
|
|
1426
|
-
const h = A.current !== r, C =
|
|
1427
|
-
if (A.current = r,
|
|
1426
|
+
const h = A.current !== r, C = P.current !== n, L = !v.current && !!l;
|
|
1427
|
+
if (A.current = r, P.current = n, v.current = l, !h && !C && !L || !r || s !== "3D") return;
|
|
1428
1428
|
const I = w();
|
|
1429
1429
|
I && m({
|
|
1430
1430
|
camera: I
|
|
@@ -1442,9 +1442,9 @@ let __tla = (async () => {
|
|
|
1442
1442
|
if (S.current = s, !(!r || !o || t <= 0)) {
|
|
1443
1443
|
if (s === "2D" && a != null) {
|
|
1444
1444
|
g.current = f;
|
|
1445
|
-
const C = o.geometry,
|
|
1445
|
+
const C = o.geometry, L = C.getAttribute("position"), I = L.array, _ = t * 0.15;
|
|
1446
1446
|
let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
|
|
1447
|
-
for (let he = 0; he <
|
|
1447
|
+
for (let he = 0; he < L.count; he++) if (Math.abs(I[he * 3 + 1] - a) < _) {
|
|
1448
1448
|
const $ = I[he * 3], ne = I[he * 3 + 2];
|
|
1449
1449
|
$ < E && (E = $), $ > V && (V = $), ne < Y && (Y = ne), ne > q && (q = ne), ye = true;
|
|
1450
1450
|
}
|
|
@@ -1485,9 +1485,9 @@ let __tla = (async () => {
|
|
|
1485
1485
|
const h = f;
|
|
1486
1486
|
if (s === "2D") {
|
|
1487
1487
|
if (!o || a == null) return;
|
|
1488
|
-
const C = o.geometry,
|
|
1488
|
+
const C = o.geometry, L = C.getAttribute("position"), I = L.array, _ = t * 0.15;
|
|
1489
1489
|
let E = 1 / 0, V = -1 / 0, Y = 1 / 0, q = -1 / 0, ye = false;
|
|
1490
|
-
for (let Z = 0; Z <
|
|
1490
|
+
for (let Z = 0; Z < L.count; Z++) if (Math.abs(I[Z * 3 + 1] - a) < _) {
|
|
1491
1491
|
const pe = I[Z * 3], me = I[Z * 3 + 2];
|
|
1492
1492
|
pe < E && (E = pe), pe > V && (V = pe), me < Y && (Y = me), me > q && (q = me), ye = true;
|
|
1493
1493
|
}
|
|
@@ -1500,7 +1500,7 @@ let __tla = (async () => {
|
|
|
1500
1500
|
let X, ue;
|
|
1501
1501
|
se / ee > ae ? (X = se, ue = se / ae) : (ue = ee, X = ee * ae), h.left = -X / 2, h.right = X / 2, h.top = ue / 2, h.bottom = -ue / 2;
|
|
1502
1502
|
} else {
|
|
1503
|
-
const C = p.current,
|
|
1503
|
+
const C = p.current, L = d.width / d.height, I = Math.max(C.y, C.x / L) * 1.6, _ = I * L;
|
|
1504
1504
|
h.left = -_ / 2, h.right = _ / 2, h.top = I / 2, h.bottom = -I / 2;
|
|
1505
1505
|
}
|
|
1506
1506
|
h.updateProjectionMatrix();
|
|
@@ -1678,18 +1678,18 @@ let __tla = (async () => {
|
|
|
1678
1678
|
}, o.number);
|
|
1679
1679
|
})
|
|
1680
1680
|
}), Go = ({ mesh: t, upperY: r, originY: n, modelSize: o, meshColor: s = "#c8c8c8", displayUnit: a = "mm" }) => {
|
|
1681
|
-
const c = t.geometry, l = H(() => new
|
|
1682
|
-
maxLeafTris:
|
|
1681
|
+
const c = t.geometry, l = H(() => new vt(c, {
|
|
1682
|
+
maxLeafTris: Ct
|
|
1683
1683
|
}), [
|
|
1684
1684
|
c
|
|
1685
1685
|
]), e = H(() => Ge(l, c, n), [
|
|
1686
1686
|
l,
|
|
1687
1687
|
c,
|
|
1688
1688
|
n
|
|
1689
|
-
]), m = H(() => new
|
|
1689
|
+
]), m = H(() => new St(new M(0, -1, 0), r), [
|
|
1690
1690
|
r
|
|
1691
1691
|
]), { mlLine: d, apLine: f, mlWidth: u, apWidth: x } = H(() => {
|
|
1692
|
-
let g = null, b = null, A = 0,
|
|
1692
|
+
let g = null, b = null, A = 0, P = 0;
|
|
1693
1693
|
if (e.linePoints.length >= 2) {
|
|
1694
1694
|
let v = e.linePoints[0], k = e.linePoints[0], w = e.linePoints[0], z = e.linePoints[0];
|
|
1695
1695
|
for (const h of e.linePoints) h.x < v.x && (v = h), h.x > k.x && (k = h), h.z < w.z && (w = h), h.z > z.z && (z = h);
|
|
@@ -1699,13 +1699,13 @@ let __tla = (async () => {
|
|
|
1699
1699
|
], b = [
|
|
1700
1700
|
new M(w.x, n, w.z),
|
|
1701
1701
|
new M(z.x, n, z.z)
|
|
1702
|
-
], A = g[0].distanceTo(g[1]),
|
|
1702
|
+
], A = g[0].distanceTo(g[1]), P = b[0].distanceTo(b[1]);
|
|
1703
1703
|
}
|
|
1704
1704
|
return {
|
|
1705
1705
|
mlLine: g,
|
|
1706
1706
|
apLine: b,
|
|
1707
1707
|
mlWidth: A,
|
|
1708
|
-
apWidth:
|
|
1708
|
+
apWidth: P
|
|
1709
1709
|
};
|
|
1710
1710
|
}, [
|
|
1711
1711
|
e,
|
|
@@ -1825,18 +1825,18 @@ let __tla = (async () => {
|
|
|
1825
1825
|
]
|
|
1826
1826
|
});
|
|
1827
1827
|
}, Zo = ({ mesh: t, yPosition: r, onYChange: n, minY: o, maxY: s, modelSize: a, color: c, hoverColor: l, dragColor: e, label: m, onDragStart: d, onDragEnd: f }) => {
|
|
1828
|
-
const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = bn(), A = ie(0),
|
|
1828
|
+
const [u, x] = B(false), [S, p] = B(false), { camera: g, gl: b } = bn(), A = ie(0), P = t.geometry, v = kn(P), k = H(() => v ? Ge(v, P, r) : {
|
|
1829
1829
|
linePoints: [],
|
|
1830
1830
|
lineLength: 0,
|
|
1831
1831
|
rightmostPoint: new M()
|
|
1832
1832
|
}, [
|
|
1833
1833
|
v,
|
|
1834
|
-
|
|
1834
|
+
P,
|
|
1835
1835
|
r
|
|
1836
1836
|
]), w = Q((I, _) => {
|
|
1837
1837
|
const E = b.domElement.getBoundingClientRect(), V = (I - E.left) / E.width * 2 - 1, Y = -((_ - E.top) / E.height) * 2 + 1, q = new fo();
|
|
1838
1838
|
q.setFromCamera(new O.Vector2(V, Y), g);
|
|
1839
|
-
const ye = new
|
|
1839
|
+
const ye = new St(new M(0, 0, 1), 0), ae = new M();
|
|
1840
1840
|
return q.ray.intersectPlane(ye, ae), ae ? ae.y : r;
|
|
1841
1841
|
}, [
|
|
1842
1842
|
g,
|
|
@@ -1866,13 +1866,13 @@ let __tla = (async () => {
|
|
|
1866
1866
|
f
|
|
1867
1867
|
]);
|
|
1868
1868
|
if (k.linePoints.length < 2) return null;
|
|
1869
|
-
const
|
|
1869
|
+
const L = u ? e : S ? l : c;
|
|
1870
1870
|
return F("group", {
|
|
1871
1871
|
renderOrder: 10,
|
|
1872
1872
|
children: [
|
|
1873
1873
|
i(de, {
|
|
1874
1874
|
points: k.linePoints,
|
|
1875
|
-
color:
|
|
1875
|
+
color: L,
|
|
1876
1876
|
lineWidth: u ? 6 : S ? 5 : 4,
|
|
1877
1877
|
depthTest: false,
|
|
1878
1878
|
depthWrite: false,
|
|
@@ -1901,7 +1901,7 @@ let __tla = (async () => {
|
|
|
1901
1901
|
padding: "4px 8px",
|
|
1902
1902
|
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
|
1903
1903
|
borderRadius: 4,
|
|
1904
|
-
color:
|
|
1904
|
+
color: L,
|
|
1905
1905
|
fontSize: 11,
|
|
1906
1906
|
whiteSpace: "nowrap",
|
|
1907
1907
|
pointerEvents: "none"
|
|
@@ -1944,7 +1944,7 @@ let __tla = (async () => {
|
|
|
1944
1944
|
"I don't want to",
|
|
1945
1945
|
"I want a second opinion",
|
|
1946
1946
|
"I measured from IT"
|
|
1947
|
-
],
|
|
1947
|
+
], xt = {
|
|
1948
1948
|
padding: "8px 20px",
|
|
1949
1949
|
borderRadius: 4,
|
|
1950
1950
|
fontSize: 14,
|
|
@@ -2099,7 +2099,7 @@ let __tla = (async () => {
|
|
|
2099
2099
|
i("button", {
|
|
2100
2100
|
onClick: m,
|
|
2101
2101
|
style: {
|
|
2102
|
-
...
|
|
2102
|
+
...xt,
|
|
2103
2103
|
backgroundColor: "#fff",
|
|
2104
2104
|
border: "1px solid #ddd",
|
|
2105
2105
|
color: "#666"
|
|
@@ -2110,7 +2110,7 @@ let __tla = (async () => {
|
|
|
2110
2110
|
onClick: f,
|
|
2111
2111
|
disabled: !d,
|
|
2112
2112
|
style: {
|
|
2113
|
-
...
|
|
2113
|
+
...xt,
|
|
2114
2114
|
backgroundColor: d ? "rgb(12, 67, 173)" : "#e0e0e0",
|
|
2115
2115
|
border: "none",
|
|
2116
2116
|
color: d ? "#fff" : "#9e9e9e",
|
|
@@ -2171,7 +2171,7 @@ let __tla = (async () => {
|
|
|
2171
2171
|
i("button", {
|
|
2172
2172
|
onClick: r,
|
|
2173
2173
|
style: {
|
|
2174
|
-
...
|
|
2174
|
+
...xt,
|
|
2175
2175
|
backgroundColor: "#fff",
|
|
2176
2176
|
border: "1px solid #bdbdbd",
|
|
2177
2177
|
color: "#333"
|
|
@@ -2181,7 +2181,7 @@ let __tla = (async () => {
|
|
|
2181
2181
|
i("button", {
|
|
2182
2182
|
onClick: e,
|
|
2183
2183
|
style: {
|
|
2184
|
-
...
|
|
2184
|
+
...xt,
|
|
2185
2185
|
backgroundColor: "rgb(12, 67, 173)",
|
|
2186
2186
|
border: "none",
|
|
2187
2187
|
color: "#fff"
|
|
@@ -2225,10 +2225,10 @@ let __tla = (async () => {
|
|
|
2225
2225
|
]), [S, p] = B(() => {
|
|
2226
2226
|
if (!e) return {};
|
|
2227
2227
|
const h = {};
|
|
2228
|
-
return x.forEach((C,
|
|
2229
|
-
e[
|
|
2228
|
+
return x.forEach((C, L) => {
|
|
2229
|
+
e[L] != null && e[L] !== 0 && (h[C] = e[L].toFixed(1));
|
|
2230
2230
|
}), h;
|
|
2231
|
-
}), [g, b] = B(m && m > 0 ? m.toFixed(1) : ""), [A,
|
|
2231
|
+
}), [g, b] = B(m && m > 0 ? m.toFixed(1) : ""), [A, P] = B(false), v = H(() => x.map((h) => {
|
|
2232
2232
|
const C = S[h];
|
|
2233
2233
|
return C != null && C !== "" && !isNaN(parseFloat(C)) ? parseFloat(C) : 0;
|
|
2234
2234
|
}), [
|
|
@@ -2248,7 +2248,7 @@ let __tla = (async () => {
|
|
|
2248
2248
|
l
|
|
2249
2249
|
]);
|
|
2250
2250
|
const k = H(() => {
|
|
2251
|
-
const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((
|
|
2251
|
+
const h = g !== "" && !isNaN(parseFloat(g)), C = v.some((L) => L !== 0);
|
|
2252
2252
|
return h || C;
|
|
2253
2253
|
}, [
|
|
2254
2254
|
v,
|
|
@@ -2267,8 +2267,8 @@ let __tla = (async () => {
|
|
|
2267
2267
|
s
|
|
2268
2268
|
]), z = Q(() => {
|
|
2269
2269
|
const h = {};
|
|
2270
|
-
x.forEach((C,
|
|
2271
|
-
const I = n[
|
|
2270
|
+
x.forEach((C, L) => {
|
|
2271
|
+
const I = n[L];
|
|
2272
2272
|
if (I) {
|
|
2273
2273
|
const _ = I.modifiedValue ?? I.originalValue;
|
|
2274
2274
|
h[C] = _.toFixed(1);
|
|
@@ -2290,7 +2290,7 @@ let __tla = (async () => {
|
|
|
2290
2290
|
children: [
|
|
2291
2291
|
A && i(Fn, {
|
|
2292
2292
|
onSkip: a,
|
|
2293
|
-
onCancel: () =>
|
|
2293
|
+
onCancel: () => P(false)
|
|
2294
2294
|
}),
|
|
2295
2295
|
F("div", {
|
|
2296
2296
|
style: {
|
|
@@ -2403,9 +2403,9 @@ let __tla = (async () => {
|
|
|
2403
2403
|
type: "number",
|
|
2404
2404
|
step: "0.1",
|
|
2405
2405
|
value: S[h] ?? "",
|
|
2406
|
-
onChange: (
|
|
2406
|
+
onChange: (L) => p((I) => ({
|
|
2407
2407
|
...I,
|
|
2408
|
-
[h]:
|
|
2408
|
+
[h]: L.target.value
|
|
2409
2409
|
})),
|
|
2410
2410
|
style: {
|
|
2411
2411
|
...mn,
|
|
@@ -2490,7 +2490,7 @@ let __tla = (async () => {
|
|
|
2490
2490
|
children: "Save Measurements"
|
|
2491
2491
|
}),
|
|
2492
2492
|
i("button", {
|
|
2493
|
-
onClick: () =>
|
|
2493
|
+
onClick: () => P(true),
|
|
2494
2494
|
style: {
|
|
2495
2495
|
...Ht,
|
|
2496
2496
|
backgroundColor: "#fff",
|
|
@@ -2507,18 +2507,18 @@ let __tla = (async () => {
|
|
|
2507
2507
|
]
|
|
2508
2508
|
});
|
|
2509
2509
|
};
|
|
2510
|
-
function
|
|
2510
|
+
function Ln(t, r, n) {
|
|
2511
2511
|
const o = t.getAttribute("position"), s = n - r;
|
|
2512
2512
|
if (s < 1) return null;
|
|
2513
2513
|
const a = 30, c = s / a, l = [];
|
|
2514
2514
|
for (let g = 0; g < a; g++) {
|
|
2515
2515
|
const b = r + g * c, A = r + (g + 1) * c;
|
|
2516
|
-
let
|
|
2516
|
+
let P = 0, v = 0, k = 0, w = 0;
|
|
2517
2517
|
for (let z = 0; z < o.count; z++) {
|
|
2518
2518
|
const h = o.getY(z);
|
|
2519
|
-
h >= b && h < A && (
|
|
2519
|
+
h >= b && h < A && (P += o.getX(z), v += h, k += o.getZ(z), w++);
|
|
2520
2520
|
}
|
|
2521
|
-
w > 20 && l.push(new M(
|
|
2521
|
+
w > 20 && l.push(new M(P / w, v / w, k / w));
|
|
2522
2522
|
}
|
|
2523
2523
|
if (l.length < 5) return null;
|
|
2524
2524
|
const e = new M();
|
|
@@ -2526,12 +2526,12 @@ let __tla = (async () => {
|
|
|
2526
2526
|
e.divideScalar(l.length);
|
|
2527
2527
|
let m = 0, d = 0, f = 0, u = 0, x = 0, S = 0;
|
|
2528
2528
|
for (const g of l) {
|
|
2529
|
-
const b = g.x - e.x, A = g.y - e.y,
|
|
2530
|
-
m += b * b, d += b * A, f += b *
|
|
2529
|
+
const b = g.x - e.x, A = g.y - e.y, P = g.z - e.z;
|
|
2530
|
+
m += b * b, d += b * A, f += b * P, u += A * A, x += A * P, S += P * P;
|
|
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 b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z,
|
|
2534
|
+
const b = m * p.x + d * p.y + f * p.z, A = d * p.x + u * p.y + x * p.z, P = f * p.x + x * p.y + S * p.z, v = new M(b, A, P), k = v.length();
|
|
2535
2535
|
if (k < 1e-10 || (v.divideScalar(k), p.distanceTo(v) < 1e-8)) break;
|
|
2536
2536
|
p = v;
|
|
2537
2537
|
}
|
|
@@ -2552,7 +2552,7 @@ let __tla = (async () => {
|
|
|
2552
2552
|
"#44cc44",
|
|
2553
2553
|
"#4488ff"
|
|
2554
2554
|
];
|
|
2555
|
-
function
|
|
2555
|
+
function Pn(t) {
|
|
2556
2556
|
const r = t.getAttribute("position"), n = r.count, o = new M();
|
|
2557
2557
|
for (let p = 0; p < n; p++) o.x += r.getX(p), o.y += r.getY(p), o.z += r.getZ(p);
|
|
2558
2558
|
o.divideScalar(n);
|
|
@@ -2582,7 +2582,7 @@ let __tla = (async () => {
|
|
|
2582
2582
|
for (let p = 0; p < 3; p++) {
|
|
2583
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 A = 0; A < 100; A++) {
|
|
2585
|
-
const
|
|
2585
|
+
const P = u[0][0] * g.x + u[0][1] * g.y + u[0][2] * g.z, v = u[1][0] * g.x + u[1][1] * g.y + u[1][2] * g.z, k = u[2][0] * g.x + u[2][1] * g.y + u[2][2] * g.z, w = new M(P, v, k);
|
|
2586
2586
|
if (b = w.length(), b < 1e-12) break;
|
|
2587
2587
|
if (w.divideScalar(b), g.distanceTo(w) < 1e-10) {
|
|
2588
2588
|
g = w;
|
|
@@ -2591,7 +2591,7 @@ let __tla = (async () => {
|
|
|
2591
2591
|
g = w;
|
|
2592
2592
|
}
|
|
2593
2593
|
d.push(g.clone()), f.push(b);
|
|
2594
|
-
for (let A = 0; A < 3; A++) for (let
|
|
2594
|
+
for (let A = 0; A < 3; A++) for (let P = 0; P < 3; P++) {
|
|
2595
2595
|
const v = [
|
|
2596
2596
|
g.x,
|
|
2597
2597
|
g.y,
|
|
@@ -2600,8 +2600,8 @@ let __tla = (async () => {
|
|
|
2600
2600
|
g.x,
|
|
2601
2601
|
g.y,
|
|
2602
2602
|
g.z
|
|
2603
|
-
][
|
|
2604
|
-
u[A][
|
|
2603
|
+
][P];
|
|
2604
|
+
u[A][P] -= b * v * k;
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
2607
2607
|
const x = new M();
|
|
@@ -2615,8 +2615,8 @@ let __tla = (async () => {
|
|
|
2615
2615
|
for (let p = 0; p < 3; p++) {
|
|
2616
2616
|
let g = 1 / 0, b = -1 / 0;
|
|
2617
2617
|
const A = d[p];
|
|
2618
|
-
for (let
|
|
2619
|
-
const v = r.getX(
|
|
2618
|
+
for (let P = 0; P < n; P++) {
|
|
2619
|
+
const v = r.getX(P) - x.x, k = r.getY(P) - x.y, w = r.getZ(P) - x.z, z = v * A.x + k * A.y + w * A.z;
|
|
2620
2620
|
z < g && (g = z), z > b && (b = z);
|
|
2621
2621
|
}
|
|
2622
2622
|
S[p] = (b - g) / 2;
|
|
@@ -2772,7 +2772,7 @@ let __tla = (async () => {
|
|
|
2772
2772
|
let e = n - 10;
|
|
2773
2773
|
const m = new M(0, 1, 0);
|
|
2774
2774
|
for (; e > r; ) {
|
|
2775
|
-
const d = Math.min(e, n), f = Math.max(e, n), u =
|
|
2775
|
+
const d = Math.min(e, n), f = Math.max(e, n), u = Ln(t, d, f);
|
|
2776
2776
|
if (u) {
|
|
2777
2777
|
const x = u.dot(m), S = Math.acos(Math.min(1, Math.abs(x))) * 180 / Math.PI;
|
|
2778
2778
|
l.push({
|
|
@@ -2822,7 +2822,7 @@ let __tla = (async () => {
|
|
|
2822
2822
|
}
|
|
2823
2823
|
function lr({ geometry: t, redY: r, greenY: n, modelSize: o }) {
|
|
2824
2824
|
const s = H(() => {
|
|
2825
|
-
const f =
|
|
2825
|
+
const f = Ln(t, r, n);
|
|
2826
2826
|
if (!f) return null;
|
|
2827
2827
|
const u = f.dot(new M(0, 1, 0)), x = Math.acos(Math.min(1, Math.abs(u))) * 180 / Math.PI;
|
|
2828
2828
|
return {
|
|
@@ -2875,7 +2875,7 @@ let __tla = (async () => {
|
|
|
2875
2875
|
});
|
|
2876
2876
|
}
|
|
2877
2877
|
if (g.length < 5) return null;
|
|
2878
|
-
const b = n - r, A = r + b * 0.3,
|
|
2878
|
+
const b = n - r, A = r + b * 0.3, P = r + b * 0.7, v = g.filter((h) => h.y >= A && h.y <= P);
|
|
2879
2879
|
if (v.length < 3) return null;
|
|
2880
2880
|
const k = v.map((h) => h.circ).sort((h, C) => h - C), w = k[Math.floor(k.length / 2)], z = Math.max(...g.map((h) => h.circ));
|
|
2881
2881
|
return {
|
|
@@ -3035,7 +3035,7 @@ let __tla = (async () => {
|
|
|
3035
3035
|
});
|
|
3036
3036
|
}
|
|
3037
3037
|
function ur({ mesh: t, layers: r, landmarkPoints: n, componentDebug: o, aoData: s, aoGeometry: a, measurementGeometry: c }) {
|
|
3038
|
-
const l = t.geometry, e = H(() => l.getAttribute("position") ?
|
|
3038
|
+
const l = t.geometry, e = H(() => l.getAttribute("position") ? Pn(l) : null, [
|
|
3039
3039
|
l
|
|
3040
3040
|
]), m = H(() => !n || n.length < 2 ? null : {
|
|
3041
3041
|
red: new M(n[1].position.x, n[1].position.y, n[1].position.z),
|
|
@@ -3102,7 +3102,7 @@ let __tla = (async () => {
|
|
|
3102
3102
|
function pr({ mesh: t }) {
|
|
3103
3103
|
const r = t.geometry, n = H(() => {
|
|
3104
3104
|
if (!r.getAttribute("position")) return null;
|
|
3105
|
-
const a =
|
|
3105
|
+
const a = Pn(r), c = a.axes[0], l = a.halfExtents[0] * 1.3;
|
|
3106
3106
|
return {
|
|
3107
3107
|
axis: c,
|
|
3108
3108
|
center: a.center,
|
|
@@ -3279,7 +3279,7 @@ let __tla = (async () => {
|
|
|
3279
3279
|
});
|
|
3280
3280
|
}
|
|
3281
3281
|
const mr = ({ config: t, spacingType: r, scanUrl: n, formMeasurements: o, onComplete: s, isDebugUser: a = false, onAnalyticsEvent: c, wasmModule: l }) => {
|
|
3282
|
-
const [e, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A,
|
|
3282
|
+
const [e, m] = B(null), [d, f] = B(0), [u, x] = B(false), [S, p] = B(false), [g, b] = B(""), [A, P] = B("3D"), [v, k] = B(r === "AK" ? 2 : 1), [w, z] = B(false), [h, C] = B(null), [L, I] = B(r ?? null), [_, E] = B("mm"), [V, Y] = B(false), [q, ye] = B(""), [ae, fe] = B(false), [se, ee] = B(false), [X, ue] = B(false), [Z, pe] = B(false), [me, he] = B(null), [$, ne] = B(null), [xe, Se] = B(null), [we, re] = B(false), [j, N] = B([]), [Ie, Le] = B(null), [Ke, le] = B(null), [ke, Mt] = B(null), [zt, Yt] = B(null), [_n, Xt] = B(false), [At, Gt] = B(null), [kt, De] = B(null), [We, Rn] = B(false), [Zt, Wn] = B(tr), [Ve, Kt] = B("obj"), [ve, Ft] = B(o), [Qe, Lt] = B(true), [je, st] = B(false), [lt, Ut] = B(false), [ze, at] = B(false), [Bn, Pt] = B(false), [qe, En] = B(null), [Tn, On] = B(void 0), [$n, Hn] = B(void 0), [Jt] = B("#c8c8c8"), [Vn] = B(1), [Te, jn] = B(false), [It, Qt] = B([]), ct = ie(null), Ne = ie(null), dt = ie(false), Nn = ie(null), Dt = ie(null), _t = ie(null), qt = ie(null);
|
|
3283
3283
|
K(() => {
|
|
3284
3284
|
import("./html2canvas.esm-Dmi1NfiH.js").then((y) => {
|
|
3285
3285
|
qt.current = y.default;
|
|
@@ -3287,30 +3287,31 @@ let __tla = (async () => {
|
|
|
3287
3287
|
});
|
|
3288
3288
|
}, []);
|
|
3289
3289
|
const et = Q(async () => {
|
|
3290
|
-
if (
|
|
3291
|
-
const y = qt.current ?? (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D =
|
|
3290
|
+
if (_t.current) try {
|
|
3291
|
+
const y = qt.current ?? (await import("./html2canvas.esm-Dmi1NfiH.js")).default, D = _t.current, W = 2, R = async (J = false) => {
|
|
3292
3292
|
const oe = await y(D, {
|
|
3293
3293
|
backgroundColor: null,
|
|
3294
3294
|
useCORS: true,
|
|
3295
|
-
scale:
|
|
3295
|
+
scale: W,
|
|
3296
3296
|
ignoreElements: (ot) => {
|
|
3297
3297
|
var _a, _b;
|
|
3298
|
-
|
|
3298
|
+
const rt = (_a = ot.style) == null ? void 0 : _a.zIndex;
|
|
3299
|
+
return rt === "10" || rt === "50" || ((_b = ot.hasAttribute) == null ? void 0 : _b.call(ot, "data-finalizing-overlay"));
|
|
3299
3300
|
}
|
|
3300
3301
|
}), te = D.getBoundingClientRect(), Fe = te.width, Be = te.height;
|
|
3301
3302
|
let Me, Ae, be, $e;
|
|
3302
3303
|
if (J) {
|
|
3303
3304
|
const _e = oe.getContext("2d").getImageData(0, 0, oe.width, oe.height).data;
|
|
3304
|
-
let Re = oe.width, Ee = oe.height,
|
|
3305
|
+
let Re = oe.width, Ee = oe.height, it = 0, gt = 0;
|
|
3305
3306
|
for (let Ye = 0; Ye < oe.height; Ye++) for (let Xe = 0; Xe < oe.width; Xe++) {
|
|
3306
3307
|
const ro = (Ye * oe.width + Xe) * 4;
|
|
3307
|
-
_e[ro + 3] > 20 && (Xe < Re && (Re = Xe), Xe >
|
|
3308
|
+
_e[ro + 3] > 20 && (Xe < Re && (Re = Xe), Xe > it && (it = Xe), Ye < Ee && (Ee = Ye), Ye > gt && (gt = Ye));
|
|
3308
3309
|
}
|
|
3309
|
-
|
|
3310
|
+
it <= Re && (Re = 0, Ee = 0, it = oe.width, gt = oe.height), Me = Re / W, Ae = Ee / W, be = it / W, $e = gt / W;
|
|
3310
3311
|
} else {
|
|
3311
3312
|
const ot = D.querySelectorAll("[style*='pointer-events: none']");
|
|
3312
|
-
Me = 1 / 0, Ae = 1 / 0, be = -1 / 0, $e = -1 / 0, ot.forEach((
|
|
3313
|
-
const _e =
|
|
3313
|
+
Me = 1 / 0, Ae = 1 / 0, be = -1 / 0, $e = -1 / 0, ot.forEach((rt) => {
|
|
3314
|
+
const _e = rt.getBoundingClientRect();
|
|
3314
3315
|
if (_e.width === 0 || _e.height === 0) return;
|
|
3315
3316
|
const Re = _e.left - te.left, Ee = _e.top - te.top;
|
|
3316
3317
|
Re < Me && (Me = Re), Ee < Ae && (Ae = Ee), Re + _e.width > be && (be = Re + _e.width), Ee + _e.height > $e && ($e = Ee + _e.height);
|
|
@@ -3318,14 +3319,14 @@ let __tla = (async () => {
|
|
|
3318
3319
|
}
|
|
3319
3320
|
const ln = Math.max(Fe, Be) * 0.03, an = Math.max(Fe, Be) * 0.06;
|
|
3320
3321
|
Me = Math.max(0, Me - ln), Ae = Math.max(0, Ae - an), be = Math.min(Fe, be + ln), $e = Math.min(Be, $e + an);
|
|
3321
|
-
const
|
|
3322
|
-
return
|
|
3322
|
+
const Tt = (be - Me) * W, Ot = ($e - Ae) * W, no = Math.max(0, Me * W), oo = Math.max(0, Ae * W), ht = document.createElement("canvas");
|
|
3323
|
+
return ht.width = Math.round(Tt), ht.height = Math.round(Ot), ht.getContext("2d").drawImage(oe, Math.round(no), Math.round(oo), Math.round(Tt), Math.round(Ot), 0, 0, Math.round(Tt), Math.round(Ot)), ht.toDataURL("image/png");
|
|
3323
3324
|
};
|
|
3324
|
-
|
|
3325
|
-
const ge = await
|
|
3326
|
-
|
|
3327
|
-
const G = await
|
|
3328
|
-
return
|
|
3325
|
+
Dt.current && Dt.current(), await new Promise((J) => setTimeout(J, 100)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
|
|
3326
|
+
const ge = await R();
|
|
3327
|
+
P("2D"), await new Promise((J) => setTimeout(J, 200)), await new Promise((J) => requestAnimationFrame(() => requestAnimationFrame(J)));
|
|
3328
|
+
const G = await R(true);
|
|
3329
|
+
return P("3D"), {
|
|
3329
3330
|
frontal_view_png: ge,
|
|
3330
3331
|
side_view_png: G
|
|
3331
3332
|
};
|
|
@@ -3333,18 +3334,18 @@ let __tla = (async () => {
|
|
|
3333
3334
|
return;
|
|
3334
3335
|
}
|
|
3335
3336
|
}, []), Ce = Q((y) => {
|
|
3336
|
-
const D = /* @__PURE__ */ new Date(),
|
|
3337
|
-
Qt((
|
|
3338
|
-
...
|
|
3339
|
-
`[${
|
|
3337
|
+
const D = /* @__PURE__ */ new Date(), W = `${String(D.getHours()).padStart(2, "0")}:${String(D.getMinutes()).padStart(2, "0")}:${String(D.getSeconds()).padStart(2, "0")}.${String(D.getMilliseconds()).padStart(3, "0")}`;
|
|
3338
|
+
Qt((R) => [
|
|
3339
|
+
...R.slice(-200),
|
|
3340
|
+
`[${W}] ${y}`
|
|
3340
3341
|
]);
|
|
3341
|
-
}, []), { landmarkPoints: T, clearLandmarkPoints: Yn, addLandmarkPoint: en, removeLandmarkPoint: tn, updateLandmarkPositions: nn, setAligned: on, isAligned: U, setCut: rn, isCut:
|
|
3342
|
+
}, []), { landmarkPoints: T, clearLandmarkPoints: Yn, addLandmarkPoint: en, removeLandmarkPoint: tn, updateLandmarkPositions: nn, setAligned: on, isAligned: U, setCut: rn, isCut: Rt, reset: ft } = Nt();
|
|
3342
3343
|
K(() => {
|
|
3343
|
-
|
|
3344
|
+
ft();
|
|
3344
3345
|
}, [
|
|
3345
|
-
|
|
3346
|
+
ft
|
|
3346
3347
|
]);
|
|
3347
|
-
const
|
|
3348
|
+
const ut = v * yt;
|
|
3348
3349
|
K(() => {
|
|
3349
3350
|
if (!a || T.length === 0) return;
|
|
3350
3351
|
const y = T[T.length - 1];
|
|
@@ -3360,35 +3361,35 @@ let __tla = (async () => {
|
|
|
3360
3361
|
a,
|
|
3361
3362
|
Ce
|
|
3362
3363
|
]), K(() => {
|
|
3363
|
-
a &&
|
|
3364
|
+
a && Rt && Ce("STATE: mesh cut");
|
|
3364
3365
|
}, [
|
|
3365
|
-
|
|
3366
|
+
Rt,
|
|
3366
3367
|
a,
|
|
3367
3368
|
Ce
|
|
3368
3369
|
]), K(() => {
|
|
3369
|
-
|
|
3370
|
+
ct.current && (ct.current.scrollTop = ct.current.scrollHeight);
|
|
3370
3371
|
}, [
|
|
3371
|
-
|
|
3372
|
+
It
|
|
3372
3373
|
]);
|
|
3373
3374
|
const Ue = H(() => xe ? new O.Mesh(xe) : null, [
|
|
3374
3375
|
xe
|
|
3375
3376
|
]);
|
|
3376
3377
|
K(() => {
|
|
3377
|
-
o &&
|
|
3378
|
+
o && Ft(o);
|
|
3378
3379
|
}, [
|
|
3379
3380
|
o
|
|
3380
3381
|
]), K(() => {
|
|
3381
|
-
o ||
|
|
3382
|
+
o || Ft(void 0);
|
|
3382
3383
|
}, [
|
|
3383
3384
|
v
|
|
3384
3385
|
]);
|
|
3385
|
-
const
|
|
3386
|
+
const pt = ie(false);
|
|
3386
3387
|
K(() => {
|
|
3387
|
-
if (!U || j.length === 0 ||
|
|
3388
|
-
|
|
3388
|
+
if (!U || j.length === 0 || pt.current || !c) return;
|
|
3389
|
+
pt.current = true;
|
|
3389
3390
|
const y = T.length >= 3 ? Math.abs(T[2].position.y - T[0].position.y) : null;
|
|
3390
3391
|
c("dimensions_calculated", {
|
|
3391
|
-
spacing_type:
|
|
3392
|
+
spacing_type: L,
|
|
3392
3393
|
source_unit: "mm",
|
|
3393
3394
|
file_format: Ve,
|
|
3394
3395
|
measurement_source: "scan_derived",
|
|
@@ -3396,9 +3397,9 @@ let __tla = (async () => {
|
|
|
3396
3397
|
is_unit_converted: false,
|
|
3397
3398
|
form_measurements: (ve == null ? void 0 : ve.filter((D) => D != null)) ?? null,
|
|
3398
3399
|
scan_measurements: j.map((D) => +(D.modifiedValue ?? D.originalValue).toFixed(1)),
|
|
3399
|
-
measurement_variance: ve ? j.map((D,
|
|
3400
|
-
const
|
|
3401
|
-
return
|
|
3400
|
+
measurement_variance: ve ? j.map((D, W) => {
|
|
3401
|
+
const R = ve[W];
|
|
3402
|
+
return R == null ? null : +((D.modifiedValue ?? D.originalValue) - R).toFixed(1);
|
|
3402
3403
|
}) : null,
|
|
3403
3404
|
frontal_height: y !== null ? +y.toFixed(1) : null
|
|
3404
3405
|
});
|
|
@@ -3412,26 +3413,26 @@ let __tla = (async () => {
|
|
|
3412
3413
|
]);
|
|
3413
3414
|
const tt = Q((y, D) => {
|
|
3414
3415
|
y.computeBoundingBox();
|
|
3415
|
-
const
|
|
3416
|
-
|
|
3416
|
+
const W = y.boundingBox, R = new M();
|
|
3417
|
+
W.getCenter(R), y.translate(-R.x, -R.y, -R.z), y.computeBoundingBox();
|
|
3417
3418
|
const ge = y.boundingBox, G = new M();
|
|
3418
3419
|
ge.getSize(G), f(Math.max(G.x, G.y, G.z));
|
|
3419
3420
|
const J = new O.Mesh(y, new O.MeshStandardMaterial({
|
|
3420
3421
|
color: 8947848,
|
|
3421
3422
|
side: O.DoubleSide
|
|
3422
3423
|
}));
|
|
3423
|
-
m(J), fe(D), ee(true), pe(false),
|
|
3424
|
+
m(J), fe(D), ee(true), pe(false), dt.current = false;
|
|
3424
3425
|
}, []), Oe = Q(async (y, D) => {
|
|
3425
3426
|
De(null);
|
|
3426
|
-
const
|
|
3427
|
-
if (!
|
|
3427
|
+
const W = D.toLowerCase(), R = W.endsWith(".stl");
|
|
3428
|
+
if (!W.endsWith(".obj") && !R) {
|
|
3428
3429
|
De("Unsupported file format. Please use OBJ or STL.");
|
|
3429
3430
|
return;
|
|
3430
3431
|
}
|
|
3431
|
-
Kt(
|
|
3432
|
+
Kt(R ? "stl" : "obj"), p(true), b("Processing file..."), Ce(`FILE_LOAD: ${D} (${R ? "STL" : "OBJ"})`);
|
|
3432
3433
|
try {
|
|
3433
3434
|
let G;
|
|
3434
|
-
if (
|
|
3435
|
+
if (R) if (b("Converting STL..."), y instanceof ArrayBuffer) {
|
|
3435
3436
|
const te = new Blob([
|
|
3436
3437
|
y
|
|
3437
3438
|
]), Fe = new File([
|
|
@@ -3477,13 +3478,13 @@ let __tla = (async () => {
|
|
|
3477
3478
|
try {
|
|
3478
3479
|
const D = await fetch(n);
|
|
3479
3480
|
if (!D.ok) throw new Error(`Failed to download scan: ${D.status}`);
|
|
3480
|
-
const
|
|
3481
|
-
if (
|
|
3481
|
+
const R = new URL(n).pathname.split("/").pop() || "scan.obj";
|
|
3482
|
+
if (R.toLowerCase().endsWith(".stl")) {
|
|
3482
3483
|
const G = await D.arrayBuffer();
|
|
3483
|
-
await Oe(G,
|
|
3484
|
+
await Oe(G, R);
|
|
3484
3485
|
} else {
|
|
3485
3486
|
const G = await D.text();
|
|
3486
|
-
await Oe(G,
|
|
3487
|
+
await Oe(G, R);
|
|
3487
3488
|
}
|
|
3488
3489
|
} catch (D) {
|
|
3489
3490
|
De(D instanceof Error ? D.message : "Failed to load scan from URL."), p(false), b("");
|
|
@@ -3504,22 +3505,22 @@ let __tla = (async () => {
|
|
|
3504
3505
|
}
|
|
3505
3506
|
const D = y.dataTransfer.files[0];
|
|
3506
3507
|
if (!D) return;
|
|
3507
|
-
const
|
|
3508
|
-
if (!
|
|
3508
|
+
const W = D.name.toLowerCase();
|
|
3509
|
+
if (!W.endsWith(".obj") && !W.endsWith(".stl")) {
|
|
3509
3510
|
De("Please drop an OBJ or STL file.");
|
|
3510
3511
|
return;
|
|
3511
3512
|
}
|
|
3512
|
-
if (
|
|
3513
|
+
if (W.endsWith(".stl")) {
|
|
3513
3514
|
Kt("stl"), p(true), b("Converting STL...");
|
|
3514
3515
|
try {
|
|
3515
|
-
const
|
|
3516
|
-
await Oe(
|
|
3517
|
-
} catch (
|
|
3518
|
-
De(
|
|
3516
|
+
const R = await $t(D);
|
|
3517
|
+
await Oe(R, D.name.replace(/\.stl$/i, ".obj"));
|
|
3518
|
+
} catch (R) {
|
|
3519
|
+
De(R instanceof Error ? R.message : "Failed to process STL file."), p(false), b("");
|
|
3519
3520
|
}
|
|
3520
3521
|
} else {
|
|
3521
|
-
const
|
|
3522
|
-
await Oe(
|
|
3522
|
+
const R = await D.text();
|
|
3523
|
+
await Oe(R, D.name);
|
|
3523
3524
|
}
|
|
3524
3525
|
}, [
|
|
3525
3526
|
Te,
|
|
@@ -3537,13 +3538,13 @@ let __tla = (async () => {
|
|
|
3537
3538
|
Ve
|
|
3538
3539
|
]);
|
|
3539
3540
|
K(() => {
|
|
3540
|
-
if (!e || T.length !== 1 || !Ne.current ||
|
|
3541
|
-
|
|
3542
|
-
const y = T[0], D = Ne.current,
|
|
3541
|
+
if (!e || T.length !== 1 || !Ne.current || dt.current) return;
|
|
3542
|
+
dt.current = true;
|
|
3543
|
+
const y = T[0], D = Ne.current, W = e.geometry, { positions: R, indices: ge } = wt(W), G = new Float32Array([
|
|
3543
3544
|
y.position.x,
|
|
3544
3545
|
y.position.y,
|
|
3545
3546
|
y.position.z
|
|
3546
|
-
]), J = D.detect_shell(
|
|
3547
|
+
]), J = D.detect_shell(R, ge, G, 40), oe = J.details(), te = J.is_double_shell();
|
|
3547
3548
|
Ce(`SHELL_DETECT: ${te ? "DOUBLE" : "SINGLE"} \u2014 ${oe}`), te && (ue(true), re(true), Ce(`SHELL_DETECT: double shell, thickness=${J.thickness().toFixed(1)}mm`));
|
|
3548
3549
|
}, [
|
|
3549
3550
|
e,
|
|
@@ -3560,38 +3561,38 @@ let __tla = (async () => {
|
|
|
3560
3561
|
T[0],
|
|
3561
3562
|
...T.slice(2)
|
|
3562
3563
|
];
|
|
3563
|
-
ko(e, D,
|
|
3564
|
-
onStatus: (
|
|
3565
|
-
ye(
|
|
3564
|
+
ko(e, D, yt, {
|
|
3565
|
+
onStatus: (W) => {
|
|
3566
|
+
ye(W), Ce(`PIPELINE: ${W}`);
|
|
3566
3567
|
},
|
|
3567
3568
|
addLandmarkPoint: en,
|
|
3568
3569
|
removeLandmarkPoint: tn,
|
|
3569
|
-
updateLandmarkPositions: (
|
|
3570
|
-
const
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
...
|
|
3570
|
+
updateLandmarkPositions: (W) => {
|
|
3571
|
+
const R = [
|
|
3572
|
+
W[1],
|
|
3573
|
+
W[0],
|
|
3574
|
+
...W.slice(2)
|
|
3574
3575
|
];
|
|
3575
|
-
nn(
|
|
3576
|
+
nn(R);
|
|
3576
3577
|
},
|
|
3577
3578
|
setAligned: on,
|
|
3578
3579
|
setCut: rn,
|
|
3579
3580
|
setModelSize: f,
|
|
3580
3581
|
setOriginalEndY: Yt,
|
|
3581
3582
|
setAdjustedStartY: le,
|
|
3582
|
-
setAdjustedEndY:
|
|
3583
|
+
setAdjustedEndY: Mt,
|
|
3583
3584
|
setError: De,
|
|
3584
|
-
setDoubleShell: (
|
|
3585
|
-
ue(
|
|
3585
|
+
setDoubleShell: (W) => {
|
|
3586
|
+
ue(W), re(true);
|
|
3586
3587
|
},
|
|
3587
|
-
setAoData: (
|
|
3588
|
-
he(
|
|
3588
|
+
setAoData: (W, R) => {
|
|
3589
|
+
he(W), ne(R ?? null);
|
|
3589
3590
|
},
|
|
3590
3591
|
setInnerShellExtracted: pe,
|
|
3591
3592
|
setMeasurementGeometry: Se,
|
|
3592
|
-
setWasmSlices:
|
|
3593
|
+
setWasmSlices: Le,
|
|
3593
3594
|
wasmModule: Ne.current ?? void 0
|
|
3594
|
-
}), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`),
|
|
3595
|
+
}), Ce(`PIPELINE: completed in ${(performance.now() - y).toFixed(0)}ms`), pt.current = false, Y(false);
|
|
3595
3596
|
}, 50);
|
|
3596
3597
|
}, [
|
|
3597
3598
|
e,
|
|
@@ -3602,14 +3603,14 @@ let __tla = (async () => {
|
|
|
3602
3603
|
tn,
|
|
3603
3604
|
rn,
|
|
3604
3605
|
Z
|
|
3605
|
-
]),
|
|
3606
|
-
if (
|
|
3606
|
+
]), Wt = ie(false), Jn = Q(async () => {
|
|
3607
|
+
if (ft(), N([]), Le(null), Se(null), le(null), Mt(null), Gt(null), Yt(null), st(false), Ut(false), Lt(true), ue(false), pe(false), dt.current = false, Wt.current = false, pt.current = false, P("3D"), n && Te) {
|
|
3607
3608
|
m(null);
|
|
3608
3609
|
try {
|
|
3609
3610
|
const y = await fetch(n);
|
|
3610
3611
|
if (!y.ok) throw new Error(`Failed to download scan: ${y.status}`);
|
|
3611
|
-
const
|
|
3612
|
-
|
|
3612
|
+
const W = new URL(n).pathname.split("/").pop() || "scan.obj";
|
|
3613
|
+
W.toLowerCase().endsWith(".stl") ? await Oe(await y.arrayBuffer(), W) : await Oe(await y.text(), W);
|
|
3613
3614
|
} catch (y) {
|
|
3614
3615
|
De(y instanceof Error ? y.message : "Failed to reload scan.");
|
|
3615
3616
|
}
|
|
@@ -3618,10 +3619,10 @@ let __tla = (async () => {
|
|
|
3618
3619
|
n,
|
|
3619
3620
|
Te,
|
|
3620
3621
|
Oe,
|
|
3621
|
-
|
|
3622
|
+
ft
|
|
3622
3623
|
]);
|
|
3623
3624
|
K(() => {
|
|
3624
|
-
U && j.length > 0 && !
|
|
3625
|
+
U && j.length > 0 && !Wt.current && (Wt.current = true, st(true));
|
|
3625
3626
|
}, [
|
|
3626
3627
|
U,
|
|
3627
3628
|
j.length
|
|
@@ -3639,18 +3640,15 @@ let __tla = (async () => {
|
|
|
3639
3640
|
T,
|
|
3640
3641
|
X
|
|
3641
3642
|
]), Qn = Q((y) => {
|
|
3642
|
-
En(y),
|
|
3643
|
+
En(y), Ft(y.circumferences), Lt(true), Ut(true);
|
|
3643
3644
|
}, []), sn = Q(async (y) => {
|
|
3644
3645
|
if (!s) return;
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
new Promise((R) => setTimeout(() => R(void 0), 8e3))
|
|
3648
|
-
]).catch(() => {
|
|
3646
|
+
st(false), Pt(false), at(true);
|
|
3647
|
+
const D = e ? await et().catch(() => {
|
|
3649
3648
|
}) : void 0;
|
|
3650
|
-
it(false), Pt(false), lt(true);
|
|
3651
3649
|
try {
|
|
3652
3650
|
s({
|
|
3653
|
-
spacingType:
|
|
3651
|
+
spacingType: L ?? "BK",
|
|
3654
3652
|
sourceUnit: "mm",
|
|
3655
3653
|
fileFormat: Ve,
|
|
3656
3654
|
measurementSource: "form_provided",
|
|
@@ -3667,12 +3665,12 @@ let __tla = (async () => {
|
|
|
3667
3665
|
screenshots: D
|
|
3668
3666
|
});
|
|
3669
3667
|
} finally {
|
|
3670
|
-
|
|
3668
|
+
at(false);
|
|
3671
3669
|
}
|
|
3672
3670
|
}, [
|
|
3673
3671
|
s,
|
|
3674
3672
|
e,
|
|
3675
|
-
|
|
3673
|
+
L,
|
|
3676
3674
|
Ve,
|
|
3677
3675
|
X,
|
|
3678
3676
|
ve,
|
|
@@ -3680,43 +3678,40 @@ let __tla = (async () => {
|
|
|
3680
3678
|
nt,
|
|
3681
3679
|
n,
|
|
3682
3680
|
et
|
|
3683
|
-
]),
|
|
3681
|
+
]), Bt = ie(null);
|
|
3684
3682
|
K(() => {
|
|
3685
3683
|
if (!e || !U) {
|
|
3686
|
-
|
|
3684
|
+
Bt.current = null;
|
|
3687
3685
|
return;
|
|
3688
3686
|
}
|
|
3689
3687
|
const y = (Ue ?? e).geometry;
|
|
3690
|
-
|
|
3688
|
+
Bt.current = jt(y);
|
|
3691
3689
|
}, [
|
|
3692
3690
|
e,
|
|
3693
3691
|
U,
|
|
3694
3692
|
Ue
|
|
3695
3693
|
]);
|
|
3696
|
-
const
|
|
3697
|
-
if (!s || !e || j.length === 0 || !
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
new Promise((R) => setTimeout(() => R(void 0), 8e3))
|
|
3701
|
-
]).catch(() => {
|
|
3694
|
+
const Et = Q(async (y) => {
|
|
3695
|
+
if (!s || !e || j.length === 0 || !L) return;
|
|
3696
|
+
at(true);
|
|
3697
|
+
const D = await et().catch(() => {
|
|
3702
3698
|
});
|
|
3703
|
-
lt(true);
|
|
3704
3699
|
try {
|
|
3705
|
-
let
|
|
3700
|
+
let W = 0, R = 0;
|
|
3706
3701
|
if (T.length >= 2) {
|
|
3707
3702
|
const ge = (Ue ?? e).geometry, J = T[0].position.y;
|
|
3708
3703
|
try {
|
|
3709
|
-
const oe =
|
|
3704
|
+
const oe = Bt.current ?? jt(ge), te = Ge(oe, ge, J);
|
|
3710
3705
|
if (te.linePoints.length >= 2) {
|
|
3711
3706
|
let Fe = te.linePoints[0], Be = te.linePoints[0], Me = te.linePoints[0], Ae = te.linePoints[0];
|
|
3712
3707
|
for (const be of te.linePoints) be.x < Fe.x && (Fe = be), be.x > Be.x && (Be = be), be.z < Me.z && (Me = be), be.z > Ae.z && (Ae = be);
|
|
3713
|
-
|
|
3708
|
+
W = new M(Fe.x, J, Fe.z).distanceTo(new M(Be.x, J, Be.z)), R = new M(Me.x, J, Me.z).distanceTo(new M(Ae.x, J, Ae.z));
|
|
3714
3709
|
}
|
|
3715
3710
|
} catch {
|
|
3716
3711
|
}
|
|
3717
3712
|
}
|
|
3718
3713
|
s({
|
|
3719
|
-
spacingType:
|
|
3714
|
+
spacingType: L,
|
|
3720
3715
|
sourceUnit: "mm",
|
|
3721
3716
|
fileFormat: Ve,
|
|
3722
3717
|
measurementSource: y === "use_form_measurements" ? "form_provided" : "scan_derived",
|
|
@@ -3725,22 +3720,22 @@ let __tla = (async () => {
|
|
|
3725
3720
|
formMeasurements: ve,
|
|
3726
3721
|
scanMeasurements: j,
|
|
3727
3722
|
frontalHeight: (qe == null ? void 0 : qe.frontalHeight) ?? nt,
|
|
3728
|
-
transverseML:
|
|
3729
|
-
transverseAP:
|
|
3723
|
+
transverseML: W,
|
|
3724
|
+
transverseAP: R,
|
|
3730
3725
|
scanUrl: n,
|
|
3731
3726
|
decision: y,
|
|
3732
3727
|
userEnteredMeasurements: qe ?? void 0,
|
|
3733
3728
|
screenshots: D
|
|
3734
3729
|
});
|
|
3735
3730
|
} finally {
|
|
3736
|
-
|
|
3731
|
+
at(false);
|
|
3737
3732
|
}
|
|
3738
3733
|
}, [
|
|
3739
3734
|
s,
|
|
3740
3735
|
e,
|
|
3741
3736
|
Ue,
|
|
3742
3737
|
j,
|
|
3743
|
-
|
|
3738
|
+
L,
|
|
3744
3739
|
T,
|
|
3745
3740
|
Ve,
|
|
3746
3741
|
X,
|
|
@@ -3754,22 +3749,22 @@ let __tla = (async () => {
|
|
|
3754
3749
|
const y = Math.min(ve.length, j.length);
|
|
3755
3750
|
if (y === 0) return false;
|
|
3756
3751
|
for (let D = 0; D < y; D++) {
|
|
3757
|
-
const
|
|
3758
|
-
if (!
|
|
3759
|
-
const ge =
|
|
3760
|
-
if (Math.abs(ge -
|
|
3752
|
+
const W = ve[D], R = j[D];
|
|
3753
|
+
if (!R || W == null || W === 0) continue;
|
|
3754
|
+
const ge = R.modifiedValue ?? R.originalValue;
|
|
3755
|
+
if (Math.abs(ge - W) > 7) return false;
|
|
3761
3756
|
}
|
|
3762
3757
|
return true;
|
|
3763
3758
|
}, [
|
|
3764
3759
|
ve,
|
|
3765
3760
|
j
|
|
3766
|
-
]), eo =
|
|
3761
|
+
]), eo = lt ? 5 : U && je || U ? 4 : e ? T.length === 0 ? 2 : 3 : 1, to = [
|
|
3767
3762
|
{
|
|
3768
3763
|
label: "Load File",
|
|
3769
3764
|
number: 1
|
|
3770
3765
|
},
|
|
3771
3766
|
{
|
|
3772
|
-
label:
|
|
3767
|
+
label: L === "AK" ? "Set IT" : "Set MPT",
|
|
3773
3768
|
number: 2
|
|
3774
3769
|
},
|
|
3775
3770
|
{
|
|
@@ -3837,7 +3832,7 @@ let __tla = (async () => {
|
|
|
3837
3832
|
minHeight: 0
|
|
3838
3833
|
},
|
|
3839
3834
|
children: [
|
|
3840
|
-
U && je &&
|
|
3835
|
+
U && je && L && i("div", {
|
|
3841
3836
|
style: {
|
|
3842
3837
|
width: 340,
|
|
3843
3838
|
flexShrink: 0,
|
|
@@ -3845,7 +3840,7 @@ let __tla = (async () => {
|
|
|
3845
3840
|
overflow: "hidden"
|
|
3846
3841
|
},
|
|
3847
3842
|
children: i(er, {
|
|
3848
|
-
amputationType:
|
|
3843
|
+
amputationType: L,
|
|
3849
3844
|
spacingInches: v,
|
|
3850
3845
|
scanMeasurements: j,
|
|
3851
3846
|
scanFrontalHeight: nt,
|
|
@@ -3858,7 +3853,7 @@ let __tla = (async () => {
|
|
|
3858
3853
|
})
|
|
3859
3854
|
}),
|
|
3860
3855
|
F("div", {
|
|
3861
|
-
ref:
|
|
3856
|
+
ref: _t,
|
|
3862
3857
|
style: {
|
|
3863
3858
|
flex: 1,
|
|
3864
3859
|
position: "relative",
|
|
@@ -3918,7 +3913,7 @@ let __tla = (async () => {
|
|
|
3918
3913
|
]
|
|
3919
3914
|
})
|
|
3920
3915
|
}),
|
|
3921
|
-
!t.showDragDrop && !e && !S && !
|
|
3916
|
+
!t.showDragDrop && !e && !S && !kt && i("div", {
|
|
3922
3917
|
style: {
|
|
3923
3918
|
position: "absolute",
|
|
3924
3919
|
inset: 0,
|
|
@@ -3985,7 +3980,7 @@ let __tla = (async () => {
|
|
|
3985
3980
|
}
|
|
3986
3981
|
}),
|
|
3987
3982
|
"Click mesh to set ",
|
|
3988
|
-
|
|
3983
|
+
L === "AK" ? "IT" : "MPT"
|
|
3989
3984
|
]
|
|
3990
3985
|
}),
|
|
3991
3986
|
e && !U && T.length === 1 && F("div", {
|
|
@@ -4025,8 +4020,8 @@ let __tla = (async () => {
|
|
|
4025
4020
|
V && i(un, {
|
|
4026
4021
|
message: q
|
|
4027
4022
|
}),
|
|
4028
|
-
|
|
4029
|
-
message:
|
|
4023
|
+
kt && i(Lo, {
|
|
4024
|
+
message: kt,
|
|
4030
4025
|
onDismiss: () => De(null)
|
|
4031
4026
|
}),
|
|
4032
4027
|
t.showAmputationModal && w && i("div", {
|
|
@@ -4090,15 +4085,15 @@ let __tla = (async () => {
|
|
|
4090
4085
|
border: "2px solid",
|
|
4091
4086
|
borderRadius: 4,
|
|
4092
4087
|
cursor: "pointer",
|
|
4093
|
-
borderColor:
|
|
4094
|
-
backgroundColor:
|
|
4088
|
+
borderColor: L === y ? "rgb(12, 67, 173)" : "#e0e0e0",
|
|
4089
|
+
backgroundColor: L === y ? "rgba(12, 67, 173, 0.04)" : "#fff",
|
|
4095
4090
|
transition: "border-color 0.15s, background-color 0.15s"
|
|
4096
4091
|
},
|
|
4097
4092
|
children: [
|
|
4098
4093
|
i("input", {
|
|
4099
4094
|
type: "radio",
|
|
4100
4095
|
name: "ampType",
|
|
4101
|
-
checked:
|
|
4096
|
+
checked: L === y,
|
|
4102
4097
|
onChange: () => I(y),
|
|
4103
4098
|
style: {
|
|
4104
4099
|
accentColor: "rgb(12, 67, 173)",
|
|
@@ -4160,17 +4155,17 @@ let __tla = (async () => {
|
|
|
4160
4155
|
children: "Cancel"
|
|
4161
4156
|
}),
|
|
4162
4157
|
i("button", {
|
|
4163
|
-
onClick: () =>
|
|
4164
|
-
disabled: !
|
|
4158
|
+
onClick: () => L && Kn(L),
|
|
4159
|
+
disabled: !L,
|
|
4165
4160
|
style: {
|
|
4166
4161
|
padding: "6px 16px",
|
|
4167
4162
|
borderRadius: 4,
|
|
4168
4163
|
fontSize: 14,
|
|
4169
4164
|
fontWeight: 500,
|
|
4170
|
-
backgroundColor:
|
|
4165
|
+
backgroundColor: L ? "rgb(12, 67, 173)" : "#e0e0e0",
|
|
4171
4166
|
border: "none",
|
|
4172
|
-
color:
|
|
4173
|
-
cursor:
|
|
4167
|
+
color: L ? "#fff" : "#9e9e9e",
|
|
4168
|
+
cursor: L ? "pointer" : "not-allowed",
|
|
4174
4169
|
fontFamily: "system-ui, sans-serif",
|
|
4175
4170
|
lineHeight: "36px",
|
|
4176
4171
|
letterSpacing: "0.4px"
|
|
@@ -4251,7 +4246,7 @@ let __tla = (async () => {
|
|
|
4251
4246
|
e && A === "3D" && i(_o, {
|
|
4252
4247
|
modelSize: d,
|
|
4253
4248
|
labels: [
|
|
4254
|
-
|
|
4249
|
+
L === "AK" ? "IT" : "MPT",
|
|
4255
4250
|
"Origin",
|
|
4256
4251
|
"Cut Plane"
|
|
4257
4252
|
]
|
|
@@ -4259,13 +4254,13 @@ let __tla = (async () => {
|
|
|
4259
4254
|
i(Vo, {
|
|
4260
4255
|
modelSize: d,
|
|
4261
4256
|
isAligned: U,
|
|
4262
|
-
isCut:
|
|
4257
|
+
isCut: Rt,
|
|
4263
4258
|
mesh: e,
|
|
4264
4259
|
viewMode: A,
|
|
4265
|
-
sliceY: U && T.length >= 2 ? ke ??
|
|
4260
|
+
sliceY: U && T.length >= 2 ? ke ?? zt ?? T[0].position.y : void 0,
|
|
4266
4261
|
landmarkCount: T.length,
|
|
4267
4262
|
measurementGeometry: xe,
|
|
4268
|
-
resetCameraToFrontRef:
|
|
4263
|
+
resetCameraToFrontRef: Dt
|
|
4269
4264
|
}),
|
|
4270
4265
|
!U && i(yn, {
|
|
4271
4266
|
enableDamping: false
|
|
@@ -4277,11 +4272,11 @@ let __tla = (async () => {
|
|
|
4277
4272
|
e && U && T.length >= 3 && (() => {
|
|
4278
4273
|
const D = e.geometry.getIndex();
|
|
4279
4274
|
if (!D || D.count < 30) return null;
|
|
4280
|
-
const
|
|
4275
|
+
const W = T[2], R = T[0], ge = Ke ?? W.position.y, G = ke ?? zt ?? R.position.y;
|
|
4281
4276
|
return A === "2D" ? i(Go, {
|
|
4282
4277
|
mesh: Ue ?? e,
|
|
4283
4278
|
upperY: G,
|
|
4284
|
-
originY:
|
|
4279
|
+
originY: R.position.y,
|
|
4285
4280
|
modelSize: d,
|
|
4286
4281
|
meshColor: Jt,
|
|
4287
4282
|
displayUnit: _
|
|
@@ -4291,39 +4286,39 @@ let __tla = (async () => {
|
|
|
4291
4286
|
mesh: Ue ?? e,
|
|
4292
4287
|
startY: ge,
|
|
4293
4288
|
endY: G,
|
|
4294
|
-
spacing:
|
|
4289
|
+
spacing: ut,
|
|
4295
4290
|
modelSize: d,
|
|
4296
4291
|
onMeasurementsChange: N,
|
|
4297
4292
|
reverseOrder: true,
|
|
4298
4293
|
displayUnit: _,
|
|
4299
4294
|
useInnerSurface: X && !Z,
|
|
4300
4295
|
formMeasurements: je ? Tn ?? ve : Qe ? ve : void 0,
|
|
4301
|
-
originY:
|
|
4296
|
+
originY: At ?? R.position.y,
|
|
4302
4297
|
wasmSlices: Ie
|
|
4303
4298
|
}),
|
|
4304
4299
|
i(Ho, {
|
|
4305
4300
|
mesh: e,
|
|
4306
|
-
greenY:
|
|
4301
|
+
greenY: At ?? R.position.y,
|
|
4307
4302
|
modelSize: d,
|
|
4308
4303
|
displayUnit: _,
|
|
4309
|
-
bottomY: X ?
|
|
4304
|
+
bottomY: X ? W.position.y : void 0,
|
|
4310
4305
|
formHeight: je ? $n : Qe ? qe == null ? void 0 : qe.frontalHeight : void 0
|
|
4311
4306
|
}),
|
|
4312
4307
|
i(Zo, {
|
|
4313
4308
|
mesh: e,
|
|
4314
|
-
yPosition:
|
|
4309
|
+
yPosition: At ?? R.position.y,
|
|
4315
4310
|
onYChange: (J) => {
|
|
4316
|
-
Gt(J),
|
|
4317
|
-
const oe = J -
|
|
4318
|
-
|
|
4311
|
+
Gt(J), Le(null);
|
|
4312
|
+
const oe = J - R.position.y;
|
|
4313
|
+
Mt((zt ?? R.position.y + ut * 2) + oe);
|
|
4319
4314
|
},
|
|
4320
|
-
minY:
|
|
4321
|
-
maxY:
|
|
4315
|
+
minY: R.position.y - ut,
|
|
4316
|
+
maxY: R.position.y + ut,
|
|
4322
4317
|
modelSize: d,
|
|
4323
4318
|
color: "#44ff44",
|
|
4324
4319
|
hoverColor: "#88ff88",
|
|
4325
4320
|
dragColor: "#ffffff",
|
|
4326
|
-
label:
|
|
4321
|
+
label: L === "AK" ? "IT" : "MPT",
|
|
4327
4322
|
onDragStart: () => Xt(true),
|
|
4328
4323
|
onDragEnd: () => Xt(false)
|
|
4329
4324
|
})
|
|
@@ -4396,7 +4391,7 @@ let __tla = (async () => {
|
|
|
4396
4391
|
},
|
|
4397
4392
|
children: "Reset Points"
|
|
4398
4393
|
}),
|
|
4399
|
-
U && !
|
|
4394
|
+
U && !lt && i("button", {
|
|
4400
4395
|
onClick: Jn,
|
|
4401
4396
|
style: {
|
|
4402
4397
|
padding: "6px 16px",
|
|
@@ -4443,7 +4438,7 @@ let __tla = (async () => {
|
|
|
4443
4438
|
},
|
|
4444
4439
|
children: [
|
|
4445
4440
|
i("button", {
|
|
4446
|
-
onClick: () =>
|
|
4441
|
+
onClick: () => P("3D"),
|
|
4447
4442
|
style: {
|
|
4448
4443
|
padding: "6px 14px",
|
|
4449
4444
|
fontSize: 13,
|
|
@@ -4457,7 +4452,7 @@ let __tla = (async () => {
|
|
|
4457
4452
|
children: "Orbital"
|
|
4458
4453
|
}),
|
|
4459
4454
|
i("button", {
|
|
4460
|
-
onClick: () =>
|
|
4455
|
+
onClick: () => P("2D"),
|
|
4461
4456
|
style: {
|
|
4462
4457
|
padding: "6px 14px",
|
|
4463
4458
|
fontSize: 13,
|
|
@@ -4562,7 +4557,7 @@ let __tla = (async () => {
|
|
|
4562
4557
|
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
4563
4558
|
},
|
|
4564
4559
|
children: i("button", {
|
|
4565
|
-
onClick: () =>
|
|
4560
|
+
onClick: () => Lt((y) => !y),
|
|
4566
4561
|
style: {
|
|
4567
4562
|
padding: "6px 14px",
|
|
4568
4563
|
fontSize: 13,
|
|
@@ -4588,11 +4583,11 @@ let __tla = (async () => {
|
|
|
4588
4583
|
onClick: async () => {
|
|
4589
4584
|
const y = await et();
|
|
4590
4585
|
if (!y) return;
|
|
4591
|
-
const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
4586
|
+
const D = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), W = (R, ge) => {
|
|
4592
4587
|
const G = document.createElement("a");
|
|
4593
|
-
G.href =
|
|
4588
|
+
G.href = R, G.download = ge, G.click();
|
|
4594
4589
|
};
|
|
4595
|
-
|
|
4590
|
+
W(y.frontal_view_png, `measurements_front_${D}.png`), await new Promise((R) => setTimeout(R, 300)), W(y.side_view_png, `measurements_transverse_${D}.png`);
|
|
4596
4591
|
},
|
|
4597
4592
|
style: {
|
|
4598
4593
|
padding: "6px 14px",
|
|
@@ -4735,8 +4730,8 @@ let __tla = (async () => {
|
|
|
4735
4730
|
},
|
|
4736
4731
|
children: "Next \xBB"
|
|
4737
4732
|
}),
|
|
4738
|
-
U &&
|
|
4739
|
-
onClick: () =>
|
|
4733
|
+
U && lt && !je && i("button", {
|
|
4734
|
+
onClick: () => st(true),
|
|
4740
4735
|
style: {
|
|
4741
4736
|
padding: "6px 16px",
|
|
4742
4737
|
borderRadius: 4,
|
|
@@ -4752,9 +4747,9 @@ let __tla = (async () => {
|
|
|
4752
4747
|
},
|
|
4753
4748
|
children: "Edit Measurements"
|
|
4754
4749
|
}),
|
|
4755
|
-
U &&
|
|
4750
|
+
U && lt && (qn ? i("button", {
|
|
4756
4751
|
disabled: ze,
|
|
4757
|
-
onClick: () =>
|
|
4752
|
+
onClick: () => Et("continue"),
|
|
4758
4753
|
style: {
|
|
4759
4754
|
padding: "6px 16px",
|
|
4760
4755
|
borderRadius: 4,
|
|
@@ -4773,7 +4768,7 @@ let __tla = (async () => {
|
|
|
4773
4768
|
children: [
|
|
4774
4769
|
i("button", {
|
|
4775
4770
|
disabled: ze,
|
|
4776
|
-
onClick: () =>
|
|
4771
|
+
onClick: () => Et("use_form_measurements"),
|
|
4777
4772
|
style: {
|
|
4778
4773
|
padding: "6px 16px",
|
|
4779
4774
|
borderRadius: 4,
|
|
@@ -4791,7 +4786,7 @@ let __tla = (async () => {
|
|
|
4791
4786
|
}),
|
|
4792
4787
|
i("button", {
|
|
4793
4788
|
disabled: ze,
|
|
4794
|
-
onClick: () =>
|
|
4789
|
+
onClick: () => Et("use_scan"),
|
|
4795
4790
|
style: {
|
|
4796
4791
|
padding: "6px 16px",
|
|
4797
4792
|
borderRadius: 4,
|
|
@@ -4815,7 +4810,7 @@ let __tla = (async () => {
|
|
|
4815
4810
|
})
|
|
4816
4811
|
]
|
|
4817
4812
|
}),
|
|
4818
|
-
a &&
|
|
4813
|
+
a && It.length > 0 && F("div", {
|
|
4819
4814
|
style: {
|
|
4820
4815
|
height: 120,
|
|
4821
4816
|
flexShrink: 0,
|
|
@@ -4890,18 +4885,18 @@ let __tla = (async () => {
|
|
|
4890
4885
|
]
|
|
4891
4886
|
}),
|
|
4892
4887
|
i("div", {
|
|
4893
|
-
ref:
|
|
4888
|
+
ref: ct,
|
|
4894
4889
|
style: {
|
|
4895
4890
|
flex: 1,
|
|
4896
4891
|
overflowY: "auto",
|
|
4897
4892
|
padding: "4px 10px",
|
|
4898
4893
|
lineHeight: 1.6
|
|
4899
4894
|
},
|
|
4900
|
-
children:
|
|
4901
|
-
const
|
|
4895
|
+
children: It.map((y, D) => {
|
|
4896
|
+
const W = y.includes("ERROR") || y.includes("failed"), R = y.includes("warning") || y.includes("WARN"), ge = y.includes("PIPELINE:"), G = y.includes("STATE:");
|
|
4902
4897
|
return i("div", {
|
|
4903
4898
|
style: {
|
|
4904
|
-
color:
|
|
4899
|
+
color: W ? "#f85149" : R ? "#d29922" : ge ? "#58a6ff" : G ? "#3fb950" : "#8b949e",
|
|
4905
4900
|
whiteSpace: "pre"
|
|
4906
4901
|
},
|
|
4907
4902
|
children: y
|
|
@@ -4945,7 +4940,7 @@ let __tla = (async () => {
|
|
|
4945
4940
|
]) n.push(`${o}_below`);
|
|
4946
4941
|
return n;
|
|
4947
4942
|
};
|
|
4948
|
-
|
|
4943
|
+
bt = function(t, r) {
|
|
4949
4944
|
const n = Dn(r), o = {};
|
|
4950
4945
|
for (let s = 0; s < Math.min(t.length, n.length); s++) {
|
|
4951
4946
|
const a = t[s];
|
|
@@ -4961,7 +4956,7 @@ let __tla = (async () => {
|
|
|
4961
4956
|
});
|
|
4962
4957
|
if (!o.every((s) => s == null)) return o;
|
|
4963
4958
|
};
|
|
4964
|
-
|
|
4959
|
+
Lr = ({ request: t, onComplete: r, wasmModule: n }) => {
|
|
4965
4960
|
const [o, s] = B(null);
|
|
4966
4961
|
K(() => {
|
|
4967
4962
|
if (n != null) return;
|
|
@@ -4988,18 +4983,18 @@ let __tla = (async () => {
|
|
|
4988
4983
|
t.spacing_type
|
|
4989
4984
|
]), l = (e) => {
|
|
4990
4985
|
var _a, _b;
|
|
4991
|
-
const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d =
|
|
4986
|
+
const m = e.scanMeasurements.map((A) => +(A.modifiedValue ?? A.originalValue).toFixed(1)), d = bt(m, t.spacing_type);
|
|
4992
4987
|
let f, u;
|
|
4993
4988
|
if (e.formMeasurements) {
|
|
4994
|
-
f =
|
|
4995
|
-
const A = e.scanMeasurements.map((
|
|
4989
|
+
f = bt(e.formMeasurements, t.spacing_type);
|
|
4990
|
+
const A = e.scanMeasurements.map((P, v) => {
|
|
4996
4991
|
var _a2;
|
|
4997
4992
|
const k = (_a2 = e.formMeasurements) == null ? void 0 : _a2[v];
|
|
4998
|
-
return k == null || isNaN(k) ? null : +((
|
|
4993
|
+
return k == null || isNaN(k) ? null : +((P.modifiedValue ?? P.originalValue) - k).toFixed(1);
|
|
4999
4994
|
});
|
|
5000
|
-
u =
|
|
4995
|
+
u = bt(A, t.spacing_type);
|
|
5001
4996
|
}
|
|
5002
|
-
const x = e.userEnteredMeasurements ?
|
|
4997
|
+
const x = e.userEnteredMeasurements ? bt(e.userEnteredMeasurements.circumferences, t.spacing_type) : void 0, S = e.decision === "use_scan" || e.decision === "continue", p = S ? d : x ?? f ?? d, g = S ? +e.frontalHeight.toFixed(1) : +(((_a = e.userEnteredMeasurements) == null ? void 0 : _a.frontalHeight) ?? e.frontalHeight).toFixed(1), b = {
|
|
5003
4998
|
spacing_type: t.spacing_type,
|
|
5004
4999
|
source_unit: "mm",
|
|
5005
5000
|
file_format: e.fileFormat,
|
|
@@ -5043,9 +5038,9 @@ let __tla = (async () => {
|
|
|
5043
5038
|
};
|
|
5044
5039
|
})();
|
|
5045
5040
|
export {
|
|
5046
|
-
|
|
5041
|
+
Lr as G,
|
|
5047
5042
|
__tla,
|
|
5048
|
-
|
|
5043
|
+
bt as a,
|
|
5049
5044
|
br as c,
|
|
5050
5045
|
Dn as g
|
|
5051
5046
|
};
|