flo-mat 4.0.3 → 4.1.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__/find-2-prong/get-medial/dd-get-medial-point-coeffs-same-curve.spec.ts +106 -0
- package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs.spec.ts +73 -0
- package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +5 -2
- package/__tests__/helpers/close-to.ts +5 -5
- package/__tests__/helpers/jest.setup.ts +35 -0
- package/__tests__/specific-cases/load-svg/load-svg.ts +30 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +168 -4
- package/__tests__/specific-cases/test-svgs/achispado.svg +5052 -0
- package/browser/index.js +16089 -16854
- package/browser/index.min.js +1 -1
- package/{jest.config.cjs → jest.config.ts} +8 -3
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +3 -2
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/corner/get-corner.js +1 -1
- package/node/corner/get-corner.js.map +1 -1
- package/node/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.d.ts +6 -2
- package/node/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.js +5 -1
- package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -0
- package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +1 -0
- package/node/cp-node/fs/get-boundary-beziers-to-next.js +1 -59
- package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
- package/node/cp-node/fs/get-edge-direction.d.ts +3 -1
- package/node/cp-node/fs/get-edge-direction.js +5 -3
- package/node/cp-node/fs/get-edge-direction.js.map +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
- package/node/cp-node/fs/get-mat-curve-between.js +6 -6
- package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
- package/node/cp-node/fs/is-fully-terminating.js +12 -0
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
- package/node/debug/debug.d.ts +4 -13
- package/node/debug/debug.js +3 -30
- package/node/debug/debug.js.map +1 -1
- package/node/find-2-prong/find-2-prong.js +24 -10
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -1
- package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -2
- 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 +7 -1
- package/node/find-2-prong/get-medial/get-closest-points.js +60 -14
- package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
- package/node/find-2-prong/reduce-radius.d.ts +3 -1
- package/node/find-2-prong/reduce-radius.js +8 -6
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/find-3-prong/calc-better-x.js +1 -3
- package/node/find-3-prong/calc-better-x.js.map +1 -1
- package/node/find-3-prong/calc-initial-3-prong-center.js +1 -2
- package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
- package/node/find-3-prong/find-3-prong-for-delta3s.js +1 -4
- package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
- package/node/find-3-prong/find-3-prong.js.map +1 -1
- package/node/find-3-prong/find-and-add-3-prong.js +0 -14
- package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
- package/node/find-mat/find-mat.js +2 -1
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/find-mats.js +3 -1
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/get-dull-corners-on-loop.js +3 -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 +6 -3
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-for-2-prongs-on-loop.js +5 -1
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +4 -1
- package/node/find-mat/get-meta.js +9 -1
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/find-mat/get-sharp-corners.js +4 -2
- package/node/find-mat/get-sharp-corners.js.map +1 -1
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.d.ts +21 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js +46 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js +97 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js +109 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.d.ts +29 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js +123 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.d.ts +30 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js +177 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.d.ts +29 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +156 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js +40 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js.map +1 -0
- package/node/index.d.ts +4 -10
- package/node/index.js +3 -6
- package/node/index.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +2 -0
- package/node/point-on-shape/to-p.d.ts +1 -1
- package/node/point-on-shape/to-p.js +1 -1
- package/node/point-on-shape/to-p.js.map +1 -1
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +2 -2
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -1
- package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +8 -2
- package/node/reconstruct-from-mat/reconstruct-from-mat.js +154 -22
- package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -1
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +1 -1
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -1
- package/node/svg/get-loop-bounds.js +6 -2
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/utils/map-deep.d.ts +15 -0
- package/node/utils/map-deep.js +34 -0
- package/node/utils/map-deep.js.map +1 -0
- package/package.json +18 -12
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +3 -2
- package/src/corner/get-corner.ts +1 -1
- package/src/{reconstruct-from-mat → cp-node/fs}/get-all-on-loop-by-loop.ts +7 -3
- package/src/cp-node/fs/get-all-on-loop.ts +1 -1
- package/src/cp-node/fs/get-boundary-beziers-to-next.ts +1 -72
- package/src/cp-node/fs/get-edge-direction.ts +8 -4
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +0 -1
- package/src/cp-node/fs/get-mat-curve-between.ts +6 -6
- package/src/cp-node/fs/is-fully-terminating.ts +16 -0
- package/src/debug/debug.ts +8 -50
- package/src/find-2-prong/find-2-prong.ts +37 -14
- package/src/find-2-prong/get-medial/get-antipodal-points.ts +3 -2
- package/src/find-2-prong/get-medial/get-closest-points-d.ts +213 -0
- package/src/find-2-prong/get-medial/get-closest-points.ts +74 -13
- package/src/find-2-prong/reduce-radius.ts +8 -5
- package/src/find-3-prong/calc-better-x.ts +1 -3
- package/src/find-3-prong/calc-initial-3-prong-center.ts +1 -2
- package/src/find-3-prong/find-3-prong-for-delta3s.ts +1 -4
- package/src/find-3-prong/find-3-prong.ts +0 -1
- package/src/find-3-prong/find-and-add-3-prong.ts +1 -15
- package/src/find-mat/find-mat.ts +3 -1
- package/src/find-mat/find-mats.ts +3 -2
- package/src/find-mat/get-dull-corners-on-loop.ts +4 -3
- package/src/find-mat/get-for-1-prongs-on-loop.ts +8 -3
- package/src/find-mat/get-for-2-prongs-on-loop.ts +6 -1
- package/src/find-mat/get-meta.ts +11 -0
- package/src/find-mat/get-sharp-corners.ts +5 -1
- package/src/get-medial-curve/__pycache__/get-cubic-self-medial-curve.cpython-313.pyc +0 -0
- package/src/get-medial-curve/get-cubic-self-medial-curve.py +419 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0-with-running-err.ts +76 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.ts +61 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.ts +116 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.ts +129 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.ts +142 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.ts +199 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +177 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs.ts +48 -0
- package/src/get-medial-points/double-double/error-bound-calc.txt +72 -0
- package/src/index.ts +4 -10
- package/src/point-on-shape/point-on-shape.ts +3 -0
- package/src/point-on-shape/to-p.ts +2 -2
- package/src/reconstruct-from-mat/get-cp-nodess-for-sat.ts +2 -2
- package/src/reconstruct-from-mat/reconstruct-from-mat.ts +202 -21
- package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +1 -1
- package/src/svg/get-loop-bounds.ts +11 -3
- package/src/utils/map-deep.ts +75 -0
- package/src/utils/map-map.ts +33 -0
- package/wallaby.mjs +4 -4
- package/node/debug/debug-elem-types.d.ts +0 -26
- package/node/debug/debug-elem-types.js +0 -22
- package/node/debug/debug-elem-types.js.map +0 -1
- package/node/debug/functions/draw/draw-beziers-as-single-path.d.ts +0 -2
- package/node/debug/functions/draw/draw-beziers-as-single-path.js +0 -30
- package/node/debug/functions/draw/draw-beziers-as-single-path.js.map +0 -1
- package/node/debug/functions/draw/xmlns.d.ts +0 -2
- package/node/debug/functions/draw/xmlns.js +0 -3
- package/node/debug/functions/draw/xmlns.js.map +0 -1
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +0 -3
- package/node/debug/functions/draw-elem/bounding-hull.js +0 -8
- package/node/debug/functions/draw-elem/bounding-hull.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-branch.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-branch.js +0 -26
- package/node/debug/functions/draw-elem/draw-branch.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-circle-percent.js +0 -13
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-cp-node.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-cp-node.js +0 -26
- package/node/debug/functions/draw-elem/draw-cp-node.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-cull.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-cull.js +0 -9
- package/node/debug/functions/draw-elem/draw-cull.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-dull-corner.js +0 -10
- package/node/debug/functions/draw-elem/draw-dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +0 -10
- package/node/debug/functions/draw-elem/draw-elem.js +0 -39
- package/node/debug/functions/draw-elem/draw-elem.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-leaves.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-leaves.js +0 -34
- package/node/debug/functions/draw-elem/draw-leaves.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loop.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-loop.js +0 -11
- package/node/debug/functions/draw-elem/draw-loop.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loops.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-loops.js +0 -6
- package/node/debug/functions/draw-elem/draw-loops.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js +0 -10
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-mat.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-mat.js +0 -34
- package/node/debug/functions/draw-elem/draw-mat.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-max-vertex.js +0 -9
- package/node/debug/functions/draw-elem/draw-max-vertex.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-min-y.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-min-y.js +0 -10
- package/node/debug/functions/draw-elem/draw-min-y.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js +0 -22
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-one-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-one-prong.js +0 -13
- package/node/debug/functions/draw-elem/draw-one-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-sharp-corner.js +0 -10
- package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-three-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-three-prong.js +0 -26
- package/node/debug/functions/draw-elem/draw-three-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js +0 -8
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-two-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-two-prong.js +0 -49
- package/node/debug/functions/draw-elem/draw-two-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-vertex.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-vertex.js +0 -13
- package/node/debug/functions/draw-elem/draw-vertex.js.map +0 -1
- package/node/find-3-prong/timed-cc.d.ts +0 -3
- package/node/find-3-prong/timed-cc.js +0 -5
- package/node/find-3-prong/timed-cc.js.map +0 -1
- package/node/reconstruct-from-mat/filter-zero-length.d.ts +0 -10
- package/node/reconstruct-from-mat/filter-zero-length.js +0 -14
- package/node/reconstruct-from-mat/filter-zero-length.js.map +0 -1
- package/node/reconstruct-from-mat/get-all-on-loop-by-loop.js.map +0 -1
- package/node/reconstruct-from-mat/get-bezier-piece-length.d.ts +0 -3
- package/node/reconstruct-from-mat/get-bezier-piece-length.js +0 -6
- package/node/reconstruct-from-mat/get-bezier-piece-length.js.map +0 -1
- package/node/reconstruct-from-mat/get-boundary.d.ts +0 -7
- package/node/reconstruct-from-mat/get-boundary.js +0 -18
- package/node/reconstruct-from-mat/get-boundary.js.map +0 -1
- package/node/reconstruct-from-mat/get-matching-beziers.d.ts +0 -10
- package/node/reconstruct-from-mat/get-matching-beziers.js +0 -29
- package/node/reconstruct-from-mat/get-matching-beziers.js.map +0 -1
- package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.d.ts +0 -6
- package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js +0 -10
- package/node/reconstruct-from-mat/get-mbss-by-loop-per-sat.js.map +0 -1
- package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.d.ts +0 -7
- package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js +0 -47
- package/node/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.js.map +0 -1
- package/node/reconstruct-from-mat/get-sats2.d.ts +0 -10
- package/node/reconstruct-from-mat/get-sats2.js +0 -16
- package/node/reconstruct-from-mat/get-sats2.js.map +0 -1
- package/node/reconstruct-from-mat/is-fully-terminating.d.ts +0 -3
- package/node/reconstruct-from-mat/is-fully-terminating.js +0 -19
- package/node/reconstruct-from-mat/is-fully-terminating.js.map +0 -1
- package/node/reconstruct-from-mat/matched-beziers.d.ts +0 -10
- package/node/reconstruct-from-mat/matched-beziers.js +0 -2
- package/node/reconstruct-from-mat/matched-beziers.js.map +0 -1
- package/node/reconstruct-from-mat/split-tri-path.d.ts +0 -5
- package/node/reconstruct-from-mat/split-tri-path.js +0 -209
- package/node/reconstruct-from-mat/split-tri-path.js.map +0 -1
- package/node/utils/clip.d.ts +0 -2
- package/node/utils/clip.js +0 -6
- package/node/utils/clip.js.map +0 -1
- package/node/utils/time-function-call.d.ts +0 -14
- package/node/utils/time-function-call.js +0 -32
- package/node/utils/time-function-call.js.map +0 -1
- package/src/debug/debug-elem-types.ts +0 -43
- package/src/debug/functions/draw/draw-bezier-pieces.ts +0 -35
- package/src/debug/functions/draw-elem/bounding-hull.ts +0 -18
- package/src/debug/functions/draw-elem/culls.ts +0 -39
- package/src/debug/functions/draw-elem/draw-branch.ts +0 -37
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +0 -23
- package/src/debug/functions/draw-elem/draw-cp-node.ts +0 -46
- package/src/debug/functions/draw-elem/draw-cull.ts +0 -21
- package/src/debug/functions/draw-elem/draw-dull-corner.ts +0 -21
- package/src/debug/functions/draw-elem/draw-elem.ts +0 -64
- package/src/debug/functions/draw-elem/draw-leaves.ts +0 -51
- package/src/debug/functions/draw-elem/draw-loop.ts +0 -16
- package/src/debug/functions/draw-elem/draw-loops.ts +0 -10
- package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +0 -21
- package/src/debug/functions/draw-elem/draw-mat.ts +0 -43
- package/src/debug/functions/draw-elem/draw-max-vertex.ts +0 -15
- package/src/debug/functions/draw-elem/draw-min-y.ts +0 -18
- package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +0 -40
- package/src/debug/functions/draw-elem/draw-one-prong.ts +0 -25
- package/src/debug/functions/draw-elem/draw-sharp-corner.ts +0 -21
- package/src/debug/functions/draw-elem/draw-three-prong.ts +0 -44
- package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +0 -18
- package/src/debug/functions/draw-elem/draw-two-prong.ts +0 -68
- package/src/debug/functions/draw-elem/draw-vertex.ts +0 -27
- package/src/debug/functions/draw-elem/dull-corner.ts +0 -21
- package/src/debug/functions/draw-elem/leaves.ts +0 -20
- package/src/debug/functions/draw-elem/loop.ts +0 -16
- package/src/debug/functions/draw-elem/loops.ts +0 -10
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -21
- package/src/debug/functions/draw-elem/mat.ts +0 -47
- package/src/debug/functions/draw-elem/max-vertex.ts +0 -15
- package/src/debug/functions/draw-elem/min-y.ts +0 -18
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +0 -26
- package/src/debug/functions/draw-elem/one-prong.ts +0 -23
- package/src/debug/functions/draw-elem/sharp-corner.ts +0 -20
- package/src/debug/functions/draw-elem/three-prong.ts +0 -30
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -18
- package/src/debug/functions/draw-elem/two-prong.ts +0 -50
- package/src/debug/functions/draw-elem/vertex.ts +0 -51
- package/src/find-3-prong/timed-cc.ts +0 -9
- package/src/reconstruct-from-mat/filter-zero-length.ts +0 -23
- package/src/reconstruct-from-mat/get-bezier-piece-length.ts +0 -12
- package/src/reconstruct-from-mat/get-boundary.ts +0 -32
- package/src/reconstruct-from-mat/get-matching-beziers.ts +0 -46
- package/src/reconstruct-from-mat/get-mbss-by-loop-per-sat.ts +0 -19
- package/src/reconstruct-from-mat/get-mbss-by-loop-with-opp-arr.ts +0 -69
- package/src/reconstruct-from-mat/get-sats2.ts +0 -25
- package/src/reconstruct-from-mat/is-fully-terminating.ts +0 -27
- package/src/reconstruct-from-mat/matched-beziers.ts +0 -14
- package/src/reconstruct-from-mat/split-tri-path.ts +0 -280
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { drawFs } from 'flo-draw';
|
|
2
|
-
import { ThreeProngForDebugging } from '../../three-prong-for-debugging.js';
|
|
3
|
-
import { Circle, scaleCircle } from '../../../geometry/circle.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** @internal */
|
|
7
|
-
function threeProng(
|
|
8
|
-
g: SVGGElement,
|
|
9
|
-
threeProng: ThreeProngForDebugging,
|
|
10
|
-
classes?: string,
|
|
11
|
-
delay = 0,
|
|
12
|
-
scaleFactor = 1) {
|
|
13
|
-
|
|
14
|
-
const circle = scaleCircle(
|
|
15
|
-
threeProng.circle,
|
|
16
|
-
1
|
|
17
|
-
);
|
|
18
|
-
const poss = threeProng.poss;
|
|
19
|
-
|
|
20
|
-
const $cp1 = drawFs.dot(g, poss[0].p, 0.01*1*scaleFactor, 'blue', delay);
|
|
21
|
-
const $cp2 = drawFs.dot(g, poss[1].p, 0.01*2*scaleFactor, 'blue', delay);
|
|
22
|
-
const $cp3 = drawFs.dot(g, poss[2].p, 0.01*3*scaleFactor, 'blue', delay);
|
|
23
|
-
const $center = drawFs.dot(g, circle.center, 0.03*scaleFactor, 'blue', delay);
|
|
24
|
-
const $circle = drawFs.circle(g, circle, 'blue thin2 nofill', delay);
|
|
25
|
-
|
|
26
|
-
return [...$center, ...$cp1, ...$cp2, ...$cp3, ...$circle];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export { threeProng }
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { drawFs } from 'flo-draw';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** @internal */
|
|
5
|
-
function tightBoundingBox(
|
|
6
|
-
g: SVGGElement,
|
|
7
|
-
box: number[][],
|
|
8
|
-
classes = 'thin5 pinker nofill',
|
|
9
|
-
delay = 0,
|
|
10
|
-
scaleFactor = 1) {
|
|
11
|
-
|
|
12
|
-
const $box = drawFs.polygon(g, box, 'thin5 pinker nofill', delay);
|
|
13
|
-
|
|
14
|
-
return $box;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export { tightBoundingBox }
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { drawFs } from 'flo-draw';
|
|
2
|
-
// import { TwoProngForDebugging } from '../../two-prong-for-debugging.js';
|
|
3
|
-
// import { getTwoProngType } from '../../../mat/get-two-prong-type.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// /** @internal */
|
|
7
|
-
// function twoProng(
|
|
8
|
-
// g: SVGGElement,
|
|
9
|
-
// twoProng: TwoProngForDebugging,
|
|
10
|
-
// classes?: string,
|
|
11
|
-
// delay = 0,
|
|
12
|
-
// scaleFactor = 1) {
|
|
13
|
-
|
|
14
|
-
// let $failedDot : SVGElement[] = [];
|
|
15
|
-
// let $center : SVGElement[] = [];
|
|
16
|
-
// let $circle : SVGElement[] = [];
|
|
17
|
-
// let $cp1 : SVGElement[] = [];
|
|
18
|
-
// let $cp2 : SVGElement[] = [];
|
|
19
|
-
|
|
20
|
-
// let color;
|
|
21
|
-
// let thin;
|
|
22
|
-
|
|
23
|
-
// switch (getTwoProngType(twoProng)) {
|
|
24
|
-
// case 'twoProng_regular': {
|
|
25
|
-
// color = 'red ';
|
|
26
|
-
// thin = '2';
|
|
27
|
-
// break;
|
|
28
|
-
// }
|
|
29
|
-
// case 'twoProng_holeClosing': {
|
|
30
|
-
// color = 'cyan ';
|
|
31
|
-
// thin = '10';
|
|
32
|
-
// break;
|
|
33
|
-
// }
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// if (twoProng.failed) {
|
|
38
|
-
// $failedDot = drawFs.dot(g, twoProng.pos.p, 1*scaleFactor, 'black', delay);
|
|
39
|
-
// } else if (!twoProng.failed) {
|
|
40
|
-
// $center = drawFs.dot (g, twoProng.circle.center, 0.01*scaleFactor, 'yellow', delay);
|
|
41
|
-
// $circle = drawFs.circle(g, twoProng.circle, color + 'thin' + thin + ' nofill', delay);
|
|
42
|
-
// $cp1 = drawFs.dot (g, twoProng.pos.p, 0.0175*scaleFactor, color, delay);
|
|
43
|
-
// $cp2 = drawFs.dot (g, twoProng.z, 0.035*scaleFactor, color, delay);
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// return [...$failedDot, ...$center, ...$circle, ...$cp1, ...$cp2];
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// export { twoProng }
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { drawFs } from 'flo-draw';
|
|
2
|
-
import { CpNode, getCpNodesOnCircle } from '../../../cp-node/cp-node.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** @internal */
|
|
6
|
-
function vertex(
|
|
7
|
-
g: SVGGElement,
|
|
8
|
-
cpNode: CpNode,
|
|
9
|
-
classes?: string,
|
|
10
|
-
delay?: number,/*
|
|
11
|
-
visible = true*/
|
|
12
|
-
scaleFactor = 1) {
|
|
13
|
-
|
|
14
|
-
// const visibleClass = visible ? '' : ' invisible';
|
|
15
|
-
|
|
16
|
-
const circle = cpNode.cp.circle;
|
|
17
|
-
|
|
18
|
-
const THIN = 'thin20';
|
|
19
|
-
|
|
20
|
-
const cps = getCpNodesOnCircle(cpNode);
|
|
21
|
-
console.log(cps)
|
|
22
|
-
|
|
23
|
-
let $svgs: SVGElement[] = [];
|
|
24
|
-
|
|
25
|
-
const $circle = drawFs.circle(g, circle, 'red ' + THIN + ' nofill '/* + visibleClass*/, delay);
|
|
26
|
-
const $crossHair = drawFs.crossHair(g, circle.center, 'red ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
|
|
27
|
-
|
|
28
|
-
$svgs = [...$circle, ...$crossHair];
|
|
29
|
-
|
|
30
|
-
for (let i=0; i<cps.length; i++) {
|
|
31
|
-
const cp = cps[i];
|
|
32
|
-
const edgeCircle = cp.next.cp.circle;
|
|
33
|
-
|
|
34
|
-
const $circle = drawFs.circle(g, edgeCircle, 'pink ' + THIN + ' nofill '/* + visibleClass*/, delay);
|
|
35
|
-
const $crossHair = drawFs.crossHair(g, edgeCircle.center, 'pink ' + THIN + ' nofill '/* + visibleClass*/, 3, delay);
|
|
36
|
-
|
|
37
|
-
$svgs.push(...$circle, ...$crossHair)
|
|
38
|
-
|
|
39
|
-
const p1 = circle.center;
|
|
40
|
-
const p2 = edgeCircle.center;
|
|
41
|
-
const thin = i === 0 ? 'thin10' : (i === 1 ? 'thin20' : 'thin35');
|
|
42
|
-
const $line = drawFs.line(g, [p1, p2], 'yellow ' + thin + ' nofill '/* + visibleClass*/, delay);
|
|
43
|
-
|
|
44
|
-
$svgs.push(...$line);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return $svgs;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export { vertex }
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { circumCenter } from 'flo-vector2d';
|
|
2
|
-
import { timeFunctionCalls } from '../utils/time-function-call.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// const timeCircumCenter = timeFunctionCalls(circumCenter);
|
|
6
|
-
const timeCircumCenter = circumCenter;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export { timeCircumCenter as circumCenter }
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { BezierPiece } from "flo-bezier3";
|
|
2
|
-
import { isBezierPieceZeroLength } from "flo-bezier3";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Filters out zero-length bezier pieces.
|
|
7
|
-
*
|
|
8
|
-
* * **note** will return at least one bezier piece, even if all pieces are zero-length.
|
|
9
|
-
*
|
|
10
|
-
* @param bezierPieces
|
|
11
|
-
*/
|
|
12
|
-
function filterZeroLength(
|
|
13
|
-
bezierPieces: BezierPiece[]): BezierPiece[] {
|
|
14
|
-
|
|
15
|
-
const bezierPieces_ = bezierPieces.filter(
|
|
16
|
-
bezierPiece => !isBezierPieceZeroLength(bezierPiece)
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
return bezierPieces_.length > 0 ? bezierPieces_ : [bezierPieces[0]];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export { filterZeroLength }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { BezierPiece } from "flo-bezier3";
|
|
2
|
-
import { length } from 'flo-bezier3';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function getBezierPieceLength(
|
|
6
|
-
bezierPiece: BezierPiece): number {
|
|
7
|
-
|
|
8
|
-
return length(bezierPiece.ts, bezierPiece.ps);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export { getBezierPieceLength }
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { BezierPiece } from 'flo-bezier3';
|
|
2
|
-
import type { CpNode } from '../cp-node/cp-node.js';
|
|
3
|
-
import { getBoundaryBezierPartsToNext } from '../cp-node/fs/get-boundary-bezier-parts-to-next.js';
|
|
4
|
-
import { filterZeroLength } from "./filter-zero-length.js";
|
|
5
|
-
import { isFullyTerminating } from './is-fully-terminating.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function getBoundary(
|
|
9
|
-
cpNode: CpNode): {
|
|
10
|
-
boundaryBeziers: BezierPiece[];
|
|
11
|
-
boundaryBeziersOpp: BezierPiece[] | undefined;
|
|
12
|
-
} {
|
|
13
|
-
|
|
14
|
-
const cpNodeOpp = isFullyTerminating(cpNode)
|
|
15
|
-
? undefined // no opposite boundary
|
|
16
|
-
: cpNode.next.prevOnCircle;
|
|
17
|
-
|
|
18
|
-
const boundaryBeziers =
|
|
19
|
-
filterZeroLength(getBoundaryBezierPartsToNext(cpNode));
|
|
20
|
-
|
|
21
|
-
const boundaryBeziersOpp = cpNodeOpp === undefined
|
|
22
|
-
? undefined
|
|
23
|
-
: filterZeroLength(getBoundaryBezierPartsToNext(cpNodeOpp));
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
boundaryBeziers,
|
|
27
|
-
boundaryBeziersOpp
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export { getBoundary }
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { BezierPiece } from 'flo-bezier3';
|
|
2
|
-
import type { CpNode } from '../cp-node/cp-node.js';
|
|
3
|
-
import type { MatchedBeziers } from './matched-beziers.js';
|
|
4
|
-
import { getMatCurveToNext } from '../cp-node/fs/get-mat-curve-to-next.js'
|
|
5
|
-
import { splitTriPath } from './split-tri-path.js';
|
|
6
|
-
import { getBoundary } from './get-boundary.js';
|
|
7
|
-
import { isOnSameLoop } from '../cp-node/fs/is-on-same-loop.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns a correspondence between boundary bezier curves and a medial axis
|
|
12
|
-
* bezier curve. They will later be interpolated.
|
|
13
|
-
*
|
|
14
|
-
* @param cpNode the start `CpNode`
|
|
15
|
-
*/
|
|
16
|
-
function getMatchingBeziers(
|
|
17
|
-
cpNode: CpNode): MatchedBeziers[] | undefined {
|
|
18
|
-
|
|
19
|
-
const medialBezier: BezierPiece = {
|
|
20
|
-
ps: getMatCurveToNext(cpNode),
|
|
21
|
-
ts: [0,1]
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (cpNode.isHoleClosing && // short-circuit
|
|
25
|
-
!isOnSameLoop(cpNode, cpNode.next)) {
|
|
26
|
-
|
|
27
|
-
// We get here for half of hole-closers, as only half of hole-closers are on a different loop.
|
|
28
|
-
// This cpNode indicates we should connect the hole
|
|
29
|
-
// console.log('hole-closing dummy case');
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const r = getBoundary(cpNode);
|
|
34
|
-
const { boundaryBeziers, boundaryBeziersOpp } = r;
|
|
35
|
-
|
|
36
|
-
const matchedBezierss: MatchedBeziers[] = splitTriPath(
|
|
37
|
-
boundaryBeziers,
|
|
38
|
-
medialBezier,
|
|
39
|
-
boundaryBeziersOpp ?? []
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return matchedBezierss;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
export { getMatchingBeziers }
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Mat } from "../mat/mat.js";
|
|
2
|
-
import { getSats2 } from "./get-sats2.js";
|
|
3
|
-
import { getMbssByLoopWithOppArr } from "./get-mbss-by-loop-with-opp-arr.js";
|
|
4
|
-
import { getCpNodessForSat } from "./get-cp-nodess-for-sat.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function getMbssByLoopPerSat(
|
|
8
|
-
mats: Mat[],
|
|
9
|
-
satScale: number) {
|
|
10
|
-
|
|
11
|
-
const sats = getSats2(mats, satScale);
|
|
12
|
-
|
|
13
|
-
const cpNodessPerSat = sats.map(getCpNodessForSat);
|
|
14
|
-
|
|
15
|
-
return cpNodessPerSat.map(getMbssByLoopWithOppArr);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export { getMbssByLoopPerSat }
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { CpNode } from "../cp-node/cp-node.js";
|
|
2
|
-
import type { MatchedBeziers } from "./matched-beziers.js";
|
|
3
|
-
import { getMatchingBeziers } from "./get-matching-beziers.js";
|
|
4
|
-
import { isFullyTerminating } from "./is-fully-terminating.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function getMbssByLoopWithOppArr(
|
|
8
|
-
cpNodess: CpNode[][]) {
|
|
9
|
-
|
|
10
|
-
const mbssByLoop: (MatchedBeziers[] | undefined)[][] = [];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* An array with each entry being a pair of indices mapping from
|
|
14
|
-
* `MatchedBeziers[]` on one side to `MatchedBeziers[]` on the other side
|
|
15
|
-
*/
|
|
16
|
-
const mbMap: Map<CpNode, [number,number]> = new Map();
|
|
17
|
-
|
|
18
|
-
for (let l=0; l<cpNodess.length; l++) {
|
|
19
|
-
const cpNodes = cpNodess[l];
|
|
20
|
-
|
|
21
|
-
const mbss: (MatchedBeziers[] | undefined)[] = [];
|
|
22
|
-
for (let i=0; i<cpNodes.length; i++) {
|
|
23
|
-
const cpNode = cpNodes[i];
|
|
24
|
-
|
|
25
|
-
mbMap.set(cpNode, [l,i]);
|
|
26
|
-
|
|
27
|
-
const mbs = getMatchingBeziers(cpNode);
|
|
28
|
-
|
|
29
|
-
mbss.push(mbs);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
mbssByLoop.push(mbss);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const oppArr: [[number,number],[number,number]][] = [];
|
|
37
|
-
|
|
38
|
-
for (let l=0; l<cpNodess.length; l++) {
|
|
39
|
-
const cpNodes = cpNodess[l];
|
|
40
|
-
|
|
41
|
-
for (let i=0; i<cpNodes.length; i++) {
|
|
42
|
-
const cpNode = cpNodes[i];
|
|
43
|
-
|
|
44
|
-
const cpNodeOpp = isFullyTerminating(cpNode)
|
|
45
|
-
? undefined // no opposite boundary
|
|
46
|
-
: cpNode.next.prevOnCircle;
|
|
47
|
-
|
|
48
|
-
// if (cpNodeOpp === undefined) {
|
|
49
|
-
// continue;
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
const oppIdxs = cpNodeOpp === undefined
|
|
53
|
-
? [255,65535] as [number,number]
|
|
54
|
-
: mbMap.get(cpNodeOpp);
|
|
55
|
-
|
|
56
|
-
const mbs = mbssByLoop[l][i];
|
|
57
|
-
if (oppIdxs !== undefined && mbs !== undefined) {
|
|
58
|
-
oppArr.push([[l,i], oppIdxs]);
|
|
59
|
-
} else {
|
|
60
|
-
oppArr.push([[l,i], [255,65535]]);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return { mbssByLoop, oppArr };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export { getMbssByLoopWithOppArr }
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Mat } from '../mat/mat.js';
|
|
2
|
-
import { findMats } from '../find-mat/find-mats.js';
|
|
3
|
-
import { removeSatInducedTrivial3Prongs } from "./remove-sat-induced-trivial-3prongs.js";
|
|
4
|
-
import { toScaleAxis } from '../sat/to-scale-axis.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns the shape information.
|
|
9
|
-
*
|
|
10
|
-
* @param font$$ the font from which the glyph outlines will be retrieved
|
|
11
|
-
* @param glyphId the glyph id for which the shape is to be retrieved
|
|
12
|
-
* @param options the options for SAT computation
|
|
13
|
-
*/
|
|
14
|
-
// TODO
|
|
15
|
-
function getSats2(
|
|
16
|
-
mats: Mat[],
|
|
17
|
-
satScale: number): Mat[] {
|
|
18
|
-
|
|
19
|
-
const sats = mats.map(mat => toScaleAxis(mat, satScale));
|
|
20
|
-
|
|
21
|
-
return sats.map(removeSatInducedTrivial3Prongs);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export { getSats2 }
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { CpNode } from '../cp-node/cp-node.js';
|
|
2
|
-
import { getAllOnCircle } from '../cp-node/fs/get-all-on-circle.js';
|
|
3
|
-
import { isTerminating } from '../cp-node/fs/is-terminating.js';
|
|
4
|
-
import { isTrivial } from '../cp-node/fs/is-trivial.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// TODO - DUPLICATE! -> likely other version needs fixing
|
|
8
|
-
function isFullyTerminating(cpNode: CpNode) {
|
|
9
|
-
if (!isTerminating(cpNode)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (isTrivial(cpNode)) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
while (cpNode.prev === cpNode.prevOnCircle) {
|
|
18
|
-
cpNode = cpNode.prev;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const otherOnCircle = getAllOnCircle(cpNode.prevOnCircle, true);
|
|
22
|
-
|
|
23
|
-
return otherOnCircle.every(isTerminating);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export { isFullyTerminating }
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BezierPiece } from 'flo-bezier3';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A type representing a correspondence between 3 bezier curves (one on the
|
|
6
|
-
* boundary, one on the medial axis and one on the opposite boundary)
|
|
7
|
-
*/
|
|
8
|
-
interface MatchedBeziers {
|
|
9
|
-
readonly medialBezier: BezierPiece;
|
|
10
|
-
readonly boundaryBezier: BezierPiece;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type { MatchedBeziers }
|