@faicad/faijs 0.13.2 → 0.16.0
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/api/api-namespace.d.ts +7 -0
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +44 -17
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/boolean.d.ts +19 -0
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +71 -12
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +12 -8
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/compound-geom.d.ts +45 -0
- package/dist/api/compound-geom.d.ts.map +1 -0
- package/dist/api/compound-geom.js +85 -0
- package/dist/api/compound-geom.js.map +1 -0
- package/dist/api/edge-ref.d.ts.map +1 -1
- package/dist/api/edge-ref.js +7 -4
- package/dist/api/edge-ref.js.map +1 -1
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +1 -0
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +131 -3
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/face-ref.d.ts.map +1 -1
- package/dist/api/face-ref.js +7 -4
- package/dist/api/face-ref.js.map +1 -1
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +6 -5
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/generated/cad/script-face.d.ts +1 -1
- package/dist/api/generated/cad/script-face.d.ts.map +1 -1
- package/dist/api/generated/cad/script-face.js +1 -2
- package/dist/api/generated/cad/script-face.js.map +1 -1
- package/dist/api/generated/operations.js +16 -16
- package/dist/api/generated/operations.js.map +1 -1
- package/dist/api/generated/script-face-manifest.d.ts.map +1 -1
- package/dist/api/generated/script-face-manifest.js +0 -2
- package/dist/api/generated/script-face-manifest.js.map +1 -1
- package/dist/api/generated/script-face.d.ts +1 -7
- package/dist/api/generated/script-face.d.ts.map +1 -1
- package/dist/api/generated/script-face.js +2 -4
- package/dist/api/generated/script-face.js.map +1 -1
- package/dist/api/generated/sketching.js +1 -1
- package/dist/api/generated/sketching.js.map +1 -1
- package/dist/api/generated/topology.d.ts +0 -56
- package/dist/api/generated/topology.d.ts.map +1 -1
- package/dist/api/generated/topology.js +19 -68
- package/dist/api/generated/topology.js.map +1 -1
- package/dist/api/import-brep.d.ts +36 -0
- package/dist/api/import-brep.d.ts.map +1 -0
- package/dist/api/import-brep.js +72 -0
- package/dist/api/import-brep.js.map +1 -0
- package/dist/api/import-step.d.ts +28 -0
- package/dist/api/import-step.d.ts.map +1 -0
- package/dist/api/import-step.js +57 -0
- package/dist/api/import-step.js.map +1 -0
- package/dist/api/index.d.ts +8 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +22 -16
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +2 -1
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/compat-projection.d.ts +3 -1
- package/dist/api/internal/compat-projection.d.ts.map +1 -1
- package/dist/api/internal/compat-projection.js +8 -5
- package/dist/api/internal/compat-projection.js.map +1 -1
- package/dist/api/internal/replica-role-table.d.ts +36 -0
- package/dist/api/internal/replica-role-table.d.ts.map +1 -0
- package/dist/api/internal/replica-role-table.js +73 -0
- package/dist/api/internal/replica-role-table.js.map +1 -0
- package/dist/api/internal/result-unwrap.d.ts +3 -1
- package/dist/api/internal/result-unwrap.d.ts.map +1 -1
- package/dist/api/internal/result-unwrap.js +2 -2
- package/dist/api/internal/result-unwrap.js.map +1 -1
- package/dist/api/knurl.d.ts.map +1 -1
- package/dist/api/knurl.js +1 -0
- package/dist/api/knurl.js.map +1 -1
- package/dist/api/occt-kernel-bridge.d.ts +105 -27
- package/dist/api/occt-kernel-bridge.d.ts.map +1 -1
- package/dist/api/occt-kernel-bridge.js +255 -41
- package/dist/api/occt-kernel-bridge.js.map +1 -1
- package/dist/api/pattern.d.ts +32 -0
- package/dist/api/pattern.d.ts.map +1 -0
- package/dist/api/pattern.js +85 -0
- package/dist/api/pattern.js.map +1 -0
- package/dist/api/place.d.ts +35 -0
- package/dist/api/place.d.ts.map +1 -0
- package/dist/api/place.js +113 -0
- package/dist/api/place.js.map +1 -0
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +10 -3
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/replicate.d.ts +145 -0
- package/dist/api/replicate.d.ts.map +1 -0
- package/dist/api/replicate.js +351 -0
- package/dist/api/replicate.js.map +1 -0
- package/dist/api/revolve.d.ts +36 -0
- package/dist/api/revolve.d.ts.map +1 -0
- package/dist/api/revolve.js +165 -0
- package/dist/api/revolve.js.map +1 -0
- package/dist/api/screw.d.ts.map +1 -1
- package/dist/api/screw.js +1 -0
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts.map +1 -1
- package/dist/api/sdf.js +1 -0
- package/dist/api/sdf.js.map +1 -1
- package/dist/api/sketch.d.ts.map +1 -1
- package/dist/api/sketch.js +1 -0
- package/dist/api/sketch.js.map +1 -1
- package/dist/api/split.d.ts +31 -0
- package/dist/api/split.d.ts.map +1 -0
- package/dist/api/split.js +96 -0
- package/dist/api/split.js.map +1 -0
- package/dist/api/surface/arg-spec.d.ts +17 -0
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +86 -66
- package/dist/api/surface/arg-spec.js.map +1 -1
- package/dist/api/surface/projection-overrides.d.ts.map +1 -1
- package/dist/api/surface/projection-overrides.js +6 -0
- package/dist/api/surface/projection-overrides.js.map +1 -1
- package/dist/api/topo-resolve.d.ts.map +1 -1
- package/dist/api/topo-resolve.js +65 -3
- package/dist/api/topo-resolve.js.map +1 -1
- package/dist/api/transform.d.ts +4 -0
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +44 -12
- package/dist/api/transform.js.map +1 -1
- package/dist/boolean/deriveNormals.d.ts +5 -4
- package/dist/boolean/deriveNormals.d.ts.map +1 -1
- package/dist/boolean/deriveNormals.js +24 -7
- package/dist/boolean/deriveNormals.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +34 -1
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +62 -22
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +66 -0
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +44 -1
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +1 -5
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +246 -9
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/primitives.d.ts +96 -0
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/types.d.ts +66 -6
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +6 -1
- package/dist/brep/export/step.js.map +1 -1
- package/dist/brep/face-evolution.d.ts +78 -8
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +130 -17
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +108 -12
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/browser.d.ts +6 -28
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +6 -17
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.d.ts +13 -0
- package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.js +27 -0
- package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +46 -3
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +48 -3
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/browser-lib-loader.d.ts +4 -4
- package/dist/cad-runtime/browser-lib-loader.d.ts.map +1 -1
- package/dist/cad-runtime/browser-lib-loader.js +7 -4
- package/dist/cad-runtime/browser-lib-loader.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +14 -4
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/module-registry.d.ts +3 -1
- package/dist/cad-runtime/module-registry.d.ts.map +1 -1
- package/dist/cad-runtime/module-registry.js +13 -1
- package/dist/cad-runtime/module-registry.js.map +1 -1
- package/dist/cad-runtime/runtime-concurrent-error.d.ts +38 -0
- package/dist/cad-runtime/runtime-concurrent-error.d.ts.map +1 -0
- package/dist/cad-runtime/runtime-concurrent-error.js +43 -0
- package/dist/cad-runtime/runtime-concurrent-error.js.map +1 -0
- package/dist/cad-runtime/runtime.d.ts +52 -2
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +180 -9
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +22 -0
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +82 -12
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +38 -0
- package/dist/env-agnostic.d.ts.map +1 -0
- package/dist/env-agnostic.js +29 -0
- package/dist/env-agnostic.js.map +1 -0
- package/dist/fcstd/attachment.d.ts +8 -1
- package/dist/fcstd/attachment.d.ts.map +1 -1
- package/dist/fcstd/attachment.js +7 -1
- package/dist/fcstd/attachment.js.map +1 -1
- package/dist/fcstd/build-fai-zip.d.ts.map +1 -1
- package/dist/fcstd/build-fai-zip.js +12 -7
- package/dist/fcstd/build-fai-zip.js.map +1 -1
- package/dist/fcstd/codegen.d.ts +10 -1
- package/dist/fcstd/codegen.d.ts.map +1 -1
- package/dist/fcstd/codegen.js +158 -49
- package/dist/fcstd/codegen.js.map +1 -1
- package/dist/fcstd/contour.d.ts.map +1 -1
- package/dist/fcstd/contour.js +23 -24
- package/dist/fcstd/contour.js.map +1 -1
- package/dist/fcstd/convert.d.ts +2 -18
- package/dist/fcstd/convert.d.ts.map +1 -1
- package/dist/fcstd/convert.js +35 -53
- package/dist/fcstd/convert.js.map +1 -1
- package/dist/fcstd/expressions.d.ts +24 -0
- package/dist/fcstd/expressions.d.ts.map +1 -1
- package/dist/fcstd/expressions.js +91 -0
- package/dist/fcstd/expressions.js.map +1 -1
- package/dist/fcstd/external-geo.d.ts +12 -1
- package/dist/fcstd/external-geo.d.ts.map +1 -1
- package/dist/fcstd/external-geo.js +15 -1
- package/dist/fcstd/external-geo.js.map +1 -1
- package/dist/fcstd/feature-translate.d.ts +21 -1
- package/dist/fcstd/feature-translate.d.ts.map +1 -1
- package/dist/fcstd/feature-translate.js +124 -8
- package/dist/fcstd/feature-translate.js.map +1 -1
- package/dist/fcstd/structural-types.d.ts +83 -0
- package/dist/fcstd/structural-types.d.ts.map +1 -0
- package/dist/fcstd/structural-types.js +121 -0
- package/dist/fcstd/structural-types.js.map +1 -0
- package/dist/index.d.ts +7 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -16
- package/dist/index.js.map +1 -1
- package/dist/lang/determinism-scanner.d.ts +71 -0
- package/dist/lang/determinism-scanner.d.ts.map +1 -0
- package/dist/lang/determinism-scanner.js +625 -0
- package/dist/lang/determinism-scanner.js.map +1 -0
- package/dist/lang/symbol-table.d.ts +31 -0
- package/dist/lang/symbol-table.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.d.ts +13 -19
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +13 -19
- package/dist/lang/symbol-table.generated.js.map +1 -1
- package/dist/lang/symbol-table.js +50 -1
- package/dist/lang/symbol-table.js.map +1 -1
- package/dist/mesh/creased-normals.d.ts +50 -0
- package/dist/mesh/creased-normals.d.ts.map +1 -0
- package/dist/mesh/creased-normals.js +114 -0
- package/dist/mesh/creased-normals.js.map +1 -0
- package/dist/mesh/decoration-provider.d.ts +53 -0
- package/dist/mesh/decoration-provider.d.ts.map +1 -0
- package/dist/mesh/decoration-provider.js +21 -0
- package/dist/mesh/decoration-provider.js.map +1 -0
- package/dist/mesh/engrave.d.ts +4 -0
- package/dist/mesh/engrave.d.ts.map +1 -1
- package/dist/mesh/engrave.js +22 -31
- package/dist/mesh/engrave.js.map +1 -1
- package/dist/mesh/index.d.ts +5 -14
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +7 -18
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +2 -1
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +5 -7
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/primitives.d.ts +5 -18
- package/dist/mesh/primitives.d.ts.map +1 -1
- package/dist/mesh/primitives.js +4 -48
- package/dist/mesh/primitives.js.map +1 -1
- package/dist/mesh/stl-loader.d.ts +23 -0
- package/dist/mesh/stl-loader.d.ts.map +1 -0
- package/dist/mesh/stl-loader.js +139 -0
- package/dist/mesh/stl-loader.js.map +1 -0
- package/dist/module-resolver/parse-imports.d.ts +37 -0
- package/dist/module-resolver/parse-imports.d.ts.map +1 -0
- package/dist/module-resolver/parse-imports.js +39 -0
- package/dist/module-resolver/parse-imports.js.map +1 -0
- package/dist/module-resolver/resolver.d.ts +1 -1
- package/dist/module-resolver/resolver.js +2 -2
- package/dist/module-resolver/resolver.js.map +1 -1
- package/dist/node-host/cli.d.ts.map +1 -1
- package/dist/node-host/cli.js +37 -4
- package/dist/node-host/cli.js.map +1 -1
- package/dist/primitives/text/cjk-font.d.ts +42 -0
- package/dist/primitives/text/cjk-font.d.ts.map +1 -0
- package/dist/primitives/text/cjk-font.js +86 -0
- package/dist/primitives/text/cjk-font.js.map +1 -0
- package/dist/runtime-state.d.ts +18 -6
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +9 -1
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.js +2 -2
- package/dist/sdk.js.map +1 -1
- package/dist/shape.d.ts +15 -0
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +26 -3
- package/dist/shape.js.map +1 -1
- package/dist/symbol-table.d.ts +15 -0
- package/dist/symbol-table.d.ts.map +1 -0
- package/dist/symbol-table.js +14 -0
- package/dist/symbol-table.js.map +1 -0
- package/dist/topology/naming/build-naming.d.ts +14 -30
- package/dist/topology/naming/build-naming.d.ts.map +1 -1
- package/dist/topology/naming/build-naming.js +21 -54
- package/dist/topology/naming/build-naming.js.map +1 -1
- package/dist/topology/naming/capture-topo-ref.d.ts.map +1 -1
- package/dist/topology/naming/capture-topo-ref.js +5 -0
- package/dist/topology/naming/capture-topo-ref.js.map +1 -1
- package/dist/topology/naming/index.d.ts +3 -0
- package/dist/topology/naming/index.d.ts.map +1 -1
- package/dist/topology/naming/index.js +3 -0
- package/dist/topology/naming/index.js.map +1 -1
- package/dist/topology/naming/lineage-resolve.d.ts +80 -0
- package/dist/topology/naming/lineage-resolve.d.ts.map +1 -0
- package/dist/topology/naming/lineage-resolve.js +120 -0
- package/dist/topology/naming/lineage-resolve.js.map +1 -0
- package/dist/topology/naming/lineage.d.ts +349 -0
- package/dist/topology/naming/lineage.d.ts.map +1 -0
- package/dist/topology/naming/lineage.js +398 -0
- package/dist/topology/naming/lineage.js.map +1 -0
- package/dist/topology/naming/migrate.d.ts +41 -0
- package/dist/topology/naming/migrate.d.ts.map +1 -0
- package/dist/topology/naming/migrate.js +88 -0
- package/dist/topology/naming/migrate.js.map +1 -0
- package/dist/topology/naming/role-name.d.ts +176 -0
- package/dist/topology/naming/role-name.d.ts.map +1 -0
- package/dist/topology/naming/role-name.js +344 -0
- package/dist/topology/naming/role-name.js.map +1 -0
- package/dist/topology/naming/roles.d.ts +20 -22
- package/dist/topology/naming/roles.d.ts.map +1 -1
- package/dist/topology/naming/roles.js +51 -49
- package/dist/topology/naming/roles.js.map +1 -1
- package/dist/topology/naming/types.d.ts +65 -18
- package/dist/topology/naming/types.d.ts.map +1 -1
- package/dist/topology/naming/types.js.map +1 -1
- package/dist/vendored/brepjs/kernel/index.d.ts +5 -0
- package/dist/vendored/brepjs/kernel/index.d.ts.map +1 -1
- package/dist/vendored/brepjs/kernel/index.js +11 -0
- package/dist/vendored/brepjs/kernel/index.js.map +1 -1
- package/dist/weapp.d.ts +4 -4
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +7 -4
- package/dist/weapp.js.map +1 -1
- package/package.json +16 -14
- package/dist/api/compat/index.d.ts +0 -173
- package/dist/api/compat/index.d.ts.map +0 -1
- package/dist/api/compat/index.js +0 -222
- package/dist/api/compat/index.js.map +0 -1
- package/dist/api/compound.d.ts +0 -108
- package/dist/api/compound.d.ts.map +0 -1
- package/dist/api/compound.js +0 -162
- package/dist/api/compound.js.map +0 -1
- package/dist/api/copy.d.ts +0 -39
- package/dist/api/copy.d.ts.map +0 -1
- package/dist/api/copy.js +0 -81
- package/dist/api/copy.js.map +0 -1
- package/dist/api/fai_drill.d.ts +0 -46
- package/dist/api/fai_drill.d.ts.map +0 -1
- package/dist/api/fai_drill.js +0 -230
- package/dist/api/fai_drill.js.map +0 -1
- package/dist/api/fai_extrude.d.ts +0 -36
- package/dist/api/fai_extrude.d.ts.map +0 -1
- package/dist/api/fai_extrude.js +0 -78
- package/dist/api/fai_extrude.js.map +0 -1
- package/dist/api/fai_split.d.ts +0 -46
- package/dist/api/fai_split.d.ts.map +0 -1
- package/dist/api/fai_split.js +0 -253
- package/dist/api/fai_split.js.map +0 -1
- package/dist/api/load.d.ts +0 -39
- package/dist/api/load.d.ts.map +0 -1
- package/dist/api/load.js +0 -82
- package/dist/api/load.js.map +0 -1
- package/dist/api/svgExtrude.d.ts +0 -32
- package/dist/api/svgExtrude.d.ts.map +0 -1
- package/dist/api/svgExtrude.js +0 -73
- package/dist/api/svgExtrude.js.map +0 -1
- package/dist/api/text.d.ts +0 -34
- package/dist/api/text.d.ts.map +0 -1
- package/dist/api/text.js +0 -100
- package/dist/api/text.js.map +0 -1
- package/dist/brep/text/fontTestHelper.d.ts +0 -30
- package/dist/brep/text/fontTestHelper.d.ts.map +0 -1
- package/dist/brep/text/fontTestHelper.js +0 -57
- package/dist/brep/text/fontTestHelper.js.map +0 -1
- package/dist/cad-runtime/module-executor.d.ts +0 -271
- package/dist/cad-runtime/module-executor.d.ts.map +0 -1
- package/dist/cad-runtime/module-executor.js +0 -630
- package/dist/cad-runtime/module-executor.js.map +0 -1
- package/dist/cad-runtime/terminal-dag.d.ts +0 -65
- package/dist/cad-runtime/terminal-dag.d.ts.map +0 -1
- package/dist/cad-runtime/terminal-dag.js +0 -167
- package/dist/cad-runtime/terminal-dag.js.map +0 -1
- package/dist/faqts/browser.d.ts +0 -16
- package/dist/faqts/browser.d.ts.map +0 -1
- package/dist/faqts/browser.js +0 -13
- package/dist/faqts/browser.js.map +0 -1
- package/dist/faqts/exec-blob.d.ts +0 -14
- package/dist/faqts/exec-blob.d.ts.map +0 -1
- package/dist/faqts/exec-blob.js +0 -22
- package/dist/faqts/exec-blob.js.map +0 -1
- package/dist/faqts/exec-node.d.ts +0 -15
- package/dist/faqts/exec-node.d.ts.map +0 -1
- package/dist/faqts/exec-node.js +0 -29
- package/dist/faqts/exec-node.js.map +0 -1
- package/dist/faqts/imports.d.ts +0 -74
- package/dist/faqts/imports.d.ts.map +0 -1
- package/dist/faqts/imports.js +0 -95
- package/dist/faqts/imports.js.map +0 -1
- package/dist/faqts/index.d.ts +0 -22
- package/dist/faqts/index.d.ts.map +0 -1
- package/dist/faqts/index.js +0 -21
- package/dist/faqts/index.js.map +0 -1
- package/dist/faqts/node.d.ts +0 -23
- package/dist/faqts/node.d.ts.map +0 -1
- package/dist/faqts/node.js +0 -23
- package/dist/faqts/node.js.map +0 -1
- package/dist/faqts/run.d.ts +0 -62
- package/dist/faqts/run.d.ts.map +0 -1
- package/dist/faqts/run.js +0 -62
- package/dist/faqts/run.js.map +0 -1
- package/dist/faqts/transform.d.ts +0 -43
- package/dist/faqts/transform.d.ts.map +0 -1
- package/dist/faqts/transform.js +0 -35
- package/dist/faqts/transform.js.map +0 -1
- package/dist/lang/compile.d.ts +0 -50
- package/dist/lang/compile.d.ts.map +0 -1
- package/dist/lang/compile.js +0 -368
- package/dist/lang/compile.js.map +0 -1
- package/dist/lang/keep.d.ts +0 -109
- package/dist/lang/keep.d.ts.map +0 -1
- package/dist/lang/keep.js +0 -226
- package/dist/lang/keep.js.map +0 -1
- package/dist/lang/parser.d.ts +0 -91
- package/dist/lang/parser.d.ts.map +0 -1
- package/dist/lang/parser.js +0 -1594
- package/dist/lang/parser.js.map +0 -1
- package/dist/mesh/drill-hole/DrillHoleCore.d.ts +0 -90
- package/dist/mesh/drill-hole/DrillHoleCore.d.ts.map +0 -1
- package/dist/mesh/drill-hole/DrillHoleCore.js +0 -287
- package/dist/mesh/drill-hole/DrillHoleCore.js.map +0 -1
- package/dist/mesh/drill-hole/drill-types.d.ts +0 -34
- package/dist/mesh/drill-hole/drill-types.d.ts.map +0 -1
- package/dist/mesh/drill-hole/drill-types.js +0 -7
- package/dist/mesh/drill-hole/drill-types.js.map +0 -1
- package/dist/mesh/fai_drill.d.ts +0 -21
- package/dist/mesh/fai_drill.d.ts.map +0 -1
- package/dist/mesh/fai_drill.js +0 -92
- package/dist/mesh/fai_drill.js.map +0 -1
- package/dist/mesh/fai_extrude.d.ts +0 -24
- package/dist/mesh/fai_extrude.d.ts.map +0 -1
- package/dist/mesh/fai_extrude.js +0 -42
- package/dist/mesh/fai_extrude.js.map +0 -1
- package/dist/mesh/fai_split.d.ts +0 -164
- package/dist/mesh/fai_split.d.ts.map +0 -1
- package/dist/mesh/fai_split.js +0 -269
- package/dist/mesh/fai_split.js.map +0 -1
- package/dist/primitives/svg-extrude.d.ts +0 -43
- package/dist/primitives/svg-extrude.d.ts.map +0 -1
- package/dist/primitives/svg-extrude.js +0 -78
- package/dist/primitives/svg-extrude.js.map +0 -1
- package/dist/primitives/text/cjk.d.ts +0 -61
- package/dist/primitives/text/cjk.d.ts.map +0 -1
- package/dist/primitives/text/cjk.js +0 -215
- package/dist/primitives/text/cjk.js.map +0 -1
- package/dist/primitives/text-geometry.d.ts +0 -47
- package/dist/primitives/text-geometry.d.ts.map +0 -1
- package/dist/primitives/text-geometry.js +0 -127
- package/dist/primitives/text-geometry.js.map +0 -1
- package/dist/test-helpers.d.ts +0 -31
- package/dist/test-helpers.d.ts.map +0 -1
- package/dist/test-helpers.js +0 -55
- package/dist/test-helpers.js.map +0 -1
- package/dist/vendored/brepjs/core/kernelReentrancy.d.ts +0 -41
- package/dist/vendored/brepjs/core/kernelReentrancy.d.ts.map +0 -1
- package/dist/vendored/brepjs/core/kernelReentrancy.js +0 -68
- package/dist/vendored/brepjs/core/kernelReentrancy.js.map +0 -1
package/dist/mesh/fai_split.d.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mesh 分割 API
|
|
3
|
-
*
|
|
4
|
-
* 提取来源:engine/boolean/csg.ts (computeSplit/computeDovetailSplit/...)
|
|
5
|
-
* 已是纯数据函数,直接包装。
|
|
6
|
-
*
|
|
7
|
-
* splitWithParams 是 UI 与重放共用的唯一分割入口:
|
|
8
|
-
* 参数编排(planeParams / planeBasis / 爆炸位移 / 世界坐标变换)
|
|
9
|
-
* 全部在此函数内部完成,调用方只需传入 cutMode + normal/offset/inPlaneAngleDeg + bbCenter
|
|
10
|
-
* 以及各 cutMode 专属参数。
|
|
11
|
-
*/
|
|
12
|
-
import type { Shape, SplitResult, SplitPlane, DovetailSplitParams, DowelSplitParams, TenonSplitParams, Vec3 } from './types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Derive the cutting-plane parameters from Euler angles (in degrees), the
|
|
15
|
-
* plane position and the bounding-box center. Behavior is identical to the
|
|
16
|
-
* former split-store.computePlaneParams.
|
|
17
|
-
* @param rotationX - rotation about X in degrees.
|
|
18
|
-
* @param rotationY - rotation about Y in degrees.
|
|
19
|
-
* @param rotationZ - rotation about Z in degrees.
|
|
20
|
-
* @param planePosition - offset of the cutting plane along the plane normal.
|
|
21
|
-
* @param bbCenter - world-space bounding-box center of the source mesh.
|
|
22
|
-
* @returns the plane normal, the plane's signed distance from the origin, and its center.
|
|
23
|
-
*/
|
|
24
|
-
export declare function computePlaneParams(rotationX: number, rotationY: number, rotationZ: number, planePosition: number, bbCenter: Vec3): {
|
|
25
|
-
normal: Vec3;
|
|
26
|
-
originOffset: number;
|
|
27
|
-
planeCenter: Vec3;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Derive the plane basis vectors from Euler angles (in degrees). Behavior is
|
|
31
|
-
* identical to the former split-store.computePlaneBasis.
|
|
32
|
-
* @param rotationX - rotation about X in degrees.
|
|
33
|
-
* @param rotationY - rotation about Y in degrees.
|
|
34
|
-
* @param rotationZ - rotation about Z in degrees.
|
|
35
|
-
* @returns the plane normal plus the in-plane width and depth directions.
|
|
36
|
-
*/
|
|
37
|
-
export declare function computePlaneBasis(rotationX: number, rotationY: number, rotationZ: number): {
|
|
38
|
-
normal: Vec3;
|
|
39
|
-
widthDir: Vec3;
|
|
40
|
-
depthDir: Vec3;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Derive widthDir/depthDir from the cutting-plane normal and the in-plane
|
|
44
|
-
* rotation angle. Matches computePlaneBasis(rx, ry, rz) with
|
|
45
|
-
* normal = eulerXYZToNormal(rx, ry, 0) and inPlaneAngleDeg = rz: the rx/ry
|
|
46
|
-
* Euler XYZ decomposition is recovered from the normal, then the rz rotation
|
|
47
|
-
* is applied.
|
|
48
|
-
*
|
|
49
|
-
* normal = [sin(ry), -sin(rx)*cos(ry), cos(rx)*cos(ry)]
|
|
50
|
-
* ry = asin(normal[0])
|
|
51
|
-
* rx = atan2(-normal[1], normal[2]) (when cos(ry) !== 0)
|
|
52
|
-
* @param normal - cutting-plane unit normal.
|
|
53
|
-
* @param inPlaneAngleDeg - in-plane rotation about the normal, in degrees.
|
|
54
|
-
* @returns the in-plane width and depth directions.
|
|
55
|
-
*/
|
|
56
|
-
export declare function computeBasisFromNormal(normal: Vec3, inPlaneAngleDeg: number): {
|
|
57
|
-
widthDir: Vec3;
|
|
58
|
-
depthDir: Vec3;
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Input parameters for splitWithParams.
|
|
62
|
-
*/
|
|
63
|
-
export interface SplitWithParamsInput {
|
|
64
|
-
/** 源几何(已在世界空间) */
|
|
65
|
-
shape: Shape;
|
|
66
|
-
/** 分割模式 */
|
|
67
|
-
cutMode: 'plane' | 'dovetail' | 'dowel' | 'straight-tenon' | 'tenon' | 'straight';
|
|
68
|
-
/** 切割面法线 */
|
|
69
|
-
normal: Vec3;
|
|
70
|
-
/** 切割面沿法线方向相对 bbCenter 的偏移(标量) */
|
|
71
|
-
offset: number;
|
|
72
|
-
/** 切割面绕法线的面内旋转(角度制,承载原 planeRotation 的 rz 分量) */
|
|
73
|
-
inPlaneAngleDeg: number;
|
|
74
|
-
/** 源 mesh 的世界空间包围盒中心 */
|
|
75
|
-
bbCenter: Vec3;
|
|
76
|
-
/** 源 mesh 的世界空间包围盒尺寸(用于计算 bboxWidthOnWidthDir 和爆炸位移) */
|
|
77
|
-
bboxSize: Vec3;
|
|
78
|
-
/** 燕尾参数(cutMode='dovetail' 时需要) */
|
|
79
|
-
groove?: {
|
|
80
|
-
depth: number;
|
|
81
|
-
depthTolerance: number;
|
|
82
|
-
width: number;
|
|
83
|
-
widthTolerance: number;
|
|
84
|
-
flapsAngle: number;
|
|
85
|
-
};
|
|
86
|
-
/** 定位销参数(cutMode='dowel' 时需要) */
|
|
87
|
-
dowel?: {
|
|
88
|
-
diameter: number;
|
|
89
|
-
diameterTolerance: number;
|
|
90
|
-
height: number;
|
|
91
|
-
heightTolerance: number;
|
|
92
|
-
};
|
|
93
|
-
/** 直榫参数(cutMode='straight-tenon' 时需要) */
|
|
94
|
-
tenon?: {
|
|
95
|
-
sideLength: number;
|
|
96
|
-
sideLengthTolerance: number;
|
|
97
|
-
height: number;
|
|
98
|
-
heightTolerance: number;
|
|
99
|
-
};
|
|
100
|
-
/** 选择的截面(dowel/straight-tenon 用) */
|
|
101
|
-
selectedSections?: number[] | null;
|
|
102
|
-
/** 是否应用爆炸位移(默认 true;导出/重放纯几何时可设 false) */
|
|
103
|
-
applyExplode?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Output of splitWithParams: the two halves plus the derived splitting data.
|
|
107
|
-
*/
|
|
108
|
-
export interface SplitWithParamsResult {
|
|
109
|
-
front: Shape;
|
|
110
|
-
back: Shape;
|
|
111
|
-
/** 实际使用的法线(派生量,供调用方记录/调试) */
|
|
112
|
-
normal: Vec3;
|
|
113
|
-
/** 实际使用的 originOffset(派生量) */
|
|
114
|
-
originOffset: number;
|
|
115
|
-
/** 实际使用的 planeCenter(派生量) */
|
|
116
|
-
planeCenter: Vec3;
|
|
117
|
-
/** 实际使用的 widthDir(派生量) */
|
|
118
|
-
widthDir: Vec3;
|
|
119
|
-
/** 爆炸位移(front 正、back 负) */
|
|
120
|
-
frontExplodeOffset: number;
|
|
121
|
-
backExplodeOffset: number;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Unified split entry point: the single split function shared by the UI
|
|
125
|
-
* executor and script replay. All parameter orchestration (planeParams,
|
|
126
|
-
* planeBasis, bboxWidthOnWidthDir, explode offset) happens inside this
|
|
127
|
-
* function; callers pass only semantic parameters. Both interaction paths
|
|
128
|
-
* (mouse / code) converge here, so the geometry result is identical.
|
|
129
|
-
* @param input - the split mode-specific input (shape, plane, mode params).
|
|
130
|
-
* @returns the split result with front/back halves and derived plane data.
|
|
131
|
-
*/
|
|
132
|
-
export declare function splitWithParams(input: SplitWithParamsInput): Promise<SplitWithParamsResult>;
|
|
133
|
-
/**
|
|
134
|
-
* Plane split of a mesh shape.
|
|
135
|
-
* @param shape - the mesh shape to split.
|
|
136
|
-
* @param plane - the cutting plane (normal + offset).
|
|
137
|
-
* @returns the front and back halves of the shape.
|
|
138
|
-
*/
|
|
139
|
-
export declare function split(shape: Shape, plane: SplitPlane): Promise<{
|
|
140
|
-
front: Shape;
|
|
141
|
-
back: Shape;
|
|
142
|
-
}>;
|
|
143
|
-
/**
|
|
144
|
-
* Dovetail split of a mesh shape.
|
|
145
|
-
* @param shape - the mesh shape to split.
|
|
146
|
-
* @param params - dovetail groove parameters plus the cutting plane setup.
|
|
147
|
-
* @returns the front/back halves and the dovetail wedge.
|
|
148
|
-
*/
|
|
149
|
-
export declare function dovetailSplit(shape: Shape, params: DovetailSplitParams): Promise<SplitResult>;
|
|
150
|
-
/**
|
|
151
|
-
* Dowel-pin split of a mesh shape.
|
|
152
|
-
* @param shape - the mesh shape to split.
|
|
153
|
-
* @param params - dowel parameters plus the cutting plane setup.
|
|
154
|
-
* @returns the front/back halves and the dowel wedge.
|
|
155
|
-
*/
|
|
156
|
-
export declare function dowelSplit(shape: Shape, params: DowelSplitParams): Promise<SplitResult>;
|
|
157
|
-
/**
|
|
158
|
-
* Straight-tenon split of a mesh shape.
|
|
159
|
-
* @param shape - the mesh shape to split.
|
|
160
|
-
* @param params - tenon parameters plus the cutting plane setup.
|
|
161
|
-
* @returns the front/back halves and the tenon wedge.
|
|
162
|
-
*/
|
|
163
|
-
export declare function tenonSplit(shape: Shape, params: TenonSplitParams): Promise<SplitResult>;
|
|
164
|
-
//#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E,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqDjG;AAkED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAGnG;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAenG;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAe7F;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAe7F"}
|
package/dist/mesh/fai_split.js
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mesh 分割 API
|
|
3
|
-
*
|
|
4
|
-
* 提取来源:engine/boolean/csg.ts (computeSplit/computeDovetailSplit/...)
|
|
5
|
-
* 已是纯数据函数,直接包装。
|
|
6
|
-
*
|
|
7
|
-
* splitWithParams 是 UI 与重放共用的唯一分割入口:
|
|
8
|
-
* 参数编排(planeParams / planeBasis / 爆炸位移 / 世界坐标变换)
|
|
9
|
-
* 全部在此函数内部完成,调用方只需传入 cutMode + normal/offset/inPlaneAngleDeg + bbCenter
|
|
10
|
-
* 以及各 cutMode 专属参数。
|
|
11
|
-
*/
|
|
12
|
-
import { computeSplit, computeDovetailSplit, computeDowelSplit, computeStraightTenonSplit, } from '../boolean/csg-backend.js';
|
|
13
|
-
import * as THREE from 'three';
|
|
14
|
-
// ── 派生量计算(从 split-store 下沉,UI 与重放共用同一份公式) ──
|
|
15
|
-
/**
|
|
16
|
-
* Derive the cutting-plane parameters from Euler angles (in degrees), the
|
|
17
|
-
* plane position and the bounding-box center. Behavior is identical to the
|
|
18
|
-
* former split-store.computePlaneParams.
|
|
19
|
-
* @param rotationX - rotation about X in degrees.
|
|
20
|
-
* @param rotationY - rotation about Y in degrees.
|
|
21
|
-
* @param rotationZ - rotation about Z in degrees.
|
|
22
|
-
* @param planePosition - offset of the cutting plane along the plane normal.
|
|
23
|
-
* @param bbCenter - world-space bounding-box center of the source mesh.
|
|
24
|
-
* @returns the plane normal, the plane's signed distance from the origin, and its center.
|
|
25
|
-
*/
|
|
26
|
-
export function computePlaneParams(rotationX, rotationY, rotationZ, planePosition, bbCenter) {
|
|
27
|
-
const rx = (rotationX * Math.PI) / 180;
|
|
28
|
-
const ry = (rotationY * Math.PI) / 180;
|
|
29
|
-
const rz = (rotationZ * Math.PI) / 180;
|
|
30
|
-
const euler = new THREE.Euler(rx, ry, rz, 'XYZ');
|
|
31
|
-
const quat = new THREE.Quaternion().setFromEuler(euler);
|
|
32
|
-
const normalVec = new THREE.Vector3(0, 0, 1).applyQuaternion(quat);
|
|
33
|
-
const normal = [normalVec.x, normalVec.y, normalVec.z];
|
|
34
|
-
const planeCenter = [
|
|
35
|
-
bbCenter[0] + planePosition * normal[0],
|
|
36
|
-
bbCenter[1] + planePosition * normal[1],
|
|
37
|
-
bbCenter[2] + planePosition * normal[2],
|
|
38
|
-
];
|
|
39
|
-
const originOffset = normal[0] * planeCenter[0] + normal[1] * planeCenter[1] + normal[2] * planeCenter[2];
|
|
40
|
-
return { normal, originOffset, planeCenter };
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Derive the plane basis vectors from Euler angles (in degrees). Behavior is
|
|
44
|
-
* identical to the former split-store.computePlaneBasis.
|
|
45
|
-
* @param rotationX - rotation about X in degrees.
|
|
46
|
-
* @param rotationY - rotation about Y in degrees.
|
|
47
|
-
* @param rotationZ - rotation about Z in degrees.
|
|
48
|
-
* @returns the plane normal plus the in-plane width and depth directions.
|
|
49
|
-
*/
|
|
50
|
-
export function computePlaneBasis(rotationX, rotationY, rotationZ) {
|
|
51
|
-
const rx = (rotationX * Math.PI) / 180;
|
|
52
|
-
const ry = (rotationY * Math.PI) / 180;
|
|
53
|
-
const rz = (rotationZ * Math.PI) / 180;
|
|
54
|
-
const euler = new THREE.Euler(rx, ry, rz, 'XYZ');
|
|
55
|
-
const quat = new THREE.Quaternion().setFromEuler(euler);
|
|
56
|
-
const normalVec = new THREE.Vector3(0, 0, 1).applyQuaternion(quat);
|
|
57
|
-
const widthVec = new THREE.Vector3(1, 0, 0).applyQuaternion(quat);
|
|
58
|
-
const depthVec = new THREE.Vector3(0, 1, 0).applyQuaternion(quat);
|
|
59
|
-
return {
|
|
60
|
-
normal: [normalVec.x, normalVec.y, normalVec.z],
|
|
61
|
-
widthDir: [widthVec.x, widthVec.y, widthVec.z],
|
|
62
|
-
depthDir: [depthVec.x, depthVec.y, depthVec.z],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// ── 从法线 + 面内旋转推导基向量(纯数学,无 THREE 依赖) ──
|
|
66
|
-
/**
|
|
67
|
-
* Derive widthDir/depthDir from the cutting-plane normal and the in-plane
|
|
68
|
-
* rotation angle. Matches computePlaneBasis(rx, ry, rz) with
|
|
69
|
-
* normal = eulerXYZToNormal(rx, ry, 0) and inPlaneAngleDeg = rz: the rx/ry
|
|
70
|
-
* Euler XYZ decomposition is recovered from the normal, then the rz rotation
|
|
71
|
-
* is applied.
|
|
72
|
-
*
|
|
73
|
-
* normal = [sin(ry), -sin(rx)*cos(ry), cos(rx)*cos(ry)]
|
|
74
|
-
* ry = asin(normal[0])
|
|
75
|
-
* rx = atan2(-normal[1], normal[2]) (when cos(ry) !== 0)
|
|
76
|
-
* @param normal - cutting-plane unit normal.
|
|
77
|
-
* @param inPlaneAngleDeg - in-plane rotation about the normal, in degrees.
|
|
78
|
-
* @returns the in-plane width and depth directions.
|
|
79
|
-
*/
|
|
80
|
-
export function computeBasisFromNormal(normal, inPlaneAngleDeg) {
|
|
81
|
-
const sinRy = Math.max(-1, Math.min(1, normal[0]));
|
|
82
|
-
const ry = Math.asin(sinRy);
|
|
83
|
-
const cosRy = Math.cos(ry);
|
|
84
|
-
let rx;
|
|
85
|
-
if (Math.abs(cosRy) < 1e-10) {
|
|
86
|
-
// 万向锁:ry = ±90°,rx 与 rz 耦合,设 rx = 0
|
|
87
|
-
rx = 0;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
rx = Math.atan2(-normal[1], normal[2]);
|
|
91
|
-
}
|
|
92
|
-
const rz = (inPlaneAngleDeg * Math.PI) / 180;
|
|
93
|
-
// R = RX(rx) · RY(ry)(不含 rz 的部分)
|
|
94
|
-
// widthDir = R · (cos(rz), sin(rz), 0)
|
|
95
|
-
// depthDir = R · (-sin(rz), cos(rz), 0)
|
|
96
|
-
const cr = Math.cos(ry), sr = Math.sin(ry);
|
|
97
|
-
const cx = Math.cos(rx), sx = Math.sin(rx);
|
|
98
|
-
const cosRz = Math.cos(rz), sinRz = Math.sin(rz);
|
|
99
|
-
const widthDir = [
|
|
100
|
-
cr * cosRz,
|
|
101
|
-
sx * sr * cosRz + cx * sinRz,
|
|
102
|
-
-cx * sr * cosRz + sx * sinRz,
|
|
103
|
-
];
|
|
104
|
-
const depthDir = [
|
|
105
|
-
-cr * sinRz,
|
|
106
|
-
-sx * sr * sinRz + cx * cosRz,
|
|
107
|
-
cx * sr * sinRz + sx * cosRz,
|
|
108
|
-
];
|
|
109
|
-
return { widthDir, depthDir };
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Unified split entry point: the single split function shared by the UI
|
|
113
|
-
* executor and script replay. All parameter orchestration (planeParams,
|
|
114
|
-
* planeBasis, bboxWidthOnWidthDir, explode offset) happens inside this
|
|
115
|
-
* function; callers pass only semantic parameters. Both interaction paths
|
|
116
|
-
* (mouse / code) converge here, so the geometry result is identical.
|
|
117
|
-
* @param input - the split mode-specific input (shape, plane, mode params).
|
|
118
|
-
* @returns the split result with front/back halves and derived plane data.
|
|
119
|
-
*/
|
|
120
|
-
export async function splitWithParams(input) {
|
|
121
|
-
const { shape, cutMode, normal, offset, inPlaneAngleDeg, bbCenter, bboxSize } = input;
|
|
122
|
-
// 1. 从 normal + offset + bbCenter 派生切割平面参数
|
|
123
|
-
const planeCenter = [
|
|
124
|
-
bbCenter[0] + offset * normal[0],
|
|
125
|
-
bbCenter[1] + offset * normal[1],
|
|
126
|
-
bbCenter[2] + offset * normal[2],
|
|
127
|
-
];
|
|
128
|
-
const originOffset = normal[0] * planeCenter[0] + normal[1] * planeCenter[1] + normal[2] * planeCenter[2];
|
|
129
|
-
// 2. 从 normal + inPlaneAngleDeg 派生基向量
|
|
130
|
-
const { widthDir } = computeBasisFromNormal(normal, inPlaneAngleDeg);
|
|
131
|
-
// 3. 按 cutMode 分发
|
|
132
|
-
let front;
|
|
133
|
-
let back;
|
|
134
|
-
if (cutMode === 'dovetail') {
|
|
135
|
-
const bboxWidthOnWidthDir = Math.abs(bboxSize[0] * widthDir[0]) +
|
|
136
|
-
Math.abs(bboxSize[1] * widthDir[1]) +
|
|
137
|
-
Math.abs(bboxSize[2] * widthDir[2]);
|
|
138
|
-
const groove = input.groove ?? {
|
|
139
|
-
depth: 0, depthTolerance: 0, width: 0, widthTolerance: 0, flapsAngle: 0,
|
|
140
|
-
};
|
|
141
|
-
const result = await computeDovetailSplit(shape, normal, originOffset, planeCenter, widthDir, bboxWidthOnWidthDir, groove);
|
|
142
|
-
front = result.front;
|
|
143
|
-
back = result.back;
|
|
144
|
-
const result2 = await finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input);
|
|
145
|
-
return result2;
|
|
146
|
-
}
|
|
147
|
-
else if (cutMode === 'dowel') {
|
|
148
|
-
const dowel = input.dowel ?? {
|
|
149
|
-
diameter: 0, diameterTolerance: 0, height: 0, heightTolerance: 0,
|
|
150
|
-
};
|
|
151
|
-
const result = await computeDowelSplit(shape, normal, originOffset, planeCenter, widthDir, dowel, input.selectedSections ?? null);
|
|
152
|
-
front = result.front;
|
|
153
|
-
back = result.back;
|
|
154
|
-
return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input);
|
|
155
|
-
}
|
|
156
|
-
else if (cutMode === 'straight-tenon' || cutMode === 'tenon') {
|
|
157
|
-
const tenon = input.tenon ?? {
|
|
158
|
-
sideLength: 0, sideLengthTolerance: 0, height: 0, heightTolerance: 0,
|
|
159
|
-
};
|
|
160
|
-
const result = await computeStraightTenonSplit(shape, normal, originOffset, planeCenter, widthDir, tenon, input.selectedSections ?? null);
|
|
161
|
-
front = result.front;
|
|
162
|
-
back = result.back;
|
|
163
|
-
return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// plane / straight / default
|
|
167
|
-
const result = await computeSplit(shape, normal, originOffset);
|
|
168
|
-
front = result.front;
|
|
169
|
-
back = result.back;
|
|
170
|
-
return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/** 计算爆炸位移并应用到 front/back */
|
|
174
|
-
async function finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input) {
|
|
175
|
-
const applyExplode = input.applyExplode ?? true;
|
|
176
|
-
// 爆炸位移:包围盒对角线的 2% + joinery 深度的一半
|
|
177
|
-
const bboxDiagonal = Math.sqrt(bboxSize[0] * bboxSize[0] + bboxSize[1] * bboxSize[1] + bboxSize[2] * bboxSize[2]);
|
|
178
|
-
const baseOffset = bboxDiagonal * 0.02;
|
|
179
|
-
let joineryOffset = 0;
|
|
180
|
-
if (cutMode === 'dovetail') {
|
|
181
|
-
joineryOffset = (input.groove?.depth ?? 0) / 2;
|
|
182
|
-
}
|
|
183
|
-
else if (cutMode === 'dowel') {
|
|
184
|
-
joineryOffset = (input.dowel?.height ?? 0) / 2;
|
|
185
|
-
}
|
|
186
|
-
else if (cutMode === 'straight-tenon' || cutMode === 'tenon') {
|
|
187
|
-
joineryOffset = (input.tenon?.height ?? 0) / 2;
|
|
188
|
-
}
|
|
189
|
-
const frontOffset = baseOffset + joineryOffset;
|
|
190
|
-
const backOffset = -(baseOffset + joineryOffset);
|
|
191
|
-
if (applyExplode) {
|
|
192
|
-
front = { positions: offsetPositions(front.positions, normal, frontOffset), indices: front.indices };
|
|
193
|
-
back = { positions: offsetPositions(back.positions, normal, backOffset), indices: back.indices };
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
front,
|
|
197
|
-
back,
|
|
198
|
-
normal,
|
|
199
|
-
originOffset,
|
|
200
|
-
planeCenter,
|
|
201
|
-
widthDir,
|
|
202
|
-
frontExplodeOffset: applyExplode ? frontOffset : 0,
|
|
203
|
-
backExplodeOffset: applyExplode ? backOffset : 0,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
/** 沿法线方向偏移所有顶点 */
|
|
207
|
-
function offsetPositions(positions, normal, offset) {
|
|
208
|
-
const out = new Float32Array(positions);
|
|
209
|
-
for (let i = 0; i < out.length; i += 3) {
|
|
210
|
-
out[i] += normal[0] * offset;
|
|
211
|
-
out[i + 1] += normal[1] * offset;
|
|
212
|
-
out[i + 2] += normal[2] * offset;
|
|
213
|
-
}
|
|
214
|
-
return out;
|
|
215
|
-
}
|
|
216
|
-
// ── 低级 API(保留向后兼容) ──
|
|
217
|
-
/**
|
|
218
|
-
* Plane split of a mesh shape.
|
|
219
|
-
* @param shape - the mesh shape to split.
|
|
220
|
-
* @param plane - the cutting plane (normal + offset).
|
|
221
|
-
* @returns the front and back halves of the shape.
|
|
222
|
-
*/
|
|
223
|
-
export async function split(shape, plane) {
|
|
224
|
-
const result = await computeSplit(shape, plane.normal, plane.offset);
|
|
225
|
-
return { front: result.front, back: result.back };
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Dovetail split of a mesh shape.
|
|
229
|
-
* @param shape - the mesh shape to split.
|
|
230
|
-
* @param params - dovetail groove parameters plus the cutting plane setup.
|
|
231
|
-
* @returns the front/back halves and the dovetail wedge.
|
|
232
|
-
*/
|
|
233
|
-
export async function dovetailSplit(shape, params) {
|
|
234
|
-
const result = await computeDovetailSplit(shape, params.plane.normal, params.plane.offset, params.planeCenter, params.widthDir, params.bboxWidthOnWidthDir, params.groove);
|
|
235
|
-
return {
|
|
236
|
-
front: result.front,
|
|
237
|
-
back: result.back,
|
|
238
|
-
wedge: result.wedge,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Dowel-pin split of a mesh shape.
|
|
243
|
-
* @param shape - the mesh shape to split.
|
|
244
|
-
* @param params - dowel parameters plus the cutting plane setup.
|
|
245
|
-
* @returns the front/back halves and the dowel wedge.
|
|
246
|
-
*/
|
|
247
|
-
export async function dowelSplit(shape, params) {
|
|
248
|
-
const result = await computeDowelSplit(shape, params.plane.normal, params.plane.offset, params.planeCenter, params.widthDir, params.dowel, params.selectedSections);
|
|
249
|
-
return {
|
|
250
|
-
front: result.front,
|
|
251
|
-
back: result.back,
|
|
252
|
-
wedge: result.wedge,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Straight-tenon split of a mesh shape.
|
|
257
|
-
* @param shape - the mesh shape to split.
|
|
258
|
-
* @param params - tenon parameters plus the cutting plane setup.
|
|
259
|
-
* @returns the front/back halves and the tenon wedge.
|
|
260
|
-
*/
|
|
261
|
-
export async function tenonSplit(shape, params) {
|
|
262
|
-
const result = await computeStraightTenonSplit(shape, params.plane.normal, params.plane.offset, params.planeCenter, params.widthDir, params.tenon, params.selectedSections);
|
|
263
|
-
return {
|
|
264
|
-
front: result.front,
|
|
265
|
-
back: result.back,
|
|
266
|
-
wedge: result.wedge,
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
//# sourceMappingURL=fai_split.js.map
|
|
@@ -1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,EACf,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,gBAAgB,CACxB,CAAA;IACD,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAY,EAAE,MAAwB;IACrE,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAC5C,KAAK,EACL,MAAM,CAAC,KAAK,CAAC,MAAM,EACnB,MAAM,CAAC,KAAK,CAAC,MAAM,EACnB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,gBAAgB,CACxB,CAAA;IACD,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAA;AACH,CAAC","sourcesContent":["/**\n * mesh 分割 API\n *\n * 提取来源:engine/boolean/csg.ts (computeSplit/computeDovetailSplit/...)\n * 已是纯数据函数,直接包装。\n *\n * splitWithParams 是 UI 与重放共用的唯一分割入口:\n * 参数编排(planeParams / planeBasis / 爆炸位移 / 世界坐标变换)\n * 全部在此函数内部完成,调用方只需传入 cutMode + normal/offset/inPlaneAngleDeg + bbCenter\n * 以及各 cutMode 专属参数。\n */\n\nimport {\n computeSplit,\n computeDovetailSplit,\n computeDowelSplit,\n computeStraightTenonSplit,\n} from '../boolean/csg-backend'\nimport * as THREE from 'three'\nimport type { Shape, SplitResult, SplitPlane, DovetailSplitParams, DowelSplitParams, TenonSplitParams, Vec3 } from './types'\n\n// ── 派生量计算(从 split-store 下沉,UI 与重放共用同一份公式) ──\n\n/**\n * Derive the cutting-plane parameters from Euler angles (in degrees), the\n * plane position and the bounding-box center. Behavior is identical to the\n * former split-store.computePlaneParams.\n * @param rotationX - rotation about X in degrees.\n * @param rotationY - rotation about Y in degrees.\n * @param rotationZ - rotation about Z in degrees.\n * @param planePosition - offset of the cutting plane along the plane normal.\n * @param bbCenter - world-space bounding-box center of the source mesh.\n * @returns the plane normal, the plane's signed distance from the origin, and its center.\n */\nexport function computePlaneParams(\n rotationX: number,\n rotationY: number,\n rotationZ: number,\n planePosition: number,\n bbCenter: Vec3,\n): { normal: Vec3; originOffset: number; planeCenter: Vec3 } {\n const rx = (rotationX * Math.PI) / 180\n const ry = (rotationY * Math.PI) / 180\n const rz = (rotationZ * Math.PI) / 180\n\n const euler = new THREE.Euler(rx, ry, rz, 'XYZ')\n const quat = new THREE.Quaternion().setFromEuler(euler)\n const normalVec = new THREE.Vector3(0, 0, 1).applyQuaternion(quat)\n\n const normal: Vec3 = [normalVec.x, normalVec.y, normalVec.z]\n\n const planeCenter: Vec3 = [\n bbCenter[0] + planePosition * normal[0],\n bbCenter[1] + planePosition * normal[1],\n bbCenter[2] + planePosition * normal[2],\n ]\n\n const originOffset = normal[0] * planeCenter[0] + normal[1] * planeCenter[1] + normal[2] * planeCenter[2]\n\n return { normal, originOffset, planeCenter }\n}\n\n/**\n * Derive the plane basis vectors from Euler angles (in degrees). Behavior is\n * identical to the former split-store.computePlaneBasis.\n * @param rotationX - rotation about X in degrees.\n * @param rotationY - rotation about Y in degrees.\n * @param rotationZ - rotation about Z in degrees.\n * @returns the plane normal plus the in-plane width and depth directions.\n */\nexport function computePlaneBasis(\n rotationX: number,\n rotationY: number,\n rotationZ: number,\n): { normal: Vec3; widthDir: Vec3; depthDir: Vec3 } {\n const rx = (rotationX * Math.PI) / 180\n const ry = (rotationY * Math.PI) / 180\n const rz = (rotationZ * Math.PI) / 180\n\n const euler = new THREE.Euler(rx, ry, rz, 'XYZ')\n const quat = new THREE.Quaternion().setFromEuler(euler)\n\n const normalVec = new THREE.Vector3(0, 0, 1).applyQuaternion(quat)\n const widthVec = new THREE.Vector3(1, 0, 0).applyQuaternion(quat)\n const depthVec = new THREE.Vector3(0, 1, 0).applyQuaternion(quat)\n\n return {\n normal: [normalVec.x, normalVec.y, normalVec.z],\n widthDir: [widthVec.x, widthVec.y, widthVec.z],\n depthDir: [depthVec.x, depthVec.y, depthVec.z],\n }\n}\n\n// ── 从法线 + 面内旋转推导基向量(纯数学,无 THREE 依赖) ──\n\n/**\n * Derive widthDir/depthDir from the cutting-plane normal and the in-plane\n * rotation angle. Matches computePlaneBasis(rx, ry, rz) with\n * normal = eulerXYZToNormal(rx, ry, 0) and inPlaneAngleDeg = rz: the rx/ry\n * Euler XYZ decomposition is recovered from the normal, then the rz rotation\n * is applied.\n *\n * normal = [sin(ry), -sin(rx)*cos(ry), cos(rx)*cos(ry)]\n * ry = asin(normal[0])\n * rx = atan2(-normal[1], normal[2]) (when cos(ry) !== 0)\n * @param normal - cutting-plane unit normal.\n * @param inPlaneAngleDeg - in-plane rotation about the normal, in degrees.\n * @returns the in-plane width and depth directions.\n */\nexport function computeBasisFromNormal(\n normal: Vec3,\n inPlaneAngleDeg: number,\n): { widthDir: Vec3; depthDir: Vec3 } {\n const sinRy = Math.max(-1, Math.min(1, normal[0]))\n const ry = Math.asin(sinRy)\n const cosRy = Math.cos(ry)\n\n let rx: number\n if (Math.abs(cosRy) < 1e-10) {\n // 万向锁:ry = ±90°,rx 与 rz 耦合,设 rx = 0\n rx = 0\n } else {\n rx = Math.atan2(-normal[1], normal[2])\n }\n\n const rz = (inPlaneAngleDeg * Math.PI) / 180\n\n // R = RX(rx) · RY(ry)(不含 rz 的部分)\n // widthDir = R · (cos(rz), sin(rz), 0)\n // depthDir = R · (-sin(rz), cos(rz), 0)\n const cr = Math.cos(ry), sr = Math.sin(ry)\n const cx = Math.cos(rx), sx = Math.sin(rx)\n const cosRz = Math.cos(rz), sinRz = Math.sin(rz)\n\n const widthDir: Vec3 = [\n cr * cosRz,\n sx * sr * cosRz + cx * sinRz,\n -cx * sr * cosRz + sx * sinRz,\n ]\n\n const depthDir: Vec3 = [\n -cr * sinRz,\n -sx * sr * sinRz + cx * cosRz,\n cx * sr * sinRz + sx * cosRz,\n ]\n\n return { widthDir, depthDir }\n}\n\n// ── 统一分割入口 ──\n\n/**\n * Input parameters for splitWithParams.\n */\nexport interface SplitWithParamsInput {\n /** 源几何(已在世界空间) */\n shape: Shape\n /** 分割模式 */\n cutMode: 'plane' | 'dovetail' | 'dowel' | 'straight-tenon' | 'tenon' | 'straight'\n /** 切割面法线 */\n normal: Vec3\n /** 切割面沿法线方向相对 bbCenter 的偏移(标量) */\n offset: number\n /** 切割面绕法线的面内旋转(角度制,承载原 planeRotation 的 rz 分量) */\n inPlaneAngleDeg: number\n /** 源 mesh 的世界空间包围盒中心 */\n bbCenter: Vec3\n /** 源 mesh 的世界空间包围盒尺寸(用于计算 bboxWidthOnWidthDir 和爆炸位移) */\n bboxSize: Vec3\n /** 燕尾参数(cutMode='dovetail' 时需要) */\n groove?: {\n depth: number\n depthTolerance: number\n width: number\n widthTolerance: number\n flapsAngle: number\n }\n /** 定位销参数(cutMode='dowel' 时需要) */\n dowel?: {\n diameter: number\n diameterTolerance: number\n height: number\n heightTolerance: number\n }\n /** 直榫参数(cutMode='straight-tenon' 时需要) */\n tenon?: {\n sideLength: number\n sideLengthTolerance: number\n height: number\n heightTolerance: number\n }\n /** 选择的截面(dowel/straight-tenon 用) */\n selectedSections?: number[] | null\n /** 是否应用爆炸位移(默认 true;导出/重放纯几何时可设 false) */\n applyExplode?: boolean\n}\n\n/**\n * Output of splitWithParams: the two halves plus the derived splitting data.\n */\nexport interface SplitWithParamsResult {\n front: Shape\n back: Shape\n /** 实际使用的法线(派生量,供调用方记录/调试) */\n normal: Vec3\n /** 实际使用的 originOffset(派生量) */\n originOffset: number\n /** 实际使用的 planeCenter(派生量) */\n planeCenter: Vec3\n /** 实际使用的 widthDir(派生量) */\n widthDir: Vec3\n /** 爆炸位移(front 正、back 负) */\n frontExplodeOffset: number\n backExplodeOffset: number\n}\n\n/**\n * Unified split entry point: the single split function shared by the UI\n * executor and script replay. All parameter orchestration (planeParams,\n * planeBasis, bboxWidthOnWidthDir, explode offset) happens inside this\n * function; callers pass only semantic parameters. Both interaction paths\n * (mouse / code) converge here, so the geometry result is identical.\n * @param input - the split mode-specific input (shape, plane, mode params).\n * @returns the split result with front/back halves and derived plane data.\n */\nexport async function splitWithParams(input: SplitWithParamsInput): Promise<SplitWithParamsResult> {\n const { shape, cutMode, normal, offset, inPlaneAngleDeg, bbCenter, bboxSize } = input\n\n // 1. 从 normal + offset + bbCenter 派生切割平面参数\n const planeCenter: Vec3 = [\n bbCenter[0] + offset * normal[0],\n bbCenter[1] + offset * normal[1],\n bbCenter[2] + offset * normal[2],\n ]\n const originOffset = normal[0] * planeCenter[0] + normal[1] * planeCenter[1] + normal[2] * planeCenter[2]\n\n // 2. 从 normal + inPlaneAngleDeg 派生基向量\n const { widthDir } = computeBasisFromNormal(normal, inPlaneAngleDeg)\n\n // 3. 按 cutMode 分发\n let front: Shape\n let back: Shape\n\n if (cutMode === 'dovetail') {\n const bboxWidthOnWidthDir =\n Math.abs(bboxSize[0] * widthDir[0]) +\n Math.abs(bboxSize[1] * widthDir[1]) +\n Math.abs(bboxSize[2] * widthDir[2])\n const groove = input.groove ?? {\n depth: 0, depthTolerance: 0, width: 0, widthTolerance: 0, flapsAngle: 0,\n }\n const result = await computeDovetailSplit(shape, normal, originOffset, planeCenter, widthDir, bboxWidthOnWidthDir, groove)\n front = result.front; back = result.back\n\n const result2: SplitWithParamsResult = await finalizeExplode(\n front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input,\n )\n return result2\n } else if (cutMode === 'dowel') {\n const dowel = input.dowel ?? {\n diameter: 0, diameterTolerance: 0, height: 0, heightTolerance: 0,\n }\n const result = await computeDowelSplit(shape, normal, originOffset, planeCenter, widthDir, dowel, input.selectedSections ?? null)\n front = result.front; back = result.back\n return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input)\n } else if (cutMode === 'straight-tenon' || cutMode === 'tenon') {\n const tenon = input.tenon ?? {\n sideLength: 0, sideLengthTolerance: 0, height: 0, heightTolerance: 0,\n }\n const result = await computeStraightTenonSplit(shape, normal, originOffset, planeCenter, widthDir, tenon, input.selectedSections ?? null)\n front = result.front; back = result.back\n return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input)\n } else {\n // plane / straight / default\n const result = await computeSplit(shape, normal, originOffset)\n front = result.front; back = result.back\n return finalizeExplode(front, back, normal, originOffset, planeCenter, widthDir, bboxSize, cutMode, input)\n }\n}\n\n/** 计算爆炸位移并应用到 front/back */\nasync function finalizeExplode(\n front: Shape,\n back: Shape,\n normal: Vec3,\n originOffset: number,\n planeCenter: Vec3,\n widthDir: Vec3,\n bboxSize: Vec3,\n cutMode: string,\n input: SplitWithParamsInput,\n): Promise<SplitWithParamsResult> {\n const applyExplode = input.applyExplode ?? true\n\n // 爆炸位移:包围盒对角线的 2% + joinery 深度的一半\n const bboxDiagonal = Math.sqrt(\n bboxSize[0] * bboxSize[0] + bboxSize[1] * bboxSize[1] + bboxSize[2] * bboxSize[2],\n )\n const baseOffset = bboxDiagonal * 0.02\n let joineryOffset = 0\n if (cutMode === 'dovetail') {\n joineryOffset = (input.groove?.depth ?? 0) / 2\n } else if (cutMode === 'dowel') {\n joineryOffset = (input.dowel?.height ?? 0) / 2\n } else if (cutMode === 'straight-tenon' || cutMode === 'tenon') {\n joineryOffset = (input.tenon?.height ?? 0) / 2\n }\n const frontOffset = baseOffset + joineryOffset\n const backOffset = -(baseOffset + joineryOffset)\n\n if (applyExplode) {\n front = { positions: offsetPositions(front.positions, normal, frontOffset), indices: front.indices }\n back = { positions: offsetPositions(back.positions, normal, backOffset), indices: back.indices }\n }\n\n return {\n front,\n back,\n normal,\n originOffset,\n planeCenter,\n widthDir,\n frontExplodeOffset: applyExplode ? frontOffset : 0,\n backExplodeOffset: applyExplode ? backOffset : 0,\n }\n}\n\n/** 沿法线方向偏移所有顶点 */\nfunction offsetPositions(\n positions: Float32Array,\n normal: Vec3,\n offset: number,\n): Float32Array {\n const out = new Float32Array(positions)\n for (let i = 0; i < out.length; i += 3) {\n out[i] += normal[0] * offset\n out[i + 1] += normal[1] * offset\n out[i + 2] += normal[2] * offset\n }\n return out\n}\n\n// ── 低级 API(保留向后兼容) ──\n\n/**\n * Plane split of a mesh shape.\n * @param shape - the mesh shape to split.\n * @param plane - the cutting plane (normal + offset).\n * @returns the front and back halves of the shape.\n */\nexport async function split(shape: Shape, plane: SplitPlane): Promise<{ front: Shape; back: Shape }> {\n const result = await computeSplit(shape, plane.normal, plane.offset)\n return { front: result.front, back: result.back }\n}\n\n/**\n * Dovetail split of a mesh shape.\n * @param shape - the mesh shape to split.\n * @param params - dovetail groove parameters plus the cutting plane setup.\n * @returns the front/back halves and the dovetail wedge.\n */\nexport async function dovetailSplit(shape: Shape, params: DovetailSplitParams): Promise<SplitResult> {\n const result = await computeDovetailSplit(\n shape,\n params.plane.normal,\n params.plane.offset,\n params.planeCenter,\n params.widthDir,\n params.bboxWidthOnWidthDir,\n params.groove,\n )\n return {\n front: result.front,\n back: result.back,\n wedge: result.wedge,\n }\n}\n\n/**\n * Dowel-pin split of a mesh shape.\n * @param shape - the mesh shape to split.\n * @param params - dowel parameters plus the cutting plane setup.\n * @returns the front/back halves and the dowel wedge.\n */\nexport async function dowelSplit(shape: Shape, params: DowelSplitParams): Promise<SplitResult> {\n const result = await computeDowelSplit(\n shape,\n params.plane.normal,\n params.plane.offset,\n params.planeCenter,\n params.widthDir,\n params.dowel,\n params.selectedSections,\n )\n return {\n front: result.front,\n back: result.back,\n wedge: result.wedge,\n }\n}\n\n/**\n * Straight-tenon split of a mesh shape.\n * @param shape - the mesh shape to split.\n * @param params - tenon parameters plus the cutting plane setup.\n * @returns the front/back halves and the tenon wedge.\n */\nexport async function tenonSplit(shape: Shape, params: TenonSplitParams): Promise<SplitResult> {\n const result = await computeStraightTenonSplit(\n shape,\n params.plane.normal,\n params.plane.offset,\n params.planeCenter,\n params.widthDir,\n params.tenon,\n params.selectedSections,\n )\n return {\n front: result.front,\n back: result.back,\n wedge: result.wedge,\n }\n}\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
/**
|
|
3
|
-
* Options controlling an SVG extrusion.
|
|
4
|
-
*
|
|
5
|
-
* targetLongSide maps the longer logical side of the SVG to this length in
|
|
6
|
-
* mm (the short side is scaled proportionally); naturalWidth/naturalHeight
|
|
7
|
-
* are the SVG's logical dimensions used to compute the scale factor.
|
|
8
|
-
*/
|
|
9
|
-
export interface SvgExtrudeOptions {
|
|
10
|
-
depth: number;
|
|
11
|
-
/** 长边目标长度(mm),短边按比例计算。默认 20 */
|
|
12
|
-
targetLongSide?: number;
|
|
13
|
-
/** SVG 原始逻辑尺寸,用于计算实际缩放比例 */
|
|
14
|
-
naturalWidth: number;
|
|
15
|
-
naturalHeight: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Parse SVG text into a list of THREE.Shape contours.
|
|
19
|
-
* Uses SVGLoader to convert the SVG paths into shapes usable by ExtrudeGeometry.
|
|
20
|
-
*
|
|
21
|
-
* @param svgText - the SVG source text.
|
|
22
|
-
* @returns the list of closed shapes found in the SVG.
|
|
23
|
-
* @throws when the SVG contains no closed contour.
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseSvgShapes(svgText: string): THREE.Shape[];
|
|
26
|
-
/**
|
|
27
|
-
* Extrude a list of shapes into a single merged BufferGeometry.
|
|
28
|
-
* The scale factor is computed from naturalWidth/naturalHeight and targetLongSide.
|
|
29
|
-
*
|
|
30
|
-
* @param shapes - the shapes to extrude.
|
|
31
|
-
* @param options - the extrusion options (depth and scale inputs).
|
|
32
|
-
* @returns the merged, scaled, centred BufferGeometry.
|
|
33
|
-
*/
|
|
34
|
-
export declare function extrudeShapes(shapes: THREE.Shape[], options: SvgExtrudeOptions): THREE.BufferGeometry;
|
|
35
|
-
/**
|
|
36
|
-
* One-stop helper: SVG text → extruded BufferGeometry.
|
|
37
|
-
*
|
|
38
|
-
* @param svgText - the SVG source text.
|
|
39
|
-
* @param options - the extrusion options.
|
|
40
|
-
* @returns the extruded BufferGeometry.
|
|
41
|
-
*/
|
|
42
|
-
export declare function svgToExtrudedGeometry(svgText: string, options: SvgExtrudeOptions): THREE.BufferGeometry;
|
|
43
|
-
//# sourceMappingURL=svg-extrude.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"svg-extrude.d.ts","sourceRoot":"","sources":["../../src/primitives/svg-extrude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,CAiB7D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,KAAK,CAAC,KAAK,EAAE,EACrB,OAAO,EAAE,iBAAiB,GACzB,KAAK,CAAC,cAAc,CAqCtB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,GACzB,KAAK,CAAC,cAAc,CAGtB"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { SVGLoader } from 'three/examples/jsm/loaders/SVGLoader.js';
|
|
3
|
-
import { mergeBufferGeometries } from '../primitives/mesh-primitives.js';
|
|
4
|
-
/**
|
|
5
|
-
* Parse SVG text into a list of THREE.Shape contours.
|
|
6
|
-
* Uses SVGLoader to convert the SVG paths into shapes usable by ExtrudeGeometry.
|
|
7
|
-
*
|
|
8
|
-
* @param svgText - the SVG source text.
|
|
9
|
-
* @returns the list of closed shapes found in the SVG.
|
|
10
|
-
* @throws when the SVG contains no closed contour.
|
|
11
|
-
*/
|
|
12
|
-
export function parseSvgShapes(svgText) {
|
|
13
|
-
const loader = new SVGLoader();
|
|
14
|
-
const svgData = loader.parse(svgText);
|
|
15
|
-
const allShapes = [];
|
|
16
|
-
for (const path of svgData.paths) {
|
|
17
|
-
const shapes = SVGLoader.createShapes(path);
|
|
18
|
-
for (const shape of shapes) {
|
|
19
|
-
allShapes.push(shape);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (allShapes.length === 0) {
|
|
23
|
-
throw new Error('No closed contour found in SVG. Please check the file content.');
|
|
24
|
-
}
|
|
25
|
-
return allShapes;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Extrude a list of shapes into a single merged BufferGeometry.
|
|
29
|
-
* The scale factor is computed from naturalWidth/naturalHeight and targetLongSide.
|
|
30
|
-
*
|
|
31
|
-
* @param shapes - the shapes to extrude.
|
|
32
|
-
* @param options - the extrusion options (depth and scale inputs).
|
|
33
|
-
* @returns the merged, scaled, centred BufferGeometry.
|
|
34
|
-
*/
|
|
35
|
-
export function extrudeShapes(shapes, options) {
|
|
36
|
-
const { depth, naturalWidth, naturalHeight, targetLongSide = 20 } = options;
|
|
37
|
-
// 计算缩放比例:长边映射到 targetLongSide
|
|
38
|
-
const longSide = Math.max(naturalWidth, naturalHeight);
|
|
39
|
-
const scale = longSide > 0 ? targetLongSide / longSide : 1;
|
|
40
|
-
// 先挤出,再整体缩放几何体
|
|
41
|
-
const geometries = shapes.map((shape) => {
|
|
42
|
-
const geo = new THREE.ExtrudeGeometry(shape, {
|
|
43
|
-
depth,
|
|
44
|
-
bevelEnabled: false,
|
|
45
|
-
});
|
|
46
|
-
// 应用缩放
|
|
47
|
-
geo.scale(scale, scale, 1);
|
|
48
|
-
return geo;
|
|
49
|
-
});
|
|
50
|
-
// 合并所有几何体为一个
|
|
51
|
-
const merged = mergeBufferGeometries(geometries);
|
|
52
|
-
merged.computeVertexNormals();
|
|
53
|
-
// 居中处理:XY 居中,Z 底部对齐到 0(3D 打印放在热床上)
|
|
54
|
-
merged.computeBoundingBox();
|
|
55
|
-
if (merged.boundingBox) {
|
|
56
|
-
const cx = (merged.boundingBox.max.x + merged.boundingBox.min.x) / 2;
|
|
57
|
-
const cy = (merged.boundingBox.max.y + merged.boundingBox.min.y) / 2;
|
|
58
|
-
const cz = merged.boundingBox.min.z;
|
|
59
|
-
merged.translate(-cx, -cy, -cz);
|
|
60
|
-
}
|
|
61
|
-
// 清理临时 geometry
|
|
62
|
-
for (const g of geometries) {
|
|
63
|
-
g.dispose();
|
|
64
|
-
}
|
|
65
|
-
return merged;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* One-stop helper: SVG text → extruded BufferGeometry.
|
|
69
|
-
*
|
|
70
|
-
* @param svgText - the SVG source text.
|
|
71
|
-
* @param options - the extrusion options.
|
|
72
|
-
* @returns the extruded BufferGeometry.
|
|
73
|
-
*/
|
|
74
|
-
export function svgToExtrudedGeometry(svgText, options) {
|
|
75
|
-
const shapes = parseSvgShapes(svgText);
|
|
76
|
-
return extrudeShapes(shapes, options);
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=svg-extrude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"svg-extrude.js","sourceRoot":"","sources":["../../src/primitives/svg-extrude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAkB,MAAM,yCAAyC,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAkBrE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,MAAM,GAAG,IAAI,SAAS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,aAAa;IACb,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAA;IAChD,MAAM,CAAC,oBAAoB,EAAE,CAAA;IAE7B,mCAAmC;IACnC,MAAM,CAAC,kBAAkB,EAAE,CAAA;IAC3B,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACpE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACpE,MAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QACnC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,gBAAgB;IAChB,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,CAAC,CAAC,OAAO,EAAE,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAe,EACf,OAA0B;IAE1B,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACtC,OAAO,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC","sourcesContent":["import * as THREE from 'three'\nimport { SVGLoader, type SVGResult } from 'three/examples/jsm/loaders/SVGLoader.js'\nimport { mergeBufferGeometries } from '../primitives/mesh-primitives'\n\n/**\n * Options controlling an SVG extrusion.\n *\n * targetLongSide maps the longer logical side of the SVG to this length in\n * mm (the short side is scaled proportionally); naturalWidth/naturalHeight\n * are the SVG's logical dimensions used to compute the scale factor.\n */\nexport interface SvgExtrudeOptions {\n depth: number\n /** 长边目标长度(mm),短边按比例计算。默认 20 */\n targetLongSide?: number\n /** SVG 原始逻辑尺寸,用于计算实际缩放比例 */\n naturalWidth: number\n naturalHeight: number\n}\n\n/**\n * Parse SVG text into a list of THREE.Shape contours.\n * Uses SVGLoader to convert the SVG paths into shapes usable by ExtrudeGeometry.\n *\n * @param svgText - the SVG source text.\n * @returns the list of closed shapes found in the SVG.\n * @throws when the SVG contains no closed contour.\n */\nexport function parseSvgShapes(svgText: string): THREE.Shape[] {\n const loader = new SVGLoader()\n const svgData: SVGResult = loader.parse(svgText)\n\n const allShapes: THREE.Shape[] = []\n for (const path of svgData.paths) {\n const shapes = SVGLoader.createShapes(path)\n for (const shape of shapes) {\n allShapes.push(shape)\n }\n }\n\n if (allShapes.length === 0) {\n throw new Error('No closed contour found in SVG. Please check the file content.')\n }\n\n return allShapes\n}\n\n/**\n * Extrude a list of shapes into a single merged BufferGeometry.\n * The scale factor is computed from naturalWidth/naturalHeight and targetLongSide.\n *\n * @param shapes - the shapes to extrude.\n * @param options - the extrusion options (depth and scale inputs).\n * @returns the merged, scaled, centred BufferGeometry.\n */\nexport function extrudeShapes(\n shapes: THREE.Shape[],\n options: SvgExtrudeOptions,\n): THREE.BufferGeometry {\n const { depth, naturalWidth, naturalHeight, targetLongSide = 20 } = options\n\n // 计算缩放比例:长边映射到 targetLongSide\n const longSide = Math.max(naturalWidth, naturalHeight)\n const scale = longSide > 0 ? targetLongSide / longSide : 1\n\n // 先挤出,再整体缩放几何体\n const geometries = shapes.map((shape) => {\n const geo = new THREE.ExtrudeGeometry(shape, {\n depth,\n bevelEnabled: false,\n })\n // 应用缩放\n geo.scale(scale, scale, 1)\n return geo\n })\n\n // 合并所有几何体为一个\n const merged = mergeBufferGeometries(geometries)\n merged.computeVertexNormals()\n\n // 居中处理:XY 居中,Z 底部对齐到 0(3D 打印放在热床上)\n merged.computeBoundingBox()\n if (merged.boundingBox) {\n const cx = (merged.boundingBox.max.x + merged.boundingBox.min.x) / 2\n const cy = (merged.boundingBox.max.y + merged.boundingBox.min.y) / 2\n const cz = merged.boundingBox.min.z\n merged.translate(-cx, -cy, -cz)\n }\n\n // 清理临时 geometry\n for (const g of geometries) {\n g.dispose()\n }\n\n return merged\n}\n\n/**\n * One-stop helper: SVG text → extruded BufferGeometry.\n *\n * @param svgText - the SVG source text.\n * @param options - the extrusion options.\n * @returns the extruded BufferGeometry.\n */\nexport function svgToExtrudedGeometry(\n svgText: string,\n options: SvgExtrudeOptions,\n): THREE.BufferGeometry {\n const shapes = parseSvgShapes(svgText)\n return extrudeShapes(shapes, options)\n}"]}
|