flo-mat 1.2.0 → 2.0.0
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/.mocharc.cjs +17 -0
- package/README.md +12 -1
- package/browser/index.js +7348 -0
- package/browser/index.min.js +2 -1
- package/browser/index.min.js.LICENSE.txt +2907 -0
- package/browser/index.module.js +7369 -0
- package/browser/index.module.min.js +2 -0
- package/browser/index.module.min.js.LICENSE.txt +2907 -0
- package/node/circle.js +3 -7
- package/node/circle.js.map +1 -1
- package/node/compare-curvatures-at-interface.d.ts +19 -0
- package/node/compare-curvatures-at-interface.js +125 -0
- package/node/compare-curvatures-at-interface.js.map +1 -0
- package/node/contact-point.d.ts +2 -2
- package/node/contact-point.js +3 -6
- package/node/contact-point.js.map +1 -1
- package/node/cp-node/clone.d.ts +1 -1
- package/node/cp-node/clone.js +4 -7
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/remove.d.ts +2 -2
- package/node/cp-node/remove.js +1 -4
- package/node/cp-node/remove.js.map +1 -1
- package/node/cp-node.d.ts +4 -5
- package/node/cp-node.js +8 -12
- package/node/cp-node.js.map +1 -1
- package/node/curve.d.ts +2 -2
- package/node/curve.js +10 -14
- package/node/curve.js.map +1 -1
- package/node/debug/cp-node-for-debugging.d.ts +2 -2
- package/node/debug/cp-node-for-debugging.js +1 -2
- package/node/debug/debug-elem-types.d.ts +8 -8
- package/node/debug/debug-elem-types.js +1 -2
- package/node/debug/debug.d.ts +5 -7
- package/node/debug/debug.js +67 -10
- package/node/debug/debug.js.map +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.js +3 -6
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.d.ts +1 -1
- package/node/debug/functions/draw-elem/branch.js +5 -8
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.d.ts +1 -1
- package/node/debug/functions/draw-elem/culls.js +1 -4
- package/node/debug/functions/draw-elem/culls.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -4
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-elem.js +34 -37
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.d.ts +1 -1
- package/node/debug/functions/draw-elem/dull-corner.js +5 -7
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +1 -1
- package/node/debug/functions/draw-elem/leaves.js +3 -6
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loop.d.ts +1 -1
- package/node/debug/functions/draw-elem/loop.js +1 -4
- package/node/debug/functions/draw-elem/loop.js.map +1 -1
- package/node/debug/functions/draw-elem/loops.d.ts +1 -1
- package/node/debug/functions/draw-elem/loops.js +1 -4
- package/node/debug/functions/draw-elem/loops.js.map +1 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -6
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.d.ts +1 -1
- package/node/debug/functions/draw-elem/mat.js +7 -10
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.d.ts +1 -1
- package/node/debug/functions/draw-elem/max-vertex.js +3 -6
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.d.ts +1 -1
- package/node/debug/functions/draw-elem/min-y.js +9 -12
- 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 +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +7 -10
- 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 +1 -1
- package/node/debug/functions/draw-elem/one-prong.js +9 -12
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.d.ts +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.js +3 -6
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +1 -1
- package/node/debug/functions/draw-elem/three-prong.js +9 -12
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -6
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +1 -1
- package/node/debug/functions/draw-elem/two-prong.js +9 -12
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.d.ts +1 -1
- package/node/debug/functions/draw-elem/vertex.js +7 -10
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +1 -1
- package/node/debug/functions/general.js +3 -6
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.js +24 -27
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +1 -1
- package/node/debug/functions/two-prong.js +10 -13
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/debug/three-prong-for-debugging.d.ts +4 -4
- package/node/debug/three-prong-for-debugging.js +4 -7
- package/node/debug/three-prong-for-debugging.js.map +1 -1
- package/node/debug/two-prong-for-debugging.d.ts +5 -5
- package/node/debug/two-prong-for-debugging.js +1 -2
- package/node/find-mats.d.ts +12 -9
- package/node/find-mats.js +47 -53
- package/node/find-mats.js.map +1 -1
- package/node/get-boundary-bezier-parts-to-next.d.ts +3 -3
- package/node/get-boundary-bezier-parts-to-next.js +1 -4
- package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/get-boundary-beziers-to-next.d.ts +1 -1
- package/node/get-boundary-beziers-to-next.js +8 -8
- package/node/get-boundary-beziers-to-next.js.map +1 -1
- package/node/get-bounding-box-.d.ts +2 -0
- package/node/get-bounding-box-.js +5 -0
- package/node/get-bounding-box-.js.map +1 -0
- package/node/get-branches.d.ts +1 -1
- package/node/get-branches.js +7 -10
- package/node/get-branches.js.map +1 -1
- package/node/get-curve/get-curve-between.d.ts +1 -1
- package/node/get-curve/get-curve-between.js +21 -24
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.d.ts +1 -1
- package/node/get-curve/get-edge-direction.js +12 -15
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/get-curve-to-next.d.ts +1 -1
- package/node/get-curve-to-next.js +3 -6
- package/node/get-curve-to-next.js.map +1 -1
- package/node/get-interface-ccw.d.ts +24 -0
- package/node/get-interface-ccw.js +98 -0
- package/node/get-interface-ccw.js.map +1 -0
- package/node/index.d.ts +35 -36
- package/node/index.js +32 -56
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.js +1 -4
- package/node/loop/get-max-coordinate.js.map +1 -1
- package/node/loop.d.ts +1 -1
- package/node/loop.js +1 -4
- package/node/loop.js.map +1 -1
- package/node/mat/add-to-cp-graph.d.ts +5 -5
- package/node/mat/add-to-cp-graph.js +5 -8
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/bezier-piece.d.ts +1 -1
- package/node/mat/bezier-piece.js +1 -2
- package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +1 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +15 -14
- 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 +1 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +7 -10
- 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 +1 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +5 -8
- 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 +1 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +7 -8
- 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 +1 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.js +6 -9
- 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 +2 -2
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +9 -12
- 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 +3 -3
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +10 -13
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
- package/node/mat/corner.js +1 -2
- package/node/mat/create-new-cp-tree.d.ts +3 -3
- package/node/mat/create-new-cp-tree.js +5 -7
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/elem-type-two-prong.js +1 -2
- package/node/mat/find-mat/add-1-prong.d.ts +4 -4
- package/node/mat/find-mat/add-1-prong.js +9 -12
- package/node/mat/find-mat/add-1-prong.js.map +1 -1
- package/node/mat/find-mat/add-2-prong.d.ts +5 -5
- package/node/mat/find-mat/add-2-prong.js +19 -22
- package/node/mat/find-mat/add-2-prong.js.map +1 -1
- package/node/mat/find-mat/add-3-prong.d.ts +5 -5
- package/node/mat/find-mat/add-3-prong.js +7 -10
- package/node/mat/find-mat/add-3-prong.js.map +1 -1
- package/node/mat/find-mat/add-debug-info.d.ts +2 -2
- package/node/mat/find-mat/add-debug-info.js +8 -13
- 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 +3 -3
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +29 -16
- 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 +4 -4
- package/node/mat/find-mat/create-initial-cp-graph.js +7 -9
- 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 +5 -5
- package/node/mat/find-mat/find-2-prong/add-debug-info.js +3 -6
- 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 +1 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +5 -8
- 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 +5 -5
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +37 -39
- 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.js +1 -4
- 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 +5 -5
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +7 -10
- 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 +1 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.js +1 -2
- package/node/mat/find-mat/find-3-prong/calc-better-x.d.ts +2 -2
- package/node/mat/find-mat/find-3-prong/calc-better-x.js +10 -13
- 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 +2 -2
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +6 -8
- 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 +3 -3
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +29 -32
- 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 +3 -3
- package/node/mat/find-mat/find-3-prong/find-3-prong.js +14 -12
- 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 +2 -2
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +3 -6
- 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 +4 -4
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +3 -6
- 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 +4 -4
- package/node/mat/find-mat/find-and-add-2-prongs.js +9 -12
- 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 +3 -3
- package/node/mat/find-mat/find-and-add-3-prongs.js +8 -11
- 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 +3 -3
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +11 -14
- 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 +1 -1
- package/node/mat/find-mat/get-potential-2-prongs.js +3 -6
- package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
- package/node/mat/find-mat/get-sharp-corners.d.ts +1 -1
- package/node/mat/find-mat/get-sharp-corners.js +3 -6
- package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
- package/node/mat/geometry/get-closest-square-distance-to-rect.js +21 -15
- package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +1 -1
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +5 -8
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
- package/node/mat/get-boundary-piece-beziers.js +6 -9
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-contact-circles-at-interface.d.ts +2 -2
- package/node/mat/get-contact-circles-at-interface.js +7 -10
- package/node/mat/get-contact-circles-at-interface.js.map +1 -1
- package/node/mat/get-largest-vertex.d.ts +1 -1
- package/node/mat/get-largest-vertex.js +1 -4
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/get-leaves.d.ts +1 -1
- package/node/mat/get-leaves.js +1 -4
- package/node/mat/get-leaves.js.map +1 -1
- package/node/mat/get-neighboring-cps.d.ts +3 -3
- package/node/mat/get-neighboring-cps.js +5 -8
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/get-two-prong-type.d.ts +2 -2
- package/node/mat/get-two-prong-type.js +1 -4
- package/node/mat/get-two-prong-type.js.map +1 -1
- package/node/mat/is-another-cp-closeby.d.ts +5 -5
- package/node/mat/is-another-cp-closeby.js +8 -11
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/mat/simplify-mat-map-only.d.ts +1 -1
- package/node/mat/simplify-mat-map-only.js +10 -14
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/mat/to-scale-axis/add-debug-info.d.ts +1 -1
- package/node/mat/to-scale-axis/add-debug-info.js +1 -4
- package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
- package/node/mat/to-scale-axis/cull-non-cycles.d.ts +1 -1
- package/node/mat/to-scale-axis/cull-non-cycles.js +5 -8
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
- package/node/mat/to-scale-axis/cull.d.ts +2 -2
- package/node/mat/to-scale-axis/cull.js +75 -8
- package/node/mat/to-scale-axis/cull.js.map +1 -1
- package/node/mat/trim-mat.d.ts +1 -1
- package/node/mat/trim-mat.js +6 -9
- package/node/mat/trim-mat.js.map +1 -1
- package/node/mat.d.ts +3 -3
- package/node/mat.js +1 -2
- package/node/point-on-shape.d.ts +2 -2
- package/node/point-on-shape.js +23 -34
- package/node/point-on-shape.js.map +1 -1
- package/node/simplify-mat.d.ts +4 -3
- package/node/simplify-mat.js +14 -16
- package/node/simplify-mat.js.map +1 -1
- package/node/svg/get-loop-bounds.d.ts +2 -2
- package/node/svg/get-loop-bounds.js +11 -13
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +3 -2
- package/node/svg/get-min-y-pos.js +3 -6
- package/node/svg/get-min-y-pos.js.map +1 -1
- package/node/svg/get-shape-bounds.d.ts +5 -5
- package/node/svg/get-shape-bounds.js +5 -8
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.js +1 -4
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/node/to-scale-axis.d.ts +2 -1
- package/node/to-scale-axis.js +18 -21
- package/node/to-scale-axis.js.map +1 -1
- package/node/traverse-edges.d.ts +1 -1
- package/node/traverse-edges.js +1 -4
- package/node/traverse-edges.js.map +1 -1
- package/node/traverse-vertices.d.ts +1 -1
- package/node/traverse-vertices.js +1 -4
- package/node/traverse-vertices.js.map +1 -1
- package/package.json +34 -31
- package/src/circle.ts +0 -6
- package/src/compare-curvatures-at-interface.ts +197 -0
- package/src/contact-point.ts +2 -3
- package/src/cp-node/clone.ts +1 -2
- package/src/cp-node/remove.ts +2 -3
- package/src/cp-node.ts +6 -8
- package/src/curve.ts +3 -4
- package/src/debug/cp-node-for-debugging.ts +2 -3
- package/src/debug/debug-elem-types.ts +8 -10
- package/src/debug/debug.ts +22 -17
- package/src/debug/functions/draw-elem/bounding-hull.ts +0 -1
- package/src/debug/functions/draw-elem/branch.ts +2 -3
- package/src/debug/functions/draw-elem/culls.ts +1 -2
- package/src/debug/functions/draw-elem/draw-elem.ts +18 -19
- package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
- package/src/debug/functions/draw-elem/leaves.ts +2 -4
- package/src/debug/functions/draw-elem/loop.ts +1 -2
- package/src/debug/functions/draw-elem/loops.ts +1 -2
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -1
- package/src/debug/functions/draw-elem/mat.ts +3 -5
- package/src/debug/functions/draw-elem/max-vertex.ts +1 -2
- package/src/debug/functions/draw-elem/min-y.ts +5 -7
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +1 -2
- package/src/debug/functions/draw-elem/one-prong.ts +2 -3
- package/src/debug/functions/draw-elem/sharp-corner.ts +1 -2
- package/src/debug/functions/draw-elem/three-prong.ts +2 -4
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -1
- package/src/debug/functions/draw-elem/two-prong.ts +2 -3
- package/src/debug/functions/draw-elem/vertex.ts +1 -2
- package/src/debug/functions/general.ts +2 -3
- package/src/debug/functions/three-prong.ts +3 -4
- package/src/debug/functions/two-prong.ts +6 -14
- package/src/debug/three-prong-for-debugging.ts +4 -5
- package/src/debug/two-prong-for-debugging.ts +5 -6
- package/src/find-mats.ts +34 -39
- package/src/get-boundary-bezier-parts-to-next.ts +5 -6
- package/src/get-boundary-beziers-to-next.ts +8 -7
- package/src/get-bounding-box-.ts +7 -0
- package/src/get-branches.ts +2 -3
- package/src/get-curve/get-curve-between.ts +2 -3
- package/src/get-curve/get-edge-direction.ts +2 -5
- package/src/get-curve-to-next.ts +2 -3
- package/src/get-interface-ccw.ts +112 -0
- package/src/index.ts +34 -48
- package/src/loop/get-max-coordinate.ts +0 -1
- package/src/loop.ts +1 -2
- package/src/mat/add-to-cp-graph.ts +7 -8
- package/src/mat/bezier-piece.ts +1 -2
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +19 -17
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +4 -5
- package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +4 -5
- package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +7 -5
- package/src/mat/closest-boundary-point/get-best-distance-squared.ts +1 -2
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +4 -11
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +5 -6
- package/src/mat/cmp-cp-on-delta.ts +2 -3
- package/src/mat/create-new-cp-tree.ts +5 -5
- package/src/mat/find-mat/add-1-prong.ts +7 -8
- package/src/mat/find-mat/add-2-prong.ts +11 -12
- package/src/mat/find-mat/add-3-prong.ts +7 -8
- package/src/mat/find-mat/add-debug-info.ts +8 -7
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +22 -8
- package/src/mat/find-mat/create-initial-cp-graph.ts +7 -8
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +9 -10
- package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +4 -7
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +19 -17
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +7 -8
- package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +1 -2
- package/src/mat/find-mat/find-3-prong/calc-better-x.ts +3 -6
- package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -8
- package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +10 -14
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +13 -8
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +2 -5
- package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +5 -6
- package/src/mat/find-mat/find-and-add-2-prongs.ts +9 -10
- package/src/mat/find-mat/find-and-add-3-prongs.ts +8 -9
- package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +7 -8
- package/src/mat/find-mat/get-potential-2-prongs.ts +1 -2
- package/src/mat/find-mat/get-sharp-corners.ts +1 -2
- package/src/mat/find-mat/get-total-abs-curvature.ts +2 -3
- package/src/mat/find-mat/get-total-by.ts +2 -3
- package/src/mat/geometry/get-closest-square-distance-to-rect.ts +15 -4
- package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +0 -1
- package/src/mat/get-boundary-piece-beziers.ts +5 -6
- package/src/mat/get-contact-circles-at-interface.ts +3 -4
- package/src/mat/get-edges-as-array.ts +2 -3
- package/src/mat/get-largest-three-prong.ts +1 -2
- package/src/mat/get-largest-vertex.ts +1 -2
- package/src/mat/get-leaves.ts +1 -2
- package/src/mat/get-neighboring-cps.ts +5 -6
- package/src/mat/get-two-prong-type.ts +2 -3
- package/src/mat/is-another-cp-closeby.ts +6 -7
- package/src/mat/simplify-mat-map-only.ts +5 -7
- package/src/mat/to-scale-axis/add-debug-info.ts +2 -3
- package/src/mat/to-scale-axis/add-to-tree.ts +3 -4
- package/src/mat/to-scale-axis/calc-groups.ts +1 -2
- package/src/mat/to-scale-axis/create-spacial-tree.ts +3 -4
- package/src/mat/to-scale-axis/cull-non-cycles.ts +2 -3
- package/src/mat/to-scale-axis/cull.ts +3 -4
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +3 -4
- package/src/mat/to-scale-axis/t-tree.ts +1 -2
- package/src/mat/to-scale-axis/traverse-spacial-tree.ts +2 -4
- package/src/mat/trim-mat.ts +4 -5
- package/src/mat.ts +3 -5
- package/src/point-on-shape.ts +10 -12
- package/src/simplify-mat.ts +11 -13
- package/src/svg/get-curvature-at-interface.ts +1 -3
- package/src/svg/get-extreme.ts +2 -3
- package/src/svg/get-loop-bounds.ts +4 -4
- package/src/svg/get-min-y-pos.ts +2 -6
- package/src/svg/get-shape-bounds.ts +2 -3
- package/src/sweep-line/are-boxes-intersecting.ts +1 -1
- package/src/to-scale-axis.ts +15 -16
- package/src/traverse-edges.ts +1 -2
- package/src/traverse-vertices.ts +1 -2
- package/test/lib-load.spec.ts +0 -1
- package/tsconfig.json +6 -31
- package/webpack.config.cjs +132 -0
- package/.nycrc +0 -4
- package/node/mat/cmp-cp-on-delta.d.ts +0 -14
- package/node/mat/cmp-cp-on-delta.js +0 -45
- package/node/mat/cmp-cp-on-delta.js.map +0 -1
- package/node/mat/find-mat/get-total-abs-curvature.d.ts +0 -5
- package/node/mat/find-mat/get-total-abs-curvature.js +0 -13
- package/node/mat/find-mat/get-total-abs-curvature.js.map +0 -1
- package/node/mat/find-mat/get-total-by.d.ts +0 -10
- package/node/mat/find-mat/get-total-by.js +0 -22
- package/node/mat/find-mat/get-total-by.js.map +0 -1
- package/node/mat/get-edges-as-array.d.ts +0 -4
- package/node/mat/get-edges-as-array.js +0 -12
- package/node/mat/get-edges-as-array.js.map +0 -1
- package/node/mat/get-largest-three-prong.d.ts +0 -4
- package/node/mat/get-largest-three-prong.js +0 -13
- package/node/mat/get-largest-three-prong.js.map +0 -1
- package/node/mat/to-scale-axis/add-to-tree.d.ts +0 -13
- package/node/mat/to-scale-axis/add-to-tree.js +0 -39
- package/node/mat/to-scale-axis/add-to-tree.js.map +0 -1
- package/node/mat/to-scale-axis/calc-groups.d.ts +0 -28
- package/node/mat/to-scale-axis/calc-groups.js +0 -66
- package/node/mat/to-scale-axis/calc-groups.js.map +0 -1
- package/node/mat/to-scale-axis/create-spacial-tree.d.ts +0 -9
- package/node/mat/to-scale-axis/create-spacial-tree.js +0 -24
- package/node/mat/to-scale-axis/create-spacial-tree.js.map +0 -1
- package/node/mat/to-scale-axis/get-engulfed-vertices.d.ts +0 -12
- package/node/mat/to-scale-axis/get-engulfed-vertices.js +0 -95
- package/node/mat/to-scale-axis/get-engulfed-vertices.js.map +0 -1
- package/node/mat/to-scale-axis/t-tree.d.ts +0 -6
- package/node/mat/to-scale-axis/t-tree.js +0 -3
- package/node/mat/to-scale-axis/t-tree.js.map +0 -1
- package/node/mat/to-scale-axis/traverse-spacial-tree.d.ts +0 -11
- package/node/mat/to-scale-axis/traverse-spacial-tree.js +0 -25
- package/node/mat/to-scale-axis/traverse-spacial-tree.js.map +0 -1
- package/node/svg/get-curvature-at-interface.d.ts +0 -9
- package/node/svg/get-curvature-at-interface.js +0 -49
- package/node/svg/get-curvature-at-interface.js.map +0 -1
- package/node/svg/get-extreme.d.ts +0 -9
- package/node/svg/get-extreme.js +0 -16
- package/node/svg/get-extreme.js.map +0 -1
- package/node/sweep-line/are-boxes-intersecting.d.ts +0 -11
- package/node/sweep-line/are-boxes-intersecting.js +0 -42
- package/node/sweep-line/are-boxes-intersecting.js.map +0 -1
- package/test/mocha.opts +0 -4
- package/webpack.config.js +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"three-prong-for-debugging.js","sourceRoot":"","sources":["../../src/debug/three-prong-for-debugging.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"three-prong-for-debugging.js","sourceRoot":"","sources":["../../src/debug/three-prong-for-debugging.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAgCvE,SAAS,iCAAiC;IACtC,OAAO;QACH,SAAS,EAAI,SAAS;QACtB,MAAM,EAAO,SAAS;QACtB,IAAI,EAAS,SAAS;QACtB,KAAK,EAAQ,SAAS;QACtB,IAAI,EAAS,SAAS;QACtB,QAAQ,EAAK,SAAS;QACtB,oBAAoB,EAAG,SAAS;QAChC,UAAU,EAAG,SAAS;QACtB,UAAU,EAAG,SAAS;QACtB,MAAM,EAAO,SAAS;KACzB,CAAA;AACL,CAAC;AAED,SAAS,SAAS,CAAC,sBAA8C;IAC7D,OAAO,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CACvC,CAAC,gBAAgB,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAE;QACxC,gBAAgB,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAE,CAAC,CAC7C,CAAC;AACN,CAAC;AAGD,OAAO,EAA0B,iCAAiC,EAAE,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node';
|
|
2
|
-
import { IPointOnShape } from '../point-on-shape';
|
|
3
|
-
import { Circle } from '../circle';
|
|
4
|
-
import { BezierPiece } from '../mat/bezier-piece';
|
|
5
|
-
import { Generated } from './debug';
|
|
1
|
+
import { CpNode } from '../cp-node.js';
|
|
2
|
+
import { IPointOnShape } from '../point-on-shape.js';
|
|
3
|
+
import { Circle } from '../circle.js';
|
|
4
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
5
|
+
import { Generated } from './debug.js';
|
|
6
6
|
/** @hidden */
|
|
7
7
|
interface TwoProngForDebugging {
|
|
8
8
|
generated: Generated;
|
package/node/find-mats.d.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { Mat } from './mat';
|
|
1
|
+
import { Mat } from './mat.js';
|
|
2
2
|
/**
|
|
3
3
|
* Finds and returns the Medial Axis Transforms (MATs) from the given array of
|
|
4
4
|
* bezier loops representing shape boundaries.
|
|
5
|
+
*
|
|
5
6
|
* @param bezierLoops An array of (possibly intersecting) loops with each loop
|
|
6
7
|
* representing one or more piecewise smooth closed curves (i.e. shapes). Each
|
|
7
8
|
* loop consists of an array of beziers represented by an array of control
|
|
8
9
|
* points with 2,3 or 4 elements corresponding to linear, quadratic and cubic
|
|
9
10
|
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
10
11
|
* first of which is the x-coordinate and the second the y-coordinate.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
*
|
|
13
|
+
* @param maxCurviness The maximum value the 'curviness' of a curve can have
|
|
14
|
+
* before an additional MAT point is inserted in between. Defaults to 0.4.
|
|
15
|
+
* (Curviness is measured as the total angle in radians between the consecutive
|
|
16
|
+
* vectors formed by the ordered control points of th bezier curve). The value
|
|
17
|
+
* is clipped in the range `[0.05,3]`.
|
|
15
18
|
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
16
|
-
* point is
|
|
17
|
-
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the will be
|
|
18
|
-
* halved, e.g. from 10 to 5). Together with
|
|
19
|
+
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
20
|
+
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
21
|
+
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
19
22
|
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
20
23
|
* in [1,100].
|
|
21
24
|
*/
|
|
22
|
-
declare function findMats(bezierLoops: number[][][][],
|
|
25
|
+
declare function findMats(bezierLoops: number[][][][], maxCurviness?: number, maxLength?: number): Mat[];
|
|
23
26
|
export { findMats };
|
package/node/find-mats.js
CHANGED
|
@@ -1,76 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const flo_boolean_1 = require("flo-boolean");
|
|
5
|
-
const find_and_add_3_prongs_1 = require("./mat/find-mat/find-and-add-3-prongs");
|
|
6
|
-
const create_initial_cp_graph_1 = require("./mat/find-mat/create-initial-cp-graph");
|
|
1
|
+
import { simplifyPaths } from 'flo-boolean';
|
|
2
|
+
import { findAndAddAll3Prongs } from './mat/find-mat/find-and-add-3-prongs.js';
|
|
3
|
+
import { createInitialCpGraph } from './mat/find-mat/create-initial-cp-graph.js';
|
|
7
4
|
;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 } from './mat/find-mat/add-debug-info.js';
|
|
6
|
+
import { getPotential2Prongs } from './mat/find-mat/get-potential-2-prongs.js';
|
|
7
|
+
import { getSharpCorners } from './mat/find-mat/get-sharp-corners.js';
|
|
8
|
+
import { findAndAdd2ProngsOnAllPaths } from './mat/find-mat/find-and-add-2-prongs-on-all-paths.js';
|
|
9
|
+
import { getInterestingPointsOnLoop } from './mat/find-mat/create-get-interesting-points-on-loop.js';
|
|
10
|
+
import { findAndAddHoleClosing2Prongs } from './mat/find-mat/find-and-add-hole-closing-2-prongs.js';
|
|
11
|
+
import { getLoopsMetrics } from './loop/get-max-coordinate.js';
|
|
15
12
|
/**
|
|
16
13
|
* Finds and returns the Medial Axis Transforms (MATs) from the given array of
|
|
17
14
|
* bezier loops representing shape boundaries.
|
|
15
|
+
*
|
|
18
16
|
* @param bezierLoops An array of (possibly intersecting) loops with each loop
|
|
19
17
|
* representing one or more piecewise smooth closed curves (i.e. shapes). Each
|
|
20
18
|
* loop consists of an array of beziers represented by an array of control
|
|
21
19
|
* points with 2,3 or 4 elements corresponding to linear, quadratic and cubic
|
|
22
20
|
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
23
21
|
* first of which is the x-coordinate and the second the y-coordinate.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @param maxCurviness The maximum value the 'curviness' of a curve can have
|
|
24
|
+
* before an additional MAT point is inserted in between. Defaults to 0.4.
|
|
25
|
+
* (Curviness is measured as the total angle in radians between the consecutive
|
|
26
|
+
* vectors formed by the ordered control points of th bezier curve). The value
|
|
27
|
+
* is clipped in the range `[0.05,3]`.
|
|
28
28
|
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
29
|
-
* point is
|
|
30
|
-
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the will be
|
|
31
|
-
* halved, e.g. from 10 to 5). Together with
|
|
29
|
+
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
30
|
+
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
31
|
+
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
32
32
|
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
33
33
|
* in [1,100].
|
|
34
34
|
*/
|
|
35
|
-
function findMats(bezierLoops,
|
|
35
|
+
function findMats(bezierLoops, maxCurviness = 0.4, maxLength = 4) {
|
|
36
36
|
if (typeof _debug_ !== 'undefined') {
|
|
37
37
|
var timingStart = performance.now();
|
|
38
38
|
}
|
|
39
39
|
let maxCoordinate;
|
|
40
40
|
let minBezLength;
|
|
41
|
-
({
|
|
42
|
-
getSizeParams(bezierLoops,
|
|
43
|
-
let loopss =
|
|
44
|
-
if (typeof _debug_ !== 'undefined') {
|
|
45
|
-
let timing = _debug_.generated.timing;
|
|
46
|
-
timing.simplifyPaths = performance.now() - timingStart;
|
|
47
|
-
}
|
|
41
|
+
({ maxCurviness, maxLength, maxCoordinate, minBezLength } =
|
|
42
|
+
getSizeParams(bezierLoops, maxCurviness, maxLength));
|
|
43
|
+
let loopss = simplifyPaths(bezierLoops, maxCoordinate);
|
|
48
44
|
let mats = [];
|
|
49
45
|
for (let loops of loopss) {
|
|
50
|
-
let mat = findMat(loops, minBezLength,
|
|
46
|
+
let mat = findMat(loops, minBezLength, maxCurviness, maxLength, maxCoordinate);
|
|
51
47
|
if (mat) {
|
|
52
48
|
mats.push(mat);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
51
|
return mats;
|
|
56
52
|
}
|
|
57
|
-
|
|
58
|
-
function getSizeParams(bezierLoops, maxFlatness, maxLength) {
|
|
53
|
+
function getSizeParams(bezierLoops, maxCurviness, maxLength) {
|
|
59
54
|
// Gather some shape metrics
|
|
60
|
-
let { maxCoordinate, maxRadius } =
|
|
55
|
+
let { maxCoordinate, maxRadius } = getLoopsMetrics(bezierLoops);
|
|
61
56
|
let expMax = Math.ceil(Math.log2(maxCoordinate));
|
|
62
57
|
let minBezLengthSigBits = 14;
|
|
63
58
|
/**
|
|
64
59
|
* If a curve is shorter than this value then no points on it will be
|
|
65
60
|
* selected for the purpose of finding the MAT.
|
|
66
61
|
*/
|
|
67
|
-
let minBezLength =
|
|
62
|
+
let minBezLength = 2 ** expMax * 2 ** (-minBezLengthSigBits);
|
|
68
63
|
// Limit the tolerance to a reasonable level
|
|
69
|
-
if (
|
|
70
|
-
|
|
64
|
+
if (maxCurviness < 0.05) {
|
|
65
|
+
maxCurviness = 0.05;
|
|
71
66
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
67
|
+
if (maxCurviness > 3) {
|
|
68
|
+
maxCurviness = 3;
|
|
74
69
|
}
|
|
75
70
|
// Limit the tolerance to a reasonable level
|
|
76
71
|
if (maxLength < 0.1) {
|
|
@@ -82,35 +77,33 @@ function getSizeParams(bezierLoops, maxFlatness, maxLength) {
|
|
|
82
77
|
// Adjust length tolerance according to a reference max coordinate
|
|
83
78
|
let expMaxRadius = Math.ceil(Math.log2(maxRadius));
|
|
84
79
|
let maxLengthSigBits = 10; // 1024 x 1024
|
|
85
|
-
maxLength = maxLength * (
|
|
86
|
-
return {
|
|
80
|
+
maxLength = maxLength * (2 ** expMaxRadius * 2 ** (-maxLengthSigBits));
|
|
81
|
+
return { maxCurviness, maxLength, maxCoordinate, minBezLength };
|
|
87
82
|
}
|
|
88
83
|
/**
|
|
89
84
|
* @hidden
|
|
90
85
|
* Find the MAT of the given loops.
|
|
91
86
|
* @param loops The loops (that as a precondition must be ordered from highest
|
|
92
87
|
* (i.e. smallest y-value) topmost point loops to lowest)
|
|
93
|
-
* @param xMap Intersection point map.
|
|
94
|
-
* @param additionalPointCount
|
|
95
88
|
*/
|
|
96
|
-
function findMat(loops, minBezLength,
|
|
97
|
-
|
|
89
|
+
function findMat(loops, minBezLength, maxCurviness, maxLength, maxCoordinate) {
|
|
90
|
+
addDebugInfo1(loops);
|
|
98
91
|
// Gets interesting points on the shape, i.e. those that makes sense to use
|
|
99
92
|
// for the 2-prong procedure.
|
|
100
|
-
let pointsPerLoop = loops.map(
|
|
101
|
-
let for2ProngsPerLoop =
|
|
102
|
-
let sharpCornersPerLoop =
|
|
93
|
+
let pointsPerLoop = loops.map(getInterestingPointsOnLoop(minBezLength, maxCurviness, maxLength));
|
|
94
|
+
let for2ProngsPerLoop = getPotential2Prongs(pointsPerLoop);
|
|
95
|
+
let sharpCornersPerLoop = getSharpCorners(pointsPerLoop);
|
|
103
96
|
let cpTrees = new Map();
|
|
104
|
-
let cpNode =
|
|
105
|
-
|
|
97
|
+
let cpNode = createInitialCpGraph(loops, cpTrees, sharpCornersPerLoop);
|
|
98
|
+
findAndAddHoleClosing2Prongs(loops, cpTrees, maxCoordinate);
|
|
106
99
|
if (typeof _debug_ !== 'undefined') {
|
|
107
100
|
if (_debug_.directives.stopAfterHoleClosers) {
|
|
108
101
|
return undefined;
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
cpNode =
|
|
113
|
-
|
|
104
|
+
addDebugInfo2();
|
|
105
|
+
cpNode = findAndAdd2ProngsOnAllPaths(loops, cpTrees, for2ProngsPerLoop, maxCoordinate);
|
|
106
|
+
addDebugInfo3();
|
|
114
107
|
if (typeof _debug_ !== 'undefined') {
|
|
115
108
|
if (_debug_.directives.stopAfterTwoProngs) {
|
|
116
109
|
return undefined;
|
|
@@ -119,14 +112,15 @@ function findMat(loops, minBezLength, maxFlatness, maxLength, maxCoordinate) {
|
|
|
119
112
|
if (cpNode === undefined) {
|
|
120
113
|
return undefined;
|
|
121
114
|
}
|
|
122
|
-
|
|
115
|
+
findAndAddAll3Prongs(cpTrees, cpNode, maxCoordinate);
|
|
123
116
|
if (typeof _debug_ !== 'undefined') {
|
|
124
117
|
if (_debug_.directives.stopAfterThreeProngs) {
|
|
125
118
|
return undefined;
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
121
|
let mat = { cpNode, cpTrees };
|
|
129
|
-
|
|
122
|
+
addDebugInfo4(mat);
|
|
130
123
|
return mat;
|
|
131
124
|
}
|
|
125
|
+
export { findMats };
|
|
132
126
|
//# sourceMappingURL=find-mats.js.map
|
package/node/find-mats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../src/find-mats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../src/find-mats.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,OAAO,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AEnB,OAAO,GAAG,CAAC;AACZ,CAAC;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CpNode } from './cp-node';
|
|
1
|
+
import { BezierPiece } from 'flo-bezier3';
|
|
2
|
+
import { CpNode } from './cp-node.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the ordered bezier curves from this CpNode to the next CpNode
|
|
5
5
|
* on the boundary.
|
|
6
6
|
* @param cpNode
|
|
7
7
|
*/
|
|
8
|
-
declare function getBoundaryBezierPartsToNext(cpNode: CpNode):
|
|
8
|
+
declare function getBoundaryBezierPartsToNext(cpNode: CpNode): BezierPiece[];
|
|
9
9
|
export { getBoundaryBezierPartsToNext };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBoundaryBezierPartsToNext = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Returns the ordered bezier curves from this CpNode to the next CpNode
|
|
6
3
|
* on the boundary.
|
|
@@ -28,7 +25,6 @@ function getBoundaryBezierPartsToNext(cpNode) {
|
|
|
28
25
|
}
|
|
29
26
|
return bezierParts;
|
|
30
27
|
}
|
|
31
|
-
exports.getBoundaryBezierPartsToNext = getBoundaryBezierPartsToNext;
|
|
32
28
|
/**
|
|
33
29
|
* @hidden
|
|
34
30
|
* Adds pieces of skipped beziers.
|
|
@@ -43,4 +39,5 @@ function addSkippedBeziers(bezierParts, curveStart, curveEnd, t1) {
|
|
|
43
39
|
bezierParts.push(bezierPart);
|
|
44
40
|
} while (curveThis !== curveEnd);
|
|
45
41
|
}
|
|
42
|
+
export { getBoundaryBezierPartsToNext };
|
|
46
43
|
//# sourceMappingURL=get-boundary-bezier-parts-to-next.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-bezier-parts-to-next.js","sourceRoot":"","sources":["../src/get-boundary-bezier-parts-to-next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-boundary-bezier-parts-to-next.js","sourceRoot":"","sources":["../src/get-boundary-bezier-parts-to-next.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,SAAS,4BAA4B,CAAC,MAAc;IAChD,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAEzB,IAAI,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IACrC,IAAI,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IAErC,IAAI,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9B,IAAI,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAE9B,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE;QACnC,wEAAwE;QACxE,UAAU;QACV,OAAO,SAAS,CAAC;KACpB;IAED,IAAI,WAAW,GAAkB,EAAE,CAAC;IAEpC,IAAI,SAAS,KAAK,SAAS,EAAE;QACzB,WAAW,CAAC,IAAI,CACZ,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CACvD,CAAC;KACL;SAAM;QACH,WAAW,CAAC,IAAI,CACZ,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAC/C,CAAC;QAEF,iBAAiB,CACT,WAAW,EACX,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,CAAC,CAChB,CAAC;KACL;IAED,OAAO,WAAW,CAAC;AACvB,CAAC;AAGD;;;GAGG;AACH,SAAS,iBAAiB,CAClB,WAA+C,EAC/C,UAAkB,EAClB,QAAkB,EAClB,EAAmB;IAEvB,IAAI,SAAS,GAAG,UAAU,CAAC;IAC3B,GAAG;QACC,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC;QAC3B,IAAI,UAAU,GAAG,SAAS,KAAK,QAAQ;YACnC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;YACnC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;QAEtC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAChC,QAAQ,SAAS,KAAK,QAAQ,EAAE;AAGrC,CAAC;AAGD,OAAO,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getBoundaryBeziersToNext = void 0;
|
|
4
|
-
const flo_bezier3_1 = require("flo-bezier3");
|
|
1
|
+
// qqq import { fromTo, fromTTo1, from0ToT } from 'flo-bezier3';
|
|
2
|
+
import { fromTo } from 'flo-bezier3';
|
|
5
3
|
/**
|
|
6
4
|
* Returns the ordered bezier curves from this CpNode to the next CpNode
|
|
7
5
|
* on the boundary.
|
|
@@ -21,15 +19,14 @@ function getBoundaryBeziersToNext(cpNode) {
|
|
|
21
19
|
}
|
|
22
20
|
let beziers = [];
|
|
23
21
|
if (curveNext === curveThis) {
|
|
24
|
-
beziers.push(
|
|
22
|
+
beziers.push(fromTo(posThis.curve.ps, posThis.t, posNext.t));
|
|
25
23
|
}
|
|
26
24
|
else {
|
|
27
|
-
beziers.push(
|
|
25
|
+
beziers.push(fromTo(posThis.curve.ps, posThis.t, 1));
|
|
28
26
|
addSkippedBeziers(beziers, posThis.curve, posNext.curve, posNext.t);
|
|
29
27
|
}
|
|
30
28
|
return beziers;
|
|
31
29
|
}
|
|
32
|
-
exports.getBoundaryBeziersToNext = getBoundaryBeziersToNext;
|
|
33
30
|
/**
|
|
34
31
|
* Adds pieces of skipped beziers.
|
|
35
32
|
* @hidden
|
|
@@ -39,7 +36,10 @@ function addSkippedBeziers(beziers, curveStart, curveEnd, t1) {
|
|
|
39
36
|
do {
|
|
40
37
|
curveThis = curveThis.next;
|
|
41
38
|
let tEnd = curveThis === curveEnd ? t1 : 1;
|
|
42
|
-
beziers.push(
|
|
39
|
+
beziers.push(
|
|
40
|
+
// qqq from0ToT(curveThis.ps, tEnd)
|
|
41
|
+
fromTo(curveThis.ps, 0, tEnd));
|
|
43
42
|
} while (curveThis !== curveEnd);
|
|
44
43
|
}
|
|
44
|
+
export { getBoundaryBeziersToNext };
|
|
45
45
|
//# sourceMappingURL=get-boundary-beziers-to-next.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../src/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../src/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAKrC;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,MAAc;IAC5C,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IAEzB,IAAI,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IACrC,IAAI,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IAErC,IAAI,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9B,IAAI,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC;IAE9B,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE;QACnC,wEAAwE;QACxE,UAAU;QACV,OAAO,SAAS,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Ac,CAAC,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/node/get-branches.d.ts
CHANGED
package/node/get-branches.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const flo_bezier3_1 = require("flo-bezier3");
|
|
5
|
-
const flo_vector2d_1 = require("flo-vector2d");
|
|
6
|
-
const get_curve_to_next_1 = require("./get-curve-to-next");
|
|
1
|
+
import { tangent } from 'flo-bezier3';
|
|
2
|
+
import { cross, toUnitVector } from 'flo-vector2d';
|
|
3
|
+
import { getCurveToNext } from './get-curve-to-next.js';
|
|
7
4
|
/** @hidden */
|
|
8
5
|
const defaultTolerance = 1; // 1 degree
|
|
9
6
|
/**
|
|
@@ -53,9 +50,9 @@ function getBranches(cpNode, tolerance = defaultTolerance) {
|
|
|
53
50
|
cps.push(...children);
|
|
54
51
|
continue;
|
|
55
52
|
}
|
|
56
|
-
let backPointingTan =
|
|
57
|
-
let forwardPointingTan =
|
|
58
|
-
let cross_ =
|
|
53
|
+
let backPointingTan = toUnitVector(tangent(getCurveToNext(cp.next.prevOnCircle), 0));
|
|
54
|
+
let forwardPointingTan = toUnitVector(tangent(getCurveToNext(children[0]), 0));
|
|
55
|
+
let cross_ = cross(backPointingTan, forwardPointingTan);
|
|
59
56
|
let angle = Math.abs(Math.asin(cross_) * (180 / Math.PI));
|
|
60
57
|
if (angle > tolerance) {
|
|
61
58
|
branches.push(branchCpNodes);
|
|
@@ -68,5 +65,5 @@ function getBranches(cpNode, tolerance = defaultTolerance) {
|
|
|
68
65
|
}
|
|
69
66
|
return branches;
|
|
70
67
|
}
|
|
71
|
-
|
|
68
|
+
export { getBranches };
|
|
72
69
|
//# sourceMappingURL=get-branches.js.map
|
package/node/get-branches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-branches.js","sourceRoot":"","sources":["../src/get-branches.ts"],"names":[],"mappings":"
|
|
1
|
+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|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getCurveBetween = void 0;
|
|
4
|
-
const flo_vector2d_1 = require("flo-vector2d");
|
|
5
|
-
const get_edge_direction_1 = require("./get-edge-direction");
|
|
1
|
+
import { fromTo, dot, cross, rotate90Degrees, interpolate, translate, lineLineIntersection } from 'flo-vector2d';
|
|
2
|
+
import { getEdgeDirection } from './get-edge-direction.js';
|
|
6
3
|
/** @hidden */
|
|
7
4
|
const TOLERANCE_ADD_2PRONG = 0.01;
|
|
8
5
|
/** @hidden */
|
|
@@ -15,46 +12,46 @@ const TOLERANCE_USE_LINE = 0.0001; // else cubic
|
|
|
15
12
|
*/
|
|
16
13
|
function getCurveBetween(cpNodeFrom, cpNodeTo) {
|
|
17
14
|
let fromCc = cpNodeFrom.cp.circle.center;
|
|
18
|
-
let fromL =
|
|
15
|
+
let fromL = getEdgeDirection(cpNodeFrom);
|
|
19
16
|
let toCc = cpNodeTo.cp.circle.center;
|
|
20
|
-
let toL =
|
|
21
|
-
let mid =
|
|
22
|
-
let c =
|
|
17
|
+
let toL = getEdgeDirection(cpNodeTo.prevOnCircle);
|
|
18
|
+
let mid = lineLineIntersection(fromL, toL);
|
|
19
|
+
let c = fromTo(fromCc, toCc);
|
|
23
20
|
let twisted;
|
|
24
21
|
if (!mid) {
|
|
25
22
|
twisted = true;
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
28
|
-
let a =
|
|
29
|
-
let b =
|
|
30
|
-
twisted =
|
|
25
|
+
let a = fromTo(fromCc, mid);
|
|
26
|
+
let b = fromTo(toCc, mid);
|
|
27
|
+
twisted = dot(a, c) < 0 || dot(b, c) > 0;
|
|
31
28
|
}
|
|
32
29
|
if (!twisted) {
|
|
33
30
|
return [fromCc, mid, toCc];
|
|
34
31
|
}
|
|
35
|
-
let r =
|
|
36
|
-
let w1 =
|
|
37
|
-
let w2 =
|
|
38
|
-
let d1 = Math.abs(
|
|
39
|
-
let d2 = Math.abs(
|
|
32
|
+
let r = rotate90Degrees(c);
|
|
33
|
+
let w1 = fromTo(fromL[0], fromL[1]); // This is a unit vector
|
|
34
|
+
let w2 = fromTo(toL[0], toL[1]); // This is a unit vector
|
|
35
|
+
let d1 = Math.abs(cross(c, w1)) / (3 * 3);
|
|
36
|
+
let d2 = Math.abs(cross(c, w2)) / (3 * 3);
|
|
40
37
|
if (d1 > TOLERANCE_ADD_2PRONG || d2 > TOLERANCE_ADD_2PRONG) {
|
|
41
38
|
// TODO - not within tolerance - must add additional 2-prong
|
|
42
39
|
return [fromCc, toCc];
|
|
43
40
|
}
|
|
44
41
|
if (d1 > TOLERANCE_USE_LINE || d2 > TOLERANCE_USE_LINE) {
|
|
45
42
|
// approximate with cubic bezier
|
|
46
|
-
let m1 =
|
|
47
|
-
let m2 =
|
|
48
|
-
let v1 =
|
|
49
|
-
let v2 =
|
|
43
|
+
let m1 = interpolate(fromCc, toCc, 1 / 3);
|
|
44
|
+
let m2 = interpolate(fromCc, toCc, 2 / 3);
|
|
45
|
+
let v1 = translate(r, m1);
|
|
46
|
+
let v2 = translate(r, m2);
|
|
50
47
|
let l1 = [m1, v1];
|
|
51
48
|
let l2 = [m2, v2];
|
|
52
|
-
let mid1 =
|
|
53
|
-
let mid2 =
|
|
49
|
+
let mid1 = lineLineIntersection(fromL, l1);
|
|
50
|
+
let mid2 = lineLineIntersection(toL, l2);
|
|
54
51
|
return [fromCc, mid1, mid2, toCc];
|
|
55
52
|
}
|
|
56
53
|
// Within tolerance - approximate with a straight line.
|
|
57
54
|
return [fromCc, toCc];
|
|
58
55
|
}
|
|
59
|
-
|
|
56
|
+
export { getCurveBetween };
|
|
60
57
|
//# sourceMappingURL=get-curve-between.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-curve-between.js","sourceRoot":"","sources":["../../src/get-curve/get-curve-between.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-curve-between.js","sourceRoot":"","sources":["../../src/get-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,IAAI,GAAG,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,IAAI,GAAG,oBAAoB,CAAC,GAAG,EAAI,EAAE,CAAC,CAAC;QAE3C,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KACrC;IAED,uDAAuD;IACvD,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const flo_vector2d_1 = require("flo-vector2d");
|
|
5
|
-
const flo_bezier3_1 = require("flo-bezier3");
|
|
6
|
-
const point_on_shape_1 = require("../point-on-shape");
|
|
1
|
+
import { toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse, dot } from 'flo-vector2d';
|
|
2
|
+
import { tangent } from 'flo-bezier3';
|
|
3
|
+
import { isPosSharpCorner } from '../point-on-shape.js';
|
|
7
4
|
/**
|
|
8
5
|
* @hidden
|
|
9
6
|
* Returns a line segment of unit length starting in the given Vertex center and
|
|
@@ -20,12 +17,12 @@ function getEdgeDirection(cpNode) {
|
|
|
20
17
|
let p2 = pos2.p;
|
|
21
18
|
let vDir;
|
|
22
19
|
//if (!PointOnShape.isSharpCorner(pos1)) {
|
|
23
|
-
if (!
|
|
20
|
+
if (!isPosSharpCorner(pos1)) {
|
|
24
21
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
25
|
-
vDir =
|
|
22
|
+
vDir = fromTo(p1, circleCenter); // A 1-prong
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
28
|
-
vDir =
|
|
25
|
+
vDir = rotate90Degrees(fromTo(p1, p2)); // not a 1-prong.
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
else {
|
|
@@ -40,18 +37,18 @@ function getEdgeDirection(cpNode) {
|
|
|
40
37
|
curve1 = pos1.curve.next;
|
|
41
38
|
curve2 = pos1.curve;
|
|
42
39
|
}
|
|
43
|
-
let tan1 =
|
|
44
|
-
let tan2 =
|
|
45
|
-
let x =
|
|
40
|
+
let tan1 = toUnitVector(tangent(curve1.ps, 0));
|
|
41
|
+
let tan2 = reverse(toUnitVector(tangent(curve2.ps, 1)));
|
|
42
|
+
let x = dot(tan1, tan2);
|
|
46
43
|
// Recall the identities sin(acos(x)) = sqrt(1-x^2), etc. Also
|
|
47
44
|
// recall the half angle formulas. Then the rotation matrix, R, can
|
|
48
45
|
// be calculated.
|
|
49
46
|
let cosθ = Math.sqrt((1 + x) / 2);
|
|
50
47
|
let sinθ = Math.sqrt((1 - x) / 2);
|
|
51
|
-
vDir =
|
|
48
|
+
vDir = rotate(sinθ, cosθ, tan2);
|
|
52
49
|
}
|
|
53
|
-
let v =
|
|
50
|
+
let v = translate(toUnitVector(vDir), circleCenter);
|
|
54
51
|
return [circleCenter, v];
|
|
55
52
|
}
|
|
56
|
-
|
|
53
|
+
export { getEdgeDirection };
|
|
57
54
|
//# sourceMappingURL=get-edge-direction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-edge-direction.js","sourceRoot":"","sources":["../../src/get-curve/get-edge-direction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-edge-direction.js","sourceRoot":"","sources":["../../src/get-curve/get-edge-direction.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EACzE,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,MAAc;IAEpC,IAAI,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;I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