okgeometry-api 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Mesh.d.ts +3 -0
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +60 -1
- package/dist/Mesh.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.js +1 -1
- package/package.json +1 -1
- package/src/Mesh.ts +77 -1
- package/src/wasm-base64.ts +1 -1
- package/wasm/okgeometrycore.js +1 -1
- package/wasm/okgeometrycore_bg.wasm +0 -0
- package/wasm/package.json +1 -1
package/package.json
CHANGED
package/src/Mesh.ts
CHANGED
|
@@ -376,6 +376,65 @@ export class Mesh {
|
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
private static roundDebugScalar(value: number): number {
|
|
380
|
+
return Number.isFinite(value) ? Number(value.toFixed(4)) : value;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private static summarizeDebugHit(hit: MeshDebugRayHit | undefined): {
|
|
384
|
+
point: { x: number; y: number; z: number };
|
|
385
|
+
normal: { x: number; y: number; z: number };
|
|
386
|
+
faceIndex: number;
|
|
387
|
+
distance: number;
|
|
388
|
+
} | null {
|
|
389
|
+
if (!hit) return null;
|
|
390
|
+
return {
|
|
391
|
+
point: {
|
|
392
|
+
x: Mesh.roundDebugScalar(hit.point.x),
|
|
393
|
+
y: Mesh.roundDebugScalar(hit.point.y),
|
|
394
|
+
z: Mesh.roundDebugScalar(hit.point.z),
|
|
395
|
+
},
|
|
396
|
+
normal: {
|
|
397
|
+
x: Mesh.roundDebugScalar(hit.normal.x),
|
|
398
|
+
y: Mesh.roundDebugScalar(hit.normal.y),
|
|
399
|
+
z: Mesh.roundDebugScalar(hit.normal.z),
|
|
400
|
+
},
|
|
401
|
+
faceIndex: hit.faceIndex,
|
|
402
|
+
distance: Mesh.roundDebugScalar(hit.distance),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
private static summarizeDebugProbe(probe: MeshBooleanDebugProbe): {
|
|
407
|
+
label: string;
|
|
408
|
+
origin: { x: number; y: number; z: number };
|
|
409
|
+
direction: { x: number; y: number; z: number };
|
|
410
|
+
inputAFirst: ReturnType<typeof Mesh.summarizeDebugHit>;
|
|
411
|
+
inputBFirst: ReturnType<typeof Mesh.summarizeDebugHit>;
|
|
412
|
+
resultFirst: ReturnType<typeof Mesh.summarizeDebugHit>;
|
|
413
|
+
inputAHits: number;
|
|
414
|
+
inputBHits: number;
|
|
415
|
+
resultHits: number;
|
|
416
|
+
} {
|
|
417
|
+
return {
|
|
418
|
+
label: probe.label,
|
|
419
|
+
origin: {
|
|
420
|
+
x: Mesh.roundDebugScalar(probe.origin.x),
|
|
421
|
+
y: Mesh.roundDebugScalar(probe.origin.y),
|
|
422
|
+
z: Mesh.roundDebugScalar(probe.origin.z),
|
|
423
|
+
},
|
|
424
|
+
direction: {
|
|
425
|
+
x: Mesh.roundDebugScalar(probe.direction.x),
|
|
426
|
+
y: Mesh.roundDebugScalar(probe.direction.y),
|
|
427
|
+
z: Mesh.roundDebugScalar(probe.direction.z),
|
|
428
|
+
},
|
|
429
|
+
inputAFirst: Mesh.summarizeDebugHit(probe.inputAHits[0]),
|
|
430
|
+
inputBFirst: Mesh.summarizeDebugHit(probe.inputBHits[0]),
|
|
431
|
+
resultFirst: Mesh.summarizeDebugHit(probe.resultHits[0]),
|
|
432
|
+
inputAHits: probe.inputAHits.length,
|
|
433
|
+
inputBHits: probe.inputBHits.length,
|
|
434
|
+
resultHits: probe.resultHits.length,
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
379
438
|
private static logSubtractDebugSuccess(
|
|
380
439
|
inputA: Mesh,
|
|
381
440
|
inputB: Mesh,
|
|
@@ -390,13 +449,30 @@ export class Mesh {
|
|
|
390
449
|
"subtraction",
|
|
391
450
|
{ maxRayHits: 2, probes: ["posX", "negX", "posY"] },
|
|
392
451
|
);
|
|
452
|
+
const probeSummary = report.probes.map((probe) => Mesh.summarizeDebugProbe(probe));
|
|
393
453
|
console.log("[okgeometry-api] Mesh.subtract debug", {
|
|
394
454
|
options: options ?? null,
|
|
395
455
|
inputA: report.inputA,
|
|
396
456
|
inputB: report.inputB,
|
|
397
457
|
result: report.resultSummary,
|
|
398
|
-
|
|
458
|
+
deltas: {
|
|
459
|
+
faceCount: report.resultSummary.faceCount - report.inputA.faceCount,
|
|
460
|
+
vertexCount: report.resultSummary.vertexCount - report.inputA.vertexCount,
|
|
461
|
+
},
|
|
462
|
+
probeSummary,
|
|
463
|
+
report,
|
|
464
|
+
});
|
|
465
|
+
console.log("[okgeometry-api] Mesh.subtract summary", {
|
|
466
|
+
inputAFaces: report.inputA.faceCount,
|
|
467
|
+
inputBFaces: report.inputB.faceCount,
|
|
468
|
+
resultFaces: report.resultSummary.faceCount,
|
|
469
|
+
inputAVerts: report.inputA.vertexCount,
|
|
470
|
+
inputBVerts: report.inputB.vertexCount,
|
|
471
|
+
resultVerts: report.resultSummary.vertexCount,
|
|
472
|
+
resultClosed: report.resultSummary.isClosedVolume,
|
|
473
|
+
resultTopology: report.resultSummary.topology,
|
|
399
474
|
});
|
|
475
|
+
console.log("[okgeometry-api] Mesh.subtract probeSummary", probeSummary);
|
|
400
476
|
} catch (debugError) {
|
|
401
477
|
console.error("[okgeometry-api] Mesh.subtract debug logging failed", debugError);
|
|
402
478
|
}
|