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,119 @@
|
|
|
1
|
+
import { Point2D } from "../../math/point.js";
|
|
2
|
+
import { Geometry } from "../../oc/geometry.js";
|
|
3
|
+
import { rad } from "../../helpers/math-helpers.js";
|
|
4
|
+
import { ExtrudableGeometryBase } from "./extrudable-base.js";
|
|
5
|
+
export class Slot extends ExtrudableGeometryBase {
|
|
6
|
+
distance;
|
|
7
|
+
radius;
|
|
8
|
+
_center = false;
|
|
9
|
+
_angle = 0;
|
|
10
|
+
constructor(distance, radius, targetPlane = null) {
|
|
11
|
+
super(targetPlane);
|
|
12
|
+
this.distance = distance;
|
|
13
|
+
this.radius = radius;
|
|
14
|
+
}
|
|
15
|
+
center(value = true) {
|
|
16
|
+
this._center = value;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
rotate(angle) {
|
|
20
|
+
this._angle = angle;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
build() {
|
|
24
|
+
if (this.distance < 0) {
|
|
25
|
+
throw new Error("Slot distance must be positive");
|
|
26
|
+
}
|
|
27
|
+
const plane = this.targetPlane?.getPlane() || this.getParent().getPlane();
|
|
28
|
+
const localToWorld = plane.localToWorld.bind(plane);
|
|
29
|
+
let leftCenter = this.targetPlane
|
|
30
|
+
? plane.worldToLocal(this.targetPlane.getPlaneCenter())
|
|
31
|
+
: this.getCurrentPosition();
|
|
32
|
+
if (this._center) {
|
|
33
|
+
const angleRad = rad(this._angle);
|
|
34
|
+
const cos = Math.cos(angleRad);
|
|
35
|
+
const sin = Math.sin(angleRad);
|
|
36
|
+
leftCenter = leftCenter.translate(-this.distance / 2 * cos, -this.distance / 2 * sin);
|
|
37
|
+
}
|
|
38
|
+
const angleRad = rad(this._angle);
|
|
39
|
+
const cos = Math.cos(angleRad);
|
|
40
|
+
const sin = Math.sin(angleRad);
|
|
41
|
+
// Direction along the slot axis
|
|
42
|
+
const dirX = cos;
|
|
43
|
+
const dirY = sin;
|
|
44
|
+
// Perpendicular direction (90 degrees CCW)
|
|
45
|
+
const perpX = -sin;
|
|
46
|
+
const perpY = cos;
|
|
47
|
+
const rightCenter = new Point2D(leftCenter.x + this.distance * dirX, leftCenter.y + this.distance * dirY);
|
|
48
|
+
// Four key points where lines meet arcs
|
|
49
|
+
const topLeft = new Point2D(leftCenter.x + this.radius * perpX, leftCenter.y + this.radius * perpY);
|
|
50
|
+
const topRight = new Point2D(rightCenter.x + this.radius * perpX, rightCenter.y + this.radius * perpY);
|
|
51
|
+
const bottomRight = new Point2D(rightCenter.x - this.radius * perpX, rightCenter.y - this.radius * perpY);
|
|
52
|
+
const bottomLeft = new Point2D(leftCenter.x - this.radius * perpX, leftCenter.y - this.radius * perpY);
|
|
53
|
+
// Top line: topLeft -> topRight
|
|
54
|
+
const topSegment = Geometry.makeSegment(localToWorld(topLeft), localToWorld(topRight));
|
|
55
|
+
// Right arc: topRight -> bottomRight (CW semicircle around rightCenter)
|
|
56
|
+
const rightArc = Geometry.makeArc(localToWorld(rightCenter), this.radius, plane.normal.negate(), localToWorld(topRight), localToWorld(bottomRight));
|
|
57
|
+
// Bottom line: bottomRight -> bottomLeft
|
|
58
|
+
const bottomSegment = Geometry.makeSegment(localToWorld(bottomRight), localToWorld(bottomLeft));
|
|
59
|
+
// Left arc: bottomLeft -> topLeft (CW semicircle around leftCenter)
|
|
60
|
+
const leftArc = Geometry.makeArc(localToWorld(leftCenter), this.radius, plane.normal.negate(), localToWorld(bottomLeft), localToWorld(topLeft));
|
|
61
|
+
const edges = [
|
|
62
|
+
Geometry.makeEdge(topSegment),
|
|
63
|
+
Geometry.makeEdgeFromCurve(rightArc),
|
|
64
|
+
Geometry.makeEdge(bottomSegment),
|
|
65
|
+
Geometry.makeEdgeFromCurve(leftArc),
|
|
66
|
+
];
|
|
67
|
+
this.addShapes(edges);
|
|
68
|
+
if (this.sketch) {
|
|
69
|
+
if (this._center) {
|
|
70
|
+
this.setCurrentPosition(this.getCurrentPosition());
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.setCurrentPosition(leftCenter);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (this.targetPlane) {
|
|
77
|
+
this.targetPlane.removeShapes(this);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
getType() {
|
|
81
|
+
return 'slot';
|
|
82
|
+
}
|
|
83
|
+
getDependencies() {
|
|
84
|
+
return this.targetPlane ? [this.targetPlane] : [];
|
|
85
|
+
}
|
|
86
|
+
createCopy(remap) {
|
|
87
|
+
const targetPlane = this.targetPlane ? (remap.get(this.targetPlane) || this.targetPlane) : null;
|
|
88
|
+
const s = new Slot(this.distance, this.radius, targetPlane);
|
|
89
|
+
s.center(this._center);
|
|
90
|
+
s.rotate(this._angle);
|
|
91
|
+
return s;
|
|
92
|
+
}
|
|
93
|
+
compareTo(other) {
|
|
94
|
+
if (!(other instanceof Slot)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (!super.compareTo(other)) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (this.targetPlane?.constructor !== other.targetPlane?.constructor) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (this.targetPlane && other.targetPlane && !this.targetPlane.compareTo(other.targetPlane)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return this.distance === other.distance &&
|
|
107
|
+
this.radius === other.radius &&
|
|
108
|
+
this._center === other._center &&
|
|
109
|
+
this._angle === other._angle;
|
|
110
|
+
}
|
|
111
|
+
serialize() {
|
|
112
|
+
return {
|
|
113
|
+
distance: this.distance,
|
|
114
|
+
radius: this.radius,
|
|
115
|
+
center: this._center,
|
|
116
|
+
angle: this._angle,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
import { ITangentArcTwoObjects } from "../../core/interfaces.js";
|
|
5
|
+
export declare class TangentArcTwoObjects extends GeometrySceneObject implements ITangentArcTwoObjects {
|
|
6
|
+
c1: QualifiedSceneObject;
|
|
7
|
+
c2: QualifiedSceneObject;
|
|
8
|
+
radius: number;
|
|
9
|
+
mustTouch: boolean;
|
|
10
|
+
constructor(c1: QualifiedSceneObject, c2: QualifiedSceneObject, radius: number, mustTouch: boolean);
|
|
11
|
+
build(): void;
|
|
12
|
+
start(index?: number): LazyVertex;
|
|
13
|
+
end(index?: number): LazyVertex;
|
|
14
|
+
compareTo(other: TangentArcTwoObjects): boolean;
|
|
15
|
+
getType(): string;
|
|
16
|
+
getUniqueType(): string;
|
|
17
|
+
serialize(): {
|
|
18
|
+
radius: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
import { Vertex } from "../../common/vertex.js";
|
|
4
|
+
import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
|
|
5
|
+
export class TangentArcTwoObjects extends GeometrySceneObject {
|
|
6
|
+
c1;
|
|
7
|
+
c2;
|
|
8
|
+
radius;
|
|
9
|
+
mustTouch;
|
|
10
|
+
constructor(c1, c2, radius, mustTouch) {
|
|
11
|
+
super();
|
|
12
|
+
this.c1 = c1;
|
|
13
|
+
this.c2 = c2;
|
|
14
|
+
this.radius = radius;
|
|
15
|
+
this.mustTouch = mustTouch;
|
|
16
|
+
}
|
|
17
|
+
build() {
|
|
18
|
+
const plane = this.sketch.getPlane();
|
|
19
|
+
const solver = createConstraintSolver(this.mustTouch);
|
|
20
|
+
const results = solver.getTangentArcs(plane, this.c1.toQualifiedShape(), this.c2.toQualifiedShape(), this.radius);
|
|
21
|
+
for (let i = 0; i < results.edges.length; i++) {
|
|
22
|
+
this.setState(`edge-${i}`, results.edges[i]);
|
|
23
|
+
}
|
|
24
|
+
if (results.edges.length > 0) {
|
|
25
|
+
const lastEdge = results.edges[results.edges.length - 1];
|
|
26
|
+
const endTangent = results.endTangent;
|
|
27
|
+
const firstVertex = lastEdge.getFirstVertex();
|
|
28
|
+
const lastVertex = lastEdge.getLastVertex();
|
|
29
|
+
const localStart = plane.worldToLocal(firstVertex.toPoint());
|
|
30
|
+
const localEnd = plane.worldToLocal(lastVertex.toPoint());
|
|
31
|
+
this.setState('start', Vertex.fromPoint2D(localStart));
|
|
32
|
+
this.setState('end', Vertex.fromPoint2D(localEnd));
|
|
33
|
+
this.setTangent(endTangent);
|
|
34
|
+
this.setCurrentPosition(localEnd);
|
|
35
|
+
}
|
|
36
|
+
this.addShapes(results.edges);
|
|
37
|
+
}
|
|
38
|
+
start(index = 0) {
|
|
39
|
+
return new LazyVertex(this.generateUniqueName(`start-vertex-${index}`), () => [this.getState('start')]);
|
|
40
|
+
}
|
|
41
|
+
end(index = 0) {
|
|
42
|
+
return new LazyVertex(this.generateUniqueName(`end-vertex-${index}`), () => [this.getState('end')]);
|
|
43
|
+
}
|
|
44
|
+
compareTo(other) {
|
|
45
|
+
if (!(other instanceof TangentArcTwoObjects)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return this.c1.compareTo(other.c1) &&
|
|
49
|
+
this.c2.compareTo(other.c2) &&
|
|
50
|
+
this.radius === other.radius &&
|
|
51
|
+
this.mustTouch === other.mustTouch;
|
|
52
|
+
}
|
|
53
|
+
getType() {
|
|
54
|
+
return 'tarc';
|
|
55
|
+
}
|
|
56
|
+
getUniqueType() {
|
|
57
|
+
return 'two-objects-tarc';
|
|
58
|
+
}
|
|
59
|
+
serialize() {
|
|
60
|
+
return {
|
|
61
|
+
radius: this.radius
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
export declare class TangentArcToPointTangent extends GeometrySceneObject {
|
|
4
|
+
endPoint: LazyVertex;
|
|
5
|
+
startTangent: LazyVertex;
|
|
6
|
+
constructor(endPoint: LazyVertex, startTangent: LazyVertex);
|
|
7
|
+
build(): void;
|
|
8
|
+
compareTo(other: TangentArcToPointTangent): boolean;
|
|
9
|
+
getType(): string;
|
|
10
|
+
getUniqueType(): string;
|
|
11
|
+
serialize(): {
|
|
12
|
+
endPoint: {};
|
|
13
|
+
startTangent: {};
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Vertex } from "../../common/vertex.js";
|
|
2
|
+
import { Geometry } from "../../oc/geometry.js";
|
|
3
|
+
import { Point2D } from "../../math/point.js";
|
|
4
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
5
|
+
export class TangentArcToPointTangent extends GeometrySceneObject {
|
|
6
|
+
endPoint;
|
|
7
|
+
startTangent;
|
|
8
|
+
constructor(endPoint, startTangent) {
|
|
9
|
+
super();
|
|
10
|
+
this.endPoint = endPoint;
|
|
11
|
+
this.startTangent = startTangent;
|
|
12
|
+
}
|
|
13
|
+
build() {
|
|
14
|
+
const plane = this.sketch.getPlane();
|
|
15
|
+
let startPoint = this.getCurrentPosition();
|
|
16
|
+
let targetPoint = this.endPoint.asPoint2D();
|
|
17
|
+
let tangent = this.startTangent.asPoint2D();
|
|
18
|
+
// Normal to start tangent (perpendicular, pointing left for CCW)
|
|
19
|
+
const norm = tangent.normalize();
|
|
20
|
+
const perpendicular = new Point2D(-norm.y, norm.x);
|
|
21
|
+
// Find circle center using perpendicular bisector constraint:
|
|
22
|
+
// Center lies on perpendicular to tangent through start, equidistant from both points
|
|
23
|
+
const d = startPoint.subtract(targetPoint);
|
|
24
|
+
const distSq = startPoint.distanceToSquared(targetPoint);
|
|
25
|
+
const dDotN = d.x * perpendicular.x + d.y * perpendicular.y;
|
|
26
|
+
if (Math.abs(dDotN) < 1e-10) {
|
|
27
|
+
throw new Error('TangentArcToPointTangent: endpoint is collinear with tangent direction');
|
|
28
|
+
}
|
|
29
|
+
// Signed parameter: positive = CCW, negative = CW
|
|
30
|
+
const t = -distSq / (2 * dDotN);
|
|
31
|
+
const radius = Math.abs(t);
|
|
32
|
+
const cw = t < 0;
|
|
33
|
+
const centerPoint = startPoint.add(perpendicular.multiplyScalar(t));
|
|
34
|
+
// Compute angles on the circle
|
|
35
|
+
const startAngle = Math.atan2(startPoint.y - centerPoint.y, startPoint.x - centerPoint.x);
|
|
36
|
+
const endAngle = Math.atan2(targetPoint.y - centerPoint.y, targetPoint.x - centerPoint.x);
|
|
37
|
+
let sweep = endAngle - startAngle;
|
|
38
|
+
if (cw) {
|
|
39
|
+
if (sweep > 0) {
|
|
40
|
+
sweep -= 2 * Math.PI;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
if (sweep < 0) {
|
|
45
|
+
sweep += 2 * Math.PI;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const normal = cw ? plane.normal.negate() : plane.normal;
|
|
49
|
+
const center = plane.localToWorld(centerPoint);
|
|
50
|
+
const start = plane.localToWorld(startPoint);
|
|
51
|
+
const end = plane.localToWorld(targetPoint);
|
|
52
|
+
const arc = Geometry.makeArc(center, radius, normal, start, end);
|
|
53
|
+
const edge = Geometry.makeEdgeFromCurve(arc);
|
|
54
|
+
// Tangent at end: perpendicular to radius direction at end point
|
|
55
|
+
// CCW: (-sin θ, cos θ), CW: (sin θ, -cos θ)
|
|
56
|
+
const sign = cw ? -1 : 1;
|
|
57
|
+
const endTx = sign * (-Math.sin(endAngle));
|
|
58
|
+
const endTy = sign * Math.cos(endAngle);
|
|
59
|
+
this.setTangent(new Point2D(endTx, endTy));
|
|
60
|
+
this.setState('start', Vertex.fromPoint2D(startPoint));
|
|
61
|
+
this.setState('end', Vertex.fromPoint2D(targetPoint));
|
|
62
|
+
this.addShape(edge);
|
|
63
|
+
this.setCurrentPosition(targetPoint);
|
|
64
|
+
}
|
|
65
|
+
compareTo(other) {
|
|
66
|
+
if (!(other instanceof TangentArcToPointTangent)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (!super.compareTo(other)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return this.endPoint.compareTo(other.endPoint) && this.startTangent.compareTo(other.startTangent);
|
|
73
|
+
}
|
|
74
|
+
getType() {
|
|
75
|
+
return 'tarc';
|
|
76
|
+
}
|
|
77
|
+
getUniqueType() {
|
|
78
|
+
return 'tarc-to-point-tangent';
|
|
79
|
+
}
|
|
80
|
+
serialize() {
|
|
81
|
+
return {
|
|
82
|
+
endPoint: this.endPoint.serialize(),
|
|
83
|
+
startTangent: this.startTangent.serialize()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
export declare class TangentArcToPoint extends GeometrySceneObject {
|
|
4
|
+
endPoint: LazyVertex;
|
|
5
|
+
constructor(endPoint: LazyVertex);
|
|
6
|
+
build(): void;
|
|
7
|
+
compareTo(other: TangentArcToPoint): boolean;
|
|
8
|
+
getType(): string;
|
|
9
|
+
getUniqueType(): string;
|
|
10
|
+
serialize(): {
|
|
11
|
+
endPoint: {};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Vertex } from "../../common/vertex.js";
|
|
2
|
+
import { Geometry } from "../../oc/geometry.js";
|
|
3
|
+
import { Point2D } from "../../math/point.js";
|
|
4
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
5
|
+
export class TangentArcToPoint extends GeometrySceneObject {
|
|
6
|
+
endPoint;
|
|
7
|
+
constructor(endPoint) {
|
|
8
|
+
super();
|
|
9
|
+
this.endPoint = endPoint;
|
|
10
|
+
}
|
|
11
|
+
build() {
|
|
12
|
+
const tangent = this.sketch.getTangentAt(this);
|
|
13
|
+
if (!tangent) {
|
|
14
|
+
throw new Error('TangentArcToPoint requires a previous sibling with a tangent');
|
|
15
|
+
}
|
|
16
|
+
const plane = this.sketch.getPlane();
|
|
17
|
+
const startPoint = this.getCurrentPosition();
|
|
18
|
+
const targetPoint = this.endPoint.asPoint2D();
|
|
19
|
+
// Normal to tangent (perpendicular, pointing left for CCW)
|
|
20
|
+
const norm = tangent.normalize();
|
|
21
|
+
const perpendicular = new Point2D(-norm.y, norm.x);
|
|
22
|
+
// Find circle center using perpendicular bisector constraint:
|
|
23
|
+
// Center lies on perpendicular to tangent through start, equidistant from both points
|
|
24
|
+
const d = startPoint.subtract(targetPoint);
|
|
25
|
+
const distSq = startPoint.distanceToSquared(targetPoint);
|
|
26
|
+
const dDotN = d.x * perpendicular.x + d.y * perpendicular.y;
|
|
27
|
+
if (Math.abs(dDotN) < 1e-10) {
|
|
28
|
+
throw new Error('TangentArcToPoint: endpoint is collinear with tangent direction');
|
|
29
|
+
}
|
|
30
|
+
// Signed parameter: positive = CCW, negative = CW
|
|
31
|
+
const t = -distSq / (2 * dDotN);
|
|
32
|
+
const radius = Math.abs(t);
|
|
33
|
+
const cw = t < 0;
|
|
34
|
+
const centerPoint = startPoint.add(perpendicular.multiplyScalar(t));
|
|
35
|
+
// Compute angles on the circle
|
|
36
|
+
const startAngle = Math.atan2(startPoint.y - centerPoint.y, startPoint.x - centerPoint.x);
|
|
37
|
+
const endAngle = Math.atan2(targetPoint.y - centerPoint.y, targetPoint.x - centerPoint.x);
|
|
38
|
+
let sweep = endAngle - startAngle;
|
|
39
|
+
if (cw) {
|
|
40
|
+
if (sweep > 0) {
|
|
41
|
+
sweep -= 2 * Math.PI;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (sweep < 0) {
|
|
46
|
+
sweep += 2 * Math.PI;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const normal = cw ? plane.normal.negate() : plane.normal;
|
|
50
|
+
const center = plane.localToWorld(centerPoint);
|
|
51
|
+
const start = plane.localToWorld(startPoint);
|
|
52
|
+
const end = plane.localToWorld(targetPoint);
|
|
53
|
+
const arc = Geometry.makeArc(center, radius, normal, start, end);
|
|
54
|
+
const edge = Geometry.makeEdgeFromCurve(arc);
|
|
55
|
+
// Tangent at end: perpendicular to radius direction at end point
|
|
56
|
+
// CCW: (-sin θ, cos θ), CW: (sin θ, -cos θ)
|
|
57
|
+
const sign = cw ? -1 : 1;
|
|
58
|
+
const endTx = sign * (-Math.sin(endAngle));
|
|
59
|
+
const endTy = sign * Math.cos(endAngle);
|
|
60
|
+
this.setTangent(new Point2D(endTx, endTy));
|
|
61
|
+
this.setState('start', Vertex.fromPoint2D(startPoint));
|
|
62
|
+
this.setState('end', Vertex.fromPoint2D(targetPoint));
|
|
63
|
+
this.addShape(edge);
|
|
64
|
+
this.setCurrentPosition(targetPoint);
|
|
65
|
+
}
|
|
66
|
+
compareTo(other) {
|
|
67
|
+
if (!(other instanceof TangentArcToPoint)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!super.compareTo(other)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return this.endPoint.compareTo(other.endPoint);
|
|
74
|
+
}
|
|
75
|
+
getType() {
|
|
76
|
+
return 'tarc';
|
|
77
|
+
}
|
|
78
|
+
getUniqueType() {
|
|
79
|
+
return 'tarc-to-point';
|
|
80
|
+
}
|
|
81
|
+
serialize() {
|
|
82
|
+
return {
|
|
83
|
+
endPoint: this.endPoint.serialize()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
export declare class TangentArcTwoObjects extends GeometrySceneObject {
|
|
5
|
+
c1: QualifiedSceneObject;
|
|
6
|
+
c2: QualifiedSceneObject;
|
|
7
|
+
radius: number;
|
|
8
|
+
constructor(c1: QualifiedSceneObject, c2: QualifiedSceneObject, radius: number);
|
|
9
|
+
build(): void;
|
|
10
|
+
start(index?: number): LazyVertex;
|
|
11
|
+
end(index?: number): LazyVertex;
|
|
12
|
+
compareTo(other: TangentArcTwoObjects): boolean;
|
|
13
|
+
getType(): string;
|
|
14
|
+
getUniqueType(): string;
|
|
15
|
+
serialize(): {
|
|
16
|
+
radius: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
|
+
import { Vertex } from "../../common/vertex.js";
|
|
4
|
+
import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
|
|
5
|
+
export class TangentArcTwoObjects extends GeometrySceneObject {
|
|
6
|
+
c1;
|
|
7
|
+
c2;
|
|
8
|
+
radius;
|
|
9
|
+
constructor(c1, c2, radius) {
|
|
10
|
+
super();
|
|
11
|
+
this.c1 = c1;
|
|
12
|
+
this.c2 = c2;
|
|
13
|
+
this.radius = radius;
|
|
14
|
+
}
|
|
15
|
+
build() {
|
|
16
|
+
const plane = this.sketch.getPlane();
|
|
17
|
+
const solver = createConstraintSolver();
|
|
18
|
+
const results = solver.getTangentArcs(plane, this.c1.toQualifiedShape(), this.c2.toQualifiedShape(), this.radius);
|
|
19
|
+
for (let i = 0; i < results.edges.length; i++) {
|
|
20
|
+
this.setState(`edge-${i}`, results.edges[i]);
|
|
21
|
+
}
|
|
22
|
+
if (results.edges.length > 0) {
|
|
23
|
+
const lastEdge = results.edges[results.edges.length - 1];
|
|
24
|
+
const endTangent = results.endTangent;
|
|
25
|
+
const firstVertex = lastEdge.getFirstVertex();
|
|
26
|
+
const lastVertex = lastEdge.getLastVertex();
|
|
27
|
+
const localStart = plane.worldToLocal(firstVertex.toPoint());
|
|
28
|
+
const localEnd = plane.worldToLocal(lastVertex.toPoint());
|
|
29
|
+
this.setState('start', Vertex.fromPoint2D(localStart));
|
|
30
|
+
this.setState('end', Vertex.fromPoint2D(localEnd));
|
|
31
|
+
this.setTangent(endTangent);
|
|
32
|
+
this.setCurrentPosition(localEnd);
|
|
33
|
+
}
|
|
34
|
+
this.addShapes(results.edges);
|
|
35
|
+
}
|
|
36
|
+
start(index = 0) {
|
|
37
|
+
return new LazyVertex(this.generateUniqueName(`start-vertex-${index}`), () => [this.getState('start')]);
|
|
38
|
+
}
|
|
39
|
+
end(index = 0) {
|
|
40
|
+
return new LazyVertex(this.generateUniqueName(`end-vertex-${index}`), () => [this.getState('end')]);
|
|
41
|
+
}
|
|
42
|
+
compareTo(other) {
|
|
43
|
+
if (!(other instanceof TangentArcTwoObjects)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return this.c1.compareTo(other.c1) &&
|
|
47
|
+
this.c2.compareTo(other.c2) &&
|
|
48
|
+
this.radius === other.radius;
|
|
49
|
+
}
|
|
50
|
+
getType() {
|
|
51
|
+
return 'tarc';
|
|
52
|
+
}
|
|
53
|
+
getUniqueType() {
|
|
54
|
+
return 'two-objects-tarc';
|
|
55
|
+
}
|
|
56
|
+
serialize() {
|
|
57
|
+
return {
|
|
58
|
+
radius: this.radius
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LazyVertex } from "../lazy-vertex.js";
|
|
2
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
3
|
+
export declare class TangentArcWithTangent extends GeometrySceneObject {
|
|
4
|
+
radius: number;
|
|
5
|
+
endAngle: number;
|
|
6
|
+
startTangent: LazyVertex;
|
|
7
|
+
constructor(radius: number, endAngle: number, startTangent: LazyVertex);
|
|
8
|
+
build(): void;
|
|
9
|
+
compareTo(other: TangentArcWithTangent): boolean;
|
|
10
|
+
getType(): string;
|
|
11
|
+
getUniqueType(): string;
|
|
12
|
+
serialize(): {
|
|
13
|
+
radius: number;
|
|
14
|
+
endAngle: number;
|
|
15
|
+
startTangent: {};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Vertex } from "../../common/vertex.js";
|
|
2
|
+
import { Geometry } from "../../oc/geometry.js";
|
|
3
|
+
import { rad } from "../../helpers/math-helpers.js";
|
|
4
|
+
import { Point2D } from "../../math/point.js";
|
|
5
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
6
|
+
export class TangentArcWithTangent extends GeometrySceneObject {
|
|
7
|
+
radius;
|
|
8
|
+
endAngle;
|
|
9
|
+
startTangent;
|
|
10
|
+
constructor(radius, endAngle, startTangent) {
|
|
11
|
+
super();
|
|
12
|
+
this.radius = radius;
|
|
13
|
+
this.endAngle = endAngle;
|
|
14
|
+
this.startTangent = startTangent;
|
|
15
|
+
}
|
|
16
|
+
build() {
|
|
17
|
+
const plane = this.sketch.getPlane();
|
|
18
|
+
const radius = this.radius;
|
|
19
|
+
const tangent = this.startTangent.asPoint2D();
|
|
20
|
+
// Derive the base angle from the provided tangent.
|
|
21
|
+
// Tangent at angle θ on a circle is (-sin θ, cos θ),
|
|
22
|
+
// so θ = atan2(-tx, ty).
|
|
23
|
+
const baseAngle = Math.atan2(-tangent.x, tangent.y);
|
|
24
|
+
const clampedEndAngle = Math.max(this.endAngle, -359.9999);
|
|
25
|
+
const cw = clampedEndAngle < 0;
|
|
26
|
+
const startAngleRad = cw ? baseAngle + Math.PI : baseAngle;
|
|
27
|
+
const endAngleRad = startAngleRad + rad(clampedEndAngle);
|
|
28
|
+
const normal = cw ? plane.normal.negate() : plane.normal;
|
|
29
|
+
const startPoint = this.getCurrentPosition();
|
|
30
|
+
const centerPoint = Geometry.getCircleCenter(startPoint, radius, startAngleRad);
|
|
31
|
+
const endPoint = Geometry.getPointOnCircle(centerPoint, radius, endAngleRad);
|
|
32
|
+
const center = plane.localToWorld(centerPoint);
|
|
33
|
+
const start = plane.localToWorld(startPoint);
|
|
34
|
+
const end = plane.localToWorld(endPoint);
|
|
35
|
+
const arc = Geometry.makeArc(center, radius, normal, start, end);
|
|
36
|
+
const edge = Geometry.makeEdgeFromCurve(arc);
|
|
37
|
+
this.setState('start', Vertex.fromPoint2D(startPoint));
|
|
38
|
+
this.setState('end', Vertex.fromPoint2D(endPoint));
|
|
39
|
+
// Tangent at end point: CCW: (-sin θ, cos θ), CW: (sin θ, -cos θ)
|
|
40
|
+
const sign = cw ? -1 : 1;
|
|
41
|
+
const tx = sign * (-Math.sin(endAngleRad));
|
|
42
|
+
const ty = sign * Math.cos(endAngleRad);
|
|
43
|
+
this.setTangent(new Point2D(tx, ty));
|
|
44
|
+
this.addShape(edge);
|
|
45
|
+
this.setCurrentPosition(endPoint);
|
|
46
|
+
}
|
|
47
|
+
compareTo(other) {
|
|
48
|
+
if (!(other instanceof TangentArcWithTangent)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (!super.compareTo(other)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return this.radius === other.radius &&
|
|
55
|
+
this.endAngle === other.endAngle &&
|
|
56
|
+
this.startTangent.compareTo(other.startTangent);
|
|
57
|
+
}
|
|
58
|
+
getType() {
|
|
59
|
+
return 'tarc';
|
|
60
|
+
}
|
|
61
|
+
getUniqueType() {
|
|
62
|
+
return 'tarc-with-tangent';
|
|
63
|
+
}
|
|
64
|
+
serialize() {
|
|
65
|
+
return {
|
|
66
|
+
radius: this.radius,
|
|
67
|
+
endAngle: this.endAngle,
|
|
68
|
+
startTangent: this.startTangent.serialize()
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
export declare class TangentArc extends GeometrySceneObject {
|
|
3
|
+
radius: number;
|
|
4
|
+
endAngle: number;
|
|
5
|
+
constructor(radius: number, endAngle: number);
|
|
6
|
+
build(): void;
|
|
7
|
+
compareTo(other: TangentArc): boolean;
|
|
8
|
+
getType(): string;
|
|
9
|
+
serialize(): {
|
|
10
|
+
radius: number;
|
|
11
|
+
endAngle: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Vertex } from "../../common/vertex.js";
|
|
2
|
+
import { Geometry } from "../../oc/geometry.js";
|
|
3
|
+
import { rad } from "../../helpers/math-helpers.js";
|
|
4
|
+
import { Point2D } from "../../math/point.js";
|
|
5
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
6
|
+
export class TangentArc extends GeometrySceneObject {
|
|
7
|
+
radius;
|
|
8
|
+
endAngle;
|
|
9
|
+
constructor(radius, endAngle) {
|
|
10
|
+
super();
|
|
11
|
+
this.radius = radius;
|
|
12
|
+
this.endAngle = endAngle;
|
|
13
|
+
}
|
|
14
|
+
build() {
|
|
15
|
+
const tangent = this.sketch.getTangentAt(this);
|
|
16
|
+
if (!tangent) {
|
|
17
|
+
throw new Error('TangentArc requires a previous sibling with a tangent');
|
|
18
|
+
}
|
|
19
|
+
const plane = this.sketch.getPlane();
|
|
20
|
+
const radius = this.radius;
|
|
21
|
+
// Derive the base angle from the previous sibling's tangent.
|
|
22
|
+
// Tangent at angle θ on a circle is (-sin θ, cos θ),
|
|
23
|
+
// so θ = atan2(-tx, ty).
|
|
24
|
+
const baseAngle = Math.atan2(-tangent.x, tangent.y);
|
|
25
|
+
// For CW (negative endAngle), flip the center to the opposite side
|
|
26
|
+
// and negate the normal so makeArc sweeps in reverse
|
|
27
|
+
// Clamp to avoid coincident start/end points at exactly ±360°
|
|
28
|
+
const clampedEndAngle = Math.max(this.endAngle, -359.9999);
|
|
29
|
+
const cw = clampedEndAngle < 0;
|
|
30
|
+
const startAngleRad = cw ? baseAngle + Math.PI : baseAngle;
|
|
31
|
+
const endAngleRad = startAngleRad + rad(clampedEndAngle);
|
|
32
|
+
const normal = cw ? plane.normal.negate() : plane.normal;
|
|
33
|
+
const startPoint = this.getCurrentPosition();
|
|
34
|
+
const centerPoint = Geometry.getCircleCenter(startPoint, radius, startAngleRad);
|
|
35
|
+
const endPoint = Geometry.getPointOnCircle(centerPoint, radius, endAngleRad);
|
|
36
|
+
const center = plane.localToWorld(centerPoint);
|
|
37
|
+
const start = plane.localToWorld(startPoint);
|
|
38
|
+
const end = plane.localToWorld(endPoint);
|
|
39
|
+
const arc = Geometry.makeArc(center, radius, normal, start, end);
|
|
40
|
+
const edge = Geometry.makeEdgeFromCurve(arc);
|
|
41
|
+
this.setState('start', Vertex.fromPoint2D(startPoint));
|
|
42
|
+
this.setState('end', Vertex.fromPoint2D(endPoint));
|
|
43
|
+
// get tangent vector at the end angle
|
|
44
|
+
// CCW: (-sin θ, cos θ), CW: (sin θ, -cos θ)
|
|
45
|
+
const sign = cw ? -1 : 1;
|
|
46
|
+
const tx = sign * (-Math.sin(endAngleRad));
|
|
47
|
+
const ty = sign * Math.cos(endAngleRad);
|
|
48
|
+
this.setTangent(new Point2D(tx, ty));
|
|
49
|
+
this.addShape(edge);
|
|
50
|
+
this.setCurrentPosition(endPoint);
|
|
51
|
+
}
|
|
52
|
+
compareTo(other) {
|
|
53
|
+
if (!(other instanceof TangentArc)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (!super.compareTo(other)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return this.radius === other.radius &&
|
|
60
|
+
this.endAngle === other.endAngle;
|
|
61
|
+
}
|
|
62
|
+
getType() {
|
|
63
|
+
return 'tarc';
|
|
64
|
+
}
|
|
65
|
+
serialize() {
|
|
66
|
+
return {
|
|
67
|
+
radius: this.radius,
|
|
68
|
+
endAngle: this.endAngle
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
3
|
+
export declare class TwoObjectsTangentCircle extends GeometrySceneObject {
|
|
4
|
+
c1: QualifiedSceneObject;
|
|
5
|
+
c2: QualifiedSceneObject;
|
|
6
|
+
diameter: number;
|
|
7
|
+
mustTouch: boolean;
|
|
8
|
+
constructor(c1: QualifiedSceneObject, c2: QualifiedSceneObject, diameter: number, mustTouch: boolean);
|
|
9
|
+
build(): void;
|
|
10
|
+
compareTo(other: TwoObjectsTangentCircle): boolean;
|
|
11
|
+
getType(): string;
|
|
12
|
+
getUniqueType(): string;
|
|
13
|
+
serialize(): {};
|
|
14
|
+
}
|