flo-mat 2.0.1 → 2.0.3
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/.eslintrc.cjs +69 -0
- package/README.md +9 -27
- package/browser/index.js +29604 -7008
- package/browser/index.min.js +1 -2
- package/node/circle.d.ts +20 -20
- package/node/circle.js +31 -31
- package/node/circle.js.map +1 -1
- package/node/compare-curvatures-at-interface.d.ts +19 -19
- package/node/compare-curvatures-at-interface.js +124 -124
- package/node/compare-curvatures-at-interface.js.map +1 -1
- package/node/contact-point.d.ts +26 -26
- package/node/contact-point.js +25 -25
- package/node/cp-node/clone.d.ts +8 -8
- package/node/cp-node/clone.js +31 -31
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/remove.d.ts +9 -9
- package/node/cp-node/remove.js +19 -19
- package/node/cp-node/remove.js.map +1 -1
- package/node/cp-node.d.ts +202 -202
- package/node/cp-node.js +320 -320
- package/node/cp-node.js.map +1 -1
- package/node/curve.d.ts +46 -46
- package/node/curve.js +88 -88
- package/node/curve.js.map +1 -1
- package/node/debug/cp-node-for-debugging.d.ts +11 -11
- package/node/debug/cp-node-for-debugging.js +1 -1
- package/node/debug/debug-elem-types.d.ts +32 -32
- package/node/debug/debug-elem-types.js +1 -1
- package/node/debug/debug.d.ts +50 -50
- package/node/debug/debug.js +75 -75
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +3 -3
- package/node/debug/functions/draw-elem/bounding-hull.js +7 -7
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.d.ts +4 -4
- package/node/debug/functions/draw-elem/branch.js +22 -22
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.d.ts +4 -4
- package/node/debug/functions/draw-elem/culls.js +21 -21
- package/node/debug/functions/draw-elem/culls.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +3 -3
- package/node/debug/functions/draw-elem/draw-circle-percent.js +12 -12
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +8 -8
- package/node/debug/functions/draw-elem/draw-elem.js +45 -45
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.d.ts +4 -4
- package/node/debug/functions/draw-elem/dull-corner.js +10 -10
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +4 -4
- package/node/debug/functions/draw-elem/leaves.js +12 -12
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loop.d.ts +4 -4
- package/node/debug/functions/draw-elem/loop.js +11 -11
- package/node/debug/functions/draw-elem/loops.d.ts +4 -4
- package/node/debug/functions/draw-elem/loops.js +6 -6
- package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +3 -3
- package/node/debug/functions/draw-elem/loose-bounding-box.js +9 -9
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.d.ts +4 -4
- package/node/debug/functions/draw-elem/mat.js +30 -30
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.d.ts +4 -4
- package/node/debug/functions/draw-elem/max-vertex.js +8 -8
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.d.ts +4 -4
- package/node/debug/functions/draw-elem/min-y.js +13 -13
- package/node/debug/functions/draw-elem/min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +4 -4
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +12 -12
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong.d.ts +4 -4
- package/node/debug/functions/draw-elem/one-prong.js +16 -16
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.d.ts +4 -4
- package/node/debug/functions/draw-elem/sharp-corner.js +9 -9
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +4 -4
- package/node/debug/functions/draw-elem/three-prong.js +16 -16
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +3 -3
- package/node/debug/functions/draw-elem/tight-bounding-box.js +7 -7
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +4 -4
- package/node/debug/functions/draw-elem/two-prong.js +36 -36
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.d.ts +4 -4
- package/node/debug/functions/draw-elem/vertex.js +27 -27
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +48 -48
- package/node/debug/functions/general.js +52 -52
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.d.ts +11 -11
- package/node/debug/functions/three-prong.js +184 -184
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +13 -13
- package/node/debug/functions/two-prong.js +117 -117
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/debug/three-prong-for-debugging.d.ts +31 -31
- package/node/debug/three-prong-for-debugging.js +20 -20
- package/node/debug/two-prong-for-debugging.d.ts +26 -26
- package/node/debug/two-prong-for-debugging.js +1 -1
- package/node/find-mats.d.ts +26 -26
- package/node/find-mats.js +122 -125
- package/node/find-mats.js.map +1 -1
- package/node/get-boundary-bezier-parts-to-next.d.ts +9 -9
- package/node/get-boundary-bezier-parts-to-next.js +42 -42
- package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/get-boundary-beziers-to-next.d.ts +8 -8
- package/node/get-boundary-beziers-to-next.js +44 -44
- package/node/get-boundary-beziers-to-next.js.map +1 -1
- package/node/get-bounding-box-.d.ts +2 -2
- package/node/get-bounding-box-.js +4 -4
- package/node/get-branches.d.ts +12 -12
- package/node/get-branches.js +68 -68
- package/node/get-branches.js.map +1 -1
- package/node/get-curve/get-curve-between.d.ts +9 -9
- package/node/get-curve/get-curve-between.js +56 -56
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.d.ts +9 -9
- package/node/get-curve/get-edge-direction.js +53 -53
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/get-curve-to-next.d.ts +9 -9
- package/node/get-curve-to-next.js +11 -11
- package/node/get-interface-ccw.d.ts +24 -24
- package/node/get-interface-ccw.js +97 -97
- package/node/get-interface-ccw.js.map +1 -1
- package/node/index.d.ts +36 -36
- package/node/index.js +32 -32
- package/node/loop/get-max-coordinate.d.ts +10 -10
- package/node/loop/get-max-coordinate.js +43 -43
- package/node/loop/get-max-coordinate.js.map +1 -1
- package/node/loop.d.ts +16 -16
- package/node/loop.js +34 -34
- package/node/loop.js.map +1 -1
- package/node/mat/add-to-cp-graph.d.ts +16 -16
- package/node/mat/add-to-cp-graph.js +30 -30
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/bezier-piece.d.ts +12 -12
- package/node/mat/bezier-piece.js +1 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +14 -14
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +72 -73
- package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +9 -9
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +19 -19
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.d.ts +11 -11
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +24 -24
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.d.ts +11 -11
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +26 -26
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.d.ts +8 -8
- package/node/mat/closest-boundary-point/get-best-distance-squared.js +24 -24
- package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +1 -1
- package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +17 -17
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +80 -80
- package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +1 -1
- package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +18 -18
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +40 -40
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
- package/node/mat/corner.d.ts +37 -37
- package/node/mat/corner.js +1 -1
- package/node/mat/create-new-cp-tree.d.ts +9 -9
- package/node/mat/create-new-cp-tree.js +23 -23
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/elem-type-two-prong.d.ts +3 -3
- package/node/mat/elem-type-two-prong.js +1 -1
- package/node/mat/find-mat/add-1-prong.d.ts +12 -12
- package/node/mat/find-mat/add-1-prong.js +42 -42
- package/node/mat/find-mat/add-1-prong.js.map +1 -1
- package/node/mat/find-mat/add-2-prong.d.ts +21 -21
- package/node/mat/find-mat/add-2-prong.js +192 -192
- package/node/mat/find-mat/add-2-prong.js.map +1 -1
- package/node/mat/find-mat/add-3-prong.d.ts +19 -19
- package/node/mat/find-mat/add-3-prong.js +54 -54
- package/node/mat/find-mat/add-3-prong.js.map +1 -1
- package/node/mat/find-mat/add-debug-info.d.ts +9 -9
- package/node/mat/find-mat/add-debug-info.js +67 -69
- package/node/mat/find-mat/add-debug-info.js.map +1 -1
- package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +11 -11
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +51 -51
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +1 -1
- package/node/mat/find-mat/create-initial-cp-graph.d.ts +12 -12
- package/node/mat/find-mat/create-initial-cp-graph.js +40 -40
- package/node/mat/find-mat/create-initial-cp-graph.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +8 -8
- package/node/mat/find-mat/find-2-prong/add-debug-info.js +21 -21
- package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +11 -11
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +29 -29
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/find-2-prong.d.ts +37 -37
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +232 -232
- package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +9 -9
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +39 -39
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +11 -11
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +37 -37
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +9 -9
- package/node/mat/find-mat/find-2-prong/x-for-debugging.js +1 -1
- package/node/mat/find-mat/find-3-prong/calc-better-x.d.ts +19 -19
- package/node/mat/find-mat/find-3-prong/calc-better-x.js +36 -36
- package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.d.ts +13 -13
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +25 -25
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.d.ts +22 -22
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +159 -159
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong.d.ts +16 -16
- package/node/mat/find-mat/find-3-prong/find-3-prong.js +76 -76
- package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.d.ts +9 -9
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +16 -16
- package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +1 -1
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +15 -15
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +20 -20
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +1 -1
- package/node/mat/find-mat/find-and-add-2-prongs.d.ts +16 -16
- package/node/mat/find-mat/find-and-add-2-prongs.js +73 -74
- package/node/mat/find-mat/find-and-add-2-prongs.js.map +1 -1
- package/node/mat/find-mat/find-and-add-3-prongs.d.ts +13 -13
- package/node/mat/find-mat/find-and-add-3-prongs.js +146 -147
- package/node/mat/find-mat/find-and-add-3-prongs.js.map +1 -1
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.d.ts +14 -14
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +33 -33
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +1 -1
- package/node/mat/find-mat/get-potential-2-prongs.d.ts +4 -4
- package/node/mat/find-mat/get-potential-2-prongs.js +16 -16
- package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
- package/node/mat/find-mat/get-sharp-corners.d.ts +4 -4
- package/node/mat/find-mat/get-sharp-corners.js +17 -17
- package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
- package/node/mat/geometry/get-closest-square-distance-to-rect.d.ts +5 -5
- package/node/mat/geometry/get-closest-square-distance-to-rect.js +49 -49
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.d.ts +5 -5
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +15 -15
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +11 -11
- package/node/mat/get-boundary-piece-beziers.js +58 -58
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-contact-circles-at-interface.d.ts +8 -8
- package/node/mat/get-contact-circles-at-interface.js +20 -20
- package/node/mat/get-contact-circles-at-interface.js.map +1 -1
- package/node/mat/get-largest-vertex.d.ts +4 -4
- package/node/mat/get-largest-vertex.js +9 -9
- package/node/mat/get-leaves.d.ts +4 -4
- package/node/mat/get-leaves.js +12 -12
- package/node/mat/get-leaves.js.map +1 -1
- package/node/mat/get-neighboring-cps.d.ts +14 -14
- package/node/mat/get-neighboring-cps.js +30 -30
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/get-two-prong-type.d.ts +5 -5
- package/node/mat/get-two-prong-type.js +8 -8
- package/node/mat/is-another-cp-closeby.d.ts +20 -20
- package/node/mat/is-another-cp-closeby.js +55 -55
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/mat/simplify-mat-map-only.d.ts +23 -23
- package/node/mat/simplify-mat-map-only.js +80 -80
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/mat/to-scale-axis/add-debug-info.d.ts +7 -7
- package/node/mat/to-scale-axis/add-debug-info.js +13 -13
- package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
- package/node/mat/to-scale-axis/cull-non-cycles.d.ts +9 -9
- package/node/mat/to-scale-axis/cull-non-cycles.js +51 -51
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
- package/node/mat/to-scale-axis/cull.d.ts +12 -12
- package/node/mat/to-scale-axis/cull.js +132 -132
- package/node/mat/to-scale-axis/cull.js.map +1 -1
- package/node/mat/trim-mat.d.ts +8 -8
- package/node/mat/trim-mat.js +16 -16
- package/node/mat/trim-mat.js.map +1 -1
- package/node/mat.d.ts +22 -22
- package/node/mat.js +1 -1
- package/node/point-on-shape.d.ts +73 -73
- package/node/point-on-shape.js +167 -167
- package/node/point-on-shape.js.map +1 -1
- package/node/simplify-mat.d.ts +16 -16
- package/node/simplify-mat.js +71 -71
- package/node/simplify-mat.js.map +1 -1
- package/node/svg/get-loop-bounds.d.ts +12 -12
- package/node/svg/get-loop-bounds.js +80 -80
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +8 -8
- package/node/svg/get-min-y-pos.js +9 -9
- package/node/svg/get-shape-bounds.d.ts +9 -9
- package/node/svg/get-shape-bounds.js +35 -35
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.d.ts +18 -18
- package/node/sweep-line/sweep-line.js +72 -72
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/node/to-scale-axis.d.ts +16 -16
- package/node/to-scale-axis.js +74 -73
- package/node/to-scale-axis.js.map +1 -1
- package/node/traverse-edges.d.ts +10 -10
- package/node/traverse-edges.js +21 -21
- package/node/traverse-edges.js.map +1 -1
- package/node/traverse-vertices.d.ts +12 -12
- package/node/traverse-vertices.js +27 -27
- package/node/traverse-vertices.js.map +1 -1
- package/package.json +29 -24
- package/src/circle.ts +3 -3
- package/src/compare-curvatures-at-interface.ts +36 -36
- package/src/cp-node/clone.ts +6 -6
- package/src/cp-node/remove.ts +4 -4
- package/src/cp-node.ts +20 -20
- package/src/curve.ts +19 -19
- package/src/debug/functions/draw-elem/bounding-hull.ts +2 -2
- package/src/debug/functions/draw-elem/branch.ts +4 -4
- package/src/debug/functions/draw-elem/culls.ts +4 -4
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +2 -2
- package/src/debug/functions/draw-elem/draw-elem.ts +1 -1
- package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
- package/src/debug/functions/draw-elem/leaves.ts +4 -4
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +2 -2
- package/src/debug/functions/draw-elem/mat.ts +4 -4
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +3 -3
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +4 -4
- package/src/debug/functions/draw-elem/one-prong.ts +4 -4
- package/src/debug/functions/draw-elem/sharp-corner.ts +2 -2
- package/src/debug/functions/draw-elem/three-prong.ts +7 -7
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +1 -1
- package/src/debug/functions/draw-elem/two-prong.ts +1 -1
- package/src/debug/functions/draw-elem/vertex.ts +20 -14
- package/src/debug/functions/general.ts +3 -3
- package/src/debug/functions/three-prong.ts +37 -37
- package/src/debug/functions/two-prong.ts +15 -15
- package/src/find-mats.ts +19 -19
- package/src/get-boundary-bezier-parts-to-next.ts +8 -8
- package/src/get-boundary-beziers-to-next.ts +8 -8
- package/src/get-branches.ts +7 -7
- package/src/get-curve/get-curve-between.ts +21 -21
- package/src/get-curve/get-edge-direction.ts +13 -14
- package/src/get-interface-ccw.ts +12 -12
- package/src/loop/get-max-coordinate.ts +7 -7
- package/src/loop.ts +4 -4
- package/src/mat/add-to-cp-graph.ts +8 -8
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +5 -6
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +1 -1
- package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +5 -5
- package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +5 -5
- package/src/mat/closest-boundary-point/get-best-distance-squared.ts +5 -5
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +15 -15
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +4 -4
- package/src/mat/cmp-cp-on-delta.ts +5 -5
- package/src/mat/create-new-cp-tree.ts +3 -3
- package/src/mat/find-mat/add-1-prong.ts +5 -5
- package/src/mat/find-mat/add-2-prong.ts +42 -42
- package/src/mat/find-mat/add-3-prong.ts +1 -1
- package/src/mat/find-mat/add-debug-info.ts +18 -20
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +4 -4
- package/src/mat/find-mat/create-initial-cp-graph.ts +11 -11
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +4 -4
- package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +5 -5
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +27 -27
- package/src/mat/find-mat/find-2-prong/find-equidistant-point-on-line.ts +7 -7
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +4 -4
- package/src/mat/find-mat/find-3-prong/calc-better-x.ts +4 -4
- package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -3
- package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +37 -37
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +16 -16
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +1 -1
- package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +2 -2
- package/src/mat/find-mat/find-and-add-2-prongs.ts +14 -16
- package/src/mat/find-mat/find-and-add-3-prongs.ts +19 -19
- package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +6 -6
- package/src/mat/find-mat/get-potential-2-prongs.ts +4 -4
- package/src/mat/find-mat/get-sharp-corners.ts +4 -4
- package/src/mat/find-mat/get-total-abs-curvature.ts +1 -1
- package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +3 -3
- package/src/mat/get-boundary-piece-beziers.ts +5 -5
- package/src/mat/get-contact-circles-at-interface.ts +1 -1
- package/src/mat/get-edges-as-array.ts +2 -2
- package/src/mat/get-leaves.ts +2 -2
- package/src/mat/get-neighboring-cps.ts +1 -1
- package/src/mat/is-another-cp-closeby.ts +9 -9
- package/src/mat/simplify-mat-map-only.ts +15 -15
- package/src/mat/to-scale-axis/add-debug-info.ts +6 -3
- package/src/mat/to-scale-axis/add-to-tree.ts +10 -10
- package/src/mat/to-scale-axis/calc-groups.ts +19 -19
- package/src/mat/to-scale-axis/create-spacial-tree.ts +4 -4
- package/src/mat/to-scale-axis/cull-non-cycles.ts +5 -5
- package/src/mat/to-scale-axis/cull.ts +5 -5
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +18 -18
- package/src/mat/trim-mat.ts +1 -1
- package/src/point-on-shape.ts +16 -16
- package/src/simplify-mat.ts +10 -10
- package/src/svg/get-curvature-at-interface.ts +6 -8
- package/src/svg/get-extreme.ts +1 -1
- package/src/svg/get-loop-bounds.ts +13 -13
- package/src/svg/get-shape-bounds.ts +4 -4
- package/src/sweep-line/are-boxes-intersecting.ts +4 -4
- package/src/sweep-line/sweep-line.ts +8 -8
- package/src/to-scale-axis.ts +18 -17
- package/src/traverse-edges.ts +2 -2
- package/src/traverse-vertices.ts +2 -2
- package/tsconfig.json +0 -1
- package/webpack.config.cjs +12 -63
- package/browser/index.min.js.LICENSE.txt +0 -2819
- package/browser/index.module.js +0 -7149
- package/browser/index.module.min.js +0 -2
- package/browser/index.module.min.js.LICENSE.txt +0 -2819
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
-
import { Loop } from '../../loop.js';
|
|
3
|
-
import { CpNode } from '../../cp-node.js';
|
|
4
|
-
import { Circle } from '../../circle.js';
|
|
5
|
-
import { IPointOnShape } from '../../point-on-shape.js';
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
* Adds a 2-prong contact circle to the shape.
|
|
9
|
-
* @param cpGraphs
|
|
10
|
-
* @param circle Circle containing the 2 contact points
|
|
11
|
-
* @param posSource The source point on shape
|
|
12
|
-
* @param posAntipode The found antipodal point on shape
|
|
13
|
-
* @param holeClosing True if this is a hole-closing 2-prong, false otherwise
|
|
14
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
15
|
-
* tolerances.
|
|
16
|
-
*/
|
|
17
|
-
declare function add2Prong(cpGraphs: Map<Loop, LlRbTree<CpNode>>, circle: Circle, posSource: IPointOnShape, posAntipodes: {
|
|
18
|
-
pos: IPointOnShape;
|
|
19
|
-
d: number;
|
|
20
|
-
}[], holeClosing: boolean, extreme: number): CpNode;
|
|
21
|
-
export { add2Prong };
|
|
1
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
+
import { Loop } from '../../loop.js';
|
|
3
|
+
import { CpNode } from '../../cp-node.js';
|
|
4
|
+
import { Circle } from '../../circle.js';
|
|
5
|
+
import { IPointOnShape } from '../../point-on-shape.js';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
* Adds a 2-prong contact circle to the shape.
|
|
9
|
+
* @param cpGraphs
|
|
10
|
+
* @param circle Circle containing the 2 contact points
|
|
11
|
+
* @param posSource The source point on shape
|
|
12
|
+
* @param posAntipode The found antipodal point on shape
|
|
13
|
+
* @param holeClosing True if this is a hole-closing 2-prong, false otherwise
|
|
14
|
+
* @param extreme The maximum coordinate value used to calculate floating point
|
|
15
|
+
* tolerances.
|
|
16
|
+
*/
|
|
17
|
+
declare function add2Prong(cpGraphs: Map<Loop, LlRbTree<CpNode>>, circle: Circle, posSource: IPointOnShape, posAntipodes: {
|
|
18
|
+
pos: IPointOnShape;
|
|
19
|
+
d: number;
|
|
20
|
+
}[], holeClosing: boolean, extreme: number): CpNode;
|
|
21
|
+
export { add2Prong };
|
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
import { exponent } from 'big-float-ts';
|
|
2
|
-
import { CpNode } from '../../cp-node.js';
|
|
3
|
-
import { PointOnShape, calcPosOrder } from '../../point-on-shape.js';
|
|
4
|
-
import { isAnotherCpCloseby } from '../is-another-cp-closeby.js';
|
|
5
|
-
import { getNeighbouringPoints } from '../get-neighboring-cps.js';
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
* Adds a 2-prong contact circle to the shape.
|
|
9
|
-
* @param cpGraphs
|
|
10
|
-
* @param circle Circle containing the 2 contact points
|
|
11
|
-
* @param posSource The source point on shape
|
|
12
|
-
* @param posAntipode The found antipodal point on shape
|
|
13
|
-
* @param holeClosing True if this is a hole-closing 2-prong, false otherwise
|
|
14
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
15
|
-
* tolerances.
|
|
16
|
-
*/
|
|
17
|
-
function add2Prong(cpGraphs, circle, posSource, posAntipodes, holeClosing, extreme) {
|
|
18
|
-
//let orderSource = PointOnShape.calcOrder(circle, posSource);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//console.log(circle.center)
|
|
22
|
-
//return PointOnShape.calcOrder(circle, posAntipode.pos);
|
|
23
|
-
return calcPosOrder(circle, posAntipode.pos);
|
|
24
|
-
});
|
|
25
|
-
let t_s = posSource.t;
|
|
26
|
-
let curve;
|
|
27
|
-
if (t_s === 0) {
|
|
28
|
-
t_s = 1;
|
|
29
|
-
curve = posSource.curve.prev;
|
|
30
|
-
posSource = new PointOnShape(curve, t_s);
|
|
31
|
-
}
|
|
32
|
-
// Make sure there isn't already a ContactPoint close by - it can cause
|
|
33
|
-
// floating point stability issues.
|
|
34
|
-
// TODO - possibly combine n-prongs in this case
|
|
35
|
-
let isCloseByAntipodes = false;
|
|
36
|
-
for (let i = 0; i < posAntipodes.length; i++) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (isAnotherCpCloseby(cpGraphs, posAntipode.pos, circle, orderAntipode, 0, extreme, 'red')) {
|
|
40
|
-
isCloseByAntipodes = true;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (isAnotherCpCloseby(cpGraphs, posSource, circle, orderSource, 0, extreme, 'red') ||
|
|
45
|
-
isCloseByAntipodes) {
|
|
46
|
-
if (typeof _debug_ !== 'undefined') {
|
|
47
|
-
if (holeClosing) {
|
|
48
|
-
_debug_.generated.elems['twoProng_holeClosing'].pop();
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
_debug_.generated.elems['twoProng_regular'].pop();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
// Antipode
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (let i = 0; i < posAntipodes.length; i++) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
cpAntipodes.push(cpAntipode);
|
|
67
|
-
|
|
68
|
-
loopAntipodes.push(loopAntipode);
|
|
69
|
-
|
|
70
|
-
cpTreeAntipodes.push(cpTreeAntipode);
|
|
71
|
-
|
|
72
|
-
deltaAntipodes.push(deltaAntipode);
|
|
73
|
-
newCpAntipodes.push(CpNode.insert(holeClosing, false, cpTreeAntipode, cpAntipode, deltaAntipode[0]));
|
|
74
|
-
}
|
|
75
|
-
// Source
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// Connect graph
|
|
82
|
-
if (newCpAntipodes.length === 1) {
|
|
83
|
-
newCpSource.prevOnCircle = newCpAntipodes[0];
|
|
84
|
-
newCpSource.nextOnCircle = newCpAntipodes[0];
|
|
85
|
-
newCpAntipodes[0].prevOnCircle = newCpSource;
|
|
86
|
-
newCpAntipodes[0].nextOnCircle = newCpSource;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
|
|
90
|
-
cpNodes.push(newCpSource);
|
|
91
|
-
// Order points according to their angle with the x-axis
|
|
92
|
-
cpNodes.sort(byAngle(circle));
|
|
93
|
-
for (let i = 0; i < cpNodes.length; i++) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
cpNodeCurr.nextOnCircle = cpNodeNext;
|
|
100
|
-
cpNodeCurr.prevOnCircle = cpNodePrev;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (holeClosing) {
|
|
104
|
-
// TODO - important - take care of case where there are more than 1 antipode
|
|
105
|
-
// Duplicate ContactPoints
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Connect graph
|
|
111
|
-
newCpB1Node.prevOnCircle = newCpB2Node;
|
|
112
|
-
newCpB1Node.nextOnCircle = newCpB2Node;
|
|
113
|
-
newCpB2Node.prevOnCircle = newCpB1Node;
|
|
114
|
-
newCpB2Node.nextOnCircle = newCpB1Node;
|
|
115
|
-
newCpAntipodes[0].next = newCpSource;
|
|
116
|
-
newCpSource.prev = newCpAntipodes[0];
|
|
117
|
-
newCpB1Node.next = newCpB2Node;
|
|
118
|
-
newCpB2Node.prev = newCpB1Node;
|
|
119
|
-
}
|
|
120
|
-
if (typeof _debug_ !== 'undefined') {
|
|
121
|
-
let elems;
|
|
122
|
-
if (holeClosing) {
|
|
123
|
-
elems = _debug_.generated.elems['twoProng_holeClosing'];
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
elems = _debug_.generated.elems['twoProng_regular'];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (!newCpSource) {
|
|
130
|
-
console.log('asas');
|
|
131
|
-
}
|
|
132
|
-
elem.cpNode = newCpSource;
|
|
133
|
-
}
|
|
134
|
-
return newCpSource;
|
|
135
|
-
}
|
|
136
|
-
/** @hidden */
|
|
137
|
-
function scale(n, exp) {
|
|
138
|
-
return n * (2 ** -(exp + 1));
|
|
139
|
-
}
|
|
140
|
-
/** @hidden */
|
|
141
|
-
function getSize(x, y) {
|
|
142
|
-
// Get size of a
|
|
143
|
-
if (x > 0) {
|
|
144
|
-
if (x > 0.5) {
|
|
145
|
-
return y; // ~ -0.7 -> 0.7, i.e. -(sqrt(2)/2) -> +(sqrt(2)/2)
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
if (y < 0) {
|
|
149
|
-
return x - 2; // ~ -2.0 -> -1.3
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
return -x + 2; // ~ 1.3 -> 2.0
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
if (x < -0.5) {
|
|
158
|
-
return -y + 4; // ~ 3.3 -> 4.7
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
if (y < 0) {
|
|
162
|
-
return x + 6; // ~ 5.3 -> 6.0
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
return -x + 2; // ~ 2 -> 2.7
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/** @hidden */
|
|
171
|
-
function byAngle(circle) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return function (_a, _b) {
|
|
176
|
-
let a = _a.cp.pointOnShape.p;
|
|
177
|
-
let b = _b.cp.pointOnShape.p;
|
|
178
|
-
// Move onto origin
|
|
179
|
-
a = [a[0] - c[0], a[1] - c[1]];
|
|
180
|
-
b = [b[0] - c[0], b[1] - c[1]];
|
|
181
|
-
// Scale
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
// Get 'size'
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return sb - sa;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
export { add2Prong };
|
|
1
|
+
import { exponent } from 'big-float-ts';
|
|
2
|
+
import { CpNode } from '../../cp-node.js';
|
|
3
|
+
import { PointOnShape, calcPosOrder } from '../../point-on-shape.js';
|
|
4
|
+
import { isAnotherCpCloseby } from '../is-another-cp-closeby.js';
|
|
5
|
+
import { getNeighbouringPoints } from '../get-neighboring-cps.js';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
* Adds a 2-prong contact circle to the shape.
|
|
9
|
+
* @param cpGraphs
|
|
10
|
+
* @param circle Circle containing the 2 contact points
|
|
11
|
+
* @param posSource The source point on shape
|
|
12
|
+
* @param posAntipode The found antipodal point on shape
|
|
13
|
+
* @param holeClosing True if this is a hole-closing 2-prong, false otherwise
|
|
14
|
+
* @param extreme The maximum coordinate value used to calculate floating point
|
|
15
|
+
* tolerances.
|
|
16
|
+
*/
|
|
17
|
+
function add2Prong(cpGraphs, circle, posSource, posAntipodes, holeClosing, extreme) {
|
|
18
|
+
//let orderSource = PointOnShape.calcOrder(circle, posSource);
|
|
19
|
+
const orderSource = calcPosOrder(circle, posSource);
|
|
20
|
+
const orderAntipodes = posAntipodes.map(posAntipode => {
|
|
21
|
+
//console.log(circle.center)
|
|
22
|
+
//return PointOnShape.calcOrder(circle, posAntipode.pos);
|
|
23
|
+
return calcPosOrder(circle, posAntipode.pos);
|
|
24
|
+
});
|
|
25
|
+
let t_s = posSource.t;
|
|
26
|
+
let curve;
|
|
27
|
+
if (t_s === 0) {
|
|
28
|
+
t_s = 1;
|
|
29
|
+
curve = posSource.curve.prev;
|
|
30
|
+
posSource = new PointOnShape(curve, t_s);
|
|
31
|
+
}
|
|
32
|
+
// Make sure there isn't already a ContactPoint close by - it can cause
|
|
33
|
+
// floating point stability issues.
|
|
34
|
+
// TODO - possibly combine n-prongs in this case
|
|
35
|
+
let isCloseByAntipodes = false;
|
|
36
|
+
for (let i = 0; i < posAntipodes.length; i++) {
|
|
37
|
+
const posAntipode = posAntipodes[i];
|
|
38
|
+
const orderAntipode = orderAntipodes[i];
|
|
39
|
+
if (isAnotherCpCloseby(cpGraphs, posAntipode.pos, circle, orderAntipode, 0, extreme, 'red')) {
|
|
40
|
+
isCloseByAntipodes = true;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (isAnotherCpCloseby(cpGraphs, posSource, circle, orderSource, 0, extreme, 'red') ||
|
|
45
|
+
isCloseByAntipodes) {
|
|
46
|
+
if (typeof _debug_ !== 'undefined') {
|
|
47
|
+
if (holeClosing) {
|
|
48
|
+
_debug_.generated.elems['twoProng_holeClosing'].pop();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
_debug_.generated.elems['twoProng_regular'].pop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Antipode
|
|
57
|
+
const newCpAntipodes = [];
|
|
58
|
+
const cpAntipodes = [];
|
|
59
|
+
const cpTreeAntipodes = [];
|
|
60
|
+
const deltaAntipodes = [];
|
|
61
|
+
const loopAntipodes = [];
|
|
62
|
+
for (let i = 0; i < posAntipodes.length; i++) {
|
|
63
|
+
const posAntipode = posAntipodes[i];
|
|
64
|
+
const orderAntipode = orderAntipodes[i];
|
|
65
|
+
const cpAntipode = { pointOnShape: posAntipode.pos, circle, order: orderAntipode, order2: 0 };
|
|
66
|
+
cpAntipodes.push(cpAntipode);
|
|
67
|
+
const loopAntipode = posAntipode.pos.curve.loop;
|
|
68
|
+
loopAntipodes.push(loopAntipode);
|
|
69
|
+
const cpTreeAntipode = cpGraphs.get(loopAntipode);
|
|
70
|
+
cpTreeAntipodes.push(cpTreeAntipode);
|
|
71
|
+
const deltaAntipode = getNeighbouringPoints(cpTreeAntipode, posAntipode.pos, orderAntipode, 0);
|
|
72
|
+
deltaAntipodes.push(deltaAntipode);
|
|
73
|
+
newCpAntipodes.push(CpNode.insert(holeClosing, false, cpTreeAntipode, cpAntipode, deltaAntipode[0]));
|
|
74
|
+
}
|
|
75
|
+
// Source
|
|
76
|
+
const cpSource = { pointOnShape: posSource, circle, order: orderSource, order2: 0 };
|
|
77
|
+
const loopSource = posSource.curve.loop;
|
|
78
|
+
const cpTreeSource = cpGraphs.get(loopSource);
|
|
79
|
+
const deltaSource = getNeighbouringPoints(cpTreeSource, posSource, orderSource, 0);
|
|
80
|
+
const newCpSource = CpNode.insert(holeClosing, false, cpTreeSource, cpSource, deltaSource[0]);
|
|
81
|
+
// Connect graph
|
|
82
|
+
if (newCpAntipodes.length === 1) {
|
|
83
|
+
newCpSource.prevOnCircle = newCpAntipodes[0];
|
|
84
|
+
newCpSource.nextOnCircle = newCpAntipodes[0];
|
|
85
|
+
newCpAntipodes[0].prevOnCircle = newCpSource;
|
|
86
|
+
newCpAntipodes[0].nextOnCircle = newCpSource;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const cpNodes = newCpAntipodes.slice();
|
|
90
|
+
cpNodes.push(newCpSource);
|
|
91
|
+
// Order points according to their angle with the x-axis
|
|
92
|
+
cpNodes.sort(byAngle(circle));
|
|
93
|
+
for (let i = 0; i < cpNodes.length; i++) {
|
|
94
|
+
const iNext = (i + 1 === cpNodes.length) ? 0 : i + 1;
|
|
95
|
+
const iPrev = (i === 0) ? cpNodes.length - 1 : i - 1;
|
|
96
|
+
const cpNodeCurr = cpNodes[i];
|
|
97
|
+
const cpNodeNext = cpNodes[iNext];
|
|
98
|
+
const cpNodePrev = cpNodes[iPrev];
|
|
99
|
+
cpNodeCurr.nextOnCircle = cpNodeNext;
|
|
100
|
+
cpNodeCurr.prevOnCircle = cpNodePrev;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (holeClosing) {
|
|
104
|
+
// TODO - important - take care of case where there are more than 1 antipode
|
|
105
|
+
// Duplicate ContactPoints
|
|
106
|
+
const cpB2 = { pointOnShape: posAntipodes[0].pos, circle, order: cpAntipodes[0].order, order2: +1 };
|
|
107
|
+
const newCpB2Node = CpNode.insert(true, false, cpTreeAntipodes[0], cpB2, newCpAntipodes[0]);
|
|
108
|
+
const cpB1 = { pointOnShape: posSource, circle, order: cpSource.order, order2: -1 };
|
|
109
|
+
const newCpB1Node = CpNode.insert(true, false, cpTreeSource, cpB1, newCpSource.prev);
|
|
110
|
+
// Connect graph
|
|
111
|
+
newCpB1Node.prevOnCircle = newCpB2Node;
|
|
112
|
+
newCpB1Node.nextOnCircle = newCpB2Node;
|
|
113
|
+
newCpB2Node.prevOnCircle = newCpB1Node;
|
|
114
|
+
newCpB2Node.nextOnCircle = newCpB1Node;
|
|
115
|
+
newCpAntipodes[0].next = newCpSource;
|
|
116
|
+
newCpSource.prev = newCpAntipodes[0];
|
|
117
|
+
newCpB1Node.next = newCpB2Node;
|
|
118
|
+
newCpB2Node.prev = newCpB1Node;
|
|
119
|
+
}
|
|
120
|
+
if (typeof _debug_ !== 'undefined') {
|
|
121
|
+
let elems;
|
|
122
|
+
if (holeClosing) {
|
|
123
|
+
elems = _debug_.generated.elems['twoProng_holeClosing'];
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
elems = _debug_.generated.elems['twoProng_regular'];
|
|
127
|
+
}
|
|
128
|
+
const elem = elems[elems.length - 1];
|
|
129
|
+
if (!newCpSource) {
|
|
130
|
+
console.log('asas');
|
|
131
|
+
}
|
|
132
|
+
elem.cpNode = newCpSource;
|
|
133
|
+
}
|
|
134
|
+
return newCpSource;
|
|
135
|
+
}
|
|
136
|
+
/** @hidden */
|
|
137
|
+
function scale(n, exp) {
|
|
138
|
+
return n * (2 ** -(exp + 1));
|
|
139
|
+
}
|
|
140
|
+
/** @hidden */
|
|
141
|
+
function getSize(x, y) {
|
|
142
|
+
// Get size of a
|
|
143
|
+
if (x > 0) {
|
|
144
|
+
if (x > 0.5) {
|
|
145
|
+
return y; // ~ -0.7 -> 0.7, i.e. -(sqrt(2)/2) -> +(sqrt(2)/2)
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
if (y < 0) {
|
|
149
|
+
return x - 2; // ~ -2.0 -> -1.3
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return -x + 2; // ~ 1.3 -> 2.0
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (x < -0.5) {
|
|
158
|
+
return -y + 4; // ~ 3.3 -> 4.7
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
if (y < 0) {
|
|
162
|
+
return x + 6; // ~ 5.3 -> 6.0
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return -x + 2; // ~ 2 -> 2.7
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** @hidden */
|
|
171
|
+
function byAngle(circle) {
|
|
172
|
+
const c = circle.center;
|
|
173
|
+
const r = circle.radius;
|
|
174
|
+
const exp = exponent(r);
|
|
175
|
+
return function (_a, _b) {
|
|
176
|
+
let a = _a.cp.pointOnShape.p;
|
|
177
|
+
let b = _b.cp.pointOnShape.p;
|
|
178
|
+
// Move onto origin
|
|
179
|
+
a = [a[0] - c[0], a[1] - c[1]];
|
|
180
|
+
b = [b[0] - c[0], b[1] - c[1]];
|
|
181
|
+
// Scale
|
|
182
|
+
const ax = scale(a[0], exp);
|
|
183
|
+
const ay = scale(a[1], exp);
|
|
184
|
+
const bx = scale(b[0], exp);
|
|
185
|
+
const by = scale(b[1], exp);
|
|
186
|
+
// Get 'size'
|
|
187
|
+
const sa = getSize(ax, ay);
|
|
188
|
+
const sb = getSize(bx, by);
|
|
189
|
+
return sb - sa;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export { add2Prong };
|
|
193
193
|
//# sourceMappingURL=add-2-prong.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-2-prong.js","sourceRoot":"","sources":["../../../src/mat/find-mat/add-2-prong.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,MAAM,EAAQ,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAIlE;;;;;;;;;;GAUG;AACH,SAAS,SAAS,CAChB,QAA0C,EACpC,MAAsB,EACtB,SAA6B,EACnC,YAAmD,EACnD,WAAuB,EACvB,OAAsB;IAEvB,gEAAgE;IAChE,
|
|
1
|
+
{"version":3,"file":"add-2-prong.js","sourceRoot":"","sources":["../../../src/mat/find-mat/add-2-prong.ts"],"names":[],"mappings":"A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,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3B,QAAQ;QACR,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAE5B,aAAa;QACb,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3B,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAE3B,OAAO,EAAE,GAAG,EAAE,CAAC;IAChB,CAAC,CAAA;AACF,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
-
import { CpNode } from '../../cp-node.js';
|
|
3
|
-
import { Loop } from '../../loop.js';
|
|
4
|
-
import { Circle } from '../../circle.js';
|
|
5
|
-
import { IPointOnShape } from '../../point-on-shape.js';
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
* Adds a 3-prong MAT circle according to the 3 given (previously calculated)
|
|
9
|
-
* points on the shape.
|
|
10
|
-
* @param cpTrees
|
|
11
|
-
* @param orders
|
|
12
|
-
* @param threeProng
|
|
13
|
-
*/
|
|
14
|
-
declare function add3Prong(cpTrees: Map<Loop, LlRbTree<CpNode>>, orders: number[], threeProng: {
|
|
15
|
-
circle: Circle;
|
|
16
|
-
ps: IPointOnShape[];
|
|
17
|
-
δ3s: CpNode[][];
|
|
18
|
-
}): Circle;
|
|
19
|
-
export { add3Prong };
|
|
1
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
+
import { CpNode } from '../../cp-node.js';
|
|
3
|
+
import { Loop } from '../../loop.js';
|
|
4
|
+
import { Circle } from '../../circle.js';
|
|
5
|
+
import { IPointOnShape } from '../../point-on-shape.js';
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
* Adds a 3-prong MAT circle according to the 3 given (previously calculated)
|
|
9
|
+
* points on the shape.
|
|
10
|
+
* @param cpTrees
|
|
11
|
+
* @param orders
|
|
12
|
+
* @param threeProng
|
|
13
|
+
*/
|
|
14
|
+
declare function add3Prong(cpTrees: Map<Loop, LlRbTree<CpNode>>, orders: number[], threeProng: {
|
|
15
|
+
circle: Circle;
|
|
16
|
+
ps: IPointOnShape[];
|
|
17
|
+
δ3s: CpNode[][];
|
|
18
|
+
}): Circle;
|
|
19
|
+
export { add3Prong };
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { addToCpGraph } from '../add-to-cp-graph.js';
|
|
2
|
-
import { isAnotherCpCloseby } from '../is-another-cp-closeby.js';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
* Adds a 3-prong MAT circle according to the 3 given (previously calculated)
|
|
6
|
-
* points on the shape.
|
|
7
|
-
* @param cpTrees
|
|
8
|
-
* @param orders
|
|
9
|
-
* @param threeProng
|
|
10
|
-
*/
|
|
11
|
-
function add3Prong(cpTrees, orders, threeProng) {
|
|
12
|
-
|
|
13
|
-
// Keep for possible future debugging.
|
|
14
|
-
/*
|
|
15
|
-
if (typeof _debug_ !== 'undefined') {
|
|
16
|
-
for (let i=0; i<3; i++) {
|
|
17
|
-
let cpBef = threeProng.δ3s[i][0].cp;
|
|
18
|
-
let cpAft = threeProng.δ3s[i][1].cp;
|
|
19
|
-
//let cmpBef = PointOnShape.compareInclOrder(cpBef.pointOnShape, ps[i], cpBef.order, orders[i]);
|
|
20
|
-
//let cmpAft = PointOnShape.compareInclOrder(cpAft.pointOnShape, ps[i], cpAft.order, orders[i]);
|
|
21
|
-
|
|
22
|
-
let cmpBef = PointOnShape.compare(cpBef.pointOnShape, ps[i]);
|
|
23
|
-
let cmpAft = PointOnShape.compare(cpAft.pointOnShape, ps[i]);
|
|
24
|
-
|
|
25
|
-
// len is used by debug functions to reference a particular
|
|
26
|
-
// three-prong.
|
|
27
|
-
let len = _debug_.generated.elems.threeProng.length-1;
|
|
28
|
-
if (cmpBef > 0) {
|
|
29
|
-
console.log('----------------------------------------');
|
|
30
|
-
console.log(`3-prong order is wrong (bef) : i: ${i} - cmp: ${cmpBef} - n: ${len}`);
|
|
31
|
-
console.log(threeProng);
|
|
32
|
-
console.log(cpBef);
|
|
33
|
-
console.log(cpAft);
|
|
34
|
-
console.log(ps[i]);
|
|
35
|
-
}
|
|
36
|
-
if (cmpAft < 0) {
|
|
37
|
-
console.log('----------------------------------------');
|
|
38
|
-
console.log(`3-prong order is wrong (aft) : i: ${i} - cmp: ${cmpAft} - n: ${len}`);
|
|
39
|
-
console.log(threeProng);
|
|
40
|
-
console.log(cpBef);
|
|
41
|
-
console.log(cpAft);
|
|
42
|
-
console.log(ps[i]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
*/
|
|
47
|
-
// TODO - replace 1000 below with correct value
|
|
48
|
-
isAnotherCpCloseby(cpTrees, poss[0], circle, orders[0], 0, 1000, 'blue');
|
|
49
|
-
isAnotherCpCloseby(cpTrees, poss[1], circle, orders[1], 0, 1000, 'blue');
|
|
50
|
-
isAnotherCpCloseby(cpTrees, poss[2], circle, orders[2], 0, 1000, 'blue');
|
|
51
|
-
addToCpGraph(circle, orders, cpTrees, poss, δ3s);
|
|
52
|
-
return circle;
|
|
53
|
-
}
|
|
54
|
-
export { add3Prong };
|
|
1
|
+
import { addToCpGraph } from '../add-to-cp-graph.js';
|
|
2
|
+
import { isAnotherCpCloseby } from '../is-another-cp-closeby.js';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
* Adds a 3-prong MAT circle according to the 3 given (previously calculated)
|
|
6
|
+
* points on the shape.
|
|
7
|
+
* @param cpTrees
|
|
8
|
+
* @param orders
|
|
9
|
+
* @param threeProng
|
|
10
|
+
*/
|
|
11
|
+
function add3Prong(cpTrees, orders, threeProng) {
|
|
12
|
+
const { circle, ps: poss, δ3s } = threeProng;
|
|
13
|
+
// Keep for possible future debugging.
|
|
14
|
+
/*
|
|
15
|
+
if (typeof _debug_ !== 'undefined') {
|
|
16
|
+
for (let i=0; i<3; i++) {
|
|
17
|
+
let cpBef = threeProng.δ3s[i][0].cp;
|
|
18
|
+
let cpAft = threeProng.δ3s[i][1].cp;
|
|
19
|
+
//let cmpBef = PointOnShape.compareInclOrder(cpBef.pointOnShape, ps[i], cpBef.order, orders[i]);
|
|
20
|
+
//let cmpAft = PointOnShape.compareInclOrder(cpAft.pointOnShape, ps[i], cpAft.order, orders[i]);
|
|
21
|
+
|
|
22
|
+
let cmpBef = PointOnShape.compare(cpBef.pointOnShape, ps[i]);
|
|
23
|
+
let cmpAft = PointOnShape.compare(cpAft.pointOnShape, ps[i]);
|
|
24
|
+
|
|
25
|
+
// len is used by debug functions to reference a particular
|
|
26
|
+
// three-prong.
|
|
27
|
+
let len = _debug_.generated.elems.threeProng.length-1;
|
|
28
|
+
if (cmpBef > 0) {
|
|
29
|
+
console.log('----------------------------------------');
|
|
30
|
+
console.log(`3-prong order is wrong (bef) : i: ${i} - cmp: ${cmpBef} - n: ${len}`);
|
|
31
|
+
console.log(threeProng);
|
|
32
|
+
console.log(cpBef);
|
|
33
|
+
console.log(cpAft);
|
|
34
|
+
console.log(ps[i]);
|
|
35
|
+
}
|
|
36
|
+
if (cmpAft < 0) {
|
|
37
|
+
console.log('----------------------------------------');
|
|
38
|
+
console.log(`3-prong order is wrong (aft) : i: ${i} - cmp: ${cmpAft} - n: ${len}`);
|
|
39
|
+
console.log(threeProng);
|
|
40
|
+
console.log(cpBef);
|
|
41
|
+
console.log(cpAft);
|
|
42
|
+
console.log(ps[i]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
*/
|
|
47
|
+
// TODO - replace 1000 below with correct value
|
|
48
|
+
isAnotherCpCloseby(cpTrees, poss[0], circle, orders[0], 0, 1000, 'blue');
|
|
49
|
+
isAnotherCpCloseby(cpTrees, poss[1], circle, orders[1], 0, 1000, 'blue');
|
|
50
|
+
isAnotherCpCloseby(cpTrees, poss[2], circle, orders[2], 0, 1000, 'blue');
|
|
51
|
+
addToCpGraph(circle, orders, cpTrees, poss, δ3s);
|
|
52
|
+
return circle;
|
|
53
|
+
}
|
|
54
|
+
export { add3Prong };
|
|
55
55
|
//# sourceMappingURL=add-3-prong.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-3-prong.js","sourceRoot":"","sources":["../../../src/mat/find-mat/add-3-prong.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;;;;;GAOG;AACH,SAAS,SAAS,CAChB,OAAmC,EACnC,MAAgB,EAChB,UAIC;IAEF,
|
|
1
|
+
{"version":3,"file":"add-3-prong.js","sourceRoot":"","sources":["../../../src/mat/find-mat/add-3-prong.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;;;;;GAOG;AACH,SAAS,SAAS,CAChB,OAAmC,EACnC,MAAgB,EAChB,UAIC;IAEF,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC;IAE7C,uCAAuC;IACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCE;IAEF,+CAA+C;IAC/C,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACzE,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACzE,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEzE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAEjD,OAAO,MAAM,CAAC;AACf,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Loop } from '../../loop.js';
|
|
2
|
-
import { Mat } from '../../mat.js';
|
|
3
|
-
/** @hidden */
|
|
4
|
-
declare function addDebugInfo1(loops: Loop[]): void;
|
|
5
|
-
/** @hidden */
|
|
6
|
-
declare function addDebugInfo2(): void;
|
|
7
|
-
declare function addDebugInfo3(): void;
|
|
8
|
-
declare function addDebugInfo4(mat: Mat): void;
|
|
9
|
-
export { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 };
|
|
1
|
+
import { Loop } from '../../loop.js';
|
|
2
|
+
import { Mat } from '../../mat.js';
|
|
3
|
+
/** @hidden */
|
|
4
|
+
declare function addDebugInfo1(loops: Loop[]): void;
|
|
5
|
+
/** @hidden */
|
|
6
|
+
declare function addDebugInfo2(): void;
|
|
7
|
+
declare function addDebugInfo3(): void;
|
|
8
|
+
declare function addDebugInfo4(mat: Mat): void;
|
|
9
|
+
export { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 };
|