@faicad/faijs 0.16.1 → 0.18.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/LICENSE +4 -5
- package/NOTICE +5 -6
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +20 -2
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/assembly/entities.d.ts +1 -1
- package/dist/api/assembly/entities.d.ts.map +1 -1
- package/dist/api/assembly/entities.js.map +1 -1
- package/dist/api/assembly/joints.d.ts +2 -2
- package/dist/api/assembly/joints.d.ts.map +1 -1
- package/dist/api/assembly/joints.js +2 -2
- package/dist/api/assembly/joints.js.map +1 -1
- package/dist/api/assembly/lower.d.ts +1 -1
- package/dist/api/assembly/lower.d.ts.map +1 -1
- package/dist/api/assembly/lower.js.map +1 -1
- package/dist/api/assembly/pose.d.ts +3 -3
- package/dist/api/assembly/pose.d.ts.map +1 -1
- package/dist/api/assembly/pose.js +1 -1
- package/dist/api/assembly/pose.js.map +1 -1
- package/dist/api/assembly/preview.d.ts +1 -1
- package/dist/api/assembly/preview.d.ts.map +1 -1
- package/dist/api/assembly/preview.js +1 -1
- package/dist/api/assembly/preview.js.map +1 -1
- package/dist/api/assembly/solve.d.ts.map +1 -1
- package/dist/api/assembly/solve.js +3 -3
- package/dist/api/assembly/solve.js.map +1 -1
- package/dist/api/assembly/solvers/assembly-tree.d.ts +98 -0
- package/dist/api/assembly/solvers/assembly-tree.d.ts.map +1 -0
- package/dist/api/assembly/solvers/assembly-tree.js +130 -0
- package/dist/api/assembly/solvers/assembly-tree.js.map +1 -0
- package/dist/api/assembly/solvers/chain-solver.d.ts +27 -0
- package/dist/api/assembly/solvers/chain-solver.d.ts.map +1 -0
- package/dist/api/assembly/solvers/chain-solver.js +330 -0
- package/dist/api/assembly/solvers/chain-solver.js.map +1 -0
- package/dist/api/assembly/solvers/global-solver.js +2 -2
- package/dist/api/assembly/solvers/global-solver.js.map +1 -1
- package/dist/api/assembly/solvers/joints-kinematics.d.ts +308 -0
- package/dist/api/assembly/solvers/joints-kinematics.d.ts.map +1 -0
- package/dist/api/assembly/solvers/joints-kinematics.js +643 -0
- package/dist/api/assembly/solvers/joints-kinematics.js.map +1 -0
- package/dist/api/assembly/solvers/quat.d.ts +35 -0
- package/dist/api/assembly/solvers/quat.d.ts.map +1 -0
- package/dist/api/assembly/solvers/quat.js +84 -0
- package/dist/api/assembly/solvers/quat.js.map +1 -0
- package/dist/api/assembly/solvers/types.d.ts +33 -0
- package/dist/api/assembly/solvers/types.d.ts.map +1 -1
- package/dist/api/assembly/solvers/types.js.map +1 -1
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +66 -29
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/brep-mirror/booleanFns.d.ts +40 -0
- package/dist/api/brep-mirror/booleanFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/booleanFns.js +104 -0
- package/dist/api/brep-mirror/booleanFns.js.map +1 -0
- package/dist/api/brep-mirror/brepHelpers.d.ts +55 -0
- package/dist/api/brep-mirror/brepHelpers.d.ts.map +1 -0
- package/dist/api/brep-mirror/brepHelpers.js +131 -0
- package/dist/api/brep-mirror/brepHelpers.js.map +1 -0
- package/dist/api/brep-mirror/compoundFns.d.ts +47 -0
- package/dist/api/brep-mirror/compoundFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/compoundFns.js +300 -0
- package/dist/api/brep-mirror/compoundFns.js.map +1 -0
- package/dist/api/brep-mirror/healingFns.d.ts +78 -0
- package/dist/api/brep-mirror/healingFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/healingFns.js +294 -0
- package/dist/api/brep-mirror/healingFns.js.map +1 -0
- package/dist/api/brep-mirror/hullFns.d.ts +20 -0
- package/dist/api/brep-mirror/hullFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/hullFns.js +46 -0
- package/dist/api/brep-mirror/hullFns.js.map +1 -0
- package/dist/api/brep-mirror/patternFns.d.ts +43 -0
- package/dist/api/brep-mirror/patternFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/patternFns.js +178 -0
- package/dist/api/brep-mirror/patternFns.js.map +1 -0
- package/dist/api/brep-mirror/primitiveFns.d.ts +42 -0
- package/dist/api/brep-mirror/primitiveFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/primitiveFns.js +104 -0
- package/dist/api/brep-mirror/primitiveFns.js.map +1 -0
- package/dist/api/brep-mirror/roofFns.d.ts +24 -0
- package/dist/api/brep-mirror/roofFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/roofFns.js +229 -0
- package/dist/api/brep-mirror/roofFns.js.map +1 -0
- package/dist/api/brep-mirror/straightSkeleton.d.ts +36 -0
- package/dist/api/brep-mirror/straightSkeleton.d.ts.map +1 -0
- package/dist/api/brep-mirror/straightSkeleton.js +443 -0
- package/dist/api/brep-mirror/straightSkeleton.js.map +1 -0
- package/dist/api/brep-mirror/sweepFns.d.ts +55 -0
- package/dist/api/brep-mirror/sweepFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/sweepFns.js +200 -0
- package/dist/api/brep-mirror/sweepFns.js.map +1 -0
- package/dist/api/brep-mirror/threadFns.d.ts +15 -0
- package/dist/api/brep-mirror/threadFns.d.ts.map +1 -1
- package/dist/api/brep-mirror/threadFns.js +37 -2
- package/dist/api/brep-mirror/threadFns.js.map +1 -1
- package/dist/api/brep-mirror/topologyFns.d.ts +74 -0
- package/dist/api/brep-mirror/topologyFns.d.ts.map +1 -0
- package/dist/api/brep-mirror/topologyFns.js +276 -0
- package/dist/api/brep-mirror/topologyFns.js.map +1 -0
- package/dist/api/brep-topology.d.ts +190 -0
- package/dist/api/brep-topology.d.ts.map +1 -0
- package/dist/api/brep-topology.js +337 -0
- package/dist/api/brep-topology.js.map +1 -0
- package/dist/api/brepjs-compat/constants.d.ts +11 -0
- package/dist/api/brepjs-compat/constants.d.ts.map +1 -0
- package/dist/api/brepjs-compat/constants.js +11 -0
- package/dist/api/brepjs-compat/constants.js.map +1 -0
- package/dist/api/brepjs-compat/index.d.ts +19 -232
- package/dist/api/brepjs-compat/index.d.ts.map +1 -1
- package/dist/api/brepjs-compat/index.js +19 -286
- package/dist/api/brepjs-compat/index.js.map +1 -1
- package/dist/api/brepjs-compat/planeOps.d.ts +98 -0
- package/dist/api/brepjs-compat/planeOps.d.ts.map +1 -0
- package/dist/api/brepjs-compat/planeOps.js +170 -0
- package/dist/api/brepjs-compat/planeOps.js.map +1 -0
- package/dist/api/brepjs-compat/planeTypes.d.ts +24 -0
- package/dist/api/brepjs-compat/planeTypes.d.ts.map +1 -0
- package/dist/api/brepjs-compat/planeTypes.js +8 -0
- package/dist/api/brepjs-compat/planeTypes.js.map +1 -0
- package/dist/api/brepjs-compat/types.d.ts +64 -0
- package/dist/api/brepjs-compat/types.d.ts.map +1 -0
- package/dist/api/brepjs-compat/types.js +48 -0
- package/dist/api/brepjs-compat/types.js.map +1 -0
- package/dist/api/brepjs-compat/vecOps.d.ts +124 -0
- package/dist/api/brepjs-compat/vecOps.d.ts.map +1 -0
- package/dist/api/brepjs-compat/vecOps.js +202 -0
- package/dist/api/brepjs-compat/vecOps.js.map +1 -0
- package/dist/api/chamfer.d.ts +12 -3
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +54 -20
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/compound-geom.d.ts.map +1 -1
- package/dist/api/compound-geom.js +8 -2
- package/dist/api/compound-geom.js.map +1 -1
- package/dist/api/draft.d.ts +69 -0
- package/dist/api/draft.d.ts.map +1 -0
- package/dist/api/draft.js +109 -0
- package/dist/api/draft.js.map +1 -0
- package/dist/api/edge-ref.d.ts.map +1 -1
- package/dist/api/edge-ref.js +2 -2
- package/dist/api/edge-ref.js.map +1 -1
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +2 -3
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +44 -14
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/face-ref.d.ts.map +1 -1
- package/dist/api/face-ref.js +2 -2
- package/dist/api/face-ref.js.map +1 -1
- package/dist/api/feature-repair.d.ts +137 -0
- package/dist/api/feature-repair.d.ts.map +1 -0
- package/dist/api/feature-repair.js +221 -0
- package/dist/api/feature-repair.js.map +1 -0
- package/dist/api/fillet-variable.d.ts +35 -0
- package/dist/api/fillet-variable.d.ts.map +1 -0
- package/dist/api/fillet-variable.js +71 -0
- package/dist/api/fillet-variable.js.map +1 -0
- package/dist/api/fillet.d.ts +3 -0
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +7 -4
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/generated/2d.d.ts +1 -13
- package/dist/api/generated/2d.d.ts.map +1 -1
- package/dist/api/generated/2d.js +6 -1
- package/dist/api/generated/2d.js.map +1 -1
- package/dist/api/generated/brepjs/index.d.ts +298 -298
- package/dist/api/generated/brepjs/index.d.ts.map +1 -1
- package/dist/api/generated/brepjs/index.js +183 -183
- package/dist/api/generated/brepjs/index.js.map +1 -1
- package/dist/api/generated/core.d.ts +3 -123
- package/dist/api/generated/core.d.ts.map +1 -1
- package/dist/api/generated/core.js +2 -81
- package/dist/api/generated/core.js.map +1 -1
- package/dist/api/generated/gear.d.ts +1 -15
- package/dist/api/generated/gear.d.ts.map +1 -1
- package/dist/api/generated/gear.js +6 -3
- package/dist/api/generated/gear.js.map +1 -1
- package/dist/api/generated/io.d.ts +1 -13
- package/dist/api/generated/io.d.ts.map +1 -1
- package/dist/api/generated/io.js +6 -1
- package/dist/api/generated/io.js.map +1 -1
- package/dist/api/generated/kernel.d.ts +1 -39
- package/dist/api/generated/kernel.d.ts.map +1 -1
- package/dist/api/generated/kernel.js +6 -4
- package/dist/api/generated/kernel.js.map +1 -1
- package/dist/api/generated/measurement.d.ts +53 -97
- package/dist/api/generated/measurement.d.ts.map +1 -1
- package/dist/api/generated/measurement.js +48 -143
- package/dist/api/generated/measurement.js.map +1 -1
- package/dist/api/generated/ns.d.ts +1 -10
- package/dist/api/generated/ns.d.ts.map +1 -1
- package/dist/api/generated/ns.js +2 -10
- package/dist/api/generated/ns.js.map +1 -1
- package/dist/api/generated/operations.d.ts +65 -110
- package/dist/api/generated/operations.d.ts.map +1 -1
- package/dist/api/generated/operations.js +132 -80
- package/dist/api/generated/operations.js.map +1 -1
- package/dist/api/generated/projection.d.ts +1 -8
- package/dist/api/generated/projection.d.ts.map +1 -1
- package/dist/api/generated/projection.js +6 -4
- package/dist/api/generated/projection.js.map +1 -1
- package/dist/api/generated/query.d.ts +1 -9
- package/dist/api/generated/query.d.ts.map +1 -1
- package/dist/api/generated/query.js +6 -1
- package/dist/api/generated/query.js.map +1 -1
- package/dist/api/generated/script-face-manifest.d.ts +2 -0
- package/dist/api/generated/script-face-manifest.d.ts.map +1 -1
- package/dist/api/generated/script-face-manifest.js +22 -10
- package/dist/api/generated/script-face-manifest.js.map +1 -1
- package/dist/api/generated/script-face.d.ts +52 -27
- package/dist/api/generated/script-face.d.ts.map +1 -1
- package/dist/api/generated/script-face.js +18 -4
- package/dist/api/generated/script-face.js.map +1 -1
- package/dist/api/generated/sketching.d.ts +4 -7
- package/dist/api/generated/sketching.d.ts.map +1 -1
- package/dist/api/generated/sketching.js +10 -8
- package/dist/api/generated/sketching.js.map +1 -1
- package/dist/api/generated/text.d.ts +1 -6
- package/dist/api/generated/text.d.ts.map +1 -1
- package/dist/api/generated/text.js +6 -3
- package/dist/api/generated/text.js.map +1 -1
- package/dist/api/generated/topology.d.ts +77 -175
- package/dist/api/generated/topology.d.ts.map +1 -1
- package/dist/api/generated/topology.js +172 -131
- package/dist/api/generated/topology.js.map +1 -1
- package/dist/api/geom.d.ts.map +1 -1
- package/dist/api/geom.js +2 -2
- package/dist/api/geom.js.map +1 -1
- package/dist/api/helix.d.ts +51 -0
- package/dist/api/helix.d.ts.map +1 -0
- package/dist/api/helix.js +63 -0
- package/dist/api/helix.js.map +1 -0
- package/dist/api/import-step.d.ts.map +1 -1
- package/dist/api/import-step.js +6 -2
- package/dist/api/import-step.js.map +1 -1
- package/dist/api/index.d.ts +20 -6
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +30 -13
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts +10 -0
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +9 -3
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/compat-projection.d.ts +4 -4
- package/dist/api/internal/compat-projection.js +7 -7
- package/dist/api/internal/compat-projection.js.map +1 -1
- package/dist/api/internal/l3-bridge.d.ts +75 -42
- package/dist/api/internal/l3-bridge.d.ts.map +1 -1
- package/dist/api/internal/l3-bridge.js +105 -50
- package/dist/api/internal/l3-bridge.js.map +1 -1
- package/dist/api/internal/profile-wire.d.ts +31 -0
- package/dist/api/internal/profile-wire.d.ts.map +1 -0
- package/dist/api/internal/profile-wire.js +37 -0
- package/dist/api/internal/profile-wire.js.map +1 -0
- package/dist/api/internal/replica-role-table.js +2 -2
- package/dist/api/internal/replica-role-table.js.map +1 -1
- package/dist/api/loft.d.ts +66 -0
- package/dist/api/loft.d.ts.map +1 -0
- package/dist/api/loft.js +111 -0
- package/dist/api/loft.js.map +1 -0
- package/dist/api/measurement/index.d.ts +51 -0
- package/dist/api/measurement/index.d.ts.map +1 -0
- package/dist/api/measurement/index.js +71 -0
- package/dist/api/measurement/index.js.map +1 -0
- package/dist/api/occt-kernel-bridge.d.ts +5 -8
- package/dist/api/occt-kernel-bridge.d.ts.map +1 -1
- package/dist/api/occt-kernel-bridge.js +18 -14
- package/dist/api/occt-kernel-bridge.js.map +1 -1
- package/dist/api/pattern.d.ts.map +1 -1
- package/dist/api/pattern.js +3 -4
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/place.d.ts.map +1 -1
- package/dist/api/place.js +2 -4
- package/dist/api/place.js.map +1 -1
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +3 -4
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts +89 -0
- package/dist/api/profile.d.ts.map +1 -0
- package/dist/api/profile.js +194 -0
- package/dist/api/profile.js.map +1 -0
- package/dist/api/replicate.d.ts +28 -1
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +34 -23
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/result.d.ts +6 -11
- package/dist/api/result.d.ts.map +1 -1
- package/dist/api/result.js +6 -11
- package/dist/api/result.js.map +1 -1
- package/dist/api/revolve.d.ts.map +1 -1
- package/dist/api/revolve.js +15 -14
- package/dist/api/revolve.js.map +1 -1
- package/dist/api/screw.d.ts +3 -0
- package/dist/api/screw.d.ts.map +1 -1
- package/dist/api/screw.js +9 -4
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts +1 -1
- package/dist/api/section-by-plane.d.ts +42 -0
- package/dist/api/section-by-plane.d.ts.map +1 -0
- package/dist/api/section-by-plane.js +61 -0
- package/dist/api/section-by-plane.js.map +1 -0
- package/dist/api/shell.d.ts +45 -0
- package/dist/api/shell.d.ts.map +1 -0
- package/dist/api/shell.js +73 -0
- package/dist/api/shell.js.map +1 -0
- package/dist/api/sketch.d.ts +8 -1
- package/dist/api/sketch.d.ts.map +1 -1
- package/dist/api/sketch.js +12 -7
- package/dist/api/sketch.js.map +1 -1
- package/dist/api/split-by-plane.d.ts +41 -0
- package/dist/api/split-by-plane.d.ts.map +1 -0
- package/dist/api/split-by-plane.js +60 -0
- package/dist/api/split-by-plane.js.map +1 -0
- package/dist/api/split.d.ts +6 -1
- package/dist/api/split.d.ts.map +1 -1
- package/dist/api/split.js +23 -9
- package/dist/api/split.js.map +1 -1
- package/dist/api/surface/arg-spec.d.ts +22 -0
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +729 -477
- package/dist/api/surface/arg-spec.js.map +1 -1
- package/dist/api/sweep.d.ts +55 -0
- package/dist/api/sweep.d.ts.map +1 -0
- package/dist/api/sweep.js +86 -0
- package/dist/api/sweep.js.map +1 -0
- package/dist/api/thicken.d.ts +36 -0
- package/dist/api/thicken.d.ts.map +1 -0
- package/dist/api/thicken.js +55 -0
- package/dist/api/thicken.js.map +1 -0
- package/dist/api/transform.d.ts +8 -0
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +15 -4
- package/dist/api/transform.js.map +1 -1
- package/dist/api/view/cameraFns.d.ts +48 -0
- package/dist/api/view/cameraFns.d.ts.map +1 -0
- package/dist/api/view/cameraFns.js +75 -0
- package/dist/api/view/cameraFns.js.map +1 -0
- package/dist/api/view/projectionPlanes.d.ts +25 -0
- package/dist/api/view/projectionPlanes.d.ts.map +1 -0
- package/dist/api/view/projectionPlanes.js +30 -0
- package/dist/api/view/projectionPlanes.js.map +1 -0
- package/dist/api/view/view-camera.d.ts +2 -2
- package/dist/api/view/view-camera.d.ts.map +1 -1
- package/dist/api/view/view-camera.js +3 -3
- package/dist/api/view/view-camera.js.map +1 -1
- package/dist/api/view/view-projection.d.ts +9 -6
- package/dist/api/view/view-projection.d.ts.map +1 -1
- package/dist/api/view/view-projection.js +132 -65
- package/dist/api/view/view-projection.js.map +1 -1
- package/dist/api/wire.d.ts +45 -0
- package/dist/api/wire.d.ts.map +1 -0
- package/dist/api/wire.js +96 -0
- package/dist/api/wire.js.map +1 -0
- package/dist/boolean/creased-normals.d.ts +50 -0
- package/dist/boolean/creased-normals.d.ts.map +1 -0
- package/dist/boolean/creased-normals.js +114 -0
- package/dist/boolean/creased-normals.js.map +1 -0
- package/dist/boolean/deriveNormals.d.ts +4 -1
- package/dist/boolean/deriveNormals.d.ts.map +1 -1
- package/dist/boolean/deriveNormals.js +5 -2
- package/dist/boolean/deriveNormals.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +6 -0
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +11 -2
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/brep-topology.d.ts +4 -0
- package/dist/brep/brep-topology.d.ts.map +1 -1
- package/dist/brep/brep-topology.js +4 -0
- package/dist/brep/brep-topology.js.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brep-mock.js +79 -59
- 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 +35 -2
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +15 -7
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +64 -167
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/primitives.d.ts +93 -130
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js +9 -7
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/types.d.ts +14 -1
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js +11 -1
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/step.d.ts +3 -0
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +7 -1
- package/dist/brep/export/step.js.map +1 -1
- package/dist/brep/face-evolution.d.ts +8 -0
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +15 -3
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/brep/handle-bridge.d.ts +20 -2
- package/dist/brep/handle-bridge.d.ts.map +1 -1
- package/dist/brep/handle-bridge.js +25 -2
- package/dist/brep/handle-bridge.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +25 -5
- package/dist/brepkit-kernel/brepkitKernel.d.ts.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +782 -218
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/brepkit-kernel/multi-version-test.d.ts +40 -0
- package/dist/brepkit-kernel/multi-version-test.d.ts.map +1 -0
- package/dist/brepkit-kernel/multi-version-test.js +89 -0
- package/dist/brepkit-kernel/multi-version-test.js.map +1 -0
- package/dist/cad-runtime/admit-compat-lib.d.ts +6 -1
- package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.js +5 -1
- package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +9 -3
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +32 -2
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +8 -2
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +3 -0
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +3 -1
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +18 -2
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +29 -1
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +3 -0
- package/dist/env-agnostic.d.ts.map +1 -1
- package/dist/env-agnostic.js +7 -0
- package/dist/env-agnostic.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/lang/symbol-table.generated.d.ts +29 -1
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +30 -2
- package/dist/lang/symbol-table.generated.js.map +1 -1
- package/dist/occt-kernel/highLevelApi.d.ts.map +1 -1
- package/dist/occt-kernel/highLevelApi.js +6 -3
- package/dist/occt-kernel/highLevelApi.js.map +1 -1
- package/dist/occt-kernel/hullGeometry.d.ts +31 -0
- package/dist/occt-kernel/hullGeometry.d.ts.map +1 -0
- package/dist/occt-kernel/hullGeometry.js +319 -0
- package/dist/occt-kernel/hullGeometry.js.map +1 -0
- package/dist/occt-kernel/hullOps.d.ts +24 -0
- package/dist/occt-kernel/hullOps.d.ts.map +1 -0
- package/dist/occt-kernel/hullOps.js +52 -0
- package/dist/occt-kernel/hullOps.js.map +1 -0
- package/dist/occt-kernel/occt-primitives.d.ts +14 -0
- package/dist/occt-kernel/occt-primitives.d.ts.map +1 -0
- package/dist/occt-kernel/occt-primitives.js +351 -0
- package/dist/occt-kernel/occt-primitives.js.map +1 -0
- package/dist/occt-kernel/occtKernel.d.ts +14 -6
- package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
- package/dist/occt-kernel/occtKernel.js +11 -3
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-kernel/topologyExt.js +2 -2
- package/dist/occt-kernel/topologyExt.js.map +1 -1
- package/dist/primitives/brep-primitives.d.ts +4 -0
- package/dist/primitives/brep-primitives.d.ts.map +1 -1
- package/dist/primitives/brep-primitives.js +4 -0
- package/dist/primitives/brep-primitives.js.map +1 -1
- package/dist/result/bug.d.ts +22 -0
- package/dist/result/bug.d.ts.map +1 -0
- package/dist/result/bug.js +28 -0
- package/dist/result/bug.js.map +1 -0
- package/dist/result/errors.d.ts +270 -0
- package/dist/result/errors.d.ts.map +1 -0
- package/dist/result/errors.js +317 -0
- package/dist/result/errors.js.map +1 -0
- package/dist/result/kernelErrorTranslation.d.ts +21 -0
- package/dist/result/kernelErrorTranslation.d.ts.map +1 -0
- package/dist/result/kernelErrorTranslation.js +102 -0
- package/dist/result/kernelErrorTranslation.js.map +1 -0
- package/dist/result/result.d.ts +213 -0
- package/dist/result/result.d.ts.map +1 -0
- package/dist/result/result.js +336 -0
- package/dist/result/result.js.map +1 -0
- package/dist/result/vec3.d.ts +12 -0
- package/dist/result/vec3.d.ts.map +1 -0
- package/dist/result/vec3.js +14 -0
- package/dist/result/vec3.js.map +1 -0
- package/dist/runtime-state.d.ts +9 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js.map +1 -1
- package/dist/sdk.d.ts +3 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +2 -1
- package/dist/sdk.js.map +1 -1
- package/dist/shape.d.ts +43 -1
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +57 -1
- package/dist/shape.js.map +1 -1
- package/dist/topology/naming/geom-hint.js +1 -1
- package/dist/topology/naming/geom-hint.js.map +1 -1
- package/dist/topology/naming/score.js +1 -1
- package/dist/topology/naming/score.js.map +1 -1
- package/package.json +6 -16
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure TypeScript straight skeleton algorithm for simple polygons.
|
|
3
|
+
* No kernel dependency — operates on 2D point arrays.
|
|
4
|
+
*/
|
|
5
|
+
import { ok, err } from '../../result/result.js';
|
|
6
|
+
import { computationError, BrepErrorCode } from '../../result/errors.js';
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Geometry helpers
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
const EPS = 1e-10;
|
|
11
|
+
function cross2(ax, ay, bx, by) {
|
|
12
|
+
return ax * by - ay * bx;
|
|
13
|
+
}
|
|
14
|
+
function dot2(ax, ay, bx, by) {
|
|
15
|
+
return ax * bx + ay * by;
|
|
16
|
+
}
|
|
17
|
+
function len2(x, y) {
|
|
18
|
+
return Math.sqrt(x * x + y * y);
|
|
19
|
+
}
|
|
20
|
+
/** Safe polygon access with modular index. */
|
|
21
|
+
function polyAt(poly, i) {
|
|
22
|
+
const idx = ((i % poly.length) + poly.length) % poly.length;
|
|
23
|
+
const p = poly[idx];
|
|
24
|
+
if (!p)
|
|
25
|
+
throw new Error(`Invalid polygon index ${i} for length ${poly.length}`);
|
|
26
|
+
return p;
|
|
27
|
+
}
|
|
28
|
+
/** Ensure polygon is in CCW order. Returns a new array if reversed. */
|
|
29
|
+
function ensureCCW(poly) {
|
|
30
|
+
let area = 0;
|
|
31
|
+
for (let i = 0; i < poly.length; i++) {
|
|
32
|
+
const cur = polyAt(poly, i);
|
|
33
|
+
const nxt = polyAt(poly, i + 1);
|
|
34
|
+
area += cur.x * nxt.y - nxt.x * cur.y;
|
|
35
|
+
}
|
|
36
|
+
if (area < 0)
|
|
37
|
+
return [...poly].reverse();
|
|
38
|
+
return poly;
|
|
39
|
+
}
|
|
40
|
+
/** Compute unit bisector direction pointing inward for vertex at index i. */
|
|
41
|
+
function bisector(poly, i) {
|
|
42
|
+
const prev = polyAt(poly, i - 1);
|
|
43
|
+
const cur = polyAt(poly, i);
|
|
44
|
+
const next = polyAt(poly, i + 1);
|
|
45
|
+
const e1x = cur.x - prev.x;
|
|
46
|
+
const e1y = cur.y - prev.y;
|
|
47
|
+
const e1l = len2(e1x, e1y);
|
|
48
|
+
const e2x = next.x - cur.x;
|
|
49
|
+
const e2y = next.y - cur.y;
|
|
50
|
+
const e2l = len2(e2x, e2y);
|
|
51
|
+
if (e1l < EPS || e2l < EPS)
|
|
52
|
+
return { dx: 0, dy: 0 };
|
|
53
|
+
const n1x = -e1y / e1l;
|
|
54
|
+
const n1y = e1x / e1l;
|
|
55
|
+
const n2x = -e2y / e2l;
|
|
56
|
+
const n2y = e2x / e2l;
|
|
57
|
+
let bx = n1x + n2x;
|
|
58
|
+
let by = n1y + n2y;
|
|
59
|
+
const bl = len2(bx, by);
|
|
60
|
+
if (bl < EPS) {
|
|
61
|
+
return { dx: n1x, dy: n1y };
|
|
62
|
+
}
|
|
63
|
+
bx /= bl;
|
|
64
|
+
by /= bl;
|
|
65
|
+
const cosHalf = dot2(bx, by, n1x, n1y);
|
|
66
|
+
const speed = Math.abs(cosHalf) > EPS ? 1.0 / cosHalf : 1.0;
|
|
67
|
+
return { dx: bx * speed, dy: by * speed };
|
|
68
|
+
}
|
|
69
|
+
/** Is a LAV node reflex based on current LAV positions? */
|
|
70
|
+
function isLavNodeReflex(node) {
|
|
71
|
+
if (!node.prev || !node.next)
|
|
72
|
+
return false;
|
|
73
|
+
return (cross2(node.x - node.prev.x, node.y - node.prev.y, node.next.x - node.x, node.next.y - node.y) <
|
|
74
|
+
-EPS);
|
|
75
|
+
}
|
|
76
|
+
function createLav(poly) {
|
|
77
|
+
const nodes = poly.map((p, i) => {
|
|
78
|
+
const b = bisector(poly, i);
|
|
79
|
+
return {
|
|
80
|
+
x: p.x,
|
|
81
|
+
y: p.y,
|
|
82
|
+
bx: b.dx,
|
|
83
|
+
by: b.dy,
|
|
84
|
+
origIdx: i,
|
|
85
|
+
prev: null,
|
|
86
|
+
next: null,
|
|
87
|
+
active: true,
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
91
|
+
const node = nodes[i];
|
|
92
|
+
const prevNode = nodes[(i - 1 + nodes.length) % nodes.length];
|
|
93
|
+
const nextNode = nodes[(i + 1) % nodes.length];
|
|
94
|
+
if (node && prevNode && nextNode) {
|
|
95
|
+
node.prev = prevNode;
|
|
96
|
+
node.next = nextNode;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return nodes;
|
|
100
|
+
}
|
|
101
|
+
/** Deactivate a chain of nodes starting from `start`. */
|
|
102
|
+
function deactivateNodes(start, count) {
|
|
103
|
+
let cur = start;
|
|
104
|
+
for (let i = 0; i < count; i++) {
|
|
105
|
+
if (!cur)
|
|
106
|
+
break;
|
|
107
|
+
cur.active = false;
|
|
108
|
+
cur = cur.next;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Count active nodes reachable from a starting node. */
|
|
112
|
+
function lavSize(start) {
|
|
113
|
+
let count = 1;
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: prev/next non-null after construction
|
|
115
|
+
let cur = start.next;
|
|
116
|
+
while (cur !== start) {
|
|
117
|
+
count++;
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
119
|
+
cur = cur.next;
|
|
120
|
+
if (count > 10000)
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
return count;
|
|
124
|
+
}
|
|
125
|
+
/** Time at which two moving bisectors from nodeA and nodeB intersect. */
|
|
126
|
+
function bisectorIntersectTime(a, b) {
|
|
127
|
+
const ddx = a.bx - b.bx;
|
|
128
|
+
const ddy = a.by - b.by;
|
|
129
|
+
const dxp = b.x - a.x;
|
|
130
|
+
const dyp = b.y - a.y;
|
|
131
|
+
if (Math.abs(ddx) < EPS && Math.abs(ddy) < EPS)
|
|
132
|
+
return null;
|
|
133
|
+
let t;
|
|
134
|
+
if (Math.abs(ddx) > Math.abs(ddy)) {
|
|
135
|
+
t = dxp / ddx;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
t = dyp / ddy;
|
|
139
|
+
}
|
|
140
|
+
if (t < EPS)
|
|
141
|
+
return null;
|
|
142
|
+
// Verify the other equation
|
|
143
|
+
const otherDd = Math.abs(ddx) > Math.abs(ddy) ? ddy : ddx;
|
|
144
|
+
const otherDp = Math.abs(ddx) > Math.abs(ddy) ? dyp : dxp;
|
|
145
|
+
if (Math.abs(otherDd) > EPS) {
|
|
146
|
+
const t2 = otherDp / otherDd;
|
|
147
|
+
if (Math.abs(t - t2) > 1e-4 * Math.max(1, Math.abs(t)))
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return t;
|
|
151
|
+
}
|
|
152
|
+
/** Compute ray-segment intersection time for split events. */
|
|
153
|
+
function raySplitTime(node, eA, eB) {
|
|
154
|
+
const edx = eB.x - eA.x;
|
|
155
|
+
const edy = eB.y - eA.y;
|
|
156
|
+
const el = len2(edx, edy);
|
|
157
|
+
if (el < EPS)
|
|
158
|
+
return null;
|
|
159
|
+
const enx = -edy / el;
|
|
160
|
+
const eny = edx / el;
|
|
161
|
+
const d0 = (node.x - eA.x) * enx + (node.y - eA.y) * eny;
|
|
162
|
+
const relBx = node.bx - (eA.bx + eB.bx) / 2;
|
|
163
|
+
const relBy = node.by - (eA.by + eB.by) / 2;
|
|
164
|
+
const dRate = relBx * enx + relBy * eny;
|
|
165
|
+
if (Math.abs(dRate) < EPS)
|
|
166
|
+
return null;
|
|
167
|
+
const t = -d0 / dRate;
|
|
168
|
+
if (t < EPS)
|
|
169
|
+
return null;
|
|
170
|
+
const px = node.x + t * node.bx;
|
|
171
|
+
const py = node.y + t * node.by;
|
|
172
|
+
const ax = eA.x + t * eA.bx;
|
|
173
|
+
const ay = eA.y + t * eA.by;
|
|
174
|
+
const bxx = eB.x + t * eB.bx;
|
|
175
|
+
const byy = eB.y + t * eB.by;
|
|
176
|
+
const segDx = bxx - ax;
|
|
177
|
+
const segDy = byy - ay;
|
|
178
|
+
const segL = len2(segDx, segDy);
|
|
179
|
+
if (segL < EPS)
|
|
180
|
+
return t;
|
|
181
|
+
const s = dot2(px - ax, py - ay, segDx, segDy) / (segL * segL);
|
|
182
|
+
if (s < -0.01 || s > 1.01)
|
|
183
|
+
return null;
|
|
184
|
+
return t;
|
|
185
|
+
}
|
|
186
|
+
function computeEvents(lavNodes) {
|
|
187
|
+
const events = [];
|
|
188
|
+
for (const node of lavNodes) {
|
|
189
|
+
if (!node.active || !node.next)
|
|
190
|
+
continue;
|
|
191
|
+
const t = bisectorIntersectTime(node, node.next);
|
|
192
|
+
if (t !== null && t > EPS) {
|
|
193
|
+
const x = node.x + t * node.bx;
|
|
194
|
+
const y = node.y + t * node.by;
|
|
195
|
+
events.push({ time: t, x, y, nodeA: node, nodeB: node.next, type: 'edge' });
|
|
196
|
+
}
|
|
197
|
+
if (isLavNodeReflex(node)) {
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
199
|
+
let cur = node.next.next;
|
|
200
|
+
let count = 0;
|
|
201
|
+
while (cur !== node.prev && cur !== node && count < 1000) {
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
203
|
+
const st = raySplitTime(node, cur, cur.next);
|
|
204
|
+
if (st !== null && st > EPS) {
|
|
205
|
+
const x = node.x + st * node.bx;
|
|
206
|
+
const y = node.y + st * node.by;
|
|
207
|
+
events.push({ time: st, x, y, nodeA: node, nodeB: cur, type: 'split' });
|
|
208
|
+
}
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
210
|
+
cur = cur.next;
|
|
211
|
+
count++;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
events.sort((a, b) => a.time - b.time);
|
|
216
|
+
return events;
|
|
217
|
+
}
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
// Main algorithm
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
/**
|
|
222
|
+
* Compute the straight skeleton of a simple polygon.
|
|
223
|
+
* The polygon vertices must define a simple (non-self-intersecting) polygon.
|
|
224
|
+
* They will be reordered to CCW if necessary.
|
|
225
|
+
*
|
|
226
|
+
* @param polygon - The input polygon vertices.
|
|
227
|
+
* @returns The computed straight skeleton.
|
|
228
|
+
*/
|
|
229
|
+
export function computeStraightSkeleton(polygon) {
|
|
230
|
+
if (polygon.length < 3) {
|
|
231
|
+
return ok({ nodes: [], faces: [] });
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
return ok(computeStraightSkeletonImpl(polygon));
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
return err(computationError(BrepErrorCode.STRAIGHT_SKELETON_FAILED, e instanceof Error ? e.message : String(e), e));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Internal implementation — may throw on degenerate polygon indices. */
|
|
241
|
+
function computeStraightSkeletonImpl(polygon) {
|
|
242
|
+
const poly = ensureCCW(polygon);
|
|
243
|
+
const n = poly.length;
|
|
244
|
+
const skeletonNodes = [];
|
|
245
|
+
const vertexToSkelNodes = Array.from({ length: n }, () => []);
|
|
246
|
+
const lavNodes = createLav(poly);
|
|
247
|
+
let iterations = 0;
|
|
248
|
+
const maxIter = n * n * 2;
|
|
249
|
+
while (iterations < maxIter) {
|
|
250
|
+
iterations++;
|
|
251
|
+
const activeStart = lavNodes.find((nd) => nd.active);
|
|
252
|
+
if (!activeStart)
|
|
253
|
+
break;
|
|
254
|
+
const sz = lavSize(activeStart);
|
|
255
|
+
if (sz <= 3) {
|
|
256
|
+
if (sz === 3) {
|
|
257
|
+
const a = activeStart;
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: 3-node LAV guaranteed non-null
|
|
259
|
+
const b = a.next;
|
|
260
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: 3-node LAV guaranteed non-null
|
|
261
|
+
const c = b.next;
|
|
262
|
+
const t = bisectorIntersectTime(a, b);
|
|
263
|
+
const time = t !== null && t > EPS ? t : 0;
|
|
264
|
+
const mx = (a.x + b.x + c.x) / 3 + (time * (a.bx + b.bx + c.bx)) / 3;
|
|
265
|
+
const my = (a.y + b.y + c.y) / 3 + (time * (a.by + b.by + c.by)) / 3;
|
|
266
|
+
const nodeIdx = skeletonNodes.length;
|
|
267
|
+
skeletonNodes.push({ x: mx, y: my, height: time });
|
|
268
|
+
const aNodes = vertexToSkelNodes[a.origIdx];
|
|
269
|
+
const bNodes = vertexToSkelNodes[b.origIdx];
|
|
270
|
+
const cNodes = vertexToSkelNodes[c.origIdx];
|
|
271
|
+
if (aNodes)
|
|
272
|
+
aNodes.push(nodeIdx);
|
|
273
|
+
if (bNodes)
|
|
274
|
+
bNodes.push(nodeIdx);
|
|
275
|
+
if (cNodes)
|
|
276
|
+
cNodes.push(nodeIdx);
|
|
277
|
+
a.active = false;
|
|
278
|
+
b.active = false;
|
|
279
|
+
c.active = false;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
deactivateNodes(activeStart, sz);
|
|
283
|
+
}
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const activeNodes = lavNodes.filter((nd) => nd.active);
|
|
287
|
+
const events = computeEvents(activeNodes);
|
|
288
|
+
if (events.length === 0) {
|
|
289
|
+
for (const nd of activeNodes) {
|
|
290
|
+
nd.active = false;
|
|
291
|
+
}
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
const ev = events[0];
|
|
295
|
+
if (!ev)
|
|
296
|
+
break;
|
|
297
|
+
if (ev.type === 'edge') {
|
|
298
|
+
const a = ev.nodeA;
|
|
299
|
+
const b = ev.nodeB;
|
|
300
|
+
if (!a.active || !b.active)
|
|
301
|
+
continue;
|
|
302
|
+
const nodeIdx = skeletonNodes.length;
|
|
303
|
+
skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });
|
|
304
|
+
const aNodes = vertexToSkelNodes[a.origIdx];
|
|
305
|
+
const bNodes = vertexToSkelNodes[b.origIdx];
|
|
306
|
+
if (aNodes)
|
|
307
|
+
aNodes.push(nodeIdx);
|
|
308
|
+
if (bNodes)
|
|
309
|
+
bNodes.push(nodeIdx);
|
|
310
|
+
a.x = ev.x;
|
|
311
|
+
a.y = ev.y;
|
|
312
|
+
a.next = b.next;
|
|
313
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: b.next non-null in active LAV
|
|
314
|
+
b.next.prev = a;
|
|
315
|
+
b.active = false;
|
|
316
|
+
const lavPoly = [];
|
|
317
|
+
let cur = a;
|
|
318
|
+
do {
|
|
319
|
+
lavPoly.push({ x: cur.x, y: cur.y });
|
|
320
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
321
|
+
cur = cur.next;
|
|
322
|
+
} while (cur !== a);
|
|
323
|
+
const bDir = bisector(lavPoly, 0);
|
|
324
|
+
a.bx = bDir.dx;
|
|
325
|
+
a.by = bDir.dy;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
// Split event: reflex vertex `a` reaches opposite edge (nodeB, nodeB.next)
|
|
329
|
+
// Must split the LAV into two independent sub-LAVs
|
|
330
|
+
const a = ev.nodeA;
|
|
331
|
+
const b = ev.nodeB; // start of the opposite edge
|
|
332
|
+
if (!a.active || !b.active)
|
|
333
|
+
continue;
|
|
334
|
+
const nodeIdx = skeletonNodes.length;
|
|
335
|
+
skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });
|
|
336
|
+
const aNodes = vertexToSkelNodes[a.origIdx];
|
|
337
|
+
if (aNodes)
|
|
338
|
+
aNodes.push(nodeIdx);
|
|
339
|
+
const bNodes = vertexToSkelNodes[b.origIdx];
|
|
340
|
+
if (bNodes)
|
|
341
|
+
bNodes.push(nodeIdx);
|
|
342
|
+
// Create a copy of `a` at the split point for the second sub-LAV
|
|
343
|
+
const aCopy = {
|
|
344
|
+
x: ev.x,
|
|
345
|
+
y: ev.y,
|
|
346
|
+
bx: 0,
|
|
347
|
+
by: 0,
|
|
348
|
+
origIdx: a.origIdx,
|
|
349
|
+
prev: null,
|
|
350
|
+
next: null,
|
|
351
|
+
active: true,
|
|
352
|
+
};
|
|
353
|
+
lavNodes.push(aCopy);
|
|
354
|
+
// Move `a` to the split point
|
|
355
|
+
a.x = ev.x;
|
|
356
|
+
a.y = ev.y;
|
|
357
|
+
// Rewire: LAV 1 runs a -> b.next -> ... -> a.prev -> a
|
|
358
|
+
// Rewire: LAV 2 runs aCopy -> a.next -> ... -> b -> aCopy
|
|
359
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: active nodes have non-null prev/next
|
|
360
|
+
const aNext = a.next;
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: active nodes have non-null prev/next
|
|
362
|
+
const bNext = b.next;
|
|
363
|
+
// LAV 1: a connects to b.next on the forward side
|
|
364
|
+
a.next = bNext;
|
|
365
|
+
bNext.prev = a;
|
|
366
|
+
// LAV 2: aCopy connects to a's old next on the forward side, b on the back
|
|
367
|
+
aCopy.next = aNext;
|
|
368
|
+
aNext.prev = aCopy;
|
|
369
|
+
aCopy.prev = b;
|
|
370
|
+
b.next = aCopy;
|
|
371
|
+
// Recompute bisectors for both split-point nodes
|
|
372
|
+
const buildLavPoly = (start) => {
|
|
373
|
+
const poly = [];
|
|
374
|
+
let c = start;
|
|
375
|
+
do {
|
|
376
|
+
poly.push({ x: c.x, y: c.y });
|
|
377
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal
|
|
378
|
+
c = c.next;
|
|
379
|
+
} while (c !== start);
|
|
380
|
+
return poly;
|
|
381
|
+
};
|
|
382
|
+
const lav1Poly = buildLavPoly(a);
|
|
383
|
+
const bDir1 = bisector(lav1Poly, 0);
|
|
384
|
+
a.bx = bDir1.dx;
|
|
385
|
+
a.by = bDir1.dy;
|
|
386
|
+
const lav2Poly = buildLavPoly(aCopy);
|
|
387
|
+
const bDir2 = bisector(lav2Poly, 0);
|
|
388
|
+
aCopy.bx = bDir2.dx;
|
|
389
|
+
aCopy.by = bDir2.dy;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// Build faces: one face per original edge
|
|
393
|
+
const faces = [];
|
|
394
|
+
for (let i = 0; i < n; i++) {
|
|
395
|
+
const j = (i + 1) % n;
|
|
396
|
+
const pi = polyAt(poly, i);
|
|
397
|
+
const pj = polyAt(poly, j);
|
|
398
|
+
const faceVerts = [pi, pj];
|
|
399
|
+
const faceHeights = [0, 0];
|
|
400
|
+
const jNodes = vertexToSkelNodes[j];
|
|
401
|
+
const iNodes = vertexToSkelNodes[i];
|
|
402
|
+
if (jNodes) {
|
|
403
|
+
for (const ni of jNodes) {
|
|
404
|
+
const sn = skeletonNodes[ni];
|
|
405
|
+
if (sn) {
|
|
406
|
+
faceVerts.push({ x: sn.x, y: sn.y });
|
|
407
|
+
faceHeights.push(sn.height);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (iNodes) {
|
|
412
|
+
for (let k = iNodes.length - 1; k >= 0; k--) {
|
|
413
|
+
const idx = iNodes[k];
|
|
414
|
+
if (idx === undefined)
|
|
415
|
+
continue;
|
|
416
|
+
const sn = skeletonNodes[idx];
|
|
417
|
+
if (!sn)
|
|
418
|
+
continue;
|
|
419
|
+
const lastVert = faceVerts[faceVerts.length - 1];
|
|
420
|
+
if (!lastVert)
|
|
421
|
+
continue;
|
|
422
|
+
const dist = len2(sn.x - lastVert.x, sn.y - lastVert.y);
|
|
423
|
+
if (dist > EPS) {
|
|
424
|
+
faceVerts.push({ x: sn.x, y: sn.y });
|
|
425
|
+
faceHeights.push(sn.height);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (faceVerts.length >= 3) {
|
|
430
|
+
faces.push({ vertices: faceVerts, heights: faceHeights });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// Deduplicate skeleton nodes
|
|
434
|
+
const uniqueNodes = [];
|
|
435
|
+
for (const sn of skeletonNodes) {
|
|
436
|
+
const exists = uniqueNodes.some((un) => Math.abs(un.x - sn.x) < 0.01 && Math.abs(un.y - sn.y) < 0.01);
|
|
437
|
+
if (!exists) {
|
|
438
|
+
uniqueNodes.push(sn);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return { nodes: uniqueNodes, faces };
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=straightSkeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"straightSkeleton.js","sourceRoot":"","sources":["../../../src/api/brep-mirror/straightSkeleton.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AA+BrE,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,GAAG,GAAG,KAAK,CAAC;AAElB,SAAS,MAAM,CAAC,EAAU,EAAE,EAAU,EAAE,EAA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I,IAAI,GAAG,GAAG,EAAE,CAAC;oBACf,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;oBACrC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,6BAA6B;IAC7B,MAAM,WAAW,GAAmB,EAAE,CAAC;IACvC,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAC7B,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CACrE,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC","sourcesContent":["/**\n * Pure TypeScript straight skeleton algorithm for simple polygons.\n * No kernel dependency — operates on 2D point arrays.\n */\n\nimport type { Result } from '../../result/result'\nimport { ok, err } from '../../result/result'\nimport { computationError, BrepErrorCode } from '../../result/errors'\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** A 2D polygon point used as skeleton input. */\nexport interface SkPoint2D {\n readonly x: number;\n readonly y: number;\n}\n\n/** A skeleton node: 2D position plus elevation height. */\nexport interface SkeletonNode {\n readonly x: number;\n readonly y: number;\n readonly height: number;\n}\n\n/** A skeleton face: its vertex loop with the matching per-vertex heights. */\nexport interface SkeletonFace {\n readonly vertices: SkPoint2D[];\n readonly heights: number[];\n}\n\n/** A complete straight skeleton: nodes and faces. */\nexport interface StraightSkeleton {\n readonly nodes: SkeletonNode[];\n readonly faces: SkeletonFace[];\n}\n\n// ---------------------------------------------------------------------------\n// Geometry helpers\n// ---------------------------------------------------------------------------\n\nconst EPS = 1e-10;\n\nfunction cross2(ax: number, ay: number, bx: number, by: number): number {\n return ax * by - ay * bx;\n}\n\nfunction dot2(ax: number, ay: number, bx: number, by: number): number {\n return ax * bx + ay * by;\n}\n\nfunction len2(x: number, y: number): number {\n return Math.sqrt(x * x + y * y);\n}\n\n/** Safe polygon access with modular index. */\nfunction polyAt(poly: SkPoint2D[], i: number): SkPoint2D {\n const idx = ((i % poly.length) + poly.length) % poly.length;\n const p = poly[idx];\n if (!p) throw new Error(`Invalid polygon index ${i} for length ${poly.length}`);\n return p;\n}\n\n/** Ensure polygon is in CCW order. Returns a new array if reversed. */\nfunction ensureCCW(poly: SkPoint2D[]): SkPoint2D[] {\n let area = 0;\n for (let i = 0; i < poly.length; i++) {\n const cur = polyAt(poly, i);\n const nxt = polyAt(poly, i + 1);\n area += cur.x * nxt.y - nxt.x * cur.y;\n }\n if (area < 0) return [...poly].reverse();\n return poly;\n}\n\n/** Compute unit bisector direction pointing inward for vertex at index i. */\nfunction bisector(poly: SkPoint2D[], i: number): { dx: number; dy: number } {\n const prev = polyAt(poly, i - 1);\n const cur = polyAt(poly, i);\n const next = polyAt(poly, i + 1);\n\n const e1x = cur.x - prev.x;\n const e1y = cur.y - prev.y;\n const e1l = len2(e1x, e1y);\n const e2x = next.x - cur.x;\n const e2y = next.y - cur.y;\n const e2l = len2(e2x, e2y);\n\n if (e1l < EPS || e2l < EPS) return { dx: 0, dy: 0 };\n\n const n1x = -e1y / e1l;\n const n1y = e1x / e1l;\n const n2x = -e2y / e2l;\n const n2y = e2x / e2l;\n\n let bx = n1x + n2x;\n let by = n1y + n2y;\n const bl = len2(bx, by);\n\n if (bl < EPS) {\n return { dx: n1x, dy: n1y };\n }\n\n bx /= bl;\n by /= bl;\n\n const cosHalf = dot2(bx, by, n1x, n1y);\n const speed = Math.abs(cosHalf) > EPS ? 1.0 / cosHalf : 1.0;\n\n return { dx: bx * speed, dy: by * speed };\n}\n\n// ---------------------------------------------------------------------------\n// LAV (List of Active Vertices)\n// ---------------------------------------------------------------------------\n\ninterface LavNode {\n x: number;\n y: number;\n bx: number;\n by: number;\n origIdx: number;\n prev: LavNode | null;\n next: LavNode | null;\n active: boolean;\n}\n\n/** Is a LAV node reflex based on current LAV positions? */\nfunction isLavNodeReflex(node: LavNode): boolean {\n if (!node.prev || !node.next) return false;\n return (\n cross2(node.x - node.prev.x, node.y - node.prev.y, node.next.x - node.x, node.next.y - node.y) <\n -EPS\n );\n}\n\nfunction createLav(poly: SkPoint2D[]): LavNode[] {\n const nodes: LavNode[] = poly.map((p, i) => {\n const b = bisector(poly, i);\n return {\n x: p.x,\n y: p.y,\n bx: b.dx,\n by: b.dy,\n origIdx: i,\n prev: null,\n next: null,\n active: true,\n };\n });\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n const prevNode = nodes[(i - 1 + nodes.length) % nodes.length];\n const nextNode = nodes[(i + 1) % nodes.length];\n if (node && prevNode && nextNode) {\n node.prev = prevNode;\n node.next = nextNode;\n }\n }\n\n return nodes;\n}\n\n/** Deactivate a chain of nodes starting from `start`. */\nfunction deactivateNodes(start: LavNode | null, count: number): void {\n let cur = start;\n for (let i = 0; i < count; i++) {\n if (!cur) break;\n cur.active = false;\n cur = cur.next;\n }\n}\n\n/** Count active nodes reachable from a starting node. */\nfunction lavSize(start: LavNode): number {\n let count = 1;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: prev/next non-null after construction\n let cur = start.next!;\n while (cur !== start) {\n count++;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n cur = cur.next!;\n if (count > 10000) break;\n }\n return count;\n}\n\n// ---------------------------------------------------------------------------\n// Event computation\n// ---------------------------------------------------------------------------\n\ninterface SkEvent {\n time: number;\n x: number;\n y: number;\n nodeA: LavNode;\n nodeB: LavNode;\n type: 'edge' | 'split';\n}\n\n/** Time at which two moving bisectors from nodeA and nodeB intersect. */\nfunction bisectorIntersectTime(a: LavNode, b: LavNode): number | null {\n const ddx = a.bx - b.bx;\n const ddy = a.by - b.by;\n const dxp = b.x - a.x;\n const dyp = b.y - a.y;\n\n if (Math.abs(ddx) < EPS && Math.abs(ddy) < EPS) return null;\n\n let t: number;\n if (Math.abs(ddx) > Math.abs(ddy)) {\n t = dxp / ddx;\n } else {\n t = dyp / ddy;\n }\n\n if (t < EPS) return null;\n\n // Verify the other equation\n const otherDd = Math.abs(ddx) > Math.abs(ddy) ? ddy : ddx;\n const otherDp = Math.abs(ddx) > Math.abs(ddy) ? dyp : dxp;\n if (Math.abs(otherDd) > EPS) {\n const t2 = otherDp / otherDd;\n if (Math.abs(t - t2) > 1e-4 * Math.max(1, Math.abs(t))) return null;\n }\n\n return t;\n}\n\n/** Compute ray-segment intersection time for split events. */\nfunction raySplitTime(node: LavNode, eA: LavNode, eB: LavNode): number | null {\n const edx = eB.x - eA.x;\n const edy = eB.y - eA.y;\n const el = len2(edx, edy);\n if (el < EPS) return null;\n\n const enx = -edy / el;\n const eny = edx / el;\n\n const d0 = (node.x - eA.x) * enx + (node.y - eA.y) * eny;\n const relBx = node.bx - (eA.bx + eB.bx) / 2;\n const relBy = node.by - (eA.by + eB.by) / 2;\n const dRate = relBx * enx + relBy * eny;\n\n if (Math.abs(dRate) < EPS) return null;\n\n const t = -d0 / dRate;\n if (t < EPS) return null;\n\n const px = node.x + t * node.bx;\n const py = node.y + t * node.by;\n const ax = eA.x + t * eA.bx;\n const ay = eA.y + t * eA.by;\n const bxx = eB.x + t * eB.bx;\n const byy = eB.y + t * eB.by;\n\n const segDx = bxx - ax;\n const segDy = byy - ay;\n const segL = len2(segDx, segDy);\n if (segL < EPS) return t;\n\n const s = dot2(px - ax, py - ay, segDx, segDy) / (segL * segL);\n if (s < -0.01 || s > 1.01) return null;\n\n return t;\n}\n\nfunction computeEvents(lavNodes: LavNode[]): SkEvent[] {\n const events: SkEvent[] = [];\n\n for (const node of lavNodes) {\n if (!node.active || !node.next) continue;\n\n const t = bisectorIntersectTime(node, node.next);\n if (t !== null && t > EPS) {\n const x = node.x + t * node.bx;\n const y = node.y + t * node.by;\n events.push({ time: t, x, y, nodeA: node, nodeB: node.next, type: 'edge' });\n }\n\n if (isLavNodeReflex(node)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n let cur = node.next.next!;\n let count = 0;\n while (cur !== node.prev && cur !== node && count < 1000) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n const st = raySplitTime(node, cur, cur.next!);\n if (st !== null && st > EPS) {\n const x = node.x + st * node.bx;\n const y = node.y + st * node.by;\n events.push({ time: st, x, y, nodeA: node, nodeB: cur, type: 'split' });\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n cur = cur.next!;\n count++;\n }\n }\n }\n\n events.sort((a, b) => a.time - b.time);\n return events;\n}\n\n// ---------------------------------------------------------------------------\n// Main algorithm\n// ---------------------------------------------------------------------------\n\n/**\n * Compute the straight skeleton of a simple polygon.\n * The polygon vertices must define a simple (non-self-intersecting) polygon.\n * They will be reordered to CCW if necessary.\n *\n * @param polygon - The input polygon vertices.\n * @returns The computed straight skeleton.\n */\nexport function computeStraightSkeleton(polygon: SkPoint2D[]): Result<StraightSkeleton> {\n if (polygon.length < 3) {\n return ok({ nodes: [], faces: [] });\n }\n\n try {\n return ok(computeStraightSkeletonImpl(polygon));\n } catch (e: unknown) {\n return err(\n computationError(\n BrepErrorCode.STRAIGHT_SKELETON_FAILED,\n e instanceof Error ? e.message : String(e),\n e\n )\n );\n }\n}\n\n/** Internal implementation — may throw on degenerate polygon indices. */\nfunction computeStraightSkeletonImpl(polygon: SkPoint2D[]): StraightSkeleton {\n const poly = ensureCCW(polygon);\n const n = poly.length;\n\n const skeletonNodes: SkeletonNode[] = [];\n const vertexToSkelNodes: number[][] = Array.from({ length: n }, () => []);\n\n const lavNodes = createLav(poly);\n let iterations = 0;\n const maxIter = n * n * 2;\n\n while (iterations < maxIter) {\n iterations++;\n\n const activeStart = lavNodes.find((nd) => nd.active);\n if (!activeStart) break;\n\n const sz = lavSize(activeStart);\n if (sz <= 3) {\n if (sz === 3) {\n const a = activeStart;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: 3-node LAV guaranteed non-null\n const b = a.next!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: 3-node LAV guaranteed non-null\n const c = b.next!;\n\n const t = bisectorIntersectTime(a, b);\n const time = t !== null && t > EPS ? t : 0;\n const mx = (a.x + b.x + c.x) / 3 + (time * (a.bx + b.bx + c.bx)) / 3;\n const my = (a.y + b.y + c.y) / 3 + (time * (a.by + b.by + c.by)) / 3;\n\n const nodeIdx = skeletonNodes.length;\n skeletonNodes.push({ x: mx, y: my, height: time });\n\n const aNodes = vertexToSkelNodes[a.origIdx];\n const bNodes = vertexToSkelNodes[b.origIdx];\n const cNodes = vertexToSkelNodes[c.origIdx];\n if (aNodes) aNodes.push(nodeIdx);\n if (bNodes) bNodes.push(nodeIdx);\n if (cNodes) cNodes.push(nodeIdx);\n\n a.active = false;\n b.active = false;\n c.active = false;\n } else {\n deactivateNodes(activeStart, sz);\n }\n continue;\n }\n\n const activeNodes = lavNodes.filter((nd) => nd.active);\n const events = computeEvents(activeNodes);\n\n if (events.length === 0) {\n for (const nd of activeNodes) {\n nd.active = false;\n }\n break;\n }\n\n const ev = events[0];\n if (!ev) break;\n\n if (ev.type === 'edge') {\n const a = ev.nodeA;\n const b = ev.nodeB;\n\n if (!a.active || !b.active) continue;\n\n const nodeIdx = skeletonNodes.length;\n skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });\n\n const aNodes = vertexToSkelNodes[a.origIdx];\n const bNodes = vertexToSkelNodes[b.origIdx];\n if (aNodes) aNodes.push(nodeIdx);\n if (bNodes) bNodes.push(nodeIdx);\n\n a.x = ev.x;\n a.y = ev.y;\n\n a.next = b.next;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: b.next non-null in active LAV\n b.next!.prev = a;\n b.active = false;\n\n const lavPoly: SkPoint2D[] = [];\n let cur = a;\n do {\n lavPoly.push({ x: cur.x, y: cur.y });\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n cur = cur.next!;\n } while (cur !== a);\n\n const bDir = bisector(lavPoly, 0);\n a.bx = bDir.dx;\n a.by = bDir.dy;\n } else {\n // Split event: reflex vertex `a` reaches opposite edge (nodeB, nodeB.next)\n // Must split the LAV into two independent sub-LAVs\n const a = ev.nodeA;\n const b = ev.nodeB; // start of the opposite edge\n if (!a.active || !b.active) continue;\n\n const nodeIdx = skeletonNodes.length;\n skeletonNodes.push({ x: ev.x, y: ev.y, height: ev.time });\n const aNodes = vertexToSkelNodes[a.origIdx];\n if (aNodes) aNodes.push(nodeIdx);\n const bNodes = vertexToSkelNodes[b.origIdx];\n if (bNodes) bNodes.push(nodeIdx);\n\n // Create a copy of `a` at the split point for the second sub-LAV\n const aCopy: LavNode = {\n x: ev.x,\n y: ev.y,\n bx: 0,\n by: 0,\n origIdx: a.origIdx,\n prev: null,\n next: null,\n active: true,\n };\n lavNodes.push(aCopy);\n\n // Move `a` to the split point\n a.x = ev.x;\n a.y = ev.y;\n\n // Rewire: LAV 1 runs a -> b.next -> ... -> a.prev -> a\n // Rewire: LAV 2 runs aCopy -> a.next -> ... -> b -> aCopy\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: active nodes have non-null prev/next\n const aNext = a.next!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list: active nodes have non-null prev/next\n const bNext = b.next!;\n\n // LAV 1: a connects to b.next on the forward side\n a.next = bNext;\n bNext.prev = a;\n\n // LAV 2: aCopy connects to a's old next on the forward side, b on the back\n aCopy.next = aNext;\n aNext.prev = aCopy;\n aCopy.prev = b;\n b.next = aCopy;\n\n // Recompute bisectors for both split-point nodes\n const buildLavPoly = (start: LavNode): SkPoint2D[] => {\n const poly: SkPoint2D[] = [];\n let c = start;\n do {\n poly.push({ x: c.x, y: c.y });\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- circular linked list traversal\n c = c.next!;\n } while (c !== start);\n return poly;\n };\n\n const lav1Poly = buildLavPoly(a);\n const bDir1 = bisector(lav1Poly, 0);\n a.bx = bDir1.dx;\n a.by = bDir1.dy;\n\n const lav2Poly = buildLavPoly(aCopy);\n const bDir2 = bisector(lav2Poly, 0);\n aCopy.bx = bDir2.dx;\n aCopy.by = bDir2.dy;\n }\n }\n\n // Build faces: one face per original edge\n const faces: SkeletonFace[] = [];\n\n for (let i = 0; i < n; i++) {\n const j = (i + 1) % n;\n const pi = polyAt(poly, i);\n const pj = polyAt(poly, j);\n const faceVerts: SkPoint2D[] = [pi, pj];\n const faceHeights: number[] = [0, 0];\n\n const jNodes = vertexToSkelNodes[j];\n const iNodes = vertexToSkelNodes[i];\n\n if (jNodes) {\n for (const ni of jNodes) {\n const sn = skeletonNodes[ni];\n if (sn) {\n faceVerts.push({ x: sn.x, y: sn.y });\n faceHeights.push(sn.height);\n }\n }\n }\n\n if (iNodes) {\n for (let k = iNodes.length - 1; k >= 0; k--) {\n const idx = iNodes[k];\n if (idx === undefined) continue;\n const sn = skeletonNodes[idx];\n if (!sn) continue;\n const lastVert = faceVerts[faceVerts.length - 1];\n if (!lastVert) continue;\n const dist = len2(sn.x - lastVert.x, sn.y - lastVert.y);\n if (dist > EPS) {\n faceVerts.push({ x: sn.x, y: sn.y });\n faceHeights.push(sn.height);\n }\n }\n }\n\n if (faceVerts.length >= 3) {\n faces.push({ vertices: faceVerts, heights: faceHeights });\n }\n }\n\n // Deduplicate skeleton nodes\n const uniqueNodes: SkeletonNode[] = [];\n for (const sn of skeletonNodes) {\n const exists = uniqueNodes.some(\n (un) => Math.abs(un.x - sn.x) < 0.01 && Math.abs(un.y - sn.y) < 0.01\n );\n if (!exists) {\n uniqueNodes.push(sn);\n }\n }\n\n return { nodes: uniqueNodes, faces };\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-hosted compat-op implementations — extrude/revolve/sweep family
|
|
3
|
+
* (core-decouple Phase 3, §5.4; G3).
|
|
4
|
+
*
|
|
5
|
+
* @platform occt
|
|
6
|
+
*
|
|
7
|
+
* Semantics mirror vendored `operations/{api,extrudeFns,sweepFns}.ts`:
|
|
8
|
+
* - `extrudeBrep` — height: number → [0,0,h]; Vec3 → as-is. EXTRUDE_ZERO_VECTOR guard.
|
|
9
|
+
* - `revolveBrep` — options { at, axis, angle(radians, default 2π) }; REVOLUTION_NOT_3D.
|
|
10
|
+
* - `sweepBrep` — config.mode 'simple' → simplePipe; default → sweepPipeShell(frenet).
|
|
11
|
+
* shellMode / law / auxiliarySpine / support / correction configs are not
|
|
12
|
+
* supported after selfhosting (cad 面取手写 api/sweep.ts,shell 元组不暴露 §2.4①).
|
|
13
|
+
* - `complexExtrudeBrep` / `twistExtrudeBrep` — linear / helix spine built on
|
|
14
|
+
* occt-wasm makeLineEdge+makeWire / makeHelixWire, then sweepPipeShell.
|
|
15
|
+
* ExtrusionProfile scaling law is not supported (vendored buildLawFromProfile
|
|
16
|
+
* has no L1 equivalent); non-undefined profile → LAW_UNSUPPORTED error.
|
|
17
|
+
*/
|
|
18
|
+
import type { BrepHandle } from '../../brep/engine/types.js';
|
|
19
|
+
import { type Result } from '../../result/result.js';
|
|
20
|
+
/**
|
|
21
|
+
* Extrude a face along a vector/height (vendored api.js#extrude + extrudeFns.ts#extrude).
|
|
22
|
+
*
|
|
23
|
+
* @param args - Resolved arguments (face, height or extrusion vector).
|
|
24
|
+
* @returns The extruded solid as a `BrepHandle`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function extrudeBrep(...args: unknown[]): Result<BrepHandle>;
|
|
27
|
+
/**
|
|
28
|
+
* Revolve a face around an axis (vendored api.js#revolve; angle in radians, default 2π).
|
|
29
|
+
*
|
|
30
|
+
* @param args - Resolved arguments (face, revolve options).
|
|
31
|
+
* @returns The revolved solid as a `BrepHandle`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function revolveBrep(...args: unknown[]): Result<BrepHandle>;
|
|
34
|
+
/**
|
|
35
|
+
* Sweep a profile along a spine (vendored sweepFns.ts#sweep).
|
|
36
|
+
*
|
|
37
|
+
* @param args - Resolved arguments (wire, spine, config, shellMode).
|
|
38
|
+
* @returns The swept solid as a `BrepHandle`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function sweepBrep(...args: unknown[]): Result<BrepHandle>;
|
|
41
|
+
/**
|
|
42
|
+
* Extrude a wire along a normal (vendored sweepFns.ts#complexExtrude).
|
|
43
|
+
*
|
|
44
|
+
* @param args - Resolved arguments (wire, center, normal, profile).
|
|
45
|
+
* @returns The extruded solid as a `BrepHandle`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function complexExtrudeBrep(...args: unknown[]): Result<BrepHandle>;
|
|
48
|
+
/**
|
|
49
|
+
* Extrude a wire along a helical path (vendored sweepFns.ts#twistExtrude).
|
|
50
|
+
*
|
|
51
|
+
* @param args - Resolved arguments (wire, angleDegrees, center, normal, profile).
|
|
52
|
+
* @returns The twisted extrusion as a `BrepHandle`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function twistExtrudeBrep(...args: unknown[]): Result<BrepHandle>;
|
|
55
|
+
//# sourceMappingURL=sweepFns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweepFns.d.ts","sourceRoot":"","sources":["../../../src/api/brep-mirror/sweepFns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA8B1D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAclE;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAqBlE;AAMD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CA8BhE;AAMD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CA6BzE;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAqDvE"}
|