flo-mat 3.0.15 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/__tests__/cp-node/compare-cp-nodes-by-value.ts +5 -3
- package/__tests__/cp-node/compare-poss-by-value.ts +7 -7
- package/__tests__/cp-node/fs/get-all-on-circle.spec.ts +8 -8
- package/__tests__/cp-node/fs/is-one-prong.spec.ts +3 -3
- package/__tests__/cp-node/fs/is-sharp.spec.ts +1 -1
- package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +49 -0
- package/__tests__/get-mats1.ts +29 -32
- package/__tests__/helpers/close-to.ts +71 -0
- package/__tests__/helpers/jest-extend-nearly.ts +39 -0
- package/__tests__/helpers/jest.setup.ts +6 -0
- package/__tests__/helpers/obj-or-array.ts +8 -0
- package/__tests__/jest-extensions.d.ts +26 -0
- package/__tests__/lib-load.spec.ts +1 -1
- package/browser/index.js +20280 -17610
- package/browser/index.min.js +1 -1
- package/jest.config.cjs +1 -0
- package/node/add-n-prong.ts/join-spokes.d.ts +2 -2
- package/node/add-n-prong.ts/join-spokes.js +5 -4
- package/node/add-n-prong.ts/join-spokes.js.map +1 -1
- package/node/closest-boundary-point/cull-bezier-pieces-1.d.ts +9 -0
- package/node/closest-boundary-point/{cull-bezier-pieces.js → cull-bezier-pieces-1.js} +6 -7
- package/node/closest-boundary-point/cull-bezier-pieces-1.js.map +1 -0
- package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +7 -5
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js +12 -10
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js +2 -2
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +6 -9
- package/node/closest-boundary-point/get-best-distance-squared.d.ts +4 -3
- package/node/closest-boundary-point/get-best-distance-squared.js +11 -11
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -1
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +5 -9
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +22 -18
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +3 -8
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +34 -91
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +1 -1
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +8 -11
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
- package/node/corner/compare-curvatures-at-interface.d.ts +1 -1
- package/node/corner/compare-curvatures-at-interface.js +1 -1
- package/node/corner/corner.d.ts +7 -6
- package/node/corner/get-corner.d.ts +1 -6
- package/node/corner/get-corner.js +2 -9
- package/node/corner/get-corner.js.map +1 -1
- package/node/corner/get-interface-ccw.d.ts +2 -2
- package/node/corner/get-interface-ccw.js +4 -5
- package/node/corner/get-interface-ccw.js.map +1 -1
- package/node/cp-node/cp-node-fs.d.ts +0 -15
- package/node/cp-node/cp-node-fs.js +0 -4
- package/node/cp-node/cp-node-fs.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +10 -10
- package/node/cp-node/fs/clone.js.map +1 -1
- package/node/cp-node/fs/cp-node-comparator.js +2 -2
- package/node/cp-node/fs/cp-node-comparator.js.map +1 -1
- package/node/cp-node/fs/enhance-cp-node.d.ts +1 -1
- package/node/cp-node/fs/enhance-cp-node.js +5 -5
- package/node/cp-node/fs/enhance-cp-node.js.map +1 -1
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js +2 -2
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/cp-node/fs/get-cp-node-ordering.js +4 -4
- package/node/cp-node/fs/get-cp-node-ordering.js.map +1 -1
- package/node/cp-node/fs/get-edge-direction.js +3 -3
- package/node/cp-node/fs/get-edge-direction.js.map +1 -1
- package/node/cp-node/fs/get-hole-closers.d.ts +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js +2 -2
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
- package/node/cp-node/fs/get-mat-curve-between.d.ts +1 -1
- package/node/cp-node/fs/get-mat-curve-between.js +6 -5
- package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
- package/node/cp-node/fs/get-salience.d.ts +1 -1
- package/node/cp-node/fs/get-salience.js +3 -3
- package/node/cp-node/fs/get-salience.js.map +1 -1
- package/node/cp-node/fs/insert-cp-node.d.ts +4 -4
- package/node/cp-node/fs/insert-cp-node.js +3 -4
- package/node/cp-node/fs/insert-cp-node.js.map +1 -1
- package/node/cp-node/fs/is-one-prong.d.ts +1 -1
- package/node/cp-node/fs/is-one-prong.js +2 -9
- package/node/cp-node/fs/is-one-prong.js.map +1 -1
- package/node/cp-node/fs/is-order-correct.d.ts +3 -3
- package/node/cp-node/fs/is-order-correct.js +5 -8
- package/node/cp-node/fs/is-order-correct.js.map +1 -1
- package/node/cp-node/fs/is-sharp.js +1 -1
- package/node/cp-node/fs/is-sharp.js.map +1 -1
- package/node/cp-node/fs/remove-cp-node.js +1 -2
- package/node/cp-node/fs/remove-cp-node.js.map +1 -1
- package/node/cp-node/fs/traverse-cp.js.map +1 -1
- package/node/cp-node/fs/traverse-vertices.d.ts +1 -1
- package/node/cp-node/fs/traverse-vertices.js.map +1 -1
- package/node/debug/debug-elem-types.d.ts +1 -2
- package/node/debug/debug-elem-types.js +1 -2
- package/node/debug/debug-elem-types.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-branch.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-branch.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-cp-node.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-cp-node.js +4 -4
- package/node/debug/functions/draw-elem/draw-cp-node.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.js +1 -5
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-leaves.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-leaves.js +4 -4
- package/node/debug/functions/draw-elem/draw-leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-mat.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-mat.js +1 -2
- package/node/debug/functions/draw-elem/draw-mat.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.js +1 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-min-y.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js +12 -3
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/draw-one-prong.js +8 -7
- package/node/debug/functions/draw-elem/draw-one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-three-prong.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-three-prong.js +4 -4
- package/node/debug/functions/draw-elem/draw-three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-two-prong.js +4 -3
- package/node/debug/functions/draw-elem/draw-two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-vertex.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-vertex.js +1 -3
- package/node/debug/functions/draw-elem/draw-vertex.js.map +1 -1
- package/node/debug/functions/general.js +1 -1
- package/node/debug/functions/general.js.map +1 -1
- package/node/error-analysis/gamma.d.ts +7 -1
- package/node/error-analysis/gamma.js +6 -2
- package/node/error-analysis/gamma.js.map +1 -1
- package/node/find-2-prong/add-1-prong.d.ts +3 -3
- package/node/find-2-prong/add-1-prong.js +4 -4
- package/node/find-2-prong/add-1-prong.js.map +1 -1
- package/node/find-2-prong/add-2-prong.d.ts +10 -11
- package/node/find-2-prong/add-2-prong.js +42 -37
- package/node/find-2-prong/add-2-prong.js.map +1 -1
- package/node/find-2-prong/calc-seperation-tolerance.js +4 -7
- package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -1
- package/node/find-2-prong/cull-bezier-pieces.d.ts +9 -7
- package/node/find-2-prong/cull-bezier-pieces.js +30 -15
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/find-2-prong.d.ts +12 -13
- package/node/find-2-prong/find-2-prong.js +73 -116
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/find-and-add-2-prongs-on-all-loops.d.ts +4 -4
- package/node/find-2-prong/find-and-add-2-prongs-on-all-loops.js.map +1 -1
- package/node/find-2-prong/find-and-add-2-prongs.d.ts +5 -4
- package/node/find-2-prong/find-and-add-2-prongs.js +28 -24
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -1
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.d.ts +6 -8
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js +11 -12
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -1
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +5 -6
- package/node/find-2-prong/get-initial-bezier-pieces.js +8 -11
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/get-initial-x.d.ts +12 -0
- package/node/find-2-prong/get-initial-x.js +35 -0
- package/node/find-2-prong/get-initial-x.js.map +1 -0
- package/node/find-2-prong/get-medial/antipodal-point.d.ts +8 -0
- package/node/find-2-prong/get-medial/antipodal-point.js +2 -0
- package/node/find-2-prong/get-medial/antipodal-point.js.map +1 -0
- package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +18 -0
- package/node/find-2-prong/get-medial/get-antipodal-points.js +41 -0
- package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -0
- package/node/find-2-prong/get-medial/get-closest-points.d.ts +15 -0
- package/node/find-2-prong/get-medial/get-closest-points.js +167 -0
- package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -0
- package/node/find-2-prong/reduce-radius.d.ts +4 -4
- package/node/find-2-prong/reduce-radius.js +30 -50
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/{find-3-prong.ts → find-3-prong}/calc-better-x.d.ts +9 -6
- package/node/{find-3-prong.ts → find-3-prong}/calc-better-x.js +11 -6
- package/node/find-3-prong/calc-better-x.js.map +1 -0
- package/node/find-3-prong/calc-initial-3-prong-center.d.ts +15 -0
- package/node/find-3-prong/calc-initial-3-prong-center.js +27 -0
- package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -0
- package/node/find-3-prong/find-3-prong-for-delta3s.d.ts +19 -0
- package/node/{find-3-prong.ts → find-3-prong}/find-3-prong-for-delta3s.js +47 -32
- package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -0
- package/node/find-3-prong/find-3-prong.d.ts +13 -0
- package/node/{find-3-prong.ts → find-3-prong}/find-3-prong.js +14 -9
- package/node/find-3-prong/find-3-prong.js.map +1 -0
- package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prong.d.ts +2 -2
- package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prong.js +17 -2
- package/node/find-3-prong/find-and-add-3-prong.js.map +1 -0
- package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs-on-loop.js +8 -21
- package/node/find-3-prong/find-and-add-3-prongs-on-loop.js.map +1 -0
- package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs.d.ts +1 -4
- package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs.js +2 -3
- package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -0
- package/node/find-3-prong/get-closest-points.d.ts +10 -0
- package/node/{find-3-prong.ts → find-3-prong}/get-closest-points.js +4 -4
- package/node/find-3-prong/get-closest-points.js.map +1 -0
- package/node/find-3-prong/three-prong-info.d.ts +9 -0
- package/node/find-3-prong/three-prong-info.js +2 -0
- package/node/find-3-prong/three-prong-info.js.map +1 -0
- package/node/find-3-prong/timed-cc.d.ts +3 -0
- package/node/find-3-prong/timed-cc.js +5 -0
- package/node/find-3-prong/timed-cc.js.map +1 -0
- package/node/find-mat/clip-options.d.ts +2 -2
- package/node/find-mat/clip-options.js +7 -14
- package/node/find-mat/clip-options.js.map +1 -1
- package/node/find-mat/create-initial-cp-tree.d.ts +9 -8
- package/node/find-mat/create-initial-cp-tree.js +17 -20
- package/node/find-mat/create-initial-cp-tree.js.map +1 -1
- package/node/find-mat/find-mat.d.ts +5 -5
- package/node/find-mat/find-mat.js +6 -12
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/find-mats.js +7 -12
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/get-dull-corners-on-loop.d.ts +3 -3
- package/node/find-mat/get-dull-corners-on-loop.js +5 -4
- package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
- package/node/find-mat/get-for-1-prongs-on-loop.d.ts +7 -7
- package/node/find-mat/get-for-1-prongs-on-loop.js +9 -21
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-for-2-prongs-on-loop.d.ts +5 -4
- package/node/find-mat/get-for-2-prongs-on-loop.js +4 -6
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +3 -3
- package/node/find-mat/get-meta.js +13 -12
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/find-mat/get-sharp-corners.d.ts +3 -3
- package/node/find-mat/get-sharp-corners.js +2 -3
- package/node/find-mat/get-sharp-corners.js.map +1 -1
- package/node/find-mat/mat-options.d.ts +15 -15
- package/node/find-mat/mat-options.js +7 -4
- package/node/find-mat/mat-options.js.map +1 -1
- package/node/floyd-warshall/floyd-warshall.js +1 -1
- package/node/floyd-warshall/floyd-warshall.js.map +1 -1
- package/node/floyd-warshall/get-graph.js +2 -2
- package/node/floyd-warshall/get-graph.js.map +1 -1
- package/node/floyd-warshall/get-hole-closer-pairs.js +6 -6
- package/node/floyd-warshall/get-hole-closer-pairs.js.map +1 -1
- package/node/geometry/circle.d.ts +1 -0
- package/node/geometry/circle.js +1 -0
- package/node/geometry/circle.js.map +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js +1 -4
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js +2 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/index.d.ts +1 -7
- package/node/index.js +1 -5
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.d.ts +2 -1
- package/node/loop/get-max-coordinate.js +6 -8
- package/node/loop/get-max-coordinate.js.map +1 -1
- package/node/mat/add-to-cp-tree.d.ts +3 -3
- package/node/mat/add-to-cp-tree.js +5 -5
- package/node/mat/add-to-cp-tree.js.map +1 -1
- package/node/mat/create-new-cp-trees.d.ts +10 -0
- package/node/mat/create-new-cp-trees.js +24 -0
- package/node/mat/create-new-cp-trees.js.map +1 -0
- package/node/mat/curve-piece.d.ts +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +3 -3
- package/node/mat/get-boundary-piece-beziers.js +125 -20
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-branches.d.ts +1 -1
- package/node/mat/get-closeby-cp-if-exist.d.ts +5 -5
- package/node/mat/get-closeby-cp-if-exist.js +6 -5
- package/node/mat/get-closeby-cp-if-exist.js.map +1 -1
- package/node/mat/get-cp-node-to-left-or-same.d.ts +4 -4
- package/node/mat/get-cp-node-to-left-or-same.js +4 -3
- package/node/mat/get-cp-node-to-left-or-same.js.map +1 -1
- package/node/mat/get-largest-vertex.d.ts +1 -1
- package/node/mat/get-largest-vertex.js +1 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/mat-meta.d.ts +4 -5
- package/node/mat/mat.d.ts +5 -5
- package/node/mat/simplify-mat.js +5 -4
- package/node/mat/simplify-mat.js.map +1 -1
- package/node/mat/trim-mat.d.ts +3 -2
- package/node/mat/trim-mat.js +5 -3
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape/calc-pos-order.d.ts +8 -5
- package/node/point-on-shape/calc-pos-order.js +7 -7
- package/node/point-on-shape/calc-pos-order.js.map +1 -1
- package/node/point-on-shape/compare-poss.d.ts +4 -0
- package/node/point-on-shape/compare-poss.js +12 -0
- package/node/point-on-shape/compare-poss.js.map +1 -1
- package/node/point-on-shape/get-osculating-circle.d.ts +5 -6
- package/node/point-on-shape/get-osculating-circle.js +18 -20
- package/node/point-on-shape/get-osculating-circle.js.map +1 -1
- package/node/point-on-shape/get-pos-corner.d.ts +18 -4
- package/node/point-on-shape/get-pos-corner.js +6 -6
- package/node/point-on-shape/get-pos-corner.js.map +1 -1
- package/node/point-on-shape/is-pos-corner.d.ts +3 -2
- package/node/point-on-shape/is-pos-corner.js.map +1 -1
- package/node/point-on-shape/is-pos-sharp-corner.d.ts +1 -12
- package/node/point-on-shape/is-pos-sharp-corner.js +4 -5
- package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +39 -6
- package/node/point-on-shape/pos-to-human-string.d.ts +1 -1
- package/node/point-on-shape/pos-to-human-string.js.map +1 -1
- package/node/point-on-shape/to-p.d.ts +9 -0
- package/node/point-on-shape/to-p.js +13 -0
- package/node/point-on-shape/to-p.js.map +1 -0
- package/node/sat/add-debug-info.d.ts +2 -1
- package/node/sat/add-debug-info.js +2 -1
- package/node/sat/add-debug-info.js.map +1 -1
- package/node/sat/cull-non-cycles.d.ts +2 -1
- package/node/sat/cull-non-cycles.js +5 -3
- package/node/sat/cull-non-cycles.js.map +1 -1
- package/node/sat/cull.js +3 -4
- package/node/sat/cull.js.map +1 -1
- package/node/sat/get-leaves.d.ts +1 -1
- package/node/sat/get-leaves.js +1 -2
- package/node/sat/get-leaves.js.map +1 -1
- package/node/sat/get-sat-culls.d.ts +2 -2
- package/node/sat/get-sat-culls.js +3 -3
- package/node/sat/get-sat-culls.js.map +1 -1
- package/node/sat/to-scale-axis.d.ts +1 -1
- package/node/sat/to-scale-axis.js +2 -2
- package/node/sat/to-scale-axis.js.map +1 -1
- package/node/svg/get-loop-bounds.d.ts +7 -7
- package/node/svg/get-loop-bounds.js +33 -70
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +2 -3
- package/node/svg/get-min-y-pos.js +2 -2
- package/node/svg/get-min-y-pos.js.map +1 -1
- package/node/svg/get-shape-bounds.d.ts +6 -6
- package/node/svg/get-shape-bounds.js +6 -6
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/utils/mutable.d.ts +4 -0
- package/node/utils/mutable.js +2 -0
- package/node/utils/mutable.js.map +1 -0
- package/node/utils/sum.js.map +1 -1
- package/node/utils/time-function-call.d.ts +14 -0
- package/node/utils/time-function-call.js +32 -0
- package/node/utils/time-function-call.js.map +1 -0
- package/node/vertex/remove-vertex.d.ts +1 -0
- package/node/vertex/remove-vertex.js +1 -1
- package/node/vertex/remove-vertex.js.map +1 -1
- package/package.json +6 -9
- package/src/add-n-prong.ts/join-spokes.ts +8 -6
- package/src/closest-boundary-point/{cull-bezier-pieces.ts → cull-bezier-pieces-1.ts} +7 -7
- package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +15 -14
- package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +2 -2
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +5 -10
- package/src/closest-boundary-point/get-best-distance-squared.ts +18 -15
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +25 -31
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +41 -102
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +7 -12
- package/src/corner/compare-curvatures-at-interface.ts +1 -1
- package/src/corner/corner.ts +7 -6
- package/src/corner/get-corner.ts +4 -11
- package/src/corner/get-interface-ccw.ts +5 -5
- package/src/cp-node/cp-node-fs.ts +0 -5
- package/src/cp-node/cp-node.ts +12 -10
- package/src/cp-node/fs/add-distance-from.ts +1 -2
- package/src/cp-node/fs/clone.ts +2 -1
- package/src/cp-node/fs/cp-node-comparator.ts +2 -2
- package/src/cp-node/fs/enhance-cp-node.ts +5 -5
- package/src/cp-node/fs/get-boundary-bezier-parts-to-next.ts +2 -2
- package/src/cp-node/fs/get-cp-node-ordering.ts +4 -4
- package/src/cp-node/fs/get-edge-direction.ts +3 -3
- package/src/cp-node/fs/get-hole-closers.ts +1 -1
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +2 -2
- package/src/cp-node/fs/get-mat-curve-between.ts +8 -6
- package/src/cp-node/fs/get-salience.ts +4 -4
- package/src/cp-node/fs/insert-cp-node.ts +12 -12
- package/src/cp-node/fs/is-one-prong.ts +3 -14
- package/src/cp-node/fs/is-order-correct.ts +8 -10
- package/src/cp-node/fs/is-sharp.ts +1 -1
- package/src/cp-node/fs/remove-cp-node.ts +4 -6
- package/src/cp-node/fs/traverse-cp.ts +1 -1
- package/src/cp-node/fs/traverse-vertices.ts +1 -2
- package/src/cp-node/stringification/cp-node-stringifyable.ts +7 -16
- package/src/cp-node/stringification/from-stringifyable.ts +6 -6
- package/src/cp-node/stringification/to-stringifyable.ts +5 -9
- package/src/debug/debug-elem-types.ts +2 -3
- package/src/{mat → debug}/elem-type-two-prong.ts +1 -1
- package/src/debug/functions/check-ordering.ts +13 -17
- package/src/debug/functions/cmp-cp-on-delta.ts +3 -3
- package/src/debug/functions/draw-elem/draw-branch.ts +1 -3
- package/src/debug/functions/draw-elem/draw-cp-node.ts +5 -6
- package/src/debug/functions/draw-elem/draw-elem.ts +1 -5
- package/src/debug/functions/draw-elem/draw-leaves.ts +5 -5
- package/src/debug/functions/draw-elem/draw-mat.ts +2 -5
- package/src/debug/functions/draw-elem/draw-max-vertex.ts +3 -3
- package/src/debug/functions/draw-elem/draw-min-y.ts +2 -2
- package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +17 -3
- package/src/debug/functions/draw-elem/draw-one-prong.ts +10 -8
- package/src/debug/functions/draw-elem/draw-three-prong.ts +5 -5
- package/src/debug/functions/draw-elem/draw-two-prong.ts +4 -3
- package/src/debug/functions/draw-elem/draw-vertex.ts +2 -5
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +2 -2
- package/src/debug/functions/general.ts +1 -1
- package/src/debug/functions/three-prong.ts +220 -220
- package/src/error-analysis/gamma.ts +9 -2
- package/src/find-2-prong/add-1-prong.ts +8 -8
- package/src/find-2-prong/add-2-prong.ts +64 -58
- package/src/find-2-prong/calc-seperation-tolerance.ts +4 -8
- package/src/find-2-prong/cull-bezier-pieces.ts +41 -21
- package/src/find-2-prong/find-2-prong.ts +105 -153
- package/src/find-2-prong/find-and-add-2-prong.ts +23 -23
- package/src/find-2-prong/find-and-add-2-prongs-on-all-loops.ts +4 -6
- package/src/find-2-prong/find-and-add-2-prongs.ts +44 -29
- package/src/find-2-prong/find-and-add-hole-closing-2-prongs.ts +15 -15
- package/src/find-2-prong/get-initial-bezier-pieces.ts +21 -24
- package/src/find-2-prong/get-initial-x.ts +52 -0
- package/src/find-2-prong/get-medial/antipodal-point.ts +12 -0
- package/src/find-2-prong/get-medial/get-antipodal-points.ts +63 -0
- package/src/find-2-prong/get-medial/get-closest-points.ts +211 -0
- package/src/find-2-prong/reduce-radius.ts +38 -61
- package/src/find-2-prong/x-for-debugging.ts +9 -9
- package/src/{find-3-prong.ts → find-3-prong}/calc-better-x.ts +23 -13
- package/src/{find-3-prong.ts → find-3-prong}/calc-initial-3-prong-center.ts +12 -15
- package/src/{find-3-prong.ts → find-3-prong}/find-3-prong-for-delta3s.ts +64 -51
- package/src/find-3-prong/find-3-prong.ts +52 -0
- package/src/{find-3-prong.ts → find-3-prong}/find-and-add-3-prong.ts +20 -6
- package/src/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs-on-loop.ts +7 -23
- package/src/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs.ts +6 -4
- package/src/{find-3-prong.ts → find-3-prong}/get-closest-points.ts +6 -5
- package/src/find-3-prong/three-prong-info.ts +13 -0
- package/src/find-3-prong/timed-cc.ts +9 -0
- package/src/find-mat/clip-options.ts +11 -16
- package/src/find-mat/create-initial-cp-tree.ts +29 -34
- package/src/find-mat/find-mat.ts +15 -23
- package/src/find-mat/find-mats.ts +11 -13
- package/src/find-mat/fix-ordering.ts +58 -58
- package/src/find-mat/get-dull-corners-on-loop.ts +12 -10
- package/src/find-mat/get-for-1-prongs-on-loop.ts +11 -33
- package/src/find-mat/get-for-2-prongs-on-loop.ts +9 -12
- package/src/find-mat/get-meta.ts +18 -16
- package/src/find-mat/get-sharp-corners.ts +7 -8
- package/src/find-mat/mat-options.ts +22 -19
- package/src/floyd-warshall/floyd-warshall.ts +1 -1
- package/src/floyd-warshall/get-graph.ts +2 -2
- package/src/floyd-warshall/get-hole-closer-pairs.ts +6 -6
- package/src/geometry/circle.ts +1 -0
- package/src/geometry/get-closest-square-distance-to-rect.ts +3 -8
- package/src/geometry/get-closest-squared-distance-to-rotated-rect.ts +3 -2
- package/src/index.ts +2 -8
- package/src/loop/get-max-coordinate.ts +8 -9
- package/src/mat/add-to-cp-tree.ts +10 -11
- package/src/mat/clone-mat.ts +8 -4
- package/src/mat/clone-meta.ts +22 -10
- package/src/mat/create-new-cp-trees.ts +35 -0
- package/src/mat/curve-piece.ts +1 -1
- package/src/mat/get-boundary-piece-beziers.ts +153 -37
- package/src/mat/get-branches.ts +1 -1
- package/src/mat/get-closeby-cp-if-exist.ts +11 -12
- package/src/mat/get-cp-node-to-left-or-same.ts +9 -8
- package/src/mat/get-largest-3-prong.ts +2 -2
- package/src/mat/get-largest-vertex.ts +2 -2
- package/src/mat/mat-meta.ts +5 -4
- package/src/mat/mat.ts +5 -5
- package/src/mat/simplify-mat.ts +5 -4
- package/src/mat/trim-mat.ts +6 -4
- package/src/point-on-shape/calc-pos-order.ts +10 -11
- package/src/point-on-shape/compare-poss.ts +11 -1
- package/src/point-on-shape/get-osculating-circle.ts +26 -28
- package/src/point-on-shape/get-pos-corner.ts +14 -12
- package/src/point-on-shape/is-pos-corner.ts +1 -4
- package/src/point-on-shape/is-pos-dull-corner.ts +9 -9
- package/src/point-on-shape/is-pos-quite-dull-corner.ts +7 -6
- package/src/point-on-shape/is-pos-quite-sharp-corner.ts +7 -6
- package/src/point-on-shape/is-pos-sharp-corner.ts +6 -5
- package/src/point-on-shape/point-on-shape.ts +44 -6
- package/src/point-on-shape/pos-to-human-string.ts +4 -2
- package/src/point-on-shape/to-p.ts +19 -0
- package/src/sat/add-debug-info.ts +3 -3
- package/src/sat/cull-non-cycles.ts +8 -6
- package/src/sat/cull.ts +7 -8
- package/src/sat/get-leaves.ts +2 -4
- package/src/sat/get-sat-culls.ts +6 -5
- package/src/sat/to-scale-axis.ts +4 -5
- package/src/svg/get-loop-bounds.ts +61 -86
- package/src/svg/get-min-y-pos.ts +3 -4
- package/src/svg/get-shape-bounds.ts +12 -12
- package/src/sweep-line/are-boxes-intersecting.ts +3 -2
- package/src/utils/mutable.ts +7 -0
- package/src/utils/rad-to-deg.ts +1 -1
- package/src/utils/smart-log.ts +20 -0
- package/src/utils/sum.ts +3 -1
- package/src/utils/time-function-call.ts +53 -0
- package/src/vertex/remove-vertex.ts +1 -3
- package/wallaby.mjs +1 -0
- package/.eslintrc.cjs +0 -69
- package/__tests__/cp-node/fs/get-avg-speed.spec.ts +0 -7
- package/__tests__/cp-node/fs/get-smoothed-speed.spec.ts +0 -7
- package/__tests__/cp-node/fs/get-smoothed.spec.ts +0 -7
- package/__tests__/cp-node/fs/get-speed.spec.ts +0 -7
- package/__tests__/cp-node/fs/is-order-correct.spec.ts +0 -7
- package/node/bezier/fit-quads-to-cubic.d.ts +0 -19
- package/node/bezier/fit-quads-to-cubic.js +0 -83
- package/node/bezier/fit-quads-to-cubic.js.map +0 -1
- package/node/bezier/total-curvature.d.ts +0 -14
- package/node/bezier/total-curvature.js +0 -5
- package/node/bezier/total-curvature.js.map +0 -1
- package/node/bezier/total-length.d.ts +0 -14
- package/node/bezier/total-length.js +0 -5
- package/node/bezier/total-length.js.map +0 -1
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +0 -10
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +0 -1
- package/node/closest-boundary-point/dd-deflate-with-running-error.d.ts +0 -25
- package/node/closest-boundary-point/dd-deflate-with-running-error.js +0 -68
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +0 -1
- package/node/closest-boundary-point/get-p-from-box.d.ts +0 -3
- package/node/closest-boundary-point/get-p-from-box.js +0 -11
- package/node/closest-boundary-point/get-p-from-box.js.map +0 -1
- package/node/contact-point/contact-point.d.ts +0 -26
- package/node/contact-point/contact-point.js +0 -22
- package/node/contact-point/contact-point.js.map +0 -1
- package/node/cp-node/fs/get-smoothed-speed.d.ts +0 -14
- package/node/cp-node/fs/get-smoothed-speed.js +0 -75
- package/node/cp-node/fs/get-smoothed-speed.js.map +0 -1
- package/node/cp-node/fs/get-speed.d.ts +0 -15
- package/node/cp-node/fs/get-speed.js +0 -39
- package/node/cp-node/fs/get-speed.js.map +0 -1
- package/node/debug/cp-node-for-debugging.d.ts +0 -11
- package/node/debug/cp-node-for-debugging.js +0 -2
- package/node/debug/cp-node-for-debugging.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-speed.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-speed.js +0 -21
- package/node/debug/functions/draw-elem/draw-speed.js.map +0 -1
- package/node/find-2-prong/find-and-add-2-prong.d.ts +0 -11
- package/node/find-2-prong/find-and-add-2-prong.js +0 -19
- package/node/find-2-prong/find-and-add-2-prong.js.map +0 -1
- package/node/find-2-prong/find-equidistant-point-on-line-dd.d.ts +0 -10
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js +0 -56
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +0 -1
- package/node/find-3-prong.ts/calc-better-x.js.map +0 -1
- package/node/find-3-prong.ts/calc-initial-3-prong-center.d.ts +0 -13
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js +0 -27
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +0 -1
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.d.ts +0 -22
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +0 -1
- package/node/find-3-prong.ts/find-3-prong.d.ts +0 -16
- package/node/find-3-prong.ts/find-3-prong.js.map +0 -1
- package/node/find-3-prong.ts/find-and-add-3-prong.js.map +0 -1
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.js.map +0 -1
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +0 -1
- package/node/find-3-prong.ts/get-closest-points.d.ts +0 -9
- package/node/find-3-prong.ts/get-closest-points.js.map +0 -1
- package/node/mat/connect-hole-closers.d.ts +0 -3
- package/node/mat/connect-hole-closers.js +0 -5
- package/node/mat/connect-hole-closers.js.map +0 -1
- package/node/mat/create-new-cp-tree.d.ts +0 -9
- package/node/mat/create-new-cp-tree.js +0 -23
- package/node/mat/create-new-cp-tree.js.map +0 -1
- package/node/memoize-primitive.d.ts +0 -11
- package/node/memoize-primitive.js +0 -25
- package/node/memoize-primitive.js.map +0 -1
- package/node/point-on-shape/create-pos.d.ts +0 -4
- package/node/point-on-shape/create-pos.js +0 -11
- package/node/point-on-shape/create-pos.js.map +0 -1
- package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +0 -17
- package/node/point-on-shape/is-pos-quite-sharp-corner.js +0 -14
- package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +0 -1
- package/src/bezier/fit-quads-to-cubic.ts +0 -103
- package/src/bezier/total-curvature.ts +0 -8
- package/src/bezier/total-length.ts +0 -8
- package/src/closest-boundary-point/closest-points-on-curve-precise.ts +0 -75
- package/src/closest-boundary-point/closest-points-on-curve.ts +0 -72
- package/src/closest-boundary-point/dd-deflate-with-running-error.ts +0 -88
- package/src/contact-point/contact-point.ts +0 -42
- package/src/cp-node/fs/get-avg-speed.ts +0 -31
- package/src/cp-node/fs/get-smoothed-speed.ts +0 -97
- package/src/cp-node/fs/get-smoothed.ts +0 -62
- package/src/cp-node/fs/get-speed.ts +0 -56
- package/src/curve/curve.ts +0 -35
- package/src/dbscan/dbscan.ts +0 -91
- package/src/debug/cp-node-for-debugging.ts +0 -15
- package/src/debug/functions/draw-elem/draw-speed.ts +0 -35
- package/src/debug/three-prong-for-debugging.ts +0 -58
- package/src/debug/two-prong-for-debugging.ts +0 -30
- package/src/dijkstra/dijkstra.ts +0 -418
- package/src/find-2-prong/find-and-add-2-prongs-on-all-paths.ts +0 -38
- package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +0 -77
- package/src/find-2-prong/find-equidistant-point-on-line.ts +0 -40
- package/src/find-2-prong/pyth-trips.ts +0 -146
- package/src/find-3-prong.ts/add-3-prong.ts +0 -113
- package/src/find-3-prong.ts/array-set.ts +0 -47
- package/src/find-3-prong.ts/find-3-prong.ts +0 -48
- package/src/find-3-prong.ts/find-and-add-all-3-prongs.ts +0 -109
- package/src/find-mat/add-2-prongs-by-error.ts +0 -122
- package/src/find-mat/add-debug-info.ts +0 -93
- package/src/find-mat/cp-node-for-insertion.ts +0 -13
- package/src/find-mat/get-dull-corners.ts +0 -34
- package/src/find-mat/get-half-angles.ts +0 -95
- package/src/find-mat/get-size-params.ts +0 -34
- package/src/find-mat/get-total-by.ts +0 -27
- package/src/get-curve/get-curve-between.ts +0 -80
- package/src/get-curve/get-edge-direction.ts +0 -70
- package/src/mat/add-to-cp-graph.ts +0 -60
- package/src/mat/cmp-cp-on-delta.ts +0 -56
- package/src/mat/connect-hole-closers.ts +0 -9
- package/src/mat/create-new-cp-tree.ts +0 -32
- package/src/mat/get-edges-as-array.ts +0 -18
- package/src/mat/get-largest-three-prong.ts +0 -14
- package/src/mat/get-neighboring-cps.ts +0 -49
- package/src/mat/is-another-cp-closeby.ts +0 -69
- package/src/mat/simplify-mat-map-only.ts +0 -110
- package/src/memoize-primitive.ts +0 -31
- package/src/point-on-shape/create-pos.ts +0 -20
- package/src/sat/cull-by-salience.ts +0 -115
- package/src/svg/get-extreme.ts +0 -23
- package/src/utils/bezier-piece-to-bezier.ts +0 -13
- package/src/utils/sleep.ts +0 -7
- /package/node/{find-3-prong.ts → find-3-prong}/find-and-add-3-prongs-on-loop.d.ts +0 -0
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { find3ProngForDelta3s } from './find-3-prong-for-delta3s.js';
|
|
2
2
|
import { getBoundaryPieceBeziers } from '../mat/get-boundary-piece-beziers.js';
|
|
3
3
|
/**
|
|
4
|
-
* @internal
|
|
5
4
|
* Find and return a 3-prong from the given boundary piece.
|
|
5
|
+
*
|
|
6
6
|
* @param δs A boundary piece
|
|
7
|
-
* @param
|
|
8
|
-
* tolerances.
|
|
7
|
+
* @param maxCoordPowerOf2 The maximum coordinate power of 2 value used to
|
|
8
|
+
* calculate floating point tolerances.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
9
11
|
*/
|
|
10
|
-
function find3Prong(δs,
|
|
12
|
+
function find3Prong(δs, maxCoordPowerOf2) {
|
|
13
|
+
// FUTURE if `δs.length > (some threshold (say 4 or 5))` then add two-prongs
|
|
14
|
+
// to reduced the number of permutations required
|
|
15
|
+
// if (δs.length > 3) { console.log(δs.length); }
|
|
11
16
|
const curvePiecess = δs.map(getBoundaryPieceBeziers);
|
|
12
17
|
// The best candidate amongst the different 'permutations' of the given δs.
|
|
13
18
|
let threeProng;
|
|
14
|
-
let smallestError =
|
|
19
|
+
let smallestError = Infinity;
|
|
15
20
|
for (let i = 1; i < δs.length - 1; i++) {
|
|
16
21
|
for (let k = 0; k < 3; k++) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
22
|
+
const r = find3ProngForDelta3s(δs, i, k, curvePiecess, maxCoordPowerOf2);
|
|
23
|
+
if (r === undefined) {
|
|
19
24
|
continue;
|
|
20
25
|
}
|
|
21
|
-
const {
|
|
26
|
+
const { error, threeProngInfo } = r;
|
|
22
27
|
if (error < smallestError) {
|
|
23
28
|
smallestError = error;
|
|
24
|
-
threeProng =
|
|
29
|
+
threeProng = threeProngInfo;
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-3-prong.js","sourceRoot":"","sources":["../../src/find-3-prong/find-3-prong.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAI/E;;;;;;;;GAQG;AACH,SAAS,UAAU,CACX,EAAc,EACd,gBAAwB;IAE5B,4EAA4E;IAC5E,iDAAiD;IACjD,iDAAiD;IAEjD,MAAM,YAAY,GAAG,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAErD,2EAA2E;IAC3E,IAAI,UAA0B,CAAC;IAE/B,IAAI,aAAa,GAAG,QAAQ,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,oBAAoB,CAC1B,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,gBAAgB,CAC3C,CAAC;YAEF,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBAAC,SAAS;YAAC,CAAC;YAElC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;YAEpC,IAAI,KAAK,GAAG,aAAa,EAAE,CAAC;gBACxB,aAAa,GAAG,KAAK,CAAC;gBACtB,UAAU,GAAG,cAAc,CAAC;YAChC,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,UAAW,CAAC;AACvB,CAAC;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
-
import { MatMeta } from '../mat/mat-meta.js';
|
|
1
|
+
import type { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
+
import type { MatMeta } from '../mat/mat-meta.js';
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* Finds and add a 3-prong MAT circle to the given shape.
|
|
@@ -3,6 +3,7 @@ import { find3Prong } from './find-3-prong.js';
|
|
|
3
3
|
import { addToCpTree } from '../mat/add-to-cp-tree.js';
|
|
4
4
|
import { getCloseByCpIfExist } from '../mat/get-closeby-cp-if-exist.js';
|
|
5
5
|
import { getProngCount } from '../cp-node/fs/get-prong-count.js';
|
|
6
|
+
let ii = 0;
|
|
6
7
|
/**
|
|
7
8
|
* @internal
|
|
8
9
|
* Finds and add a 3-prong MAT circle to the given shape.
|
|
@@ -16,11 +17,25 @@ function findAndAdd3Prong(meta, visitedCps) {
|
|
|
16
17
|
for (const visitedCp of visitedCps) {
|
|
17
18
|
δs.push([visitedCp, visitedCp.next]);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
// TODO - remove - debugging
|
|
21
|
+
//-------------------------
|
|
22
|
+
// ii++;
|
|
23
|
+
// if (ii === 13) {
|
|
24
|
+
// //@ts-ignore
|
|
25
|
+
// if (_debug_.temp === undefined) { _debug_.temp = []; }
|
|
26
|
+
// //@ts-ignore
|
|
27
|
+
// _debug_.temp.push(δs);
|
|
28
|
+
// }
|
|
29
|
+
// //@ts-ignore
|
|
30
|
+
// if (_debug_.temp2 === undefined) { _debug_.temp2 = []; }
|
|
31
|
+
// //@ts-ignore
|
|
32
|
+
// _debug_.temp2.push(δs.length);
|
|
33
|
+
//-------------------------
|
|
34
|
+
const threeProngInfo = find3Prong(δs, meta.maxCoordPowerOf2);
|
|
20
35
|
const { circle, poss, δ3s } = threeProngInfo;
|
|
21
36
|
const orders = [];
|
|
22
37
|
for (let i = 0; i < 3; i++) {
|
|
23
|
-
orders.push(calcPosOrder(circle, poss[i]));
|
|
38
|
+
orders.push(calcPosOrder(circle.center, poss[i]));
|
|
24
39
|
}
|
|
25
40
|
const closeBysFor3Prong = [];
|
|
26
41
|
for (let i = 0; i < poss.length; i++) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-and-add-3-prong.js","sourceRoot":"","sources":["../../src/find-3-prong/find-and-add-3-prong.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,IAAI,EAAE,GAAG,CAAC,CAAC;AACX;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACjB,IAAa,EACb,UAAoB;IAExB,MAAM,EAAE,GAAuB,EAAE,CAAC;IAClC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,4BAA4B;IAC5B,2BAA2B;IAC3B,QAAQ;IACR,mBAAmB;IACnB,mBAAmB;IACnB,6DAA6D;IAC7D,mBAAmB;IACnB,6BAA6B;IAC7B,IAAI;IACJ,eAAe;IACf,2DAA2D;IAC3D,eAAe;IACf,iCAAiC;IACjC,2BAA2B;IAE3B,MAAM,cAAc,GAAG,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAA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AAC;IAET,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAmB,EAAE,CAAC;AAC/D,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { findAndAdd3Prongs } from './find-and-add-3-prongs.js';
|
|
2
2
|
import { getAllOnLoop } from '../cp-node/fs/get-all-on-loop.js';
|
|
3
3
|
import { removeVertex } from '../vertex/remove-vertex.js';
|
|
4
|
-
// import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
|
-
// import { Loop } from 'flo-boolean';
|
|
6
|
-
// import { drawFs } from 'flo-draw';
|
|
7
4
|
import { getAllOnCircle } from '../cp-node/fs/get-all-on-circle.js';
|
|
8
5
|
/**
|
|
9
6
|
* @internal
|
|
@@ -37,7 +34,7 @@ function findAndAdd3ProngsOnLoop(meta, cpStart) {
|
|
|
37
34
|
}
|
|
38
35
|
cpStart = getFirstItemOfSet(cpNodeGoodSet);
|
|
39
36
|
}
|
|
40
|
-
return
|
|
37
|
+
return cpStart;
|
|
41
38
|
}
|
|
42
39
|
// From https://stackoverflow.com/a/73281564/2010061
|
|
43
40
|
function getFirstItemOfSet(set) {
|
|
@@ -46,23 +43,13 @@ function getFirstItemOfSet(set) {
|
|
|
46
43
|
}
|
|
47
44
|
return undefined;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function replaceCloseBys(
|
|
57
|
-
// cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
58
|
-
meta, closeBysFor3Prong, cpNodeSet, cpNodeGoodSet) {
|
|
59
|
-
for (const closeBy of [closeBysFor3Prong[0]]) {
|
|
60
|
-
getAllOnCircle(closeBy).forEach(v => {
|
|
61
|
-
cpNodeSet.delete(v);
|
|
62
|
-
cpNodeGoodSet.delete(v);
|
|
63
|
-
});
|
|
64
|
-
removeVertex(closeBy, meta);
|
|
65
|
-
}
|
|
46
|
+
function replaceCloseBys(meta, closeBysFor3Prong, cpNodeSet, cpNodeGoodSet) {
|
|
47
|
+
const closeBy = closeBysFor3Prong[0];
|
|
48
|
+
getAllOnCircle(closeBy).forEach(v => {
|
|
49
|
+
cpNodeSet.delete(v);
|
|
50
|
+
cpNodeGoodSet.delete(v);
|
|
51
|
+
});
|
|
52
|
+
removeVertex(closeBy, meta);
|
|
66
53
|
}
|
|
67
54
|
export { findAndAdd3ProngsOnLoop };
|
|
68
55
|
//# sourceMappingURL=find-and-add-3-prongs-on-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-and-add-3-prongs-on-loop.js","sourceRoot":"","sources":["../../src/find-3-prong/find-and-add-3-prongs-on-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGpE;;;;;;IAMI;AACJ,SAAS,uBAAuB,CACxB,IAAa,EACb,OAA2B;IAE/B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,SAAU,CAAC;IAAC,CAAC;IAEjD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,OAAO,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,KAAK,CAAC;QACf,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACjD,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,GACrC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEpC,IA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|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
declare function findAndAdd3Prongs(meta: MatMeta, cpStart: CpNode): {
|
|
18
|
-
closeBysFor3Prong: CpNode[];
|
|
19
|
-
addedCpNodes: CpNode[][];
|
|
20
|
-
} | {
|
|
21
|
-
closeBysFor3Prong: undefined;
|
|
18
|
+
closeBysFor3Prong: CpNode[] | undefined;
|
|
22
19
|
addedCpNodes: CpNode[][];
|
|
23
20
|
};
|
|
24
21
|
export { findAndAdd3Prongs };
|
|
@@ -17,11 +17,10 @@ let ii = 0;
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
function findAndAdd3Prongs(meta, cpStart) {
|
|
20
|
-
if (isPosSharpCorner(cpStart.
|
|
20
|
+
if (isPosSharpCorner(cpStart.pointOnShape)) {
|
|
21
21
|
return { closeBysFor3Prong: undefined, addedCpNodes: [] };
|
|
22
22
|
}
|
|
23
23
|
const addedCpNodes = [];
|
|
24
|
-
let closeBysFor3Prong = undefined;
|
|
25
24
|
do {
|
|
26
25
|
if (cpStart === undefined) {
|
|
27
26
|
continue;
|
|
@@ -41,7 +40,7 @@ function findAndAdd3Prongs(meta, cpStart) {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
} while (true);
|
|
44
|
-
return { closeBysFor3Prong, addedCpNodes };
|
|
43
|
+
return { closeBysFor3Prong: undefined, addedCpNodes };
|
|
45
44
|
}
|
|
46
45
|
export { findAndAdd3Prongs };
|
|
47
46
|
//# sourceMappingURL=find-and-add-3-prongs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-and-add-3-prongs.js","sourceRoot":"","sources":["../../src/find-3-prong/find-and-add-3-prongs.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA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x
|
|
5
|
+
* @param curvePiece3s
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
declare function getClosestPoints(x: number[], curvePiece3s: CurvePiece[][]): import("../point-on-shape/point-on-shape.js").PrePointOnShape[];
|
|
10
|
+
export { getClosestPoints };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { getCloseBoundaryPointsCertified } from '../closest-boundary-point/get-close-boundary-points-certified.js';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @param maxCoordPowerOf2
|
|
4
4
|
* @param x
|
|
5
5
|
* @param curvePiece3s
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
7
8
|
*/
|
|
8
9
|
function getClosestPoints(x, curvePiece3s) {
|
|
9
10
|
return curvePiece3s.map(curvePieces => {
|
|
10
|
-
return getCloseBoundaryPointsCertified(
|
|
11
|
-
curvePieces, x)[0];
|
|
11
|
+
return getCloseBoundaryPointsCertified(curvePieces, x)[0];
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
export { getClosestPoints };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-closest-points.js","sourceRoot":"","sources":["../../src/find-3-prong/get-closest-points.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,kEAAkE,CAAC;AAGnH;;;;;;GAMG;AACH,SAAS,gBAAgB,CACjB,CAAW,EACX,YAA4B;IAEhC,OAAO,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;QAClC,OAAO,+BAA+B,CAClC,WAAW,EACX,CAAC,CACJ,CAAC,CAAC,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;AACP,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
+
import type { Circle } from '../geometry/circle.js';
|
|
3
|
+
import type { PrePointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
4
|
+
interface ThreeProngInfo {
|
|
5
|
+
readonly circle: Circle;
|
|
6
|
+
readonly poss: PrePointOnShape[];
|
|
7
|
+
readonly δ3s: CpNode[][];
|
|
8
|
+
}
|
|
9
|
+
export type { ThreeProngInfo };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three-prong-info.js","sourceRoot":"","sources":["../../src/find-3-prong/three-prong-info.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timed-cc.js","sourceRoot":"","sources":["../../src/find-3-prong/timed-cc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C,4DAA4D;AAC5D,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAGtC,OAAO,EAAE,gBAAgB,IAAI,YAAY,EAAE,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MatOptions } from './mat-options.js';
|
|
2
|
-
declare function clipOptions(
|
|
1
|
+
import { type MatOptions } from './mat-options.js';
|
|
2
|
+
declare function clipOptions(maxCoordPowerOf2: number, options: Required<MatOptions>): Required<MatOptions>;
|
|
3
3
|
export { clipOptions };
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { matOptionRanges } from './mat-options.js';
|
|
2
|
-
function clipOptions(
|
|
3
|
-
const expMaxCoord = Math.ceil(Math.log2(maxCoordinate));
|
|
4
|
-
const expMaxRadius = Math.ceil(Math.log2(maxRadius));
|
|
2
|
+
function clipOptions(maxCoordPowerOf2, options) {
|
|
5
3
|
const scaleSigBits = 10; // 1024 x 1024
|
|
6
4
|
const options_ = { ...options };
|
|
7
5
|
for (const k in matOptionRanges) {
|
|
8
|
-
|
|
9
|
-
let o = options_[
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const { range, scaleByMaxCoordinate, scaleByMaxRadius } = c;
|
|
6
|
+
const key = k;
|
|
7
|
+
let o = options_[key];
|
|
8
|
+
const c = matOptionRanges[key];
|
|
9
|
+
const { range, scaleByMaxCoordinate } = c;
|
|
13
10
|
if (o < range[0]) {
|
|
14
11
|
o = range[0];
|
|
15
12
|
}
|
|
@@ -18,13 +15,9 @@ function clipOptions(maxCoordinate, maxRadius, options) {
|
|
|
18
15
|
}
|
|
19
16
|
// Adjust length tolerance according to a reference max coordinate
|
|
20
17
|
if (!!scaleByMaxCoordinate) {
|
|
21
|
-
o
|
|
18
|
+
o *= 2 ** (maxCoordPowerOf2 - scaleSigBits);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
o = o * (2 ** expMaxRadius * 2 ** (-scaleSigBits));
|
|
25
|
-
}
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
options_[k] = o;
|
|
20
|
+
options_[key] = o;
|
|
28
21
|
}
|
|
29
22
|
return options_;
|
|
30
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-options.js","sourceRoot":"","sources":["../../src/find-mat/clip-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clip-options.js","sourceRoot":"","sources":["../../src/find-mat/clip-options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AAGpE,SAAS,WAAW,CACZ,gBAAwB,EACxB,OAA6B;IAEjC,MAAM,YAAY,GAAG,EAAE,CAAC,CAAE,cAAc;IAExC,MAAM,QAAQ,GAAkC,EAAE,GAAG,OAAO,EAAE,CAAC;IAE/D,KAAK,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,CAAiC,CAAC;QAC9C,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtB,MAAM,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;QACnC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;QAEnC,kEAAkE;QAClE,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;YACzB,CAAC,IAAI,CAAC,IAAE,CAAC,gBAAgB,GAAG,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Loop } from 'flo-boolean';
|
|
2
|
+
import type { CpNode } from '../cp-node/cp-node.js';
|
|
3
|
+
import type { PrePointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
4
|
+
import { RbTree } from 'flo-ll-rb-tree';
|
|
5
5
|
/**
|
|
6
|
-
* @internal
|
|
7
6
|
* Creates the initial ContactPoint loops from the given sharp corners.
|
|
8
7
|
*
|
|
9
|
-
* *
|
|
8
|
+
* * ❗Modifies❗`cpTrees` and `lastInsertId`
|
|
10
9
|
*
|
|
11
10
|
* @param loops
|
|
12
11
|
* @param cpTrees
|
|
13
12
|
* @param sharpCornerss
|
|
14
13
|
* @param lastInsertId
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
15
16
|
*/
|
|
16
|
-
declare function createInitialCpTree(loops: Loop[],
|
|
17
|
+
declare function createInitialCpTree(loops: Loop[], sharpCornerss: PrePointOnShape[][], lastInsertId: {
|
|
17
18
|
id: number;
|
|
18
|
-
}): CpNode
|
|
19
|
+
}): Map<Loop, RbTree<CpNode>>;
|
|
19
20
|
export { createInitialCpTree };
|
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CpNodeFs } from '../cp-node/cp-node-fs.js';
|
|
1
|
+
import { RbTree } from 'flo-ll-rb-tree';
|
|
3
2
|
import { insertCpNode } from '../cp-node/fs/insert-cp-node.js';
|
|
4
|
-
|
|
3
|
+
import { cpNodeComparator } from '../cp-node/fs/cp-node-comparator.js';
|
|
5
4
|
/**
|
|
6
|
-
* @internal
|
|
7
5
|
* Creates the initial ContactPoint loops from the given sharp corners.
|
|
8
6
|
*
|
|
9
|
-
* *
|
|
7
|
+
* * ❗Modifies❗`cpTrees` and `lastInsertId`
|
|
10
8
|
*
|
|
11
9
|
* @param loops
|
|
12
10
|
* @param cpTrees
|
|
13
11
|
* @param sharpCornerss
|
|
14
12
|
* @param lastInsertId
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
15
|
*/
|
|
16
|
-
function createInitialCpTree(loops,
|
|
17
|
-
|
|
16
|
+
function createInitialCpTree(loops, sharpCornerss, lastInsertId) {
|
|
17
|
+
const cpTrees = new Map();
|
|
18
18
|
for (let k = 0; k < sharpCornerss.length; k++) {
|
|
19
|
+
const cpTree = new RbTree(cpNodeComparator);
|
|
20
|
+
cpTrees.set(loops[k], cpTree);
|
|
19
21
|
const sharpCorners = sharpCornerss[k];
|
|
20
|
-
const cpTree = new LlRbTree(cpNodeComparator, false);
|
|
21
22
|
let cpNode1 = undefined;
|
|
22
23
|
let cpNode2 = undefined;
|
|
23
|
-
for (const
|
|
24
|
-
const circle = { center:
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
for (const ppos of sharpCorners) {
|
|
25
|
+
const circle = { center: ppos.p, radius: 0 };
|
|
26
|
+
const { curve } = ppos;
|
|
27
|
+
const pos1 = { ...ppos, curve, t: 1, circle, order: -1, order2: 0 };
|
|
28
|
+
const pos2 = { ...ppos, curve: curve.next, t: 0, circle, order: +1, order2: 0 };
|
|
29
|
+
cpNode1 = insertCpNode(true, false, false, cpTree, pos1, cpNode2, lastInsertId);
|
|
30
|
+
cpNode2 = insertCpNode(true, false, false, cpTree, pos2, cpNode1, lastInsertId);
|
|
29
31
|
cpNode1.prevOnCircle = cpNode2;
|
|
30
32
|
cpNode2.prevOnCircle = cpNode1;
|
|
31
33
|
cpNode1.nextOnCircle = cpNode2;
|
|
32
34
|
cpNode2.nextOnCircle = cpNode1;
|
|
33
35
|
}
|
|
34
|
-
if (!cpNode) {
|
|
35
|
-
cpNode = cpNode1;
|
|
36
|
-
}
|
|
37
|
-
const loop = loops[k];
|
|
38
|
-
cpTrees.set(loop, cpTree);
|
|
39
36
|
}
|
|
40
|
-
return
|
|
37
|
+
return cpTrees;
|
|
41
38
|
}
|
|
42
39
|
export { createInitialCpTree };
|
|
43
40
|
//# sourceMappingURL=create-initial-cp-tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-initial-cp-tree.js","sourceRoot":"","sources":["../../src/find-mat/create-initial-cp-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-initial-cp-tree.js","sourceRoot":"","sources":["../../src/find-mat/create-initial-cp-tree.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAGvE;;;;;;;;;;;GAWG;AACH,SAAS,mBAAmB,CACpB,KAAa,EACb,aAAkC,EAClC,YAA4B;IAEhC,MAAM,OAAO,GAA8B,IAAI,GAAG,EAAE,CAAC;IAErD,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,g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,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
-
import { Loop } from 'flo-boolean';
|
|
3
|
-
import { MatOptions } from './mat-options.js';
|
|
4
|
-
import { MatMeta } from '../mat/mat-meta.js';
|
|
1
|
+
import type { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
+
import type { Loop } from 'flo-boolean';
|
|
3
|
+
import type { MatOptions } from './mat-options.js';
|
|
4
|
+
import type { MatMeta } from '../mat/mat-meta.js';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
* Find the MAT of the given loops.
|
|
8
8
|
* @param loops The loops (that as a precondition must be ordered from highest
|
|
9
9
|
* (i.e. smallest y-value) topmost point loops to lowest)
|
|
10
10
|
*/
|
|
11
|
-
declare function findMat(loops: Loop[],
|
|
11
|
+
declare function findMat(loops: Loop[], maxCoordPowerOf2: number, options: Required<MatOptions>): {
|
|
12
12
|
cpNode: CpNode;
|
|
13
13
|
meta: MatMeta;
|
|
14
14
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findAndAdd3ProngsOnLoop } from '../find-3-prong
|
|
1
|
+
import { findAndAdd3ProngsOnLoop } from '../find-3-prong/find-and-add-3-prongs-on-loop.js';
|
|
2
2
|
import { createInitialCpTree } from './create-initial-cp-tree.js';
|
|
3
|
-
import { getPointToCpNode
|
|
3
|
+
import { /*getPointToCpNode,*/ getPartialMeta, addDebugInfo2, addDebugInfo3, addDebugInfo4, getPointToCpNode } from './get-meta.js';
|
|
4
4
|
import { getSharpCornersOnLoop } from './get-sharp-corners.js';
|
|
5
5
|
import { getDullCornersOnLoop } from './get-dull-corners-on-loop.js';
|
|
6
6
|
import { findAndAdd2ProngsOnAllLoops } from '../find-2-prong/find-and-add-2-prongs-on-all-loops.js';
|
|
@@ -14,29 +14,24 @@ import { getShapeBounds } from '../svg/get-shape-bounds.js';
|
|
|
14
14
|
* @param loops The loops (that as a precondition must be ordered from highest
|
|
15
15
|
* (i.e. smallest y-value) topmost point loops to lowest)
|
|
16
16
|
*/
|
|
17
|
-
function findMat(loops,
|
|
17
|
+
function findMat(loops, maxCoordPowerOf2, options) {
|
|
18
18
|
const { minBezLength, maxCurviness, maxLength, angleIncrement } = options;
|
|
19
19
|
const getSharpCornersOnLoop_ = getSharpCornersOnLoop(minBezLength);
|
|
20
20
|
const getDullCornersOnLoop_ = getDullCornersOnLoop(minBezLength);
|
|
21
21
|
const getFor2ProngsOnLoop_ = getFor2ProngsOnLoop(minBezLength, maxCurviness, maxLength);
|
|
22
22
|
const getFor1ProngsOnLoop_ = getFor1ProngsOnLoop(minBezLength);
|
|
23
|
-
const sharpCornersPerLoop = loops.map(getSharpCornersOnLoop_);
|
|
24
23
|
const bounds = getShapeBounds(loops);
|
|
25
24
|
const squaredDiagonalLength = (bounds.maxX.p[0] - bounds.minX.p[0]) ** 2 +
|
|
26
25
|
(bounds.maxY.p[1] - bounds.minY.p[1]) ** 2;
|
|
27
|
-
const
|
|
26
|
+
const sharpCornersPerLoop = loops.map(getSharpCornersOnLoop_);
|
|
28
27
|
const lastInsertId = { id: 0 };
|
|
29
|
-
createInitialCpTree(loops,
|
|
28
|
+
const cpTrees = createInitialCpTree(loops, sharpCornersPerLoop, lastInsertId);
|
|
30
29
|
const _meta = getPartialMeta(loops);
|
|
31
30
|
const pointToCpNode = getPointToCpNode(loops, cpTrees);
|
|
32
31
|
const meta = {
|
|
33
|
-
|
|
32
|
+
maxCoordPowerOf2, squaredDiagonalLength, loops, cpTrees, // pointToCpNode,
|
|
34
33
|
lastInsertId, ..._meta
|
|
35
34
|
};
|
|
36
|
-
// const cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
|
|
37
|
-
// const lastInsertId = { id: 0 };
|
|
38
|
-
// createInitialCpTree(loops, cpTrees, sharpCornersPerLoop, lastInsertId);
|
|
39
|
-
// const meta = getMeta(maxCoordinate, squaredDiagonalLength, loops, cpTrees, lastInsertId);
|
|
40
35
|
let cpNode;
|
|
41
36
|
cpNode = findAndAddHoleClosing2Prongs(meta);
|
|
42
37
|
if (typeof _debug_ !== 'undefined') {
|
|
@@ -66,7 +61,6 @@ function findMat(loops, maxCoordinate, options) {
|
|
|
66
61
|
return { cpNode: cpNode, meta };
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
|
-
// if (cpNode !== undefined) { add2rongsByError(options, 0.1, meta, cpNode); }
|
|
70
64
|
// if (cpNode !== undefined) { checkOrdering(cpTrees, cpNode); }
|
|
71
65
|
const mat = { cpNode, meta };
|
|
72
66
|
addDebugInfo4();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-mat.js","sourceRoot":"","sources":["../../src/find-mat/find-mat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-mat.js","sourceRoot":"","sources":["../../src/find-mat/find-mat.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpI,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;;;;GAKG;AACH,SAAS,OAAO,CACR,KAAa,E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AAC;YAAC,OAAO,EAAE,MAAM,EAAE,MAAO,EAAE,IAAI,EAAE,CAAC;QAAC,CAAC;IACtF,CAAC;IAED,gEAAgE;IAEhE,MAAM,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAE7B,aAAa,EAAE,CAAC;IAEhB,OAAO,GAAG,CAAC;AACf,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,CAAA;AAIlB,wCAAwC;AACxC,mDAAmD;AACnD,8CAA8C"}
|
|
@@ -5,6 +5,7 @@ import { toScaleAxis } from '../sat/to-scale-axis.js';
|
|
|
5
5
|
import { clipOptions } from './clip-options.js';
|
|
6
6
|
import { findMat } from './find-mat.js';
|
|
7
7
|
import { defaultMatOptions } from './mat-options.js';
|
|
8
|
+
const { ceil, log2 } = Math;
|
|
8
9
|
/**
|
|
9
10
|
* Finds and returns the Medial Axis Transforms (MATs) from the given array of
|
|
10
11
|
* bezier loops representing shape boundaries.
|
|
@@ -31,26 +32,18 @@ import { defaultMatOptions } from './mat-options.js';
|
|
|
31
32
|
*/
|
|
32
33
|
function findMats(bezierLoops, options) {
|
|
33
34
|
// if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
|
|
34
|
-
const { maxCoordinate
|
|
35
|
-
const
|
|
35
|
+
const { maxCoordinate } = getLoopsMetrics(bezierLoops);
|
|
36
|
+
const maxCoordPowerOf2 = ceil(log2(maxCoordinate));
|
|
37
|
+
const options_ = clipOptions(maxCoordPowerOf2, {
|
|
36
38
|
...defaultMatOptions,
|
|
37
39
|
...(options || {})
|
|
38
40
|
});
|
|
39
41
|
const { applySat, simplify, satScale, simplifyTolerance } = options_;
|
|
40
42
|
const loopss = simplifyPaths(bezierLoops, undefined, { forceOrientationNegative: true });
|
|
41
43
|
// console.log(loopsToSvgPathStr(bezierLoops));
|
|
42
|
-
// console.log(loopsToSvgPathStr(loopss[0].map(loop => loop.beziers.map(ps => ps.map(p => p.map(c => Math.round(c*1)/1))))));
|
|
43
|
-
// console.log(loopsToSvgPathStr(loopss[1].map(loop => loop.beziers.map(ps => ps.map(p => p.map(c => Math.round(c*1)/1))))));
|
|
44
|
-
// console.log(loopsToSvgPathStr(loopss[0].map(loop => loop.beziers.map(ps => ps.map(p => p.map(c => Math.round(c*1000)/1000))))));
|
|
45
|
-
// console.log(loopsToSvgPathStr(loopss[1].map(loop => loop.beziers.map(ps => ps.map(p => p.map(c => Math.round(c*1000)/1000))))));
|
|
46
|
-
// console.log(loopss.map(loops => loops.map(loop => loop.beziers)));
|
|
47
|
-
// console.log(loopss.map(loops => loopsToSvgPathStr(loops.map(loop => loop.beziers))));
|
|
48
|
-
// const loopss = [bezierLoops.map(loop => loopFromBeziers(loop,0))];
|
|
49
|
-
// console.log(loopsToSvgPathStr(bezierLoops.map(v => v.map(v => v.map(v => [-v[0],v[1]])))));
|
|
50
|
-
// console.log(loopsToSvgPathStr(loopss[0].map(loop => loop.beziers)));
|
|
51
44
|
const mats = [];
|
|
52
45
|
for (const loops of loopss) {
|
|
53
|
-
let mat = findMat(loops,
|
|
46
|
+
let mat = findMat(loops, maxCoordPowerOf2, options_);
|
|
54
47
|
if (mat === undefined) {
|
|
55
48
|
continue;
|
|
56
49
|
}
|
|
@@ -62,6 +55,8 @@ function findMats(bezierLoops, options) {
|
|
|
62
55
|
}
|
|
63
56
|
mats.push(mat);
|
|
64
57
|
}
|
|
58
|
+
// console.log(structuredClone(circumCenter.getStats()));
|
|
59
|
+
// circumCenter.resetStats();
|
|
65
60
|
return mats;
|
|
66
61
|
}
|
|
67
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../../src/find-mat/find-mats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;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SAAS,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEzF,+CAA+C;IAE/C,MAAM,IAAI,GAAU,EAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACrD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAEpC,IAAI,QAAQ,EAAE,CAAC;YACX,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACX,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAA;QACjD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,yDAAyD;IACzD,6BAA6B;IAE7B,OAAO,IAAI,CAAC;AAChB,CAAC;AAID;;;;GAIG;AACH,SAAS,iBAAiB,CAClB,KAAqB;IAEzB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Loop } from 'flo-boolean';
|
|
1
|
+
import type { PrePointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
2
|
+
import type { Loop } from 'flo-boolean';
|
|
3
3
|
/** @internal */
|
|
4
|
-
declare function getDullCornersOnLoop(minBezLength: number): (loop: Loop) =>
|
|
4
|
+
declare function getDullCornersOnLoop(minBezLength: number): (loop: Loop) => PrePointOnShape[];
|
|
5
5
|
export { getDullCornersOnLoop };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createPos } from '../point-on-shape/create-pos.js';
|
|
2
1
|
import { controlPointLinesLength } from 'flo-bezier3';
|
|
3
2
|
import { getCorner } from '../corner/get-corner.js';
|
|
4
3
|
/** @internal */
|
|
@@ -10,9 +9,11 @@ function getDullCornersOnLoop(minBezLength) {
|
|
|
10
9
|
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
11
10
|
continue;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const { next, ps } = curve;
|
|
13
|
+
if (getCorner(ps, next.ps).isQuiteDull) {
|
|
14
|
+
const p = ps[ps.length - 1];
|
|
15
|
+
dullCorners.push({ curve, t: 1, isSource: true, p });
|
|
16
|
+
dullCorners.push({ curve: next, t: 0, isSource: true, p });
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
return dullCorners;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-dull-corners-on-loop.js","sourceRoot":"","sources":["../../src/find-mat/get-dull-corners-on-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-dull-corners-on-loop.js","sourceRoot":"","sources":["../../src/find-mat/get-dull-corners-on-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,gBAAgB;AAChB,SAAS,oBAAoB,CACrB,YAAoB;IAExB,OAAO,CAAC,IAAU,EAAqB,EAAE;QACrC,MAAM,WAAW,GAAsB,EAAE,CAAC;QAE1C,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,C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