flo-mat 4.1.4 → 5.0.1
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/__tests__/closest-boundary-point/get-endpoint-info.spec.ts +140 -0
- package/__tests__/closest-boundary-point/root-interval-to-distance-squared-interval.spec.ts +87 -0
- package/__tests__/cp-node/circle-identity.spec.ts +56 -0
- package/__tests__/cp-node/fs/get-all-on-loop-by-loop.spec.ts +55 -0
- package/__tests__/cp-node/fs/get-angle-between-mat-curves.spec.ts +39 -3
- package/__tests__/cp-node/fs/get-boundary-bezier-parts-to-next.spec.ts +87 -3
- package/__tests__/cp-node/fs/get-boundary-beziers-between.spec.ts +68 -3
- package/__tests__/cp-node/fs/get-boundary-beziers-to-next.spec.ts +41 -3
- package/__tests__/cp-node/fs/get-boundary-distance-to-next.spec.ts +20 -3
- package/__tests__/cp-node/fs/get-branch-beziers.spec.ts +42 -3
- package/__tests__/cp-node/fs/get-branch.spec.ts +60 -3
- package/__tests__/cp-node/fs/get-cp-node-ordering.spec.ts +19 -3
- package/__tests__/cp-node/fs/get-distance-to-next.spec.ts +37 -4
- package/__tests__/cp-node/fs/get-edge-direction.spec.ts +50 -3
- package/__tests__/cp-node/fs/get-first-exit.spec.ts +78 -3
- package/__tests__/cp-node/fs/get-hole-closers.spec.ts +32 -3
- package/__tests__/cp-node/fs/get-implied-boundary-bezier-between.spec.ts +48 -3
- package/__tests__/cp-node/fs/get-mat-curve-between.spec.ts +77 -3
- package/__tests__/cp-node/fs/get-mat-curve-to-next.spec.ts +17 -4
- package/__tests__/cp-node/fs/get-mat-curves-between.spec.ts +38 -3
- package/__tests__/cp-node/fs/get-salience.spec.ts +68 -3
- package/__tests__/cp-node/fs/get-vertex-forward-children.spec.ts +40 -3
- package/__tests__/cp-node/fs/insert-cp-node.spec.ts +87 -3
- package/__tests__/cp-node/fs/is-special.spec.ts +1 -1
- package/__tests__/cp-node/fs/remove-cp-node.spec.ts +42 -3
- package/__tests__/find-2-prong/calc-seperation-tolerance.spec.ts +46 -0
- package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs-same-curve.spec.ts +7 -5
- package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs.spec.ts +4 -2
- package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +1 -1
- package/__tests__/floyd-warshall/get-graph.spec.ts +100 -0
- package/__tests__/get-mats-with-hole.ts +28 -0
- package/__tests__/get-mats1.spec.ts +61 -0
- package/__tests__/get-mats1.ts +75 -67
- package/__tests__/helpers/cp-node-by-id.ts +27 -0
- package/__tests__/helpers/expect-point-close.ts +42 -0
- package/__tests__/mat/hausdorff-distance-one-sided-exceeds.spec.ts +129 -0
- package/__tests__/mat/simplify-mat.spec.ts +85 -0
- package/__tests__/reconstruct-from-mat/reconstruct-from-mat.spec.ts +39 -0
- package/__tests__/specific-cases/test-svgs/achispado.svg +14 -0
- package/__tests__/utils/get-beziers-from-tangents.spec.ts +142 -0
- package/browser/index.js +17882 -13800
- package/browser/index.min.js +1 -1
- package/node/add-n-prong.ts/join-spokes.js +3 -2
- package/node/add-n-prong.ts/join-spokes.js.map +1 -1
- package/node/closest-boundary-point/cull-curve-pieces.d.ts +21 -0
- package/node/closest-boundary-point/cull-curve-pieces.js +40 -0
- package/node/closest-boundary-point/cull-curve-pieces.js.map +1 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +5 -2
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/closest-boundary-point/get-endpoint-info.d.ts +39 -0
- package/node/closest-boundary-point/get-endpoint-info.js +78 -0
- package/node/closest-boundary-point/get-endpoint-info.js.map +1 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +5 -19
- 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 +17 -5
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +37 -50
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
- package/node/corner/get-corner.d.ts +18 -1
- package/node/corner/get-corner.js +8 -1
- package/node/corner/get-corner.js.map +1 -1
- package/node/corner/get-interface-ccw.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +4 -3
- package/node/cp-node/fs/enhance-cp-node.d.ts +9 -9
- package/node/cp-node/fs/get-all-on-loop-by-loop.js +0 -4
- package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -1
- package/node/cp-node/fs/get-angle-between-mat-curves.d.ts +1 -1
- package/node/cp-node/fs/get-angle-between-mat-curves.js +7 -4
- package/node/cp-node/fs/get-angle-between-mat-curves.js.map +1 -1
- package/node/cp-node/fs/get-boundary-beziers-between.d.ts +6 -4
- package/node/cp-node/fs/get-boundary-beziers-between.js +6 -4
- package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -1
- package/node/cp-node/fs/get-branch-beziers.d.ts +2 -1
- package/node/cp-node/fs/get-branch-beziers.js +3 -2
- package/node/cp-node/fs/get-branch-beziers.js.map +1 -1
- package/node/cp-node/fs/get-branch.js +1 -2
- package/node/cp-node/fs/get-branch.js.map +1 -1
- package/node/cp-node/fs/get-distance-to-next.js +4 -2
- package/node/cp-node/fs/get-distance-to-next.js.map +1 -1
- package/node/cp-node/fs/get-edge-direction.js +3 -2
- package/node/cp-node/fs/get-edge-direction.js.map +1 -1
- package/node/cp-node/fs/get-first-exit.d.ts +7 -3
- package/node/cp-node/fs/get-first-exit.js +13 -11
- package/node/cp-node/fs/get-first-exit.js.map +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.d.ts +10 -2
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js +11 -54
- 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 +5 -3
- package/node/cp-node/fs/get-mat-curve-between.js +6 -49
- package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
- package/node/cp-node/fs/get-mat-curve-to-next.d.ts +1 -1
- package/node/cp-node/fs/get-mat-curves-between.d.ts +8 -0
- package/node/cp-node/fs/get-mat-curves-between.js +9 -2
- package/node/cp-node/fs/get-mat-curves-between.js.map +1 -1
- package/node/cp-node/fs/get-real-prong-count.d.ts +2 -1
- package/node/cp-node/fs/get-real-prong-count.js +11 -5
- package/node/cp-node/fs/get-real-prong-count.js.map +1 -1
- package/node/cp-node/fs/get-salience.d.ts +10 -0
- package/node/cp-node/fs/get-salience.js +17 -1
- package/node/cp-node/fs/get-salience.js.map +1 -1
- package/node/cp-node/fs/is-fully-terminating.d.ts +4 -2
- package/node/cp-node/fs/is-fully-terminating.js +6 -17
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
- package/node/cp-node/fs/is-on-same-circle.d.ts +3 -0
- package/node/cp-node/fs/is-on-same-circle.js +4 -4
- package/node/cp-node/fs/is-on-same-circle.js.map +1 -1
- package/node/cp-node/fs/is-on-same-loop.d.ts +1 -1
- package/node/cp-node/fs/is-special.d.ts +7 -0
- package/node/cp-node/fs/is-special.js +9 -2
- package/node/cp-node/fs/is-special.js.map +1 -1
- package/node/cp-node/fs/is-vertex.d.ts +1 -1
- package/node/cp-node/fs/traverse-edges.d.ts +7 -3
- package/node/cp-node/fs/traverse-edges.js +7 -3
- package/node/cp-node/fs/traverse-edges.js.map +1 -1
- package/node/cp-node/stringification/from-stringifyable.d.ts +2 -2
- package/node/cp-node/stringification/from-stringifyable.js +17 -1
- package/node/cp-node/stringification/from-stringifyable.js.map +1 -1
- package/node/cp-node/stringification/to-stringifyable.d.ts +3 -3
- package/node/cp-node/stringification/to-stringifyable.js +3 -3
- package/node/debug/debug.d.ts +26 -3
- package/node/debug/debug.js +16 -5
- package/node/debug/debug.js.map +1 -1
- package/node/find-2-prong/add-2-prong.js +7 -9
- package/node/find-2-prong/add-2-prong.js.map +1 -1
- package/node/find-2-prong/calc-seperation-tolerance.d.ts +28 -5
- package/node/find-2-prong/calc-seperation-tolerance.js +32 -89
- package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -1
- package/node/find-2-prong/find-2-prong.js +8 -10
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/find-and-add-2-prongs.js +2 -2
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -1
- package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -2
- package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -3
- package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
- package/node/find-2-prong/get-medial/get-closest-points.d.ts +1 -8
- package/node/find-2-prong/get-medial/get-closest-points.js +4 -40
- package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
- package/node/find-2-prong/reduce-radius.d.ts +1 -1
- package/node/find-2-prong/reduce-radius.js +6 -3
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/find-3-prong/calc-better-x.js +1 -1
- package/node/find-3-prong/calc-better-x.js.map +1 -1
- package/node/find-3-prong/find-3-prong-for-delta3s.d.ts +3 -2
- package/node/find-3-prong/find-3-prong-for-delta3s.js +36 -42
- package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
- package/node/find-3-prong/find-3-prong.js +3 -1
- package/node/find-3-prong/find-3-prong.js.map +1 -1
- package/node/find-3-prong/find-and-add-3-prongs.js +16 -0
- package/node/find-3-prong/find-and-add-3-prongs.js.map +1 -1
- package/node/find-mat/create-initial-cp-tree.js +2 -2
- package/node/find-mat/create-initial-cp-tree.js.map +1 -1
- package/node/find-mat/find-mat.js +3 -4
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/find-mats.d.ts +6 -12
- package/node/find-mat/find-mats.js +10 -27
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/get-dull-corners-on-loop.js +2 -2
- package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
- package/node/find-mat/get-for-1-prongs-on-loop.js +36 -8
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +14 -4
- package/node/find-mat/get-meta.js +30 -24
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/find-mat/get-sharp-corners.js +2 -2
- package/node/find-mat/get-sharp-corners.js.map +1 -1
- package/node/find-mat/mat-options.d.ts +2 -2
- package/node/floyd-warshall/get-graph.d.ts +12 -1
- package/node/floyd-warshall/get-graph.js +41 -38
- package/node/floyd-warshall/get-graph.js.map +1 -1
- package/node/geometry/get-bounding-box-.d.ts +16 -2
- package/node/geometry/get-bounding-box-.js +5 -2
- package/node/geometry/get-bounding-box-.js.map +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.d.ts +3 -0
- package/node/geometry/get-closest-square-distance-to-rect.js +7 -5
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.d.ts +4 -0
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js +12 -5
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +1 -2
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -1
- package/node/index.d.ts +3 -2
- package/node/index.js +2 -1
- package/node/index.js.map +1 -1
- package/node/mat/clone-mat.d.ts +9 -0
- package/node/mat/clone-mat.js +17 -0
- package/node/mat/clone-mat.js.map +1 -0
- package/node/mat/clone-meta.d.ts +12 -0
- package/node/mat/clone-meta.js +24 -0
- package/node/mat/clone-meta.js.map +1 -0
- package/node/mat/get-boundary-piece-beziers.d.ts +5 -0
- package/node/mat/get-boundary-piece-beziers.js +7 -93
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-closeby-cp-if-exist.js +2 -1
- package/node/mat/get-closeby-cp-if-exist.js.map +1 -1
- package/node/mat/get-largest-3-prong.d.ts +6 -0
- package/node/mat/get-largest-3-prong.js +8 -5
- package/node/mat/get-largest-3-prong.js.map +1 -1
- package/node/mat/get-largest-vertex.d.ts +15 -1
- package/node/mat/get-largest-vertex.js +20 -7
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/hausdorff-distance-one-sided-exceeds.d.ts +79 -0
- package/node/mat/hausdorff-distance-one-sided-exceeds.js +251 -0
- package/node/mat/hausdorff-distance-one-sided-exceeds.js.map +1 -0
- package/node/mat/mat-meta.d.ts +0 -6
- package/node/mat/simplify-mat.d.ts +25 -8
- package/node/mat/simplify-mat.js +182 -53
- package/node/mat/simplify-mat.js.map +1 -1
- package/node/mat/trim-mat.d.ts +4 -2
- package/node/mat/trim-mat.js +3 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape/get-boundary-tangent-line.d.ts +19 -0
- package/node/point-on-shape/get-boundary-tangent-line.js +33 -0
- package/node/point-on-shape/get-boundary-tangent-line.js.map +1 -0
- package/node/point-on-shape/get-osculating-circle.d.ts +6 -4
- package/node/point-on-shape/get-osculating-circle.js +6 -4
- package/node/point-on-shape/get-osculating-circle.js.map +1 -1
- package/node/point-on-shape/get-pos-corner.js +2 -2
- package/node/point-on-shape/get-pos-corner.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +5 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.js +20 -80
- package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -1
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +4 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +4 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -1
- package/node/sat/cull.d.ts +7 -6
- package/node/sat/cull.js +13 -16
- package/node/sat/cull.js.map +1 -1
- package/node/sat/get-sat-culls.d.ts +12 -2
- package/node/sat/get-sat-culls.js +21 -16
- package/node/sat/get-sat-culls.js.map +1 -1
- package/node/svg/get-shape-bounds.d.ts +1 -12
- package/node/svg/get-shape-bounds.js +2 -3
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/node/utils/get-beziers-from-tangents.d.ts +28 -0
- package/node/utils/get-beziers-from-tangents.js +92 -0
- package/node/utils/get-beziers-from-tangents.js.map +1 -0
- package/node/vertex/remove-vertex.d.ts +5 -3
- package/node/vertex/remove-vertex.js +5 -3
- package/node/vertex/remove-vertex.js.map +1 -1
- package/package.json +16 -16
- package/qv-infinite-loop.md +120 -0
- package/src/add-n-prong.ts/join-spokes.ts +4 -2
- package/src/closest-boundary-point/cull-curve-pieces.ts +49 -0
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +5 -2
- package/src/closest-boundary-point/get-endpoint-info.ts +96 -0
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +5 -23
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +42 -60
- package/src/corner/get-corner.ts +10 -1
- package/src/corner/get-interface-ccw.ts +2 -2
- package/src/cp-node/cp-node.ts +4 -3
- package/src/cp-node/fs/get-all-on-loop-by-loop.ts +0 -4
- package/src/cp-node/fs/get-angle-between-mat-curves.ts +9 -5
- package/src/cp-node/fs/get-boundary-beziers-between.ts +10 -8
- package/src/cp-node/fs/get-branch-beziers.ts +3 -2
- package/src/cp-node/fs/get-branch.ts +1 -2
- package/src/cp-node/fs/get-distance-to-next.ts +4 -2
- package/src/cp-node/fs/get-edge-direction.ts +4 -2
- package/src/cp-node/fs/get-first-exit.ts +15 -14
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +18 -70
- package/src/cp-node/fs/get-mat-curve-between.ts +10 -67
- package/src/cp-node/fs/get-mat-curves-between.ts +9 -2
- package/src/cp-node/fs/get-real-prong-count.ts +11 -7
- package/src/cp-node/fs/get-salience.ts +15 -2
- package/src/cp-node/fs/is-fully-terminating.ts +6 -22
- package/src/cp-node/fs/is-on-same-circle.ts +6 -7
- package/src/cp-node/fs/is-on-same-loop.ts +2 -2
- package/src/cp-node/fs/is-special.ts +11 -6
- package/src/cp-node/fs/is-vertex.ts +1 -1
- package/src/cp-node/fs/traverse-edges.ts +8 -4
- package/src/cp-node/stringification/from-stringifyable.ts +75 -58
- package/src/cp-node/stringification/to-stringifyable.ts +3 -3
- package/src/debug/debug.ts +44 -8
- package/src/find-2-prong/add-2-prong.ts +9 -11
- package/src/find-2-prong/calc-seperation-tolerance.ts +34 -115
- package/src/find-2-prong/find-2-prong.ts +9 -11
- package/src/find-2-prong/find-and-add-2-prongs.ts +2 -2
- package/src/find-2-prong/get-medial/get-antipodal-points.ts +1 -3
- package/src/find-2-prong/get-medial/get-closest-points.ts +6 -51
- package/src/find-2-prong/reduce-radius.ts +6 -4
- package/src/find-3-prong/calc-better-x.ts +2 -2
- package/src/find-3-prong/find-3-prong-for-delta3s.ts +197 -214
- package/src/find-3-prong/find-3-prong.ts +54 -51
- package/src/find-3-prong/find-and-add-3-prongs.ts +20 -1
- package/src/find-mat/create-initial-cp-tree.ts +2 -2
- package/src/find-mat/find-mat.ts +4 -6
- package/src/find-mat/find-mats.ts +83 -105
- package/src/find-mat/get-dull-corners-on-loop.ts +2 -2
- package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -8
- package/src/find-mat/get-meta.ts +34 -39
- package/src/find-mat/get-sharp-corners.ts +2 -2
- package/src/find-mat/mat-options.ts +2 -2
- package/src/floyd-warshall/get-graph.ts +46 -47
- package/src/geometry/get-bounding-box-.ts +5 -2
- package/src/geometry/get-closest-square-distance-to-rect.ts +7 -7
- package/src/geometry/get-closest-squared-distance-to-rotated-rect.ts +15 -13
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +1 -2
- package/src/index.ts +3 -2
- package/src/mat/clone-mat.ts +9 -3
- package/src/mat/clone-meta.ts +8 -0
- package/src/mat/get-boundary-piece-beziers.ts +16 -117
- package/src/mat/get-closeby-cp-if-exist.ts +3 -1
- package/src/mat/get-largest-3-prong.ts +9 -6
- package/src/mat/get-largest-vertex.ts +25 -9
- package/src/mat/hausdorff-distance-one-sided-exceeds.ts +314 -0
- package/src/mat/mat-meta.ts +0 -9
- package/src/mat/simplify-mat.ts +254 -116
- package/src/mat/trim-mat.ts +6 -4
- package/src/point-on-shape/get-boundary-tangent-line.ts +36 -0
- package/src/point-on-shape/get-osculating-circle.ts +7 -5
- package/src/point-on-shape/get-pos-corner.ts +2 -2
- package/src/point-on-shape/point-on-shape.ts +5 -0
- package/src/reconstruct-from-mat/reconstruct-from-mat.ts +22 -111
- package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +4 -0
- package/src/sat/cull.ts +16 -20
- package/src/sat/get-sat-culls.ts +28 -23
- package/src/svg/get-shape-bounds.ts +2 -3
- package/src/sweep-line/sweep-line.ts +1 -1
- package/src/utils/deg-to-rad.ts +4 -2
- package/src/utils/get-beziers-from-tangents.ts +110 -0
- package/src/utils/map-map.ts +1 -1
- package/src/utils/rad-to-deg.ts +4 -1
- package/src/vertex/remove-vertex.ts +5 -3
- package/webpack.config.cjs +7 -2
- package/__tests__/cp-node/fs/get-distance-between.spec.ts +0 -7
- package/__tests__/cp-node/fs/get-terminating-on-circle.spec.ts +0 -24
- package/__tests__/cp-node/fs/is-single-3-prong.spec.ts +0 -17
- package/__tests__/cp-node/fs/iterate-all-on-loop.spec.ts +0 -17
- package/__tests__/cp-node/fs/traverse-all-forward.spec.ts +0 -14
- package/node/closest-boundary-point/cull-bezier-pieces-1.d.ts +0 -9
- package/node/closest-boundary-point/cull-bezier-pieces-1.js +0 -17
- package/node/closest-boundary-point/cull-bezier-pieces-1.js.map +0 -1
- package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +0 -13
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js +0 -27
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +0 -11
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js +0 -27
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
- package/node/cp-node/fs/find-first.d.ts +0 -10
- package/node/cp-node/fs/find-first.js +0 -19
- package/node/cp-node/fs/find-first.js.map +0 -1
- package/node/debug/functions/check-ordering.d.ts +0 -4
- package/node/debug/functions/check-ordering.js +0 -43
- package/node/debug/functions/check-ordering.js.map +0 -1
- package/node/find-2-prong/cull-bezier-pieces.d.ts +0 -13
- package/node/find-2-prong/cull-bezier-pieces.js +0 -43
- package/node/find-2-prong/cull-bezier-pieces.js.map +0 -1
- package/node/floyd-warshall/get-hole-closer-pairs.d.ts +0 -8
- package/node/floyd-warshall/get-hole-closer-pairs.js +0 -27
- package/node/floyd-warshall/get-hole-closer-pairs.js.map +0 -1
- package/node/utils/dual-set.d.ts +0 -27
- package/node/utils/dual-set.js +0 -55
- package/node/utils/dual-set.js.map +0 -1
- package/node/utils/tri-map.d.ts +0 -27
- package/node/utils/tri-map.js +0 -49
- package/node/utils/tri-map.js.map +0 -1
- package/src/closest-boundary-point/cull-bezier-pieces-1.ts +0 -36
- package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +0 -42
- package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +0 -43
- package/src/closest-boundary-point/get-p-from-box.ts +0 -14
- package/src/cp-node/fs/add-distance-from.ts +0 -49
- package/src/cp-node/fs/get-distance-between.ts +0 -16
- package/src/cp-node/fs/get-terminating-on-circle.ts +0 -24
- package/src/cp-node/fs/is-single-3-prong.ts +0 -15
- package/src/cp-node/fs/iterate-all-on-loop.ts +0 -15
- package/src/cp-node/fs/traverse-all-forward.ts +0 -24
- package/src/debug/functions/draw/draw-beziers-as-single-path.ts +0 -40
- package/src/debug/functions/draw/draw-disk.ts +0 -34
- package/src/debug/functions/draw/xmlns.ts +0 -5
- package/src/find-2-prong/cull-bezier-pieces.ts +0 -61
- package/src/find-2-prong/find-and-add-2-prong.ts +0 -30
- package/src/find-2-prong/get-medial/get-closest-points-d.ts +0 -213
- package/src/find-2-prong/x-for-debugging.ts +0 -13
- package/src/floyd-warshall/get-hole-closer-pairs.ts +0 -35
- package/src/mat/get-two-prong-type.ts +0 -13
- package/src/point-on-shape/is-pos-dull-corner.ts +0 -18
- package/src/point-on-shape/is-pos-quite-dull-corner.ts +0 -18
- package/src/point-on-shape/is-pos-quite-sharp-corner.ts +0 -18
- package/src/point-on-shape/pos-to-human-string.ts +0 -18
- package/src/sweep-line/are-boxes-intersecting.ts +0 -37
|
@@ -11,18 +11,12 @@ import { MatOptions } from './mat-options.js';
|
|
|
11
11
|
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
12
12
|
* first of which is the x-coordinate and the second the y-coordinate.
|
|
13
13
|
*
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* is
|
|
19
|
-
*
|
|
20
|
-
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
21
|
-
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
22
|
-
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
23
|
-
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
24
|
-
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
25
|
-
* in [1,100].
|
|
14
|
+
* @param options the `MatOptions` (see there for a description of each option
|
|
15
|
+
* and its default), e.g. `maxCurviness` and `maxLength` together determine the
|
|
16
|
+
* accuracy of the MAT, `simplify` and `simplifyTolerance` control the
|
|
17
|
+
* simplification of the result and `applySat` and `satScale` whether and how
|
|
18
|
+
* the Scale Axis Transform is applied. Missing options take their defaults
|
|
19
|
+
* (`defaultMatOptions`) and all values are clipped to their allowed ranges.
|
|
26
20
|
*/
|
|
27
21
|
declare function findMats(bezierLoops: number[][][][], options?: MatOptions): Mat[];
|
|
28
22
|
export { findMats };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { simplifyPaths } from 'flo-boolean';
|
|
2
2
|
import { getLoopsMetrics } from '../loop/get-max-coordinate.js';
|
|
3
3
|
import { simplifyMat } from '../mat/simplify-mat.js';
|
|
4
4
|
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
|
+
import { resetDebugElems } from './get-meta.js';
|
|
7
8
|
import { defaultMatOptions } from './mat-options.js';
|
|
8
9
|
const { ceil, log2 } = Math;
|
|
9
10
|
/**
|
|
@@ -17,21 +18,16 @@ const { ceil, log2 } = Math;
|
|
|
17
18
|
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
18
19
|
* first of which is the x-coordinate and the second the y-coordinate.
|
|
19
20
|
*
|
|
20
|
-
* @param
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* is
|
|
25
|
-
*
|
|
26
|
-
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
27
|
-
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
28
|
-
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
29
|
-
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
30
|
-
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
31
|
-
* in [1,100].
|
|
21
|
+
* @param options the `MatOptions` (see there for a description of each option
|
|
22
|
+
* and its default), e.g. `maxCurviness` and `maxLength` together determine the
|
|
23
|
+
* accuracy of the MAT, `simplify` and `simplifyTolerance` control the
|
|
24
|
+
* simplification of the result and `applySat` and `satScale` whether and how
|
|
25
|
+
* the Scale Axis Transform is applied. Missing options take their defaults
|
|
26
|
+
* (`defaultMatOptions`) and all values are clipped to their allowed ranges.
|
|
32
27
|
*/
|
|
33
28
|
function findMats(bezierLoops, options) {
|
|
34
29
|
// if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
|
|
30
|
+
resetDebugElems();
|
|
35
31
|
const { maxCoordinate } = getLoopsMetrics(bezierLoops);
|
|
36
32
|
const maxCoordPowerOf2 = ceil(log2(maxCoordinate));
|
|
37
33
|
const options_ = clipOptions(maxCoordPowerOf2, {
|
|
@@ -42,7 +38,6 @@ function findMats(bezierLoops, options) {
|
|
|
42
38
|
const loopss = simplifyPaths(bezierLoops, {
|
|
43
39
|
forceOrientationNegative: true,
|
|
44
40
|
});
|
|
45
|
-
// console.log(loopsToSvgPathStr(bezierLoops));
|
|
46
41
|
const mats = [];
|
|
47
42
|
for (const loops of loopss) {
|
|
48
43
|
let mat = findMat(loops, maxCoordPowerOf2, options_);
|
|
@@ -53,7 +48,7 @@ function findMats(bezierLoops, options) {
|
|
|
53
48
|
mat = toScaleAxis(mat, satScale);
|
|
54
49
|
}
|
|
55
50
|
if (simplify) {
|
|
56
|
-
mat = simplifyMat(mat, simplifyTolerance
|
|
51
|
+
mat = simplifyMat(mat, simplifyTolerance);
|
|
57
52
|
}
|
|
58
53
|
mats.push(mat);
|
|
59
54
|
}
|
|
@@ -61,17 +56,5 @@ function findMats(bezierLoops, options) {
|
|
|
61
56
|
// circumCenter.resetStats();
|
|
62
57
|
return mats;
|
|
63
58
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Returns an SVG path string representation of the given bezier loops.
|
|
66
|
-
* @param loops An array of loops having an array of bezier curves each given as
|
|
67
|
-
* an array of control points.
|
|
68
|
-
*/
|
|
69
|
-
function loopsToSvgPathStr(loops) {
|
|
70
|
-
let str = '';
|
|
71
|
-
for (const loop of loops) {
|
|
72
|
-
str = str + beziersToSvgPathStr(loop) + '\n';
|
|
73
|
-
}
|
|
74
|
-
return str;
|
|
75
|
-
}
|
|
76
59
|
export { findMats };
|
|
77
60
|
//# sourceMappingURL=find-mats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../../src/find-mat/find-mats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"find-mats.js","sourceRoot":"","sources":["../../src/find-mat/find-mats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA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AAI,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,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,yDAAyD;IACzD,6BAA6B;IAE7B,OAAO,IAAI,CAAC;AAChB,CAAC;AAID,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { controlPointLinesLength } from 'flo-bezier3';
|
|
2
|
-
import { getCorner } from '../corner/get-corner.js';
|
|
2
|
+
import { getCorner$ } from '../corner/get-corner.js';
|
|
3
3
|
/** @internal */
|
|
4
4
|
function getDullCornersOnLoop(minBezLength) {
|
|
5
5
|
return (loop) => {
|
|
@@ -10,7 +10,7 @@ function getDullCornersOnLoop(minBezLength) {
|
|
|
10
10
|
continue;
|
|
11
11
|
}
|
|
12
12
|
const { next, ps } = curve;
|
|
13
|
-
if (getCorner(ps, next.ps).isQuiteDull) {
|
|
13
|
+
if (getCorner$(ps, next.ps).isQuiteDull) {
|
|
14
14
|
const p = ps[ps.length - 1];
|
|
15
15
|
const pDd = [[0, p[0]], [0, p[1]]];
|
|
16
16
|
dullCorners.push({ curve, t: 1, isSource: true, p, pDd });
|
|
@@ -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,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,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,MA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,CAAA"}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { getCurvatureExtremaDd, controlPointLinesLength } from 'flo-bezier3';
|
|
2
|
+
import { distanceBetween } from 'flo-vector2d';
|
|
2
3
|
import { toP } from '../point-on-shape/to-p.js';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Curvature maxima closer than this (in parameter space) to a curve endpoint
|
|
7
|
+
* are ignored - they are handled by the corner logic.
|
|
8
|
+
*/
|
|
9
|
+
const EDGE_T_TOLERANCE = 2 ** -20;
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
* Curvature maxima closer than this fraction of the curve's control polygon
|
|
13
|
+
* length to a curve endpoint are ignored. A curve with (near) coincident
|
|
14
|
+
* control points at an end has (near) zero speed there and its curvature
|
|
15
|
+
* blows up towards that end; the resulting "maximum" (that can be well
|
|
16
|
+
* inside the parameter tolerance above) is an artifact and not a feature of
|
|
17
|
+
* the shape.
|
|
18
|
+
*/
|
|
19
|
+
const EDGE_DISTANCE_TOLERANCE = 2 ** -20;
|
|
3
20
|
/**
|
|
4
21
|
* Get points of maximum curvature.
|
|
5
22
|
*
|
|
@@ -12,19 +29,30 @@ function getFor1ProngsOnLoop(minBezLength) {
|
|
|
12
29
|
const poss = [];
|
|
13
30
|
for (let i = 0; i < loop.curves.length; i++) {
|
|
14
31
|
const curve = loop.curves[i];
|
|
15
|
-
|
|
32
|
+
const { ps } = curve;
|
|
33
|
+
const len = controlPointLinesLength(ps);
|
|
34
|
+
if (len < minBezLength) {
|
|
16
35
|
continue;
|
|
17
36
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
37
|
+
const pS = ps[0];
|
|
38
|
+
const pE = ps[ps.length - 1];
|
|
39
|
+
const edgeDistanceTolerance = len * EDGE_DISTANCE_TOLERANCE;
|
|
40
|
+
for (const t of getCurvatureExtremaDd(ps).maxima) {
|
|
41
|
+
// keep away from edges (in parameter space)
|
|
42
|
+
if (t < EDGE_T_TOLERANCE || t > 1 - EDGE_T_TOLERANCE) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
20
45
|
const pDd = toP(ps, t);
|
|
21
46
|
const p = pDd.map(c => c[0] + c[1]);
|
|
22
|
-
|
|
23
|
-
|
|
47
|
+
// keep away from edges (in distance)
|
|
48
|
+
if (distanceBetween(p, pS) < edgeDistanceTolerance ||
|
|
49
|
+
distanceBetween(p, pE) < edgeDistanceTolerance) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
poss.push({ curve, t, isSource: true, p, pDd });
|
|
53
|
+
}
|
|
24
54
|
}
|
|
25
|
-
return poss
|
|
26
|
-
// keep away from edges
|
|
27
|
-
.filter(pos => pos.t > 2 ** -20 && pos.t < 2 ** -20);
|
|
55
|
+
return poss;
|
|
28
56
|
};
|
|
29
57
|
}
|
|
30
58
|
export { getFor1ProngsOnLoop };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-for-1-prongs-on-loop.js","sourceRoot":"","sources":["../../src/find-mat/get-for-1-prongs-on-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;;;;;GAMG;AACH,SAAS,mBAAmB,CACpB,YAAoB;IAExB,OAAO,UAAS,IAAU;QACtB,MAAM,IAAI,GAAsB,EAAE,CAAC;QAEnC,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,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"get-for-1-prongs-on-loop.js","sourceRoot":"","sources":["../../src/find-mat/get-for-1-prongs-on-loop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAu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G,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEpC,qCAAqC;gBACrC,IAAI,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,qBAAqB;oBAC9C,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,qBAAqB,EAAE,CAAC;oBACjD,SAAS;gBACb,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YACpD,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import type { Loop } from 'flo-boolean';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Resets the generated debug `_debug_.elems` (if debug is enabled) so that
|
|
5
|
+
* they only reflect the current `findMats` call.
|
|
6
|
+
*/
|
|
7
|
+
declare function resetDebugElems(): void;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
* Adds (if debug is enabled) the loose and tight bounding boxes, the bounding
|
|
11
|
+
* hulls and the sharp and dull corners of the given loops' curves to
|
|
12
|
+
* `_debug_.elems` for later inspection by consumers.
|
|
13
|
+
*/
|
|
14
|
+
declare function addDebugElems(loops: Loop[]): void;
|
|
5
15
|
declare function addDebugInfo1(): void;
|
|
6
16
|
/** @internal */
|
|
7
17
|
declare function addDebugInfo2(): void;
|
|
@@ -9,4 +19,4 @@ declare function addDebugInfo2(): void;
|
|
|
9
19
|
declare function addDebugInfo3(): void;
|
|
10
20
|
/** @internal */
|
|
11
21
|
declare function addDebugInfo4(): void;
|
|
12
|
-
export {
|
|
22
|
+
export { resetDebugElems, addDebugElems, addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 };
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import { getBoundingHull
|
|
2
|
-
import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
|
|
1
|
+
import { getBoundingHull } from 'flo-bezier3';
|
|
2
|
+
import { getBoundingBox$, getBoundingBoxTight$ } from '../geometry/get-bounding-box-.js';
|
|
3
3
|
import { getCorner } from '../corner/get-corner.js';
|
|
4
|
+
import { createEmptyElems } from '../debug/debug.js';
|
|
4
5
|
let timingStart;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Resets the generated debug `_debug_.elems` (if debug is enabled) so that
|
|
9
|
+
* they only reflect the current `findMats` call.
|
|
10
|
+
*/
|
|
11
|
+
function resetDebugElems() {
|
|
12
|
+
if (typeof _debug_ === 'undefined') {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
_debug_.elems = { ..._debug_.elems, ...createEmptyElems() };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* Adds (if debug is enabled) the loose and tight bounding boxes, the bounding
|
|
20
|
+
* hulls and the sharp and dull corners of the given loops' curves to
|
|
21
|
+
* `_debug_.elems` for later inspection by consumers.
|
|
22
|
+
*/
|
|
23
|
+
function addDebugElems(loops) {
|
|
24
|
+
if (typeof _debug_ === 'undefined') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const { looseBoundingBoxes, tightBoundingBoxes, boundingHulls, sharpCorners, dullCorners } = _debug_.elems;
|
|
12
28
|
for (const loop of loops) {
|
|
13
29
|
for (const curve of loop.curves) {
|
|
14
30
|
const ps = curve.ps;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const tightBoundingBox = getBoundingBoxTight(ps);
|
|
20
|
-
tightBoundingBoxes.push(tightBoundingBox);
|
|
21
|
-
const corner = getCorner(curve.ps, curve.next.ps);
|
|
31
|
+
boundingHulls.push(getBoundingHull(ps, true));
|
|
32
|
+
looseBoundingBoxes.push(getBoundingBox$(ps));
|
|
33
|
+
tightBoundingBoxes.push(getBoundingBoxTight$(ps));
|
|
34
|
+
const corner = getCorner(ps, curve.next.ps);
|
|
22
35
|
if (corner.isQuiteSharp) {
|
|
23
36
|
sharpCorners.push(curve);
|
|
24
37
|
}
|
|
@@ -27,13 +40,6 @@ function getPartialMeta(loops) {
|
|
|
27
40
|
}
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
|
-
return {
|
|
31
|
-
looseBoundingBoxes,
|
|
32
|
-
tightBoundingBoxes,
|
|
33
|
-
boundingHulls,
|
|
34
|
-
sharpCorners,
|
|
35
|
-
dullCorners
|
|
36
|
-
};
|
|
37
43
|
}
|
|
38
44
|
function addDebugInfo1() {
|
|
39
45
|
if (typeof _debug_ === 'undefined') {
|
|
@@ -66,5 +72,5 @@ function addDebugInfo4() {
|
|
|
66
72
|
}
|
|
67
73
|
_debug_.timing.threeProngs += performance.now() - timingStart;
|
|
68
74
|
}
|
|
69
|
-
export {
|
|
75
|
+
export { resetDebugElems, addDebugElems, addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 };
|
|
70
76
|
//# sourceMappingURL=get-meta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-meta.js","sourceRoot":"","sources":["../../src/find-mat/get-meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-meta.js","sourceRoot":"","sources":["../../src/find-mat/get-meta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM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CAAC;IACL,CAAC;AACL,CAAC;AAGD,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;AACpC,CAAC;AAID,gBAAgB;AAChB,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,GAAG,GAAG,WAAW,CAAC;IAChD,WAAW,GAAG,GAAG,CAAC;AACtB,CAAC;AAGD,gBAAgB;AAChB,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAE9B,OAAO,CAAC,MAAM,CAAC,aAAa,IAAI,GAAG,GAAG,WAAW,CAAC;IAClD,WAAW,GAAG,GAAG,CAAC;AACtB,CAAC;AAGD,gBAAgB;AAChB,SAAS,aAAa;IAClB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAE/C,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,WAAW,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC;AAClE,CAAC;AAGD,OAAO,EACH,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EAChB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { controlPointLinesLength } from 'flo-bezier3';
|
|
2
|
-
import { getCorner } from '../corner/get-corner.js';
|
|
2
|
+
import { getCorner$ } from '../corner/get-corner.js';
|
|
3
3
|
/** @internal */
|
|
4
4
|
function getSharpCornersOnLoop(minBezLength) {
|
|
5
5
|
return (loop) => {
|
|
@@ -9,7 +9,7 @@ function getSharpCornersOnLoop(minBezLength) {
|
|
|
9
9
|
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
10
10
|
continue;
|
|
11
11
|
}
|
|
12
|
-
if (getCorner(curve.ps, curve.next.ps).isQuiteSharp) {
|
|
12
|
+
if (getCorner$(curve.ps, curve.next.ps).isQuiteSharp) {
|
|
13
13
|
const { ps } = curve;
|
|
14
14
|
const p = ps[ps.length - 1];
|
|
15
15
|
const pDd = [[0, p[0]], [0, p[1]]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sharp-corners.js","sourceRoot":"","sources":["../../src/find-mat/get-sharp-corners.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-sharp-corners.js","sourceRoot":"","sources":["../../src/find-mat/get-sharp-corners.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,gBAAgB;AAChB,SAAS,qBAAqB,CACtB,YAAoB;IAExB,OAAO,CAAC,IAAU,EAAqB,EAAE;QACrC,MAAM,YAAY,GAAsB,EAAE,CAAC;QAE3C,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,CAAC,CAAC,CAAC,CAAC;YAE7B,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC;gBACnD,SAAS;YACb,CAAC;YAED,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC;gBACnD,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;gBAErB,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAC5B,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YAC/D,CAAC;QACL,CAAC;QAED,OAAO,YAAY,CAAC;IACxB,CAAC,CAAA;AACL,CAAC;AAID,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
|
|
@@ -53,7 +53,7 @@ interface MatOptions {
|
|
|
53
53
|
*
|
|
54
54
|
* * Only applies if `simplify` is `true`
|
|
55
55
|
* * Defaults to `1/16`
|
|
56
|
-
* * The value is clipped in `[2**-
|
|
56
|
+
* * The value is clipped in `[2**-20,2**20]`
|
|
57
57
|
* * scaled to a 1024x1024 vector image size, i.e. a value of `1` on such
|
|
58
58
|
* a vector image will have a `1` pixel accuracy. If the vector is, say,
|
|
59
59
|
* 512x400 then the accuracy is scaled to `1/2` a pixel. This ensures
|
|
@@ -65,7 +65,7 @@ interface MatOptions {
|
|
|
65
65
|
*
|
|
66
66
|
* * it is not recommended to change this value
|
|
67
67
|
* * scaled to a 1024x1024 vector image size
|
|
68
|
-
* * Defaults to `1/
|
|
68
|
+
* * Defaults to `1/64`
|
|
69
69
|
*/
|
|
70
70
|
readonly minBezLength?: number;
|
|
71
71
|
/**
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import type { CpNode } from "../cp-node/cp-node.js";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Returns the adjacency matrix (MAT edge lengths, `Infinity` if not adjacent)
|
|
4
|
+
* of the given special vertices (leaves, 3-prongs, ...) seen as the vertices of
|
|
5
|
+
* a graph with the MAT branches between them as edges.
|
|
6
|
+
*
|
|
7
|
+
* * for each vertex every MAT edge leaving it is walked once, up to the next
|
|
8
|
+
* special vertex; if that vertex is one of the given ones the walked length
|
|
9
|
+
* is its distance (the minimum over all such walks if there are several)
|
|
10
|
+
*
|
|
11
|
+
* @param specialVertices the special `CpNode`s (one per vertex)
|
|
12
|
+
*/
|
|
13
|
+
declare function getGraph(specialVertices: CpNode[]): number[][];
|
|
3
14
|
export { getGraph };
|
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
import { getAllOnCircle } from "../cp-node/fs/get-all-on-circle.js";
|
|
2
1
|
import { getMatDistanceToNext$ } from "../cp-node/fs/get-distance-to-next.js";
|
|
3
|
-
import { isOnSameCircle } from "../cp-node/fs/is-on-same-circle.js";
|
|
4
2
|
import { isVertexSpecial } from "../cp-node/fs/is-vertex-special.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Returns the adjacency matrix (MAT edge lengths, `Infinity` if not adjacent)
|
|
5
|
+
* of the given special vertices (leaves, 3-prongs, ...) seen as the vertices of
|
|
6
|
+
* a graph with the MAT branches between them as edges.
|
|
7
|
+
*
|
|
8
|
+
* * for each vertex every MAT edge leaving it is walked once, up to the next
|
|
9
|
+
* special vertex; if that vertex is one of the given ones the walked length
|
|
10
|
+
* is its distance (the minimum over all such walks if there are several)
|
|
11
|
+
*
|
|
12
|
+
* @param specialVertices the special `CpNode`s (one per vertex)
|
|
13
|
+
*/
|
|
14
|
+
function getGraph(specialVertices) {
|
|
8
15
|
const V = specialVertices.length;
|
|
16
|
+
// the column of each given vertex, identified by its circle (all `CpNode`s
|
|
17
|
+
// on a vertex share the same `Circle` object)
|
|
18
|
+
const columnOf = new Map(specialVertices.map((cpNode, j) => [cpNode.pointOnShape.circle, j]));
|
|
9
19
|
const graph = [];
|
|
10
20
|
for (let i = 0; i < V; i++) {
|
|
11
21
|
const cpNodeA = specialVertices[i];
|
|
12
|
-
const row =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
break; // Found path from A to B
|
|
26
|
-
}
|
|
27
|
-
if (child.isHoleClosing) {
|
|
28
|
-
// Hole closer found - don't go around loop
|
|
29
|
-
child = getHoleCloserNext(pairs, child);
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (isVertexSpecial(child)) {
|
|
33
|
-
// we only find the immediate next special ones
|
|
34
|
-
d = Infinity;
|
|
35
|
-
break; // Next special vertex found but it's not B
|
|
22
|
+
const row = new Array(V).fill(Infinity);
|
|
23
|
+
row[i] = 0;
|
|
24
|
+
// walk each edge leaving the vertex up to the next special vertex
|
|
25
|
+
let toChild = cpNodeA;
|
|
26
|
+
do {
|
|
27
|
+
let d = getMatDistanceToNext$(toChild);
|
|
28
|
+
let child = toChild.next;
|
|
29
|
+
while (true) {
|
|
30
|
+
const j = columnOf.get(child.pointOnShape.circle);
|
|
31
|
+
if (j !== undefined) {
|
|
32
|
+
// Found a path from A to one of the given vertices
|
|
33
|
+
if (j !== i && d < row[j]) {
|
|
34
|
+
row[j] = d;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
child = child.next;
|
|
36
|
+
break;
|
|
39
37
|
}
|
|
40
|
-
if (
|
|
41
|
-
|
|
38
|
+
if (child.isHoleClosing) {
|
|
39
|
+
// Hole closer found - skip it (don't go around loop)
|
|
40
|
+
child = child.holeCloserTwin.next;
|
|
41
|
+
continue;
|
|
42
42
|
}
|
|
43
|
+
if (isVertexSpecial(child)) {
|
|
44
|
+
// we only find the immediate next special ones
|
|
45
|
+
break; // Next special vertex found but it's not a given one
|
|
46
|
+
}
|
|
47
|
+
d += getMatDistanceToNext$(child);
|
|
48
|
+
child = child.next;
|
|
43
49
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
50
|
+
toChild = toChild.nextOnCircle;
|
|
51
|
+
} while (toChild !== cpNodeA);
|
|
46
52
|
graph.push(row);
|
|
47
53
|
}
|
|
48
54
|
return graph;
|
|
49
55
|
}
|
|
50
|
-
function getHoleCloserNext(pairs, holeCloser) {
|
|
51
|
-
return pairs.get(holeCloser).next;
|
|
52
|
-
}
|
|
53
56
|
export { getGraph };
|
|
54
57
|
//# sourceMappingURL=get-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-graph.js","sourceRoot":"","sources":["../../src/floyd-warshall/get-graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-graph.js","sourceRoot":"","sources":["../../src/floyd-warshall/get-graph.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE;;;;;;;;;;GAUG;AACH,SAAS,QAAQ,CACT,eAAyB;IAE7B,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC;IAEjC,2EAA2E;IAC3E,8CAA8C;IAC9C,MAAM,QAAQ,GAAG,IAAI,GAAG,CACpB,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CACtE,CAAC;IAEF,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAa,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,GAAG,CAAC,C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-bezier3";
|
|
2
|
+
/** The (loose, axis-aligned) bounding box of a bezier curve - memoized on its control points. */
|
|
2
3
|
declare const getBoundingBox$: typeof getBoundingBox & {
|
|
3
4
|
readonly weakMapS: WeakMap<object, {
|
|
4
5
|
readonly weakMap: WeakMap<object, any>;
|
|
@@ -11,4 +12,17 @@ declare const getBoundingBox$: typeof getBoundingBox & {
|
|
|
11
12
|
readonly clearCache: () => void;
|
|
12
13
|
readonly addToCache: (r: unknown, ...args: any) => void;
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
/** The tight (rotated) bounding box of a bezier curve - memoized on its control points. */
|
|
16
|
+
declare const getBoundingBoxTight$: typeof getBoundingBoxTight & {
|
|
17
|
+
readonly weakMapS: WeakMap<object, {
|
|
18
|
+
readonly weakMap: WeakMap<object, any>;
|
|
19
|
+
readonly map: Map<object, any>;
|
|
20
|
+
}>;
|
|
21
|
+
readonly mapS: Map<object, {
|
|
22
|
+
readonly weakMap: WeakMap<object, any>;
|
|
23
|
+
readonly map: Map<object, any>;
|
|
24
|
+
}>;
|
|
25
|
+
readonly clearCache: () => void;
|
|
26
|
+
readonly addToCache: (r: unknown, ...args: any) => void;
|
|
27
|
+
};
|
|
28
|
+
export { getBoundingBox$, getBoundingBoxTight$ };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { getBoundingBox } from "flo-bezier3";
|
|
1
|
+
import { getBoundingBox, getBoundingBoxTight } from "flo-bezier3";
|
|
2
2
|
import { memoize } from "flo-memoize";
|
|
3
|
+
/** The (loose, axis-aligned) bounding box of a bezier curve - memoized on its control points. */
|
|
3
4
|
const getBoundingBox$ = memoize(getBoundingBox);
|
|
4
|
-
|
|
5
|
+
/** The tight (rotated) bounding box of a bezier curve - memoized on its control points. */
|
|
6
|
+
const getBoundingBoxTight$ = memoize(getBoundingBoxTight);
|
|
7
|
+
export { getBoundingBox$, getBoundingBoxTight$ };
|
|
5
8
|
//# sourceMappingURL=get-bounding-box-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-bounding-box-.js","sourceRoot":"","sources":["../../src/geometry/get-bounding-box-.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"get-bounding-box-.js","sourceRoot":"","sources":["../../src/geometry/get-bounding-box-.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,iGAAiG;AACjG,MAAM,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAChD,2FAA2F;AAC3F,MAAM,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Returns the closest squared distance from the point `p` to the given
|
|
3
|
+
* axis-aligned box `[[minX, minY], [maxX, maxY]]`, i.e. `0` if `p` is inside.
|
|
4
|
+
*
|
|
2
5
|
* @internal
|
|
3
6
|
*/
|
|
4
7
|
declare function getClosestSquareDistanceToRect(box: number[][], p: number[]): number;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { squaredDistanceBetween } from 'flo-vector2d';
|
|
2
1
|
/**
|
|
2
|
+
* Returns the closest squared distance from the point `p` to the given
|
|
3
|
+
* axis-aligned box `[[minX, minY], [maxX, maxY]]`, i.e. `0` if `p` is inside.
|
|
4
|
+
*
|
|
3
5
|
* @internal
|
|
4
6
|
*/
|
|
5
7
|
function getClosestSquareDistanceToRect(box, p) {
|
|
@@ -13,10 +15,10 @@ function getClosestSquareDistanceToRect(box, p) {
|
|
|
13
15
|
const yp = p[1];
|
|
14
16
|
if (xp < x0) {
|
|
15
17
|
if (yp < y0) {
|
|
16
|
-
return
|
|
18
|
+
return (x0 - xp) ** 2 + (y0 - yp) ** 2;
|
|
17
19
|
}
|
|
18
20
|
else if (yp > y1) {
|
|
19
|
-
return
|
|
21
|
+
return (x0 - xp) ** 2 + (yp - y1) ** 2;
|
|
20
22
|
}
|
|
21
23
|
else {
|
|
22
24
|
return (x0 - xp) ** 2;
|
|
@@ -24,10 +26,10 @@ function getClosestSquareDistanceToRect(box, p) {
|
|
|
24
26
|
}
|
|
25
27
|
else if (xp > x1) {
|
|
26
28
|
if (yp < y0) {
|
|
27
|
-
return
|
|
29
|
+
return (xp - x1) ** 2 + (y0 - yp) ** 2;
|
|
28
30
|
}
|
|
29
31
|
else if (yp > y1) {
|
|
30
|
-
return
|
|
32
|
+
return (xp - x1) ** 2 + (yp - y1) ** 2;
|
|
31
33
|
}
|
|
32
34
|
else {
|
|
33
35
|
return (xp - x1) ** 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-closest-square-distance-to-rect.js","sourceRoot":"","sources":["../../src/geometry/get-closest-square-distance-to-rect.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-closest-square-distance-to-rect.js","sourceRoot":"","sources":["../../src/geometry/get-closest-square-distance-to-rect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,SAAS,8BAA8B,CAC/B,GAAe,EAAE,CAAW;IAEhC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACjB,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,MAAM,EAAE,GAAG,CAAC,CAA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OAAO,EAAE,8BAA8B,EAAE,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Returns the closest squared distance from the point `p` to the given
|
|
3
|
+
* (rotated) rectangle given by its 4 corners in order, i.e. `0` if `p` is
|
|
4
|
+
* inside the rectangle.
|
|
5
|
+
*
|
|
2
6
|
* @internal
|
|
3
7
|
*/
|
|
4
8
|
declare function getClosestSquaredDistanceToRotatedRect(ps: number[][], p: number[]): number;
|