@solid-labs/fab-one-widget 1.1.9 → 1.1.10
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/{GirthManagerWidget-nOvuxEz4.js → GirthManagerWidget-BZkAS44n.js} +1718 -1625
- package/dist/GirthManagerWidget-BZkAS44n.js.map +1 -0
- package/dist/geo_wasm-BBuWXukA.js +1032 -0
- package/dist/geo_wasm-BBuWXukA.js.map +1 -0
- package/dist/geo_wasm.d.ts +12 -7
- package/dist/geo_wasm.js +14 -7
- package/dist/geo_wasm_bg.wasm +0 -0
- package/dist/girth-manager-ui/src/GirthManagerCore.d.ts +1 -1
- package/dist/girth-manager-ui/src/components/ScaleNotice.d.ts +3 -2
- package/dist/girth-manager-ui/src/processing/aop-convert.d.ts +14 -0
- package/dist/girth-manager-ui/src/processing/stl-convert.d.ts +3 -0
- package/dist/girth-manager-ui/src/processing/types.d.ts +2 -2
- package/dist/girth-manager-ui/src/store.d.ts +2 -0
- package/dist/girth-manager-web-widget/src/types.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/web-component.js +4 -2
- package/dist/web-component.js.map +1 -1
- package/package.json +1 -1
- package/dist/GirthManagerWidget-nOvuxEz4.js.map +0 -1
- package/dist/geo_wasm-hwvtXYn2.js +0 -1032
- package/dist/geo_wasm-hwvtXYn2.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo_wasm-BBuWXukA.js","sources":["../../wasm/galileo-core-geo/pkg/geo_wasm.js"],"sourcesContent":["/* @ts-self-types=\"./geo_wasm.d.ts\" */\n\n/**\n * Result of the align-to-origin transform.\n */\nexport class AlignResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(AlignResult.prototype);\n obj.__wbg_ptr = ptr;\n AlignResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n AlignResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_alignresult_free(ptr, 0);\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.alignresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {Float32Array}\n */\n mpt() {\n const ret = wasm.alignresult_mpt(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n origin() {\n const ret = wasm.alignresult_origin(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.alignresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * Returns [ox, oy, oz, r00, r01, r02, r10, r11, r12, r20, r21, r22]\n * To transform a point p: rotated = R * (p - [ox,oy,oz])\n * @returns {Float32Array}\n */\n transform() {\n const ret = wasm.alignresult_transform(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) AlignResult.prototype[Symbol.dispose] = AlignResult.prototype.free;\n\n/**\n * Result of batch cross-sections along a line.\n */\nexport class BatchCrossSectionResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(BatchCrossSectionResult.prototype);\n obj.__wbg_ptr = ptr;\n BatchCrossSectionResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BatchCrossSectionResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_batchcrosssectionresult_free(ptr, 0);\n }\n /**\n * @returns {Float32Array}\n */\n all_loop_points() {\n const ret = wasm.batchcrosssectionresult_all_loop_points(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n circumferences() {\n const ret = wasm.batchcrosssectionresult_circumferences(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n count() {\n const ret = wasm.batchcrosssectionresult_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.batchcrosssectionresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {Uint32Array}\n */\n offsets() {\n const ret = wasm.batchcrosssectionresult_offsets(this.__wbg_ptr);\n var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) BatchCrossSectionResult.prototype[Symbol.dispose] = BatchCrossSectionResult.prototype.free;\n\n/**\n * Result of cross-section detection.\n */\nexport class CrossSectionResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(CrossSectionResult.prototype);\n obj.__wbg_ptr = ptr;\n CrossSectionResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CrossSectionResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_crosssectionresult_free(ptr, 0);\n }\n /**\n * @returns {number}\n */\n circumference() {\n const ret = wasm.crosssectionresult_circumference(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.crosssectionresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {boolean}\n */\n is_closed() {\n const ret = wasm.crosssectionresult_is_closed(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * @returns {Float32Array}\n */\n loop_points() {\n const ret = wasm.crosssectionresult_loop_points(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n plane_normal() {\n const ret = wasm.crosssectionresult_plane_normal(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) CrossSectionResult.prototype[Symbol.dispose] = CrossSectionResult.prototype.free;\n\n/**\n * Result of inner shell extraction via ray-casting from interior point.\n */\nexport class ExtractInnerShellResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(ExtractInnerShellResult.prototype);\n obj.__wbg_ptr = ptr;\n ExtractInnerShellResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ExtractInnerShellResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_extractinnershellresult_free(ptr, 0);\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.extractinnershellresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {Uint32Array}\n */\n indices() {\n const ret = wasm.extractinnershellresult_indices(this.__wbg_ptr);\n var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n inner_count() {\n const ret = wasm.extractinnershellresult_inner_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Float32Array}\n */\n interior_point() {\n const ret = wasm.extractinnershellresult_interior_point(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.extractinnershellresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n total_count() {\n const ret = wasm.extractinnershellresult_total_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n}\nif (Symbol.dispose) ExtractInnerShellResult.prototype[Symbol.dispose] = ExtractInnerShellResult.prototype.free;\n\n/**\n * Result of fill_small_holes.\n */\nexport class FillHolesResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(FillHolesResult.prototype);\n obj.__wbg_ptr = ptr;\n FillHolesResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n FillHolesResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_fillholesresult_free(ptr, 0);\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.fillholesresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n holes_filled() {\n const ret = wasm.fillholesresult_holes_filled(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Uint32Array}\n */\n indices() {\n const ret = wasm.fillholesresult_indices(this.__wbg_ptr);\n var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.fillholesresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) FillHolesResult.prototype[Symbol.dispose] = FillHolesResult.prototype.free;\n\n/**\n * Result of weld_and_keep_largest: holds positions + indices.\n * Access via getters since wasm_bindgen can't return tuples.\n */\nexport class MeshResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(MeshResult.prototype);\n obj.__wbg_ptr = ptr;\n MeshResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n MeshResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_meshresult_free(ptr, 0);\n }\n /**\n * @returns {Uint32Array}\n */\n indices() {\n const ret = wasm.meshresult_indices(this.__wbg_ptr);\n var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.meshresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {string}\n */\n stats() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.meshresult_stats(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\nif (Symbol.dispose) MeshResult.prototype[Symbol.dispose] = MeshResult.prototype.free;\n\n/**\n * Stage 1 result: fully preprocessed mesh ready for interactive steps.\n *\n * Chains four operations in a single WASM call (no JS round-trips):\n * 1. Unit detection & conversion (m → mm)\n * 2. AABB center → origin\n * 3. Vertex welding + largest-component extraction\n * 4. Small-hole filling\n */\nexport class PreprocessResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(PreprocessResult.prototype);\n obj.__wbg_ptr = ptr;\n PreprocessResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PreprocessResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_preprocessresult_free(ptr, 0);\n }\n /**\n * @returns {Float32Array}\n */\n bbox_size() {\n const ret = wasm.preprocessresult_bbox_size(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {string}\n */\n detected_unit() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.preprocessresult_detected_unit(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n holes_filled() {\n const ret = wasm.preprocessresult_holes_filled(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Uint32Array}\n */\n indices() {\n const ret = wasm.preprocessresult_indices(this.__wbg_ptr);\n var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {string}\n */\n log() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.preprocessresult_log(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n max_dimension() {\n const ret = wasm.preprocessresult_max_dimension(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.preprocessresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {boolean}\n */\n unit_converted() {\n const ret = wasm.preprocessresult_unit_converted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * @returns {string}\n */\n weld_stats() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.preprocessresult_weld_stats(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\nif (Symbol.dispose) PreprocessResult.prototype[Symbol.dispose] = PreprocessResult.prototype.free;\n\n/**\n * Result of centroid-based alignment refinement.\n */\nexport class RefineAlignmentResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(RefineAlignmentResult.prototype);\n obj.__wbg_ptr = ptr;\n RefineAlignmentResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RefineAlignmentResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_refinealignmentresult_free(ptr, 0);\n }\n /**\n * @returns {Float32Array}\n */\n centroid_axis() {\n const ret = wasm.refinealignmentresult_centroid_axis(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n correction_angle() {\n const ret = wasm.refinealignmentresult_correction_angle(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.refinealignmentresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {Float32Array}\n */\n mpt() {\n const ret = wasm.refinealignmentresult_mpt(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n origin() {\n const ret = wasm.refinealignmentresult_origin(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.refinealignmentresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n rotation() {\n const ret = wasm.refinealignmentresult_rotation(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) RefineAlignmentResult.prototype[Symbol.dispose] = RefineAlignmentResult.prototype.free;\n\n/**\n * Result of secondary PCA alignment.\n */\nexport class SecondaryPcaResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(SecondaryPcaResult.prototype);\n obj.__wbg_ptr = ptr;\n SecondaryPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SecondaryPcaResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_secondarypcaresult_free(ptr, 0);\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.secondarypcaresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {Float32Array}\n */\n mpt() {\n const ret = wasm.secondarypcaresult_mpt(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n origin() {\n const ret = wasm.secondarypcaresult_origin(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.secondarypcaresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n transform() {\n const ret = wasm.secondarypcaresult_transform(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) SecondaryPcaResult.prototype[Symbol.dispose] = SecondaryPcaResult.prototype.free;\n\n/**\n * Result of shell detection at MPT.\n */\nexport class ShellDetectResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(ShellDetectResult.prototype);\n obj.__wbg_ptr = ptr;\n ShellDetectResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ShellDetectResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_shelldetectresult_free(ptr, 0);\n }\n /**\n * @returns {number}\n */\n avg_thickness() {\n const ret = wasm.shelldetectresult_avg_thickness(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {string}\n */\n details() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.shelldetectresult_details(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n double_hit_count() {\n const ret = wasm.shelldetectresult_double_hit_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Float32Array}\n */\n hit_points() {\n const ret = wasm.shelldetectresult_hit_points(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {Float32Array}\n */\n hit_ray_lines() {\n const ret = wasm.shelldetectresult_hit_ray_lines(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {boolean}\n */\n is_double_shell() {\n const ret = wasm.shelldetectresult_is_double_shell(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * @returns {number}\n */\n max_thickness() {\n const ret = wasm.shelldetectresult_max_thickness(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {number}\n */\n min_thickness() {\n const ret = wasm.shelldetectresult_min_thickness(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {Float32Array}\n */\n miss_ray_lines() {\n const ret = wasm.shelldetectresult_miss_ray_lines(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n ray_count() {\n const ret = wasm.shelldetectresult_ray_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Float32Array}\n */\n surface_normal() {\n const ret = wasm.shelldetectresult_surface_normal(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n thickness() {\n const ret = wasm.shelldetectresult_thickness(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) ShellDetectResult.prototype[Symbol.dispose] = ShellDetectResult.prototype.free;\n\n/**\n * Result of subdividing the origin→projection line into ~1\" spaced points.\n */\nexport class SubdivideLineResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(SubdivideLineResult.prototype);\n obj.__wbg_ptr = ptr;\n SubdivideLineResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SubdivideLineResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_subdividelineresult_free(ptr, 0);\n }\n /**\n * @returns {number}\n */\n count() {\n const ret = wasm.subdividelineresult_count(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * @returns {Float32Array}\n */\n points() {\n const ret = wasm.subdividelineresult_points(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n /**\n * @returns {number}\n */\n spacing() {\n const ret = wasm.subdividelineresult_spacing(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {number}\n */\n total_distance() {\n const ret = wasm.subdividelineresult_total_distance(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) SubdivideLineResult.prototype[Symbol.dispose] = SubdivideLineResult.prototype.free;\n\n/**\n * Result of detect_and_convert_units: holds positions + detection info.\n */\nexport class UnitConversionResult {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(UnitConversionResult.prototype);\n obj.__wbg_ptr = ptr;\n UnitConversionResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n UnitConversionResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_unitconversionresult_free(ptr, 0);\n }\n /**\n * @returns {boolean}\n */\n converted() {\n const ret = wasm.unitconversionresult_converted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * @returns {string}\n */\n detected_unit() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.unitconversionresult_detected_unit(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * @returns {number}\n */\n max_dimension() {\n const ret = wasm.unitconversionresult_max_dimension(this.__wbg_ptr);\n return ret;\n }\n /**\n * @returns {Float32Array}\n */\n positions() {\n const ret = wasm.unitconversionresult_positions(this.__wbg_ptr);\n var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v1;\n }\n}\nif (Symbol.dispose) UnitConversionResult.prototype[Symbol.dispose] = UnitConversionResult.prototype.free;\n\n/**\n * Translate geometry so `origin_pt` maps to (0,0,0), then rotate so the\n * vector from `origin_pt` to its projection on the cross-section plane\n * aligns with the +Y axis.\n *\n * `positions`: flat [x,y,z,...] vertex positions\n * `origin_pt`: [x,y,z] the origin point (will become 0,0,0)\n * `mpt`: [x,y,z] the MPT point on the surface\n * `plane_normal`: [nx,ny,nz] the cross-section plane normal\n * @param {Float32Array} positions\n * @param {Float32Array} origin_pt\n * @param {Float32Array} mpt\n * @param {Float32Array} plane_normal\n * @returns {AlignResult}\n */\nexport function align_to_origin(positions, origin_pt, mpt, plane_normal) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passArrayF32ToWasm0(plane_normal, wasm.__wbindgen_malloc);\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.align_to_origin(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n return AlignResult.__wrap(ret);\n}\n\n/**\n * Slice the mesh at each Y height from the given points.\n *\n * After PCA alignment (step 7), the mesh is Y-aligned: origin at (0,0,0),\n * MPT along +Y. Cross-sections are horizontal planes (normal = Y axis)\n * at each subdivision point's Y coordinate.\n *\n * `positions`: flat [x,y,z,...] indexed mesh positions (PCA-aligned)\n * `indices`: flat [i0,i1,i2,...] triangle indices\n * `y_values`: Y coordinates to slice at\n * `max_gap`: maximum gap to bridge when chaining segments (mm)\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {Float32Array} y_values\n * @param {number} max_gap\n * @returns {BatchCrossSectionResult}\n */\nexport function batch_cross_sections_y(positions, indices, y_values, max_gap) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(y_values, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.batch_cross_sections_y(ptr0, len0, ptr1, len1, ptr2, len2, max_gap);\n return BatchCrossSectionResult.__wrap(ret);\n}\n\n/**\n * Same as `batch_cross_sections_y` but picks the **inner** (smallest substantial)\n * loop at each height. For double-shell meshes this selects the inner wall.\n *\n * Uses a tight chaining tolerance (no gap bridging) to prevent inner+outer\n * wall segments from merging into one figure-8 loop.\n *\n * \"Substantial\" = circumference >= 30% of the largest loop at that height.\n * Among substantial loops, picks the one with the smallest circumference.\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {Float32Array} y_values\n * @param {number} _max_gap\n * @returns {BatchCrossSectionResult}\n */\nexport function batch_cross_sections_y_inner(positions, indices, y_values, _max_gap) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(y_values, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.batch_cross_sections_y_inner(ptr0, len0, ptr1, len1, ptr2, len2, _max_gap);\n return BatchCrossSectionResult.__wrap(ret);\n}\n\n/**\n * Compute bounding box from a flat f32 position array [x,y,z, x,y,z, ...]\n * Returns [min_x, min_y, min_z, max_x, max_y, max_z]\n * @param {Float32Array} positions\n * @returns {Float32Array}\n */\nexport function bounding_box(positions) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.bounding_box(ptr0, len0);\n var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v2;\n}\n\n/**\n * Translate positions so their AABB center is at origin.\n * Takes flat [x,y,z,...], returns new flat [x,y,z,...].\n * @param {Float32Array} positions\n * @returns {Float32Array}\n */\nexport function center_to_origin(positions) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.center_to_origin(ptr0, len0);\n var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v2;\n}\n\n/**\n * Detect if positions are in meters, centimeters or millimeters based on\n * bounding box size:\n * - max AABB dim < `meter_threshold` (default: 10) → meters, scaled ×1000 to mm\n * - max AABB dim < `cm_threshold` (default: 100) → centimeters, scaled ×10 to mm\n * - otherwise → already mm, passed through\n * @param {Float32Array} positions\n * @param {number} meter_threshold\n * @param {number} cm_threshold\n * @returns {UnitConversionResult}\n */\nexport function detect_and_convert_units(positions, meter_threshold, cm_threshold) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.detect_and_convert_units(ptr0, len0, meter_threshold, cm_threshold);\n return UnitConversionResult.__wrap(ret);\n}\n\n/**\n * Detect if the surface at `mpt` is single or double shell.\n *\n * Strategy: compute the surface normal at `mpt` (from the closest triangle),\n * then cast rays in a cone of directions around that normal (both sides).\n * For each ray, count surface intersections. If we consistently find pairs\n * of hits with small gaps, it's a double shell.\n *\n * `positions`: flat [x,y,z,...] indexed geometry positions\n * `indices`: flat [i0,i1,i2,...] triangle indices\n * `mpt`: [x,y,z] the MPT point on the surface\n * `max_thickness`: maximum expected wall thickness — hits farther than this are ignored\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {Float32Array} mpt\n * @param {number} max_thickness\n * @returns {ShellDetectResult}\n */\nexport function detect_shell(positions, indices, mpt, max_thickness) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.detect_shell(ptr0, len0, ptr1, len1, ptr2, len2, max_thickness);\n return ShellDetectResult.__wrap(ret);\n}\n\n/**\n * Step 5a: Extract the inner shell from a double-walled mesh.\n *\n * Strategy: multi-point face-visibility.\n * 1. Use `hit_points` (outer wall hits from detect_shell) to compute the cavity\n * direction: vector from mean-outer-hit toward MPT = inward = cavity direction.\n * 2. Generate a cluster of probe points at multiple depths inside the cavity,\n * spread laterally for concave-socket robustness.\n * 3. For every triangle, cast a ray from each probe toward the face centroid;\n * if the FIRST hit is that triangle from ANY probe → inner shell.\n *\n * `mpt`: user-placed point on the inner surface\n * `wall_thickness`: median wall thickness from detect_shell\n * `hit_points`: outer-wall hit points from detect_shell [x,y,z,...] (may be empty)\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {Float32Array} mpt\n * @param {number} wall_thickness\n * @param {Float32Array} hit_points\n * @returns {ExtractInnerShellResult}\n */\nexport function extract_inner_shell(positions, indices, mpt, wall_thickness, hit_points) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passArrayF32ToWasm0(hit_points, wasm.__wbindgen_malloc);\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.extract_inner_shell(ptr0, len0, ptr1, len1, ptr2, len2, wall_thickness, ptr3, len3);\n return ExtractInnerShellResult.__wrap(ret);\n}\n\n/**\n * Find and fill small boundary holes in an indexed mesh.\n *\n * A \"hole\" is a closed boundary loop of edges that each appear in exactly one triangle.\n * Loops whose total perimeter is < `max_perimeter` are filled via fan triangulation\n * from the loop centroid.\n *\n * `positions`: flat [x,y,z,...] vertex positions\n * `indices`: flat [i0,i1,i2,...] triangle indices\n * `max_perimeter`: maximum hole perimeter in mm to close (e.g. 40.0)\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {number} max_perimeter\n * @returns {FillHolesResult}\n */\nexport function fill_small_holes(positions, indices, max_perimeter) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.fill_small_holes(ptr0, len0, ptr1, len1, max_perimeter);\n return FillHolesResult.__wrap(ret);\n}\n\n/**\n * Find the cross-section plane through `mpt` that gives the smallest circumference.\n *\n * Strategy:\n * 1. Build rotation axes: the surface normal + 8 perturbed axes (±5° tilts)\n * 2. For each axis, coarse scan 90 plane orientations (2° steps)\n * 3. Refine: ±2° around best at 0.1° steps\n * 4. Score loops by circumference × closedness × proximity to MPT\n *\n * `positions`: flat [x,y,z,...] indexed geometry positions\n * `indices`: flat [i0,i1,i2,...] triangle indices\n * `mpt`: [x,y,z] the MPT point on the surface\n * `surface_normal`: [nx,ny,nz] surface normal at MPT\n * `max_gap`: maximum gap to bridge when chaining segments into loops (mm)\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {Float32Array} mpt\n * @param {Float32Array} surface_normal\n * @param {number} max_gap\n * @returns {CrossSectionResult}\n */\nexport function find_min_cross_section(positions, indices, mpt, surface_normal, max_gap) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passArrayF32ToWasm0(surface_normal, wasm.__wbindgen_malloc);\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.find_min_cross_section(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, max_gap);\n return CrossSectionResult.__wrap(ret);\n}\n\n/**\n * Initialize panic hook for better WASM error messages in the browser console.\n * Called automatically on WASM module init.\n */\nexport function init() {\n wasm.init();\n}\n\n/**\n * Stage 1: preprocess a raw mesh in one shot.\n *\n * Accepts raw geometry (positions + optional indices) and runs all four\n * automatic preprocessing steps without crossing the WASM boundary in between.\n *\n * **Parameters**\n * - `positions`: flat `[x,y,z, …]` vertex positions\n * - `indices`: flat `[i0,i1,i2, …]` triangle indices (pass empty array for non-indexed)\n * - `meter_threshold`: max AABB dimension (in model units) below which the\n * geometry is assumed to be in meters and scaled ×1000 to mm (default: `10.0`)\n * - `cm_threshold`: max AABB dimension at/above `meter_threshold` but below\n * this value is assumed to be in centimeters and scaled ×10 to mm\n * (default: `100.0`). At/above this, the mesh is assumed to already be mm.\n * - `weld_tolerance`: distance within which vertices are merged (default: `1e-4`)\n * - `max_hole_perimeter`: boundary loops shorter than this (mm) are fan-filled (default: `300.0`)\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {number} meter_threshold\n * @param {number} cm_threshold\n * @param {number} weld_tolerance\n * @param {number} max_hole_perimeter\n * @returns {PreprocessResult}\n */\nexport function preprocess_mesh(positions, indices, meter_threshold, cm_threshold, weld_tolerance, max_hole_perimeter) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.preprocess_mesh(ptr0, len0, ptr1, len1, meter_threshold, cm_threshold, weld_tolerance, max_hole_perimeter);\n return PreprocessResult.__wrap(ret);\n}\n\n/**\n * Build a BVH from flat triangle positions and ray-cast against it.\n * `positions`: flat [x,y,z, ...] with every 9 floats = 1 triangle\n * `ray_origin`: [ox, oy, oz]\n * `ray_dir`: [dx, dy, dz]\n * Returns indices of triangles whose AABBs the ray intersects.\n * @param {Float32Array} positions\n * @param {Float32Array} ray_origin\n * @param {Float32Array} ray_dir\n * @returns {Uint32Array}\n */\nexport function ray_cast_bvh(positions, ray_origin, ray_dir) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayF32ToWasm0(ray_origin, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(ray_dir, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.ray_cast_bvh(ptr0, len0, ptr1, len1, ptr2, len2);\n var v4 = getArrayU32FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n return v4;\n}\n\n/**\n * Step 9: Refine alignment using cross-section centroids.\n *\n * Computes PCA on the centroids of cross-section loops to find the \"true\"\n * limb axis, then rotates the mesh so this axis aligns with +Y.\n *\n * `centroids`: flat [x,y,z,...] centroid of each cross-section loop\n * `all_positions`: flat [x,y,z,...] full mesh positions\n * `origin_pt`: [x,y,z]\n * `mpt`: [x,y,z]\n * @param {Float32Array} centroids\n * @param {Float32Array} all_positions\n * @param {Float32Array} origin_pt\n * @param {Float32Array} mpt\n * @returns {RefineAlignmentResult}\n */\nexport function refine_alignment(centroids, all_positions, origin_pt, mpt) {\n const ptr0 = passArrayF32ToWasm0(centroids, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayF32ToWasm0(all_positions, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.refine_alignment(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n return RefineAlignmentResult.__wrap(ret);\n}\n\n/**\n * Compute PCA on `selected_positions` (the region of interest),\n * then apply the resulting rotation to `all_positions` (full mesh).\n *\n * The principal axis (longest variance) aligns with +Y.\n * Ensures `origin_pt.y < mpt.y` after rotation (origin below MPT).\n *\n * `selected_positions`: flat [x,y,z,...] of selected region vertices\n * `all_positions`: flat [x,y,z,...] of full mesh\n * `origin_pt`: [x,y,z]\n * `mpt`: [x,y,z]\n * @param {Float32Array} selected_positions\n * @param {Float32Array} all_positions\n * @param {Float32Array} origin_pt\n * @param {Float32Array} mpt\n * @returns {SecondaryPcaResult}\n */\nexport function secondary_pca(selected_positions, all_positions, origin_pt, mpt) {\n const ptr0 = passArrayF32ToWasm0(selected_positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayF32ToWasm0(all_positions, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ptr3 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len3 = WASM_VECTOR_LEN;\n const ret = wasm.secondary_pca(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);\n return SecondaryPcaResult.__wrap(ret);\n}\n\n/**\n * Step 8: Subdivide the line from `origin_pt` to its projection onto the\n * cross-section plane into points spaced roughly 1 inch (25.4 mm) apart.\n *\n * `origin_pt`: [x,y,z] the origin point\n * `mpt`: [x,y,z] a point on the cross-section plane\n * `plane_normal`: [nx,ny,nz] the cross-section plane normal\n *\n * Returns the series of evenly-spaced points along the line (both endpoints included).\n * @param {Float32Array} origin_pt\n * @param {Float32Array} mpt\n * @param {Float32Array} plane_normal\n * @returns {SubdivideLineResult}\n */\nexport function subdivide_origin_to_plane(origin_pt, mpt, plane_normal) {\n const ptr0 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passArrayF32ToWasm0(plane_normal, wasm.__wbindgen_malloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.subdivide_origin_to_plane(ptr0, len0, ptr1, len1, ptr2, len2);\n return SubdivideLineResult.__wrap(ret);\n}\n\n/**\n * Weld close vertices, find connected components, keep only the largest mesh.\n *\n * `positions`: flat [x,y,z,...] — non-indexed (every 9 floats = 1 triangle)\n * `tolerance`: distance within which vertices are merged\n *\n * For indexed input, use `weld_and_keep_largest_indexed`.\n * @param {Float32Array} positions\n * @param {number} tolerance\n * @returns {MeshResult}\n */\nexport function weld_and_keep_largest(positions, tolerance) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.weld_and_keep_largest(ptr0, len0, tolerance);\n return MeshResult.__wrap(ret);\n}\n\n/**\n * Same as above but for indexed geometry.\n * `positions`: flat [x,y,z,...]\n * `indices`: flat [i0,i1,i2, ...] triangle indices\n * `tolerance`: weld distance\n * @param {Float32Array} positions\n * @param {Uint32Array} indices\n * @param {number} tolerance\n * @returns {MeshResult}\n */\nexport function weld_and_keep_largest_indexed(positions, indices, tolerance) {\n const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);\n const len1 = WASM_VECTOR_LEN;\n const ret = wasm.weld_and_keep_largest_indexed(ptr0, len0, ptr1, len1, tolerance);\n return MeshResult.__wrap(ret);\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {\n let deferred0_0;\n let deferred0_1;\n try {\n deferred0_0 = arg0;\n deferred0_1 = arg1;\n console.error(getStringFromWasm0(arg0, arg1));\n } finally {\n wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n }\n },\n __wbg_new_227d7c05414eb861: function() {\n const ret = new Error();\n return ret;\n },\n __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {\n const ret = arg1.stack;\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbindgen_init_externref_table: function() {\n const table = wasm.__wbindgen_externrefs;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n },\n };\n return {\n __proto__: null,\n \"./geo_wasm_bg.js\": import0,\n };\n}\n\nconst AlignResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_alignresult_free(ptr >>> 0, 1));\nconst BatchCrossSectionResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_batchcrosssectionresult_free(ptr >>> 0, 1));\nconst CrossSectionResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssectionresult_free(ptr >>> 0, 1));\nconst ExtractInnerShellResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_extractinnershellresult_free(ptr >>> 0, 1));\nconst FillHolesResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_fillholesresult_free(ptr >>> 0, 1));\nconst MeshResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_meshresult_free(ptr >>> 0, 1));\nconst PreprocessResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_preprocessresult_free(ptr >>> 0, 1));\nconst RefineAlignmentResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_refinealignmentresult_free(ptr >>> 0, 1));\nconst SecondaryPcaResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_secondarypcaresult_free(ptr >>> 0, 1));\nconst ShellDetectResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_shelldetectresult_free(ptr >>> 0, 1));\nconst SubdivideLineResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_subdividelineresult_free(ptr >>> 0, 1));\nconst UnitConversionResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_unitconversionresult_free(ptr >>> 0, 1));\n\nfunction getArrayF32FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);\n}\n\nfunction getArrayU32FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nlet cachedFloat32ArrayMemory0 = null;\nfunction getFloat32ArrayMemory0() {\n if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {\n cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);\n }\n return cachedFloat32ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint32ArrayMemory0 = null;\nfunction getUint32ArrayMemory0() {\n if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {\n cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);\n }\n return cachedUint32ArrayMemory0;\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction passArray32ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 4, 4) >>> 0;\n getUint32ArrayMemory0().set(arg, ptr / 4);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passArrayF32ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 4, 4) >>> 0;\n getFloat32ArrayMemory0().set(arg, ptr / 4);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedFloat32ArrayMemory0 = null;\n cachedUint32ArrayMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('geo_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n"],"names":["AlignResult","ptr","obj","AlignResultFinalization","wasm","deferred1_0","deferred1_1","ret","getStringFromWasm0","v1","getArrayF32FromWasm0","BatchCrossSectionResult","BatchCrossSectionResultFinalization","getArrayU32FromWasm0","CrossSectionResult","CrossSectionResultFinalization","ExtractInnerShellResult","ExtractInnerShellResultFinalization","FillHolesResult","FillHolesResultFinalization","MeshResult","MeshResultFinalization","PreprocessResult","PreprocessResultFinalization","RefineAlignmentResult","RefineAlignmentResultFinalization","SecondaryPcaResult","SecondaryPcaResultFinalization","ShellDetectResult","ShellDetectResultFinalization","SubdivideLineResult","SubdivideLineResultFinalization","UnitConversionResult","UnitConversionResultFinalization","align_to_origin","positions","origin_pt","mpt","plane_normal","ptr0","passArrayF32ToWasm0","len0","WASM_VECTOR_LEN","ptr1","len1","ptr2","len2","ptr3","len3","batch_cross_sections_y","indices","y_values","max_gap","passArray32ToWasm0","batch_cross_sections_y_inner","_max_gap","bounding_box","v2","center_to_origin","detect_and_convert_units","meter_threshold","cm_threshold","detect_shell","max_thickness","extract_inner_shell","wall_thickness","hit_points","fill_small_holes","max_perimeter","find_min_cross_section","surface_normal","init","preprocess_mesh","weld_tolerance","max_hole_perimeter","ray_cast_bvh","ray_origin","ray_dir","v4","refine_alignment","centroids","all_positions","secondary_pca","selected_positions","subdivide_origin_to_plane","weld_and_keep_largest","tolerance","weld_and_keep_largest_indexed","__wbg_get_imports","arg0","arg1","deferred0_0","deferred0_1","passStringToWasm0","getDataViewMemory0","table","offset","len","getFloat32ArrayMemory0","getUint32ArrayMemory0","cachedDataViewMemory0","cachedFloat32ArrayMemory0","decodeText","cachedUint32ArrayMemory0","cachedUint8ArrayMemory0","getUint8ArrayMemory0","arg","malloc","realloc","buf","cachedTextEncoder","mem","code","view","cachedTextDecoder","MAX_SAFARI_DECODE_BYTES","numBytesDecoded","__wbg_finalize_init","instance","module","__wbg_load","imports","e","expectedResponseType","bytes","type","initSync","__wbg_init","module_or_path"],"mappings":"AAKO,MAAMA,EAAY;AAAA,EACrB,OAAO,OAAOC,GAAK;AACf,IAAAA,IAAMA,MAAQ;AACd,UAAMC,IAAM,OAAO,OAAOF,EAAY,SAAS;AAC/C,WAAAE,EAAI,YAAYD,GAChBE,EAAwB,SAASD,GAAKA,EAAI,WAAWA,CAAG,GACjDA;AAAA,EACX;AAAA,EACA,qBAAqB;AACjB,UAAMD,IAAM,KAAK;AACjB,gBAAK,YAAY,GACjBE,EAAwB,WAAW,IAAI,GAChCF;AAAA,EACX;AAAA,EACA,OAAO;AACH,UAAMA,IAAM,KAAK,mBAAkB;AACnC,IAAAG,EAAK,uBAAuBH,GAAK,CAAC;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA,EAIA,UAAU;AACN,QAAII,GACAC;AACJ,QAAI;AACA,YAAMC,IAAMH,EAAK,oBAAoB,KAAK,SAAS;AACnD,aAAAC,IAAcE,EAAI,CAAC,GACnBD,IAAcC,EAAI,CAAC,GACZC,EAAmBD,EAAI,CAAC,GAAGA,EAAI,CAAC,CAAC;AAAA,IAC5C,UAAC;AACG,MAAAH,EAAK,gBAAgBC,GAAaC,GAAa,CAAC;AAAA,IACpD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM;AACF,UAAMC,IAAMH,EAAK,gBAAgB,KAAK,SAAS;AAC/C,QAAIK,IAAKC,EAAqBH,EAAI,CAAC,GAA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W,WACP,OAAO,eAAeA,CAAM,MAAM,OAAO,YACxC,EAAC,QAAAA,EAAM,IAAIA,IAEZ,QAAQ,KAAK,4EAA4E;AAIjG,QAAME,IAAUjC,GAAiB;AACjC,EAAM+B,aAAkB,YAAY,WAChCA,IAAS,IAAI,YAAY,OAAOA,CAAM;AAE1C,QAAMD,IAAW,IAAI,YAAY,SAASC,GAAQE,CAAO;AACzD,SAAOJ,GAAoBC,CAAgB;AAC/C;AAEA,eAAeS,GAAWC,GAAgB;AACtC,MAAI5H,MAAS,OAAW,QAAOA;AAG/B,EAAI4H,MAAmB,WACf,OAAO,eAAeA,CAAc,MAAM,OAAO,YAChD,EAAC,gBAAAA,EAAc,IAAIA,IAEpB,QAAQ,KAAK,2FAA2F,IAI5GA,MAAmB,WACnBA,IAAiB,IAAA,IAAA,i4rPAAA,YAAA,GAAA;AAErB,QAAMP,IAAUjC,GAAiB;AAEjC,GAAI,OAAOwC,KAAmB,YAAa,OAAO,WAAY,cAAcA,aAA0B,WAAa,OAAO,OAAQ,cAAcA,aAA0B,SACtKA,IAAiB,MAAMA,CAAc;AAGzC,QAAM,EAAE,UAAAV,GAAU,QAAAC,EAAM,IAAK,MAAMC,GAAW,MAAMQ,GAAgBP,CAAO;AAE3E,SAAOJ,GAAoBC,CAAgB;AAC/C;"}
|
package/dist/geo_wasm.d.ts
CHANGED
|
@@ -240,11 +240,13 @@ export function bounding_box(positions: Float32Array): Float32Array;
|
|
|
240
240
|
export function center_to_origin(positions: Float32Array): Float32Array;
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* Detect if positions are in meters or millimeters based on
|
|
244
|
-
*
|
|
245
|
-
*
|
|
243
|
+
* Detect if positions are in meters, centimeters or millimeters based on
|
|
244
|
+
* bounding box size:
|
|
245
|
+
* - max AABB dim < `meter_threshold` (default: 10) → meters, scaled ×1000 to mm
|
|
246
|
+
* - max AABB dim < `cm_threshold` (default: 100) → centimeters, scaled ×10 to mm
|
|
247
|
+
* - otherwise → already mm, passed through
|
|
246
248
|
*/
|
|
247
|
-
export function detect_and_convert_units(positions: Float32Array, meter_threshold: number): UnitConversionResult;
|
|
249
|
+
export function detect_and_convert_units(positions: Float32Array, meter_threshold: number, cm_threshold: number): UnitConversionResult;
|
|
248
250
|
|
|
249
251
|
/**
|
|
250
252
|
* Detect if the surface at `mpt` is single or double shell.
|
|
@@ -325,10 +327,13 @@ export function init(): void;
|
|
|
325
327
|
* - `indices`: flat `[i0,i1,i2, …]` triangle indices (pass empty array for non-indexed)
|
|
326
328
|
* - `meter_threshold`: max AABB dimension (in model units) below which the
|
|
327
329
|
* geometry is assumed to be in meters and scaled ×1000 to mm (default: `10.0`)
|
|
330
|
+
* - `cm_threshold`: max AABB dimension at/above `meter_threshold` but below
|
|
331
|
+
* this value is assumed to be in centimeters and scaled ×10 to mm
|
|
332
|
+
* (default: `100.0`). At/above this, the mesh is assumed to already be mm.
|
|
328
333
|
* - `weld_tolerance`: distance within which vertices are merged (default: `1e-4`)
|
|
329
334
|
* - `max_hole_perimeter`: boundary loops shorter than this (mm) are fan-filled (default: `300.0`)
|
|
330
335
|
*/
|
|
331
|
-
export function preprocess_mesh(positions: Float32Array, indices: Uint32Array, meter_threshold: number, weld_tolerance: number, max_hole_perimeter: number): PreprocessResult;
|
|
336
|
+
export function preprocess_mesh(positions: Float32Array, indices: Uint32Array, meter_threshold: number, cm_threshold: number, weld_tolerance: number, max_hole_perimeter: number): PreprocessResult;
|
|
332
337
|
|
|
333
338
|
/**
|
|
334
339
|
* Build a BVH from flat triangle positions and ray-cast against it.
|
|
@@ -405,7 +410,7 @@ export interface InitOutput {
|
|
|
405
410
|
readonly unitconversionresult_detected_unit: (a: number) => [number, number];
|
|
406
411
|
readonly unitconversionresult_converted: (a: number) => number;
|
|
407
412
|
readonly unitconversionresult_max_dimension: (a: number) => number;
|
|
408
|
-
readonly detect_and_convert_units: (a: number, b: number, c: number) => number;
|
|
413
|
+
readonly detect_and_convert_units: (a: number, b: number, c: number, d: number) => number;
|
|
409
414
|
readonly center_to_origin: (a: number, b: number) => [number, number];
|
|
410
415
|
readonly __wbg_meshresult_free: (a: number, b: number) => void;
|
|
411
416
|
readonly meshresult_positions: (a: number) => [number, number];
|
|
@@ -496,7 +501,7 @@ export interface InitOutput {
|
|
|
496
501
|
readonly preprocessresult_weld_stats: (a: number) => [number, number];
|
|
497
502
|
readonly preprocessresult_holes_filled: (a: number) => number;
|
|
498
503
|
readonly preprocessresult_log: (a: number) => [number, number];
|
|
499
|
-
readonly preprocess_mesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
504
|
+
readonly preprocess_mesh: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
500
505
|
readonly init: () => void;
|
|
501
506
|
readonly bounding_box: (a: number, b: number) => [number, number];
|
|
502
507
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
package/dist/geo_wasm.js
CHANGED
|
@@ -1065,17 +1065,20 @@ export function center_to_origin(positions) {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
1067
|
/**
|
|
1068
|
-
* Detect if positions are in meters or millimeters based on
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1068
|
+
* Detect if positions are in meters, centimeters or millimeters based on
|
|
1069
|
+
* bounding box size:
|
|
1070
|
+
* - max AABB dim < `meter_threshold` (default: 10) → meters, scaled ×1000 to mm
|
|
1071
|
+
* - max AABB dim < `cm_threshold` (default: 100) → centimeters, scaled ×10 to mm
|
|
1072
|
+
* - otherwise → already mm, passed through
|
|
1071
1073
|
* @param {Float32Array} positions
|
|
1072
1074
|
* @param {number} meter_threshold
|
|
1075
|
+
* @param {number} cm_threshold
|
|
1073
1076
|
* @returns {UnitConversionResult}
|
|
1074
1077
|
*/
|
|
1075
|
-
export function detect_and_convert_units(positions, meter_threshold) {
|
|
1078
|
+
export function detect_and_convert_units(positions, meter_threshold, cm_threshold) {
|
|
1076
1079
|
const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
|
|
1077
1080
|
const len0 = WASM_VECTOR_LEN;
|
|
1078
|
-
const ret = wasm.detect_and_convert_units(ptr0, len0, meter_threshold);
|
|
1081
|
+
const ret = wasm.detect_and_convert_units(ptr0, len0, meter_threshold, cm_threshold);
|
|
1079
1082
|
return UnitConversionResult.__wrap(ret);
|
|
1080
1083
|
}
|
|
1081
1084
|
|
|
@@ -1219,21 +1222,25 @@ export function init() {
|
|
|
1219
1222
|
* - `indices`: flat `[i0,i1,i2, …]` triangle indices (pass empty array for non-indexed)
|
|
1220
1223
|
* - `meter_threshold`: max AABB dimension (in model units) below which the
|
|
1221
1224
|
* geometry is assumed to be in meters and scaled ×1000 to mm (default: `10.0`)
|
|
1225
|
+
* - `cm_threshold`: max AABB dimension at/above `meter_threshold` but below
|
|
1226
|
+
* this value is assumed to be in centimeters and scaled ×10 to mm
|
|
1227
|
+
* (default: `100.0`). At/above this, the mesh is assumed to already be mm.
|
|
1222
1228
|
* - `weld_tolerance`: distance within which vertices are merged (default: `1e-4`)
|
|
1223
1229
|
* - `max_hole_perimeter`: boundary loops shorter than this (mm) are fan-filled (default: `300.0`)
|
|
1224
1230
|
* @param {Float32Array} positions
|
|
1225
1231
|
* @param {Uint32Array} indices
|
|
1226
1232
|
* @param {number} meter_threshold
|
|
1233
|
+
* @param {number} cm_threshold
|
|
1227
1234
|
* @param {number} weld_tolerance
|
|
1228
1235
|
* @param {number} max_hole_perimeter
|
|
1229
1236
|
* @returns {PreprocessResult}
|
|
1230
1237
|
*/
|
|
1231
|
-
export function preprocess_mesh(positions, indices, meter_threshold, weld_tolerance, max_hole_perimeter) {
|
|
1238
|
+
export function preprocess_mesh(positions, indices, meter_threshold, cm_threshold, weld_tolerance, max_hole_perimeter) {
|
|
1232
1239
|
const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
|
|
1233
1240
|
const len0 = WASM_VECTOR_LEN;
|
|
1234
1241
|
const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
|
|
1235
1242
|
const len1 = WASM_VECTOR_LEN;
|
|
1236
|
-
const ret = wasm.preprocess_mesh(ptr0, len0, ptr1, len1, meter_threshold, weld_tolerance, max_hole_perimeter);
|
|
1243
|
+
const ret = wasm.preprocess_mesh(ptr0, len0, ptr1, len1, meter_threshold, cm_threshold, weld_tolerance, max_hole_perimeter);
|
|
1237
1244
|
return PreprocessResult.__wrap(ret);
|
|
1238
1245
|
}
|
|
1239
1246
|
|
package/dist/geo_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -6,7 +6,7 @@ export interface GirthManagerResult {
|
|
|
6
6
|
spacingType: "AK" | "BK";
|
|
7
7
|
/** Unit of all measurement fields in this payload. "cm" for user-facing measurements; geometry (alignedGeometry, scanMeasurements[].yPosition) always stays in mm. */
|
|
8
8
|
sourceUnit: "mm" | "cm" | "inch";
|
|
9
|
-
fileFormat: "obj" | "stl";
|
|
9
|
+
fileFormat: "obj" | "stl" | "aop";
|
|
10
10
|
measurementSource: "scan_derived" | "form_provided";
|
|
11
11
|
isDoubleWall: boolean;
|
|
12
12
|
isUnitConverted: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface ScaleNoticeProps {
|
|
2
|
-
|
|
2
|
+
/** Source unit detected for the scan: "meter" | "cm" | "mm" | "unknown" */
|
|
3
|
+
detectedUnit: string;
|
|
3
4
|
onDismiss: () => void;
|
|
4
5
|
}
|
|
5
|
-
export declare const ScaleNotice: ({
|
|
6
|
+
export declare const ScaleNotice: ({ detectedUnit, onDismiss }: ScaleNoticeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert an .aop scan into OBJ text so it can go through the WASM pipeline.
|
|
3
|
+
*
|
|
4
|
+
* The .aop format used across the O&P industry (Rodin4D, Artec, Vorum, etc.) is
|
|
5
|
+
* a ZIP container that wraps the actual surface mesh — typically a `.stl`,
|
|
6
|
+
* `.ply`, or `.obj` entry — alongside metadata. Some exporters also ship a bare
|
|
7
|
+
* (non-zipped) mesh under the `.aop` extension, so we sniff the magic bytes and
|
|
8
|
+
* fall back to parsing the payload directly.
|
|
9
|
+
*
|
|
10
|
+
* We deliberately fail loudly when no recognizable mesh is found rather than
|
|
11
|
+
* guessing at a proprietary binary layout — wrong geometry on a medical scan is
|
|
12
|
+
* worse than a clear error.
|
|
13
|
+
*/
|
|
14
|
+
export declare function aopToObjString(file: File): Promise<string>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import type { BufferGeometry } from "three";
|
|
2
|
+
/** Serialize a THREE.BufferGeometry to OBJ text so it can go through the WASM pipeline. */
|
|
3
|
+
export declare function geometryToObjString(geometry: BufferGeometry): string;
|
|
1
4
|
/** Convert STL binary/ascii into OBJ text so it can go through the WASM pipeline */
|
|
2
5
|
export declare function stlToObjString(file: File): Promise<string>;
|
|
@@ -89,8 +89,8 @@ export interface FillHolesResult {
|
|
|
89
89
|
/** WASM module — functional API, no persistent state */
|
|
90
90
|
export interface WasmModule {
|
|
91
91
|
bounding_box(positions: Float32Array): Float32Array;
|
|
92
|
-
preprocess_mesh(positions: Float32Array, indices: Uint32Array, meter_threshold: number, weld_tolerance: number, max_hole_perimeter: number): PreprocessResult;
|
|
93
|
-
detect_and_convert_units(positions: Float32Array, meter_threshold: number): {
|
|
92
|
+
preprocess_mesh(positions: Float32Array, indices: Uint32Array, meter_threshold: number, cm_threshold: number, weld_tolerance: number, max_hole_perimeter: number): PreprocessResult;
|
|
93
|
+
detect_and_convert_units(positions: Float32Array, meter_threshold: number, cm_threshold: number): {
|
|
94
94
|
positions(): Float32Array;
|
|
95
95
|
detected_unit(): string;
|
|
96
96
|
converted(): boolean;
|
|
@@ -5,6 +5,8 @@ interface MeasurementStore {
|
|
|
5
5
|
isCut: boolean;
|
|
6
6
|
addLandmarkPoint: (point: LandmarkPoint) => void;
|
|
7
7
|
removeLandmarkPoint: (index: number) => void;
|
|
8
|
+
/** Undo the most recently placed landmark point (single-point undo). */
|
|
9
|
+
undoLastLandmarkPoint: () => void;
|
|
8
10
|
clearLandmarkPoints: () => void;
|
|
9
11
|
updateLandmarkPositions: (positions: {
|
|
10
12
|
x: number;
|
|
@@ -22,7 +22,7 @@ export interface WidgetResponse {
|
|
|
22
22
|
/** Unit of all measurements in this response */
|
|
23
23
|
source_unit: "mm" | "cm" | "inch";
|
|
24
24
|
/** File format of the scan */
|
|
25
|
-
file_format: "obj" | "stl";
|
|
25
|
+
file_format: "obj" | "stl" | "aop";
|
|
26
26
|
/** Whether measurements were derived from the scan or taken from the order form */
|
|
27
27
|
measurement_source: "scan_derived" | "form_provided";
|
|
28
28
|
/** Whether the spacing uses a double-wall construction */
|
package/dist/index.js
CHANGED
package/dist/web-component.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { createElement as n } from "react";
|
|
2
2
|
import { createRoot as i } from "react-dom/client";
|
|
3
|
-
import { u as a, G as u, __tla as __tla_0 } from "./GirthManagerWidget-
|
|
3
|
+
import { u as a, G as u, __tla as __tla_0 } from "./GirthManagerWidget-BZkAS44n.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "@react-three/fiber";
|
|
6
6
|
import "@react-three/drei";
|
|
7
7
|
import "three";
|
|
8
8
|
import "three/examples/jsm/loaders/OBJLoader.js";
|
|
9
9
|
import "three/examples/jsm/loaders/STLLoader.js";
|
|
10
|
+
import "three/examples/jsm/libs/fflate.module.js";
|
|
11
|
+
import "three/examples/jsm/loaders/PLYLoader.js";
|
|
10
12
|
import "three-mesh-bvh";
|
|
11
13
|
let h;
|
|
12
14
|
let __tla = Promise.all([
|
|
@@ -67,7 +69,7 @@ let __tla = Promise.all([
|
|
|
67
69
|
if (!(this._wasmModule || this._wasmLoading)) {
|
|
68
70
|
this._wasmLoading = true, this._setWasmStatus("loading");
|
|
69
71
|
try {
|
|
70
|
-
const e = await import("./geo_wasm-
|
|
72
|
+
const e = await import("./geo_wasm-BBuWXukA.js");
|
|
71
73
|
await e.default(), this._wasmModule = e, this._setWasmStatus("ready"), this._render();
|
|
72
74
|
} catch (e) {
|
|
73
75
|
if (t < 2) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-component.js","sources":["../src/web-component.ts"],"sourcesContent":["import { createElement } from \"react\"\nimport { createRoot, type Root } from \"react-dom/client\"\nimport { useMeasurementStore } from \"@galileo/girth-manager-ui\"\nimport { GirthManagerWidget } from \"./GirthManagerWidget\"\nimport type { WidgetRequest, WidgetResponse } from \"./types\"\n\n/**\n * Custom Element wrapper for Angular / vanilla JS integration.\n *\n * WASM is loaded automatically from the bundled package — no manual\n * loading required. Just set the `request` property:\n *\n * Usage in Angular:\n * async ngAfterViewInit() {\n * this.widgetEl.nativeElement.request = { spacing_type: 'BK', scan_url: '...' };\n * }\n *\n * <girth-manager-widget #widgetEl (widgetComplete)=\"onComplete($event)\"></girth-manager-widget>\n *\n * To provide your own WASM module (advanced), set `wasmModule` before `request`.\n */\nclass GirthManagerWidgetElement extends HTMLElement {\n private _root: Root | null = null\n private _request: WidgetRequest | null = null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wasmModule: any = undefined\n private _wasmLoading = false\n private _wasmStatus: \"idle\" | \"loading\" | \"ready\" | \"error\" = \"idle\"\n\n static get observedAttributes() {\n return [\"request\"]\n }\n\n get request(): WidgetRequest | null {\n return this._request\n }\n\n set request(value: WidgetRequest | string | null) {\n if (typeof value === \"string\") {\n try {\n this._request = JSON.parse(value)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON for request attribute:\", value)\n return\n }\n } else {\n this._request = value\n }\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n this._render()\n }\n\n /** Set a pre-loaded WASM module (optional — auto-loaded from bundle if not set). */\n get wasmModule() {\n return this._wasmModule\n }\n\n set wasmModule(value: unknown) {\n this._wasmModule = value\n this._setWasmStatus(\"ready\")\n this._render()\n }\n\n /** Current WASM loading status: \"idle\" | \"loading\" | \"ready\" | \"error\" */\n get wasmStatus() {\n return this._wasmStatus\n }\n\n private _setWasmStatus(status: typeof this._wasmStatus) {\n this._wasmStatus = status\n this.setAttribute(\"wasm-status\", status)\n this.dispatchEvent(new CustomEvent(\"wasmStatusChange\", {\n detail: { status },\n bubbles: true,\n composed: true,\n }))\n }\n\n /** Auto-load WASM from the bundled package export with retry */\n private async _autoLoadWasm(attempt = 0): Promise<void> {\n if (this._wasmModule || this._wasmLoading) return\n this._wasmLoading = true\n this._setWasmStatus(\"loading\")\n try {\n const wasm = await import(\"geo-wasm\")\n await wasm.default()\n this._wasmModule = wasm\n this._setWasmStatus(\"ready\")\n this._render()\n } catch (err) {\n if (attempt < 2) {\n // Retry after backoff: 1s, 3s\n const delay = (attempt + 1) * 1000 + attempt * 1000\n console.warn(`[GirthManagerWidget] WASM load failed (attempt ${attempt + 1}/3), retrying in ${delay}ms...`, err)\n this._wasmLoading = false\n await new Promise(r => setTimeout(r, delay))\n return this._autoLoadWasm(attempt + 1)\n }\n console.error(\"[GirthManagerWidget] WASM load failed after 3 attempts:\", err)\n this._setWasmStatus(\"error\")\n this.dispatchEvent(new CustomEvent(\"wasmError\", {\n detail: { error: err instanceof Error ? err.message : String(err) },\n bubbles: true,\n composed: true,\n }))\n } finally {\n this._wasmLoading = false\n }\n }\n\n connectedCallback() {\n const shadow = this.attachShadow({ mode: \"open\" })\n const container = document.createElement(\"div\")\n container.style.width = \"100%\"\n container.style.height = \"100%\"\n shadow.appendChild(container)\n this._root = createRoot(container)\n\n // Recover properties set before custom element upgrade.\n // When the element is created in HTML before customElements.define() runs,\n // property assignments (el.request = {...}) become own-properties on the\n // HTMLElement instance and bypass the class setters. We must pick them up.\n for (const prop of [\"request\", \"wasmModule\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = (this as any)[prop]\n delete (this as any)[prop] // remove own-property so setter is reachable\n ;(this as any)[prop] = value // re-assign through the class setter\n }\n }\n\n // Parse request from attribute if set before connection\n const attrValue = this.getAttribute(\"request\")\n if (attrValue && !this._request) {\n try {\n this._request = JSON.parse(attrValue)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n\n this._render()\n }\n\n disconnectedCallback() {\n this._root?.unmount()\n this._root = null\n // Clear module-scoped Zustand state so a re-mounted widget starts fresh\n // (prevents landmarks/alignment carrying over across widget instances).\n useMeasurementStore.getState().reset()\n }\n\n /**\n * Reset the widget to its initial state without removing it from the DOM.\n * Unmounts and re-mounts the React tree, clearing all internal state\n * (Zustand store, WASM memory, landmarks, measurements).\n *\n * Usage in Angular:\n * this.widgetEl.nativeElement.reset();\n * this.widgetEl.nativeElement.request = { ... }; // re-initialize\n */\n reset() {\n if (!this._root) return\n // Unmount the current React tree (clears all component state + triggers\n // GirthManagerCore's cleanup effects that dispose THREE geometries/meshes).\n this._root.unmount()\n // Clear module-scoped Zustand state too — otherwise landmarks/alignment\n // from the previous scan would carry into the next one.\n useMeasurementStore.getState().reset()\n // Re-create the root on the same container\n const container = this.shadowRoot?.querySelector(\"div\")\n if (container) {\n this._root = createRoot(container)\n }\n this._request = null\n // Keep _wasmModule — it's reusable across resets\n }\n\n attributeChangedCallback(name: string, _oldValue: string, newValue: string) {\n if (name === \"request\" && newValue) {\n try {\n this._request = JSON.parse(newValue)\n this._render()\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n }\n\n private _handleComplete = (response: WidgetResponse) => {\n this.dispatchEvent(\n new CustomEvent(\"widgetComplete\", {\n detail: response,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n private _render() {\n if (!this._root || !this._request) return\n\n this._root.render(\n createElement(GirthManagerWidget, {\n request: this._request,\n onComplete: this._handleComplete,\n // Pass undefined while loading so GirthManagerCore shows \"Loading WASM...\"\n // Pass null only if consumer explicitly set wasmModule=null (JS fallback)\n wasmModule: this._wasmModule === undefined && this._wasmStatus === \"loading\"\n ? undefined\n : this._wasmModule,\n })\n )\n }\n}\n\n// Register the custom element\nif (!customElements.get(\"girth-manager-widget\")) {\n customElements.define(\"girth-manager-widget\", GirthManagerWidgetElement)\n}\n\nexport { GirthManagerWidgetElement }\nexport type { WidgetRequest, WidgetResponse }\n"],"names":["GirthManagerWidgetElement","response","value","status","attempt","wasm","err","delay","shadow","container","createRoot","prop","attrValue","useMeasurementStore","name","_oldValue","newValue","createElement","GirthManagerWidget"],"mappings":";;;;;;;;;;AAqBA,MAAMA,UAAkC,YAAY;AAAA,EAApD,cAAA;AAAA,UAAA,GAAA,SAAA,GACI,KAAQ,QAAqB,MAC7B,KAAQ,WAAiC,MAEzC,KAAQ,cAAmB,QAC3B,KAAQ,eAAe,IACvB,KAAQ,cAAsD,QAyK9D,KAAQ,kBAAkB,CAACC,MAA6B;AACpD,WAAK;AAAA,QACD,IAAI,YAAY,kBAAkB;AAAA,UAC9B,QAAQA;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,QAAA,CACb;AAAA,MAAA;AAAA,IAET;AAAA,EAAA;AAAA,EA/KA,WAAW,qBAAqB;AAC5B,WAAO,CAAC,SAAS;AAAA,EACrB;AAAA,EAEA,IAAI,UAAgC;AAChC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,QAAQC,GAAsC;AAC9C,QAAI,OAAOA,KAAU;AACjB,UAAI;AACA,aAAK,WAAW,KAAK,MAAMA,CAAK;AAAA,MACpC,QAAQ;AACJ,gBAAQ,MAAM,4DAA4DA,CAAK;AAC/E;AAAA,MACJ;AAAA;AAEA,WAAK,WAAWA;AAGpB,IAAI,KAAK,YAAY,CAAC,KAAK,eACvB,KAAK,cAAA,GAET,KAAK,QAAA;AAAA,EACT;AAAA;AAAA,EAGA,IAAI,aAAa;AACb,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,WAAWA,GAAgB;AA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AC1E;AAAA,EAER;AAAA,EAYQ,UAAU;AACd,IAAI,CAAC,KAAK,SAAS,CAAC,KAAK,YAEzB,KAAK,MAAM;AAAA,MACPC,EAAcC,GAAoB;AAAA,QAC9B,SAAS,KAAK;AAAA,QACd,YAAY,KAAK;AAAA;AAAA;AAAA,QAGjB,YAAY,KAAK,gBAAgB,UAAa,KAAK,gBAAgB,YAC7D,SACA,KAAK;AAAA,MAAA,CACd;AAAA,IAAA;AAAA,EAET;AACJ;AAGK,eAAe,IAAI,sBAAsB,KAC1C,eAAe,OAAO,wBAAwBlB,CAAyB;"}
|
|
1
|
+
{"version":3,"file":"web-component.js","sources":["../src/web-component.ts"],"sourcesContent":["import { createElement } from \"react\"\nimport { createRoot, type Root } from \"react-dom/client\"\nimport { useMeasurementStore } from \"@galileo/girth-manager-ui\"\nimport { GirthManagerWidget } from \"./GirthManagerWidget\"\nimport type { WidgetRequest, WidgetResponse } from \"./types\"\n\n/**\n * Custom Element wrapper for Angular / vanilla JS integration.\n *\n * WASM is loaded automatically from the bundled package — no manual\n * loading required. Just set the `request` property:\n *\n * Usage in Angular:\n * async ngAfterViewInit() {\n * this.widgetEl.nativeElement.request = { spacing_type: 'BK', scan_url: '...' };\n * }\n *\n * <girth-manager-widget #widgetEl (widgetComplete)=\"onComplete($event)\"></girth-manager-widget>\n *\n * To provide your own WASM module (advanced), set `wasmModule` before `request`.\n */\nclass GirthManagerWidgetElement extends HTMLElement {\n private _root: Root | null = null\n private _request: WidgetRequest | null = null\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _wasmModule: any = undefined\n private _wasmLoading = false\n private _wasmStatus: \"idle\" | \"loading\" | \"ready\" | \"error\" = \"idle\"\n\n static get observedAttributes() {\n return [\"request\"]\n }\n\n get request(): WidgetRequest | null {\n return this._request\n }\n\n set request(value: WidgetRequest | string | null) {\n if (typeof value === \"string\") {\n try {\n this._request = JSON.parse(value)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON for request attribute:\", value)\n return\n }\n } else {\n this._request = value\n }\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n this._render()\n }\n\n /** Set a pre-loaded WASM module (optional — auto-loaded from bundle if not set). */\n get wasmModule() {\n return this._wasmModule\n }\n\n set wasmModule(value: unknown) {\n this._wasmModule = value\n this._setWasmStatus(\"ready\")\n this._render()\n }\n\n /** Current WASM loading status: \"idle\" | \"loading\" | \"ready\" | \"error\" */\n get wasmStatus() {\n return this._wasmStatus\n }\n\n private _setWasmStatus(status: typeof this._wasmStatus) {\n this._wasmStatus = status\n this.setAttribute(\"wasm-status\", status)\n this.dispatchEvent(new CustomEvent(\"wasmStatusChange\", {\n detail: { status },\n bubbles: true,\n composed: true,\n }))\n }\n\n /** Auto-load WASM from the bundled package export with retry */\n private async _autoLoadWasm(attempt = 0): Promise<void> {\n if (this._wasmModule || this._wasmLoading) return\n this._wasmLoading = true\n this._setWasmStatus(\"loading\")\n try {\n const wasm = await import(\"geo-wasm\")\n await wasm.default()\n this._wasmModule = wasm\n this._setWasmStatus(\"ready\")\n this._render()\n } catch (err) {\n if (attempt < 2) {\n // Retry after backoff: 1s, 3s\n const delay = (attempt + 1) * 1000 + attempt * 1000\n console.warn(`[GirthManagerWidget] WASM load failed (attempt ${attempt + 1}/3), retrying in ${delay}ms...`, err)\n this._wasmLoading = false\n await new Promise(r => setTimeout(r, delay))\n return this._autoLoadWasm(attempt + 1)\n }\n console.error(\"[GirthManagerWidget] WASM load failed after 3 attempts:\", err)\n this._setWasmStatus(\"error\")\n this.dispatchEvent(new CustomEvent(\"wasmError\", {\n detail: { error: err instanceof Error ? err.message : String(err) },\n bubbles: true,\n composed: true,\n }))\n } finally {\n this._wasmLoading = false\n }\n }\n\n connectedCallback() {\n const shadow = this.attachShadow({ mode: \"open\" })\n const container = document.createElement(\"div\")\n container.style.width = \"100%\"\n container.style.height = \"100%\"\n shadow.appendChild(container)\n this._root = createRoot(container)\n\n // Recover properties set before custom element upgrade.\n // When the element is created in HTML before customElements.define() runs,\n // property assignments (el.request = {...}) become own-properties on the\n // HTMLElement instance and bypass the class setters. We must pick them up.\n for (const prop of [\"request\", \"wasmModule\"] as const) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = (this as any)[prop]\n delete (this as any)[prop] // remove own-property so setter is reachable\n ;(this as any)[prop] = value // re-assign through the class setter\n }\n }\n\n // Parse request from attribute if set before connection\n const attrValue = this.getAttribute(\"request\")\n if (attrValue && !this._request) {\n try {\n this._request = JSON.parse(attrValue)\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n\n // Auto-load WASM from bundle if not externally provided\n if (this._request && !this._wasmModule) {\n this._autoLoadWasm()\n }\n\n this._render()\n }\n\n disconnectedCallback() {\n this._root?.unmount()\n this._root = null\n // Clear module-scoped Zustand state so a re-mounted widget starts fresh\n // (prevents landmarks/alignment carrying over across widget instances).\n useMeasurementStore.getState().reset()\n }\n\n /**\n * Reset the widget to its initial state without removing it from the DOM.\n * Unmounts and re-mounts the React tree, clearing all internal state\n * (Zustand store, WASM memory, landmarks, measurements).\n *\n * Usage in Angular:\n * this.widgetEl.nativeElement.reset();\n * this.widgetEl.nativeElement.request = { ... }; // re-initialize\n */\n reset() {\n if (!this._root) return\n // Unmount the current React tree (clears all component state + triggers\n // GirthManagerCore's cleanup effects that dispose THREE geometries/meshes).\n this._root.unmount()\n // Clear module-scoped Zustand state too — otherwise landmarks/alignment\n // from the previous scan would carry into the next one.\n useMeasurementStore.getState().reset()\n // Re-create the root on the same container\n const container = this.shadowRoot?.querySelector(\"div\")\n if (container) {\n this._root = createRoot(container)\n }\n this._request = null\n // Keep _wasmModule — it's reusable across resets\n }\n\n attributeChangedCallback(name: string, _oldValue: string, newValue: string) {\n if (name === \"request\" && newValue) {\n try {\n this._request = JSON.parse(newValue)\n this._render()\n } catch {\n console.error(\"[GirthManagerWidget] Invalid JSON in request attribute\")\n }\n }\n }\n\n private _handleComplete = (response: WidgetResponse) => {\n this.dispatchEvent(\n new CustomEvent(\"widgetComplete\", {\n detail: response,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n private _render() {\n if (!this._root || !this._request) return\n\n this._root.render(\n createElement(GirthManagerWidget, {\n request: this._request,\n onComplete: this._handleComplete,\n // Pass undefined while loading so GirthManagerCore shows \"Loading WASM...\"\n // Pass null only if consumer explicitly set wasmModule=null (JS fallback)\n wasmModule: this._wasmModule === undefined && this._wasmStatus === \"loading\"\n ? undefined\n : this._wasmModule,\n })\n )\n }\n}\n\n// Register the custom element\nif (!customElements.get(\"girth-manager-widget\")) {\n customElements.define(\"girth-manager-widget\", GirthManagerWidgetElement)\n}\n\nexport { GirthManagerWidgetElement }\nexport type { WidgetRequest, WidgetResponse }\n"],"names":["GirthManagerWidgetElement","response","value","status","attempt","wasm","err","delay","shadow","container","createRoot","prop","attrValue","useMeasurementStore","name","_oldValue","newValue","createElement","GirthManagerWidget"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,UAAkC,YAAY;AAAA,EAApD,cAAA;AAAA,UAAA,GAAA,SAAA,GACI,KAAQ,QAAqB,MAC7B,KAAQ,WAAiC,MAEzC,KAAQ,cAAmB,QAC3B,KAAQ,eAAe,IACvB,KAAQ,cAAsD,QAyK9D,KAAQ,kBAAkB,CAACC,MAA6B;AACpD,WAAK;AAAA,QACD,IAAI,YAAY,kBAAkB;AAAA,UAC9B,QAAQA;AAAA,UACR,SAAS;AAAA,UACT,UAAU;AAAA,QAAA,CACb;AAAA,MAAA;AAAA,IAET;AAAA,EAAA;AAAA,EA/KA,WAAW,qBAAqB;AAC5B,WAAO,CAAC,SAAS;AAAA,EACrB;AAAA,EAEA,IAAI,UAAgC;AAChC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,QAAQC,GAAsC;AAC9C,QAAI,OAAOA,KAAU;AACjB,UAAI;AACA,aAAK,WAAW,KAAK,MAAMA,CAAK;AAAA,MACpC,QAAQ;AACJ,gBAAQ,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