@faicad/faijs 0.29.5 → 0.31.1
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/NOTICE +6 -5
- package/dist/api/align/index.d.ts +64 -0
- package/dist/api/align/index.d.ts.map +1 -0
- package/dist/api/align/index.js +101 -0
- package/dist/api/align/index.js.map +1 -0
- package/dist/api/api-namespace.d.ts +6 -5
- package/dist/api/api-namespace.d.ts.map +1 -1
- package/dist/api/api-namespace.js +89 -5
- package/dist/api/api-namespace.js.map +1 -1
- package/dist/api/appearance.d.ts +0 -2
- package/dist/api/appearance.d.ts.map +1 -1
- package/dist/api/appearance.js +0 -2
- package/dist/api/appearance.js.map +1 -1
- package/dist/api/assembly/entities.d.ts +1 -1
- package/dist/api/assembly/entities.js +1 -1
- package/dist/api/assembly/entities.js.map +1 -1
- package/dist/api/assembly/index.d.ts +1 -1
- package/dist/api/assembly/index.js +1 -1
- package/dist/api/assembly/index.js.map +1 -1
- package/dist/api/assembly/joints.d.ts +33 -15
- package/dist/api/assembly/joints.d.ts.map +1 -1
- package/dist/api/assembly/joints.js +31 -13
- package/dist/api/assembly/joints.js.map +1 -1
- package/dist/api/assembly/preview.d.ts +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 +1 -1
- package/dist/api/assembly/solve.js +1 -1
- package/dist/api/assembly/solve.js.map +1 -1
- package/dist/api/assembly/solvers/assembly-tree.d.ts +1 -1
- package/dist/api/assembly/solvers/assembly-tree.js +1 -1
- package/dist/api/assembly/solvers/assembly-tree.js.map +1 -1
- package/dist/api/assembly/solvers/chain-solver.d.ts +2 -2
- package/dist/api/assembly/solvers/chain-solver.js.map +1 -1
- package/dist/api/assembly/solvers/global-solver.d.ts +1 -2
- package/dist/api/assembly/solvers/global-solver.d.ts.map +1 -1
- package/dist/api/assembly/solvers/global-solver.js +3 -4
- package/dist/api/assembly/solvers/global-solver.js.map +1 -1
- package/dist/api/assembly/solvers/joints-kinematics.js +1 -1
- package/dist/api/assembly/solvers/joints-kinematics.js.map +1 -1
- package/dist/api/assembly/solvers/linalg.d.ts +2 -2
- package/dist/api/assembly/solvers/linalg.js +2 -2
- package/dist/api/assembly/solvers/linalg.js.map +1 -1
- package/dist/api/assembly/solvers/types.d.ts +2 -5
- package/dist/api/assembly/solvers/types.d.ts.map +1 -1
- package/dist/api/assembly/solvers/types.js +1 -4
- package/dist/api/assembly/solvers/types.js.map +1 -1
- package/dist/api/boolean-op/index.d.ts +65 -0
- package/dist/api/boolean-op/index.d.ts.map +1 -0
- package/dist/api/boolean-op/index.js +113 -0
- package/dist/api/boolean-op/index.js.map +1 -0
- package/dist/api/boolean.d.ts.map +1 -1
- package/dist/api/boolean.js +22 -33
- package/dist/api/boolean.js.map +1 -1
- package/dist/api/brep-mirror/booleanFns.d.ts +3 -3
- package/dist/api/brep-mirror/booleanFns.js +5 -5
- package/dist/api/brep-mirror/booleanFns.js.map +1 -1
- package/dist/api/brep-mirror/compoundFns.d.ts +1 -1
- package/dist/api/brep-mirror/compoundFns.js +4 -4
- package/dist/api/brep-mirror/compoundFns.js.map +1 -1
- package/dist/api/brep-mirror/healingFns.d.ts +4 -4
- package/dist/api/brep-mirror/healingFns.js +4 -4
- package/dist/api/brep-mirror/healingFns.js.map +1 -1
- package/dist/api/brep-mirror/hullFns.d.ts +2 -2
- package/dist/api/brep-mirror/hullFns.js +2 -2
- package/dist/api/brep-mirror/hullFns.js.map +1 -1
- package/dist/api/brep-mirror/patternFns.d.ts +5 -5
- package/dist/api/brep-mirror/patternFns.js +10 -10
- package/dist/api/brep-mirror/patternFns.js.map +1 -1
- package/dist/api/brep-mirror/primitiveFns.d.ts +4 -4
- package/dist/api/brep-mirror/primitiveFns.js +4 -4
- package/dist/api/brep-mirror/primitiveFns.js.map +1 -1
- package/dist/api/brep-mirror/roofFns.d.ts +3 -3
- package/dist/api/brep-mirror/roofFns.js +7 -7
- package/dist/api/brep-mirror/roofFns.js.map +1 -1
- package/dist/api/brep-mirror/sweepFns.d.ts +7 -7
- package/dist/api/brep-mirror/sweepFns.js +14 -14
- package/dist/api/brep-mirror/sweepFns.js.map +1 -1
- package/dist/api/brep-mirror/threadFns.d.ts +1 -1
- package/dist/api/brep-mirror/threadFns.js +1 -1
- package/dist/api/brep-mirror/threadFns.js.map +1 -1
- package/dist/api/brep-mirror/topologyFns.d.ts +5 -5
- package/dist/api/brep-mirror/topologyFns.js +8 -8
- package/dist/api/brep-mirror/topologyFns.js.map +1 -1
- package/dist/api/brep-operations/booleanFns.d.ts +40 -0
- package/dist/api/brep-operations/booleanFns.d.ts.map +1 -0
- package/dist/api/brep-operations/booleanFns.js +104 -0
- package/dist/api/brep-operations/booleanFns.js.map +1 -0
- package/dist/api/brep-operations/brepHelpers.d.ts +55 -0
- package/dist/api/brep-operations/brepHelpers.d.ts.map +1 -0
- package/dist/api/brep-operations/brepHelpers.js +131 -0
- package/dist/api/brep-operations/brepHelpers.js.map +1 -0
- package/dist/api/brep-operations/compoundFns.d.ts +46 -0
- package/dist/api/brep-operations/compoundFns.d.ts.map +1 -0
- package/dist/api/brep-operations/compoundFns.js +299 -0
- package/dist/api/brep-operations/compoundFns.js.map +1 -0
- package/dist/api/brep-operations/healingFns.d.ts +91 -0
- package/dist/api/brep-operations/healingFns.d.ts.map +1 -0
- package/dist/api/brep-operations/healingFns.js +321 -0
- package/dist/api/brep-operations/healingFns.js.map +1 -0
- package/dist/api/brep-operations/hullFns.d.ts +20 -0
- package/dist/api/brep-operations/hullFns.d.ts.map +1 -0
- package/dist/api/brep-operations/hullFns.js +46 -0
- package/dist/api/brep-operations/hullFns.js.map +1 -0
- package/dist/api/brep-operations/joinery-brep.d.ts +172 -0
- package/dist/api/brep-operations/joinery-brep.d.ts.map +1 -0
- package/dist/api/brep-operations/joinery-brep.js +463 -0
- package/dist/api/brep-operations/joinery-brep.js.map +1 -0
- package/dist/api/brep-operations/patternFns.d.ts +43 -0
- package/dist/api/brep-operations/patternFns.d.ts.map +1 -0
- package/dist/api/brep-operations/patternFns.js +178 -0
- package/dist/api/brep-operations/patternFns.js.map +1 -0
- package/dist/api/brep-operations/primitiveFns.d.ts +42 -0
- package/dist/api/brep-operations/primitiveFns.d.ts.map +1 -0
- package/dist/api/brep-operations/primitiveFns.js +104 -0
- package/dist/api/brep-operations/primitiveFns.js.map +1 -0
- package/dist/api/brep-operations/roofFns.d.ts +24 -0
- package/dist/api/brep-operations/roofFns.d.ts.map +1 -0
- package/dist/api/brep-operations/roofFns.js +229 -0
- package/dist/api/brep-operations/roofFns.js.map +1 -0
- package/dist/api/brep-operations/straightSkeleton.d.ts +36 -0
- package/dist/api/brep-operations/straightSkeleton.d.ts.map +1 -0
- package/dist/api/brep-operations/straightSkeleton.js +431 -0
- package/dist/api/brep-operations/straightSkeleton.js.map +1 -0
- package/dist/api/brep-operations/sweepFns.d.ts +60 -0
- package/dist/api/brep-operations/sweepFns.d.ts.map +1 -0
- package/dist/api/brep-operations/sweepFns.js +323 -0
- package/dist/api/brep-operations/sweepFns.js.map +1 -0
- package/dist/api/brep-operations/threadFns.d.ts +83 -0
- package/dist/api/brep-operations/threadFns.d.ts.map +1 -0
- package/dist/api/brep-operations/threadFns.js +138 -0
- package/dist/api/brep-operations/threadFns.js.map +1 -0
- package/dist/api/brep-operations/topologyFns.d.ts +111 -0
- package/dist/api/brep-operations/topologyFns.d.ts.map +1 -0
- package/dist/api/brep-operations/topologyFns.js +300 -0
- package/dist/api/brep-operations/topologyFns.js.map +1 -0
- package/dist/api/brep-topology.d.ts +1 -1
- package/dist/api/brep-topology.d.ts.map +1 -1
- package/dist/api/brep-topology.js +1 -1
- package/dist/api/brep-topology.js.map +1 -1
- package/dist/api/brepjs-compat/index.d.ts +1 -1
- package/dist/api/brepjs-compat/index.js +3 -3
- package/dist/api/brepjs-compat/index.js.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.d.ts.map +1 -1
- package/dist/api/cadquery-selectors/borrow-bridge.js +3 -4
- package/dist/api/cadquery-selectors/borrow-bridge.js.map +1 -1
- package/dist/api/chamfer.d.ts +5 -4
- package/dist/api/chamfer.d.ts.map +1 -1
- package/dist/api/chamfer.js +12 -11
- package/dist/api/chamfer.js.map +1 -1
- package/dist/api/curve-sketch/index.d.ts +235 -0
- package/dist/api/curve-sketch/index.d.ts.map +1 -0
- package/dist/api/curve-sketch/index.js +493 -0
- package/dist/api/curve-sketch/index.js.map +1 -0
- package/dist/api/draft.d.ts.map +1 -1
- package/dist/api/draft.js +1 -3
- package/dist/api/draft.js.map +1 -1
- package/dist/api/engrave.d.ts.map +1 -1
- package/dist/api/engrave.js +6 -15
- package/dist/api/engrave.js.map +1 -1
- package/dist/api/export-3mf.d.ts +73 -0
- package/dist/api/export-3mf.d.ts.map +1 -0
- package/dist/api/export-3mf.js +121 -0
- package/dist/api/export-3mf.js.map +1 -0
- package/dist/api/export-brep.d.ts +47 -0
- package/dist/api/export-brep.d.ts.map +1 -0
- package/dist/api/export-brep.js +67 -0
- package/dist/api/export-brep.js.map +1 -0
- package/dist/api/export-step.d.ts +67 -0
- package/dist/api/export-step.d.ts.map +1 -0
- package/dist/api/export-step.js +98 -0
- package/dist/api/export-step.js.map +1 -0
- package/dist/api/export-stl.d.ts +58 -0
- package/dist/api/export-stl.d.ts.map +1 -0
- package/dist/api/export-stl.js +114 -0
- package/dist/api/export-stl.js.map +1 -0
- package/dist/api/extrude.d.ts +8 -11
- package/dist/api/extrude.d.ts.map +1 -1
- package/dist/api/extrude.js +11 -14
- package/dist/api/extrude.js.map +1 -1
- package/dist/api/feature-repair.d.ts +1 -1
- package/dist/api/feature-repair.d.ts.map +1 -1
- package/dist/api/feature-repair.js +1 -7
- package/dist/api/feature-repair.js.map +1 -1
- package/dist/api/fillet-variable.d.ts +2 -2
- package/dist/api/fillet-variable.d.ts.map +1 -1
- package/dist/api/fillet-variable.js +2 -3
- package/dist/api/fillet-variable.js.map +1 -1
- package/dist/api/fillet.d.ts +5 -7
- package/dist/api/fillet.d.ts.map +1 -1
- package/dist/api/fillet.js +5 -8
- package/dist/api/fillet.js.map +1 -1
- package/dist/api/generated/2d.d.ts +4 -0
- package/dist/api/generated/2d.d.ts.map +1 -1
- package/dist/api/generated/2d.js +4 -0
- package/dist/api/generated/2d.js.map +1 -1
- package/dist/api/generated/core.d.ts +4 -0
- package/dist/api/generated/core.d.ts.map +1 -1
- package/dist/api/generated/core.js +4 -0
- package/dist/api/generated/core.js.map +1 -1
- package/dist/api/generated/gear.d.ts +4 -0
- package/dist/api/generated/gear.d.ts.map +1 -1
- package/dist/api/generated/gear.js +4 -0
- package/dist/api/generated/gear.js.map +1 -1
- package/dist/api/generated/io.d.ts +4 -0
- package/dist/api/generated/io.d.ts.map +1 -1
- package/dist/api/generated/io.js +4 -0
- package/dist/api/generated/io.js.map +1 -1
- package/dist/api/generated/kernel.d.ts +4 -0
- package/dist/api/generated/kernel.d.ts.map +1 -1
- package/dist/api/generated/kernel.js +4 -0
- package/dist/api/generated/kernel.js.map +1 -1
- package/dist/api/generated/measurement.d.ts +21 -21
- package/dist/api/generated/measurement.d.ts.map +1 -1
- package/dist/api/generated/measurement.js +25 -21
- package/dist/api/generated/measurement.js.map +1 -1
- package/dist/api/generated/ns.d.ts +4 -0
- package/dist/api/generated/ns.d.ts.map +1 -1
- package/dist/api/generated/ns.js +4 -0
- package/dist/api/generated/ns.js.map +1 -1
- package/dist/api/generated/operations.d.ts +32 -32
- package/dist/api/generated/operations.d.ts.map +1 -1
- package/dist/api/generated/operations.js +58 -54
- package/dist/api/generated/operations.js.map +1 -1
- package/dist/api/generated/projection.d.ts +4 -0
- package/dist/api/generated/projection.d.ts.map +1 -1
- package/dist/api/generated/projection.js +4 -0
- package/dist/api/generated/projection.js.map +1 -1
- package/dist/api/generated/query.d.ts +4 -0
- package/dist/api/generated/query.d.ts.map +1 -1
- package/dist/api/generated/query.js +4 -0
- package/dist/api/generated/query.js.map +1 -1
- package/dist/api/generated/script-face-manifest.d.ts +1 -1
- package/dist/api/generated/script-face-manifest.js +3 -3
- package/dist/api/generated/script-face-manifest.js.map +1 -1
- package/dist/api/generated/script-face.d.ts +1 -1
- package/dist/api/generated/script-face.js +1 -1
- package/dist/api/generated/script-face.js.map +1 -1
- package/dist/api/generated/sketching.d.ts +2 -2
- package/dist/api/generated/sketching.d.ts.map +1 -1
- package/dist/api/generated/sketching.js +8 -4
- package/dist/api/generated/sketching.js.map +1 -1
- package/dist/api/generated/text.d.ts +4 -0
- package/dist/api/generated/text.d.ts.map +1 -1
- package/dist/api/generated/text.js +4 -0
- package/dist/api/generated/text.js.map +1 -1
- package/dist/api/generated/topology.d.ts +45 -45
- package/dist/api/generated/topology.d.ts.map +1 -1
- package/dist/api/generated/topology.js +77 -73
- package/dist/api/generated/topology.js.map +1 -1
- package/dist/api/generated/view.d.ts +4 -0
- package/dist/api/generated/view.d.ts.map +1 -1
- package/dist/api/generated/view.js +4 -0
- package/dist/api/generated/view.js.map +1 -1
- package/dist/api/geom-types/constants.d.ts +11 -0
- package/dist/api/geom-types/constants.d.ts.map +1 -0
- package/dist/api/geom-types/constants.js +11 -0
- package/dist/api/geom-types/constants.js.map +1 -0
- package/dist/api/geom-types/index.d.ts +21 -0
- package/dist/api/geom-types/index.d.ts.map +1 -0
- package/dist/api/geom-types/index.js +22 -0
- package/dist/api/geom-types/index.js.map +1 -0
- package/dist/api/geom-types/planeOps.d.ts +98 -0
- package/dist/api/geom-types/planeOps.d.ts.map +1 -0
- package/dist/api/geom-types/planeOps.js +170 -0
- package/dist/api/geom-types/planeOps.js.map +1 -0
- package/dist/api/geom-types/planeTypes.d.ts +24 -0
- package/dist/api/geom-types/planeTypes.d.ts.map +1 -0
- package/dist/api/geom-types/planeTypes.js +8 -0
- package/dist/api/geom-types/planeTypes.js.map +1 -0
- package/dist/api/geom-types/types.d.ts +64 -0
- package/dist/api/geom-types/types.d.ts.map +1 -0
- package/dist/api/geom-types/types.js +48 -0
- package/dist/api/geom-types/types.js.map +1 -0
- package/dist/api/geom-types/vecOps.d.ts +124 -0
- package/dist/api/geom-types/vecOps.d.ts.map +1 -0
- package/dist/api/geom-types/vecOps.js +202 -0
- package/dist/api/geom-types/vecOps.js.map +1 -0
- package/dist/api/geom.d.ts.map +1 -1
- package/dist/api/geom.js +6 -5
- package/dist/api/geom.js.map +1 -1
- package/dist/api/half-space.d.ts +56 -0
- package/dist/api/half-space.d.ts.map +1 -0
- package/dist/api/half-space.js +82 -0
- package/dist/api/half-space.js.map +1 -0
- package/dist/api/helix.d.ts +11 -2
- package/dist/api/helix.d.ts.map +1 -1
- package/dist/api/helix.js +20 -4
- package/dist/api/helix.js.map +1 -1
- package/dist/api/index.d.ts +19 -7
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +44 -11
- package/dist/api/index.js.map +1 -1
- package/dist/api/internal/compat-op.d.ts +10 -36
- package/dist/api/internal/compat-op.d.ts.map +1 -1
- package/dist/api/internal/compat-op.js +17 -51
- package/dist/api/internal/compat-op.js.map +1 -1
- package/dist/api/internal/compat-projection.d.ts +5 -5
- package/dist/api/internal/compat-projection.js +5 -5
- package/dist/api/internal/compat-projection.js.map +1 -1
- package/dist/api/internal/dual-form-args.d.ts +0 -2
- package/dist/api/internal/dual-form-args.d.ts.map +1 -1
- package/dist/api/internal/dual-form-args.js +1 -3
- package/dist/api/internal/dual-form-args.js.map +1 -1
- package/dist/api/internal/export-members.d.ts +80 -0
- package/dist/api/internal/export-members.d.ts.map +1 -0
- package/dist/api/internal/export-members.js +104 -0
- package/dist/api/internal/export-members.js.map +1 -0
- package/dist/api/internal/l3-bridge.d.ts +22 -37
- package/dist/api/internal/l3-bridge.d.ts.map +1 -1
- package/dist/api/internal/l3-bridge.js +30 -77
- package/dist/api/internal/l3-bridge.js.map +1 -1
- package/dist/api/internal/profile-wire.d.ts +1 -1
- package/dist/api/internal/profile-wire.js +1 -1
- package/dist/api/internal/profile-wire.js.map +1 -1
- package/dist/api/internal/result-unwrap.d.ts +4 -6
- package/dist/api/internal/result-unwrap.d.ts.map +1 -1
- package/dist/api/internal/result-unwrap.js +4 -6
- package/dist/api/internal/result-unwrap.js.map +1 -1
- package/dist/api/knurl.d.ts.map +1 -1
- package/dist/api/knurl.js +5 -3
- package/dist/api/knurl.js.map +1 -1
- package/dist/api/loft.d.ts +2 -2
- package/dist/api/loft.d.ts.map +1 -1
- package/dist/api/loft.js +2 -2
- package/dist/api/loft.js.map +1 -1
- package/dist/api/measure-query/index.d.ts +262 -0
- package/dist/api/measure-query/index.d.ts.map +1 -0
- package/dist/api/measure-query/index.js +390 -0
- package/dist/api/measure-query/index.js.map +1 -0
- package/dist/api/measurement/index.d.ts +3 -3
- package/dist/api/measurement/index.js +3 -3
- package/dist/api/measurement/index.js.map +1 -1
- package/dist/api/meta.d.ts +0 -2
- package/dist/api/meta.d.ts.map +1 -1
- package/dist/api/meta.js +0 -2
- package/dist/api/meta.js.map +1 -1
- package/dist/api/offset2d.d.ts +49 -0
- package/dist/api/offset2d.d.ts.map +1 -0
- package/dist/api/offset2d.js +86 -0
- package/dist/api/offset2d.js.map +1 -0
- package/dist/api/pattern.d.ts.map +1 -1
- package/dist/api/pattern.js +3 -6
- package/dist/api/pattern.js.map +1 -1
- package/dist/api/primitives.d.ts +6 -6
- package/dist/api/primitives.d.ts.map +1 -1
- package/dist/api/primitives.js +19 -17
- package/dist/api/primitives.js.map +1 -1
- package/dist/api/profile.d.ts.map +1 -1
- package/dist/api/profile.js +0 -1
- package/dist/api/profile.js.map +1 -1
- package/dist/api/punch-hole.d.ts.map +1 -1
- package/dist/api/punch-hole.js +0 -1
- package/dist/api/punch-hole.js.map +1 -1
- package/dist/api/replicate.d.ts +6 -8
- package/dist/api/replicate.d.ts.map +1 -1
- package/dist/api/replicate.js +27 -65
- package/dist/api/replicate.js.map +1 -1
- package/dist/api/result.d.ts +1 -1
- package/dist/api/result.js +1 -1
- package/dist/api/result.js.map +1 -1
- package/dist/api/revolve.d.ts +2 -2
- package/dist/api/revolve.js +3 -3
- package/dist/api/revolve.js.map +1 -1
- package/dist/api/screw.d.ts +1 -1
- package/dist/api/screw.d.ts.map +1 -1
- package/dist/api/screw.js +5 -4
- package/dist/api/screw.js.map +1 -1
- package/dist/api/sdf.d.ts.map +1 -1
- package/dist/api/sdf.js +3 -2
- package/dist/api/sdf.js.map +1 -1
- package/dist/api/section-by-plane.d.ts.map +1 -1
- package/dist/api/section-by-plane.js +0 -1
- package/dist/api/section-by-plane.js.map +1 -1
- package/dist/api/shape-type/index.d.ts +141 -0
- package/dist/api/shape-type/index.d.ts.map +1 -0
- package/dist/api/shape-type/index.js +182 -0
- package/dist/api/shape-type/index.js.map +1 -0
- package/dist/api/shell.d.ts +2 -2
- package/dist/api/shell.d.ts.map +1 -1
- package/dist/api/shell.js +12 -3
- package/dist/api/shell.js.map +1 -1
- package/dist/api/sketch-on-face.d.ts +3 -3
- package/dist/api/sketch-on-face.d.ts.map +1 -1
- package/dist/api/sketch-on-face.js +6 -4
- package/dist/api/sketch-on-face.js.map +1 -1
- package/dist/api/sketch-on-plane.d.ts.map +1 -1
- package/dist/api/sketch-on-plane.js +0 -1
- package/dist/api/sketch-on-plane.js.map +1 -1
- package/dist/api/solid-from-faces.d.ts +45 -0
- package/dist/api/solid-from-faces.d.ts.map +1 -0
- package/dist/api/solid-from-faces.js +72 -0
- package/dist/api/solid-from-faces.js.map +1 -0
- package/dist/api/solid-offset/index.d.ts +67 -0
- package/dist/api/solid-offset/index.d.ts.map +1 -0
- package/dist/api/solid-offset/index.js +132 -0
- package/dist/api/solid-offset/index.js.map +1 -0
- package/dist/api/split-by-plane.d.ts.map +1 -1
- package/dist/api/split-by-plane.js +0 -1
- package/dist/api/split-by-plane.js.map +1 -1
- package/dist/api/split.d.ts +1 -1
- package/dist/api/split.js +1 -1
- package/dist/api/split.js.map +1 -1
- package/dist/api/surface/arg-spec.d.ts +37 -44
- package/dist/api/surface/arg-spec.d.ts.map +1 -1
- package/dist/api/surface/arg-spec.js +224 -233
- package/dist/api/surface/arg-spec.js.map +1 -1
- package/dist/api/surface-face/index.d.ts +104 -0
- package/dist/api/surface-face/index.d.ts.map +1 -0
- package/dist/api/surface-face/index.js +217 -0
- package/dist/api/surface-face/index.js.map +1 -0
- package/dist/api/surface.d.ts +44 -0
- package/dist/api/surface.d.ts.map +1 -0
- package/dist/api/surface.js +66 -0
- package/dist/api/surface.js.map +1 -0
- package/dist/api/sweep.d.ts +71 -9
- package/dist/api/sweep.d.ts.map +1 -1
- package/dist/api/sweep.js +13 -6
- package/dist/api/sweep.js.map +1 -1
- package/dist/api/thicken.d.ts +1 -1
- package/dist/api/thicken.d.ts.map +1 -1
- package/dist/api/thicken.js +12 -3
- package/dist/api/thicken.js.map +1 -1
- package/dist/api/transform.d.ts +8 -8
- package/dist/api/transform.d.ts.map +1 -1
- package/dist/api/transform.js +58 -27
- package/dist/api/transform.js.map +1 -1
- package/dist/api/view/cameraFns.d.ts +1 -1
- package/dist/api/view/cameraFns.d.ts.map +1 -1
- package/dist/api/view/cameraFns.js +1 -1
- package/dist/api/view/cameraFns.js.map +1 -1
- package/dist/api/view/index.d.ts +0 -2
- package/dist/api/view/index.d.ts.map +1 -1
- package/dist/api/view/index.js +0 -2
- package/dist/api/view/index.js.map +1 -1
- package/dist/api/view/projectionPlanes.d.ts +1 -1
- package/dist/api/view/projectionPlanes.d.ts.map +1 -1
- package/dist/api/view/projectionPlanes.js.map +1 -1
- package/dist/api/view/view-camera.d.ts +7 -9
- package/dist/api/view/view-camera.d.ts.map +1 -1
- package/dist/api/view/view-camera.js +4 -6
- package/dist/api/view/view-camera.js.map +1 -1
- package/dist/api/view/view-projection.d.ts +0 -2
- package/dist/api/view/view-projection.d.ts.map +1 -1
- package/dist/api/view/view-projection.js +0 -2
- package/dist/api/view/view-projection.js.map +1 -1
- package/dist/api/view/view-sheet.d.ts +0 -2
- package/dist/api/view/view-sheet.d.ts.map +1 -1
- package/dist/api/view/view-sheet.js +0 -2
- package/dist/api/view/view-sheet.js.map +1 -1
- package/dist/api/view-export/index.d.ts +97 -0
- package/dist/api/view-export/index.d.ts.map +1 -0
- package/dist/api/view-export/index.js +118 -0
- package/dist/api/view-export/index.js.map +1 -0
- package/dist/boolean/index.d.ts +23 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +27 -0
- package/dist/boolean/index.js.map +1 -0
- package/dist/brep/brep-chain.d.ts +1 -19
- package/dist/brep/brep-chain.d.ts.map +1 -1
- package/dist/brep/brep-chain.js +0 -1
- package/dist/brep/brep-chain.js.map +1 -1
- package/dist/brep/brep-ops.d.ts +93 -2
- package/dist/brep/brep-ops.d.ts.map +1 -1
- package/dist/brep/brep-ops.js +185 -15
- package/dist/brep/brep-ops.js.map +1 -1
- package/dist/brep/brep-topology.d.ts +20 -0
- package/dist/brep/brep-topology.d.ts.map +1 -1
- package/dist/brep/brep-topology.js +46 -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 +0 -3
- package/dist/brep/engine/adapters/brep-mock.js.map +1 -1
- package/dist/brep/engine/adapters/brepkit.d.ts +4 -3
- package/dist/brep/engine/adapters/brepkit.d.ts.map +1 -1
- package/dist/brep/engine/adapters/brepkit.js +4 -98
- package/dist/brep/engine/adapters/brepkit.js.map +1 -1
- package/dist/brep/engine/adapters/occt.d.ts +1 -1
- package/dist/brep/engine/adapters/occt.d.ts.map +1 -1
- package/dist/brep/engine/adapters/occt.js +4 -148
- package/dist/brep/engine/adapters/occt.js.map +1 -1
- package/dist/brep/engine/native-history.d.ts +27 -0
- package/dist/brep/engine/native-history.d.ts.map +1 -0
- package/dist/brep/engine/native-history.js +54 -0
- package/dist/brep/engine/native-history.js.map +1 -0
- package/dist/brep/engine/primitives.d.ts +2 -3
- package/dist/brep/engine/primitives.d.ts.map +1 -1
- package/dist/brep/engine/primitives.js +1 -2
- package/dist/brep/engine/primitives.js.map +1 -1
- package/dist/brep/engine/registry.d.ts +3 -5
- package/dist/brep/engine/registry.d.ts.map +1 -1
- package/dist/brep/engine/registry.js +2 -2
- package/dist/brep/engine/registry.js.map +1 -1
- package/dist/brep/engine/types.d.ts +35 -77
- package/dist/brep/engine/types.d.ts.map +1 -1
- package/dist/brep/engine/types.js.map +1 -1
- package/dist/brep/export/export-model.d.ts +21 -0
- package/dist/brep/export/export-model.d.ts.map +1 -1
- package/dist/brep/export/export-model.js +171 -73
- package/dist/brep/export/export-model.js.map +1 -1
- package/dist/brep/export/step.d.ts +17 -1
- package/dist/brep/export/step.d.ts.map +1 -1
- package/dist/brep/export/step.js +133 -0
- package/dist/brep/export/step.js.map +1 -1
- package/dist/brep/export/stl.d.ts +22 -1
- package/dist/brep/export/stl.d.ts.map +1 -1
- package/dist/brep/export/stl.js +58 -10
- package/dist/brep/export/stl.js.map +1 -1
- package/dist/brep/export/transform12.d.ts +47 -0
- package/dist/brep/export/transform12.d.ts.map +1 -0
- package/dist/brep/export/transform12.js +87 -0
- package/dist/brep/export/transform12.js.map +1 -0
- package/dist/brep/face-evolution.d.ts +53 -0
- package/dist/brep/face-evolution.d.ts.map +1 -1
- package/dist/brep/face-evolution.js +65 -0
- package/dist/brep/face-evolution.js.map +1 -1
- package/dist/brep/handle-bridge.d.ts +2 -2
- package/dist/brep/handle-bridge.js +2 -2
- package/dist/brep/handle-bridge.js.map +1 -1
- package/dist/brep/index.d.ts +6 -3
- package/dist/brep/index.d.ts.map +1 -1
- package/dist/brep/index.js +6 -3
- package/dist/brep/index.js.map +1 -1
- package/dist/brepkit-kernel/brepkitKernel.d.ts +1 -1
- package/dist/brepkit-kernel/brepkitKernel.js +2 -2
- package/dist/brepkit-kernel/brepkitKernel.js.map +1 -1
- package/dist/browser-host/index.d.ts +4 -1
- package/dist/browser-host/index.d.ts.map +1 -1
- package/dist/browser-host/index.js +7 -1
- package/dist/browser-host/index.js.map +1 -1
- package/dist/browser.d.ts +5 -9
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +5 -26
- package/dist/browser.js.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.d.ts +3 -10
- package/dist/cad-runtime/admit-compat-lib.d.ts.map +1 -1
- package/dist/cad-runtime/admit-compat-lib.js +3 -9
- package/dist/cad-runtime/admit-compat-lib.js.map +1 -1
- package/dist/cad-runtime/backend-dispatch.d.ts +13 -58
- package/dist/cad-runtime/backend-dispatch.d.ts.map +1 -1
- package/dist/cad-runtime/backend-dispatch.js +34 -83
- package/dist/cad-runtime/backend-dispatch.js.map +1 -1
- package/dist/cad-runtime/content-key.d.ts +3 -3
- package/dist/cad-runtime/content-key.js +3 -3
- package/dist/cad-runtime/content-key.js.map +1 -1
- package/dist/cad-runtime/direct-executor.d.ts +6 -3
- package/dist/cad-runtime/direct-executor.d.ts.map +1 -1
- package/dist/cad-runtime/direct-executor.js +31 -9
- package/dist/cad-runtime/direct-executor.js.map +1 -1
- package/dist/cad-runtime/interp/env.d.ts +1 -1
- package/dist/cad-runtime/interp/env.js.map +1 -1
- package/dist/cad-runtime/lib-id.d.ts +0 -2
- package/dist/cad-runtime/lib-id.d.ts.map +1 -1
- package/dist/cad-runtime/lib-id.js +0 -2
- package/dist/cad-runtime/lib-id.js.map +1 -1
- package/dist/cad-runtime/live-shapes.d.ts +3 -5
- package/dist/cad-runtime/live-shapes.d.ts.map +1 -1
- package/dist/cad-runtime/live-shapes.js +8 -10
- package/dist/cad-runtime/live-shapes.js.map +1 -1
- package/dist/cad-runtime/ports.d.ts +31 -3
- package/dist/cad-runtime/ports.d.ts.map +1 -1
- package/dist/cad-runtime/ports.js.map +1 -1
- package/dist/cad-runtime/runtime.d.ts +54 -19
- package/dist/cad-runtime/runtime.d.ts.map +1 -1
- package/dist/cad-runtime/runtime.js +89 -54
- package/dist/cad-runtime/runtime.js.map +1 -1
- package/dist/define-op.d.ts +10 -14
- package/dist/define-op.d.ts.map +1 -1
- package/dist/define-op.js +5 -22
- package/dist/define-op.js.map +1 -1
- package/dist/env-agnostic.d.ts +2 -2
- package/dist/env-agnostic.d.ts.map +1 -1
- package/dist/env-agnostic.js +1 -1
- package/dist/env-agnostic.js.map +1 -1
- package/dist/geometry2d/bridge/plane.d.ts +1 -1
- package/dist/geometry2d/bridge/plane.js +1 -1
- package/dist/geometry2d/bridge/plane.js.map +1 -1
- package/dist/geometry2d/curve2d.d.ts +1 -1
- package/dist/geometry2d/curve2d.js +1 -1
- package/dist/geometry2d/curve2d.js.map +1 -1
- package/dist/index.d.ts +14 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -70
- package/dist/index.js.map +1 -1
- package/dist/io/fai-zip/container-read.d.ts +16 -0
- package/dist/io/fai-zip/container-read.d.ts.map +1 -1
- package/dist/io/fai-zip/container-read.js +22 -0
- package/dist/io/fai-zip/container-read.js.map +1 -1
- package/dist/io/fai-zip/index.d.ts +1 -1
- package/dist/io/fai-zip/index.d.ts.map +1 -1
- package/dist/io/fai-zip/index.js +1 -1
- package/dist/io/fai-zip/index.js.map +1 -1
- package/dist/lang/code-to-args.d.ts.map +1 -1
- package/dist/lang/code-to-args.js +10 -1
- package/dist/lang/code-to-args.js.map +1 -1
- package/dist/lang/determinism-scanner.d.ts.map +1 -1
- package/dist/lang/determinism-scanner.js +22 -9
- package/dist/lang/determinism-scanner.js.map +1 -1
- package/dist/lang/metadata-extractor.d.ts +27 -6
- package/dist/lang/metadata-extractor.d.ts.map +1 -1
- package/dist/lang/metadata-extractor.js +88 -8
- package/dist/lang/metadata-extractor.js.map +1 -1
- package/dist/lang/parse-error.d.ts +4 -0
- package/dist/lang/parse-error.d.ts.map +1 -1
- package/dist/lang/parse-error.js.map +1 -1
- package/dist/lang/security-scanner.d.ts +27 -2
- package/dist/lang/security-scanner.d.ts.map +1 -1
- package/dist/lang/security-scanner.js +29 -2
- package/dist/lang/security-scanner.js.map +1 -1
- package/dist/lang/source-edit.d.ts +2 -2
- package/dist/lang/source-edit.js.map +1 -1
- package/dist/lang/symbol-table.generated.d.ts +53 -0
- package/dist/lang/symbol-table.generated.d.ts.map +1 -1
- package/dist/lang/symbol-table.generated.js +53 -0
- package/dist/lang/symbol-table.generated.js.map +1 -1
- package/dist/mesh/import-model.d.ts +94 -0
- package/dist/mesh/import-model.d.ts.map +1 -0
- package/dist/mesh/import-model.js +15 -0
- package/dist/mesh/import-model.js.map +1 -0
- package/dist/mesh/index.d.ts +19 -63
- package/dist/mesh/index.d.ts.map +1 -1
- package/dist/mesh/index.js +19 -72
- package/dist/mesh/index.js.map +1 -1
- package/dist/mesh/io.d.ts +62 -17
- package/dist/mesh/io.d.ts.map +1 -1
- package/dist/mesh/io.js +210 -41
- package/dist/mesh/io.js.map +1 -1
- package/dist/mesh/primitives.js +1 -1
- package/dist/mesh/primitives.js.map +1 -1
- package/dist/mesh/threemf-bambu.d.ts +12 -1
- package/dist/mesh/threemf-bambu.d.ts.map +1 -1
- package/dist/mesh/threemf-bambu.js +68 -16
- package/dist/mesh/threemf-bambu.js.map +1 -1
- package/dist/mesh/threemf-loader.d.ts +52 -5
- package/dist/mesh/threemf-loader.d.ts.map +1 -1
- package/dist/mesh/threemf-loader.js +139 -41
- package/dist/mesh/threemf-loader.js.map +1 -1
- package/dist/mesh/transform.d.ts +1 -1
- package/dist/mesh/transform.js +1 -1
- package/dist/mesh/transform.js.map +1 -1
- package/dist/mesh/types.d.ts +35 -5
- package/dist/mesh/types.d.ts.map +1 -1
- package/dist/mesh/types.js.map +1 -1
- package/dist/node-host/cli.d.ts +49 -1
- package/dist/node-host/cli.d.ts.map +1 -1
- package/dist/node-host/cli.js +125 -19
- package/dist/node-host/cli.js.map +1 -1
- package/dist/node-host/execute-script.d.ts +56 -0
- package/dist/node-host/execute-script.d.ts.map +1 -0
- package/dist/node-host/execute-script.js +47 -0
- package/dist/node-host/execute-script.js.map +1 -0
- package/dist/node-host/index.d.ts +1 -0
- package/dist/node-host/index.d.ts.map +1 -1
- package/dist/node-host/index.js +4 -0
- package/dist/node-host/index.js.map +1 -1
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -1
- package/dist/occt-kernel/generated/occtPlatform.generated.d.ts +260 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.d.ts.map +1 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.js +875 -0
- package/dist/occt-kernel/generated/occtPlatform.generated.js.map +1 -0
- package/dist/occt-kernel/hullGeometry.d.ts +2 -2
- package/dist/occt-kernel/hullGeometry.js +2 -3
- package/dist/occt-kernel/hullGeometry.js.map +1 -1
- package/dist/occt-kernel/hullOps.d.ts +3 -3
- package/dist/occt-kernel/hullOps.js +4 -4
- package/dist/occt-kernel/hullOps.js.map +1 -1
- package/dist/occt-kernel/occt-primitives.d.ts.map +1 -1
- package/dist/occt-kernel/occt-primitives.js +31 -4
- package/dist/occt-kernel/occt-primitives.js.map +1 -1
- package/dist/occt-kernel/occtKernel.d.ts.map +1 -1
- package/dist/occt-kernel/occtKernel.js +18 -0
- package/dist/occt-kernel/occtKernel.js.map +1 -1
- package/dist/occt-scan/recognize.d.ts +58 -0
- package/dist/occt-scan/recognize.d.ts.map +1 -0
- package/dist/occt-scan/recognize.js +216 -0
- package/dist/occt-scan/recognize.js.map +1 -0
- package/dist/primitives/brep-primitives.js +7 -7
- package/dist/primitives/brep-primitives.js.map +1 -1
- package/dist/primitives/index.d.ts +19 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +21 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/result/bug.d.ts +1 -1
- package/dist/result/bug.js +1 -1
- package/dist/result/bug.js.map +1 -1
- package/dist/result/errors.d.ts +2 -2
- package/dist/result/errors.d.ts.map +1 -1
- package/dist/result/errors.js +1 -1
- package/dist/result/errors.js.map +1 -1
- package/dist/result/vec3.d.ts +1 -1
- package/dist/result/vec3.js +1 -1
- package/dist/result/vec3.js.map +1 -1
- package/dist/runtime-state.d.ts +79 -29
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +84 -0
- package/dist/runtime-state.js.map +1 -1
- package/dist/script-globals.d.ts +24 -0
- package/dist/script-globals.d.ts.map +1 -0
- package/dist/script-globals.js +24 -0
- package/dist/script-globals.js.map +1 -0
- package/dist/sdf/index.d.ts +12 -0
- package/dist/sdf/index.d.ts.map +1 -0
- package/dist/sdf/index.js +13 -0
- package/dist/sdf/index.js.map +1 -0
- package/dist/sdk.d.ts +0 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js.map +1 -1
- package/dist/shape.d.ts +24 -0
- package/dist/shape.d.ts.map +1 -1
- package/dist/shape.js +40 -0
- package/dist/shape.js.map +1 -1
- package/dist/topology/naming/lineage.d.ts +3 -2
- package/dist/topology/naming/lineage.d.ts.map +1 -1
- package/dist/topology/naming/lineage.js.map +1 -1
- package/dist/weapp.d.ts +3 -3
- package/dist/weapp.d.ts.map +1 -1
- package/dist/weapp.js +2 -2
- package/dist/weapp.js.map +1 -1
- package/package.json +283 -44
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure plane operations — replaces the old Plane class methods.
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/planeOps.ts`(同源复制,签名不变);import 来源改为 compat 面
|
|
6
|
+
* 第一方模块与 `result/` 第一方模块。
|
|
7
|
+
*/
|
|
8
|
+
import type { Vec3, Vec2, PointInput } from './types.js';
|
|
9
|
+
import type { Plane, PlaneName, PlaneInput } from './planeTypes.js';
|
|
10
|
+
import { type Result } from '../../result/result.js';
|
|
11
|
+
/**
|
|
12
|
+
* Create a {@link Plane} from an origin, optional X direction, and a normal.
|
|
13
|
+
*
|
|
14
|
+
* If `xDirection` is omitted, the X axis is derived automatically via kernel `gp_Ax3`.
|
|
15
|
+
*
|
|
16
|
+
* @param origin - Origin point of the plane.
|
|
17
|
+
* @param xDirection - Explicit X axis direction, or `null` to auto-derive.
|
|
18
|
+
* @param normal - Plane normal (Z direction).
|
|
19
|
+
* @returns The created plane.
|
|
20
|
+
* @throws If the normal or derived xDir is zero-length.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createPlane(origin: Vec3, xDirection?: Vec3 | null, normal?: Vec3): Plane;
|
|
23
|
+
/**
|
|
24
|
+
* Create a standard named plane with an optional origin offset.
|
|
25
|
+
*
|
|
26
|
+
* @param name - One of the predefined {@link PlaneName} values.
|
|
27
|
+
* @param sourceOrigin - Origin point, or a scalar offset along the plane normal.
|
|
28
|
+
* @returns `Ok<Plane>` on success, or `Err` if the name is unknown.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createNamedPlane(name: PlaneName, sourceOrigin?: PointInput | number): Result<Plane>;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve a {@link PlaneInput} to a concrete {@link Plane}.
|
|
33
|
+
*
|
|
34
|
+
* @param input - Plane input to resolve (a named plane or a `Plane` object).
|
|
35
|
+
* @param origin - Optional origin point or scalar offset along the plane normal.
|
|
36
|
+
* @returns `Ok<Plane>` on success, or `Err` if the named plane cannot be resolved.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolvePlane(input: PlaneInput, origin?: PointInput | number): Result<Plane>;
|
|
39
|
+
/**
|
|
40
|
+
* Create or copy a {@link Plane}.
|
|
41
|
+
*
|
|
42
|
+
* When called with a `Plane` object, returns a shallow copy.
|
|
43
|
+
* When called with a `PlaneName` string (or no arguments), resolves the named
|
|
44
|
+
* plane with an optional origin offset.
|
|
45
|
+
*
|
|
46
|
+
* @param plane - A `Plane` object to copy, or a `PlaneName` string to resolve.
|
|
47
|
+
* @param origin - Origin point or scalar offset along the plane normal.
|
|
48
|
+
* @returns The copied or resolved plane.
|
|
49
|
+
* @default plane `'XY'`
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* Copy a {@link Plane} object.
|
|
53
|
+
*
|
|
54
|
+
* @param plane - The `Plane` object to copy.
|
|
55
|
+
* @returns A shallow copy of the plane.
|
|
56
|
+
*/
|
|
57
|
+
declare function makePlane(plane: Plane): Plane;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a named plane with an optional origin offset.
|
|
60
|
+
*
|
|
61
|
+
* @param plane - The {@link PlaneName} to resolve (defaults to `'XY'`).
|
|
62
|
+
* @param origin - Origin point or scalar offset along the plane normal.
|
|
63
|
+
* @returns The resolved plane.
|
|
64
|
+
*/
|
|
65
|
+
declare function makePlane(plane?: PlaneName, origin?: PointInput | number): Plane;
|
|
66
|
+
export { makePlane };
|
|
67
|
+
/** Convert 2D local coordinates to 3D world coordinates on the plane.
|
|
68
|
+
*
|
|
69
|
+
* @param plane - Plane defining the local coordinate system.
|
|
70
|
+
* @param local - 2D local coordinates.
|
|
71
|
+
* @returns The corresponding 3D world point.
|
|
72
|
+
*/
|
|
73
|
+
export declare function planeToWorld(plane: Plane, local: Vec2): Vec3;
|
|
74
|
+
/**
|
|
75
|
+
* Convert 3D world coordinates to 2D local coordinates on the plane.
|
|
76
|
+
*
|
|
77
|
+
* @param plane - Plane defining the local coordinate system.
|
|
78
|
+
* @param world - 3D world point.
|
|
79
|
+
* @returns The corresponding 2D local coordinates.
|
|
80
|
+
*/
|
|
81
|
+
export declare function planeToLocal(plane: Plane, world: Vec3): Vec2;
|
|
82
|
+
/** Translate a plane by a vector.
|
|
83
|
+
*
|
|
84
|
+
* @param plane - Plane to translate.
|
|
85
|
+
* @param offset - Translation vector.
|
|
86
|
+
* @returns The translated plane.
|
|
87
|
+
*/
|
|
88
|
+
export declare function translatePlane(plane: Plane, offset: Vec3): Plane;
|
|
89
|
+
/**
|
|
90
|
+
* Pivot a plane by rotating its axes around a world-space axis.
|
|
91
|
+
*
|
|
92
|
+
* @param angleDeg - Rotation angle in **degrees**.
|
|
93
|
+
* @param axis - World-space axis to rotate around.
|
|
94
|
+
* @param plane - Plane to pivot.
|
|
95
|
+
* @returns The pivoted plane.
|
|
96
|
+
*/
|
|
97
|
+
export declare function pivotPlane(plane: Plane, angleDeg: number, axis?: Vec3): Plane;
|
|
98
|
+
//# sourceMappingURL=planeOps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeOps.d.ts","sourceRoot":"","sources":["../../../src/api/geom-types/planeOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAYjE,OAAO,EAAE,KAAK,MAAM,EAAmB,MAAM,qBAAqB,CAAC;AAOnE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,IAAI,EACZ,UAAU,GAAE,IAAI,GAAG,IAAW,EAC9B,MAAM,GAAE,IAAgB,GACvB,KAAK,CA+BP;AAqBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,EACf,YAAY,GAAE,UAAU,GAAG,MAAkB,GAC5C,MAAM,CAAC,KAAK,CAAC,CAWf;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAK3F;AAMD;;;;;;;;;;;GAWG;AACH;;;;;GAKG;AACH,iBAAS,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC;AACxC;;;;;;GAMG;AACH,iBAAS,SAAS,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,CAAC;AAMrB;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAG5D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAG5D;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,KAAK,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,IAAgB,GAAG,KAAK,CAMxF"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure plane operations — replaces the old Plane class methods.
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/planeOps.ts`(同源复制,签名不变);import 来源改为 compat 面
|
|
6
|
+
* 第一方模块与 `result/` 第一方模块。
|
|
7
|
+
*/
|
|
8
|
+
import { toVec3 } from './types.js';
|
|
9
|
+
import { vecAdd, vecSub, vecScale, vecDot, vecCross, vecNormalize, vecIsZero, vecRotate, } from './vecOps.js';
|
|
10
|
+
import { DEG2RAD } from './constants.js';
|
|
11
|
+
import { ok, err, unwrap } from '../../result/result.js';
|
|
12
|
+
import { validationError } from '../../result/errors.js';
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Plane construction
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/**
|
|
17
|
+
* Create a {@link Plane} from an origin, optional X direction, and a normal.
|
|
18
|
+
*
|
|
19
|
+
* If `xDirection` is omitted, the X axis is derived automatically via kernel `gp_Ax3`.
|
|
20
|
+
*
|
|
21
|
+
* @param origin - Origin point of the plane.
|
|
22
|
+
* @param xDirection - Explicit X axis direction, or `null` to auto-derive.
|
|
23
|
+
* @param normal - Plane normal (Z direction).
|
|
24
|
+
* @returns The created plane.
|
|
25
|
+
* @throws If the normal or derived xDir is zero-length.
|
|
26
|
+
*/
|
|
27
|
+
export function createPlane(origin, xDirection = null, normal = [0, 0, 1]) {
|
|
28
|
+
const zDir = vecNormalize(normal);
|
|
29
|
+
if (vecIsZero(zDir))
|
|
30
|
+
throw new Error('Plane normal must be non-zero');
|
|
31
|
+
let xDir;
|
|
32
|
+
if (!xDirection) {
|
|
33
|
+
// Derive xDir perpendicular to zDir (same algorithm as kernel gp_Ax3)
|
|
34
|
+
const [nx, ny, nz] = zDir;
|
|
35
|
+
const absX = Math.abs(nx), absY = Math.abs(ny), absZ = Math.abs(nz);
|
|
36
|
+
// Pick the axis least aligned with zDir to cross-product with
|
|
37
|
+
let candidate;
|
|
38
|
+
if (absX <= absY && absX <= absZ)
|
|
39
|
+
candidate = [1, 0, 0];
|
|
40
|
+
else if (absY <= absZ)
|
|
41
|
+
candidate = [0, 1, 0];
|
|
42
|
+
else
|
|
43
|
+
candidate = [0, 0, 1];
|
|
44
|
+
// xDir = normalize(candidate × zDir)
|
|
45
|
+
const cx = candidate[1] * nz - candidate[2] * ny;
|
|
46
|
+
const cy = candidate[2] * nx - candidate[0] * nz;
|
|
47
|
+
const cz = candidate[0] * ny - candidate[1] * nx;
|
|
48
|
+
const len = Math.sqrt(cx * cx + cy * cy + cz * cz);
|
|
49
|
+
xDir = len > 1e-12 ? vecNormalize([cx, cy, cz]) : [1, 0, 0];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
xDir = vecNormalize(xDirection);
|
|
53
|
+
}
|
|
54
|
+
if (vecIsZero(xDir))
|
|
55
|
+
throw new Error('Plane xDir must be non-zero');
|
|
56
|
+
const yDir = vecNormalize(vecCross(zDir, xDir));
|
|
57
|
+
return { origin, xDir, yDir, zDir };
|
|
58
|
+
}
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Named plane configs
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
const PLANES_CONFIG = {
|
|
63
|
+
XY: { xDir: [1, 0, 0], normal: [0, 0, 1] },
|
|
64
|
+
YZ: { xDir: [0, 1, 0], normal: [1, 0, 0] },
|
|
65
|
+
ZX: { xDir: [0, 0, 1], normal: [0, 1, 0] },
|
|
66
|
+
XZ: { xDir: [1, 0, 0], normal: [0, -1, 0] },
|
|
67
|
+
YX: { xDir: [0, 1, 0], normal: [0, 0, -1] },
|
|
68
|
+
ZY: { xDir: [0, 0, 1], normal: [-1, 0, 0] },
|
|
69
|
+
front: { xDir: [1, 0, 0], normal: [0, 0, 1] },
|
|
70
|
+
back: { xDir: [-1, 0, 0], normal: [0, 0, -1] },
|
|
71
|
+
left: { xDir: [0, 0, 1], normal: [-1, 0, 0] },
|
|
72
|
+
right: { xDir: [0, 0, -1], normal: [1, 0, 0] },
|
|
73
|
+
top: { xDir: [1, 0, 0], normal: [0, 1, 0] },
|
|
74
|
+
bottom: { xDir: [1, 0, 0], normal: [0, -1, 0] },
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Create a standard named plane with an optional origin offset.
|
|
78
|
+
*
|
|
79
|
+
* @param name - One of the predefined {@link PlaneName} values.
|
|
80
|
+
* @param sourceOrigin - Origin point, or a scalar offset along the plane normal.
|
|
81
|
+
* @returns `Ok<Plane>` on success, or `Err` if the name is unknown.
|
|
82
|
+
*/
|
|
83
|
+
export function createNamedPlane(name, sourceOrigin = [0, 0, 0]) {
|
|
84
|
+
const config = PLANES_CONFIG[name];
|
|
85
|
+
if (!config)
|
|
86
|
+
return err(validationError('UNKNOWN_PLANE', `Could not find plane ${name}`));
|
|
87
|
+
let origin;
|
|
88
|
+
if (typeof sourceOrigin === 'number') {
|
|
89
|
+
origin = vecScale(config.normal, sourceOrigin);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
origin = toVec3(sourceOrigin);
|
|
93
|
+
}
|
|
94
|
+
return ok(createPlane(origin, config.xDir, config.normal));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolve a {@link PlaneInput} to a concrete {@link Plane}.
|
|
98
|
+
*
|
|
99
|
+
* @param input - Plane input to resolve (a named plane or a `Plane` object).
|
|
100
|
+
* @param origin - Optional origin point or scalar offset along the plane normal.
|
|
101
|
+
* @returns `Ok<Plane>` on success, or `Err` if the named plane cannot be resolved.
|
|
102
|
+
*/
|
|
103
|
+
export function resolvePlane(input, origin) {
|
|
104
|
+
if (typeof input === 'string') {
|
|
105
|
+
return createNamedPlane(input, origin);
|
|
106
|
+
}
|
|
107
|
+
return ok(input);
|
|
108
|
+
}
|
|
109
|
+
function makePlane(plane, origin) {
|
|
110
|
+
if (plane && typeof plane !== 'string') {
|
|
111
|
+
// Already a Plane object - return a copy
|
|
112
|
+
return { ...plane };
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return unwrap(resolvePlane(plane ?? 'XY', origin));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export { makePlane };
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Coordinate transforms
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
/** Convert 2D local coordinates to 3D world coordinates on the plane.
|
|
123
|
+
*
|
|
124
|
+
* @param plane - Plane defining the local coordinate system.
|
|
125
|
+
* @param local - 2D local coordinates.
|
|
126
|
+
* @returns The corresponding 3D world point.
|
|
127
|
+
*/
|
|
128
|
+
export function planeToWorld(plane, local) {
|
|
129
|
+
const [u, v] = local;
|
|
130
|
+
return vecAdd(vecAdd(plane.origin, vecScale(plane.xDir, u)), vecScale(plane.yDir, v));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Convert 3D world coordinates to 2D local coordinates on the plane.
|
|
134
|
+
*
|
|
135
|
+
* @param plane - Plane defining the local coordinate system.
|
|
136
|
+
* @param world - 3D world point.
|
|
137
|
+
* @returns The corresponding 2D local coordinates.
|
|
138
|
+
*/
|
|
139
|
+
export function planeToLocal(plane, world) {
|
|
140
|
+
const relative = vecSub(world, plane.origin);
|
|
141
|
+
return [vecDot(relative, plane.xDir), vecDot(relative, plane.yDir)];
|
|
142
|
+
}
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// Plane transformations (all return new Plane)
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
/** Translate a plane by a vector.
|
|
147
|
+
*
|
|
148
|
+
* @param plane - Plane to translate.
|
|
149
|
+
* @param offset - Translation vector.
|
|
150
|
+
* @returns The translated plane.
|
|
151
|
+
*/
|
|
152
|
+
export function translatePlane(plane, offset) {
|
|
153
|
+
return { ...plane, origin: vecAdd(plane.origin, offset) };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Pivot a plane by rotating its axes around a world-space axis.
|
|
157
|
+
*
|
|
158
|
+
* @param angleDeg - Rotation angle in **degrees**.
|
|
159
|
+
* @param axis - World-space axis to rotate around.
|
|
160
|
+
* @param plane - Plane to pivot.
|
|
161
|
+
* @returns The pivoted plane.
|
|
162
|
+
*/
|
|
163
|
+
export function pivotPlane(plane, angleDeg, axis = [1, 0, 0]) {
|
|
164
|
+
const angleRad = angleDeg * DEG2RAD;
|
|
165
|
+
const newZDir = vecRotate(plane.zDir, axis, angleRad);
|
|
166
|
+
const newXDir = vecRotate(plane.xDir, axis, angleRad);
|
|
167
|
+
const newYDir = vecNormalize(vecCross(newZDir, newXDir));
|
|
168
|
+
return { origin: plane.origin, xDir: newXDir, yDir: newYDir, zDir: newZDir };
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=planeOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeOps.js","sourceRoot":"","sources":["../../../src/api/geom-types/planeOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACt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C/E,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * Pure plane operations — replaces the old Plane class methods.\n *\n * 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs\n * `src/core/planeOps.ts`(同源复制,签名不变);import 来源改为 compat 面\n * 第一方模块与 `result/` 第一方模块。\n */\n\nimport type { Vec3, Vec2, PointInput } from './types';\nimport { toVec3 } from './types';\nimport type { Plane, PlaneName, PlaneInput } from './planeTypes';\nimport {\n vecAdd,\n vecSub,\n vecScale,\n vecDot,\n vecCross,\n vecNormalize,\n vecIsZero,\n vecRotate,\n} from './vecOps';\nimport { DEG2RAD } from './constants';\nimport { type Result, ok, err, unwrap } from '../../result/result';\nimport { validationError } from '../../result/errors';\n\n// ---------------------------------------------------------------------------\n// Plane construction\n// ---------------------------------------------------------------------------\n\n/**\n * Create a {@link Plane} from an origin, optional X direction, and a normal.\n *\n * If `xDirection` is omitted, the X axis is derived automatically via kernel `gp_Ax3`.\n *\n * @param origin - Origin point of the plane.\n * @param xDirection - Explicit X axis direction, or `null` to auto-derive.\n * @param normal - Plane normal (Z direction).\n * @returns The created plane.\n * @throws If the normal or derived xDir is zero-length.\n */\nexport function createPlane(\n origin: Vec3,\n xDirection: Vec3 | null = null,\n normal: Vec3 = [0, 0, 1]\n): Plane {\n const zDir = vecNormalize(normal);\n if (vecIsZero(zDir)) throw new Error('Plane normal must be non-zero');\n\n let xDir: Vec3;\n if (!xDirection) {\n // Derive xDir perpendicular to zDir (same algorithm as kernel gp_Ax3)\n const [nx, ny, nz] = zDir;\n const absX = Math.abs(nx),\n absY = Math.abs(ny),\n absZ = Math.abs(nz);\n // Pick the axis least aligned with zDir to cross-product with\n let candidate: Vec3;\n if (absX <= absY && absX <= absZ) candidate = [1, 0, 0];\n else if (absY <= absZ) candidate = [0, 1, 0];\n else candidate = [0, 0, 1];\n // xDir = normalize(candidate × zDir)\n const cx = candidate[1] * nz - candidate[2] * ny;\n const cy = candidate[2] * nx - candidate[0] * nz;\n const cz = candidate[0] * ny - candidate[1] * nx;\n const len = Math.sqrt(cx * cx + cy * cy + cz * cz);\n xDir = len > 1e-12 ? vecNormalize([cx, cy, cz]) : [1, 0, 0];\n } else {\n xDir = vecNormalize(xDirection);\n }\n\n if (vecIsZero(xDir)) throw new Error('Plane xDir must be non-zero');\n\n const yDir = vecNormalize(vecCross(zDir, xDir));\n\n return { origin, xDir, yDir, zDir };\n}\n\n// ---------------------------------------------------------------------------\n// Named plane configs\n// ---------------------------------------------------------------------------\n\nconst PLANES_CONFIG: Record<PlaneName, { xDir: Vec3; normal: Vec3 }> = {\n XY: { xDir: [1, 0, 0], normal: [0, 0, 1] },\n YZ: { xDir: [0, 1, 0], normal: [1, 0, 0] },\n ZX: { xDir: [0, 0, 1], normal: [0, 1, 0] },\n XZ: { xDir: [1, 0, 0], normal: [0, -1, 0] },\n YX: { xDir: [0, 1, 0], normal: [0, 0, -1] },\n ZY: { xDir: [0, 0, 1], normal: [-1, 0, 0] },\n front: { xDir: [1, 0, 0], normal: [0, 0, 1] },\n back: { xDir: [-1, 0, 0], normal: [0, 0, -1] },\n left: { xDir: [0, 0, 1], normal: [-1, 0, 0] },\n right: { xDir: [0, 0, -1], normal: [1, 0, 0] },\n top: { xDir: [1, 0, 0], normal: [0, 1, 0] },\n bottom: { xDir: [1, 0, 0], normal: [0, -1, 0] },\n};\n\n/**\n * Create a standard named plane with an optional origin offset.\n *\n * @param name - One of the predefined {@link PlaneName} values.\n * @param sourceOrigin - Origin point, or a scalar offset along the plane normal.\n * @returns `Ok<Plane>` on success, or `Err` if the name is unknown.\n */\nexport function createNamedPlane(\n name: PlaneName,\n sourceOrigin: PointInput | number = [0, 0, 0]\n): Result<Plane> {\n const config = PLANES_CONFIG[name] as { xDir: Vec3; normal: Vec3 } | undefined;\n if (!config) return err(validationError('UNKNOWN_PLANE', `Could not find plane ${name}`));\n\n let origin: Vec3;\n if (typeof sourceOrigin === 'number') {\n origin = vecScale(config.normal, sourceOrigin);\n } else {\n origin = toVec3(sourceOrigin);\n }\n return ok(createPlane(origin, config.xDir, config.normal));\n}\n\n/**\n * Resolve a {@link PlaneInput} to a concrete {@link Plane}.\n *\n * @param input - Plane input to resolve (a named plane or a `Plane` object).\n * @param origin - Optional origin point or scalar offset along the plane normal.\n * @returns `Ok<Plane>` on success, or `Err` if the named plane cannot be resolved.\n */\nexport function resolvePlane(input: PlaneInput, origin?: PointInput | number): Result<Plane> {\n if (typeof input === 'string') {\n return createNamedPlane(input, origin);\n }\n return ok(input);\n}\n\n// ---------------------------------------------------------------------------\n// makePlane — convenience constructor (migrated from geometryHelpers.ts)\n// ---------------------------------------------------------------------------\n\n/**\n * Create or copy a {@link Plane}.\n *\n * When called with a `Plane` object, returns a shallow copy.\n * When called with a `PlaneName` string (or no arguments), resolves the named\n * plane with an optional origin offset.\n *\n * @param plane - A `Plane` object to copy, or a `PlaneName` string to resolve.\n * @param origin - Origin point or scalar offset along the plane normal.\n * @returns The copied or resolved plane.\n * @default plane `'XY'`\n */\n/**\n * Copy a {@link Plane} object.\n *\n * @param plane - The `Plane` object to copy.\n * @returns A shallow copy of the plane.\n */\nfunction makePlane(plane: Plane): Plane;\n/**\n * Resolve a named plane with an optional origin offset.\n *\n * @param plane - The {@link PlaneName} to resolve (defaults to `'XY'`).\n * @param origin - Origin point or scalar offset along the plane normal.\n * @returns The resolved plane.\n */\nfunction makePlane(plane?: PlaneName, origin?: PointInput | number): Plane;\nfunction makePlane(plane?: PlaneInput, origin?: PointInput | number): Plane {\n if (plane && typeof plane !== 'string') {\n // Already a Plane object - return a copy\n return { ...plane };\n } else {\n return unwrap(resolvePlane(plane ?? 'XY', origin));\n }\n}\n\nexport { makePlane };\n\n// ---------------------------------------------------------------------------\n// Coordinate transforms\n// ---------------------------------------------------------------------------\n\n/** Convert 2D local coordinates to 3D world coordinates on the plane.\n *\n * @param plane - Plane defining the local coordinate system.\n * @param local - 2D local coordinates.\n * @returns The corresponding 3D world point.\n */\nexport function planeToWorld(plane: Plane, local: Vec2): Vec3 {\n const [u, v] = local;\n return vecAdd(vecAdd(plane.origin, vecScale(plane.xDir, u)), vecScale(plane.yDir, v));\n}\n\n/**\n * Convert 3D world coordinates to 2D local coordinates on the plane.\n *\n * @param plane - Plane defining the local coordinate system.\n * @param world - 3D world point.\n * @returns The corresponding 2D local coordinates.\n */\nexport function planeToLocal(plane: Plane, world: Vec3): Vec2 {\n const relative = vecSub(world, plane.origin);\n return [vecDot(relative, plane.xDir), vecDot(relative, plane.yDir)];\n}\n\n// ---------------------------------------------------------------------------\n// Plane transformations (all return new Plane)\n// ---------------------------------------------------------------------------\n\n/** Translate a plane by a vector.\n *\n * @param plane - Plane to translate.\n * @param offset - Translation vector.\n * @returns The translated plane.\n */\nexport function translatePlane(plane: Plane, offset: Vec3): Plane {\n return { ...plane, origin: vecAdd(plane.origin, offset) };\n}\n\n/**\n * Pivot a plane by rotating its axes around a world-space axis.\n *\n * @param angleDeg - Rotation angle in **degrees**.\n * @param axis - World-space axis to rotate around.\n * @param plane - Plane to pivot.\n * @returns The pivoted plane.\n */\nexport function pivotPlane(plane: Plane, angleDeg: number, axis: Vec3 = [1, 0, 0]): Plane {\n const angleRad = angleDeg * DEG2RAD;\n const newZDir = vecRotate(plane.zDir, axis, angleRad);\n const newXDir = vecRotate(plane.xDir, axis, angleRad);\n const newYDir = vecNormalize(vecCross(newZDir, newXDir));\n return { origin: plane.origin, xDir: newXDir, yDir: newYDir, zDir: newZDir };\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plane type definitions — immutable plain objects.
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/planeTypes.ts`(同源复制,签名不变)。
|
|
6
|
+
*/
|
|
7
|
+
import type { Vec3 } from './types.js';
|
|
8
|
+
/** Immutable plane defined by origin and three orthogonal direction vectors. */
|
|
9
|
+
export interface Plane {
|
|
10
|
+
readonly origin: Vec3;
|
|
11
|
+
readonly xDir: Vec3;
|
|
12
|
+
readonly yDir: Vec3;
|
|
13
|
+
readonly zDir: Vec3;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Named standard planes.
|
|
17
|
+
*
|
|
18
|
+
* Axis pairs (`'XY'`, `'YZ'`, …) and view names (`'front'`, `'top'`, …)
|
|
19
|
+
* are both supported. The axis-pair order determines the normal direction.
|
|
20
|
+
*/
|
|
21
|
+
export type PlaneName = 'XY' | 'YZ' | 'ZX' | 'XZ' | 'YX' | 'ZY' | 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom';
|
|
22
|
+
/** Accept either an explicit {@link Plane} object or a {@link PlaneName} string. */
|
|
23
|
+
export type PlaneInput = Plane | PlaneName;
|
|
24
|
+
//# sourceMappingURL=planeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeTypes.d.ts","sourceRoot":"","sources":["../../../src/api/geom-types/planeTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,gFAAgF;AAChF,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACnB,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEnG,oFAAoF;AACpF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planeTypes.js","sourceRoot":"","sources":["../../../src/api/geom-types/planeTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * Plane type definitions — immutable plain objects.\n *\n * 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs\n * `src/core/planeTypes.ts`(同源复制,签名不变)。\n */\n\nimport type { Vec3 } from './types';\n\n/** Immutable plane defined by origin and three orthogonal direction vectors. */\nexport interface Plane {\n readonly origin: Vec3;\n readonly xDir: Vec3;\n readonly yDir: Vec3;\n readonly zDir: Vec3;\n}\n\n/**\n * Named standard planes.\n *\n * Axis pairs (`'XY'`, `'YZ'`, …) and view names (`'front'`, `'top'`, …)\n * are both supported. The axis-pair order determines the normal direction.\n */\nexport type PlaneName =\n 'XY' | 'YZ' | 'ZX' | 'XZ' | 'YX' | 'ZY' | 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom';\n\n/** Accept either an explicit {@link Plane} object or a {@link PlaneName} string. */\nexport type PlaneInput = Plane | PlaneName;\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions(compat 面类型底座)。
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/types.ts`(同源复制,签名不变)。
|
|
6
|
+
* Vec3 tuples replace the old Vector class.
|
|
7
|
+
* All operations on vectors are pure functions in vecOps.ts.
|
|
8
|
+
*/
|
|
9
|
+
/** 3D vector/point as a readonly tuple */
|
|
10
|
+
export type Vec3 = readonly [number, number, number];
|
|
11
|
+
/** 2D point as a readonly tuple */
|
|
12
|
+
export type Vec2 = readonly [number, number];
|
|
13
|
+
/**
|
|
14
|
+
* Flexible point input — accepts various formats for convenience.
|
|
15
|
+
* Use `toVec3()` to normalize to Vec3.
|
|
16
|
+
*/
|
|
17
|
+
export type PointInput = Vec3 | Vec2 | readonly [number, number, number] | readonly [number, number];
|
|
18
|
+
/** Normalize any point input to Vec3
|
|
19
|
+
*
|
|
20
|
+
* @param p - Point input to normalize.
|
|
21
|
+
* @returns The point as a `Vec3` (missing z defaults to 0).
|
|
22
|
+
*/
|
|
23
|
+
export declare function toVec3(p: PointInput): Vec3;
|
|
24
|
+
/** Normalize to Vec2 (drops z)
|
|
25
|
+
*
|
|
26
|
+
* @param p - Point input to normalize.
|
|
27
|
+
* @returns The point as a `Vec2` (z component dropped).
|
|
28
|
+
*/
|
|
29
|
+
export declare function toVec2(p: PointInput): Vec2;
|
|
30
|
+
/** Direction shorthand — a named axis (`'X'`, `'Y'`, `'Z'`) or an explicit {@link Vec3}. */
|
|
31
|
+
export type Direction = Vec3 | 'X' | 'Y' | 'Z';
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a {@link Direction} shorthand to a unit {@link Vec3}.
|
|
34
|
+
*
|
|
35
|
+
* @param d - Direction shorthand to resolve.
|
|
36
|
+
* @returns The direction as a unit `Vec3`.
|
|
37
|
+
* @throws If the string is not a recognised axis name.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveDirection(d: Direction): Vec3;
|
|
40
|
+
/** A row of a 4x4 matrix. */
|
|
41
|
+
type Row4 = [number, number, number, number];
|
|
42
|
+
/** 4x4 affine transformation matrix in row-major order. Bottom row must be [0,0,0,1]. */
|
|
43
|
+
export type Matrix4x4 = [Row4, Row4, Row4, Row4];
|
|
44
|
+
/** Structured matrix input: 3x3 linear part + translation vector. */
|
|
45
|
+
export interface MatrixTransform {
|
|
46
|
+
/** 3x3 linear part in row-major order: [r00, r01, r02, r10, r11, r12, r20, r21, r22]. */
|
|
47
|
+
readonly linear: readonly [
|
|
48
|
+
number,
|
|
49
|
+
number,
|
|
50
|
+
number,
|
|
51
|
+
number,
|
|
52
|
+
number,
|
|
53
|
+
number,
|
|
54
|
+
number,
|
|
55
|
+
number,
|
|
56
|
+
number
|
|
57
|
+
];
|
|
58
|
+
/** Translation vector [tx, ty, tz]. */
|
|
59
|
+
readonly translation: Vec3;
|
|
60
|
+
}
|
|
61
|
+
/** Input accepted by `applyMatrix`: either a raw 4x4 array or a structured object. */
|
|
62
|
+
export type MatrixInput = Matrix4x4 | MatrixTransform;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/geom-types/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,mCAAmC;AACnC,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,UAAU,GACpB,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAE1C;AAED,4FAA4F;AAC5F,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAQ/C;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,CAOnD;AAMD,6BAA6B;AAC7B,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C,yFAAyF;AACzF,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEjD,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;KACP,CAAC;IACF,uCAAuC;IACvC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B;AAED,sFAAsF;AACtF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions(compat 面类型底座)。
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/types.ts`(同源复制,签名不变)。
|
|
6
|
+
* Vec3 tuples replace the old Vector class.
|
|
7
|
+
* All operations on vectors are pure functions in vecOps.ts.
|
|
8
|
+
*/
|
|
9
|
+
/** Normalize any point input to Vec3
|
|
10
|
+
*
|
|
11
|
+
* @param p - Point input to normalize.
|
|
12
|
+
* @returns The point as a `Vec3` (missing z defaults to 0).
|
|
13
|
+
*/
|
|
14
|
+
export function toVec3(p) {
|
|
15
|
+
if (p.length === 2)
|
|
16
|
+
return [p[0], p[1], 0];
|
|
17
|
+
return [p[0], p[1], p[2]];
|
|
18
|
+
}
|
|
19
|
+
/** Normalize to Vec2 (drops z)
|
|
20
|
+
*
|
|
21
|
+
* @param p - Point input to normalize.
|
|
22
|
+
* @returns The point as a `Vec2` (z component dropped).
|
|
23
|
+
*/
|
|
24
|
+
export function toVec2(p) {
|
|
25
|
+
return [p[0], p[1]];
|
|
26
|
+
}
|
|
27
|
+
const DIRECTIONS = {
|
|
28
|
+
X: [1, 0, 0],
|
|
29
|
+
Y: [0, 1, 0],
|
|
30
|
+
Z: [0, 0, 1],
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Resolve a {@link Direction} shorthand to a unit {@link Vec3}.
|
|
34
|
+
*
|
|
35
|
+
* @param d - Direction shorthand to resolve.
|
|
36
|
+
* @returns The direction as a unit `Vec3`.
|
|
37
|
+
* @throws If the string is not a recognised axis name.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveDirection(d) {
|
|
40
|
+
if (typeof d === 'string') {
|
|
41
|
+
const dir = DIRECTIONS[d];
|
|
42
|
+
if (!dir)
|
|
43
|
+
throw new Error(`Unknown direction: ${d}`);
|
|
44
|
+
return dir;
|
|
45
|
+
}
|
|
46
|
+
return d;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/geom-types/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,CAAa;IAClC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,CAAa;IAClC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAKD,MAAM,UAAU,GAAyB;IACvC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACZ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACZ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAY;IAC3C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * Core type definitions(compat 面类型底座)。\n *\n * 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs\n * `src/core/types.ts`(同源复制,签名不变)。\n * Vec3 tuples replace the old Vector class.\n * All operations on vectors are pure functions in vecOps.ts.\n */\n\n/** 3D vector/point as a readonly tuple */\nexport type Vec3 = readonly [number, number, number];\n\n/** 2D point as a readonly tuple */\nexport type Vec2 = readonly [number, number];\n\n/**\n * Flexible point input — accepts various formats for convenience.\n * Use `toVec3()` to normalize to Vec3.\n */\nexport type PointInput =\n Vec3 | Vec2 | readonly [number, number, number] | readonly [number, number];\n\n/** Normalize any point input to Vec3\n *\n * @param p - Point input to normalize.\n * @returns The point as a `Vec3` (missing z defaults to 0).\n */\nexport function toVec3(p: PointInput): Vec3 {\n if (p.length === 2) return [p[0], p[1], 0];\n return [p[0], p[1], p[2]];\n}\n\n/** Normalize to Vec2 (drops z)\n *\n * @param p - Point input to normalize.\n * @returns The point as a `Vec2` (z component dropped).\n */\nexport function toVec2(p: PointInput): Vec2 {\n return [p[0], p[1]];\n}\n\n/** Direction shorthand — a named axis (`'X'`, `'Y'`, `'Z'`) or an explicit {@link Vec3}. */\nexport type Direction = Vec3 | 'X' | 'Y' | 'Z';\n\nconst DIRECTIONS: Record<string, Vec3> = {\n X: [1, 0, 0],\n Y: [0, 1, 0],\n Z: [0, 0, 1],\n};\n\n/**\n * Resolve a {@link Direction} shorthand to a unit {@link Vec3}.\n *\n * @param d - Direction shorthand to resolve.\n * @returns The direction as a unit `Vec3`.\n * @throws If the string is not a recognised axis name.\n */\nexport function resolveDirection(d: Direction): Vec3 {\n if (typeof d === 'string') {\n const dir = DIRECTIONS[d];\n if (!dir) throw new Error(`Unknown direction: ${d}`);\n return dir;\n }\n return d;\n}\n\n// ---------------------------------------------------------------------------\n// Matrix types for applyMatrix (OpenSCAD multmatrix equivalent)\n// ---------------------------------------------------------------------------\n\n/** A row of a 4x4 matrix. */\ntype Row4 = [number, number, number, number];\n\n/** 4x4 affine transformation matrix in row-major order. Bottom row must be [0,0,0,1]. */\nexport type Matrix4x4 = [Row4, Row4, Row4, Row4];\n\n/** Structured matrix input: 3x3 linear part + translation vector. */\nexport interface MatrixTransform {\n /** 3x3 linear part in row-major order: [r00, r01, r02, r10, r11, r12, r20, r21, r22]. */\n readonly linear: readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ];\n /** Translation vector [tx, ty, tz]. */\n readonly translation: Vec3;\n}\n\n/** Input accepted by `applyMatrix`: either a raw 4x4 array or a structured object. */\nexport type MatrixInput = Matrix4x4 | MatrixTransform;\n"]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure vector operations on Vec3 tuples.
|
|
3
|
+
*
|
|
4
|
+
* 第一方模块(2026-09-25 core-decouple Phase 1):复制自 brepjs
|
|
5
|
+
* `src/core/vecOps.ts`(同源复制,签名不变);import 来源改为 compat 面
|
|
6
|
+
* 第一方 `types.ts`。
|
|
7
|
+
*/
|
|
8
|
+
import type { Vec3 } from './types.js';
|
|
9
|
+
/** Add two 3D vectors component-wise.
|
|
10
|
+
*
|
|
11
|
+
* @param a - First vector.
|
|
12
|
+
* @param b - Second vector.
|
|
13
|
+
* @returns The component-wise sum `a + b`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function vecAdd(a: Vec3, b: Vec3): Vec3;
|
|
16
|
+
/** Subtract vector `b` from vector `a` component-wise.
|
|
17
|
+
*
|
|
18
|
+
* @param a - Vector to subtract from.
|
|
19
|
+
* @param b - Vector to subtract.
|
|
20
|
+
* @returns The component-wise difference `a - b`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function vecSub(a: Vec3, b: Vec3): Vec3;
|
|
23
|
+
/** Multiply each component of a 3D vector by a scalar.
|
|
24
|
+
*
|
|
25
|
+
* @param v - Vector to scale.
|
|
26
|
+
* @param s - Scalar multiplier.
|
|
27
|
+
* @returns The scaled vector.
|
|
28
|
+
*/
|
|
29
|
+
export declare function vecScale(v: Vec3, s: number): Vec3;
|
|
30
|
+
/** Negate all components of a 3D vector.
|
|
31
|
+
*
|
|
32
|
+
* @param v - Vector to negate.
|
|
33
|
+
* @returns The negated vector `-v`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function vecNegate(v: Vec3): Vec3;
|
|
36
|
+
/** Compute the dot product of two 3D vectors.
|
|
37
|
+
*
|
|
38
|
+
* @param a - First vector.
|
|
39
|
+
* @param b - Second vector.
|
|
40
|
+
* @returns The scalar dot product `a · b`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function vecDot(a: Vec3, b: Vec3): number;
|
|
43
|
+
/** Compute the cross product of two 3D vectors.
|
|
44
|
+
*
|
|
45
|
+
* @param a - First vector.
|
|
46
|
+
* @param b - Second vector.
|
|
47
|
+
* @returns The cross product `a × b`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function vecCross(a: Vec3, b: Vec3): Vec3;
|
|
50
|
+
/** Compute the Euclidean length of a 3D vector.
|
|
51
|
+
*
|
|
52
|
+
* @param v - Vector to measure.
|
|
53
|
+
* @returns The Euclidean length of `v`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function vecLength(v: Vec3): number;
|
|
56
|
+
/** Compute the squared length of a 3D vector (avoids a sqrt).
|
|
57
|
+
*
|
|
58
|
+
* @param v - Vector to measure.
|
|
59
|
+
* @returns The squared Euclidean length of `v`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function vecLengthSq(v: Vec3): number;
|
|
62
|
+
/** Compute the Euclidean distance between two 3D points.
|
|
63
|
+
*
|
|
64
|
+
* @param a - First point.
|
|
65
|
+
* @param b - Second point.
|
|
66
|
+
* @returns The distance `|a - b|`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function vecDistance(a: Vec3, b: Vec3): number;
|
|
69
|
+
/** Return a unit-length vector in the same direction, or `[0,0,0]` for near-zero input.
|
|
70
|
+
*
|
|
71
|
+
* @param v - Vector to normalize.
|
|
72
|
+
* @returns A unit-length vector in the same direction, or `[0,0,0]`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function vecNormalize(v: Vec3): Vec3;
|
|
75
|
+
/**
|
|
76
|
+
* Test whether two 3D vectors are approximately equal.
|
|
77
|
+
*
|
|
78
|
+
* @param a - First vector.
|
|
79
|
+
* @param b - Second vector.
|
|
80
|
+
* @param tolerance - Per-component absolute tolerance.
|
|
81
|
+
* @returns True if the vectors are approximately equal.
|
|
82
|
+
* @default tolerance `1e-5`
|
|
83
|
+
*/
|
|
84
|
+
export declare function vecEquals(a: Vec3, b: Vec3, tolerance?: number): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Test whether a 3D vector is approximately zero-length.
|
|
87
|
+
*
|
|
88
|
+
* @param v - Vector to test.
|
|
89
|
+
* @param tolerance - Length threshold below which the vector is considered zero.
|
|
90
|
+
* @returns True if the vector is approximately zero-length.
|
|
91
|
+
* @default tolerance `1e-10`
|
|
92
|
+
*/
|
|
93
|
+
export declare function vecIsZero(v: Vec3, tolerance?: number): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Compute the unsigned angle between two 3D vectors in **radians**.
|
|
96
|
+
*
|
|
97
|
+
* @param a - First vector.
|
|
98
|
+
* @param b - Second vector.
|
|
99
|
+
* @returns Angle in `[0, PI]`, or `0` if either vector is zero-length.
|
|
100
|
+
*/
|
|
101
|
+
export declare function vecAngle(a: Vec3, b: Vec3): number;
|
|
102
|
+
/** Project vector onto plane defined by its normal
|
|
103
|
+
*
|
|
104
|
+
* @param v - Vector to project.
|
|
105
|
+
* @param planeOrigin - A point on the plane.
|
|
106
|
+
* @param planeNormal - Plane normal (need not be unit length).
|
|
107
|
+
* @returns The projection of `v` onto the plane.
|
|
108
|
+
*/
|
|
109
|
+
export declare function vecProjectToPlane(v: Vec3, planeOrigin: Vec3, planeNormal: Vec3): Vec3;
|
|
110
|
+
/** Rotate vector around an axis by angle (radians)
|
|
111
|
+
*
|
|
112
|
+
* @param v - Vector to rotate.
|
|
113
|
+
* @param axis - Rotation axis (need not be unit length).
|
|
114
|
+
* @param angleRad - Rotation angle in radians.
|
|
115
|
+
* @returns The rotated vector.
|
|
116
|
+
*/
|
|
117
|
+
export declare function vecRotate(v: Vec3, axis: Vec3, angleRad: number): Vec3;
|
|
118
|
+
/** Format a Vec3 as a human-readable string rounded to 3 decimal places.
|
|
119
|
+
*
|
|
120
|
+
* @param v - Vector to format.
|
|
121
|
+
* @returns A human-readable representation of `v`.
|
|
122
|
+
*/
|
|
123
|
+
export declare function vecRepr(v: Vec3): string;
|
|
124
|
+
//# sourceMappingURL=vecOps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vecOps.d.ts","sourceRoot":"","sources":["../../../src/api/geom-types/vecOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAMpC;;;;;GAKG;AACH,wBAAgB,MAAM,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