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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { atan2 } = Math;
|
|
1
2
|
function joinSpokes(circle, cpNodes) {
|
|
2
3
|
cpNodes = cpNodes.slice().sort(byAngle(circle));
|
|
3
4
|
const len = cpNodes.length;
|
|
@@ -16,8 +17,8 @@ function byAngle(circle) {
|
|
|
16
17
|
// Move onto origin
|
|
17
18
|
a = [a[0] - c[0], a[1] - c[1]];
|
|
18
19
|
b = [b[0] - c[0], b[1] - c[1]];
|
|
19
|
-
const a_ =
|
|
20
|
-
const b_ =
|
|
20
|
+
const a_ = atan2(a[1], a[0]);
|
|
21
|
+
const b_ = atan2(b[1], b[0]);
|
|
21
22
|
return b_ - a_;
|
|
22
23
|
};
|
|
23
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-spokes.js","sourceRoot":"","sources":["../../src/add-n-prong.ts/join-spokes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"join-spokes.js","sourceRoot":"","sources":["../../src/add-n-prong.ts/join-spokes.ts"],"names":[],"mappings":"AAIA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;AAGvB,SAAS,UAAU,CACX,MAAc,EACd,OAAiB;IAErB,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEhD,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,OAAO,CAAC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the given curve pieces with those culled whose closest possible
|
|
4
|
+
* point to `p` is further than `sqrt(maxSquaredDistance)` away.
|
|
5
|
+
*
|
|
6
|
+
* * a piece is kept only if both its (cheap, axis-aligned) loose bounding box
|
|
7
|
+
* and then its (rotated) tight bounding box come within the distance
|
|
8
|
+
* * the bounding boxes are those of the entire curves (not just the pieces)
|
|
9
|
+
* and are memoized per curve
|
|
10
|
+
* * the given array is not modified (callers may reuse it for other points)
|
|
11
|
+
* * any tolerance for floating point error is the responsibility of the
|
|
12
|
+
* caller (i.e. `maxSquaredDistance` should already include it)
|
|
13
|
+
*
|
|
14
|
+
* @param curvePieces the curve pieces to cull
|
|
15
|
+
* @param p the point
|
|
16
|
+
* @param maxSquaredDistance the squared distance beyond which to cull
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
declare function cullCurvePieces(curvePieces: CurvePiece[], p: number[], maxSquaredDistance: number): CurvePiece[];
|
|
21
|
+
export { cullCurvePieces };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getBoundingBox$, getBoundingBoxTight$ } from '../geometry/get-bounding-box-.js';
|
|
2
|
+
import { getClosestSquareDistanceToRect } from '../geometry/get-closest-square-distance-to-rect.js';
|
|
3
|
+
import { getClosestSquaredDistanceToRotatedRect } from '../geometry/get-closest-squared-distance-to-rotated-rect.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns the given curve pieces with those culled whose closest possible
|
|
6
|
+
* point to `p` is further than `sqrt(maxSquaredDistance)` away.
|
|
7
|
+
*
|
|
8
|
+
* * a piece is kept only if both its (cheap, axis-aligned) loose bounding box
|
|
9
|
+
* and then its (rotated) tight bounding box come within the distance
|
|
10
|
+
* * the bounding boxes are those of the entire curves (not just the pieces)
|
|
11
|
+
* and are memoized per curve
|
|
12
|
+
* * the given array is not modified (callers may reuse it for other points)
|
|
13
|
+
* * any tolerance for floating point error is the responsibility of the
|
|
14
|
+
* caller (i.e. `maxSquaredDistance` should already include it)
|
|
15
|
+
*
|
|
16
|
+
* @param curvePieces the curve pieces to cull
|
|
17
|
+
* @param p the point
|
|
18
|
+
* @param maxSquaredDistance the squared distance beyond which to cull
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function cullCurvePieces(curvePieces, p, maxSquaredDistance) {
|
|
23
|
+
const culled = [];
|
|
24
|
+
for (let i = 0; i < curvePieces.length; i++) {
|
|
25
|
+
const curvePiece = curvePieces[i];
|
|
26
|
+
const { ps } = curvePiece.curve;
|
|
27
|
+
const d = getClosestSquareDistanceToRect(getBoundingBox$(ps), p);
|
|
28
|
+
if (d > maxSquaredDistance) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const d2 = getClosestSquaredDistanceToRotatedRect(getBoundingBoxTight$(ps), p);
|
|
32
|
+
if (d2 > maxSquaredDistance) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
culled.push(curvePiece);
|
|
36
|
+
}
|
|
37
|
+
return culled;
|
|
38
|
+
}
|
|
39
|
+
export { cullCurvePieces };
|
|
40
|
+
//# sourceMappingURL=cull-curve-pieces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cull-curve-pieces.js","sourceRoot":"","sources":["../../src/closest-boundary-point/cull-curve-pieces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,oDAAoD,CAAC;AACpG,OAAO,EAAE,sCAAsC,EAAE,MAAM,6DAA6D,CAAC;AAGrH;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,eAAe,CAChB,WAAyB,EACzB,CAAW,EACX,kBAA0B;IAE9B,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,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;QAClC,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;QAEhC,MAAM,CAAC,GAAG,8BAA8B,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,GAAG,kBAAkB,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAEzC,MAAM,EAAE,GAAG,sCAAsC,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/E,IAAI,EAAE,GAAG,kBAAkB,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAE1C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPotentialClosestPointsOnCurveCertified } from './get-potential-closest-points-on-curve-certified.js';
|
|
2
|
-
import {
|
|
2
|
+
import { cullCurvePieces } from './cull-curve-pieces.js';
|
|
3
|
+
import { getBestDistanceSquared } from './get-best-distance-squared.js';
|
|
3
4
|
import { toP } from '../point-on-shape/to-p.js';
|
|
4
5
|
/**
|
|
5
6
|
* Returns the closest boundary point to the given point, limited to the given
|
|
@@ -12,7 +13,9 @@ import { toP } from '../point-on-shape/to-p.js';
|
|
|
12
13
|
* @internal
|
|
13
14
|
*/
|
|
14
15
|
function getCloseBoundaryPointsCertified(curvePieces, x) {
|
|
15
|
-
|
|
16
|
+
// cull the pieces that cannot contain the closest point (the best
|
|
17
|
+
// squared distance already includes a floating point tolerance)
|
|
18
|
+
curvePieces = cullCurvePieces(curvePieces, x, getBestDistanceSquared(curvePieces, x));
|
|
16
19
|
const pInfos = [];
|
|
17
20
|
for (let i = 0; i < curvePieces.length; i++) {
|
|
18
21
|
const curvePiece = curvePieces[i];
|
|
@@ -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,
|
|
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,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;;;;;;;;GASG;AACH,SAAS,+BAA+B,CAChC,WAAyB,EACzB,CAAW;IAEf,kEAAkE;IAClE,gEAAgE;IAChE,WAAW,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,sBAAsB,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtF,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,GAAG,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACvB,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAEnC,OAAO;YACH,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG;SACpC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAGD,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Curve } from "flo-boolean";
|
|
2
|
+
import type { FootAndEndpointInfo } from './foot-and-endpoint-info.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the `FootAndEndpointInfo` of the endpoint at parameter `t` of the
|
|
5
|
+
* given curve, i.e. the certified interval `dSquaredI` guaranteed to contain
|
|
6
|
+
* the squared distance from `x` to the point on the curve at `t` (`t` taken as
|
|
7
|
+
* exact).
|
|
8
|
+
*
|
|
9
|
+
* * the point is kept in double-double precision (including its evaluation
|
|
10
|
+
* error bound) until the differences with `x` have been taken, so the only
|
|
11
|
+
* rounding left is that of forming the interval in double precision, which
|
|
12
|
+
* is accounted for exactly below
|
|
13
|
+
*
|
|
14
|
+
* Error analysis (`u = eps/2` the unit roundoff, `fl(a∘b) = (a∘b)(1+δ)`,
|
|
15
|
+
* `|δ| <= u`): let `a` be the exact magnitude of the double-double difference
|
|
16
|
+
* `dx` and `Δx` the true (exact) difference. Then
|
|
17
|
+
* * `|Δx| ∈ [a(1-ρ) - ex, a(1+ρ) + ex]` with `ρ = 2u²` (the relative error
|
|
18
|
+
* bound of the double-double minus double subtraction) and `ex` the
|
|
19
|
+
* evaluation error bound on the coordinate
|
|
20
|
+
* * `ax = |hi(dx)|` satisfies `|ax - a| <= u·ax` (the low part of a
|
|
21
|
+
* normalized double-double is at most half an ulp of the high part)
|
|
22
|
+
* * the upper bound `(ax+ex)² + (ay+ey)²` is then computed with 3 roundings
|
|
23
|
+
* (addition, square, sum) and widened with 1 more; it must dominate
|
|
24
|
+
* `(a(1+ρ)+ex)² + ...` which requires `(1-u)⁴(1+WIDEN) >= (1+u+ρ)²`, i.e.
|
|
25
|
+
* `WIDEN >= 6u + O(u²)`
|
|
26
|
+
* * the lower bound `(ax-ex)₊² + (ay-ey)₊²` likewise requires
|
|
27
|
+
* `(1+u)⁴(1-WIDEN) <= (1-u-ρ)²`, i.e. `WIDEN >= 6u + O(u²)`, *except* that
|
|
28
|
+
* when the true term is `0` (`a <= ex`) rounding may still leave
|
|
29
|
+
* `ax - ex <= ax·u` positive, giving a spurious `(ax-ex)² <= 2u²·ax²`; this
|
|
30
|
+
* is covered by subtracting `SLACK·(ax² + ay²)` with `SLACK >= 2u²`
|
|
31
|
+
*
|
|
32
|
+
* @param curve the curve
|
|
33
|
+
* @param x the point from which to check
|
|
34
|
+
* @param t the parameter value of the endpoint
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
declare function getEndpointInfoCertified(curve: Curve, x: number[], t: number): FootAndEndpointInfo;
|
|
39
|
+
export { getEndpointInfoCertified };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { evalDeCasteljauWithErrDd } from 'flo-bezier3';
|
|
2
|
+
import { ddDiffDouble } from 'double-double';
|
|
3
|
+
import { eps } from '../error-analysis/gamma.js';
|
|
4
|
+
const { abs, max } = Math;
|
|
5
|
+
/**
|
|
6
|
+
* Relative widening of the interval bounds - see the error analysis in
|
|
7
|
+
* `getEndpointInfoCertified`: the exact first order requirement is `6u = 3eps`
|
|
8
|
+
* (`u = eps/2` the unit roundoff); `4eps = 2**-50` (exactly representable)
|
|
9
|
+
* leaves room for the `O(u²)` terms.
|
|
10
|
+
*/
|
|
11
|
+
const WIDEN = 4 * eps;
|
|
12
|
+
/**
|
|
13
|
+
* Absolute slack (relative to `ax² + ay²`) for the lower bound - see the error
|
|
14
|
+
* analysis: the exact first order requirement is `2u² = eps²/2`.
|
|
15
|
+
*/
|
|
16
|
+
const SLACK = eps * eps;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the `FootAndEndpointInfo` of the endpoint at parameter `t` of the
|
|
19
|
+
* given curve, i.e. the certified interval `dSquaredI` guaranteed to contain
|
|
20
|
+
* the squared distance from `x` to the point on the curve at `t` (`t` taken as
|
|
21
|
+
* exact).
|
|
22
|
+
*
|
|
23
|
+
* * the point is kept in double-double precision (including its evaluation
|
|
24
|
+
* error bound) until the differences with `x` have been taken, so the only
|
|
25
|
+
* rounding left is that of forming the interval in double precision, which
|
|
26
|
+
* is accounted for exactly below
|
|
27
|
+
*
|
|
28
|
+
* Error analysis (`u = eps/2` the unit roundoff, `fl(a∘b) = (a∘b)(1+δ)`,
|
|
29
|
+
* `|δ| <= u`): let `a` be the exact magnitude of the double-double difference
|
|
30
|
+
* `dx` and `Δx` the true (exact) difference. Then
|
|
31
|
+
* * `|Δx| ∈ [a(1-ρ) - ex, a(1+ρ) + ex]` with `ρ = 2u²` (the relative error
|
|
32
|
+
* bound of the double-double minus double subtraction) and `ex` the
|
|
33
|
+
* evaluation error bound on the coordinate
|
|
34
|
+
* * `ax = |hi(dx)|` satisfies `|ax - a| <= u·ax` (the low part of a
|
|
35
|
+
* normalized double-double is at most half an ulp of the high part)
|
|
36
|
+
* * the upper bound `(ax+ex)² + (ay+ey)²` is then computed with 3 roundings
|
|
37
|
+
* (addition, square, sum) and widened with 1 more; it must dominate
|
|
38
|
+
* `(a(1+ρ)+ex)² + ...` which requires `(1-u)⁴(1+WIDEN) >= (1+u+ρ)²`, i.e.
|
|
39
|
+
* `WIDEN >= 6u + O(u²)`
|
|
40
|
+
* * the lower bound `(ax-ex)₊² + (ay-ey)₊²` likewise requires
|
|
41
|
+
* `(1+u)⁴(1-WIDEN) <= (1-u-ρ)²`, i.e. `WIDEN >= 6u + O(u²)`, *except* that
|
|
42
|
+
* when the true term is `0` (`a <= ex`) rounding may still leave
|
|
43
|
+
* `ax - ex <= ax·u` positive, giving a spurious `(ax-ex)² <= 2u²·ax²`; this
|
|
44
|
+
* is covered by subtracting `SLACK·(ax² + ay²)` with `SLACK >= 2u²`
|
|
45
|
+
*
|
|
46
|
+
* @param curve the curve
|
|
47
|
+
* @param x the point from which to check
|
|
48
|
+
* @param t the parameter value of the endpoint
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
function getEndpointInfoCertified(curve, x, t) {
|
|
53
|
+
const { ps } = curve;
|
|
54
|
+
// the point in double-double precision with coordinate-wise absolute
|
|
55
|
+
// error bounds `pE`
|
|
56
|
+
const { p: pDd, pE } = evalDeCasteljauWithErrDd(ps, [0, t]);
|
|
57
|
+
// the coordinate differences in double-double precision
|
|
58
|
+
const dx = ddDiffDouble(pDd[0], x[0]);
|
|
59
|
+
const dy = ddDiffDouble(pDd[1], x[1]);
|
|
60
|
+
const ax = abs(dx[1]);
|
|
61
|
+
const ay = abs(dy[1]);
|
|
62
|
+
const [ex, ey] = pE;
|
|
63
|
+
const lo = max(ax - ex, 0) ** 2 + max(ay - ey, 0) ** 2;
|
|
64
|
+
const hi = (ax + ex) ** 2 + (ay + ey) ** 2;
|
|
65
|
+
const dSquaredI = [
|
|
66
|
+
max(lo * (1 - WIDEN) - SLACK * (ax * ax + ay * ay), 0),
|
|
67
|
+
hi * (1 + WIDEN)
|
|
68
|
+
];
|
|
69
|
+
const t_ = t === 0 ? 1 : t;
|
|
70
|
+
const curve_ = t === 0 ? curve.prev : curve;
|
|
71
|
+
return {
|
|
72
|
+
curve: curve_,
|
|
73
|
+
t: t_,
|
|
74
|
+
dSquaredI
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export { getEndpointInfoCertified };
|
|
78
|
+
//# sourceMappingURL=get-endpoint-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-endpoint-info.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-endpoint-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAEjD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,KAAK,GAAG,CAAC,GAAC,GAAG,CAAC;AACpB;;;GAGG;AACH,MAAM,KAAK,GAAG,GAAG,GAAC,GAAG,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAS,wBAAwB,CACzB,KAAY,EACZ,CAAW,EACX,CAAS;IAEb,MAAM,EAAE,EAAE,EAAE,GAAG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CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAE5C,OAAO;QACH,KAAK,EAAE,MAAM;QACb,CAAC,EAAE,EAAE;QACL,SAAS;KACZ,CAAA;AACL,CAAC;AAGD,OAAO,EAAE,wBAAwB,EAAE,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { roots } from 'flo-poly';
|
|
2
|
-
import {
|
|
2
|
+
import { getFootPointsOnBezierPolysCertified, getIntervalBox } from 'flo-bezier3';
|
|
3
3
|
import { rootIntervalToDistanceSquaredInterval } from './root-interval-to-distance-squared-interval.js';
|
|
4
|
-
import {
|
|
5
|
-
import { eps } from '../error-analysis/gamma.js';
|
|
4
|
+
import { getEndpointInfoCertified } from './get-endpoint-info.js';
|
|
6
5
|
/**
|
|
7
6
|
* @internal
|
|
8
7
|
*
|
|
@@ -31,22 +30,9 @@ function getPotentialClosestPointsOnCurveCertified(curve, x, tRange) {
|
|
|
31
30
|
};
|
|
32
31
|
}));
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
infos.push(...ts.map(t => {
|
|
39
|
-
const p = evalDeCasteljauDd(ps, [0, t]).map(v => v[0] + v[1]);
|
|
40
|
-
const d = squaredDistanceBetweenDd(p, x);
|
|
41
|
-
const dSquaredI = [d * (1 - eps), d * (1 + eps)];
|
|
42
|
-
const t_ = t === 0 ? 1 : t;
|
|
43
|
-
const curve_ = t === 0 ? curve.prev : curve;
|
|
44
|
-
return {
|
|
45
|
-
curve: curve_,
|
|
46
|
-
t: t_,
|
|
47
|
-
dSquaredI
|
|
48
|
-
};
|
|
49
|
-
}));
|
|
33
|
+
// the endpoints of the range (just the one if the range is a single point)
|
|
34
|
+
const ts = tS === tE ? [tS] : [tS, tE];
|
|
35
|
+
infos.push(...ts.map(t => getEndpointInfoCertified(curve, x, t)));
|
|
50
36
|
return infos;
|
|
51
37
|
}
|
|
52
38
|
export { getPotentialClosestPointsOnCurveCertified };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-potential-closest-points-on-curve-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-potential-closest-points-on-curve-certified.js","sourceRoot":"","sources":["../../src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,mCAAmC,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EAAE,qCAAqC,EAAE,MAAM,iDAAiD,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;;;;;GAMG;AACH,SAAS,yCAAyC,CAC1C,KAAY,EACZ,CAAW,EACX,MAAwB;IAE5B,MAAM,CAAC,EAAE,EAAC,EAAE,CAAC,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IAErB,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACZ,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,GAC5C,mCAAmC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC;QAEzD,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACvB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EA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of a curve piece, given an axis-aligned
|
|
4
|
+
* box that is guaranteed to engulf that piece (see `getIntervalBox`).
|
|
4
5
|
*
|
|
5
|
-
* * the
|
|
6
|
+
* * the minimum squared distance to the box is attained on its boundary (or
|
|
7
|
+
* is `0` if `p` is inside): per axis the distance is the gap between `p` and
|
|
8
|
+
* the box's range on that axis (`0` if `p` is within the range)
|
|
9
|
+
* * the maximum squared distance to the box is attained at a corner: per axis
|
|
10
|
+
* it is the larger of the distances to the two range ends
|
|
6
11
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
12
|
+
* Error analysis (`u = eps/2` the unit roundoff, `fl(a∘b) = (a∘b)(1+δ)`,
|
|
13
|
+
* `|δ| <= u`): all inputs are doubles and each bound is computed with 3
|
|
14
|
+
* roundings per term path (subtraction, square, sum - `max` is exact) and
|
|
15
|
+
* widened with 1 more, so the computed bound is within a factor `(1±u)⁴` of
|
|
16
|
+
* the exact one before widening and `WIDEN >= 4u + O(u²)` makes the interval
|
|
17
|
+
* rigorous. (A gap of `0` is exact: `fl(a-b)` has the sign of `a-b`.)
|
|
18
|
+
*
|
|
19
|
+
* @param box the engulfing box given as `[[minX, minY], [maxX, maxY]]`
|
|
20
|
+
* @param p the point
|
|
9
21
|
*
|
|
10
22
|
* @internal
|
|
11
23
|
*/
|
|
@@ -1,60 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const qmq = ddMultDd;
|
|
4
|
-
const qaq = ddAddDd;
|
|
5
|
-
const eps = Number.EPSILON;
|
|
1
|
+
import { eps } from '../error-analysis/gamma.js';
|
|
2
|
+
const { max } = Math;
|
|
6
3
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Relative widening of the interval bounds - see the error analysis in
|
|
5
|
+
* `rootIntervalToDistanceSquaredInterval`: the exact first order requirement
|
|
6
|
+
* is `4u = 2eps` (`u = eps/2` the unit roundoff); `4eps = 2**-50` (exactly
|
|
7
|
+
* representable) leaves room for the `O(u²)` terms.
|
|
8
|
+
*/
|
|
9
|
+
const WIDEN = 4 * eps;
|
|
10
|
+
/**
|
|
11
|
+
* Returns an interval `[min, max]` guaranteed to contain the squared distance
|
|
12
|
+
* from the point `p` to *any* point of a curve piece, given an axis-aligned
|
|
13
|
+
* box that is guaranteed to engulf that piece (see `getIntervalBox`).
|
|
14
|
+
*
|
|
15
|
+
* * the minimum squared distance to the box is attained on its boundary (or
|
|
16
|
+
* is `0` if `p` is inside): per axis the distance is the gap between `p` and
|
|
17
|
+
* the box's range on that axis (`0` if `p` is within the range)
|
|
18
|
+
* * the maximum squared distance to the box is attained at a corner: per axis
|
|
19
|
+
* it is the larger of the distances to the two range ends
|
|
9
20
|
*
|
|
10
|
-
*
|
|
21
|
+
* Error analysis (`u = eps/2` the unit roundoff, `fl(a∘b) = (a∘b)(1+δ)`,
|
|
22
|
+
* `|δ| <= u`): all inputs are doubles and each bound is computed with 3
|
|
23
|
+
* roundings per term path (subtraction, square, sum - `max` is exact) and
|
|
24
|
+
* widened with 1 more, so the computed bound is within a factor `(1±u)⁴` of
|
|
25
|
+
* the exact one before widening and `WIDEN >= 4u + O(u²)` makes the interval
|
|
26
|
+
* rigorous. (A gap of `0` is exact: `fl(a-b)` has the sign of `a-b`.)
|
|
11
27
|
*
|
|
12
|
-
* @param box
|
|
13
|
-
* @param p
|
|
28
|
+
* @param box the engulfing box given as `[[minX, minY], [maxX, maxY]]`
|
|
29
|
+
* @param p the point
|
|
14
30
|
*
|
|
15
31
|
* @internal
|
|
16
32
|
*/
|
|
17
33
|
function rootIntervalToDistanceSquaredInterval(box, p) {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
for (const [a, b] of [[minX, minY], [minX, maxY], [maxX, minY], [maxX, maxY]]) {
|
|
30
|
-
/*
|
|
31
|
-
// distance to 1st corner of interval box - `distance² = x² + y²`
|
|
32
|
-
const dc1 = (a - x)**2 + (b - y)**2;
|
|
33
|
-
// max absolute roundoff error of `dc1`
|
|
34
|
-
// <4>dc1 <-- <4>(<3>(<1>(a - x)**2) + <3>(<1>((b - y)**2))
|
|
35
|
-
const dc1E = 4*γ1*((a + x)**2 + (b + y)**2);
|
|
36
|
-
const dc1Min = dc1 - dc1E; // distance minus max error
|
|
37
|
-
const dc1Max = dc1 + dc1E; // distance plus max error
|
|
38
|
-
*/
|
|
39
|
-
/** distance to 1st corner of interval box - `distance² = x² + y²` */
|
|
40
|
-
const ax = td(a, x); // a - x
|
|
41
|
-
const by = td(b, y); // b - y
|
|
42
|
-
// const dc1Exact = eadd(emult(ax,ax),emult(by,by)); // ax**2 + bx**2
|
|
43
|
-
// const dc1 = estimate(dc1Exact);
|
|
44
|
-
const dc1Dd = qaq(qmq(ax, ax), qmq(by, by)); // ax**2 + bx**2
|
|
45
|
-
const dc1 = dc1Dd[1];
|
|
46
|
-
// const dc1Min = dc1*(1 - 2**maxCoordPowerOf2*eps); // distance minus max error
|
|
47
|
-
// const dc1Max = dc1*(1 + 2**maxCoordPowerOf2*eps); // distance plus max error
|
|
48
|
-
const dc1Min = dc1 * (1 - eps); // distance minus max error
|
|
49
|
-
const dc1Max = dc1 * (1 + eps); // distance plus max error
|
|
50
|
-
if (dc1Min <= minDSquared) {
|
|
51
|
-
minDSquared = dc1Min;
|
|
52
|
-
}
|
|
53
|
-
if (dc1Max >= maxDSquared) {
|
|
54
|
-
maxDSquared = dc1Max;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return [minDSquared, maxDSquared];
|
|
34
|
+
const [[minX, minY], [maxX, maxY]] = box;
|
|
35
|
+
const [x, y] = p;
|
|
36
|
+
// per axis gap between `p` and the box (`0` if `p` is within range)
|
|
37
|
+
const dxMin = max(minX - x, 0, x - maxX);
|
|
38
|
+
const dyMin = max(minY - y, 0, y - maxY);
|
|
39
|
+
// per axis distance from `p` to the furthest end of the box's range
|
|
40
|
+
const dxMax = max(x - minX, maxX - x);
|
|
41
|
+
const dyMax = max(y - minY, maxY - y);
|
|
42
|
+
const minDSquared = dxMin * dxMin + dyMin * dyMin;
|
|
43
|
+
const maxDSquared = dxMax * dxMax + dyMax * dyMax;
|
|
44
|
+
return [minDSquared * (1 - WIDEN), maxDSquared * (1 + WIDEN)];
|
|
58
45
|
}
|
|
59
46
|
export { rootIntervalToDistanceSquaredInterval };
|
|
60
47
|
//# sourceMappingURL=root-interval-to-distance-squared-interval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-interval-to-distance-squared-interval.js","sourceRoot":"","sources":["../../src/closest-boundary-point/root-interval-to-distance-squared-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"root-interval-to-distance-squared-interval.js","sourceRoot":"","sources":["../../src/closest-boundary-point/root-interval-to-distance-squared-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAEjD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAErB;;;;;GAKG;AACH,MAAM,KAAK,GAAG,CAAC,GAAC,GAAG,CAAC;AAGpB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,qCAAqC,CACtC,GAAe,EACf,CAAW;IAEf,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IACzC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAEjB,oEAAoE;IACpE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACzC,oEAAoE;IACpE,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IAEtC,MAAM,WAAW,GAAG,KAAK,GAAC,KAAK,GAAG,KAAK,GAAC,KAAK,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,GAAC,KAAK,GAAG,KAAK,GAAC,KAAK,CAAC;IAE9C,OAAO,CAAC,WAAW,GAAC,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,WAAW,GAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC;AAGD,OAAO,EAAE,qCAAqC,EAAE,CAAA"}
|
|
@@ -7,4 +7,21 @@ import type { Corner } from "./corner.js";
|
|
|
7
7
|
* @param psO The outgoing bezier that starts at the corner
|
|
8
8
|
*/
|
|
9
9
|
declare function getCorner(psI: number[][], psO: number[][]): Corner;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Memoized version of `getCorner` (keyed on the two control point arrays).
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
declare const getCorner$: typeof getCorner & {
|
|
16
|
+
readonly weakMapS: WeakMap<object, {
|
|
17
|
+
readonly weakMap: WeakMap<object, any>;
|
|
18
|
+
readonly map: Map<object, any>;
|
|
19
|
+
}>;
|
|
20
|
+
readonly mapS: Map<object, {
|
|
21
|
+
readonly weakMap: WeakMap<object, any>;
|
|
22
|
+
readonly map: Map<object, any>;
|
|
23
|
+
}>;
|
|
24
|
+
readonly clearCache: () => void;
|
|
25
|
+
readonly addToCache: (r: unknown, ...args: any) => void;
|
|
26
|
+
};
|
|
27
|
+
export { getCorner, getCorner$ };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { memoize } from 'flo-memoize';
|
|
1
2
|
import { cross, toUnitVector } from "flo-vector2d";
|
|
2
3
|
import { getInterfaceCcw } from './get-interface-ccw.js';
|
|
3
4
|
/**
|
|
@@ -55,5 +56,11 @@ function getCorner(psI, psO) {
|
|
|
55
56
|
isQuiteDull
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Memoized version of `getCorner` (keyed on the two control point arrays).
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
const getCorner$ = memoize(getCorner);
|
|
65
|
+
export { getCorner, getCorner$ };
|
|
59
66
|
//# sourceMappingURL=get-corner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-corner.js","sourceRoot":"","sources":["../../src/corner/get-corner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD;;;GAGG;AACH,MAAM,OAAO,GAAG;IACZ,kBAAkB;IAClB,IAAI,EAAG,MAAM;IACb,CAAC,EAAM,MAAM;IACb,CAAC,EAAM,MAAM;IACb,EAAE,EAAK,MAAM;CAChB,CAAC;AAGF,gBAAgB;AAChB,mCAAmC;AACnC,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAChC,oCAAoC;AAGpC;;;;;;GAMG;AACH,SAAS,SAAS,CACV,GAAe,EACf,GAAe;IAEnB,0EAA0E;IAC1E,sDAAsD;IACtD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC;IACxB,MAAM,MAAM,GAAI,GAAG,GAAG,CAAC,CAAC;IAExB,+CAA+C;IAC/C,MAAM,YAAY,GAAG;QACjB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E,SAAS,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-interface-ccw.js","sourceRoot":"","sources":["../../src/corner/get-interface-ccw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"get-interface-ccw.js","sourceRoot":"","sources":["../../src/corner/get-interface-ccw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAGpF;;;;;;;;;;;;;;;GAeG;AACH,SAAS,eAAe,CAChB,GAAe,EACf,GAAe;IAQnB,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC;IAExB,8CAA8C;IAC9C,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,GAAC,CAAC,CAAC,CAAC;IACrB,yEAAyE;IACzE,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,yCAAyC;IACzC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAEhB,uDAAuD;IACvD,IAAI,WAAW,CAAC,EAAE,EAAC,EAAE,CAAC,EAAE,CAAC;QACrB,EAAE,GAAG,GAAG,CAAC,IAAI,GAAC,CAAC,CAAC,CAAC,CAAE,qBAAqB;IAC5C,CAAC;IACD,IAAI,WAAW,CAAC,EAAE,EAAC,EAAE,CAAC,EAAE,CAAC;QACrB,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAE,qBAAqB;IACvC,CAAC;IAED,MAAM,aAAa,GAAG,YAAY,CAAC,EAAE,EAAC,EAAE,EAAC,EAAE,CAAC,CAAC,CAAE,uBAAuB;IAEtE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,EAAE,CAAC,CAAC,CAAC,C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/point-on-shape.js';
|
|
|
23
23
|
* following other branches on the MAT.
|
|
24
24
|
*
|
|
25
25
|
* Call `getMatCurveBetween(cpNodeFrom, cpNodeTo)` or `getMatCurveToNext(cpNode)`
|
|
26
|
-
* (replacing the older CpNode.`matCurveToNextVertex`) to get
|
|
27
|
-
* from the maximal disk of this
|
|
28
|
-
* maximal disk and thus directly representing
|
|
26
|
+
* (replacing the older CpNode.`matCurveToNextVertex`) to get the bezier curves
|
|
27
|
+
* (1 or 2 lines or quadratics joined smoothly) from the maximal disk of this
|
|
28
|
+
* `CpNode` to the next `CpNode`'s maximal disk and thus directly representing
|
|
29
|
+
* a piece of the medial axis.
|
|
29
30
|
*
|
|
30
31
|
* The function, `getChildren`, returns the children of this `CpNode` when
|
|
31
32
|
* seen as a MAT edge. Only children in a 'forward' direction are returned. These
|
|
@@ -4,6 +4,15 @@ import { CpNode } from "../cp-node.js";
|
|
|
4
4
|
* @param cpNode
|
|
5
5
|
*/
|
|
6
6
|
declare function enhanceCpNode(cpNode: CpNode): {
|
|
7
|
+
id: number;
|
|
8
|
+
pointOnShape: import("../../index.js").PointOnShape;
|
|
9
|
+
isHoleClosing: boolean;
|
|
10
|
+
isIntersection: boolean;
|
|
11
|
+
prev: CpNode;
|
|
12
|
+
next: CpNode;
|
|
13
|
+
prevOnCircle: CpNode;
|
|
14
|
+
nextOnCircle: CpNode;
|
|
15
|
+
holeCloserTwin?: CpNode | undefined;
|
|
7
16
|
pos: import("../../index.js").PointOnShape;
|
|
8
17
|
p: number[];
|
|
9
18
|
t: number;
|
|
@@ -20,14 +29,5 @@ declare function enhanceCpNode(cpNode: CpNode): {
|
|
|
20
29
|
};
|
|
21
30
|
curve: import("flo-boolean").Curve;
|
|
22
31
|
loop: import("flo-boolean").Loop;
|
|
23
|
-
id: number;
|
|
24
|
-
pointOnShape: import("../../index.js").PointOnShape;
|
|
25
|
-
isHoleClosing: boolean;
|
|
26
|
-
isIntersection: boolean;
|
|
27
|
-
prev: CpNode;
|
|
28
|
-
next: CpNode;
|
|
29
|
-
prevOnCircle: CpNode;
|
|
30
|
-
nextOnCircle: CpNode;
|
|
31
|
-
holeCloserTwin?: CpNode | undefined;
|
|
32
32
|
};
|
|
33
33
|
export { enhanceCpNode };
|
|
@@ -10,10 +10,6 @@ function getAllOnLoop_ByLoop(cpNode) {
|
|
|
10
10
|
const cpNodess = [];
|
|
11
11
|
const cpStarts = [cpNode];
|
|
12
12
|
const cpStartSet = new Set(cpStarts);
|
|
13
|
-
if (cpNode.isHoleClosing) {
|
|
14
|
-
cpStartSet.add(cpNode.prevOnCircle.holeCloserTwin);
|
|
15
|
-
}
|
|
16
|
-
cpStartSet.add(cpNode);
|
|
17
13
|
while (cpStarts.length > 0) {
|
|
18
14
|
const cpNodes = [];
|
|
19
15
|
const cpStart = cpStarts.pop();
|
|
@@ -1 +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,MAAM,QAAQ,GAAa,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;
|
|
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,MAAM,QAAQ,GAAa,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAG,CAAC;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;QAC9C,IAAI,MAAM,GAAG,OAAO,CAAC;QAErB,GAAG,CAAC;YACA,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;YAC5C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACjB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACrB,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;gBACrB,SAAS;YACb,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,CAAC,cAAe,CAAC;YACpC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACrB,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,cAAe,CAAC,CAAC;gBAClD,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,cAAe,CAAC;QACzC,CAAC,QAAQ,MAAM,KAAK,OAAO,EAAE;QAE7B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAGD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { tangent } from "flo-bezier3";
|
|
2
2
|
import { cross, toUnitVector } from "flo-vector2d";
|
|
3
3
|
import { getMatCurveToNext } from "./get-mat-curve-to-next.js";
|
|
4
|
+
const { abs, asin, min, max, PI: π } = Math;
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
6
7
|
* @param cpNode1
|
|
@@ -8,10 +9,12 @@ import { getMatCurveToNext } from "./get-mat-curve-to-next.js";
|
|
|
8
9
|
* @returns
|
|
9
10
|
*/
|
|
10
11
|
function getInitialDegAngleBetweenMatCurves(cpNode1, cpNode2) {
|
|
11
|
-
const tan1 = toUnitVector(tangent(getMatCurveToNext(cpNode1), 0));
|
|
12
|
-
const tan2 = toUnitVector(tangent(getMatCurveToNext(cpNode2), 0));
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const tan1 = toUnitVector(tangent(getMatCurveToNext(cpNode1)[0], 0));
|
|
13
|
+
const tan2 = toUnitVector(tangent(getMatCurveToNext(cpNode2)[0], 0));
|
|
14
|
+
// clamp: rounding can push the cross product of two unit vectors just
|
|
15
|
+
// outside [-1,1], which would make `asin` return `NaN`
|
|
16
|
+
const cross_ = max(-1, min(1, cross(tan1, tan2)));
|
|
17
|
+
const angle = abs(asin(cross_) * (180 / π));
|
|
15
18
|
return angle;
|
|
16
19
|
}
|
|
17
20
|
export { getInitialDegAngleBetweenMatCurves };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-angle-between-mat-curves.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-angle-between-mat-curves.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-angle-between-mat-curves.js","sourceRoot":"","sources":["../../../src/cp-node/fs/get-angle-between-mat-curves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;AAG5C;;;;;GAKG;AACH,SAAS,kCAAkC,CACnC,OAAe,EACf,OAAe;IAEnB,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAC7B,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAC7B,CAAC,CACJ,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAC7B,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAC7B,CAAC,CACJ,CAAC,CAAC;IAEH,sEAAsE;IACtE,uDAAuD;IACvD,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAE,MAAM,CAAE,GAAG,CAAC,GAAG,GAAC,CAAC,CAAC,CAAC,CAAC;IAE5C,OAAO,KAAK,CAAC;AACjB,CAAC;AAGD,OAAO,EAAE,kCAAkC,EAAE,CAAA"}
|