fluidcad 0.0.2
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.txt +504 -0
- package/README.md +175 -0
- package/bin/fluidcad.js +94 -0
- package/bin/watcher.js +55 -0
- package/lib/dist/common/edge.d.ts +14 -0
- package/lib/dist/common/edge.js +32 -0
- package/lib/dist/common/face.d.ts +31 -0
- package/lib/dist/common/face.js +83 -0
- package/lib/dist/common/materials.d.ts +7 -0
- package/lib/dist/common/materials.js +22 -0
- package/lib/dist/common/scene-object.d.ts +111 -0
- package/lib/dist/common/scene-object.js +380 -0
- package/lib/dist/common/shape-factory.d.ts +8 -0
- package/lib/dist/common/shape-factory.js +31 -0
- package/lib/dist/common/shape-type.d.ts +1 -0
- package/lib/dist/common/shape-type.js +1 -0
- package/lib/dist/common/shape.d.ts +43 -0
- package/lib/dist/common/shape.js +95 -0
- package/lib/dist/common/shapes.d.ts +6 -0
- package/lib/dist/common/shapes.js +6 -0
- package/lib/dist/common/solid-face.d.ts +9 -0
- package/lib/dist/common/solid-face.js +22 -0
- package/lib/dist/common/solid.d.ts +20 -0
- package/lib/dist/common/solid.js +68 -0
- package/lib/dist/common/vertex.d.ts +17 -0
- package/lib/dist/common/vertex.js +44 -0
- package/lib/dist/common/wire.d.ts +22 -0
- package/lib/dist/common/wire.js +97 -0
- package/lib/dist/constraints/constraint.d.ts +11 -0
- package/lib/dist/constraints/constraint.js +51 -0
- package/lib/dist/constraints/outside.d.ts +3 -0
- package/lib/dist/constraints/outside.js +4 -0
- package/lib/dist/core/2d/aline.d.ts +28 -0
- package/lib/dist/core/2d/aline.js +26 -0
- package/lib/dist/core/2d/arc.d.ts +77 -0
- package/lib/dist/core/2d/arc.js +49 -0
- package/lib/dist/core/2d/aslot.d.ts +12 -0
- package/lib/dist/core/2d/aslot.js +40 -0
- package/lib/dist/core/2d/bezier.d.ts +16 -0
- package/lib/dist/core/2d/bezier.js +15 -0
- package/lib/dist/core/2d/circle.d.ts +24 -0
- package/lib/dist/core/2d/circle.js +44 -0
- package/lib/dist/core/2d/connect.d.ts +11 -0
- package/lib/dist/core/2d/connect.js +10 -0
- package/lib/dist/core/2d/crect.d.ts +12 -0
- package/lib/dist/core/2d/crect.js +74 -0
- package/lib/dist/core/2d/face-driller.d.ts +8 -0
- package/lib/dist/core/2d/face-driller.js +70 -0
- package/lib/dist/core/2d/face-maker.d.ts +13 -0
- package/lib/dist/core/2d/face-maker.js +119 -0
- package/lib/dist/core/2d/face-maker2.d.ts +6 -0
- package/lib/dist/core/2d/face-maker2.js +54 -0
- package/lib/dist/core/2d/hline.d.ts +33 -0
- package/lib/dist/core/2d/hline.js +37 -0
- package/lib/dist/core/2d/hmove.d.ts +9 -0
- package/lib/dist/core/2d/hmove.js +11 -0
- package/lib/dist/core/2d/index.d.ts +22 -0
- package/lib/dist/core/2d/index.js +22 -0
- package/lib/dist/core/2d/line.d.ts +24 -0
- package/lib/dist/core/2d/line.js +40 -0
- package/lib/dist/core/2d/move.d.ts +13 -0
- package/lib/dist/core/2d/move.js +13 -0
- package/lib/dist/core/2d/offset.d.ts +21 -0
- package/lib/dist/core/2d/offset.js +24 -0
- package/lib/dist/core/2d/pmove.d.ts +11 -0
- package/lib/dist/core/2d/pmove.js +12 -0
- package/lib/dist/core/2d/polygon.d.ts +38 -0
- package/lib/dist/core/2d/polygon.js +63 -0
- package/lib/dist/core/2d/project.d.ts +17 -0
- package/lib/dist/core/2d/project.js +20 -0
- package/lib/dist/core/2d/rect.d.ts +27 -0
- package/lib/dist/core/2d/rect.js +58 -0
- package/lib/dist/core/2d/rmove.d.ts +17 -0
- package/lib/dist/core/2d/rmove.js +14 -0
- package/lib/dist/core/2d/slot.d.ts +49 -0
- package/lib/dist/core/2d/slot.js +65 -0
- package/lib/dist/core/2d/tarc.d.ts +46 -0
- package/lib/dist/core/2d/tarc.js +61 -0
- package/lib/dist/core/2d/tcircle.d.ts +15 -0
- package/lib/dist/core/2d/tcircle.js +24 -0
- package/lib/dist/core/2d/tline.d.ts +24 -0
- package/lib/dist/core/2d/tline.js +30 -0
- package/lib/dist/core/2d/vline.d.ts +33 -0
- package/lib/dist/core/2d/vline.js +37 -0
- package/lib/dist/core/2d/vmove.d.ts +9 -0
- package/lib/dist/core/2d/vmove.js +11 -0
- package/lib/dist/core/2d/wire.d.ts +11 -0
- package/lib/dist/core/2d/wire.js +29 -0
- package/lib/dist/core/axis.d.ts +41 -0
- package/lib/dist/core/axis.js +104 -0
- package/lib/dist/core/chamfer.d.ts +31 -0
- package/lib/dist/core/chamfer.js +32 -0
- package/lib/dist/core/color.d.ts +16 -0
- package/lib/dist/core/color.js +19 -0
- package/lib/dist/core/common.d.ts +12 -0
- package/lib/dist/core/common.js +36 -0
- package/lib/dist/core/copy.d.ts +58 -0
- package/lib/dist/core/copy.js +49 -0
- package/lib/dist/core/cut.d.ts +46 -0
- package/lib/dist/core/cut.js +53 -0
- package/lib/dist/core/cylinder.d.ts +11 -0
- package/lib/dist/core/cylinder.js +10 -0
- package/lib/dist/core/extrude.d.ts +36 -0
- package/lib/dist/core/extrude.js +55 -0
- package/lib/dist/core/fillet.d.ts +33 -0
- package/lib/dist/core/fillet.js +58 -0
- package/lib/dist/core/fuse.d.ts +14 -0
- package/lib/dist/core/fuse.js +36 -0
- package/lib/dist/core/index.d.ts +32 -0
- package/lib/dist/core/index.js +30 -0
- package/lib/dist/core/interfaces.d.ts +411 -0
- package/lib/dist/core/interfaces.js +1 -0
- package/lib/dist/core/load.d.ts +10 -0
- package/lib/dist/core/load.js +10 -0
- package/lib/dist/core/loft.d.ts +10 -0
- package/lib/dist/core/loft.js +21 -0
- package/lib/dist/core/mirror.d.ts +40 -0
- package/lib/dist/core/mirror.js +95 -0
- package/lib/dist/core/part.d.ts +7 -0
- package/lib/dist/core/part.js +29 -0
- package/lib/dist/core/plane.d.ts +56 -0
- package/lib/dist/core/plane.js +111 -0
- package/lib/dist/core/region.d.ts +13 -0
- package/lib/dist/core/region.js +18 -0
- package/lib/dist/core/remove.d.ts +10 -0
- package/lib/dist/core/remove.js +10 -0
- package/lib/dist/core/repeat.d.ts +41 -0
- package/lib/dist/core/repeat.js +146 -0
- package/lib/dist/core/revolve.d.ts +19 -0
- package/lib/dist/core/revolve.js +39 -0
- package/lib/dist/core/rotate.d.ts +34 -0
- package/lib/dist/core/rotate.js +48 -0
- package/lib/dist/core/select.d.ts +12 -0
- package/lib/dist/core/select.js +21 -0
- package/lib/dist/core/shell.d.ts +16 -0
- package/lib/dist/core/shell.js +28 -0
- package/lib/dist/core/sketch.d.ts +18 -0
- package/lib/dist/core/sketch.js +34 -0
- package/lib/dist/core/sphere.d.ts +16 -0
- package/lib/dist/core/sphere.js +11 -0
- package/lib/dist/core/split.d.ts +12 -0
- package/lib/dist/core/split.js +26 -0
- package/lib/dist/core/subtract.d.ts +11 -0
- package/lib/dist/core/subtract.js +10 -0
- package/lib/dist/core/sweep.d.ts +16 -0
- package/lib/dist/core/sweep.js +29 -0
- package/lib/dist/core/translate.d.ts +64 -0
- package/lib/dist/core/translate.js +39 -0
- package/lib/dist/core/trim.d.ts +13 -0
- package/lib/dist/core/trim.js +18 -0
- package/lib/dist/core/use.d.ts +5 -0
- package/lib/dist/core/use.js +22 -0
- package/lib/dist/features/2d/aline.d.ts +18 -0
- package/lib/dist/features/2d/aline.js +78 -0
- package/lib/dist/features/2d/amove.d.ts +14 -0
- package/lib/dist/features/2d/amove.js +33 -0
- package/lib/dist/features/2d/arc-from-center.d.ts +16 -0
- package/lib/dist/features/2d/arc-from-center.js +69 -0
- package/lib/dist/features/2d/arc-to-point.d.ts +17 -0
- package/lib/dist/features/2d/arc-to-point.js +95 -0
- package/lib/dist/features/2d/arc.d.ts +19 -0
- package/lib/dist/features/2d/arc.js +94 -0
- package/lib/dist/features/2d/bezier.d.ts +15 -0
- package/lib/dist/features/2d/bezier.js +77 -0
- package/lib/dist/features/2d/circle.d.ts +17 -0
- package/lib/dist/features/2d/circle.js +58 -0
- package/lib/dist/features/2d/connect.d.ts +12 -0
- package/lib/dist/features/2d/connect.js +105 -0
- package/lib/dist/features/2d/constraints/constraint.d.ts +11 -0
- package/lib/dist/features/2d/constraints/constraint.js +49 -0
- package/lib/dist/features/2d/constraints/geometry-qualifier.d.ts +6 -0
- package/lib/dist/features/2d/constraints/geometry-qualifier.js +13 -0
- package/lib/dist/features/2d/constraints/outside.d.ts +3 -0
- package/lib/dist/features/2d/constraints/outside.js +4 -0
- package/lib/dist/features/2d/constraints/qualified-geometry.d.ts +16 -0
- package/lib/dist/features/2d/constraints/qualified-geometry.js +36 -0
- package/lib/dist/features/2d/extrudable-base.d.ts +15 -0
- package/lib/dist/features/2d/extrudable-base.js +27 -0
- package/lib/dist/features/2d/geometry.d.ts +20 -0
- package/lib/dist/features/2d/geometry.js +77 -0
- package/lib/dist/features/2d/hline.d.ts +16 -0
- package/lib/dist/features/2d/hline.js +66 -0
- package/lib/dist/features/2d/hmove.d.ts +14 -0
- package/lib/dist/features/2d/hmove.js +37 -0
- package/lib/dist/features/2d/line.d.ts +15 -0
- package/lib/dist/features/2d/line.js +59 -0
- package/lib/dist/features/2d/move.d.ts +15 -0
- package/lib/dist/features/2d/move.js +36 -0
- package/lib/dist/features/2d/offset.d.ts +18 -0
- package/lib/dist/features/2d/offset.js +117 -0
- package/lib/dist/features/2d/pmove.d.ts +16 -0
- package/lib/dist/features/2d/pmove.js +40 -0
- package/lib/dist/features/2d/polygon.d.ts +25 -0
- package/lib/dist/features/2d/polygon.js +107 -0
- package/lib/dist/features/2d/projection.d.ts +15 -0
- package/lib/dist/features/2d/projection.js +94 -0
- package/lib/dist/features/2d/rect.d.ts +45 -0
- package/lib/dist/features/2d/rect.js +262 -0
- package/lib/dist/features/2d/rmove.d.ts +17 -0
- package/lib/dist/features/2d/rmove.js +39 -0
- package/lib/dist/features/2d/sketch.d.ts +34 -0
- package/lib/dist/features/2d/sketch.js +171 -0
- package/lib/dist/features/2d/slot-from-edge.d.ts +19 -0
- package/lib/dist/features/2d/slot-from-edge.js +66 -0
- package/lib/dist/features/2d/slot.d.ts +24 -0
- package/lib/dist/features/2d/slot.js +119 -0
- package/lib/dist/features/2d/tarc-constrained.d.ts +20 -0
- package/lib/dist/features/2d/tarc-constrained.js +64 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +15 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.js +86 -0
- package/lib/dist/features/2d/tarc-to-point.d.ts +13 -0
- package/lib/dist/features/2d/tarc-to-point.js +86 -0
- package/lib/dist/features/2d/tarc-two-circles.d.ts +18 -0
- package/lib/dist/features/2d/tarc-two-circles.js +61 -0
- package/lib/dist/features/2d/tarc-with-tangent.d.ts +17 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +71 -0
- package/lib/dist/features/2d/tarc.d.ts +13 -0
- package/lib/dist/features/2d/tarc.js +71 -0
- package/lib/dist/features/2d/tcircle-constrained.d.ts +14 -0
- package/lib/dist/features/2d/tcircle-constrained.js +37 -0
- package/lib/dist/features/2d/tcircle-three-tan.d.ts +13 -0
- package/lib/dist/features/2d/tcircle-three-tan.js +33 -0
- package/lib/dist/features/2d/tcircle-two-tan.d.ts +13 -0
- package/lib/dist/features/2d/tcircle-two-tan.js +33 -0
- package/lib/dist/features/2d/tline-constrained.d.ts +27 -0
- package/lib/dist/features/2d/tline-constrained.js +82 -0
- package/lib/dist/features/2d/tline.d.ts +12 -0
- package/lib/dist/features/2d/tline.js +49 -0
- package/lib/dist/features/2d/vline.d.ts +16 -0
- package/lib/dist/features/2d/vline.js +65 -0
- package/lib/dist/features/2d/vmove.d.ts +14 -0
- package/lib/dist/features/2d/vmove.js +37 -0
- package/lib/dist/features/2d/wire.d.ts +12 -0
- package/lib/dist/features/2d/wire.js +76 -0
- package/lib/dist/features/Extrude.d.ts +1 -0
- package/lib/dist/features/Extrude.js +1 -0
- package/lib/dist/features/axis-from-edge.d.ts +15 -0
- package/lib/dist/features/axis-from-edge.js +82 -0
- package/lib/dist/features/axis-mid.d.ts +16 -0
- package/lib/dist/features/axis-mid.js +59 -0
- package/lib/dist/features/axis-renderable-base.d.ts +8 -0
- package/lib/dist/features/axis-renderable-base.js +12 -0
- package/lib/dist/features/axis.d.ts +14 -0
- package/lib/dist/features/axis.js +43 -0
- package/lib/dist/features/chamfer.d.ts +20 -0
- package/lib/dist/features/chamfer.js +129 -0
- package/lib/dist/features/color.d.ts +11 -0
- package/lib/dist/features/color.js +93 -0
- package/lib/dist/features/common.d.ts +12 -0
- package/lib/dist/features/common.js +70 -0
- package/lib/dist/features/common2d.d.ts +15 -0
- package/lib/dist/features/common2d.js +96 -0
- package/lib/dist/features/copy-circular.d.ts +23 -0
- package/lib/dist/features/copy-circular.js +73 -0
- package/lib/dist/features/copy-circular2d.d.ts +15 -0
- package/lib/dist/features/copy-circular2d.js +84 -0
- package/lib/dist/features/copy-linear.d.ts +23 -0
- package/lib/dist/features/copy-linear.js +101 -0
- package/lib/dist/features/copy-linear2d.d.ts +15 -0
- package/lib/dist/features/copy-linear2d.js +108 -0
- package/lib/dist/features/cut-base.d.ts +49 -0
- package/lib/dist/features/cut-base.js +312 -0
- package/lib/dist/features/cut-symmetric.d.ts +23 -0
- package/lib/dist/features/cut-symmetric.js +119 -0
- package/lib/dist/features/cut-two-distances.d.ts +24 -0
- package/lib/dist/features/cut-two-distances.js +110 -0
- package/lib/dist/features/cut.d.ts +27 -0
- package/lib/dist/features/cut.js +101 -0
- package/lib/dist/features/cylinder.d.ts +13 -0
- package/lib/dist/features/cylinder.js +33 -0
- package/lib/dist/features/extrude-base.d.ts +56 -0
- package/lib/dist/features/extrude-base.js +331 -0
- package/lib/dist/features/extrude-options.d.ts +8 -0
- package/lib/dist/features/extrude-options.js +1 -0
- package/lib/dist/features/extrude-symmetric.d.ts +28 -0
- package/lib/dist/features/extrude-symmetric.js +177 -0
- package/lib/dist/features/extrude-to-face.d.ts +35 -0
- package/lib/dist/features/extrude-to-face.js +275 -0
- package/lib/dist/features/extrude-two-distances.d.ts +21 -0
- package/lib/dist/features/extrude-two-distances.js +116 -0
- package/lib/dist/features/extrude.d.ts +25 -0
- package/lib/dist/features/extrude.js +182 -0
- package/lib/dist/features/fillet.d.ts +24 -0
- package/lib/dist/features/fillet.js +125 -0
- package/lib/dist/features/fillet2d.d.ts +16 -0
- package/lib/dist/features/fillet2d.js +98 -0
- package/lib/dist/features/fuse.d.ts +10 -0
- package/lib/dist/features/fuse.js +63 -0
- package/lib/dist/features/fuse2d.d.ts +13 -0
- package/lib/dist/features/fuse2d.js +86 -0
- package/lib/dist/features/infinite-extrude.d.ts +10 -0
- package/lib/dist/features/infinite-extrude.js +44 -0
- package/lib/dist/features/lazy-scene-object.d.ts +16 -0
- package/lib/dist/features/lazy-scene-object.js +52 -0
- package/lib/dist/features/lazy-vertex.d.ts +19 -0
- package/lib/dist/features/lazy-vertex.js +62 -0
- package/lib/dist/features/load.d.ts +9 -0
- package/lib/dist/features/load.js +31 -0
- package/lib/dist/features/loft.d.ts +27 -0
- package/lib/dist/features/loft.js +273 -0
- package/lib/dist/features/mirror-feature.d.ts +15 -0
- package/lib/dist/features/mirror-feature.js +39 -0
- package/lib/dist/features/mirror-shape.d.ts +14 -0
- package/lib/dist/features/mirror-shape.js +86 -0
- package/lib/dist/features/mirror-shape2d.d.ts +18 -0
- package/lib/dist/features/mirror-shape2d.js +110 -0
- package/lib/dist/features/part.d.ts +12 -0
- package/lib/dist/features/part.js +36 -0
- package/lib/dist/features/plane-from-object.d.ts +29 -0
- package/lib/dist/features/plane-from-object.js +103 -0
- package/lib/dist/features/plane-mid.d.ts +18 -0
- package/lib/dist/features/plane-mid.js +54 -0
- package/lib/dist/features/plane-renderable-base.d.ts +9 -0
- package/lib/dist/features/plane-renderable-base.js +15 -0
- package/lib/dist/features/plane.d.ts +21 -0
- package/lib/dist/features/plane.js +64 -0
- package/lib/dist/features/region2d.d.ts +25 -0
- package/lib/dist/features/region2d.js +185 -0
- package/lib/dist/features/remove.d.ts +9 -0
- package/lib/dist/features/remove.js +33 -0
- package/lib/dist/features/repeat-circular.d.ts +23 -0
- package/lib/dist/features/repeat-circular.js +47 -0
- package/lib/dist/features/repeat-circular2d.d.ts +17 -0
- package/lib/dist/features/repeat-circular2d.js +90 -0
- package/lib/dist/features/repeat-linear.d.ts +23 -0
- package/lib/dist/features/repeat-linear.js +52 -0
- package/lib/dist/features/repeat-linear2d.d.ts +17 -0
- package/lib/dist/features/repeat-linear2d.js +114 -0
- package/lib/dist/features/revolve-options.d.ts +6 -0
- package/lib/dist/features/revolve-options.js +1 -0
- package/lib/dist/features/revolve.d.ts +23 -0
- package/lib/dist/features/revolve.js +150 -0
- package/lib/dist/features/rotate.d.ts +16 -0
- package/lib/dist/features/rotate.js +89 -0
- package/lib/dist/features/rotate2d.d.ts +15 -0
- package/lib/dist/features/rotate2d.js +83 -0
- package/lib/dist/features/select.d.ts +26 -0
- package/lib/dist/features/select.js +113 -0
- package/lib/dist/features/shell.d.ts +24 -0
- package/lib/dist/features/shell.js +214 -0
- package/lib/dist/features/simple-extruder.d.ts +22 -0
- package/lib/dist/features/simple-extruder.js +108 -0
- package/lib/dist/features/sphere.d.ts +13 -0
- package/lib/dist/features/sphere.js +33 -0
- package/lib/dist/features/split.d.ts +14 -0
- package/lib/dist/features/split.js +74 -0
- package/lib/dist/features/split2d.d.ts +13 -0
- package/lib/dist/features/split2d.js +69 -0
- package/lib/dist/features/state-scene-object.d.ts +15 -0
- package/lib/dist/features/state-scene-object.js +44 -0
- package/lib/dist/features/state-select.d.ts +21 -0
- package/lib/dist/features/state-select.js +73 -0
- package/lib/dist/features/static-scene-object.d.ts +10 -0
- package/lib/dist/features/static-scene-object.js +21 -0
- package/lib/dist/features/subtract.d.ts +13 -0
- package/lib/dist/features/subtract.js +56 -0
- package/lib/dist/features/sweep.d.ts +22 -0
- package/lib/dist/features/sweep.js +129 -0
- package/lib/dist/features/translate.d.ts +17 -0
- package/lib/dist/features/translate.js +76 -0
- package/lib/dist/features/translate2d.d.ts +16 -0
- package/lib/dist/features/translate2d.js +61 -0
- package/lib/dist/features/trim2d.d.ts +15 -0
- package/lib/dist/features/trim2d.js +154 -0
- package/lib/dist/filters/all-filter.d.ts +8 -0
- package/lib/dist/filters/all-filter.js +12 -0
- package/lib/dist/filters/edge/at-index.d.ts +21 -0
- package/lib/dist/filters/edge/at-index.js +82 -0
- package/lib/dist/filters/edge/circle-filter.d.ts +17 -0
- package/lib/dist/filters/edge/circle-filter.js +34 -0
- package/lib/dist/filters/edge/curve-filter.d.ts +17 -0
- package/lib/dist/filters/edge/curve-filter.js +34 -0
- package/lib/dist/filters/edge/edge-filter.d.ts +22 -0
- package/lib/dist/filters/edge/edge-filter.js +169 -0
- package/lib/dist/filters/edge/line-filter.d.ts +14 -0
- package/lib/dist/filters/edge/line-filter.js +27 -0
- package/lib/dist/filters/edge/on-plane.d.ts +20 -0
- package/lib/dist/filters/edge/on-plane.js +70 -0
- package/lib/dist/filters/edge/parallel.d.ts +18 -0
- package/lib/dist/filters/edge/parallel.js +41 -0
- package/lib/dist/filters/edge/vertical-plane.d.ts +18 -0
- package/lib/dist/filters/edge/vertical-plane.js +41 -0
- package/lib/dist/filters/face/at-index.d.ts +21 -0
- package/lib/dist/filters/face/at-index.js +89 -0
- package/lib/dist/filters/face/circle-filter.d.ts +17 -0
- package/lib/dist/filters/face/circle-filter.js +34 -0
- package/lib/dist/filters/face/cone-filter.d.ts +15 -0
- package/lib/dist/filters/face/cone-filter.js +30 -0
- package/lib/dist/filters/face/cylinder-curve.d.ts +17 -0
- package/lib/dist/filters/face/cylinder-curve.js +34 -0
- package/lib/dist/filters/face/cylinder.d.ts +17 -0
- package/lib/dist/filters/face/cylinder.js +34 -0
- package/lib/dist/filters/face/face-filter.d.ts +21 -0
- package/lib/dist/filters/face/face-filter.js +134 -0
- package/lib/dist/filters/face/on-plane.d.ts +18 -0
- package/lib/dist/filters/face/on-plane.js +41 -0
- package/lib/dist/filters/face/parallel.d.ts +18 -0
- package/lib/dist/filters/face/parallel.js +41 -0
- package/lib/dist/filters/filter-base.d.ts +8 -0
- package/lib/dist/filters/filter-base.js +2 -0
- package/lib/dist/filters/filter-builder-base.d.ts +10 -0
- package/lib/dist/filters/filter-builder-base.js +31 -0
- package/lib/dist/filters/filter.d.ts +8 -0
- package/lib/dist/filters/filter.js +33 -0
- package/lib/dist/filters/index.d.ts +4 -0
- package/lib/dist/filters/index.js +8 -0
- package/lib/dist/filters/near-point-filter.d.ts +11 -0
- package/lib/dist/filters/near-point-filter.js +33 -0
- package/lib/dist/helpers/clone-transform.d.ts +3 -0
- package/lib/dist/helpers/clone-transform.js +46 -0
- package/lib/dist/helpers/cut-helpers.d.ts +13 -0
- package/lib/dist/helpers/cut-helpers.js +79 -0
- package/lib/dist/helpers/math-helpers.d.ts +2 -0
- package/lib/dist/helpers/math-helpers.js +6 -0
- package/lib/dist/helpers/normalize.d.ts +12 -0
- package/lib/dist/helpers/normalize.js +118 -0
- package/lib/dist/helpers/resolve-filters.d.ts +6 -0
- package/lib/dist/helpers/resolve-filters.js +25 -0
- package/lib/dist/helpers/resolve.d.ts +8 -0
- package/lib/dist/helpers/resolve.js +45 -0
- package/lib/dist/helpers/scene-helpers.d.ts +17 -0
- package/lib/dist/helpers/scene-helpers.js +67 -0
- package/lib/dist/helpers/types.d.ts +27 -0
- package/lib/dist/helpers/types.js +1 -0
- package/lib/dist/index.d.ts +37 -0
- package/lib/dist/index.js +75 -0
- package/lib/dist/io/file-export.d.ts +30 -0
- package/lib/dist/io/file-export.js +45 -0
- package/lib/dist/io/file-import.d.ts +8 -0
- package/lib/dist/io/file-import.js +81 -0
- package/lib/dist/load.d.ts +1 -0
- package/lib/dist/load.js +1 -0
- package/lib/dist/math/axis.d.ts +72 -0
- package/lib/dist/math/axis.js +157 -0
- package/lib/dist/math/axis.test.d.ts +1 -0
- package/lib/dist/math/axis.test.js +287 -0
- package/lib/dist/math/convert.d.ts +2 -0
- package/lib/dist/math/convert.js +1 -0
- package/lib/dist/math/coordinate-system.d.ts +43 -0
- package/lib/dist/math/coordinate-system.js +140 -0
- package/lib/dist/math/coordinate-system.test.d.ts +1 -0
- package/lib/dist/math/coordinate-system.test.js +308 -0
- package/lib/dist/math/index.d.ts +8 -0
- package/lib/dist/math/index.js +8 -0
- package/lib/dist/math/matrix4.d.ts +53 -0
- package/lib/dist/math/matrix4.js +336 -0
- package/lib/dist/math/matrix4.test.d.ts +1 -0
- package/lib/dist/math/matrix4.test.js +357 -0
- package/lib/dist/math/plane.d.ts +60 -0
- package/lib/dist/math/plane.js +243 -0
- package/lib/dist/math/plane.test.d.ts +1 -0
- package/lib/dist/math/plane.test.js +398 -0
- package/lib/dist/math/point.d.ts +73 -0
- package/lib/dist/math/point.js +227 -0
- package/lib/dist/math/point.test.d.ts +1 -0
- package/lib/dist/math/point.test.js +385 -0
- package/lib/dist/math/quaternion.d.ts +37 -0
- package/lib/dist/math/quaternion.js +234 -0
- package/lib/dist/math/quaternion.test.d.ts +1 -0
- package/lib/dist/math/quaternion.test.js +278 -0
- package/lib/dist/math/vector3d.d.ts +43 -0
- package/lib/dist/math/vector3d.js +143 -0
- package/lib/dist/math/vector3d.test.d.ts +1 -0
- package/lib/dist/math/vector3d.test.js +276 -0
- package/lib/dist/oc/boolean-ops.d.ts +36 -0
- package/lib/dist/oc/boolean-ops.js +337 -0
- package/lib/dist/oc/constraint-resolver.d.ts +7 -0
- package/lib/dist/oc/constraint-resolver.js +31 -0
- package/lib/dist/oc/constraints/constraint-helpers.d.ts +33 -0
- package/lib/dist/oc/constraints/constraint-helpers.js +252 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +22 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.js +62 -0
- package/lib/dist/oc/constraints/constraint-solver.d.ts +18 -0
- package/lib/dist/oc/constraints/constraint-solver.js +2 -0
- package/lib/dist/oc/constraints/create-solver.d.ts +2 -0
- package/lib/dist/oc/constraints/create-solver.js +6 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +13 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +18 -0
- package/lib/dist/oc/constraints/curve/tangent-circle-solver.d.ts +16 -0
- package/lib/dist/oc/constraints/curve/tangent-circle-solver.js +112 -0
- package/lib/dist/oc/constraints/curve/tangent-line-solver.d.ts +19 -0
- package/lib/dist/oc/constraints/curve/tangent-line-solver.js +83 -0
- package/lib/dist/oc/constraints/curve-constraint-solver.d.ts +1 -0
- package/lib/dist/oc/constraints/curve-constraint-solver.js +2 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +12 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +17 -0
- package/lib/dist/oc/constraints/geometric/tangent-circle-solver.d.ts +21 -0
- package/lib/dist/oc/constraints/geometric/tangent-circle-solver.js +220 -0
- package/lib/dist/oc/constraints/geometric/tangent-line-solver.d.ts +19 -0
- package/lib/dist/oc/constraints/geometric/tangent-line-solver.js +92 -0
- package/lib/dist/oc/constraints/geometric-constraint-solver.d.ts +1 -0
- package/lib/dist/oc/constraints/geometric-constraint-solver.js +5 -0
- package/lib/dist/oc/convert.d.ts +42 -0
- package/lib/dist/oc/convert.js +231 -0
- package/lib/dist/oc/edge-ops.d.ts +37 -0
- package/lib/dist/oc/edge-ops.js +306 -0
- package/lib/dist/oc/edge-props.d.ts +11 -0
- package/lib/dist/oc/edge-props.js +45 -0
- package/lib/dist/oc/edge-query.d.ts +44 -0
- package/lib/dist/oc/edge-query.js +235 -0
- package/lib/dist/oc/explorer.d.ts +34 -0
- package/lib/dist/oc/explorer.js +179 -0
- package/lib/dist/oc/extrude-ops.d.ts +22 -0
- package/lib/dist/oc/extrude-ops.js +149 -0
- package/lib/dist/oc/face-maker.d.ts +14 -0
- package/lib/dist/oc/face-maker.js +191 -0
- package/lib/dist/oc/face-maker2.d.ts +10 -0
- package/lib/dist/oc/face-maker2.js +139 -0
- package/lib/dist/oc/face-ops.d.ts +28 -0
- package/lib/dist/oc/face-ops.js +252 -0
- package/lib/dist/oc/face-props.d.ts +12 -0
- package/lib/dist/oc/face-props.js +81 -0
- package/lib/dist/oc/face-query.d.ts +35 -0
- package/lib/dist/oc/face-query.js +341 -0
- package/lib/dist/oc/fillet-ops.d.ts +13 -0
- package/lib/dist/oc/fillet-ops.js +153 -0
- package/lib/dist/oc/geometry.d.ts +22 -0
- package/lib/dist/oc/geometry.js +231 -0
- package/lib/dist/oc/hit-test.d.ts +11 -0
- package/lib/dist/oc/hit-test.js +85 -0
- package/lib/dist/oc/index.d.ts +24 -0
- package/lib/dist/oc/index.js +21 -0
- package/lib/dist/oc/init.d.ts +3 -0
- package/lib/dist/oc/init.js +17 -0
- package/lib/dist/oc/intersection.d.ts +10 -0
- package/lib/dist/oc/intersection.js +107 -0
- package/lib/dist/oc/io.d.ts +49 -0
- package/lib/dist/oc/io.js +417 -0
- package/lib/dist/oc/loft-ops.d.ts +5 -0
- package/lib/dist/oc/loft-ops.js +26 -0
- package/lib/dist/oc/measure.d.ts +21 -0
- package/lib/dist/oc/measure.js +256 -0
- package/lib/dist/oc/mesh.d.ts +15 -0
- package/lib/dist/oc/mesh.js +110 -0
- package/lib/dist/oc/primitives.d.ts +5 -0
- package/lib/dist/oc/primitives.js +19 -0
- package/lib/dist/oc/props.d.ts +13 -0
- package/lib/dist/oc/props.js +18 -0
- package/lib/dist/oc/shape-ops.d.ts +34 -0
- package/lib/dist/oc/shape-ops.js +208 -0
- package/lib/dist/oc/shell-ops.d.ts +5 -0
- package/lib/dist/oc/shell-ops.js +25 -0
- package/lib/dist/oc/sweep-ops.d.ts +12 -0
- package/lib/dist/oc/sweep-ops.js +39 -0
- package/lib/dist/oc/tangent-circle-solver.d.ts +17 -0
- package/lib/dist/oc/tangent-circle-solver.js +72 -0
- package/lib/dist/oc/tangent-line-solver.d.ts +17 -0
- package/lib/dist/oc/tangent-line-solver.js +83 -0
- package/lib/dist/oc/tangent-solver.d.ts +14 -0
- package/lib/dist/oc/tangent-solver.js +199 -0
- package/lib/dist/oc/vertex-ops.d.ts +11 -0
- package/lib/dist/oc/vertex-ops.js +39 -0
- package/lib/dist/oc/wire-ops.d.ts +21 -0
- package/lib/dist/oc/wire-ops.js +176 -0
- package/lib/dist/rendering/builder-context.d.ts +16 -0
- package/lib/dist/rendering/builder-context.js +63 -0
- package/lib/dist/rendering/mesh-builder.d.ts +5 -0
- package/lib/dist/rendering/mesh-builder.js +43 -0
- package/lib/dist/rendering/render-edge.d.ts +3 -0
- package/lib/dist/rendering/render-edge.js +4 -0
- package/lib/dist/rendering/render-face.d.ts +2 -0
- package/lib/dist/rendering/render-face.js +5 -0
- package/lib/dist/rendering/render-solid.d.ts +3 -0
- package/lib/dist/rendering/render-solid.js +61 -0
- package/lib/dist/rendering/render-wire.d.ts +6 -0
- package/lib/dist/rendering/render-wire.js +27 -0
- package/lib/dist/rendering/render.d.ts +3 -0
- package/lib/dist/rendering/render.js +183 -0
- package/lib/dist/rendering/scene-compare.d.ts +4 -0
- package/lib/dist/rendering/scene-compare.js +41 -0
- package/lib/dist/rendering/scene.d.ts +81 -0
- package/lib/dist/rendering/scene.js +206 -0
- package/lib/dist/scene-manager.d.ts +32 -0
- package/lib/dist/scene-manager.js +120 -0
- package/lib/dist/tests/extrude.test.d.ts +1 -0
- package/lib/dist/tests/extrude.test.js +48 -0
- package/lib/dist/tests/features/2d/arc.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/arc.test.js +40 -0
- package/lib/dist/tests/features/2d/circle.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/circle.test.js +64 -0
- package/lib/dist/tests/features/2d/constrained.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/constrained.test.js +202 -0
- package/lib/dist/tests/features/2d/line.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/line.test.js +86 -0
- package/lib/dist/tests/features/2d/move.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/move.test.js +74 -0
- package/lib/dist/tests/features/2d/offset.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/offset.test.js +111 -0
- package/lib/dist/tests/features/2d/pmove.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/pmove.test.js +43 -0
- package/lib/dist/tests/features/2d/polygon.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/polygon.test.js +150 -0
- package/lib/dist/tests/features/2d/project.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/project.test.js +22 -0
- package/lib/dist/tests/features/2d/rect.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/rect.test.js +66 -0
- package/lib/dist/tests/features/2d/rmove.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/rmove.test.js +29 -0
- package/lib/dist/tests/features/2d/slot-from-edge.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/slot-from-edge.test.js +35 -0
- package/lib/dist/tests/features/2d/slot.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/slot.test.js +44 -0
- package/lib/dist/tests/features/2d/tarc.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tarc.test.js +237 -0
- package/lib/dist/tests/features/2d/tcircle.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tcircle.test.js +28 -0
- package/lib/dist/tests/features/2d/tline.test.d.ts +1 -0
- package/lib/dist/tests/features/2d/tline.test.js +34 -0
- package/lib/dist/tests/features/axis.test.d.ts +1 -0
- package/lib/dist/tests/features/axis.test.js +143 -0
- package/lib/dist/tests/features/chamfer.test.d.ts +1 -0
- package/lib/dist/tests/features/chamfer.test.js +159 -0
- package/lib/dist/tests/features/color.test.d.ts +1 -0
- package/lib/dist/tests/features/color.test.js +96 -0
- package/lib/dist/tests/features/common2d.test.d.ts +1 -0
- package/lib/dist/tests/features/common2d.test.js +113 -0
- package/lib/dist/tests/features/copy-circular-2d.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-circular-2d.test.js +40 -0
- package/lib/dist/tests/features/copy-circular.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-circular.test.js +44 -0
- package/lib/dist/tests/features/copy-linear-2d.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-linear-2d.test.js +35 -0
- package/lib/dist/tests/features/copy-linear.test.d.ts +1 -0
- package/lib/dist/tests/features/copy-linear.test.js +95 -0
- package/lib/dist/tests/features/copy.test.d.ts +1 -0
- package/lib/dist/tests/features/copy.test.js +158 -0
- package/lib/dist/tests/features/cut-symmetric.test.d.ts +1 -0
- package/lib/dist/tests/features/cut-symmetric.test.js +120 -0
- package/lib/dist/tests/features/cut-two-distances.test.d.ts +1 -0
- package/lib/dist/tests/features/cut-two-distances.test.js +125 -0
- package/lib/dist/tests/features/cut.test.d.ts +1 -0
- package/lib/dist/tests/features/cut.test.js +311 -0
- package/lib/dist/tests/features/dispose.test.d.ts +1 -0
- package/lib/dist/tests/features/dispose.test.js +189 -0
- package/lib/dist/tests/features/extrude-symmetric.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-symmetric.test.js +240 -0
- package/lib/dist/tests/features/extrude-to-face.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-to-face.test.js +256 -0
- package/lib/dist/tests/features/extrude-two-distances.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude-two-distances.test.js +264 -0
- package/lib/dist/tests/features/extrude.test.d.ts +1 -0
- package/lib/dist/tests/features/extrude.test.js +640 -0
- package/lib/dist/tests/features/fillet.test.d.ts +1 -0
- package/lib/dist/tests/features/fillet.test.js +163 -0
- package/lib/dist/tests/features/fillet2d.test.d.ts +1 -0
- package/lib/dist/tests/features/fillet2d.test.js +69 -0
- package/lib/dist/tests/features/fuse.test.d.ts +1 -0
- package/lib/dist/tests/features/fuse.test.js +122 -0
- package/lib/dist/tests/features/fuse2d.test.d.ts +1 -0
- package/lib/dist/tests/features/fuse2d.test.js +80 -0
- package/lib/dist/tests/features/loft.test.d.ts +1 -0
- package/lib/dist/tests/features/loft.test.js +283 -0
- package/lib/dist/tests/features/mirror.test.d.ts +1 -0
- package/lib/dist/tests/features/mirror.test.js +112 -0
- package/lib/dist/tests/features/mirror2d.test.d.ts +1 -0
- package/lib/dist/tests/features/mirror2d.test.js +75 -0
- package/lib/dist/tests/features/part-pick.test.d.ts +1 -0
- package/lib/dist/tests/features/part-pick.test.js +73 -0
- package/lib/dist/tests/features/part-repeat.test.d.ts +1 -0
- package/lib/dist/tests/features/part-repeat.test.js +109 -0
- package/lib/dist/tests/features/part.test.d.ts +1 -0
- package/lib/dist/tests/features/part.test.js +356 -0
- package/lib/dist/tests/features/plane.test.d.ts +1 -0
- package/lib/dist/tests/features/plane.test.js +154 -0
- package/lib/dist/tests/features/repeat-circular.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-circular.test.js +114 -0
- package/lib/dist/tests/features/repeat-linear.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-linear.test.js +138 -0
- package/lib/dist/tests/features/revolve.test.d.ts +1 -0
- package/lib/dist/tests/features/revolve.test.js +205 -0
- package/lib/dist/tests/features/rotate.test.d.ts +1 -0
- package/lib/dist/tests/features/rotate.test.js +133 -0
- package/lib/dist/tests/features/rotate2d.test.d.ts +1 -0
- package/lib/dist/tests/features/rotate2d.test.js +74 -0
- package/lib/dist/tests/features/select.test.d.ts +1 -0
- package/lib/dist/tests/features/select.test.js +337 -0
- package/lib/dist/tests/features/shell.test.d.ts +1 -0
- package/lib/dist/tests/features/shell.test.js +230 -0
- package/lib/dist/tests/features/subtract.test.d.ts +1 -0
- package/lib/dist/tests/features/subtract.test.js +103 -0
- package/lib/dist/tests/features/sweep.test.d.ts +1 -0
- package/lib/dist/tests/features/sweep.test.js +312 -0
- package/lib/dist/tests/features/translate.test.d.ts +1 -0
- package/lib/dist/tests/features/translate.test.js +117 -0
- package/lib/dist/tests/global-setup.d.ts +1 -0
- package/lib/dist/tests/global-setup.js +5 -0
- package/lib/dist/tests/math/axis.test.d.ts +1 -0
- package/lib/dist/tests/math/axis.test.js +287 -0
- package/lib/dist/tests/math/coordinate-system.test.d.ts +1 -0
- package/lib/dist/tests/math/coordinate-system.test.js +308 -0
- package/lib/dist/tests/math/matrix4.test.d.ts +1 -0
- package/lib/dist/tests/math/matrix4.test.js +357 -0
- package/lib/dist/tests/math/plane.test.d.ts +1 -0
- package/lib/dist/tests/math/plane.test.js +398 -0
- package/lib/dist/tests/math/point.test.d.ts +1 -0
- package/lib/dist/tests/math/point.test.js +385 -0
- package/lib/dist/tests/math/quaternion.test.d.ts +1 -0
- package/lib/dist/tests/math/quaternion.test.js +278 -0
- package/lib/dist/tests/math/vector3d.test.d.ts +1 -0
- package/lib/dist/tests/math/vector3d.test.js +276 -0
- package/lib/dist/tests/setup.d.ts +5 -0
- package/lib/dist/tests/setup.js +14 -0
- package/lib/dist/tests/utils.d.ts +12 -0
- package/lib/dist/tests/utils.js +36 -0
- package/lib/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +83 -0
- package/server/dist/fluidcad-server.d.ts +32 -0
- package/server/dist/fluidcad-server.js +150 -0
- package/server/dist/index.d.ts +1 -0
- package/server/dist/index.js +290 -0
- package/server/dist/routes/actions.d.ts +3 -0
- package/server/dist/routes/actions.js +100 -0
- package/server/dist/routes/export.d.ts +3 -0
- package/server/dist/routes/export.js +55 -0
- package/server/dist/routes/properties.d.ts +3 -0
- package/server/dist/routes/properties.js +46 -0
- package/server/dist/routes/screenshot.d.ts +2 -0
- package/server/dist/routes/screenshot.js +76 -0
- package/server/dist/vite-manager.d.ts +10 -0
- package/server/dist/vite-manager.js +64 -0
- package/server/dist/ws-protocol.d.ts +138 -0
- package/server/dist/ws-protocol.js +4 -0
- package/ui/dist/assets/index-DXW2yo2v.css +2 -0
- package/ui/dist/assets/index-qqJ_mWi7.js +4732 -0
- package/ui/dist/icons/aline.png +0 -0
- package/ui/dist/icons/arc.png +0 -0
- package/ui/dist/icons/aslot.png +0 -0
- package/ui/dist/icons/axis.png +0 -0
- package/ui/dist/icons/box.png +0 -0
- package/ui/dist/icons/chamfer.png +0 -0
- package/ui/dist/icons/circle.png +0 -0
- package/ui/dist/icons/color.png +0 -0
- package/ui/dist/icons/common.png +0 -0
- package/ui/dist/icons/cone.png +0 -0
- package/ui/dist/icons/connect.png +0 -0
- package/ui/dist/icons/copy-circular.png +0 -0
- package/ui/dist/icons/copy-circular2d.png +0 -0
- package/ui/dist/icons/copy-linear.png +0 -0
- package/ui/dist/icons/copy-linear2d.png +0 -0
- package/ui/dist/icons/cut.png +0 -0
- package/ui/dist/icons/cylinder.png +0 -0
- package/ui/dist/icons/edge.png +0 -0
- package/ui/dist/icons/extrude.png +0 -0
- package/ui/dist/icons/fillet.png +0 -0
- package/ui/dist/icons/fillet2d.png +0 -0
- package/ui/dist/icons/fuse.png +0 -0
- package/ui/dist/icons/hline.png +0 -0
- package/ui/dist/icons/hole.png +0 -0
- package/ui/dist/icons/line.png +0 -0
- package/ui/dist/icons/load.png +0 -0
- package/ui/dist/icons/mirror.png +0 -0
- package/ui/dist/icons/mirror2d.png +0 -0
- package/ui/dist/icons/move.png +0 -0
- package/ui/dist/icons/plane.png +0 -0
- package/ui/dist/icons/polygon.png +0 -0
- package/ui/dist/icons/rect.png +0 -0
- package/ui/dist/icons/revolve.png +0 -0
- package/ui/dist/icons/rotate.png +0 -0
- package/ui/dist/icons/rotate2d.png +0 -0
- package/ui/dist/icons/select.png +0 -0
- package/ui/dist/icons/shell.png +0 -0
- package/ui/dist/icons/sketch.png +0 -0
- package/ui/dist/icons/slot.png +0 -0
- package/ui/dist/icons/solid.png +0 -0
- package/ui/dist/icons/sphere.png +0 -0
- package/ui/dist/icons/subtract.png +0 -0
- package/ui/dist/icons/tarc.png +0 -0
- package/ui/dist/icons/tline.png +0 -0
- package/ui/dist/icons/translate.png +0 -0
- package/ui/dist/icons/vline.png +0 -0
- package/ui/dist/icons/wire.png +0 -0
- package/ui/dist/index.html +13 -0
- package/ui/dist/logo.png +0 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { Vector3d, normalizeVector } from "./vector3d.js";
|
|
3
|
+
describe("Vector3d", () => {
|
|
4
|
+
describe("constructor", () => {
|
|
5
|
+
it("creates a vector with x, y, z components", () => {
|
|
6
|
+
const v = new Vector3d(1, 2, 3);
|
|
7
|
+
expect(v.x).toBe(1);
|
|
8
|
+
expect(v.y).toBe(2);
|
|
9
|
+
expect(v.z).toBe(3);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe("equals", () => {
|
|
13
|
+
it("returns true for identical vectors", () => {
|
|
14
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
15
|
+
const v2 = new Vector3d(1, 2, 3);
|
|
16
|
+
expect(v1.equals(v2)).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it("returns false for different vectors", () => {
|
|
19
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
20
|
+
const v2 = new Vector3d(1, 2, 4);
|
|
21
|
+
expect(v1.equals(v2)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
it("supports tolerance", () => {
|
|
24
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
25
|
+
const v2 = new Vector3d(1.001, 2.001, 3.001);
|
|
26
|
+
expect(v1.equals(v2, 0.01)).toBe(true);
|
|
27
|
+
expect(v1.equals(v2, 0.0001)).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe("dot", () => {
|
|
31
|
+
it("computes dot product correctly", () => {
|
|
32
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
33
|
+
const v2 = new Vector3d(4, 5, 6);
|
|
34
|
+
expect(v1.dot(v2)).toBe(32); // 1*4 + 2*5 + 3*6
|
|
35
|
+
});
|
|
36
|
+
it("returns 0 for perpendicular vectors", () => {
|
|
37
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
38
|
+
const v2 = new Vector3d(0, 1, 0);
|
|
39
|
+
expect(v1.dot(v2)).toBe(0);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe("cross", () => {
|
|
43
|
+
it("computes cross product correctly", () => {
|
|
44
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
45
|
+
const v2 = new Vector3d(0, 1, 0);
|
|
46
|
+
const result = v1.cross(v2);
|
|
47
|
+
expect(result.x).toBe(0);
|
|
48
|
+
expect(result.y).toBe(0);
|
|
49
|
+
expect(result.z).toBe(1);
|
|
50
|
+
});
|
|
51
|
+
it("returns zero vector for parallel vectors", () => {
|
|
52
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
53
|
+
const v2 = new Vector3d(2, 0, 0);
|
|
54
|
+
const result = v1.cross(v2);
|
|
55
|
+
expect(result.isZero()).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("length", () => {
|
|
59
|
+
it("computes length correctly", () => {
|
|
60
|
+
const v = new Vector3d(3, 4, 0);
|
|
61
|
+
expect(v.length()).toBe(5);
|
|
62
|
+
});
|
|
63
|
+
it("returns 0 for zero vector", () => {
|
|
64
|
+
const v = new Vector3d(0, 0, 0);
|
|
65
|
+
expect(v.length()).toBe(0);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe("normalize", () => {
|
|
69
|
+
it("returns unit vector", () => {
|
|
70
|
+
const v = new Vector3d(3, 4, 0);
|
|
71
|
+
const normalized = v.normalize();
|
|
72
|
+
expect(normalized.length()).toBeCloseTo(1);
|
|
73
|
+
expect(normalized.x).toBeCloseTo(0.6);
|
|
74
|
+
expect(normalized.y).toBeCloseTo(0.8);
|
|
75
|
+
expect(normalized.z).toBe(0);
|
|
76
|
+
});
|
|
77
|
+
it("throws for zero vector", () => {
|
|
78
|
+
const v = new Vector3d(0, 0, 0);
|
|
79
|
+
expect(() => v.normalize()).toThrow();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe("add", () => {
|
|
83
|
+
it("adds vectors correctly", () => {
|
|
84
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
85
|
+
const v2 = new Vector3d(4, 5, 6);
|
|
86
|
+
const result = v1.add(v2);
|
|
87
|
+
expect(result.x).toBe(5);
|
|
88
|
+
expect(result.y).toBe(7);
|
|
89
|
+
expect(result.z).toBe(9);
|
|
90
|
+
});
|
|
91
|
+
it("is immutable", () => {
|
|
92
|
+
const v1 = new Vector3d(1, 2, 3);
|
|
93
|
+
const v2 = new Vector3d(4, 5, 6);
|
|
94
|
+
v1.add(v2);
|
|
95
|
+
expect(v1.x).toBe(1);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe("subtract", () => {
|
|
99
|
+
it("subtracts vectors correctly", () => {
|
|
100
|
+
const v1 = new Vector3d(4, 5, 6);
|
|
101
|
+
const v2 = new Vector3d(1, 2, 3);
|
|
102
|
+
const result = v1.subtract(v2);
|
|
103
|
+
expect(result.x).toBe(3);
|
|
104
|
+
expect(result.y).toBe(3);
|
|
105
|
+
expect(result.z).toBe(3);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
describe("multiply", () => {
|
|
109
|
+
it("multiplies by scalar correctly", () => {
|
|
110
|
+
const v = new Vector3d(1, 2, 3);
|
|
111
|
+
const result = v.multiply(2);
|
|
112
|
+
expect(result.x).toBe(2);
|
|
113
|
+
expect(result.y).toBe(4);
|
|
114
|
+
expect(result.z).toBe(6);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe("negate", () => {
|
|
118
|
+
it("negates vector correctly", () => {
|
|
119
|
+
const v = new Vector3d(1, -2, 3);
|
|
120
|
+
const result = v.negate();
|
|
121
|
+
expect(result.x).toBe(-1);
|
|
122
|
+
expect(result.y).toBe(2);
|
|
123
|
+
expect(result.z).toBe(-3);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("isZero", () => {
|
|
127
|
+
it("returns true for zero vector", () => {
|
|
128
|
+
const v = new Vector3d(0, 0, 0);
|
|
129
|
+
expect(v.isZero()).toBe(true);
|
|
130
|
+
});
|
|
131
|
+
it("returns false for non-zero vector", () => {
|
|
132
|
+
const v = new Vector3d(0.001, 0, 0);
|
|
133
|
+
expect(v.isZero()).toBe(false);
|
|
134
|
+
});
|
|
135
|
+
it("supports tolerance", () => {
|
|
136
|
+
const v = new Vector3d(0.001, 0.001, 0.001);
|
|
137
|
+
expect(v.isZero(0.01)).toBe(true);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
describe("angleTo", () => {
|
|
141
|
+
it("returns 0 for same direction", () => {
|
|
142
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
143
|
+
const v2 = new Vector3d(2, 0, 0);
|
|
144
|
+
expect(v1.angleTo(v2)).toBeCloseTo(0);
|
|
145
|
+
});
|
|
146
|
+
it("returns PI/2 for perpendicular vectors", () => {
|
|
147
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
148
|
+
const v2 = new Vector3d(0, 1, 0);
|
|
149
|
+
expect(v1.angleTo(v2)).toBeCloseTo(Math.PI / 2);
|
|
150
|
+
});
|
|
151
|
+
it("returns PI for opposite directions", () => {
|
|
152
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
153
|
+
const v2 = new Vector3d(-1, 0, 0);
|
|
154
|
+
expect(v1.angleTo(v2)).toBeCloseTo(Math.PI);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
describe("projectOnto", () => {
|
|
158
|
+
it("projects vector correctly", () => {
|
|
159
|
+
const v = new Vector3d(3, 4, 0);
|
|
160
|
+
const onto = new Vector3d(1, 0, 0);
|
|
161
|
+
const result = v.projectOnto(onto);
|
|
162
|
+
expect(result.x).toBeCloseTo(3);
|
|
163
|
+
expect(result.y).toBeCloseTo(0);
|
|
164
|
+
expect(result.z).toBeCloseTo(0);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
describe("reflect", () => {
|
|
168
|
+
it("reflects vector correctly", () => {
|
|
169
|
+
const v = new Vector3d(1, -1, 0);
|
|
170
|
+
const normal = new Vector3d(0, 1, 0);
|
|
171
|
+
const result = v.reflect(normal);
|
|
172
|
+
expect(result.x).toBeCloseTo(1);
|
|
173
|
+
expect(result.y).toBeCloseTo(1);
|
|
174
|
+
expect(result.z).toBeCloseTo(0);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
describe("lerp", () => {
|
|
178
|
+
it("interpolates at t=0", () => {
|
|
179
|
+
const v1 = new Vector3d(0, 0, 0);
|
|
180
|
+
const v2 = new Vector3d(10, 10, 10);
|
|
181
|
+
const result = v1.lerp(v2, 0);
|
|
182
|
+
expect(result.equals(v1)).toBe(true);
|
|
183
|
+
});
|
|
184
|
+
it("interpolates at t=1", () => {
|
|
185
|
+
const v1 = new Vector3d(0, 0, 0);
|
|
186
|
+
const v2 = new Vector3d(10, 10, 10);
|
|
187
|
+
const result = v1.lerp(v2, 1);
|
|
188
|
+
expect(result.equals(v2)).toBe(true);
|
|
189
|
+
});
|
|
190
|
+
it("interpolates at t=0.5", () => {
|
|
191
|
+
const v1 = new Vector3d(0, 0, 0);
|
|
192
|
+
const v2 = new Vector3d(10, 10, 10);
|
|
193
|
+
const result = v1.lerp(v2, 0.5);
|
|
194
|
+
expect(result.x).toBe(5);
|
|
195
|
+
expect(result.y).toBe(5);
|
|
196
|
+
expect(result.z).toBe(5);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
describe("isParallelTo", () => {
|
|
200
|
+
it("returns true for parallel vectors", () => {
|
|
201
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
202
|
+
const v2 = new Vector3d(5, 0, 0);
|
|
203
|
+
expect(v1.isParallelTo(v2)).toBe(true);
|
|
204
|
+
});
|
|
205
|
+
it("returns true for anti-parallel vectors", () => {
|
|
206
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
207
|
+
const v2 = new Vector3d(-5, 0, 0);
|
|
208
|
+
expect(v1.isParallelTo(v2)).toBe(true);
|
|
209
|
+
});
|
|
210
|
+
it("returns false for non-parallel vectors", () => {
|
|
211
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
212
|
+
const v2 = new Vector3d(1, 1, 0);
|
|
213
|
+
expect(v1.isParallelTo(v2)).toBe(false);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
describe("isPerpendicularTo", () => {
|
|
217
|
+
it("returns true for perpendicular vectors", () => {
|
|
218
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
219
|
+
const v2 = new Vector3d(0, 1, 0);
|
|
220
|
+
expect(v1.isPerpendicularTo(v2)).toBe(true);
|
|
221
|
+
});
|
|
222
|
+
it("returns false for non-perpendicular vectors", () => {
|
|
223
|
+
const v1 = new Vector3d(1, 0, 0);
|
|
224
|
+
const v2 = new Vector3d(1, 1, 0);
|
|
225
|
+
expect(v1.isPerpendicularTo(v2)).toBe(false);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe("static methods", () => {
|
|
229
|
+
it("unitX returns (1,0,0)", () => {
|
|
230
|
+
const v = Vector3d.unitX();
|
|
231
|
+
expect(v.x).toBe(1);
|
|
232
|
+
expect(v.y).toBe(0);
|
|
233
|
+
expect(v.z).toBe(0);
|
|
234
|
+
});
|
|
235
|
+
it("unitY returns (0,1,0)", () => {
|
|
236
|
+
const v = Vector3d.unitY();
|
|
237
|
+
expect(v.x).toBe(0);
|
|
238
|
+
expect(v.y).toBe(1);
|
|
239
|
+
expect(v.z).toBe(0);
|
|
240
|
+
});
|
|
241
|
+
it("unitZ returns (0,0,1)", () => {
|
|
242
|
+
const v = Vector3d.unitZ();
|
|
243
|
+
expect(v.x).toBe(0);
|
|
244
|
+
expect(v.y).toBe(0);
|
|
245
|
+
expect(v.z).toBe(1);
|
|
246
|
+
});
|
|
247
|
+
it("zero returns (0,0,0)", () => {
|
|
248
|
+
const v = Vector3d.zero();
|
|
249
|
+
expect(v.isZero()).toBe(true);
|
|
250
|
+
});
|
|
251
|
+
it("fromArray creates vector from array", () => {
|
|
252
|
+
const v = Vector3d.fromArray([1, 2, 3]);
|
|
253
|
+
expect(v.x).toBe(1);
|
|
254
|
+
expect(v.y).toBe(2);
|
|
255
|
+
expect(v.z).toBe(3);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
describe("toVector3d helper", () => {
|
|
259
|
+
it("returns same instance for Vector3d", () => {
|
|
260
|
+
const v = new Vector3d(1, 2, 3);
|
|
261
|
+
expect(normalizeVector(v)).toBe(v);
|
|
262
|
+
});
|
|
263
|
+
it("converts array to Vector3d", () => {
|
|
264
|
+
const v = normalizeVector([1, 2, 3]);
|
|
265
|
+
expect(v.x).toBe(1);
|
|
266
|
+
expect(v.y).toBe(2);
|
|
267
|
+
expect(v.z).toBe(3);
|
|
268
|
+
});
|
|
269
|
+
it("converts object to Vector3d", () => {
|
|
270
|
+
const v = normalizeVector({ x: 1, y: 2, z: 3 });
|
|
271
|
+
expect(v.x).toBe(1);
|
|
272
|
+
expect(v.y).toBe(2);
|
|
273
|
+
expect(v.z).toBe(3);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TopoDS_Shape } from "occjs-wrapper";
|
|
2
|
+
import { Shape } from "../common/shape.js";
|
|
3
|
+
import { Solid } from "../common/solid.js";
|
|
4
|
+
import { Edge } from "../common/edge.js";
|
|
5
|
+
import { Face } from "../common/face.js";
|
|
6
|
+
import { Plane } from "../math/plane.js";
|
|
7
|
+
export declare class BooleanOps {
|
|
8
|
+
static cutShapes(shape: Shape, tool: Shape): Shape;
|
|
9
|
+
static cutShapesRaw(shape: TopoDS_Shape, tool: TopoDS_Shape): TopoDS_Shape;
|
|
10
|
+
static cutMultiShape(stocks: Shape[], tools: Shape[], plane?: Plane, cutDistance?: number): {
|
|
11
|
+
result: Solid | Edge | Face | import("../common/wire.js").Wire;
|
|
12
|
+
modified: (shape: Shape) => (Solid | Edge | Face | import("../common/wire.js").Wire)[];
|
|
13
|
+
sectionEdges: Edge[];
|
|
14
|
+
startEdges: Edge[];
|
|
15
|
+
endEdges: Edge[];
|
|
16
|
+
internalEdges: Edge[];
|
|
17
|
+
internalFaces: Face[];
|
|
18
|
+
};
|
|
19
|
+
static fuse(args: Shape[]): {
|
|
20
|
+
result: Shape[];
|
|
21
|
+
modifiedShapes: Shape[];
|
|
22
|
+
newShapes: Shape[];
|
|
23
|
+
};
|
|
24
|
+
static fuseFaces(args: Shape[]): {
|
|
25
|
+
result: Shape[];
|
|
26
|
+
modifiedShapes: Shape[];
|
|
27
|
+
newShapes: Shape[];
|
|
28
|
+
};
|
|
29
|
+
static splitShape(shape: Shape, tool: Shape): Shape[];
|
|
30
|
+
static common(args: Shape[]): {
|
|
31
|
+
result: Shape[];
|
|
32
|
+
modifiedShapes: Shape[];
|
|
33
|
+
newShapes: Shape[];
|
|
34
|
+
};
|
|
35
|
+
static doShapesIntersect(shape1: Shape, shape2: Shape): boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
import { Explorer } from "./explorer.js";
|
|
3
|
+
import { ShapeOps } from "./shape-ops.js";
|
|
4
|
+
import { Solid } from "../common/solid.js";
|
|
5
|
+
import { ShapeFactory } from "../common/shape-factory.js";
|
|
6
|
+
import { Edge } from "../common/edge.js";
|
|
7
|
+
import { Face } from "../common/face.js";
|
|
8
|
+
import { EdgeOps } from "./edge-ops.js";
|
|
9
|
+
export class BooleanOps {
|
|
10
|
+
static cutShapes(shape, tool) {
|
|
11
|
+
const result = BooleanOps.cutShapesRaw(shape.getShape(), tool.getShape());
|
|
12
|
+
return ShapeFactory.fromShape(result);
|
|
13
|
+
}
|
|
14
|
+
static cutShapesRaw(shape, tool) {
|
|
15
|
+
const oc = getOC();
|
|
16
|
+
const progress = new oc.Message_ProgressRange();
|
|
17
|
+
const cutter = new oc.BRepAlgoAPI_Cut(shape, tool, progress);
|
|
18
|
+
cutter.Build(progress);
|
|
19
|
+
if (!cutter.IsDone()) {
|
|
20
|
+
cutter.delete();
|
|
21
|
+
progress.delete();
|
|
22
|
+
throw new Error("Cut operation failed");
|
|
23
|
+
}
|
|
24
|
+
const result = cutter.Shape();
|
|
25
|
+
cutter.delete();
|
|
26
|
+
progress.delete();
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
static cutMultiShape(stocks, tools, plane, cutDistance = 0) {
|
|
30
|
+
const oc = getOC();
|
|
31
|
+
const stockList = new oc.TopTools_ListOfShape();
|
|
32
|
+
for (const s of stocks) {
|
|
33
|
+
stockList.Append(s.getShape());
|
|
34
|
+
}
|
|
35
|
+
const toolList = new oc.TopTools_ListOfShape();
|
|
36
|
+
for (const t of tools) {
|
|
37
|
+
toolList.Append(t.getShape());
|
|
38
|
+
}
|
|
39
|
+
const progress = new oc.Message_ProgressRange();
|
|
40
|
+
const cutMaker = new oc.BRepAlgoAPI_Cut();
|
|
41
|
+
cutMaker.SetArguments(stockList);
|
|
42
|
+
cutMaker.SetTools(toolList);
|
|
43
|
+
cutMaker.SetNonDestructive(true);
|
|
44
|
+
cutMaker.SetRunParallel(true);
|
|
45
|
+
cutMaker.Build(progress);
|
|
46
|
+
const result = cutMaker.Shape();
|
|
47
|
+
const resultSolids = Explorer.findShapes(result, Explorer.getOcShapeType("solid"));
|
|
48
|
+
const wrappedResult = resultSolids.length > 0
|
|
49
|
+
? Solid.fromTopoDSSolid(Explorer.toSolid(resultSolids[0]))
|
|
50
|
+
: ShapeFactory.fromShape(result);
|
|
51
|
+
const modified = (shape) => ShapeOps.shapeListToArray(cutMaker.Modified(shape.getShape()))
|
|
52
|
+
.map(s => ShapeFactory.fromShape(s));
|
|
53
|
+
// Build maps of all edges and faces that came from the original stocks (unchanged or modified).
|
|
54
|
+
// Any result edge/face not in these maps is new, created by the cut.
|
|
55
|
+
const stockEdgeMap = new oc.TopTools_MapOfShape();
|
|
56
|
+
const stockFaceMap = new oc.TopTools_MapOfShape();
|
|
57
|
+
for (const stock of stocks) {
|
|
58
|
+
const rawEdges = Explorer.findShapes(stock.getShape(), Explorer.getOcShapeType("edge"));
|
|
59
|
+
for (const rawEdge of rawEdges) {
|
|
60
|
+
stockEdgeMap.Add(rawEdge);
|
|
61
|
+
// Also track modified versions of this edge so we don't misidentify them as new.
|
|
62
|
+
const modifiedList = cutMaker.Modified(rawEdge);
|
|
63
|
+
while (modifiedList.Size() > 0) {
|
|
64
|
+
stockEdgeMap.Add(modifiedList.First());
|
|
65
|
+
modifiedList.RemoveFirst();
|
|
66
|
+
}
|
|
67
|
+
modifiedList.delete();
|
|
68
|
+
}
|
|
69
|
+
const rawFaces = Explorer.findShapes(stock.getShape(), Explorer.getOcShapeType("face"));
|
|
70
|
+
for (const rawFace of rawFaces) {
|
|
71
|
+
stockFaceMap.Add(rawFace);
|
|
72
|
+
const modifiedList = cutMaker.Modified(rawFace);
|
|
73
|
+
while (modifiedList.Size() > 0) {
|
|
74
|
+
stockFaceMap.Add(modifiedList.First());
|
|
75
|
+
modifiedList.RemoveFirst();
|
|
76
|
+
}
|
|
77
|
+
modifiedList.delete();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const resultRawEdges = Explorer.findShapes(result, Explorer.getOcShapeType("edge"));
|
|
81
|
+
const sectionEdges = resultRawEdges
|
|
82
|
+
.filter(re => !stockEdgeMap.Contains(re))
|
|
83
|
+
.map(re => Edge.fromTopoDSEdge(Explorer.toEdge(re)));
|
|
84
|
+
// Classify section edges into start, end, and internal groups using signed
|
|
85
|
+
// distance from the cut plane. Through-all cuts use min/max projection.
|
|
86
|
+
const startEdges = [];
|
|
87
|
+
const endEdges = [];
|
|
88
|
+
const internalEdges = [];
|
|
89
|
+
if (plane && sectionEdges.length > 0) {
|
|
90
|
+
const tolerance = oc.Precision.Confusion();
|
|
91
|
+
const isThroughAll = cutDistance === 0;
|
|
92
|
+
const dists = sectionEdges.map(edge => ({
|
|
93
|
+
edge,
|
|
94
|
+
d: plane.signedDistanceToPoint(EdgeOps.getEdgeMidPoint(edge))
|
|
95
|
+
}));
|
|
96
|
+
const startDist = isThroughAll ? Math.max(...dists.map(e => e.d)) : 0;
|
|
97
|
+
const endDist = isThroughAll ? Math.min(...dists.map(e => e.d)) : -cutDistance;
|
|
98
|
+
for (const { edge, d } of dists) {
|
|
99
|
+
if (Math.abs(d - startDist) < tolerance) {
|
|
100
|
+
startEdges.push(edge);
|
|
101
|
+
}
|
|
102
|
+
else if (Math.abs(d - endDist) < tolerance) {
|
|
103
|
+
endEdges.push(edge);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
internalEdges.push(edge);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const resultRawFaces = Explorer.findShapes(result, Explorer.getOcShapeType("face"));
|
|
111
|
+
const internalFaces = resultRawFaces
|
|
112
|
+
.filter(rf => !stockFaceMap.Contains(rf))
|
|
113
|
+
.map(rf => Face.fromTopoDSFace(Explorer.toFace(rf)));
|
|
114
|
+
stockEdgeMap.delete();
|
|
115
|
+
stockFaceMap.delete();
|
|
116
|
+
progress.delete();
|
|
117
|
+
stockList.delete();
|
|
118
|
+
toolList.delete();
|
|
119
|
+
return { result: wrappedResult, modified, sectionEdges, startEdges, endEdges, internalEdges, internalFaces };
|
|
120
|
+
}
|
|
121
|
+
static fuse(args) {
|
|
122
|
+
const oc = getOC();
|
|
123
|
+
const builder = new oc.BRepAlgoAPI_Fuse();
|
|
124
|
+
builder.SetNonDestructive(true);
|
|
125
|
+
builder.SetCheckInverted(true);
|
|
126
|
+
builder.SetRunParallel(true);
|
|
127
|
+
const argsList = new oc.TopTools_ListOfShape();
|
|
128
|
+
for (const arg of args) {
|
|
129
|
+
argsList.Append(arg.getShape());
|
|
130
|
+
}
|
|
131
|
+
const empty = ShapeOps.makeCompoundRaw([]);
|
|
132
|
+
const list = new oc.TopTools_ListOfShape();
|
|
133
|
+
list.Append(empty);
|
|
134
|
+
builder.SetArguments(list);
|
|
135
|
+
builder.SetTools(argsList);
|
|
136
|
+
const progress = new oc.Message_ProgressRange();
|
|
137
|
+
builder.Build(progress);
|
|
138
|
+
builder.SimplifyResult(false, true, oc.Precision.Angular());
|
|
139
|
+
const resultShape = builder.Shape();
|
|
140
|
+
console.log('FuseMultiShape: Result shape type:', Explorer.getShapeType(resultShape));
|
|
141
|
+
const rawShapes = Explorer.findAllShapes(resultShape);
|
|
142
|
+
console.log('FuseMultiShape: Result shapes count:', rawShapes.length);
|
|
143
|
+
const result = rawShapes.map(s => ShapeFactory.fromShape(s));
|
|
144
|
+
const modifiedShapes = [];
|
|
145
|
+
for (const shape of args) {
|
|
146
|
+
if (builder.IsDeleted(shape.getShape())) {
|
|
147
|
+
modifiedShapes.push(shape);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
builder.delete();
|
|
151
|
+
progress.delete();
|
|
152
|
+
const newShapes = [];
|
|
153
|
+
for (const s of result) {
|
|
154
|
+
const existsInArgs = args.some(arg => arg.getShape().IsPartner(s.getShape()));
|
|
155
|
+
if (!existsInArgs) {
|
|
156
|
+
newShapes.push(s);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { result, newShapes, modifiedShapes };
|
|
160
|
+
}
|
|
161
|
+
static fuseFaces(args) {
|
|
162
|
+
const oc = getOC();
|
|
163
|
+
const builder = new oc.BRepAlgoAPI_Fuse();
|
|
164
|
+
builder.SetNonDestructive(true);
|
|
165
|
+
builder.SetRunParallel(true);
|
|
166
|
+
const argsList = new oc.TopTools_ListOfShape();
|
|
167
|
+
for (const arg of args) {
|
|
168
|
+
argsList.Append(arg.getShape());
|
|
169
|
+
}
|
|
170
|
+
const empty = ShapeOps.makeCompoundRaw([]);
|
|
171
|
+
const list = new oc.TopTools_ListOfShape();
|
|
172
|
+
list.Append(empty);
|
|
173
|
+
builder.SetArguments(list);
|
|
174
|
+
builder.SetTools(argsList);
|
|
175
|
+
const progress = new oc.Message_ProgressRange();
|
|
176
|
+
builder.Build(progress);
|
|
177
|
+
const resultShape = builder.Shape();
|
|
178
|
+
console.log('FuseMultiShape: Result shape type:', Explorer.getShapeType(resultShape));
|
|
179
|
+
const unify = new oc.ShapeUpgrade_UnifySameDomain(resultShape, true, true, false);
|
|
180
|
+
unify.Build();
|
|
181
|
+
const mergedShape = unify.Shape();
|
|
182
|
+
const rawShapes = Explorer.findAllShapes(mergedShape);
|
|
183
|
+
if (rawShapes.length === args.length || rawShapes.length === 0) {
|
|
184
|
+
return {
|
|
185
|
+
result: args,
|
|
186
|
+
newShapes: [],
|
|
187
|
+
modifiedShapes: []
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
console.log('FuseMultiShape: Result shapes count:', rawShapes.length);
|
|
191
|
+
const result = rawShapes.map(s => ShapeFactory.fromShape(s));
|
|
192
|
+
const modifiedShapes = [];
|
|
193
|
+
for (const shape of args) {
|
|
194
|
+
if (builder.IsDeleted(shape.getShape())) {
|
|
195
|
+
console.log('=======', 'Shape was deleted in fuse:', shape);
|
|
196
|
+
modifiedShapes.push(shape);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
builder.delete();
|
|
200
|
+
progress.delete();
|
|
201
|
+
const newShapes = [];
|
|
202
|
+
for (const s of result) {
|
|
203
|
+
const existsInArgs = args.some(arg => arg.getShape().IsPartner(s.getShape()));
|
|
204
|
+
if (!existsInArgs) {
|
|
205
|
+
newShapes.push(s);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const cleanResult = result.map(s => ShapeOps.cleanShape(s));
|
|
209
|
+
const cleanNewShapes = newShapes.map(s => ShapeOps.cleanShape(s));
|
|
210
|
+
return { result: cleanResult, newShapes: cleanNewShapes, modifiedShapes };
|
|
211
|
+
}
|
|
212
|
+
static splitShape(shape, tool) {
|
|
213
|
+
const oc = getOC();
|
|
214
|
+
const splitter = new oc.BOPAlgo_Splitter();
|
|
215
|
+
splitter.SetRunParallel(true);
|
|
216
|
+
splitter.SetNonDestructive(true);
|
|
217
|
+
splitter.AddTool(tool.getShape());
|
|
218
|
+
splitter.AddArgument(shape.getShape());
|
|
219
|
+
const progress = new oc.Message_ProgressRange();
|
|
220
|
+
splitter.Perform(progress);
|
|
221
|
+
progress.delete();
|
|
222
|
+
if (splitter.HasErrors()) {
|
|
223
|
+
splitter.delete();
|
|
224
|
+
throw new Error("Splitter failed");
|
|
225
|
+
}
|
|
226
|
+
const resultShape = splitter.Shape();
|
|
227
|
+
splitter.delete();
|
|
228
|
+
if (Explorer.isSolid(resultShape)) {
|
|
229
|
+
return [ShapeFactory.fromShape(resultShape)];
|
|
230
|
+
}
|
|
231
|
+
return Explorer.findShapes(resultShape, Explorer.getOcShapeType("solid"))
|
|
232
|
+
.map(s => ShapeFactory.fromShape(s));
|
|
233
|
+
}
|
|
234
|
+
static common(args) {
|
|
235
|
+
const oc = getOC();
|
|
236
|
+
const argsList = new oc.TopTools_ListOfShape();
|
|
237
|
+
for (const arg of args) {
|
|
238
|
+
argsList.Append(arg.getShape());
|
|
239
|
+
}
|
|
240
|
+
const empty = ShapeOps.makeCompoundRaw([]);
|
|
241
|
+
const list = new oc.TopTools_ListOfShape();
|
|
242
|
+
list.Append(empty);
|
|
243
|
+
const progress = new oc.Message_ProgressRange();
|
|
244
|
+
const builder = new oc.BOPAlgo_CellsBuilder();
|
|
245
|
+
builder.SetArguments(argsList);
|
|
246
|
+
builder.SetNonDestructive(true);
|
|
247
|
+
builder.SetCheckInverted(true);
|
|
248
|
+
builder.SetRunParallel(true);
|
|
249
|
+
builder.Perform(progress);
|
|
250
|
+
if (builder.HasErrors()) {
|
|
251
|
+
builder.delete();
|
|
252
|
+
progress.delete();
|
|
253
|
+
list.delete();
|
|
254
|
+
throw new Error('Common operation failed');
|
|
255
|
+
}
|
|
256
|
+
builder.RemoveAllFromResult();
|
|
257
|
+
const inside = new oc.TopTools_ListOfShape();
|
|
258
|
+
for (const arg of args) {
|
|
259
|
+
inside.Append(arg.getShape());
|
|
260
|
+
}
|
|
261
|
+
const outside = new oc.TopTools_ListOfShape();
|
|
262
|
+
builder.AddToResult(inside, outside, 0, false);
|
|
263
|
+
builder.MakeContainers();
|
|
264
|
+
const resultShape = builder.Shape();
|
|
265
|
+
const rawShapes = Explorer.findAllShapes(resultShape);
|
|
266
|
+
const result = rawShapes.map(s => ShapeFactory.fromShape(s));
|
|
267
|
+
console.log('Common operation: result shape type:', rawShapes.length);
|
|
268
|
+
const modifiedShapes = [];
|
|
269
|
+
for (const shape of args) {
|
|
270
|
+
if (builder.IsDeleted(shape.getShape())) {
|
|
271
|
+
modifiedShapes.push(shape);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const modified = builder.Modified(shape.getShape());
|
|
275
|
+
if (modified.Size() > 0) {
|
|
276
|
+
modifiedShapes.push(shape);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
builder.delete();
|
|
281
|
+
progress.delete();
|
|
282
|
+
const newShapes = [];
|
|
283
|
+
for (const s of result) {
|
|
284
|
+
const existsInArgs = args.some(arg => arg.getShape().IsPartner(s.getShape()));
|
|
285
|
+
if (!existsInArgs) {
|
|
286
|
+
newShapes.push(s);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
const cleanResult = result.map(s => ShapeOps.cleanShape(s));
|
|
290
|
+
const cleanNewShapes = newShapes.map(s => ShapeOps.cleanShape(s));
|
|
291
|
+
console.log('Common operation: result shapes count:', cleanResult.length);
|
|
292
|
+
console.log('Common operation: new shapes count:', cleanNewShapes.length);
|
|
293
|
+
console.log('Common operation: modified shapes count:', modifiedShapes.length);
|
|
294
|
+
return { result: cleanResult, newShapes: cleanNewShapes, modifiedShapes };
|
|
295
|
+
}
|
|
296
|
+
static doShapesIntersect(shape1, shape2) {
|
|
297
|
+
const oc = getOC();
|
|
298
|
+
const raw1 = shape1.getShape();
|
|
299
|
+
const raw2 = shape2.getShape();
|
|
300
|
+
const bbox1 = new oc.Bnd_Box();
|
|
301
|
+
const bbox2 = new oc.Bnd_Box();
|
|
302
|
+
oc.BRepBndLib.Add(raw1, bbox1, false);
|
|
303
|
+
oc.BRepBndLib.Add(raw2, bbox2, false);
|
|
304
|
+
if (bbox1.IsOut(bbox2)) {
|
|
305
|
+
bbox1.delete();
|
|
306
|
+
bbox2.delete();
|
|
307
|
+
console.log(`Intersection test: Bounding boxes do not intersect.`);
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
bbox1.delete();
|
|
311
|
+
bbox2.delete();
|
|
312
|
+
const progress = new oc.Message_ProgressRange();
|
|
313
|
+
const distCalc = new oc.BRepExtrema_DistShapeShape(raw1, raw2, oc.Extrema_ExtFlag.Extrema_ExtFlag_MIN, oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad, progress);
|
|
314
|
+
distCalc.SetMultiThread(true);
|
|
315
|
+
const distance = distCalc.IsDone() ? distCalc.Value() : Infinity;
|
|
316
|
+
distCalc.delete();
|
|
317
|
+
console.log(`Intersection test: Minimum distance between shapes is ${distance}.`);
|
|
318
|
+
if (distance <= 0) {
|
|
319
|
+
console.log(`Intersection test: Shapes are separated by distance ${distance}.`);
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
const common = new oc.BRepAlgoAPI_Common(raw1, raw2, progress);
|
|
323
|
+
common.SetRunParallel(true);
|
|
324
|
+
common.Build(new oc.Message_ProgressRange());
|
|
325
|
+
if (!common.IsDone()) {
|
|
326
|
+
common.delete();
|
|
327
|
+
console.log(`Intersection test: Boolean common operation failed.`);
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
const props = new oc.GProp_GProps();
|
|
331
|
+
oc.BRepGProp.VolumeProperties(common.Shape(), props, false, false, false);
|
|
332
|
+
const volume = props.Mass();
|
|
333
|
+
props.delete();
|
|
334
|
+
common.delete();
|
|
335
|
+
return volume > 1e-9;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GccEnt_Position, GccEnt_QualifiedCirc, GccEnt_QualifiedLin, gp_Circ, gp_Circ2d, gp_Lin, gp_Lin2d, gp_Pln, gp_Pnt, gp_Pnt2d } from "occjs-wrapper";
|
|
2
|
+
import { ConstraintQualifier } from "../features/2d/constraints/qualified-geometry.js";
|
|
3
|
+
export declare class ConstraintResolver {
|
|
4
|
+
static get2dGeometry<T extends gp_Circ | gp_Lin | gp_Pnt>(plane: gp_Pln, geometry: T): gp_Lin2d | gp_Circ2d | gp_Pnt2d;
|
|
5
|
+
static getQualifier(qualifier: ConstraintQualifier): GccEnt_Position;
|
|
6
|
+
static getQualified(plane: gp_Pln, geometry: gp_Circ | gp_Lin, qualifier: ConstraintQualifier): GccEnt_QualifiedCirc | GccEnt_QualifiedLin;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
export class ConstraintResolver {
|
|
3
|
+
static get2dGeometry(plane, geometry) {
|
|
4
|
+
const oc = getOC();
|
|
5
|
+
return oc.ProjLib.Project(plane, geometry);
|
|
6
|
+
}
|
|
7
|
+
static getQualifier(qualifier) {
|
|
8
|
+
const oc = getOC();
|
|
9
|
+
switch (qualifier) {
|
|
10
|
+
case 'unqualified':
|
|
11
|
+
return oc.GccEnt_Position.GccEnt_unqualified;
|
|
12
|
+
case 'enclosed':
|
|
13
|
+
return oc.GccEnt_Position.GccEnt_enclosed;
|
|
14
|
+
case 'enclosing':
|
|
15
|
+
return oc.GccEnt_Position.GccEnt_enclosing;
|
|
16
|
+
case 'outside':
|
|
17
|
+
return oc.GccEnt_Position.GccEnt_outside;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
static getQualified(plane, geometry, qualifier) {
|
|
21
|
+
const oc = getOC();
|
|
22
|
+
const geom = this.get2dGeometry(plane, geometry);
|
|
23
|
+
if (geom instanceof oc.gp_Circ2d) {
|
|
24
|
+
return new oc.GccEnt_QualifiedCirc(geom, this.getQualifier(qualifier));
|
|
25
|
+
}
|
|
26
|
+
else if (geom instanceof oc.gp_Lin2d) {
|
|
27
|
+
return new oc.GccEnt_QualifiedLin(geom, this.getQualifier(qualifier));
|
|
28
|
+
}
|
|
29
|
+
throw new Error('Unsupported geometry type');
|
|
30
|
+
}
|
|
31
|
+
}
|