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
package/node/simplify-mat.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { hausdorffDistance } from 'flo-bezier3';
|
|
2
|
-
import { CpNode } from './cp-node.js';
|
|
3
|
-
import { getBranches } from './get-branches.js';
|
|
4
|
-
import { getCurveToNext } from './get-curve-to-next.js';
|
|
5
|
-
import { getCurveBetween } from './get-curve/get-curve-between.js';
|
|
6
|
-
/**
|
|
7
|
-
* Simplifies the given MAT by replacing the piecewise quad beziers composing
|
|
8
|
-
* the MAT with fewer ones to within a given tolerance.
|
|
9
|
-
* @param cpNode A representation of the MAT
|
|
10
|
-
* @param anlgeTolerance Tolerance given as the degrees difference of the unit
|
|
11
|
-
* direction vectors at the interface between curves. A tolerance of zero means
|
|
12
|
-
* perfect smoothness is required - defaults to 15.
|
|
13
|
-
* TODO - the next two params are wrong??
|
|
14
|
-
* @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
|
|
15
|
-
* defaults to 0.1
|
|
16
|
-
* @param maxIterations The spacing on the curves used to calculate the Hausdorff
|
|
17
|
-
* Distance - defaults to 1
|
|
18
|
-
*/
|
|
19
|
-
function simplifyMat(mat, anlgeTolerance = 15, hausdorffTolerance = 2 ** -3, maxIterations = 50) {
|
|
20
|
-
let cpNode = mat.cpNode;
|
|
21
|
-
// Start from a leaf
|
|
22
|
-
while (!cpNode.isTerminating()) {
|
|
23
|
-
cpNode = cpNode.next;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for (let k = 0; k < branches.length; k++) {
|
|
28
|
-
|
|
29
|
-
// Try to remove some
|
|
30
|
-
let j = 0;
|
|
31
|
-
while (j < branch.length) {
|
|
32
|
-
|
|
33
|
-
while (true) {
|
|
34
|
-
j++;
|
|
35
|
-
if (j === branch.length) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (hd > hausdorffTolerance) {
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
canDeletes.push(branch[j]);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (i + 1 === j) {
|
|
47
|
-
// no simplification occured
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
for (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (isTerminating || onCircleCount !== 2) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
CpNode.remove(cpNode);
|
|
59
|
-
}
|
|
60
|
-
//return { cpNode, cpTrees: createNewCpTree(cpNode) };
|
|
61
|
-
return { cpNode, cpTrees: undefined };
|
|
62
|
-
}
|
|
63
|
-
function getTotalHausdorffDistance(i, j, branch, hausdorffSpacing) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (; i < j + 1; i++) {
|
|
67
|
-
hds.push(hausdorffDistance(getCurveToNext(branch[i]), longCurve, hausdorffSpacing));
|
|
68
|
-
}
|
|
69
|
-
return Math.max(...hds);
|
|
70
|
-
}
|
|
71
|
-
export { simplifyMat };
|
|
1
|
+
import { hausdorffDistance } from 'flo-bezier3';
|
|
2
|
+
import { CpNode } from './cp-node.js';
|
|
3
|
+
import { getBranches } from './get-branches.js';
|
|
4
|
+
import { getCurveToNext } from './get-curve-to-next.js';
|
|
5
|
+
import { getCurveBetween } from './get-curve/get-curve-between.js';
|
|
6
|
+
/**
|
|
7
|
+
* Simplifies the given MAT by replacing the piecewise quad beziers composing
|
|
8
|
+
* the MAT with fewer ones to within a given tolerance.
|
|
9
|
+
* @param cpNode A representation of the MAT
|
|
10
|
+
* @param anlgeTolerance Tolerance given as the degrees difference of the unit
|
|
11
|
+
* direction vectors at the interface between curves. A tolerance of zero means
|
|
12
|
+
* perfect smoothness is required - defaults to 15.
|
|
13
|
+
* TODO - the next two params are wrong??
|
|
14
|
+
* @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
|
|
15
|
+
* defaults to 0.1
|
|
16
|
+
* @param maxIterations The spacing on the curves used to calculate the Hausdorff
|
|
17
|
+
* Distance - defaults to 1
|
|
18
|
+
*/
|
|
19
|
+
function simplifyMat(mat, anlgeTolerance = 15, hausdorffTolerance = 2 ** -3, maxIterations = 50) {
|
|
20
|
+
let cpNode = mat.cpNode;
|
|
21
|
+
// Start from a leaf
|
|
22
|
+
while (!cpNode.isTerminating()) {
|
|
23
|
+
cpNode = cpNode.next;
|
|
24
|
+
}
|
|
25
|
+
const branches = getBranches(cpNode, anlgeTolerance);
|
|
26
|
+
const canDeletes = [];
|
|
27
|
+
for (let k = 0; k < branches.length; k++) {
|
|
28
|
+
const branch = branches[k];
|
|
29
|
+
// Try to remove some
|
|
30
|
+
let j = 0;
|
|
31
|
+
while (j < branch.length) {
|
|
32
|
+
const i = j;
|
|
33
|
+
while (true) {
|
|
34
|
+
j++;
|
|
35
|
+
if (j === branch.length) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
const hd = getTotalHausdorffDistance(i, j, branch, maxIterations);
|
|
39
|
+
if (hd > hausdorffTolerance) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
canDeletes.push(branch[j]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (i + 1 === j) {
|
|
47
|
+
// no simplification occured
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const cpNode of canDeletes) {
|
|
53
|
+
const isTerminating = cpNode.isTerminating();
|
|
54
|
+
const onCircleCount = cpNode.getCpNodesOnCircle().length;
|
|
55
|
+
if (isTerminating || onCircleCount !== 2) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
CpNode.remove(cpNode);
|
|
59
|
+
}
|
|
60
|
+
//return { cpNode, cpTrees: createNewCpTree(cpNode) };
|
|
61
|
+
return { cpNode, cpTrees: undefined };
|
|
62
|
+
}
|
|
63
|
+
function getTotalHausdorffDistance(i, j, branch, hausdorffSpacing) {
|
|
64
|
+
const hds = [];
|
|
65
|
+
const longCurve = getCurveBetween(branch[i], branch[j].next);
|
|
66
|
+
for (; i < j + 1; i++) {
|
|
67
|
+
hds.push(hausdorffDistance(getCurveToNext(branch[i]), longCurve, hausdorffSpacing));
|
|
68
|
+
}
|
|
69
|
+
return Math.max(...hds);
|
|
70
|
+
}
|
|
71
|
+
export { simplifyMat };
|
|
72
72
|
//# sourceMappingURL=simplify-mat.js.map
|
package/node/simplify-mat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplify-mat.js","sourceRoot":"","sources":["../src/simplify-mat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,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C,CAAC;IAC7D,OAAO,CAAC,GAAC,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACf,GAAG,CAAC,IAAI,CAAC,iBAAiB,CACtB,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACzB,SAAS,EACT,gBAAgB,CACnB,CAAC,CAAC;KACN;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AAC5B,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Loop } from '../loop.js';
|
|
2
|
-
import { IPointOnShape } from '../point-on-shape.js';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
*/
|
|
6
|
-
declare
|
|
7
|
-
minX: IPointOnShape;
|
|
8
|
-
minY: IPointOnShape;
|
|
9
|
-
maxX: IPointOnShape;
|
|
10
|
-
maxY: IPointOnShape;
|
|
11
|
-
};
|
|
12
|
-
export { getLoopBounds };
|
|
1
|
+
import { Loop } from '../loop.js';
|
|
2
|
+
import { IPointOnShape } from '../point-on-shape.js';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
declare const getLoopBounds: (a: Loop) => {
|
|
7
|
+
minX: IPointOnShape;
|
|
8
|
+
minY: IPointOnShape;
|
|
9
|
+
maxX: IPointOnShape;
|
|
10
|
+
maxY: IPointOnShape;
|
|
11
|
+
};
|
|
12
|
+
export { getLoopBounds };
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { getBounds } from 'flo-bezier3';
|
|
2
|
-
import { memoize } from 'flo-memoize';
|
|
3
|
-
import { PointOnShape } from '../point-on-shape.js';
|
|
4
|
-
/** @hidden */
|
|
5
|
-
const INF = Number.POSITIVE_INFINITY;
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[
|
|
12
|
-
{ bezier: undefined, t: undefined, val: INF },
|
|
13
|
-
{ bezier: undefined, t: undefined, val: INF }
|
|
14
|
-
],
|
|
15
|
-
[
|
|
16
|
-
{ bezier: undefined, t: undefined, val: -INF },
|
|
17
|
-
{ bezier: undefined, t: undefined, val: -INF }
|
|
18
|
-
]
|
|
19
|
-
];
|
|
20
|
-
loop.curves.forEach(function (curve) {
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (v < x || (v === x && bounds.ts[0][0] > extremes[0][0].t)) {
|
|
29
|
-
extremes[0][0] = {
|
|
30
|
-
bezier: curve,
|
|
31
|
-
t: bounds.ts[0][0],
|
|
32
|
-
val: v
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (v < x || (v === x && bounds.ts[0][1] > extremes[0][1].t)) {
|
|
40
|
-
extremes[0][1] = {
|
|
41
|
-
bezier: curve,
|
|
42
|
-
t: bounds.ts[0][1],
|
|
43
|
-
val: v
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
{
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (v > x || (v === x && bounds.ts[1][0] > extremes[1][0].t)) {
|
|
53
|
-
extremes[1][0] = {
|
|
54
|
-
bezier: curve,
|
|
55
|
-
t: bounds.ts[1][0],
|
|
56
|
-
val: v
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (v > x || (v === x && bounds.ts[1][1] > extremes[1][1].t)) {
|
|
64
|
-
extremes[1][1] = {
|
|
65
|
-
bezier: curve,
|
|
66
|
-
t: bounds.ts[1][1],
|
|
67
|
-
val: v
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
minX: new PointOnShape(extremes[0][0].bezier, extremes[0][0].t),
|
|
75
|
-
minY: new PointOnShape(extremes[0][1].bezier, extremes[0][1].t),
|
|
76
|
-
maxX: new PointOnShape(extremes[1][0].bezier, extremes[1][0].t),
|
|
77
|
-
maxY: new PointOnShape(extremes[1][1].bezier, extremes[1][1].t)
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
export { getLoopBounds };
|
|
1
|
+
import { getBounds } from 'flo-bezier3';
|
|
2
|
+
import { memoize } from 'flo-memoize';
|
|
3
|
+
import { PointOnShape } from '../point-on-shape.js';
|
|
4
|
+
/** @hidden */
|
|
5
|
+
const INF = Number.POSITIVE_INFINITY;
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
const getLoopBounds = memoize(function (loop) {
|
|
10
|
+
const extremes = [
|
|
11
|
+
[
|
|
12
|
+
{ bezier: undefined, t: undefined, val: INF },
|
|
13
|
+
{ bezier: undefined, t: undefined, val: INF }
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
{ bezier: undefined, t: undefined, val: -INF },
|
|
17
|
+
{ bezier: undefined, t: undefined, val: -INF }
|
|
18
|
+
]
|
|
19
|
+
];
|
|
20
|
+
loop.curves.forEach(function (curve) {
|
|
21
|
+
const ps = curve.ps;
|
|
22
|
+
// const bounds = getBounds_(ps);
|
|
23
|
+
const bounds = getBounds(ps);
|
|
24
|
+
{
|
|
25
|
+
{
|
|
26
|
+
const v = bounds.box[0][0];
|
|
27
|
+
const x = extremes[0][0].val;
|
|
28
|
+
if (v < x || (v === x && bounds.ts[0][0] > extremes[0][0].t)) {
|
|
29
|
+
extremes[0][0] = {
|
|
30
|
+
bezier: curve,
|
|
31
|
+
t: bounds.ts[0][0],
|
|
32
|
+
val: v
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
{
|
|
37
|
+
const v = bounds.box[0][1];
|
|
38
|
+
const x = extremes[0][1].val;
|
|
39
|
+
if (v < x || (v === x && bounds.ts[0][1] > extremes[0][1].t)) {
|
|
40
|
+
extremes[0][1] = {
|
|
41
|
+
bezier: curve,
|
|
42
|
+
t: bounds.ts[0][1],
|
|
43
|
+
val: v
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
{
|
|
49
|
+
{
|
|
50
|
+
const v = bounds.box[1][0];
|
|
51
|
+
const x = extremes[1][0].val;
|
|
52
|
+
if (v > x || (v === x && bounds.ts[1][0] > extremes[1][0].t)) {
|
|
53
|
+
extremes[1][0] = {
|
|
54
|
+
bezier: curve,
|
|
55
|
+
t: bounds.ts[1][0],
|
|
56
|
+
val: v
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
{
|
|
61
|
+
const v = bounds.box[1][1];
|
|
62
|
+
const x = extremes[1][1].val;
|
|
63
|
+
if (v > x || (v === x && bounds.ts[1][1] > extremes[1][1].t)) {
|
|
64
|
+
extremes[1][1] = {
|
|
65
|
+
bezier: curve,
|
|
66
|
+
t: bounds.ts[1][1],
|
|
67
|
+
val: v
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
minX: new PointOnShape(extremes[0][0].bezier, extremes[0][0].t),
|
|
75
|
+
minY: new PointOnShape(extremes[0][1].bezier, extremes[0][1].t),
|
|
76
|
+
maxX: new PointOnShape(extremes[1][0].bezier, extremes[1][0].t),
|
|
77
|
+
maxY: new PointOnShape(extremes[1][1].bezier, extremes[1][1].t)
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
export { getLoopBounds };
|
|
81
81
|
//# sourceMappingURL=get-loop-bounds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-loop-bounds.js","sourceRoot":"","sources":["../../src/svg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AAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,EAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,EAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,IAAI,EAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAChE,CAAC;AACH,CAAC,CAAC,CAAC;AAGH,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
import { Loop } from '../loop.js';
|
|
3
|
-
/**
|
|
4
|
-
* @hidden
|
|
5
|
-
* Get topmost PointOnShape of the given loop.
|
|
6
|
-
*/
|
|
7
|
-
declare function getMinYPos(loop: Loop): import("../point-on-shape.js").IPointOnShape;
|
|
8
|
-
export { getMinYPos };
|
|
1
|
+
/** @hidden */
|
|
2
|
+
import { Loop } from '../loop.js';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
* Get topmost PointOnShape of the given loop.
|
|
6
|
+
*/
|
|
7
|
+
declare function getMinYPos(loop: Loop): import("../point-on-shape.js").IPointOnShape;
|
|
8
|
+
export { getMinYPos };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getLoopBounds } from './get-loop-bounds.js';
|
|
2
|
-
/**
|
|
3
|
-
* @hidden
|
|
4
|
-
* Get topmost PointOnShape of the given loop.
|
|
5
|
-
*/
|
|
6
|
-
function getMinYPos(loop) {
|
|
7
|
-
return getLoopBounds(loop).minY;
|
|
8
|
-
}
|
|
9
|
-
export { getMinYPos };
|
|
1
|
+
import { getLoopBounds } from './get-loop-bounds.js';
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
* Get topmost PointOnShape of the given loop.
|
|
5
|
+
*/
|
|
6
|
+
function getMinYPos(loop) {
|
|
7
|
+
return getLoopBounds(loop).minY;
|
|
8
|
+
}
|
|
9
|
+
export { getMinYPos };
|
|
10
10
|
//# sourceMappingURL=get-min-y-pos.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Loop } from '../loop.js';
|
|
2
|
-
/** @
|
|
3
|
-
declare
|
|
4
|
-
minX: import("../point-on-shape.js").IPointOnShape;
|
|
5
|
-
minY: import("../point-on-shape.js").IPointOnShape;
|
|
6
|
-
maxX: import("../point-on-shape.js").IPointOnShape;
|
|
7
|
-
maxY: import("../point-on-shape.js").IPointOnShape;
|
|
8
|
-
};
|
|
9
|
-
export { getShapeBounds };
|
|
1
|
+
import { Loop } from '../loop.js';
|
|
2
|
+
/** @internal */
|
|
3
|
+
declare const getShapeBounds: (a: Loop[]) => {
|
|
4
|
+
minX: import("../point-on-shape.js").IPointOnShape;
|
|
5
|
+
minY: import("../point-on-shape.js").IPointOnShape;
|
|
6
|
+
maxX: import("../point-on-shape.js").IPointOnShape;
|
|
7
|
+
maxY: import("../point-on-shape.js").IPointOnShape;
|
|
8
|
+
};
|
|
9
|
+
export { getShapeBounds };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { memoize } from 'flo-memoize';
|
|
2
|
-
import { getLoopBounds } from './get-loop-bounds.js';
|
|
3
|
-
// TODO - move to another library
|
|
4
|
-
/** @
|
|
5
|
-
|
|
6
|
-
let minX_ = Number.POSITIVE_INFINITY;
|
|
7
|
-
let maxX_ = Number.NEGATIVE_INFINITY;
|
|
8
|
-
let minY_ = Number.POSITIVE_INFINITY;
|
|
9
|
-
let maxY_ = Number.NEGATIVE_INFINITY;
|
|
10
|
-
let minX;
|
|
11
|
-
let maxX;
|
|
12
|
-
let minY;
|
|
13
|
-
let maxY;
|
|
14
|
-
for (
|
|
15
|
-
|
|
16
|
-
if (bounds.minX.p[0] < minX_) {
|
|
17
|
-
minX = bounds.minX;
|
|
18
|
-
minX_ = bounds.minX.p[0];
|
|
19
|
-
}
|
|
20
|
-
if (bounds.maxX.p[0] > maxX_) {
|
|
21
|
-
maxX = bounds.maxX;
|
|
22
|
-
maxX_ = bounds.maxX.p[0];
|
|
23
|
-
}
|
|
24
|
-
if (bounds.minY.p[1] < minY_) {
|
|
25
|
-
minY = bounds.minY;
|
|
26
|
-
minY_ = bounds.minY.p[1];
|
|
27
|
-
}
|
|
28
|
-
if (bounds.maxY.p[1] > maxY_) {
|
|
29
|
-
maxY = bounds.maxY;
|
|
30
|
-
maxY_ = bounds.maxY.p[1];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return { minX, minY, maxX, maxY };
|
|
34
|
-
});
|
|
35
|
-
export { getShapeBounds };
|
|
1
|
+
import { memoize } from 'flo-memoize';
|
|
2
|
+
import { getLoopBounds } from './get-loop-bounds.js';
|
|
3
|
+
// TODO - move to another library
|
|
4
|
+
/** @internal */
|
|
5
|
+
const getShapeBounds = memoize(function (loops) {
|
|
6
|
+
let minX_ = Number.POSITIVE_INFINITY;
|
|
7
|
+
let maxX_ = Number.NEGATIVE_INFINITY;
|
|
8
|
+
let minY_ = Number.POSITIVE_INFINITY;
|
|
9
|
+
let maxY_ = Number.NEGATIVE_INFINITY;
|
|
10
|
+
let minX;
|
|
11
|
+
let maxX;
|
|
12
|
+
let minY;
|
|
13
|
+
let maxY;
|
|
14
|
+
for (const loop of loops) {
|
|
15
|
+
const bounds = getLoopBounds(loop);
|
|
16
|
+
if (bounds.minX.p[0] < minX_) {
|
|
17
|
+
minX = bounds.minX;
|
|
18
|
+
minX_ = bounds.minX.p[0];
|
|
19
|
+
}
|
|
20
|
+
if (bounds.maxX.p[0] > maxX_) {
|
|
21
|
+
maxX = bounds.maxX;
|
|
22
|
+
maxX_ = bounds.maxX.p[0];
|
|
23
|
+
}
|
|
24
|
+
if (bounds.minY.p[1] < minY_) {
|
|
25
|
+
minY = bounds.minY;
|
|
26
|
+
minY_ = bounds.minY.p[1];
|
|
27
|
+
}
|
|
28
|
+
if (bounds.maxY.p[1] > maxY_) {
|
|
29
|
+
maxY = bounds.maxY;
|
|
30
|
+
maxY_ = bounds.maxY.p[1];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { minX, minY, maxX, maxY };
|
|
34
|
+
});
|
|
35
|
+
export { getShapeBounds };
|
|
36
36
|
//# sourceMappingURL=get-shape-bounds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-shape-bounds.js","sourceRoot":"","sources":["../../src/svg/get-shape-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,iCAAiC;AAGjC,
|
|
1
|
+
{"version":3,"file":"get-shape-bounds.js","sourceRoot":"","sources":["../../src/svg/get-shape-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,iCAAiC;AAGjC,gBAAgB;AAChB,MAAM,cAAc,GAAG,OAAO,CAAC,UAAS,KAAa;IACjD,IAAI,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACrC,IAAI,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACrC,IAAI,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC;IACrC,IAAI,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAErC,IAAI,IAAI,CAAC;IACT,IAAI,IAAI,CAAC;IACT,IAAI,IAAI,CAAC;IACT,IAAI,IAAI,C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of items that are to be compared. Items should
|
|
8
|
-
* typically be geometric objects in 2d space with well-defined left and right
|
|
9
|
-
* endpoints.
|
|
10
|
-
* @param getLeftmostPoint A function that returns the leftmost point of the
|
|
11
|
-
* geometric object of interest.
|
|
12
|
-
* @param getRightmostPoint A function that returns the rightmost point of the
|
|
13
|
-
* geometric object of interest.
|
|
14
|
-
* @param predicate A predicate that takes two geometric objects and returns
|
|
15
|
-
* true if they are of interest or false otherwise.
|
|
16
|
-
*/
|
|
17
|
-
declare function sweepLine<T>(items: T[], getLeftmost: (item: T) => number, getRightmost: (item: T) => number, predicate: (item1: T, item2: T) => boolean): [T, T][];
|
|
18
|
-
export { sweepLine };
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
* Generalized sweepline algorithm.
|
|
4
|
+
*
|
|
5
|
+
* Typically used to turn O(n^2) algorithms into roughly O(n logn) algorithms.
|
|
6
|
+
*
|
|
7
|
+
* @param items An array of items that are to be compared. Items should
|
|
8
|
+
* typically be geometric objects in 2d space with well-defined left and right
|
|
9
|
+
* endpoints.
|
|
10
|
+
* @param getLeftmostPoint A function that returns the leftmost point of the
|
|
11
|
+
* geometric object of interest.
|
|
12
|
+
* @param getRightmostPoint A function that returns the rightmost point of the
|
|
13
|
+
* geometric object of interest.
|
|
14
|
+
* @param predicate A predicate that takes two geometric objects and returns
|
|
15
|
+
* true if they are of interest or false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
declare function sweepLine<T>(items: T[], getLeftmost: (item: T) => number, getRightmost: (item: T) => number, predicate: (item1: T, item2: T) => boolean): [T, T][];
|
|
18
|
+
export { sweepLine };
|