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,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isAnotherCpCloseby = void 0;
|
|
4
|
-
const flo_vector2d_1 = require("flo-vector2d");
|
|
5
|
-
const get_neighboring_cps_1 = require("./get-neighboring-cps");
|
|
1
|
+
import { distanceBetween, toUnitVector, fromTo, dot } from 'flo-vector2d';
|
|
2
|
+
import { getNeighbouringPoints } from './get-neighboring-cps.js';
|
|
6
3
|
/** @hidden */
|
|
7
4
|
//const ANGLE_THRESHOLD = Math.cos(3 * (Math.PI / 180)); // 3 degrees
|
|
8
5
|
const ANGLE_THRESHOLD = 0.9986295347545738; // === Math.cos(3 degrees)
|
|
@@ -34,7 +31,7 @@ function isAnotherCpCloseby(cpTrees, pos, circle, order, order2, extreme, color)
|
|
|
34
31
|
// It seems this can be zero else the ordering should be correct
|
|
35
32
|
//const DISTANCE_THRESHOLD = 0;
|
|
36
33
|
let cpTree = cpTrees.get(pos.curve.loop);
|
|
37
|
-
let cpNodes =
|
|
34
|
+
let cpNodes = getNeighbouringPoints(cpTree, pos, order, order2);
|
|
38
35
|
if (!cpNodes[0]) {
|
|
39
36
|
return false;
|
|
40
37
|
}
|
|
@@ -42,12 +39,12 @@ function isAnotherCpCloseby(cpTrees, pos, circle, order, order2, extreme, color)
|
|
|
42
39
|
let pos2 = cpNode.cp.pointOnShape;
|
|
43
40
|
let p1 = pos.p;
|
|
44
41
|
let p2 = pos2.p;
|
|
45
|
-
if (
|
|
42
|
+
if (distanceBetween(p1, p2) > DISTANCE_THRESHOLD) {
|
|
46
43
|
continue;
|
|
47
44
|
}
|
|
48
|
-
let v1 =
|
|
49
|
-
let v2 =
|
|
50
|
-
let cosTheta =
|
|
45
|
+
let v1 = toUnitVector(fromTo(cpNode.cp.pointOnShape.p, cpNode.cp.circle.center));
|
|
46
|
+
let v2 = toUnitVector(fromTo(p1, circle.center));
|
|
47
|
+
let cosTheta = dot(v1, v2);
|
|
51
48
|
if (cosTheta > ANGLE_THRESHOLD) {
|
|
52
49
|
//console.log(`%c${cosTheta} - ${distanceBetween(p1,p2)}`, `color: ${color}`);
|
|
53
50
|
return true;
|
|
@@ -55,5 +52,5 @@ function isAnotherCpCloseby(cpTrees, pos, circle, order, order2, extreme, color)
|
|
|
55
52
|
}
|
|
56
53
|
return false;
|
|
57
54
|
}
|
|
58
|
-
|
|
55
|
+
export { isAnotherCpCloseby };
|
|
59
56
|
//# sourceMappingURL=is-another-cp-closeby.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-another-cp-closeby.js","sourceRoot":"","sources":["../../src/mat/is-another-cp-closeby.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-another-cp-closeby.js","sourceRoot":"","sources":["../../src/mat/is-another-cp-closeby.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAK1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,cAAc;AACd,qEAAqE;AACrE,MAAM,eAAe,GAAG,kBAAkB,CAAC,CAAC,2BAA2B;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAG9E;;;;;;;;;;;;GAYG;AACH,SAAS,kBAAkB,CACnB,OAAmC,EACnC,GAAkB,EAClB,MAAc,EACd,KAAa,EACb,MAAc,EACd,OAAe,EACf,KAAa;IAEjB,sBAAsB;IACtB,6CAA6C;IAC7C,4CAA4C;IAC5C,MAAM,kBAAkB,GAAG,OAAO,GAAG,IAAI,CAAC;IAC1C,uDAAuD;IAC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require("../get-curve-to-next");
|
|
7
|
-
const get_curve_between_1 = require("../get-curve/get-curve-between");
|
|
8
|
-
const closest_point_on_bezier_1 = require("flo-bezier3/node/simultaneous-properties/closest-point-on-bezier/closest-point-on-bezier");
|
|
1
|
+
import { closestPointOnBezier, hausdorffDistance, toCubic } from 'flo-bezier3';
|
|
2
|
+
import { getBranches } from '../get-branches.js';
|
|
3
|
+
import { getCurveToNext } from '../get-curve-to-next.js';
|
|
4
|
+
import { getCurveBetween } from '../get-curve/get-curve-between.js';
|
|
9
5
|
/**
|
|
10
6
|
* Simplifies the given MAT by replacing the piecewise quad beziers composing
|
|
11
7
|
* the MAT with fewer ones to within a given tolerance. Returns the map of
|
|
@@ -26,7 +22,7 @@ function simplifyMatMapOnly(cpNode, anlgeTolerance = 15, hausdorffTolerance = 1e
|
|
|
26
22
|
while (!cpNode.isTerminating()) {
|
|
27
23
|
cpNode = cpNode.next;
|
|
28
24
|
}
|
|
29
|
-
let branches =
|
|
25
|
+
let branches = getBranches(cpNode, anlgeTolerance);
|
|
30
26
|
let canDeletes = [];
|
|
31
27
|
for (let k = 0; k < branches.length; k++) {
|
|
32
28
|
let branch = branches[k];
|
|
@@ -53,12 +49,12 @@ function simplifyMatMapOnly(cpNode, anlgeTolerance = 15, hausdorffTolerance = 1e
|
|
|
53
49
|
else {
|
|
54
50
|
let branStart = branch[i];
|
|
55
51
|
let branEnd = branch[j - 1];
|
|
56
|
-
let medial =
|
|
52
|
+
let medial = toCubic(getCurveBetween(branStart, branEnd.next));
|
|
57
53
|
let rev = medial.slice().reverse();
|
|
58
54
|
let curCpNode = branStart;
|
|
59
55
|
let prevT = 0;
|
|
60
56
|
while (curCpNode !== branEnd) {
|
|
61
|
-
let t =
|
|
57
|
+
let t = closestPointOnBezier(medial, curCpNode.next.cp.circle.center).t;
|
|
62
58
|
simpleMap.set(curCpNode, { ps: medial, ts: [prevT, t] });
|
|
63
59
|
let oppositeCpNode = curCpNode.nextOnCircle.prev;
|
|
64
60
|
simpleMap.set(oppositeCpNode, { ps: rev, ts: [1 - t, 1 - prevT] });
|
|
@@ -73,13 +69,13 @@ function simplifyMatMapOnly(cpNode, anlgeTolerance = 15, hausdorffTolerance = 1e
|
|
|
73
69
|
}
|
|
74
70
|
return { simpleMap, cpNode };
|
|
75
71
|
}
|
|
76
|
-
exports.simplifyMatMapOnly = simplifyMatMapOnly;
|
|
77
72
|
function getTotalHausdorffDistance(i, j, branch, hausdorffSpacing) {
|
|
78
73
|
let hds = [];
|
|
79
|
-
let longCurve =
|
|
74
|
+
let longCurve = getCurveBetween(branch[i], branch[j].next);
|
|
80
75
|
for (let m = i; m < j + 1; m++) {
|
|
81
|
-
hds.push(
|
|
76
|
+
hds.push(hausdorffDistance(getCurveToNext(branch[m]), longCurve, hausdorffSpacing));
|
|
82
77
|
}
|
|
83
78
|
return Math.max(...hds);
|
|
84
79
|
}
|
|
80
|
+
export { simplifyMatMapOnly };
|
|
85
81
|
//# sourceMappingURL=simplify-mat-map-only.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplify-mat-map-only.js","sourceRoot":"","sources":["../../src/mat/simplify-mat-map-only.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simplify-mat-map-only.js","sourceRoot":"","sources":["../../src/mat/simplify-mat-map-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGpE;;;;;;;;;;;;;GAaG;AACH,SAAS,kBAAkB,CACnB,MAAc,EACd,cAAc,GAAG,EAAE,EACnB,kBAAkB,GAAG,IAAI,EACzB,gBAAgB,GAAG,GAAG;IAE1B,IAAI,SAAS,GAAkD,IAAI,GAA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,IAAI,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3D,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACtB,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,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDebugInfo = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @hidden
|
|
6
3
|
* @param sat
|
|
@@ -13,5 +10,5 @@ function addDebugInfo(sat, timingStart) {
|
|
|
13
10
|
let timing = _debug_.generated.timing;
|
|
14
11
|
timing.sats = performance.now() - timingStart;
|
|
15
12
|
}
|
|
16
|
-
|
|
13
|
+
export { addDebugInfo };
|
|
17
14
|
//# sourceMappingURL=add-debug-info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-debug-info.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/add-debug-info.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"add-debug-info.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/add-debug-info.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,SAAS,YAAY,CAAC,GAAQ,EAAE,WAAmB;IAClD,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAAE,OAAO;KAAE;IAE/C,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;IACtC,MAAM,CAAC,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;AAC/C,CAAC;AAGD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.cullNonCycles = void 0;
|
|
4
|
-
const get_leaves_1 = require("../get-leaves");
|
|
5
|
-
const cp_node_1 = require("../../cp-node");
|
|
1
|
+
import { getLeaves } from '../get-leaves.js';
|
|
2
|
+
import { CpNode } from '../../cp-node.js';
|
|
6
3
|
/**
|
|
7
4
|
* @hidden
|
|
8
5
|
* Cull all edges not part of a cycle in the MAT planar graph.
|
|
@@ -11,7 +8,7 @@ const cp_node_1 = require("../../cp-node");
|
|
|
11
8
|
*/
|
|
12
9
|
function cullNonCycles(cpStart) {
|
|
13
10
|
let cpNodeKept = cpStart;
|
|
14
|
-
let leaves =
|
|
11
|
+
let leaves = getLeaves(cpStart);
|
|
15
12
|
while (leaves.length) {
|
|
16
13
|
let leaf = leaves.pop();
|
|
17
14
|
// Preserve topology - keep cycles.
|
|
@@ -27,7 +24,7 @@ function cullNonCycles(cpStart) {
|
|
|
27
24
|
//let cp2 = cp1.prevOnCircle;
|
|
28
25
|
let cp2 = cpNode.nextOnCircle;
|
|
29
26
|
//if (cpStart === cpNode || cpStart === cp1 || cpStart === cp2) {
|
|
30
|
-
if (
|
|
27
|
+
if (CpNode.isOnSameCircle(cpNode, cpStart)) {
|
|
31
28
|
cut = true; // We are at the max disk - cut whole edge
|
|
32
29
|
}
|
|
33
30
|
else if (cpNode.next === cp2) {
|
|
@@ -51,5 +48,5 @@ function cullNonCycles(cpStart) {
|
|
|
51
48
|
}
|
|
52
49
|
return cpNodeKept;
|
|
53
50
|
}
|
|
54
|
-
|
|
51
|
+
export { cullNonCycles };
|
|
55
52
|
//# sourceMappingURL=cull-non-cycles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull-non-cycles.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/cull-non-cycles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cull-non-cycles.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/cull-non-cycles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C;;;;;GAKG;AACH,SAAS,aAAa,CAAC,OAAe;IAElC,IAAI,UAAU,GAAG,OAAO,CAAC;IAEzB,IAAI,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAGhC,OAAO,MAAM,CAAC,MAAM,EAAE;QAClB,IAAI,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;QAExB,mCAAmC;QACnC,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,cAAc,EAAE;YAAE,SAAS;SAAE;QAE5D,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,cAAc;QAEtC,OAAO,IAAI,EAAE;YACT,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;YACrB,IAAI,GAAG,GAAG,KAAK,CAAC;YAChB,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;YAE9B,IAAI,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;gBAC5B,6BAA6B;gBAC7B,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;gBAE9B,iEAAiE;gBACjE,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;oBACxC,GAAG,GAAG,IAAI,CAAC,CAAC,0CAA0C;iBACzD;qBAAM,IAAI,MAAM,CAAC,IAAI,KAAK,GAAG,EAAE;oBAC5B,MAAM,GAAG,GAAG,CAAC;iBAChB;qBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE;oBACzB,GAAG,GAAG,IAAI,CAAC,CAAC,iBAAiB;iBAChC;aACJ;iBAAM,IAAI,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;gBACzD,UAAU,GAAG,MAAM,CAAC;gBACpB,OAAO,SAAS,CAAC;aACpB;YAED,IAAI,GAAG,EAAE;gBACL,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC;gBAClB,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC;gBAElB,UAAU,GAAG,MAAM,CAAC;gBACpB,MAAM;aACT;SACJ;KACJ;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAGD,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Circle } from '../../circle';
|
|
2
|
-
import { CpNode } from '../../cp-node';
|
|
1
|
+
import { Circle } from '../../circle.js';
|
|
2
|
+
import { CpNode } from '../../cp-node.js';
|
|
3
3
|
/**
|
|
4
4
|
* @hidden
|
|
5
5
|
* Returns the set of Vertices passing the following test: walk the MAT tree and
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.cull = void 0;
|
|
4
|
-
const get_leaves_1 = require("../get-leaves");
|
|
5
|
-
const cp_node_1 = require("../../cp-node");
|
|
1
|
+
import { getLeaves } from '../get-leaves.js';
|
|
2
|
+
import { CpNode } from '../../cp-node.js';
|
|
6
3
|
/**
|
|
7
4
|
* @hidden
|
|
8
5
|
* Returns the set of Vertices passing the following test: walk the MAT tree and
|
|
@@ -12,7 +9,7 @@ const cp_node_1 = require("../../cp-node");
|
|
|
12
9
|
* @param maxCpNode The start CpNode which must reprsesent the maximal vertex.
|
|
13
10
|
*/
|
|
14
11
|
function cull(culls, maxCpNode) {
|
|
15
|
-
let leaves =
|
|
12
|
+
let leaves = getLeaves(maxCpNode);
|
|
16
13
|
function getNonTrivialEdges(cpStart) {
|
|
17
14
|
let cp = cpStart;
|
|
18
15
|
let cps = [];
|
|
@@ -42,7 +39,7 @@ function cull(culls, maxCpNode) {
|
|
|
42
39
|
// Cut off the edge once a non-cull has been reached.
|
|
43
40
|
cut = true;
|
|
44
41
|
}
|
|
45
|
-
else if (
|
|
42
|
+
else if (CpNode.isOnSameCircle(cpNode, maxCpNode)) {
|
|
46
43
|
cut = true; // We are at the max disk - cut whole edge
|
|
47
44
|
}
|
|
48
45
|
else {
|
|
@@ -62,5 +59,75 @@ function cull(culls, maxCpNode) {
|
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
|
|
62
|
+
/*
|
|
63
|
+
function cull(
|
|
64
|
+
culls: Set<Circle>,
|
|
65
|
+
maxCpNode: CpNode) {
|
|
66
|
+
|
|
67
|
+
let leaves = getLeaves(maxCpNode);
|
|
68
|
+
|
|
69
|
+
function getNonTrivialBranches(cpStart: CpNode) {
|
|
70
|
+
let cp = cpStart.next;
|
|
71
|
+
|
|
72
|
+
let cps: CpNode[] = [];
|
|
73
|
+
do {
|
|
74
|
+
if (cp.next !== cp.nextOnCircle) {
|
|
75
|
+
cps.push(cp);
|
|
76
|
+
}
|
|
77
|
+
cp = cp.nextOnCircle;
|
|
78
|
+
} while (cp !== cpStart)
|
|
79
|
+
|
|
80
|
+
return cps;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
while (leaves.length) {
|
|
84
|
+
let leaf = leaves.pop();
|
|
85
|
+
|
|
86
|
+
// Preserve topology.
|
|
87
|
+
if (leaf.isHoleClosing || leaf.isIntersection) { continue; }
|
|
88
|
+
|
|
89
|
+
if (!culls.has(leaf.cp.circle)) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
let cpNode = leaf.next; // Turn around
|
|
94
|
+
|
|
95
|
+
while (true) {
|
|
96
|
+
cpNode = cpNode.next;
|
|
97
|
+
let cut = false;
|
|
98
|
+
let cp1 = cpNode.prevOnCircle;
|
|
99
|
+
|
|
100
|
+
if (!culls.has(cpNode.cp.circle)) {
|
|
101
|
+
// Cut the branch once a non-cull has been reached.
|
|
102
|
+
cut = true;
|
|
103
|
+
} else {
|
|
104
|
+
//let cp2 = cp1.prevOnCircle;
|
|
105
|
+
let cp2 = cpNode.nextOnCircle;
|
|
106
|
+
|
|
107
|
+
//if (maxCpNode === cpNode || maxCpNode === cp1 || maxCpNode === cp2) {
|
|
108
|
+
if (CpNode.isOnSameCircle(cpNode, maxCpNode)) {
|
|
109
|
+
cut = true; // We are at the max disk - cut whole edge
|
|
110
|
+
} else if (cpNode.next === cp2) {
|
|
111
|
+
// Continue but starting from cp2
|
|
112
|
+
cpNode = cp2;
|
|
113
|
+
} else if (cp2.next === cp1) {
|
|
114
|
+
// Do nothing - ignore the branch starting from cp2 since it
|
|
115
|
+
// is terminating.
|
|
116
|
+
} else if (cp2.next !== cp1) {
|
|
117
|
+
// At this stage (cpNode.next !== cp2 && cp2.next !== cp1)
|
|
118
|
+
// so it is a bifurcation point - cut the edge.
|
|
119
|
+
cut = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (cut) {
|
|
124
|
+
cp1.next = cpNode;
|
|
125
|
+
cpNode.prev = cp1;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
*/
|
|
132
|
+
export { cull };
|
|
66
133
|
//# sourceMappingURL=cull.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/cull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cull.js","sourceRoot":"","sources":["../../../src/mat/to-scale-axis/cull.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,k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A0C;aACzD;iBAAM;gBACH,IAAI,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAErC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;oBAClB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;iBACnB;qBAAM;oBACH,GAAG,GAAG,IAAI,CAAC;iBACd;aACJ;YAED,IAAI,GAAG,EAAE;gBACL,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC;gBAClB,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC;gBAClB,MAAM;aACT;SACJ;KACJ;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEE;AAGF,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
package/node/mat/trim-mat.d.ts
CHANGED
package/node/mat/trim-mat.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const create_new_cp_tree_1 = require("./create-new-cp-tree");
|
|
5
|
-
const cull_non_cycles_1 = require("./to-scale-axis/cull-non-cycles");
|
|
6
|
-
const clone_1 = require("../cp-node/clone");
|
|
1
|
+
import { createNewCpTree } from './create-new-cp-tree.js';
|
|
2
|
+
import { cullNonCycles } from './to-scale-axis/cull-non-cycles.js';
|
|
3
|
+
import { clone } from '../cp-node/clone.js';
|
|
7
4
|
/**
|
|
8
5
|
* Trims the given Medial Axis Transform so that only cycles remain. Similar to
|
|
9
6
|
* toScaleAxis(mat, Number.POSITIVE_INFINITY).
|
|
10
7
|
* @param mat The MAT to trim.
|
|
11
8
|
*/
|
|
12
9
|
function trimMat(mat) {
|
|
13
|
-
let cpNode =
|
|
10
|
+
let cpNode = cullNonCycles(clone(mat.cpNode));
|
|
14
11
|
if (!cpNode) {
|
|
15
12
|
return undefined;
|
|
16
13
|
}
|
|
17
|
-
return { cpNode, cpTrees:
|
|
14
|
+
return { cpNode, cpTrees: createNewCpTree(cpNode) };
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
export { trimMat };
|
|
20
17
|
//# sourceMappingURL=trim-mat.js.map
|
package/node/mat/trim-mat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trim-mat.js","sourceRoot":"","sources":["../../src/mat/trim-mat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trim-mat.js","sourceRoot":"","sources":["../../src/mat/trim-mat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG5C;;;;GAIG;AACH,SAAS,OAAO,CAAC,GAAQ;IACxB,IAAI,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QAAE,OAAO,SAAS,CAAC;KAAE;IAElC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;AACxD,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/node/mat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import LlRbTree from
|
|
2
|
-
import { CpNode } from
|
|
3
|
-
import { Loop } from './loop';
|
|
1
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
+
import { CpNode } from './cp-node.js';
|
|
3
|
+
import { Loop } from './loop.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a complete Medial Axis Transform (MAT).
|
|
6
6
|
*
|
package/node/mat.js
CHANGED
package/node/point-on-shape.d.ts
CHANGED
package/node/point-on-shape.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const flo_memoize_1 = require("flo-memoize");
|
|
6
|
-
const flo_bezier3_1 = require("flo-bezier3");
|
|
7
|
-
const curve_1 = require("./curve");
|
|
1
|
+
import { dot, fromTo, toUnitVector, rotateNeg90Degrees } from 'flo-vector2d';
|
|
2
|
+
import { memoize } from 'flo-memoize';
|
|
3
|
+
import { curvature, evalDeCasteljau, tangent } from 'flo-bezier3';
|
|
4
|
+
import { getCornerAtEnd } from './curve.js';
|
|
8
5
|
/**
|
|
9
6
|
* Represents a point on the shape boundary for which MAT vertex information
|
|
10
7
|
* has not *necessarily* been calculated.
|
|
@@ -26,11 +23,10 @@ class PointOnShape {
|
|
|
26
23
|
*/
|
|
27
24
|
get p() {
|
|
28
25
|
return this.p_ === undefined
|
|
29
|
-
? this.p_ =
|
|
26
|
+
? this.p_ = evalDeCasteljau(this.curve.ps, this.t)
|
|
30
27
|
: this.p_;
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
|
-
exports.PointOnShape = PointOnShape;
|
|
34
30
|
/**
|
|
35
31
|
* @hidden
|
|
36
32
|
*/
|
|
@@ -41,48 +37,44 @@ function isPosCorner(pos) {
|
|
|
41
37
|
* @hidden
|
|
42
38
|
*/
|
|
43
39
|
function getPosCorner(pos) {
|
|
44
|
-
return
|
|
40
|
+
return getCornerAtEnd(pos.t === 1 ? pos.curve : pos.curve.prev);
|
|
45
41
|
}
|
|
46
42
|
/**
|
|
47
43
|
* @hidden
|
|
48
44
|
*/
|
|
49
|
-
let isPosSharpCorner =
|
|
45
|
+
let isPosSharpCorner = memoize((pos) => {
|
|
50
46
|
if (!isPosCorner(pos)) {
|
|
51
47
|
return false;
|
|
52
48
|
}
|
|
53
49
|
return getPosCorner(pos).isSharp;
|
|
54
50
|
});
|
|
55
|
-
exports.isPosSharpCorner = isPosSharpCorner;
|
|
56
51
|
/**
|
|
57
52
|
* @hidden
|
|
58
53
|
*/
|
|
59
|
-
let isPosDullCorner =
|
|
54
|
+
let isPosDullCorner = memoize((pos) => {
|
|
60
55
|
if (!isPosCorner(pos)) {
|
|
61
56
|
return false;
|
|
62
57
|
}
|
|
63
58
|
return getPosCorner(pos).isDull;
|
|
64
59
|
});
|
|
65
|
-
exports.isPosDullCorner = isPosDullCorner;
|
|
66
60
|
/**
|
|
67
61
|
* @hidden
|
|
68
62
|
*/
|
|
69
|
-
let isPosQuiteSharpCorner =
|
|
63
|
+
let isPosQuiteSharpCorner = memoize((pos) => {
|
|
70
64
|
if (!isPosCorner(pos)) {
|
|
71
65
|
return false;
|
|
72
66
|
}
|
|
73
67
|
return getPosCorner(pos).isQuiteSharp;
|
|
74
68
|
});
|
|
75
|
-
exports.isPosQuiteSharpCorner = isPosQuiteSharpCorner;
|
|
76
69
|
/**
|
|
77
70
|
* @hidden
|
|
78
71
|
*/
|
|
79
|
-
let isPosQuiteDullCorner =
|
|
72
|
+
let isPosQuiteDullCorner = memoize((pos) => {
|
|
80
73
|
if (!isPosCorner(pos)) {
|
|
81
74
|
return false;
|
|
82
75
|
}
|
|
83
76
|
return getPosCorner(pos).isQuiteDull;
|
|
84
77
|
});
|
|
85
|
-
exports.isPosQuiteDullCorner = isPosQuiteDullCorner;
|
|
86
78
|
/**
|
|
87
79
|
* Returns a human-readable string of the given [[PointOnShape]].
|
|
88
80
|
* For debugging only.
|
|
@@ -93,7 +85,6 @@ function posToHumanString(pos) {
|
|
|
93
85
|
' | bz: ' + pos.curve.idx +
|
|
94
86
|
' | t: ' + pos.t;
|
|
95
87
|
}
|
|
96
|
-
exports.posToHumanString = posToHumanString;
|
|
97
88
|
/**
|
|
98
89
|
* @hidden
|
|
99
90
|
* Calculates the order (to distinguish between points lying on top of each
|
|
@@ -109,11 +100,10 @@ function calcPosOrder(circle, pos) {
|
|
|
109
100
|
}
|
|
110
101
|
//if (!isPosDullCorner(pos)) { return 0; }
|
|
111
102
|
let corner = getPosCorner(pos);
|
|
112
|
-
let n =
|
|
113
|
-
let v =
|
|
114
|
-
return -
|
|
103
|
+
let n = rotateNeg90Degrees(corner.tangents[0]);
|
|
104
|
+
let v = toUnitVector(fromTo(pos.p, circle.center));
|
|
105
|
+
return -dot(n, v);
|
|
115
106
|
}
|
|
116
|
-
exports.calcPosOrder = calcPosOrder;
|
|
117
107
|
/**
|
|
118
108
|
* Compares two [[PointOnShape]]s according to their cyclic ordering imposed
|
|
119
109
|
* by their relative positions on the shape boundary.
|
|
@@ -133,7 +123,6 @@ function comparePoss(a, b) {
|
|
|
133
123
|
res = a.t - b.t;
|
|
134
124
|
return res;
|
|
135
125
|
}
|
|
136
|
-
exports.comparePoss = comparePoss;
|
|
137
126
|
/**
|
|
138
127
|
* Calculates and returns the osculating circle radius of the bezier at a
|
|
139
128
|
* specific t. If it is found to have negative or nearly zero radius
|
|
@@ -142,12 +131,12 @@ exports.comparePoss = comparePoss;
|
|
|
142
131
|
* @param t
|
|
143
132
|
* @hidden
|
|
144
133
|
*/
|
|
145
|
-
let calcOsculatingCircleRadius =
|
|
134
|
+
let calcOsculatingCircleRadius = memoize((pos) => {
|
|
146
135
|
let ps = pos.curve.ps;
|
|
147
136
|
let t = pos.t;
|
|
148
|
-
let
|
|
149
|
-
//
|
|
150
|
-
return 1 /
|
|
137
|
+
let c = -curvature(ps, t);
|
|
138
|
+
// c > 0 => bending inwards
|
|
139
|
+
return 1 / c;
|
|
151
140
|
});
|
|
152
141
|
/**
|
|
153
142
|
* Returns the osculating circle at this point of the curve.
|
|
@@ -156,7 +145,6 @@ let calcOsculatingCircleRadius = flo_memoize_1.memoize((pos) => {
|
|
|
156
145
|
* @param pos The [[PointOnShape]] identifying the point.
|
|
157
146
|
*/
|
|
158
147
|
function getOsculatingCircle(maxOsculatingCircleRadius, pos) {
|
|
159
|
-
//if (PointOnShape.isSharpCorner(pos)) {
|
|
160
148
|
if (isPosSharpCorner(pos)) {
|
|
161
149
|
return { center: pos.p, radius: 0 };
|
|
162
150
|
}
|
|
@@ -167,13 +155,14 @@ function getOsculatingCircle(maxOsculatingCircleRadius, pos) {
|
|
|
167
155
|
radius = Math.min(radius, maxOsculatingCircleRadius);
|
|
168
156
|
let ps = pos.curve.ps;
|
|
169
157
|
let t = pos.t;
|
|
170
|
-
|
|
171
|
-
let
|
|
158
|
+
const tangent_ = tangent(ps, t);
|
|
159
|
+
let normal_ = toUnitVector([-tangent_[1], tangent_[0]]);
|
|
160
|
+
let p = evalDeCasteljau(ps, t);
|
|
172
161
|
let circleCenter = [
|
|
173
|
-
p[0]
|
|
174
|
-
p[1]
|
|
162
|
+
p[0] - normal_[0] * radius,
|
|
163
|
+
p[1] - normal_[1] * radius
|
|
175
164
|
];
|
|
176
165
|
return { center: circleCenter, radius };
|
|
177
166
|
}
|
|
178
|
-
|
|
167
|
+
export { PointOnShape, getOsculatingCircle, comparePoss, calcPosOrder, posToHumanString, isPosSharpCorner, isPosDullCorner, isPosQuiteSharpCorner, isPosQuiteDullCorner };
|
|
179
168
|
//# sourceMappingURL=point-on-shape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point-on-shape.js","sourceRoot":"","sources":["../src/point-on-shape.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"point-on-shape.js","sourceRoot":"","sources":["../src/point-on-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAQ,aAAa,CAAC;AACpE,OAAO,EAAS,cAAc,EAAE,MAAM,YAAY,CAAC;AAanD;;;GAGG;AACH,MAAM,YAAY;IAEd;;;;OAIG;IACH,YACwB,KAAY,EACZ,CAAS;QADT,UAAK,GAAL,KAAK,CAAO;QACZ,MAAC,GAAD,CAAC,CAAQ;QAIjC,QAAQ;QACA,OAAE,GAAc,SAAS,CAAC;IAJlC,CAAC;IAKD;;O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,CAAC,CAAC;IAC/B,IAAI,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,GAAG,eAAe,CAAC,EAAE,EAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,YAAY,GAAG;QACf,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAC,MAAM;QACxB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAC,MAAM;KAC3B,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC;AAGD,OAAO,EAEH,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACvB,CAAA"}
|
package/node/simplify-mat.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mat } from
|
|
1
|
+
import { Mat } from './mat.js';
|
|
2
2
|
/**
|
|
3
3
|
* Simplifies the given MAT by replacing the piecewise quad beziers composing
|
|
4
4
|
* the MAT with fewer ones to within a given tolerance.
|
|
@@ -6,10 +6,11 @@ import { Mat } from "./mat";
|
|
|
6
6
|
* @param anlgeTolerance Tolerance given as the degrees difference of the unit
|
|
7
7
|
* direction vectors at the interface between curves. A tolerance of zero means
|
|
8
8
|
* perfect smoothness is required - defaults to 15.
|
|
9
|
+
* TODO - the next two params are wrong??
|
|
9
10
|
* @param hausdorffTolerance The approximate maximum Hausdorff Distance tolerance -
|
|
10
11
|
* defaults to 0.1
|
|
11
|
-
* @param
|
|
12
|
+
* @param maxIterations The spacing on the curves used to calculate the Hausdorff
|
|
12
13
|
* Distance - defaults to 1
|
|
13
14
|
*/
|
|
14
|
-
declare function simplifyMat(mat: Mat, anlgeTolerance?: number, hausdorffTolerance?: number,
|
|
15
|
+
declare function simplifyMat(mat: Mat, anlgeTolerance?: number, hausdorffTolerance?: number, maxIterations?: number): Mat;
|
|
15
16
|
export { simplifyMat };
|