flo-mat 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__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__/specific-cases/load-svg/load-svg.ts +30 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +170 -0
- package/__tests__/specific-cases/test-svgs/achispado.svg +5052 -0
- package/browser/index.js +5129 -8785
- 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/cp-node/fs/get-all-on-loop-by-loop.d.ts +11 -0
- package/node/cp-node/fs/get-all-on-loop-by-loop.js +42 -0
- 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-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/cp-node/fs/is-on-same-loop.d.ts +3 -0
- package/node/cp-node/fs/is-on-same-loop.js +6 -0
- package/node/cp-node/fs/is-on-same-loop.js.map +1 -0
- package/node/debug/debug.d.ts +8 -22
- package/node/debug/debug.js +12 -50
- package/node/debug/debug.js.map +1 -1
- package/node/find-2-prong/add-1-prong.js +1 -4
- package/node/find-2-prong/add-1-prong.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 -2
- package/node/find-mat/find-mat.js.map +1 -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 -6
- package/node/find-mat/get-meta.js +12 -26
- 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 +6 -10
- package/node/index.js +5 -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.d.ts +4 -0
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +15 -0
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +10 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.js +160 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +12 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +46 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -0
- package/node/sat/add-debug-info.js +1 -2
- package/node/sat/add-debug-info.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 +14 -8
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +3 -2
- package/src/corner/get-corner.ts +1 -1
- package/src/cp-node/fs/get-all-on-loop-by-loop.ts +56 -0
- 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-mat-curve-between.ts +6 -6
- package/src/cp-node/fs/is-fully-terminating.ts +16 -0
- package/src/cp-node/fs/is-on-same-loop.ts +15 -0
- package/src/debug/debug.ts +27 -87
- package/src/find-2-prong/add-1-prong.ts +1 -5
- 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 -2
- package/src/find-mat/find-mats.ts +0 -1
- 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 +14 -38
- 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 +7 -11
- 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 +24 -0
- package/src/reconstruct-from-mat/reconstruct-from-mat.ts +226 -0
- package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +62 -0
- package/src/sat/add-debug-info.ts +1 -2
- package/src/svg/get-loop-bounds.ts +11 -3
- package/src/utils/clip.ts +13 -0
- 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/debug/functions/general.d.ts +0 -48
- package/node/debug/functions/general.js +0 -53
- package/node/debug/functions/general.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/point-on-shape/pos-to-human-string.d.ts +0 -8
- package/node/point-on-shape/pos-to-human-string.js +0 -12
- package/node/point-on-shape/pos-to-human-string.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/elem-type-two-prong.ts +0 -8
- package/src/debug/functions/cmp-cp-on-delta.ts +0 -54
- 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/debug/functions/general.ts +0 -79
- package/src/debug/functions/three-prong.ts +0 -249
- package/src/debug/functions/two-prong.ts +0 -203
- package/src/find-2-prong/add-debug-info.ts +0 -45
- package/src/find-3-prong/timed-cc.ts +0 -9
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
|
|
1
3
|
|
|
2
4
|
const esModules = [
|
|
3
5
|
'flo-bezier3',
|
|
@@ -15,8 +17,8 @@ const esModules = [
|
|
|
15
17
|
'squares-rng'
|
|
16
18
|
].join('|');
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
const config: Config = {
|
|
20
22
|
testEnvironment: 'node',
|
|
21
23
|
resolver: "jest-ts-webcompat-resolver",
|
|
22
24
|
setupFilesAfterEnv: ['<rootDir>/__tests__/helpers/jest.setup.ts'],
|
|
@@ -31,4 +33,7 @@ module.exports = {
|
|
|
31
33
|
transformIgnorePatterns: [
|
|
32
34
|
`/node_modules/(?!${esModules})`
|
|
33
35
|
]
|
|
34
|
-
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export default config;
|
|
@@ -37,9 +37,10 @@ function getCloseBoundaryPointsCertified(curvePieces, x) {
|
|
|
37
37
|
return closestPointInfos.map(info => {
|
|
38
38
|
const { curve, t } = info;
|
|
39
39
|
const { ps } = curve;
|
|
40
|
-
const
|
|
40
|
+
const pDd = toP(ps, t);
|
|
41
|
+
const p = pDd.map(c => c[0] + c[1]);
|
|
41
42
|
return {
|
|
42
|
-
|
|
43
|
+
curve, t, isSource: false, p, pDd
|
|
43
44
|
};
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-close-boundary-points-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-close-boundary-points-certified.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yCAAyC,EAAE,MAAM,sDAAsD,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;;;;;;;;GASG;AACH,SAAS,+BAA+B,CAChC,WAAyB,EACzB,CAAW;IAEf,WAAW,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE/C,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,OAAO,GAAG,yCAAyC,CACrD,UAAU,CAAC,KAAK,EAChB,CAAC,EACD,UAAU,CAAC,EAAqB,CACnC,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,qCAAqC;IACrC,IAAI,MAAM,GAAG,QAAQ,CAAC;IACtB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC;YACjB,MAAM,GAAG,KAAK,CAAC;QACnB,CAAC;IACL,CAAC;IAED,MAAM,iBAAiB,GAA0B,EAAE,CAAC;IAEpD,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;YAC9B,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACL,CAAC;IAED,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAChC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QAC1B,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;QACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"get-close-boundary-points-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-close-boundary-points-certified.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yCAAyC,EAAE,MAAM,sDAAsD,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;;;;;;;;GASG;AACH,SAAS,+BAA+B,CAChC,WAAyB,EACzB,CAAW;IAEf,WAAW,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE/C,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,OAAO,GAAG,yCAAyC,CACrD,UAAU,CAAC,KAAK,EAChB,CAAC,EACD,UAAU,CAAC,EAAqB,CACnC,CAAC;QAEF,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,qCAAqC;IACrC,IAAI,MAAM,GAAG,QAAQ,CAAC;IACtB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,MAAM,CAAC,MAAM,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AC,CAAC,CAAC;KACxC,CAAC;IAEF,wEAAwE;IACxE,cAAc;IACd,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,IAAI,YAAqB,CAAC;IAC1B,IAAI,WAAoB,CAAC;IACzB,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QAClB,8BAA8B;QAC9B,YAAY,GAAG,aAAa,GAAG,CAAC,YAAY,CAAC;QAC7C,WAAW,GAAG,aAAa,GAAG,CAAC,YAAY,CAAC;IAChD,CAAC;SAAM,CAAC;QACJ,YAAY,GAAG,OAAO,CAAC;QACvB,WAAW,GAAI,MAAM,CAAC;IAC1B,CAAC;IAED,OAAO;QACH,QAAQ,EAAE,YAAY;QACtB,OAAO;QACP,MAAM;QACN,YAAY;QACZ,WAAW;KACd,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CpNode } from '../cp-node.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns all `CpNode`s on the MAT that this `CpNode` is part of
|
|
4
|
+
* starting from the current one and going anti-clockwise around the shape
|
|
5
|
+
* going loop by loop.
|
|
6
|
+
*
|
|
7
|
+
* * sometimes more useful than `getAllOnLoop` since this function returns an
|
|
8
|
+
* array of `CpNode`s for each loop seperately.
|
|
9
|
+
*/
|
|
10
|
+
declare function getAllOnLoop_ByLoop(cpNode: CpNode): CpNode[][];
|
|
11
|
+
export { getAllOnLoop_ByLoop };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns all `CpNode`s on the MAT that this `CpNode` is part of
|
|
3
|
+
* starting from the current one and going anti-clockwise around the shape
|
|
4
|
+
* going loop by loop.
|
|
5
|
+
*
|
|
6
|
+
* * sometimes more useful than `getAllOnLoop` since this function returns an
|
|
7
|
+
* array of `CpNode`s for each loop seperately.
|
|
8
|
+
*/
|
|
9
|
+
function getAllOnLoop_ByLoop(cpNode) {
|
|
10
|
+
const cpNodess = [];
|
|
11
|
+
const cpStarts = [cpNode];
|
|
12
|
+
const cpStartSet = new Set(cpStarts);
|
|
13
|
+
if (cpNode.isHoleClosing) {
|
|
14
|
+
cpStartSet.add(cpNode.prevOnCircle.holeCloserTwin);
|
|
15
|
+
}
|
|
16
|
+
cpStartSet.add(cpNode);
|
|
17
|
+
while (cpStarts.length > 0) {
|
|
18
|
+
const cpNodes = [];
|
|
19
|
+
const cpStart = cpStarts.pop();
|
|
20
|
+
const _loop = cpStart.pointOnShape.curve.loop;
|
|
21
|
+
let cpNode = cpStart;
|
|
22
|
+
do {
|
|
23
|
+
const loop = cpNode.pointOnShape.curve.loop;
|
|
24
|
+
if (_loop === loop) {
|
|
25
|
+
cpNodes.push(cpNode);
|
|
26
|
+
cpNode = cpNode.next;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const twin = cpNode.holeCloserTwin;
|
|
30
|
+
if (!cpStartSet.has(twin)) {
|
|
31
|
+
cpStartSet.add(twin);
|
|
32
|
+
cpStartSet.add(twin.prevOnCircle.holeCloserTwin);
|
|
33
|
+
cpStarts.push(twin);
|
|
34
|
+
}
|
|
35
|
+
cpNode = cpNode.prev.holeCloserTwin;
|
|
36
|
+
} while (cpNode !== cpStart);
|
|
37
|
+
cpNodess.push(cpNodes);
|
|
38
|
+
}
|
|
39
|
+
return cpNodess;
|
|
40
|
+
}
|
|
41
|
+
export { getAllOnLoop_ByLoop };
|
|
42
|
+
//# sourceMappingURL=get-all-on-loop-by-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-on-loop-by-loop.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-all-on-loop-by-loop.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,SAAS,mBAAmB,CACpB,MAAc;IAElB,MAAM,QAAQ,GAAe,EAAE,CAAC;IAEhC,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AC3B,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -3,69 +3,11 @@ import { getBoundaryBezierPartsToNext } from './get-boundary-bezier-parts-to-nex
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns the ordered bezier curves from this `CpNode` to the next `CpNode`
|
|
5
5
|
* on the boundary.
|
|
6
|
+
*
|
|
6
7
|
* @param cpNode
|
|
7
8
|
*/
|
|
8
9
|
function getBoundaryBeziersToNext(cpNode) {
|
|
9
10
|
return getBoundaryBezierPartsToNext(cpNode).map(bp => fromTo(bp.ps, bp.ts[0], bp.ts[1]));
|
|
10
11
|
}
|
|
11
|
-
// /**
|
|
12
|
-
// * Returns the boundary beziers between this `CpNode` and the next
|
|
13
|
-
// * one.
|
|
14
|
-
// *
|
|
15
|
-
// * * returns `[]` if the next `CpNode` is on a different loop,
|
|
16
|
-
// * as this is a hole-closer and there are no boundary beziers between them.
|
|
17
|
-
// *
|
|
18
|
-
// * @param cpNode
|
|
19
|
-
// */
|
|
20
|
-
// function getBoundaryBeziersToNext(
|
|
21
|
-
// cpNode: CpNode): number[][][] {
|
|
22
|
-
// const cpThis = cpNode;
|
|
23
|
-
// const cpNext = cpNode.next;
|
|
24
|
-
// const posThis = cpThis.cp.pointOnShape;
|
|
25
|
-
// const posNext = cpNext.cp.pointOnShape;
|
|
26
|
-
// const curveThis = posThis.curve;
|
|
27
|
-
// const curveNext = posNext.curve;
|
|
28
|
-
// if (curveThis.loop !== curveNext.loop) {
|
|
29
|
-
// // It is a hole-closer going over to the other loop - a kind of terminal
|
|
30
|
-
// // CpNode.
|
|
31
|
-
// // return undefined!;
|
|
32
|
-
// return [];
|
|
33
|
-
// }
|
|
34
|
-
// const beziers: number[][][] = [];
|
|
35
|
-
// if (curveNext === curveThis) {
|
|
36
|
-
// beziers.push(
|
|
37
|
-
// fromTo(posThis.curve.ps, posThis.t, posNext.t)
|
|
38
|
-
// );
|
|
39
|
-
// } else {
|
|
40
|
-
// beziers.push(
|
|
41
|
-
// fromTo(posThis.curve.ps, posThis.t, 1)
|
|
42
|
-
// );
|
|
43
|
-
// addSkippedBeziers(
|
|
44
|
-
// beziers,
|
|
45
|
-
// posThis.curve,
|
|
46
|
-
// posNext.curve,
|
|
47
|
-
// posNext.t
|
|
48
|
-
// );
|
|
49
|
-
// }
|
|
50
|
-
// return beziers;
|
|
51
|
-
// }
|
|
52
|
-
// /**
|
|
53
|
-
// * Adds pieces of skipped beziers.
|
|
54
|
-
// * @internal
|
|
55
|
-
// */
|
|
56
|
-
// function addSkippedBeziers(
|
|
57
|
-
// beziers: number[][][],
|
|
58
|
-
// curveStart: Curve,
|
|
59
|
-
// curveEnd: Curve,
|
|
60
|
-
// t1: number) {
|
|
61
|
-
// let curveThis = curveStart;
|
|
62
|
-
// do {
|
|
63
|
-
// curveThis = curveThis.next;
|
|
64
|
-
// const tEnd = curveThis === curveEnd ? t1 : 1;
|
|
65
|
-
// beziers.push(
|
|
66
|
-
// fromTo(curveThis.ps, 0, tEnd)
|
|
67
|
-
// );
|
|
68
|
-
// } while (curveThis !== curveEnd);
|
|
69
|
-
// }
|
|
70
12
|
export { getBoundaryBeziersToNext };
|
|
71
13
|
//# sourceMappingURL=get-boundary-beziers-to-next.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAGtF
|
|
1
|
+
{"version":3,"file":"get-boundary-beziers-to-next.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-boundary-beziers-to-next.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAGtF;;;;;GAKG;AACH,SAAS,wBAAwB,CACzB,MAAc;IAElB,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC,GAAG,CAC3C,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1C,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { CpNode } from '../cp-node.js';
|
|
2
2
|
/**
|
|
3
|
-
* @internal
|
|
4
3
|
* Returns a line segment of unit length starting in the given Vertex center and
|
|
5
4
|
* pointing in the direction of the medial axis (viewed as a rooted tree).
|
|
5
|
+
*
|
|
6
6
|
* @param cpNode
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
7
9
|
*/
|
|
8
10
|
declare function getEdgeDirection(cpNode: CpNode): number[][];
|
|
9
11
|
export { getEdgeDirection };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse, dot } from 'flo-vector2d';
|
|
1
|
+
import { toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse as reverseVec, dot } from 'flo-vector2d';
|
|
2
2
|
import { tangent } from 'flo-bezier3';
|
|
3
3
|
import { isPosSharpCorner } from '../../point-on-shape/is-pos-sharp-corner.js';
|
|
4
4
|
/**
|
|
5
|
-
* @internal
|
|
6
5
|
* Returns a line segment of unit length starting in the given Vertex center and
|
|
7
6
|
* pointing in the direction of the medial axis (viewed as a rooted tree).
|
|
7
|
+
*
|
|
8
8
|
* @param cpNode
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
9
11
|
*/
|
|
10
12
|
function getEdgeDirection(cpNode) {
|
|
11
13
|
const circleCenter = cpNode.pointOnShape.circle.center;
|
|
@@ -36,7 +38,7 @@ function getEdgeDirection(cpNode) {
|
|
|
36
38
|
curve2 = pos1.curve;
|
|
37
39
|
}
|
|
38
40
|
const tan1 = toUnitVector(tangent(curve1.ps, 0));
|
|
39
|
-
const tan2 =
|
|
41
|
+
const tan2 = reverseVec(toUnitVector(tangent(curve2.ps, 1)));
|
|
40
42
|
const x = dot(tan1, tan2);
|
|
41
43
|
// Recall the identities sin(acos(x)) = sqrt(1-x^2), etc. Also
|
|
42
44
|
// recall the half angle formulas. Then the rotation matrix, R, can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-edge-direction.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-edge-direction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"get-edge-direction.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-edge-direction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,IAAI,UAAU,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAG/E;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACjB,MAAc;IAElB,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC;IAEvD,MAAM,GAAG,GAAG,MAAM,CAAC;IACnB,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;IAEhC,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC;IAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC;IAE9B,MAAM,EAAE,GAAG,IAAI,CAA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CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC;QAElC,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,GAAG,SAAS,CACf,YAAY,CAAC,IAAI,CAAC,EAClB,YAAY,CACf,CAAC;IAEF,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromTo, dot, cross, rotate90Degrees, interpolate, translate, lineLineIntersection } from 'flo-vector2d';
|
|
1
|
+
import { fromTo as fromToVec, dot, cross, rotate90Degrees, interpolate, translate, lineLineIntersection } from 'flo-vector2d';
|
|
2
2
|
import { getEdgeDirection } from './get-edge-direction.js';
|
|
3
3
|
const { abs } = Math;
|
|
4
4
|
/** @internal */
|
|
@@ -17,22 +17,22 @@ function getMatCurveBetween(cpNodeFrom, cpNodeTo) {
|
|
|
17
17
|
const toCc = cpNodeTo.pointOnShape.circle.center;
|
|
18
18
|
const toL = getEdgeDirection(cpNodeTo.prevOnCircle);
|
|
19
19
|
const mid = lineLineIntersection(fromL, toL);
|
|
20
|
-
const c =
|
|
20
|
+
const c = fromToVec(fromCc, toCc);
|
|
21
21
|
let twisted;
|
|
22
22
|
if (!mid) {
|
|
23
23
|
twisted = true;
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
const a =
|
|
27
|
-
const b =
|
|
26
|
+
const a = fromToVec(fromCc, mid);
|
|
27
|
+
const b = fromToVec(toCc, mid);
|
|
28
28
|
twisted = dot(a, c) < 0 || dot(b, c) > 0;
|
|
29
29
|
}
|
|
30
30
|
if (!twisted) {
|
|
31
31
|
return [fromCc, mid, toCc];
|
|
32
32
|
}
|
|
33
33
|
const r = rotate90Degrees(c);
|
|
34
|
-
const w1 =
|
|
35
|
-
const w2 =
|
|
34
|
+
const w1 = fromToVec(fromL[0], fromL[1]); // This is a unit vector
|
|
35
|
+
const w2 = fromToVec(toL[0], toL[1]); // This is a unit vector
|
|
36
36
|
const d1 = abs(cross(c, w1)) / (3 * 3);
|
|
37
37
|
const d2 = abs(cross(c, w2)) / (3 * 3);
|
|
38
38
|
if (d1 > TOLERANCE_ADD_2PRONG || d2 > TOLERANCE_ADD_2PRONG) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-mat-curve-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-mat-curve-between.ts"],"names":[],"mappings":"AACA,OAAO,EACH,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"get-mat-curve-between.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-mat-curve-between.ts"],"names":[],"mappings":"AACA,OAAO,EACH,MAAM,IAAI,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EACxE,oBAAoB,EACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAGrB,gBAAgB;AAChB,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,gBAAgB;AAChB,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,aAAa;AAGhD;;;;;GAKG;AACH,SAAS,kBAAkB,CACnB,UAAkB,EAClB,QAAgB;IAEpB,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC;IACrD,MAAM,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAE3C,MAAM,IAA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E,CAAC,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC;IAErC,IAAI,EAAE,GAAG,oBAAoB,IAAI,EAAE,GAAG,oBAAoB,EAAE,CAAC;QACzD,8DAA8D;QAC9D,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,EAAE,GAAG,kBAAkB,IAAI,EAAE,GAAG,kBAAkB,EAAE,CAAC;QACrD,gCAAgC;QAChC,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,EAAC,IAAI,EAAC,CAAC,GAAC,CAAC,CAAC,CAAC;QACxC,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,EAAC,IAAI,EAAC,CAAC,GAAC,CAAC,CAAC,CAAC;QACxC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,MAAM,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;QACnB,MAAM,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;QACnB,MAAM,IAAI,GAAG,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,EAAI,EAAE,CAAE,CAAC;QAE9C,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,uDAAuD;IACvD,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { getAllOnCircle } from "./get-all-on-circle.js";
|
|
2
2
|
import { isTerminating } from "./is-terminating.js";
|
|
3
|
+
import { isTrivial } from "./is-trivial.js";
|
|
3
4
|
/**
|
|
4
5
|
* Like isTerminating() but only returns true if all cpNodes on the circle
|
|
5
6
|
* (except this.prevOnCircle) is terminating.
|
|
6
7
|
*/
|
|
7
8
|
function isFullyTerminating(cpNode) {
|
|
9
|
+
// const otherOnCircle = getAllOnCircle(cpNode.prevOnCircle, true);
|
|
10
|
+
// return otherOnCircle.every(isTerminating);
|
|
11
|
+
if (!isTerminating(cpNode)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (isTrivial(cpNode)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
while (cpNode.prev === cpNode.prevOnCircle) {
|
|
18
|
+
cpNode = cpNode.prev;
|
|
19
|
+
}
|
|
8
20
|
const otherOnCircle = getAllOnCircle(cpNode.prevOnCircle, true);
|
|
9
21
|
return otherOnCircle.every(isTerminating);
|
|
10
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-fully-terminating.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-fully-terminating.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"is-fully-terminating.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-fully-terminating.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;GAGG;AACH,SAAS,kBAAkB,CAAC,MAAc;IACtC,mEAAmE;IAEnE,6CAA6C;IAC7C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEhE,OAAO,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;AAC9C,CAAC;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-on-same-loop.js","sourceRoot":"","sources":["../../../src/cp-node/fs/is-on-same-loop.ts"],"names":[],"mappings":"AAGA,SAAS,YAAY,CACb,OAAe,EACf,OAAe;IAEnB,OAAO,CACH,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;QAC/B,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAClC,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/node/debug/debug.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { IGeneralDebugFunctions } from './functions/general.js';
|
|
2
|
-
import { DrawElemFunctions } from './functions/draw-elem/draw-elem.js';
|
|
3
|
-
import { DebugElems } from './debug-elem-types.js';
|
|
4
1
|
/** @internal */
|
|
5
2
|
interface Debug {
|
|
6
3
|
/** Generated by debug object for later inspection */
|
|
7
|
-
|
|
4
|
+
elems: {};
|
|
5
|
+
timing: Timing;
|
|
8
6
|
/**
|
|
9
7
|
* These functions are meant to be used in the console, e.g. in the
|
|
10
8
|
* console try typing d.fs.twoProng.traceConvergence(0);
|
|
11
9
|
*/
|
|
12
|
-
fs:
|
|
13
|
-
directives:
|
|
10
|
+
fs: {};
|
|
11
|
+
directives: Directives;
|
|
14
12
|
}
|
|
15
13
|
/** @internal */
|
|
16
|
-
|
|
17
|
-
[T in keyof DebugElems]: DebugElems[T][];
|
|
18
|
-
};
|
|
19
|
-
/** @internal */
|
|
20
|
-
interface ITiming {
|
|
14
|
+
interface Timing {
|
|
21
15
|
holeClosers: number;
|
|
22
16
|
oneAnd2Prongs: number;
|
|
23
17
|
threeProngs: number;
|
|
@@ -25,16 +19,7 @@ interface ITiming {
|
|
|
25
19
|
simplifyMat: number;
|
|
26
20
|
}
|
|
27
21
|
/** @internal */
|
|
28
|
-
interface
|
|
29
|
-
elems: GeneratedElems;
|
|
30
|
-
timing: ITiming;
|
|
31
|
-
}
|
|
32
|
-
/** @internal */
|
|
33
|
-
interface IDebugFunctions extends IGeneralDebugFunctions {
|
|
34
|
-
drawElem: DrawElemFunctions;
|
|
35
|
-
}
|
|
36
|
-
/** @internal */
|
|
37
|
-
interface IDirectives {
|
|
22
|
+
interface Directives {
|
|
38
23
|
stopAfterHoleClosers: boolean;
|
|
39
24
|
stopAfterHoleClosersNum: number;
|
|
40
25
|
stopAfterTwoProngs: boolean;
|
|
@@ -43,4 +28,5 @@ interface IDirectives {
|
|
|
43
28
|
stopAfterThreeProngsNum: number;
|
|
44
29
|
}
|
|
45
30
|
declare function enableDebugForMat(debugOn: boolean): void;
|
|
46
|
-
export { Debug,
|
|
31
|
+
export type { Debug, Timing, Directives };
|
|
32
|
+
export { enableDebugForMat };
|
package/node/debug/debug.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { generalDebugFunctions } from './functions/general.js';
|
|
2
|
-
import { drawElemFs } from './functions/draw-elem/draw-elem.js';
|
|
3
1
|
function enableDebugForMat(debugOn) {
|
|
4
2
|
if (!debugOn) {
|
|
5
3
|
window._debug_ = undefined;
|
|
@@ -8,59 +6,23 @@ function enableDebugForMat(debugOn) {
|
|
|
8
6
|
let debug = window._debug_;
|
|
9
7
|
debug = {
|
|
10
8
|
...debug,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// twoProng_regular : [],
|
|
22
|
-
// twoProng_failed : [],
|
|
23
|
-
// twoProng_notAdded : [],
|
|
24
|
-
// twoProng_deleted : [],
|
|
25
|
-
// twoProng_holeClosing : [],
|
|
26
|
-
looseBoundingBox: [],
|
|
27
|
-
tightBoundingBox: [],
|
|
28
|
-
// sharpCorner : [],
|
|
29
|
-
// dullCorner : [],
|
|
30
|
-
vertex: [],
|
|
31
|
-
threeProng: [],
|
|
32
|
-
boundingHull: [],
|
|
33
|
-
mat: [],
|
|
34
|
-
// sat : [],
|
|
35
|
-
cpNode: [],
|
|
36
|
-
maxVertex: [],
|
|
37
|
-
leaves: [],
|
|
38
|
-
// culls : [],
|
|
39
|
-
},
|
|
40
|
-
timing: {
|
|
41
|
-
//...debug?.generated?.timing,
|
|
42
|
-
...(!debug ? {} : !debug.generated ? {} : !debug.generated.timing ? {} : debug.generated.timing),
|
|
43
|
-
holeClosers: 0,
|
|
44
|
-
oneAnd2Prongs: 0,
|
|
45
|
-
threeProngs: 0,
|
|
46
|
-
sats: 0,
|
|
47
|
-
simplifyMat: 0,
|
|
48
|
-
}
|
|
9
|
+
elems: {
|
|
10
|
+
...debug?.elems
|
|
11
|
+
},
|
|
12
|
+
timing: {
|
|
13
|
+
...debug?.timing,
|
|
14
|
+
holeClosers: 0,
|
|
15
|
+
oneAnd2Prongs: 0,
|
|
16
|
+
threeProngs: 0,
|
|
17
|
+
sats: 0,
|
|
18
|
+
simplifyMat: 0
|
|
49
19
|
},
|
|
50
20
|
fs: {
|
|
51
|
-
|
|
52
|
-
...(!debug ? {} : !debug.fs ? {} : debug.fs),
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
drawElem: {
|
|
55
|
-
//...debug?.fs?.drawElem,
|
|
56
|
-
...(!debug ? {} : !debug.fs ? {} : !debug.fs.drawElem ? {} : debug.fs.drawElem),
|
|
57
|
-
...drawElemFs
|
|
58
|
-
},
|
|
59
|
-
...generalDebugFunctions
|
|
21
|
+
...debug?.fs
|
|
60
22
|
},
|
|
61
23
|
directives: {
|
|
62
24
|
//...debug?.directives,
|
|
63
|
-
...
|
|
25
|
+
...debug?.directives,
|
|
64
26
|
stopAfterHoleClosers: false,
|
|
65
27
|
stopAfterHoleClosersNum: undefined,
|
|
66
28
|
stopAfterTwoProngs: false,
|
package/node/debug/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug/debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug/debug.ts"],"names":[],"mappings":"AAqCA,SAAS,iBAAiB,CAAC,OAAgB;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACV,MAAc,CAAC,OAAO,GAAG,SAAS,CAAC;QACpC,OAAO;IACX,CAAC;IAED,IAAI,KAAK,GAAW,MAAc,CAAC,OAAO,CAAC;IAE3C,KAAK,GAAG;QACJ,GAAG,KAAK;QACR,KAAK,EAAE;YACH,GAAG,KAAK,EAAE,KAAK;SAClB;QACD,MAAM,EAAE;YACJ,GAAG,KAAK,EAAE,MAAM;YAChB,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;YAChB,WAAW,EAAE,CAAC;YACd,IAAI,EAAE,CAAC;YACP,WAAW,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACA,GAAG,KAAK,EAAE,EAAE;SACf;QACD,UAAU,EAAE;YACR,uBAAuB;YACvB,GAAG,KAAK,EAAE,UAAU;YACpB,oBAAoB,EAAE,KAAK;YAC3B,uBAAuB,EAAE,SAAU;YACnC,kBAAkB,EAAE,KAAK;YACzB,qBAAqB,EAAE,SAAU;YACjC,oBAAoB,EAAE,KAAK;YAC3B,uBAAuB,EAAE,SAAU;SACtC;KACJ,CAAC;IAED,MAAc,CAAC,OAAO,GAAG,KAAK,CAAC;AACpC,CAAC;AAID,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -33,10 +33,7 @@ function add1Prong(meta, radius, center, pos) {
|
|
|
33
33
|
if (getCloseByCpIfExist(meta, pos, circle, order, 0, 1)) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
// if (typeof _debug_ !== 'undefined') {
|
|
38
|
-
// _debug_.generated.elems.oneProng.push(cpNodes);
|
|
39
|
-
// }
|
|
36
|
+
addToCpTree(false, false, circle, [-0.5, +0.5], meta, [pos, pos]);
|
|
40
37
|
}
|
|
41
38
|
export { add1Prong };
|
|
42
39
|
//# sourceMappingURL=add-1-prong.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-1-prong.js","sourceRoot":"","sources":["../../src/find-2-prong/add-1-prong.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAGpE;;;;;GAKG;AACH,SAAS,SAAS,CACV,IAAa,EACb,MAAc,EACd,MAAgB,EAChB,GAAoB;IAExB,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QAChD,sCAAsC;QAEtC,SAAS;QACT,gEAAgE;QAChE,wEAAwE;QACxE,mEAAmE;QACnE,mEAAmE;QACnE,qEAAqE;QACrE,kEAAkE;QAClE,oEAAoE;QAEpE,kCAAkC;QAElC,yCAAyC;QACrC,0DAA0D;QAC9D,IAAI;QAEJ,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,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,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAGD,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -9,7 +9,7 @@ import { calcSeperationTolerance } from './calc-seperation-tolerance.js';
|
|
|
9
9
|
import { getInitialX } from './get-initial-x.js';
|
|
10
10
|
import { ddNormal } from 'flo-bezier3';
|
|
11
11
|
import { rotate } from 'flo-vector2d';
|
|
12
|
-
const { sin, cos, max, sqrt } = Math;
|
|
12
|
+
const { abs, sin, cos, max, sqrt } = Math;
|
|
13
13
|
/**
|
|
14
14
|
* Adds a 2-prong to the MAT. The first point on the shape boundary is given and
|
|
15
15
|
* the second one is found by the algorithm.
|
|
@@ -49,23 +49,30 @@ function find2Prong(meta) {
|
|
|
49
49
|
const nnorm = isHoleClosing
|
|
50
50
|
? [0, -maxOsculatingCircleRadius]
|
|
51
51
|
: (angle !== 0 ? rotate(sin(angle), cos(angle))(_nnorm) : _nnorm);
|
|
52
|
+
const nnormDd = isHoleClosing || angle !== 0
|
|
53
|
+
? [[0, nnorm[0]], [0, nnorm[1]]]
|
|
54
|
+
: [[-normDd[0][0], -normDd[0][1]], [-normDd[1][0], -normDd[1][1]]];
|
|
52
55
|
// Get initial kissing circle guess
|
|
53
56
|
let [xO, rO] = getInitialX(angle, isHoleClosing, maxOsculatingCircleRadius, yPos, nnorm);
|
|
54
57
|
// The boundary piece that should contain the other point of
|
|
55
58
|
// the 2-prong circle. (Defined by start and end points).
|
|
56
59
|
const curvePieces = getInitialCurvePieces(angle, isHoleClosing, loop, loops, meta, yPos, xO);
|
|
57
60
|
// The lines below is an optimization.
|
|
58
|
-
const xy2 = reduceRadius(maxCoordPowerOf2, curvePieces, y, nnorm);
|
|
61
|
+
const xy2 = reduceRadius(maxCoordPowerOf2, rO, curvePieces, y, nnorm);
|
|
59
62
|
const xy = sqrt(xy2);
|
|
60
63
|
const l = sqrt(nnorm[0] ** 2 + nnorm[1] ** 2);
|
|
61
64
|
xO = [y[0] + nnorm[0] / l * xy, y[1] + nnorm[1] / l * xy];
|
|
62
65
|
cullCurvePieces(curvePieces, xO, xy2);
|
|
63
|
-
const antipodalPoints = getAntipodalPoints(maxCoordPowerOf2, nnorm, yPos, for1Prong, angle, curvePieces);
|
|
66
|
+
const antipodalPoints = getAntipodalPoints(maxCoordPowerOf2, nnorm, nnormDd, yPos, for1Prong, angle, curvePieces);
|
|
67
|
+
// FUTURE - if antipodalPoints.length > 1 let's just add an n-prong;
|
|
64
68
|
if (antipodalPoints.length !== 1) {
|
|
65
69
|
if (antipodalPoints.length === 0) {
|
|
70
|
+
if (isHoleClosing) {
|
|
71
|
+
console.log(yPos);
|
|
72
|
+
}
|
|
66
73
|
return undefined;
|
|
67
74
|
}
|
|
68
|
-
if (!areAllAntipodesSame(antipodalPoints)) {
|
|
75
|
+
if (!isHoleClosing && !areAllAntipodesSame(antipodalPoints, maxCoordPowerOf2)) {
|
|
69
76
|
// At this point there is multiple antipodal points (zs) for the given
|
|
70
77
|
// source point so do not add the 2-prong, it will be caught when
|
|
71
78
|
// adding 3+-prongs.
|
|
@@ -77,9 +84,11 @@ function find2Prong(meta) {
|
|
|
77
84
|
add1Prong(meta, rO, xO, yPos);
|
|
78
85
|
return undefined;
|
|
79
86
|
}
|
|
87
|
+
const pDd = toP(curve.ps, s);
|
|
88
|
+
const p = pDd.map(c => c[0] + c[1]);
|
|
80
89
|
const z = {
|
|
81
90
|
curve, t: s, isSource: false,
|
|
82
|
-
p
|
|
91
|
+
p, pDd
|
|
83
92
|
};
|
|
84
93
|
const circle = { center: x, radius: d };
|
|
85
94
|
const yz = squaredDistanceBetweenDd(yPos.p, z.p);
|
|
@@ -99,11 +108,16 @@ function find2Prong(meta) {
|
|
|
99
108
|
};
|
|
100
109
|
}
|
|
101
110
|
/** @internal */
|
|
102
|
-
function areAllAntipodesSame(
|
|
103
|
-
const { curve, s: t } =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
function areAllAntipodesSame(point, maxCoordPowerOf2) {
|
|
112
|
+
const { curve, s: t, x } = point[0];
|
|
113
|
+
const tol = 2 ** (maxCoordPowerOf2 - 40);
|
|
114
|
+
for (let i = 1; i < point.length; i++) {
|
|
115
|
+
// const { curve: curve_, s: t_ } = point[i];
|
|
116
|
+
// if (curve !== curve_ || t !== t_) {
|
|
117
|
+
// return false;
|
|
118
|
+
// }
|
|
119
|
+
const { x: x_ } = point[i];
|
|
120
|
+
if (abs(x[0] - x_[0]) > tol || abs(x[0] - x_[0]) > tol) {
|
|
107
121
|
return false;
|
|
108
122
|
}
|
|
109
123
|
}
|