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,256 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
import { Explorer } from "./explorer.js";
|
|
3
|
+
export class OccMeasure {
|
|
4
|
+
static compute(shapeA, typeA, indexA, shapeB, typeB, indexB) {
|
|
5
|
+
const oc = getOC();
|
|
6
|
+
// Extract sub-shapes by index
|
|
7
|
+
const subA = typeA === 'face'
|
|
8
|
+
? Explorer.findShapes(shapeA, oc.TopAbs_ShapeEnum.TopAbs_FACE)[indexA]
|
|
9
|
+
: Explorer.findShapes(shapeA, oc.TopAbs_ShapeEnum.TopAbs_EDGE)[indexA];
|
|
10
|
+
const subB = typeB === 'face'
|
|
11
|
+
? Explorer.findShapes(shapeB, oc.TopAbs_ShapeEnum.TopAbs_FACE)[indexB]
|
|
12
|
+
: Explorer.findShapes(shapeB, oc.TopAbs_ShapeEnum.TopAbs_EDGE)[indexB];
|
|
13
|
+
if (!subA || !subB) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
// Compute minimum distance and reference points via BRepExtrema
|
|
17
|
+
const progress = new oc.Message_ProgressRange();
|
|
18
|
+
const distCalc = new oc.BRepExtrema_DistShapeShape(subA, subB, oc.Extrema_ExtFlag.Extrema_ExtFlag_MIN, oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad, progress);
|
|
19
|
+
let minDist = 0;
|
|
20
|
+
let refPointA = [0, 0, 0];
|
|
21
|
+
let refPointB = [0, 0, 0];
|
|
22
|
+
if (distCalc.IsDone() && distCalc.NbSolution() > 0) {
|
|
23
|
+
minDist = distCalc.Value();
|
|
24
|
+
const pA = distCalc.PointOnShape1(1);
|
|
25
|
+
const pB = distCalc.PointOnShape2(1);
|
|
26
|
+
refPointA = [pA.X(), pA.Y(), pA.Z()];
|
|
27
|
+
refPointB = [pB.X(), pB.Y(), pB.Z()];
|
|
28
|
+
}
|
|
29
|
+
distCalc.delete();
|
|
30
|
+
progress.delete();
|
|
31
|
+
const dx = refPointB[0] - refPointA[0];
|
|
32
|
+
const dy = refPointB[1] - refPointA[1];
|
|
33
|
+
const dz = refPointB[2] - refPointA[2];
|
|
34
|
+
const axisBreakdown = { dx, dy, dz };
|
|
35
|
+
const minDistEntry = {
|
|
36
|
+
label: 'Min Distance',
|
|
37
|
+
value: minDist,
|
|
38
|
+
unit: 'mm',
|
|
39
|
+
icon: 'distance',
|
|
40
|
+
axisBreakdown,
|
|
41
|
+
};
|
|
42
|
+
const others = [];
|
|
43
|
+
let headline = minDistEntry;
|
|
44
|
+
let headlineSet = false;
|
|
45
|
+
if (typeA === 'face' && typeB === 'face') {
|
|
46
|
+
const ocFaceA = oc.TopoDS.Face(subA);
|
|
47
|
+
const ocFaceB = oc.TopoDS.Face(subB);
|
|
48
|
+
const adaptorA = new oc.BRepAdaptor_Surface(ocFaceA, true);
|
|
49
|
+
const adaptorB = new oc.BRepAdaptor_Surface(ocFaceB, true);
|
|
50
|
+
const gTypeA = adaptorA.GetType();
|
|
51
|
+
const gTypeB = adaptorB.GetType();
|
|
52
|
+
if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Plane &&
|
|
53
|
+
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Plane) {
|
|
54
|
+
// Plane + Plane
|
|
55
|
+
const planeA = adaptorA.Plane();
|
|
56
|
+
const planeB = adaptorB.Plane();
|
|
57
|
+
const axA = planeA.Axis();
|
|
58
|
+
const axB = planeB.Axis();
|
|
59
|
+
const dirA = axA.Direction();
|
|
60
|
+
const dirB = axB.Direction();
|
|
61
|
+
const nax = dirA.X(), nay = dirA.Y(), naz = dirA.Z();
|
|
62
|
+
const nbx = dirB.X(), nby = dirB.Y(), nbz = dirB.Z();
|
|
63
|
+
const dot = Math.abs(nax * nbx + nay * nby + naz * nbz);
|
|
64
|
+
if (dot > 0.9999) {
|
|
65
|
+
// Parallel planes → face distance
|
|
66
|
+
headline = {
|
|
67
|
+
label: 'Face Distance',
|
|
68
|
+
value: minDist,
|
|
69
|
+
unit: 'mm',
|
|
70
|
+
icon: 'distance',
|
|
71
|
+
axisBreakdown,
|
|
72
|
+
};
|
|
73
|
+
headlineSet = true;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// Non-parallel → dihedral angle
|
|
77
|
+
const angleRad = Math.acos(Math.min(1, dot));
|
|
78
|
+
const angleDeg = angleRad * (180 / Math.PI);
|
|
79
|
+
headline = {
|
|
80
|
+
label: 'Dihedral Angle',
|
|
81
|
+
value: angleDeg,
|
|
82
|
+
unit: 'deg',
|
|
83
|
+
icon: 'angle',
|
|
84
|
+
};
|
|
85
|
+
headlineSet = true;
|
|
86
|
+
others.push(minDistEntry);
|
|
87
|
+
}
|
|
88
|
+
planeB.delete();
|
|
89
|
+
planeA.delete();
|
|
90
|
+
}
|
|
91
|
+
else if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Cylinder &&
|
|
92
|
+
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Cylinder) {
|
|
93
|
+
// Cylinder + Cylinder
|
|
94
|
+
const cylA = adaptorA.Cylinder();
|
|
95
|
+
const cylB = adaptorB.Cylinder();
|
|
96
|
+
const axA = cylA.Axis();
|
|
97
|
+
const axB = cylB.Axis();
|
|
98
|
+
const dirA = axA.Direction();
|
|
99
|
+
const dirB = axB.Direction();
|
|
100
|
+
const adx = dirA.X(), ady = dirA.Y(), adz = dirA.Z();
|
|
101
|
+
const bdx = dirB.X(), bdy = dirB.Y(), bdz = dirB.Z();
|
|
102
|
+
const dot = Math.abs(adx * bdx + ady * bdy + adz * bdz);
|
|
103
|
+
const radA = cylA.Radius();
|
|
104
|
+
const radB = cylB.Radius();
|
|
105
|
+
if (dot > 0.9999) {
|
|
106
|
+
// Parallel axes → compute axis distance
|
|
107
|
+
const locA = cylA.Location();
|
|
108
|
+
const locB = cylB.Location();
|
|
109
|
+
const lax = locA.X(), lay = locA.Y(), laz = locA.Z();
|
|
110
|
+
const lbx = locB.X(), lby = locB.Y(), lbz = locB.Z();
|
|
111
|
+
const dv0 = lbx - lax, dv1 = lby - lay, dv2 = lbz - laz;
|
|
112
|
+
const proj = dv0 * adx + dv1 * ady + dv2 * adz;
|
|
113
|
+
const perpX = dv0 - proj * adx;
|
|
114
|
+
const perpY = dv1 - proj * ady;
|
|
115
|
+
const perpZ = dv2 - proj * adz;
|
|
116
|
+
const axisDist = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ);
|
|
117
|
+
const radialGap = axisDist - radA - radB;
|
|
118
|
+
headline = {
|
|
119
|
+
label: 'Axis Distance',
|
|
120
|
+
value: axisDist,
|
|
121
|
+
unit: 'mm',
|
|
122
|
+
icon: 'distance',
|
|
123
|
+
};
|
|
124
|
+
headlineSet = true;
|
|
125
|
+
if (radialGap > -1e-6) {
|
|
126
|
+
others.push({
|
|
127
|
+
label: 'Radial Gap',
|
|
128
|
+
value: Math.max(0, radialGap),
|
|
129
|
+
unit: 'mm',
|
|
130
|
+
icon: 'distance',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
others.push(minDistEntry);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
others.push(minDistEntry);
|
|
137
|
+
}
|
|
138
|
+
cylA.delete();
|
|
139
|
+
cylB.delete();
|
|
140
|
+
}
|
|
141
|
+
else if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Sphere &&
|
|
142
|
+
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Sphere) {
|
|
143
|
+
// Sphere + Sphere → center distance
|
|
144
|
+
const sphA = adaptorA.Sphere();
|
|
145
|
+
const sphB = adaptorB.Sphere();
|
|
146
|
+
const locA = sphA.Location();
|
|
147
|
+
const locB = sphB.Location();
|
|
148
|
+
const cx = locB.X() - locA.X();
|
|
149
|
+
const cy = locB.Y() - locA.Y();
|
|
150
|
+
const cz = locB.Z() - locA.Z();
|
|
151
|
+
const centerDist = Math.sqrt(cx * cx + cy * cy + cz * cz);
|
|
152
|
+
headline = {
|
|
153
|
+
label: 'Center Distance',
|
|
154
|
+
value: centerDist,
|
|
155
|
+
unit: 'mm',
|
|
156
|
+
icon: 'distance',
|
|
157
|
+
axisBreakdown: { dx: cx, dy: cy, dz: cz },
|
|
158
|
+
};
|
|
159
|
+
headlineSet = true;
|
|
160
|
+
others.push(minDistEntry);
|
|
161
|
+
sphA.delete();
|
|
162
|
+
sphB.delete();
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Mixed face types → min distance
|
|
166
|
+
others.push(minDistEntry);
|
|
167
|
+
}
|
|
168
|
+
adaptorA.delete();
|
|
169
|
+
adaptorB.delete();
|
|
170
|
+
}
|
|
171
|
+
else if (typeA === 'edge' && typeB === 'edge') {
|
|
172
|
+
const ocEdgeA = oc.TopoDS.Edge(subA);
|
|
173
|
+
const ocEdgeB = oc.TopoDS.Edge(subB);
|
|
174
|
+
const adaptorA = new oc.BRepAdaptor_Curve(ocEdgeA);
|
|
175
|
+
const adaptorB = new oc.BRepAdaptor_Curve(ocEdgeB);
|
|
176
|
+
const gTypeA = adaptorA.GetType();
|
|
177
|
+
const gTypeB = adaptorB.GetType();
|
|
178
|
+
if (gTypeA === oc.GeomAbs_CurveType.GeomAbs_Line &&
|
|
179
|
+
gTypeB === oc.GeomAbs_CurveType.GeomAbs_Line) {
|
|
180
|
+
// Line + Line
|
|
181
|
+
const linA = adaptorA.Line();
|
|
182
|
+
const linB = adaptorB.Line();
|
|
183
|
+
const dirA = linA.Direction();
|
|
184
|
+
const dirB = linB.Direction();
|
|
185
|
+
const adx = dirA.X(), ady = dirA.Y(), adz = dirA.Z();
|
|
186
|
+
const bdx = dirB.X(), bdy = dirB.Y(), bdz = dirB.Z();
|
|
187
|
+
const dot = Math.abs(adx * bdx + ady * bdy + adz * bdz);
|
|
188
|
+
linA.delete();
|
|
189
|
+
linB.delete();
|
|
190
|
+
if (dot > 0.9999) {
|
|
191
|
+
// Parallel lines → parallel distance
|
|
192
|
+
headline = {
|
|
193
|
+
label: 'Parallel Distance',
|
|
194
|
+
value: minDist,
|
|
195
|
+
unit: 'mm',
|
|
196
|
+
icon: 'distance',
|
|
197
|
+
axisBreakdown,
|
|
198
|
+
};
|
|
199
|
+
headlineSet = true;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
// Non-parallel → angle
|
|
203
|
+
const angleRad = Math.acos(Math.min(1, dot));
|
|
204
|
+
const angleDeg = angleRad * (180 / Math.PI);
|
|
205
|
+
headline = {
|
|
206
|
+
label: 'Angle',
|
|
207
|
+
value: angleDeg,
|
|
208
|
+
unit: 'deg',
|
|
209
|
+
icon: 'angle',
|
|
210
|
+
};
|
|
211
|
+
headlineSet = true;
|
|
212
|
+
others.push(minDistEntry);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else if (gTypeA === oc.GeomAbs_CurveType.GeomAbs_Circle &&
|
|
216
|
+
gTypeB === oc.GeomAbs_CurveType.GeomAbs_Circle) {
|
|
217
|
+
// Circle/Arc + Circle/Arc → center distance
|
|
218
|
+
const circA = adaptorA.Circle();
|
|
219
|
+
const circB = adaptorB.Circle();
|
|
220
|
+
const locA = circA.Location();
|
|
221
|
+
const locB = circB.Location();
|
|
222
|
+
const cx = locB.X() - locA.X();
|
|
223
|
+
const cy = locB.Y() - locA.Y();
|
|
224
|
+
const cz = locB.Z() - locA.Z();
|
|
225
|
+
const centerDist = Math.sqrt(cx * cx + cy * cy + cz * cz);
|
|
226
|
+
headline = {
|
|
227
|
+
label: 'Center Distance',
|
|
228
|
+
value: centerDist,
|
|
229
|
+
unit: 'mm',
|
|
230
|
+
icon: 'distance',
|
|
231
|
+
axisBreakdown: { dx: cx, dy: cy, dz: cz },
|
|
232
|
+
};
|
|
233
|
+
headlineSet = true;
|
|
234
|
+
others.push(minDistEntry);
|
|
235
|
+
circA.delete();
|
|
236
|
+
circB.delete();
|
|
237
|
+
}
|
|
238
|
+
adaptorA.delete();
|
|
239
|
+
adaptorB.delete();
|
|
240
|
+
}
|
|
241
|
+
if (!headlineSet) {
|
|
242
|
+
headline = minDistEntry;
|
|
243
|
+
}
|
|
244
|
+
// Ensure minDistEntry is in others if it's not the headline
|
|
245
|
+
const othersHasMinDist = others.some(e => e === minDistEntry);
|
|
246
|
+
if (headline !== minDistEntry && !othersHasMinDist) {
|
|
247
|
+
others.push(minDistEntry);
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
headline,
|
|
251
|
+
others,
|
|
252
|
+
refPointA,
|
|
253
|
+
refPointB,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TopoDS_Face, TopoDS_Shape } from "occjs-wrapper";
|
|
2
|
+
import { Face } from "../common/face.js";
|
|
3
|
+
import { Shape } from "../common/shape.js";
|
|
4
|
+
export interface MeshData {
|
|
5
|
+
vertices: number[];
|
|
6
|
+
normals: number[];
|
|
7
|
+
indices: number[];
|
|
8
|
+
count?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class Mesh {
|
|
11
|
+
static triangulateFace(face: Face, vertexOffset?: number): MeshData | null;
|
|
12
|
+
static discretizeEdge(edge: Shape): MeshData;
|
|
13
|
+
static triangulateFaceRaw(face: TopoDS_Face, vertexOffset?: number): MeshData | null;
|
|
14
|
+
static discretizeEdgeRaw(edge: TopoDS_Shape): MeshData;
|
|
15
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
export class Mesh {
|
|
3
|
+
// Wrapper methods (public API for external callers)
|
|
4
|
+
static triangulateFace(face, vertexOffset = 0) {
|
|
5
|
+
return Mesh.triangulateFaceRaw(face.getShape(), vertexOffset);
|
|
6
|
+
}
|
|
7
|
+
static discretizeEdge(edge) {
|
|
8
|
+
return Mesh.discretizeEdgeRaw(edge.getShape());
|
|
9
|
+
}
|
|
10
|
+
// Raw methods (for oc-internal use)
|
|
11
|
+
static triangulateFaceRaw(face, vertexOffset = 0) {
|
|
12
|
+
const oc = getOC();
|
|
13
|
+
const vertices = [];
|
|
14
|
+
const normals = [];
|
|
15
|
+
const indices = [];
|
|
16
|
+
let inc;
|
|
17
|
+
try {
|
|
18
|
+
inc = new oc.BRepMesh_IncrementalMesh(face, 0.3, false, 0.3, true);
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.error("Face mesh failed", e);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const aLocation = new oc.TopLoc_Location();
|
|
25
|
+
const myT = oc.BRep_Tool.Triangulation(face, aLocation, 0);
|
|
26
|
+
if (myT.IsNull()) {
|
|
27
|
+
aLocation.delete();
|
|
28
|
+
inc.delete();
|
|
29
|
+
throw new Error("No triangulation for face");
|
|
30
|
+
}
|
|
31
|
+
const pc = new oc.Poly_Connect(myT);
|
|
32
|
+
const triangulation = myT.get();
|
|
33
|
+
const nbNodes = triangulation.NbNodes();
|
|
34
|
+
for (let i = 1; i <= nbNodes; i++) {
|
|
35
|
+
const t1 = aLocation.Transformation();
|
|
36
|
+
const p = triangulation.Node(i);
|
|
37
|
+
const p1 = p.Transformed(t1);
|
|
38
|
+
vertices.push(p1.X(), p1.Y(), p1.Z());
|
|
39
|
+
p.delete();
|
|
40
|
+
p1.delete();
|
|
41
|
+
t1.delete();
|
|
42
|
+
}
|
|
43
|
+
const myNormal = new oc.TColgp_Array1OfDir(1, nbNodes);
|
|
44
|
+
oc.StdPrs_ToolTriangulatedShape.Normal(face, pc, myNormal);
|
|
45
|
+
for (let i = 1; i <= nbNodes; i++) {
|
|
46
|
+
const t1 = aLocation.Transformation();
|
|
47
|
+
const d1 = myNormal.Value(i);
|
|
48
|
+
const d = d1.Transformed(t1);
|
|
49
|
+
normals.push(d.X(), d.Y(), d.Z());
|
|
50
|
+
d1.delete();
|
|
51
|
+
d.delete();
|
|
52
|
+
t1.delete();
|
|
53
|
+
}
|
|
54
|
+
const orient = face.Orientation();
|
|
55
|
+
const triangles = triangulation.Triangles();
|
|
56
|
+
for (let nt = 1; nt <= triangulation.NbTriangles(); nt++) {
|
|
57
|
+
const t = triangles.Value(nt);
|
|
58
|
+
let n1 = t.Value(1) - 1;
|
|
59
|
+
let n2 = t.Value(2) - 1;
|
|
60
|
+
let n3 = t.Value(3) - 1;
|
|
61
|
+
if (orient !== oc.TopAbs_Orientation.TopAbs_FORWARD) {
|
|
62
|
+
[n1, n2] = [n2, n1];
|
|
63
|
+
}
|
|
64
|
+
indices.push(vertexOffset + n1, vertexOffset + n2, vertexOffset + n3);
|
|
65
|
+
t.delete();
|
|
66
|
+
}
|
|
67
|
+
pc.delete();
|
|
68
|
+
myNormal.delete();
|
|
69
|
+
triangles.delete();
|
|
70
|
+
myT.delete();
|
|
71
|
+
aLocation.delete();
|
|
72
|
+
inc.delete();
|
|
73
|
+
return { vertices, normals, indices, count: nbNodes };
|
|
74
|
+
}
|
|
75
|
+
static discretizeEdgeRaw(edge) {
|
|
76
|
+
const oc = getOC();
|
|
77
|
+
const ocEdge = oc.TopoDS.Edge(edge);
|
|
78
|
+
const adaptor = new oc.BRepAdaptor_Curve(ocEdge);
|
|
79
|
+
const type = adaptor.GetType();
|
|
80
|
+
const first = adaptor.FirstParameter();
|
|
81
|
+
const last = adaptor.LastParameter();
|
|
82
|
+
const points = [];
|
|
83
|
+
if (type === oc.GeomAbs_CurveType.GeomAbs_Line) {
|
|
84
|
+
const startPnt = adaptor.Value(first);
|
|
85
|
+
const endPnt = adaptor.Value(last);
|
|
86
|
+
points.push(startPnt.X(), startPnt.Y(), startPnt.Z());
|
|
87
|
+
points.push(endPnt.X(), endPnt.Y(), endPnt.Z());
|
|
88
|
+
startPnt.delete();
|
|
89
|
+
endPnt.delete();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const numSegments = Math.max(1, Math.floor((last - first) / 0.01));
|
|
93
|
+
for (let i = 0; i <= numSegments; i++) {
|
|
94
|
+
const t = first + ((last - first) * i) / numSegments;
|
|
95
|
+
const pnt = adaptor.Value(t);
|
|
96
|
+
points.push(pnt.X(), pnt.Y(), pnt.Z());
|
|
97
|
+
pnt.delete();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
adaptor.delete();
|
|
101
|
+
ocEdge.delete();
|
|
102
|
+
const pointCount = points.length / 3;
|
|
103
|
+
const indices = [];
|
|
104
|
+
for (let i = 0; i < pointCount - 1; i++) {
|
|
105
|
+
indices[2 * i] = i;
|
|
106
|
+
indices[2 * i + 1] = i + 1;
|
|
107
|
+
}
|
|
108
|
+
return { vertices: points, normals: [], indices };
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
import { Solid } from "../common/solid.js";
|
|
3
|
+
import { Explorer } from "./explorer.js";
|
|
4
|
+
export class Primitives {
|
|
5
|
+
static makeCylinder(radius, height) {
|
|
6
|
+
const oc = getOC();
|
|
7
|
+
const cylinderMaker = new oc.BRepPrimAPI_MakeCylinder(radius, height);
|
|
8
|
+
const shape = cylinderMaker.Shape();
|
|
9
|
+
cylinderMaker.delete();
|
|
10
|
+
return Solid.fromTopoDSSolid(Explorer.toSolid(shape));
|
|
11
|
+
}
|
|
12
|
+
static makeSphere(radius, angle) {
|
|
13
|
+
const oc = getOC();
|
|
14
|
+
const sphereMaker = new oc.BRepPrimAPI_MakeSphere(radius, angle);
|
|
15
|
+
const sphere = sphereMaker.Shape();
|
|
16
|
+
sphereMaker.delete();
|
|
17
|
+
return Solid.fromTopoDSSolid(Explorer.toSolid(sphere));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TopoDS_Shape } from "occjs-wrapper";
|
|
2
|
+
export interface ShapeProperties {
|
|
3
|
+
volumeMm3: number;
|
|
4
|
+
surfaceAreaMm2: number;
|
|
5
|
+
centroid: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare class ShapeProps {
|
|
12
|
+
static getProperties(shape: TopoDS_Shape): ShapeProperties;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
export class ShapeProps {
|
|
3
|
+
static getProperties(shape) {
|
|
4
|
+
const oc = getOC();
|
|
5
|
+
const volumeProps = new oc.GProp_GProps();
|
|
6
|
+
oc.BRepGProp.VolumeProperties(shape, volumeProps, false, false, false);
|
|
7
|
+
const volumeMm3 = volumeProps.Mass();
|
|
8
|
+
const cog = volumeProps.CentreOfMass();
|
|
9
|
+
const centroid = { x: cog.X(), y: cog.Y(), z: cog.Z() };
|
|
10
|
+
cog.delete();
|
|
11
|
+
volumeProps.delete();
|
|
12
|
+
const surfaceProps = new oc.GProp_GProps();
|
|
13
|
+
oc.BRepGProp.SurfaceProperties(shape, surfaceProps, false, false);
|
|
14
|
+
const surfaceAreaMm2 = surfaceProps.Mass();
|
|
15
|
+
surfaceProps.delete();
|
|
16
|
+
return { volumeMm3, surfaceAreaMm2, centroid };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TopTools_ListOfShape, TopoDS_Edge, TopoDS_Face, TopoDS_Shape, TopoDS_Solid } from "occjs-wrapper";
|
|
2
|
+
import { Matrix4 } from "../math/matrix4.js";
|
|
3
|
+
import { Vector3d } from "../math/vector3d.js";
|
|
4
|
+
import { Shape } from "../common/shape.js";
|
|
5
|
+
import { Face } from "../common/face.js";
|
|
6
|
+
import { Solid } from "../common/solid.js";
|
|
7
|
+
import { BoundingBox } from "../helpers/types.js";
|
|
8
|
+
import { Axis } from "../math/axis.js";
|
|
9
|
+
export declare class ShapeOps {
|
|
10
|
+
static transform(shape: Shape, matrix: Matrix4): Shape;
|
|
11
|
+
static getBoundingBox(shape: Shape | TopoDS_Shape): BoundingBox;
|
|
12
|
+
static getBoundingBoxRaw(shape: TopoDS_Shape): BoundingBox;
|
|
13
|
+
static makeCompound(shapes: Shape[]): Shape;
|
|
14
|
+
static makeCompoundRaw(shapes: TopoDS_Shape[]): import("occjs-wrapper").TopoDS_Compound;
|
|
15
|
+
static cleanShape(shape: Shape): Shape;
|
|
16
|
+
static cleanShapeRaw(shape: TopoDS_Shape): TopoDS_Shape;
|
|
17
|
+
static getSolidOutwardNormal(face: Face, solid: Solid): Vector3d;
|
|
18
|
+
static getSolidOutwardNormalRaw(face: TopoDS_Face, solid: TopoDS_Solid): Vector3d;
|
|
19
|
+
static mirrorShape(shape: Shape, mirrorPoint: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
}): Shape;
|
|
24
|
+
static mirrorShapeRaw(shape: TopoDS_Shape, mirrorPoint: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
z: number;
|
|
28
|
+
}): TopoDS_Shape;
|
|
29
|
+
static translateShape(shape: Shape, direction: Vector3d): Shape;
|
|
30
|
+
static translateShapeRaw(shape: TopoDS_Shape, direction: Vector3d): TopoDS_Shape;
|
|
31
|
+
static rotateShape(shape: TopoDS_Shape, axis: Axis, angle: number): TopoDS_Shape;
|
|
32
|
+
static shapeListToArray(list: TopTools_ListOfShape): TopoDS_Shape[];
|
|
33
|
+
static edgeMiddlePoint(edge: TopoDS_Edge): import("occjs-wrapper").gp_Pnt;
|
|
34
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { getOC } from "./init.js";
|
|
2
|
+
import { Convert } from "./convert.js";
|
|
3
|
+
import { Vector3d } from "../math/vector3d.js";
|
|
4
|
+
import { Shape } from "../common/shape.js";
|
|
5
|
+
import { ShapeFactory } from "../common/shape-factory.js";
|
|
6
|
+
export class ShapeOps {
|
|
7
|
+
static transform(shape, matrix) {
|
|
8
|
+
const oc = getOC();
|
|
9
|
+
const [trsf, disposeTrsf] = Convert.toGpTrsf(matrix);
|
|
10
|
+
const transformer = new oc.BRepBuilderAPI_Transform(trsf);
|
|
11
|
+
transformer.Perform(shape.getShape(), true);
|
|
12
|
+
const raw = transformer.Shape();
|
|
13
|
+
const transformed = ShapeFactory.fromShape(raw);
|
|
14
|
+
if (shape.hasColors()) {
|
|
15
|
+
const sourceFaces = shape.getSubShapes("face");
|
|
16
|
+
for (const sourceFace of sourceFaces) {
|
|
17
|
+
const faceColor = shape.getColor(sourceFace.getShape());
|
|
18
|
+
if (faceColor) {
|
|
19
|
+
const modifiedFace = transformer.ModifiedShape(sourceFace.getShape());
|
|
20
|
+
transformed.setColor(modifiedFace, faceColor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (shape.isMetaShape()) {
|
|
25
|
+
transformed.markAsMetaShape(shape.metaType);
|
|
26
|
+
}
|
|
27
|
+
if (shape.isGuideShape()) {
|
|
28
|
+
transformed.markAsGuide();
|
|
29
|
+
}
|
|
30
|
+
transformer.delete();
|
|
31
|
+
disposeTrsf();
|
|
32
|
+
return transformed;
|
|
33
|
+
}
|
|
34
|
+
static getBoundingBox(shape) {
|
|
35
|
+
const raw = shape instanceof Shape ? shape.getShape() : shape;
|
|
36
|
+
return ShapeOps.getBoundingBoxRaw(raw);
|
|
37
|
+
}
|
|
38
|
+
static getBoundingBoxRaw(shape) {
|
|
39
|
+
const oc = getOC();
|
|
40
|
+
const bbox = new oc.Bnd_Box();
|
|
41
|
+
oc.BRepBndLib.Add(shape, bbox, true);
|
|
42
|
+
const minPnt = bbox.CornerMin();
|
|
43
|
+
const maxPnt = bbox.CornerMax();
|
|
44
|
+
bbox.delete();
|
|
45
|
+
return {
|
|
46
|
+
minX: minPnt.X(),
|
|
47
|
+
minY: minPnt.Y(),
|
|
48
|
+
minZ: minPnt.Z(),
|
|
49
|
+
maxX: maxPnt.X(),
|
|
50
|
+
maxY: maxPnt.Y(),
|
|
51
|
+
maxZ: maxPnt.Z(),
|
|
52
|
+
centerX: (minPnt.X() + maxPnt.X()) / 2,
|
|
53
|
+
centerY: (minPnt.Y() + maxPnt.Y()) / 2,
|
|
54
|
+
centerZ: (minPnt.Z() + maxPnt.Z()) / 2,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
static makeCompound(shapes) {
|
|
58
|
+
const raw = ShapeOps.makeCompoundRaw(shapes.map(s => s.getShape()));
|
|
59
|
+
return ShapeFactory.fromShape(raw);
|
|
60
|
+
}
|
|
61
|
+
static makeCompoundRaw(shapes) {
|
|
62
|
+
const oc = getOC();
|
|
63
|
+
const compoundBuilder = new oc.BRep_Builder();
|
|
64
|
+
const compound = new oc.TopoDS_Compound();
|
|
65
|
+
compoundBuilder.MakeCompound(compound);
|
|
66
|
+
for (const shape of shapes) {
|
|
67
|
+
compoundBuilder.Add(compound, shape);
|
|
68
|
+
}
|
|
69
|
+
return compound;
|
|
70
|
+
}
|
|
71
|
+
static cleanShape(shape) {
|
|
72
|
+
return ShapeFactory.fromShape(ShapeOps.cleanShapeRaw(shape.getShape()));
|
|
73
|
+
}
|
|
74
|
+
static cleanShapeRaw(shape) {
|
|
75
|
+
const oc = getOC();
|
|
76
|
+
// Full unification: merge redundant edges AND co-surface faces
|
|
77
|
+
const unify = new oc.ShapeUpgrade_UnifySameDomain(shape, false, true, false);
|
|
78
|
+
unify.Build();
|
|
79
|
+
let cleaned = unify.Shape();
|
|
80
|
+
unify.delete();
|
|
81
|
+
// Validate — UnifySameDomain can corrupt periodic surfaces (e.g. cylinders)
|
|
82
|
+
const checker = new oc.BRepCheck_Analyzer(cleaned, true, true);
|
|
83
|
+
if (checker.IsValid()) {
|
|
84
|
+
checker.delete();
|
|
85
|
+
return cleaned;
|
|
86
|
+
}
|
|
87
|
+
checker.delete();
|
|
88
|
+
// Repair with ShapeFix_Shape (fixes seam edges, wire orientation, SameParameter)
|
|
89
|
+
const fixer = new oc.ShapeFix_Shape(cleaned);
|
|
90
|
+
const progress = new oc.Message_ProgressRange();
|
|
91
|
+
fixer.Perform(progress);
|
|
92
|
+
const fixed = fixer.Shape();
|
|
93
|
+
fixer.delete();
|
|
94
|
+
progress.delete();
|
|
95
|
+
return fixed;
|
|
96
|
+
}
|
|
97
|
+
static getSolidOutwardNormal(face, solid) {
|
|
98
|
+
return ShapeOps.getSolidOutwardNormalRaw(face.getShape(), solid.getShape());
|
|
99
|
+
}
|
|
100
|
+
static getSolidOutwardNormalRaw(face, solid) {
|
|
101
|
+
const oc = getOC();
|
|
102
|
+
const surfaceAdaptor = new oc.BRepAdaptor_Surface(face, true);
|
|
103
|
+
const type = surfaceAdaptor.GetType();
|
|
104
|
+
if (type !== oc.GeomAbs_SurfaceType.GeomAbs_Plane) {
|
|
105
|
+
surfaceAdaptor.delete();
|
|
106
|
+
throw new Error("Non-planar faces not supported for normal calculation");
|
|
107
|
+
}
|
|
108
|
+
const uFirst = surfaceAdaptor.FirstUParameter();
|
|
109
|
+
const uLast = surfaceAdaptor.LastUParameter();
|
|
110
|
+
const vFirst = surfaceAdaptor.FirstVParameter();
|
|
111
|
+
const vLast = surfaceAdaptor.LastVParameter();
|
|
112
|
+
const u = (uFirst + uLast) / 2.0;
|
|
113
|
+
const v = (vFirst + vLast) / 2.0;
|
|
114
|
+
const testPoint = new oc.gp_Pnt();
|
|
115
|
+
const du = new oc.gp_Vec();
|
|
116
|
+
const dv = new oc.gp_Vec();
|
|
117
|
+
surfaceAdaptor.D1(u, v, testPoint, du, dv);
|
|
118
|
+
const geometricNormal = surfaceAdaptor.Plane().Position().Direction();
|
|
119
|
+
if (face.Orientation() === oc.TopAbs_Orientation.TopAbs_REVERSED) {
|
|
120
|
+
geometricNormal.Reverse();
|
|
121
|
+
}
|
|
122
|
+
const offset = 1e-6;
|
|
123
|
+
const testPointOffset = new oc.gp_Pnt(testPoint.X() + geometricNormal.X() * offset, testPoint.Y() + geometricNormal.Y() * offset, testPoint.Z() + geometricNormal.Z() * offset);
|
|
124
|
+
const classifier = new oc.BRepClass3d_SolidClassifier(solid, testPointOffset, oc.Precision.Confusion());
|
|
125
|
+
const state = classifier.State();
|
|
126
|
+
let result;
|
|
127
|
+
if (state === oc.TopAbs_State.TopAbs_IN) {
|
|
128
|
+
result = new Vector3d(-geometricNormal.X(), -geometricNormal.Y(), -geometricNormal.Z());
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
result = new Vector3d(geometricNormal.X(), geometricNormal.Y(), geometricNormal.Z());
|
|
132
|
+
}
|
|
133
|
+
classifier.delete();
|
|
134
|
+
testPointOffset.delete();
|
|
135
|
+
geometricNormal.delete();
|
|
136
|
+
du.delete();
|
|
137
|
+
dv.delete();
|
|
138
|
+
testPoint.delete();
|
|
139
|
+
surfaceAdaptor.delete();
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
static mirrorShape(shape, mirrorPoint) {
|
|
143
|
+
const result = ShapeOps.mirrorShapeRaw(shape.getShape(), mirrorPoint);
|
|
144
|
+
return ShapeFactory.fromShape(result);
|
|
145
|
+
}
|
|
146
|
+
static mirrorShapeRaw(shape, mirrorPoint) {
|
|
147
|
+
const oc = getOC();
|
|
148
|
+
const point = new oc.gp_Pnt(mirrorPoint.x, mirrorPoint.y, mirrorPoint.z);
|
|
149
|
+
const trsf = new oc.gp_Trsf();
|
|
150
|
+
trsf.SetMirror(point);
|
|
151
|
+
const transformer = new oc.BRepBuilderAPI_Transform(trsf);
|
|
152
|
+
transformer.Perform(shape, true);
|
|
153
|
+
const result = transformer.Shape();
|
|
154
|
+
transformer.delete();
|
|
155
|
+
trsf.delete();
|
|
156
|
+
point.delete();
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
static translateShape(shape, direction) {
|
|
160
|
+
const result = ShapeOps.translateShapeRaw(shape.getShape(), direction);
|
|
161
|
+
return ShapeFactory.fromShape(result);
|
|
162
|
+
}
|
|
163
|
+
static translateShapeRaw(shape, direction) {
|
|
164
|
+
const oc = getOC();
|
|
165
|
+
const [vec, disposeVec] = Convert.toGpVec(direction);
|
|
166
|
+
const trsf = new oc.gp_Trsf();
|
|
167
|
+
trsf.SetTranslation(vec);
|
|
168
|
+
const transformer = new oc.BRepBuilderAPI_Transform(trsf);
|
|
169
|
+
transformer.Perform(shape, false);
|
|
170
|
+
const result = transformer.Shape();
|
|
171
|
+
transformer.delete();
|
|
172
|
+
trsf.delete();
|
|
173
|
+
disposeVec();
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
static rotateShape(shape, axis, angle) {
|
|
177
|
+
const oc = getOC();
|
|
178
|
+
const trsf = new oc.gp_Trsf();
|
|
179
|
+
const [gpAxis, disposeGpAxis] = Convert.toGpAx1(axis);
|
|
180
|
+
trsf.SetRotation(gpAxis, angle);
|
|
181
|
+
const transformer = new oc.BRepBuilderAPI_Transform(trsf);
|
|
182
|
+
transformer.Perform(shape, false);
|
|
183
|
+
const result = transformer.Shape();
|
|
184
|
+
transformer.delete();
|
|
185
|
+
trsf.delete();
|
|
186
|
+
disposeGpAxis();
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
static shapeListToArray(list) {
|
|
190
|
+
let res = [];
|
|
191
|
+
while (list.Size() > 0) {
|
|
192
|
+
res.push(list.First());
|
|
193
|
+
list.RemoveFirst();
|
|
194
|
+
}
|
|
195
|
+
list.delete();
|
|
196
|
+
return res;
|
|
197
|
+
}
|
|
198
|
+
static edgeMiddlePoint(edge) {
|
|
199
|
+
const oc = getOC();
|
|
200
|
+
const curveAdaptor = new oc.BRepAdaptor_Curve(oc.TopoDS.Edge(edge));
|
|
201
|
+
const curve = curveAdaptor.Curve();
|
|
202
|
+
const midParam = (curve.FirstParameter() + curve.LastParameter()) / 2.0;
|
|
203
|
+
const midPoint = curve.Value(midParam);
|
|
204
|
+
const result = new oc.gp_Pnt(midPoint.X(), midPoint.Y(), midPoint.Z());
|
|
205
|
+
curveAdaptor.delete();
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
}
|