flo-mat 2.0.4 → 3.0.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/.quokka +4 -0
- package/browser/index.js +18434 -14538
- package/browser/index.min.js +1 -1
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +9 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js +17 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.js +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.js +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.d.ts +25 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js +68 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +10 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js +2 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.js +2 -3
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +40 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js +42 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js.map +1 -0
- package/node/closest-boundary-point/get-p-from-box.d.ts +3 -0
- package/node/closest-boundary-point/get-p-from-box.js +11 -0
- package/node/closest-boundary-point/get-p-from-box.js.map +1 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +12 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +93 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +13 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +58 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -0
- package/node/{contact-point.d.ts → contact-point/contact-point.d.ts} +3 -3
- package/node/{contact-point.js → contact-point/contact-point.js} +1 -5
- package/node/contact-point/contact-point.js.map +1 -0
- package/node/{compare-curvatures-at-interface.js → corner/compare-curvatures-at-interface.js} +2 -2
- package/node/corner/compare-curvatures-at-interface.js.map +1 -0
- package/node/{mat → corner}/corner.d.ts +1 -1
- package/node/{mat → corner}/corner.js.map +1 -1
- package/node/corner/get-corner.d.ts +15 -0
- package/node/{curve.js → corner/get-corner.js} +6 -17
- package/node/corner/get-corner.js.map +1 -0
- package/node/{get-interface-ccw.js → corner/get-interface-ccw.js} +18 -33
- package/node/corner/get-interface-ccw.js.map +1 -0
- package/node/cp-node/clone.d.ts +1 -1
- package/node/cp-node/clone.js +6 -4
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +196 -0
- package/node/cp-node/cp-node.js +249 -0
- package/node/cp-node/cp-node.js.map +1 -0
- package/node/cp-node/create-cp-node.d.ts +4 -0
- package/node/cp-node/create-cp-node.js +8 -0
- package/node/cp-node/create-cp-node.js.map +1 -0
- package/node/cp-node/enhance-cp-node.d.ts +24 -0
- package/node/cp-node/enhance-cp-node.js +20 -0
- package/node/cp-node/enhance-cp-node.js.map +1 -0
- package/node/{get-boundary-bezier-parts-to-next.js → cp-node/get-boundary-bezier-parts-to-next.js} +1 -1
- package/node/cp-node/get-boundary-bezier-parts-to-next.js.map +1 -0
- package/node/{get-boundary-beziers-to-next.d.ts → cp-node/get-boundary-beziers-to-next.d.ts} +1 -1
- package/node/{get-boundary-beziers-to-next.js → cp-node/get-boundary-beziers-to-next.js} +1 -1
- package/node/cp-node/get-boundary-beziers-to-next.js.map +1 -0
- package/node/cp-node/get-cp-node-ordering.d.ts +8 -0
- package/node/cp-node/get-cp-node-ordering.js +12 -0
- package/node/cp-node/get-cp-node-ordering.js.map +1 -0
- package/node/{get-curve-to-next.js → cp-node/get-curve-to-next.js} +1 -1
- package/node/cp-node/get-curve-to-next.js.map +1 -0
- package/node/cp-node/remove.d.ts +1 -1
- package/node/cp-node/traverse-cp.d.ts +12 -0
- package/node/cp-node/traverse-cp.js +26 -0
- package/node/cp-node/traverse-cp.js.map +1 -0
- package/node/{traverse-edges.js → cp-node/traverse-edges.js} +4 -3
- package/node/cp-node/traverse-edges.js.map +1 -0
- package/node/{traverse-vertices.js → cp-node/traverse-vertices.js} +4 -3
- package/node/cp-node/traverse-vertices.js.map +1 -0
- package/node/{curve.d.ts → curve/curve.d.ts} +4 -17
- package/node/curve/curve.js +14 -0
- package/node/curve/curve.js.map +1 -0
- package/node/debug/cp-node-for-debugging.d.ts +2 -2
- package/node/debug/debug-elem-types.d.ts +8 -8
- package/node/debug/debug.d.ts +6 -6
- package/node/debug/debug.js +2 -2
- package/node/debug/debug.js.map +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +2 -2
- package/node/debug/functions/draw-elem/bounding-hull.js +3 -3
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.d.ts +2 -2
- package/node/debug/functions/draw-elem/branch.js +4 -3
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.d.ts +2 -2
- package/node/debug/functions/draw-elem/culls.js +2 -2
- package/node/debug/functions/draw-elem/culls.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/dull-corner.js +3 -4
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +2 -2
- package/node/debug/functions/draw-elem/leaves.js +1 -1
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loop.d.ts +2 -2
- package/node/debug/functions/draw-elem/loop.js +1 -2
- package/node/debug/functions/draw-elem/loop.js.map +1 -1
- package/node/debug/functions/draw-elem/loops.d.ts +1 -1
- package/node/debug/functions/draw-elem/loops.js +0 -1
- package/node/debug/functions/draw-elem/loops.js.map +1 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.d.ts +3 -3
- package/node/debug/functions/draw-elem/mat.js +9 -7
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.d.ts +2 -2
- package/node/debug/functions/draw-elem/max-vertex.js +1 -1
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.d.ts +3 -3
- package/node/debug/functions/draw-elem/min-y.js +2 -6
- package/node/debug/functions/draw-elem/min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong.js +6 -11
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/sharp-corner.js +3 -4
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/three-prong.js +8 -10
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/two-prong.js +7 -8
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.d.ts +4 -3
- package/node/debug/functions/draw-elem/vertex.js +11 -9
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +8 -8
- package/node/debug/functions/general.js +8 -8
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.d.ts +2 -2
- package/node/debug/functions/three-prong.js +10 -13
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +16 -5
- package/node/debug/functions/two-prong.js +56 -58
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/debug/three-prong-for-debugging.d.ts +6 -6
- package/node/debug/three-prong-for-debugging.js +1 -1
- package/node/debug/three-prong-for-debugging.js.map +1 -1
- package/node/debug/two-prong-for-debugging.d.ts +7 -7
- package/node/error-analysis/gamma.d.ts +26 -0
- package/node/error-analysis/gamma.js +35 -0
- package/node/error-analysis/gamma.js.map +1 -0
- package/node/find-2-prong/add-1-prong.d.ts +12 -0
- package/node/{mat/find-mat → find-2-prong}/add-1-prong.js +11 -11
- package/node/find-2-prong/add-1-prong.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.d.ts +6 -9
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.js +26 -74
- package/node/find-2-prong/add-2-prong.js.map +1 -0
- package/node/find-2-prong/add-debug-info.d.ts +8 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/add-debug-info.js +5 -4
- package/node/find-2-prong/add-debug-info.js.map +1 -0
- package/node/find-2-prong/cull-bezier-pieces.d.ts +11 -0
- package/node/find-2-prong/cull-bezier-pieces.js +28 -0
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/find-2-prong.d.ts +9 -13
- package/node/find-2-prong/find-2-prong.js +144 -0
- package/node/find-2-prong/find-2-prong.js.map +1 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.d.ts +15 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.js +5 -4
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs.d.ts +5 -5
- package/node/find-2-prong/find-and-add-2-prongs.js +60 -0
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.d.ts +3 -3
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.js +5 -5
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.d.ts +10 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js +56 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -0
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +15 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js +40 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -0
- package/node/find-2-prong/reduce-radius.d.ts +8 -0
- package/node/find-2-prong/reduce-radius.js +72 -0
- package/node/find-2-prong/reduce-radius.js.map +1 -0
- package/node/find-2-prong/squared-distance-between-dd.d.ts +2 -0
- package/node/find-2-prong/squared-distance-between-dd.js +17 -0
- package/node/find-2-prong/squared-distance-between-dd.js.map +1 -0
- package/node/find-2-prong/x-for-debugging.d.ts +9 -0
- package/node/find-2-prong/x-for-debugging.js.map +1 -0
- package/node/{mat/find-mat → find-3-prong.ts}/add-3-prong.d.ts +12 -7
- package/node/find-3-prong.ts/add-3-prong.js +82 -0
- package/node/find-3-prong.ts/add-3-prong.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.d.ts +4 -4
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.js +1 -1
- package/node/find-3-prong.ts/calc-better-x.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.d.ts +3 -3
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.js +5 -7
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.d.ts +6 -6
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.js +11 -12
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.d.ts +5 -5
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.js +52 -39
- package/node/find-3-prong.ts/find-3-prong.js.map +1 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.d.ts +5 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js +74 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-and-add-3-prongs.d.ts → find-3-prong.ts/find-and-add-all-3-prongs.d.ts} +3 -3
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js +66 -0
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/get-closest-points.d.ts +3 -3
- package/node/find-3-prong.ts/get-closest-points.js +14 -0
- package/node/find-3-prong.ts/get-closest-points.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/add-debug-info.d.ts +4 -4
- package/node/{mat/find-mat → find-mat}/add-debug-info.js +6 -6
- package/node/find-mat/add-debug-info.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.d.ts +5 -5
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.js +5 -6
- package/node/find-mat/create-initial-cp-graph.js.map +1 -0
- package/node/find-mat/find-mat.d.ts +10 -0
- package/node/find-mat/find-mat.js +57 -0
- package/node/find-mat/find-mat.js.map +1 -0
- package/node/{find-mats.d.ts → find-mat/find-mats.d.ts} +1 -1
- package/node/find-mat/find-mats.js +58 -0
- package/node/find-mat/find-mats.js.map +1 -0
- package/node/find-mat/fix-ordering.d.ts +8 -0
- package/node/find-mat/fix-ordering.js +59 -0
- package/node/find-mat/fix-ordering.js.map +1 -0
- package/node/find-mat/get-dull-corners.d.ts +5 -0
- package/node/find-mat/get-dull-corners.js +22 -0
- package/node/find-mat/get-dull-corners.js.map +1 -0
- package/node/find-mat/get-for-1-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js +28 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-for-2-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js +30 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-sharp-corners.d.ts +5 -0
- package/node/find-mat/get-sharp-corners.js +21 -0
- package/node/find-mat/get-sharp-corners.js.map +1 -0
- package/node/find-mat/get-size-params.d.ts +7 -0
- package/node/find-mat/get-size-params.js +33 -0
- package/node/find-mat/get-size-params.js.map +1 -0
- package/node/geometry/circle.js.map +1 -0
- package/node/geometry/get-bounding-box-.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.js +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.js +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -0
- package/node/get-curve/get-curve-between.d.ts +1 -1
- package/node/get-curve/get-curve-between.js +2 -2
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.d.ts +2 -2
- package/node/get-curve/get-edge-direction.js +2 -4
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/index.d.ts +24 -20
- package/node/index.js +21 -16
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.d.ts +1 -1
- package/node/loop/get-max-coordinate.js +1 -1
- package/node/mat/add-to-cp-graph.d.ts +8 -7
- package/node/mat/add-to-cp-graph.js +6 -4
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/bezier-piece.d.ts +2 -2
- package/node/mat/create-new-cp-tree.d.ts +3 -3
- package/node/mat/create-new-cp-tree.js +5 -7
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/elem-type-two-prong.d.ts +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
- package/node/mat/get-boundary-piece-beziers.js +4 -4
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/{get-branches.d.ts → mat/get-branches.d.ts} +1 -1
- package/node/{get-branches.js → mat/get-branches.js} +7 -6
- package/node/mat/get-branches.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +2 -2
- package/node/mat/get-largest-vertex.js +1 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/get-neighboring-cps.d.ts +6 -4
- package/node/mat/get-neighboring-cps.js +5 -3
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/get-two-prong-type.d.ts +1 -1
- package/node/mat/get-two-prong-type.js +1 -1
- package/node/mat/get-two-prong-type.js.map +1 -1
- package/node/mat/is-another-cp-closeby.d.ts +9 -8
- package/node/mat/is-another-cp-closeby.js +21 -29
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/{mat.d.ts → mat/mat.d.ts} +2 -2
- package/node/mat/mat.js.map +1 -0
- package/node/mat/simplify-mat-map-only.d.ts +1 -1
- package/node/mat/simplify-mat-map-only.js +4 -3
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/{simplify-mat.d.ts → mat/simplify-mat.d.ts} +3 -5
- package/node/{simplify-mat.js → mat/simplify-mat.js} +11 -13
- package/node/mat/simplify-mat.js.map +1 -0
- package/node/mat/trim-mat.d.ts +1 -1
- package/node/mat/trim-mat.js +1 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape/calc-pos-order.d.ts +13 -0
- package/node/point-on-shape/calc-pos-order.js +27 -0
- package/node/point-on-shape/calc-pos-order.js.map +1 -0
- package/node/point-on-shape/compare-poss.d.ts +10 -0
- package/node/point-on-shape/compare-poss.js +18 -0
- package/node/point-on-shape/compare-poss.js.map +1 -0
- package/node/point-on-shape/create-pos.d.ts +4 -0
- package/node/point-on-shape/create-pos.js +12 -0
- package/node/point-on-shape/create-pos.js.map +1 -0
- package/node/point-on-shape/get-osculating-circle.d.ts +10 -0
- package/node/point-on-shape/get-osculating-circle.js +25 -0
- package/node/point-on-shape/get-osculating-circle.js.map +1 -0
- package/node/point-on-shape/get-pos-corner.d.ts +7 -0
- package/node/point-on-shape/get-pos-corner.js +9 -0
- package/node/point-on-shape/get-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-corner.js +8 -0
- package/node/point-on-shape/is-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-dull-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-dull-corner.js +14 -0
- package/node/point-on-shape/is-pos-dull-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -0
- package/node/point-on-shape/point-on-shape.d.ts +11 -0
- package/node/point-on-shape/point-on-shape.js +2 -0
- package/node/point-on-shape/point-on-shape.js.map +1 -0
- package/node/point-on-shape/pos-to-human-string.d.ts +8 -0
- package/node/point-on-shape/pos-to-human-string.js +12 -0
- package/node/point-on-shape/pos-to-human-string.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/add-debug-info.d.ts +2 -2
- package/node/{mat/to-scale-axis → sat}/add-debug-info.js +1 -1
- package/node/sat/add-debug-info.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.js +6 -6
- package/node/sat/cull-non-cycles.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull.js +4 -4
- package/node/sat/cull.js.map +1 -0
- package/node/{mat → sat}/get-leaves.d.ts +2 -2
- package/node/sat/get-leaves.js +14 -0
- package/node/sat/get-leaves.js.map +1 -0
- package/node/{to-scale-axis.d.ts → sat/to-scale-axis.d.ts} +2 -2
- package/node/{to-scale-axis.js → sat/to-scale-axis.js} +11 -10
- package/node/sat/to-scale-axis.js.map +1 -0
- package/node/svg/get-loop-bounds.d.ts +7 -7
- package/node/svg/get-loop-bounds.js +11 -7
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +4 -4
- package/node/svg/get-min-y-pos.js +1 -1
- package/node/svg/get-shape-bounds.d.ts +6 -5
- package/node/svg/get-shape-bounds.js +6 -2
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.d.ts +1 -1
- package/node/sweep-line/sweep-line.js +4 -4
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/package.json +10 -10
- package/src/closest-boundary-point/closest-points-on-curve-precise.ts +75 -0
- package/src/closest-boundary-point/closest-points-on-curve.ts +72 -0
- package/src/closest-boundary-point/cull-bezier-pieces.ts +35 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.ts +4 -3
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.ts +2 -2
- package/src/closest-boundary-point/dd-deflate-with-running-error.ts +88 -0
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +16 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.ts +3 -4
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +69 -0
- package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +70 -0
- package/src/closest-boundary-point/get-p-from-box.ts +14 -0
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +122 -0
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +75 -0
- package/src/{contact-point.ts → contact-point/contact-point.ts} +4 -6
- package/src/{compare-curvatures-at-interface.ts → corner/compare-curvatures-at-interface.ts} +2 -2
- package/src/{mat → corner}/corner.ts +1 -1
- package/src/{curve.ts → corner/get-corner.ts} +10 -49
- package/src/{get-interface-ccw.ts → corner/get-interface-ccw.ts} +28 -35
- package/src/cp-node/clone.ts +17 -6
- package/src/cp-node/cp-node.ts +422 -0
- package/src/cp-node/create-cp-node.ts +21 -0
- package/src/cp-node/enhance-cp-node.ts +27 -0
- package/src/{get-boundary-bezier-parts-to-next.ts → cp-node/get-boundary-bezier-parts-to-next.ts} +3 -3
- package/src/{get-boundary-beziers-to-next.ts → cp-node/get-boundary-beziers-to-next.ts} +2 -2
- package/src/cp-node/get-cp-node-ordering.ts +17 -0
- package/src/{get-curve-to-next.ts → cp-node/get-curve-to-next.ts} +1 -1
- package/src/cp-node/remove.ts +1 -1
- package/src/cp-node/traverse-cp.ts +35 -0
- package/src/{traverse-edges.ts → cp-node/traverse-edges.ts} +5 -5
- package/src/{traverse-vertices.ts → cp-node/traverse-vertices.ts} +5 -5
- package/src/curve/curve.ts +46 -0
- package/src/debug/cp-node-for-debugging.ts +2 -2
- package/src/debug/debug-elem-types.ts +8 -8
- package/src/debug/debug.ts +11 -11
- package/src/debug/functions/draw-elem/bounding-hull.ts +5 -3
- package/src/debug/functions/draw-elem/branch.ts +4 -4
- package/src/debug/functions/draw-elem/culls.ts +3 -3
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +1 -1
- package/src/debug/functions/draw-elem/draw-elem.ts +10 -6
- package/src/debug/functions/draw-elem/dull-corner.ts +10 -6
- package/src/debug/functions/draw-elem/leaves.ts +2 -2
- package/src/debug/functions/draw-elem/loop.ts +4 -3
- package/src/debug/functions/draw-elem/loops.ts +1 -2
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +8 -3
- package/src/debug/functions/draw-elem/mat.ts +16 -8
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +4 -9
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +10 -2
- package/src/debug/functions/draw-elem/one-prong.ts +12 -15
- package/src/debug/functions/draw-elem/sharp-corner.ts +10 -6
- package/src/debug/functions/draw-elem/three-prong.ts +13 -11
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +9 -3
- package/src/debug/functions/draw-elem/two-prong.ts +12 -8
- package/src/debug/functions/draw-elem/vertex.ts +12 -11
- package/src/debug/functions/general.ts +10 -10
- package/src/debug/functions/three-prong.ts +16 -20
- package/src/debug/functions/two-prong.ts +89 -77
- package/src/debug/three-prong-for-debugging.ts +17 -16
- package/src/debug/two-prong-for-debugging.ts +7 -7
- package/src/error-analysis/gamma.ts +41 -0
- package/src/{mat/find-mat → find-2-prong}/add-1-prong.ts +19 -16
- package/src/{mat/find-mat → find-2-prong}/add-2-prong.ts +45 -91
- package/src/find-2-prong/add-debug-info.ts +49 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/cull-bezier-pieces.ts +9 -11
- package/src/find-2-prong/find-2-prong.ts +191 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.ts +12 -9
- package/src/find-2-prong/find-and-add-2-prongs.ts +88 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.ts +7 -7
- package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +77 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line.ts +1 -1
- package/src/find-2-prong/get-initial-bezier-pieces.ts +61 -0
- package/src/find-2-prong/pyth-trips.ts +146 -0
- package/src/find-2-prong/reduce-radius.ts +98 -0
- package/src/find-2-prong/squared-distance-between-dd.ts +25 -0
- package/src/find-2-prong/x-for-debugging.ts +13 -0
- package/src/find-3-prong.ts/add-3-prong.ts +110 -0
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.ts +5 -5
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.ts +11 -12
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.ts +28 -28
- package/src/find-3-prong.ts/find-3-prong.ts +148 -0
- package/src/find-3-prong.ts/find-and-add-3-prongs.ts +111 -0
- package/src/find-3-prong.ts/find-and-add-all-3-prongs.ts +109 -0
- package/src/find-3-prong.ts/get-closest-points.ts +24 -0
- package/src/{mat/find-mat → find-mat}/add-debug-info.ts +10 -10
- package/src/{mat/find-mat → find-mat}/create-initial-cp-graph.ts +11 -12
- package/src/find-mat/find-mat.ts +89 -0
- package/src/find-mat/find-mats.ts +83 -0
- package/src/find-mat/fix-ordering.ts +69 -0
- package/src/find-mat/get-dull-corners.ts +34 -0
- package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -0
- package/src/find-mat/get-for-2-prongs-on-loop.ts +44 -0
- package/src/find-mat/get-sharp-corners.ts +33 -0
- package/src/find-mat/get-size-params.ts +34 -0
- package/src/{mat/find-mat → find-mat}/get-total-by.ts +4 -4
- package/src/{mat/geometry → geometry}/get-closest-square-distance-to-rect.ts +1 -1
- package/src/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.ts +2 -2
- package/src/get-curve/get-curve-between.ts +7 -7
- package/src/get-curve/get-edge-direction.ts +11 -11
- package/src/index.ts +64 -21
- package/src/loop/get-max-coordinate.ts +1 -1
- package/src/mat/add-to-cp-graph.ts +15 -12
- package/src/mat/bezier-piece.ts +2 -2
- package/src/mat/cmp-cp-on-delta.ts +6 -3
- package/src/mat/create-new-cp-tree.ts +6 -9
- package/src/mat/elem-type-two-prong.ts +1 -1
- package/src/mat/get-boundary-piece-beziers.ts +7 -7
- package/src/{get-branches.ts → mat/get-branches.ts} +8 -8
- package/src/mat/get-edges-as-array.ts +2 -2
- package/src/mat/get-largest-three-prong.ts +3 -3
- package/src/mat/get-largest-vertex.ts +2 -2
- package/src/mat/get-neighboring-cps.ts +9 -6
- package/src/mat/get-two-prong-type.ts +1 -1
- package/src/mat/is-another-cp-closeby.ts +29 -44
- package/src/{mat.ts → mat/mat.ts} +2 -2
- package/src/mat/simplify-mat-map-only.ts +5 -5
- package/src/{simplify-mat.ts → mat/simplify-mat.ts} +12 -14
- package/src/mat/trim-mat.ts +3 -3
- package/src/point-on-shape/calc-pos-order.ts +35 -0
- package/src/point-on-shape/compare-poss.ts +26 -0
- package/src/point-on-shape/create-pos.ts +21 -0
- package/src/point-on-shape/get-osculating-circle.ts +39 -0
- package/src/point-on-shape/get-pos-corner.ts +16 -0
- package/src/point-on-shape/is-pos-corner.ts +12 -0
- package/src/point-on-shape/is-pos-dull-corner.ts +16 -0
- package/src/point-on-shape/is-pos-quite-dull-corner.ts +17 -0
- package/src/point-on-shape/is-pos-quite-sharp-corner.ts +17 -0
- package/src/point-on-shape/is-pos-sharp-corner.ts +17 -0
- package/src/point-on-shape/point-on-shape.ts +15 -0
- package/src/point-on-shape/pos-to-human-string.ts +16 -0
- package/src/{mat/to-scale-axis → sat}/add-debug-info.ts +3 -3
- package/src/{mat/to-scale-axis → sat}/cull-non-cycles.ts +7 -7
- package/src/{mat/to-scale-axis → sat}/cull.ts +6 -6
- package/src/{mat → sat}/get-leaves.ts +4 -4
- package/src/{mat/to-scale-axis → sat}/t-tree.ts +2 -2
- package/src/{to-scale-axis.ts → sat/to-scale-axis.ts} +16 -16
- package/src/{mat/to-scale-axis → sat}/traverse-spacial-tree.ts +5 -5
- package/src/svg/get-loop-bounds.ts +22 -17
- package/src/svg/get-min-y-pos.ts +3 -3
- package/src/svg/get-shape-bounds.ts +12 -9
- package/src/sweep-line/are-boxes-intersecting.ts +1 -1
- package/src/sweep-line/sweep-line.ts +7 -7
- package/tsconfig.json +3 -7
- package/wallaby.mjs +32 -0
- package/node/circle.js.map +0 -1
- package/node/compare-curvatures-at-interface.js.map +0 -1
- package/node/contact-point.js.map +0 -1
- package/node/cp-node.d.ts +0 -202
- package/node/cp-node.js +0 -321
- package/node/cp-node.js.map +0 -1
- package/node/curve.js.map +0 -1
- package/node/find-mats.js +0 -123
- package/node/find-mats.js.map +0 -1
- package/node/get-boundary-bezier-parts-to-next.js.map +0 -1
- package/node/get-boundary-beziers-to-next.js.map +0 -1
- package/node/get-bounding-box-.js.map +0 -1
- package/node/get-branches.js.map +0 -1
- package/node/get-curve-to-next.js.map +0 -1
- package/node/get-interface-ccw.js.map +0 -1
- package/node/loop.d.ts +0 -16
- package/node/loop.js +0 -35
- package/node/loop.js.map +0 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +0 -14
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +0 -73
- package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +0 -9
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +0 -20
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +0 -1
- package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +0 -17
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +0 -81
- package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +0 -1
- package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +0 -18
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +0 -41
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +0 -1
- package/node/mat/find-mat/add-1-prong.d.ts +0 -12
- package/node/mat/find-mat/add-1-prong.js.map +0 -1
- package/node/mat/find-mat/add-2-prong.js.map +0 -1
- package/node/mat/find-mat/add-3-prong.js +0 -55
- package/node/mat/find-mat/add-3-prong.js.map +0 -1
- package/node/mat/find-mat/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +0 -11
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +0 -52
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +0 -1
- package/node/mat/find-mat/create-initial-cp-graph.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +0 -8
- package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +0 -30
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +0 -233
- package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +0 -40
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +0 -38
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/x-for-debugging.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +0 -17
- package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +0 -15
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs.js +0 -74
- package/node/mat/find-mat/find-and-add-2-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-3-prongs.js +0 -147
- package/node/mat/find-mat/find-and-add-3-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-potential-2-prongs.d.ts +0 -4
- package/node/mat/find-mat/get-potential-2-prongs.js +0 -17
- package/node/mat/find-mat/get-potential-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-sharp-corners.d.ts +0 -4
- package/node/mat/find-mat/get-sharp-corners.js +0 -18
- package/node/mat/find-mat/get-sharp-corners.js.map +0 -1
- package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +0 -1
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +0 -1
- package/node/mat/get-contact-circles-at-interface.d.ts +0 -8
- package/node/mat/get-contact-circles-at-interface.js +0 -21
- package/node/mat/get-contact-circles-at-interface.js.map +0 -1
- package/node/mat/get-leaves.js +0 -13
- package/node/mat/get-leaves.js.map +0 -1
- package/node/mat/to-scale-axis/add-debug-info.js.map +0 -1
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +0 -1
- package/node/mat/to-scale-axis/cull.js.map +0 -1
- package/node/mat.js.map +0 -1
- package/node/point-on-shape.d.ts +0 -73
- package/node/point-on-shape.js +0 -168
- package/node/point-on-shape.js.map +0 -1
- package/node/simplify-mat.js.map +0 -1
- package/node/to-scale-axis.js.map +0 -1
- package/node/traverse-edges.js.map +0 -1
- package/node/traverse-vertices.js.map +0 -1
- package/src/cp-node.ts +0 -388
- package/src/find-mats.ts +0 -171
- package/src/loop.ts +0 -56
- package/src/mat/closest-boundary-point/closest-point-on-curve-old.ts_ +0 -88
- package/src/mat/closest-boundary-point/closest-point-on-curve.ts_ +0 -95
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +0 -84
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +0 -38
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +0 -107
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +0 -64
- package/src/mat/find-mat/add-3-prong.ts +0 -75
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +0 -73
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +0 -46
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +0 -316
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +0 -52
- package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +0 -13
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +0 -106
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +0 -28
- package/src/mat/find-mat/find-and-add-2-prongs.ts +0 -108
- package/src/mat/find-mat/find-and-add-3-prongs.ts +0 -218
- package/src/mat/find-mat/get-potential-2-prongs.ts +0 -24
- package/src/mat/find-mat/get-sharp-corners.ts +0 -25
- package/src/mat/find-mat/get-total-abs-curvature.ts +0 -17
- package/src/mat/get-contact-circles-at-interface.ts +0 -26
- package/src/mat/to-scale-axis/add-to-tree.ts +0 -66
- package/src/mat/to-scale-axis/calc-groups.ts +0 -82
- package/src/mat/to-scale-axis/create-spacial-tree.ts +0 -41
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +0 -135
- package/src/point-on-shape.ts +0 -231
- package/src/svg/get-curvature-at-interface.ts +0 -55
- /package/node/{compare-curvatures-at-interface.d.ts → corner/compare-curvatures-at-interface.d.ts} +0 -0
- /package/node/{mat → corner}/corner.js +0 -0
- /package/node/{get-interface-ccw.d.ts → corner/get-interface-ccw.d.ts} +0 -0
- /package/node/{get-boundary-bezier-parts-to-next.d.ts → cp-node/get-boundary-bezier-parts-to-next.d.ts} +0 -0
- /package/node/{get-curve-to-next.d.ts → cp-node/get-curve-to-next.d.ts} +0 -0
- /package/node/{traverse-edges.d.ts → cp-node/traverse-edges.d.ts} +0 -0
- /package/node/{traverse-vertices.d.ts → cp-node/traverse-vertices.d.ts} +0 -0
- /package/node/{mat/find-mat/find-2-prong → find-2-prong}/x-for-debugging.js +0 -0
- /package/node/{circle.d.ts → geometry/circle.d.ts} +0 -0
- /package/node/{circle.js → geometry/circle.js} +0 -0
- /package/node/{get-bounding-box-.d.ts → geometry/get-bounding-box-.d.ts} +0 -0
- /package/node/{get-bounding-box-.js → geometry/get-bounding-box-.js} +0 -0
- /package/node/{mat.js → mat/mat.js} +0 -0
- /package/src/{circle.ts → geometry/circle.ts} +0 -0
- /package/src/{get-bounding-box-.ts → geometry/get-bounding-box-.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-vertices.js","sourceRoot":"","sources":["../src/traverse-vertices.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACvB,MAAc,EACd,CAA2B;IAE5B,CAAC,CAAC,MAAM,CAAC,CAAC;IAEV,wEAAwE;IACxE,iBAAiB;IACjB,MAAM,CAAC,kBAAkB,EAAE;SACzB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;SACzC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC1B,OAAO,CAAC,EAAE,CAAC,CAAC;IAEd,SAAS,EAAE,CAAC,MAAc;QACzB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC,MAAM,EAAE;YAClB,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;YACrB,CAAC,CAAC,EAAE,CAAC,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;SAC/B;IACF,CAAC;AACF,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
package/src/cp-node.ts
DELETED
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
declare const _debug_: Debug;
|
|
3
|
-
|
|
4
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
|
-
import { Debug } from './debug/debug.js';
|
|
6
|
-
import { ContactPoint, compareCps } from './contact-point.js';
|
|
7
|
-
import { removeCpNode } from './cp-node/remove.js';
|
|
8
|
-
import { getCurveToNext } from './get-curve-to-next.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The primary class of the library.
|
|
13
|
-
*
|
|
14
|
-
* Since the MAT is a full representation of the shape boundary an instance of
|
|
15
|
-
* this class contains both the information of a boundary point and a medial
|
|
16
|
-
* axis point (and edge to the next point(s)). It also contains edges to other
|
|
17
|
-
* [[CpNode]]s which allows for traversal of the MAT and thus implictly
|
|
18
|
-
* represents the entire MAT.
|
|
19
|
-
*
|
|
20
|
-
* To get the maximal disk circle (of which the center is on the medial axis)
|
|
21
|
-
* use [[cp]].circle.
|
|
22
|
-
*
|
|
23
|
-
* To get the boundary point, use [[cp]].pointOnShape.
|
|
24
|
-
*
|
|
25
|
-
* The edge [[next]] (resp. [[prev]]) allows one to move anti-clockwise (resp.
|
|
26
|
-
* clockwise) on the shape boundary to the next [[CpNode]]. This also imposes a
|
|
27
|
-
* direction of traversal of the MAT edges and vertices.
|
|
28
|
-
*
|
|
29
|
-
* The edge [[nextOnCircle]] (resp. [[prevOnCircle]]) allows one to go
|
|
30
|
-
* anti-clockwise (resp. clockwise) around the maximal disks implied by
|
|
31
|
-
* the CpNode to the next maximal disk contact point. This is equivalent to
|
|
32
|
-
* following other branches on the MAT.
|
|
33
|
-
*
|
|
34
|
-
* Call [[getCurveBetween]](cpNodeFrom, cpNodeTo) or getCurveToNext(cpNode)
|
|
35
|
-
* (replacing the older CpNode.[[matCurveToNextVertex]]) to get a bezier curve
|
|
36
|
-
* from the maximal disk of this [[CpNode]] to the next [[CpNode]]'s
|
|
37
|
-
* maximal disk and thus directly representing a piece of the medial axis.
|
|
38
|
-
*
|
|
39
|
-
* The function, [[getChildren]], returns the children of this [[CpNode]] when
|
|
40
|
-
* seen as a MAT edge. Only children in a 'forward' direction are returned. These
|
|
41
|
-
* include all edges except the 'backward' edge given by [[prevOnCircle]]. For
|
|
42
|
-
* [[CpNode]]s having a maximal disk with 2 contact points (a 2-prong, the usual
|
|
43
|
-
* case) the children will be the single edge [[next]]. For a 3-prong this will
|
|
44
|
-
* be the edges [[next]] and [[nextOnCircle]], etc. [[getChildren]] allows one to
|
|
45
|
-
* easily traverse the MAT tree - see e.g. the implementation of [[traverseEdges]].
|
|
46
|
-
*
|
|
47
|
-
* The getter, [[vertexChildren]], is similar to [[getChildren]] but returns the
|
|
48
|
-
* child nodes of the tree when [[CpNode]] is seen as a MAT vertex point (as
|
|
49
|
-
* opposed to edge). In this way the dual graph of the tree can easily be
|
|
50
|
-
* traversed - see e.g. [[traverseVertices]]. Generally, however, traversing the
|
|
51
|
-
* edges is preferred as it returns the entire Medial Axis (by utilizing
|
|
52
|
-
* [[getCurveToNext]] on each returned edge).
|
|
53
|
-
*
|
|
54
|
-
* It may be worth mentioning that by traversing from the CpNode by following
|
|
55
|
-
* [[next]] repeatedly until one is back at the same CpNode allows one
|
|
56
|
-
* to 'go around' the shape boundary and at the same time traverse the MAT twice
|
|
57
|
-
* in opposite directions.
|
|
58
|
-
*/
|
|
59
|
-
class CpNode {
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Primarily for internal use.
|
|
63
|
-
* @param cp The shape boundary contact point, i.e. a [[CpNode]] without its
|
|
64
|
-
* edges.
|
|
65
|
-
* @param isHoleClosing If true, this [[CpNode]] belongs to a hole-closing
|
|
66
|
-
* maximal disk.
|
|
67
|
-
* @param isIntersection true if this cpNode is at a shape boundary
|
|
68
|
-
* intersection point, false otherwise
|
|
69
|
-
* @param prev The previous (going clockwise around the boundary) contact
|
|
70
|
-
* point ([[CpNode]]).
|
|
71
|
-
* @param next The next (going anti-clockwise around the boundary) contact
|
|
72
|
-
* point ([[CpNode]]).
|
|
73
|
-
* @param prevOnCircle The previous [[CpNode]] (going clockwise around
|
|
74
|
-
* the inscribed circle defined by the maximal disk).
|
|
75
|
-
* @param nextOnCircle The next [[CpNode]] (going anti-clockwise around
|
|
76
|
-
* the inscribed circle defined by the maximal disk).
|
|
77
|
-
*/
|
|
78
|
-
constructor(
|
|
79
|
-
public readonly cp : ContactPoint,
|
|
80
|
-
public isHoleClosing : boolean,
|
|
81
|
-
public isIntersection : boolean,
|
|
82
|
-
public prev : CpNode = undefined,
|
|
83
|
-
public next : CpNode = undefined,
|
|
84
|
-
public prevOnCircle : CpNode = undefined,
|
|
85
|
-
public nextOnCircle : CpNode = undefined) {
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Returns the bezier curve from the maximal disk of this [[CpNode]] to the
|
|
91
|
-
* next [[CpNode]]'s maximal disk and thus directly represents a piece of the
|
|
92
|
-
* medial axis.
|
|
93
|
-
* @deprecated Use [[getCurveToNext]] instead
|
|
94
|
-
* @param cpNode
|
|
95
|
-
*/
|
|
96
|
-
get matCurveToNextVertex() {
|
|
97
|
-
return getCurveToNext(this);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Primarily for internal use.
|
|
103
|
-
*
|
|
104
|
-
* Compares the order of two [[CpNode]]s. The order is cyclic and depends
|
|
105
|
-
* on a [[CpNode]]'s relative position along the shape boundary.
|
|
106
|
-
*/
|
|
107
|
-
static comparator =
|
|
108
|
-
(a: CpNode, b: CpNode) => compareCps(a.cp, b.cp);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Returns the children of this [[CpNode]] when seen as a MAT edge. Only
|
|
113
|
-
* children in a 'forward' direction are returned. These include all edges
|
|
114
|
-
* except the 'backward' edge given by [[prevOnCircle]], even terminating
|
|
115
|
-
* edges.
|
|
116
|
-
*/
|
|
117
|
-
getChildren() {
|
|
118
|
-
const children: CpNode[] = [];
|
|
119
|
-
|
|
120
|
-
const cp = this.next;
|
|
121
|
-
let cp_ = cp;
|
|
122
|
-
do {
|
|
123
|
-
children.push(cp_);
|
|
124
|
-
cp_ = cp_.nextOnCircle;
|
|
125
|
-
} while (cp_.nextOnCircle !== cp);
|
|
126
|
-
|
|
127
|
-
return children;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static remove = removeCpNode;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Similar to [[getChildren]] but returns the child nodes of the tree when
|
|
135
|
-
* [[CpNode]] is seen as a MAT vertex point (as opposed to edge). In this
|
|
136
|
-
* way the dual graph of the tree can easily be traversed - see e.g.
|
|
137
|
-
* [[traverseVertices]]. Generally, however, traversing the edges is
|
|
138
|
-
* preferred as it returns the entire Medial Axis (by utilizing
|
|
139
|
-
* [[getCurveToNext]] on each returned edge).
|
|
140
|
-
*/
|
|
141
|
-
get vertexChildren() {
|
|
142
|
-
if (this.isTerminating()) { return []; }
|
|
143
|
-
|
|
144
|
-
const cp: CpNode = this;
|
|
145
|
-
const children: CpNode[] = [];
|
|
146
|
-
|
|
147
|
-
let cp_ = cp;
|
|
148
|
-
while (cp_ !== cp.prevOnCircle) {
|
|
149
|
-
if (!cp_.isTerminating()) { children.push(cp_.next); }
|
|
150
|
-
cp_ = cp_.nextOnCircle;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return children;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Returns all [[CpNode]]s on the MAT that this [[CpNode]] is part of
|
|
159
|
-
* starting from the current one and going anti-clockwise around the shape.
|
|
160
|
-
*/
|
|
161
|
-
public getAllOnLoop() {
|
|
162
|
-
const cpStart: CpNode = this;
|
|
163
|
-
const cps: CpNode[] = [cpStart];
|
|
164
|
-
let cp: CpNode = this.next;
|
|
165
|
-
|
|
166
|
-
while (cp !== cpStart) {
|
|
167
|
-
cps.push(cp);
|
|
168
|
-
cp = cp.next;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return cps;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Primarily for internal use.
|
|
177
|
-
*
|
|
178
|
-
* Insert a [[CpNode]] into the MAT tree graph after the specified point
|
|
179
|
-
* and returns the freshly inserted [[CpNode]].
|
|
180
|
-
* @param isHoleClosing True if this is a hole closing contact point.
|
|
181
|
-
* @param isIntersection True if this is a contact point at a shape boundary
|
|
182
|
-
* intersection point.
|
|
183
|
-
* @param cpTree The tree graph holding the [[CpNodes]] of the MAT.
|
|
184
|
-
* @param cp [[ContactPoint]] defining the [[CpNode]].
|
|
185
|
-
* @param prev_ Inserts the new [[CpNode]] right after this item if the
|
|
186
|
-
* loop is not empty, else insert the new [[CpNode]] as the only item in the
|
|
187
|
-
* loop.
|
|
188
|
-
*/
|
|
189
|
-
public static insert(
|
|
190
|
-
isHoleClosing: boolean,
|
|
191
|
-
isIntersection: boolean,
|
|
192
|
-
cpTree: LlRbTree<CpNode>,
|
|
193
|
-
cp: ContactPoint,
|
|
194
|
-
prev_: CpNode) {
|
|
195
|
-
|
|
196
|
-
const cpNode = new CpNode(cp, isHoleClosing, isIntersection);
|
|
197
|
-
if (typeof _debug_ !== 'undefined') {
|
|
198
|
-
_debug_.generated.elems.cpNode.push({
|
|
199
|
-
generated: _debug_.generated,
|
|
200
|
-
cpNode
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
let prev;
|
|
205
|
-
let next;
|
|
206
|
-
|
|
207
|
-
if (!prev_) {
|
|
208
|
-
prev = cpNode;
|
|
209
|
-
next = cpNode;
|
|
210
|
-
} else {
|
|
211
|
-
prev = prev_;
|
|
212
|
-
next = prev.next;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
next.prev = cpNode;
|
|
216
|
-
prev.next = cpNode;
|
|
217
|
-
|
|
218
|
-
cpNode.prev = prev;
|
|
219
|
-
cpNode.next = next;
|
|
220
|
-
|
|
221
|
-
cpTree.insert(cpNode);
|
|
222
|
-
|
|
223
|
-
return cpNode;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Return this (except if exclThis is truthy) and the the other CpNodes
|
|
229
|
-
* around the maximal disk vertex circle in an anti-clockwise order.
|
|
230
|
-
* @param exclThis If true the returned array does not include this
|
|
231
|
-
* [[CpNode]].
|
|
232
|
-
*/
|
|
233
|
-
public getCpNodesOnCircle(exclThis = false) {
|
|
234
|
-
const startCp = this as CpNode;
|
|
235
|
-
let cp = startCp;
|
|
236
|
-
|
|
237
|
-
const cps: CpNode[] = [];
|
|
238
|
-
do {
|
|
239
|
-
if (exclThis) {
|
|
240
|
-
exclThis = false;
|
|
241
|
-
} else {
|
|
242
|
-
cps.push(cp);
|
|
243
|
-
}
|
|
244
|
-
cp = cp.nextOnCircle;
|
|
245
|
-
} while (cp !== startCp)
|
|
246
|
-
|
|
247
|
-
return cps;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Returns true if the 2 given [[CpNode]]s are on the same maximal disk
|
|
253
|
-
* circle.
|
|
254
|
-
* @param cpNode1 A [[CpNode]].
|
|
255
|
-
* @param cpNode2 Another [[CpNode]]
|
|
256
|
-
*/
|
|
257
|
-
static isOnSameCircle(cpNode1: CpNode, cpNode2: CpNode) {
|
|
258
|
-
const cpNodes = cpNode1.getCpNodesOnCircle(true);
|
|
259
|
-
|
|
260
|
-
return cpNodes.indexOf(cpNode2) >= 0;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Returns true if this [[CpNode]] is terminating, i.e. implies a leaf MAT
|
|
266
|
-
* vertex.
|
|
267
|
-
*
|
|
268
|
-
* This is always the case for sharp corners and maximal disks with
|
|
269
|
-
* a single contact point. Note, however, that even in these cases there are
|
|
270
|
-
* two contact points stored (sitting 'on top' of each other) for the
|
|
271
|
-
* maximal disk. It can be seen as a limiting case of a two-prong where the
|
|
272
|
-
* distance between two of the contact points tend to zero. One point
|
|
273
|
-
* (represented by a [[CpNode]] of course) will be terminating with the
|
|
274
|
-
* other point being its [[next]], whereas the other point will *not* be
|
|
275
|
-
* terminating and 'points' back into the shape.
|
|
276
|
-
*/
|
|
277
|
-
public isTerminating() {
|
|
278
|
-
return this === this.next.prevOnCircle;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Like isTerminating() but only returns true if all cpNodes on the circle
|
|
284
|
-
* (except this.prevOnCircle) is terminating.
|
|
285
|
-
*/
|
|
286
|
-
public isFullyTerminating() {
|
|
287
|
-
const otherOnCircle = this.prevOnCircle.getCpNodesOnCircle(true);
|
|
288
|
-
const isFullyTerminating = otherOnCircle.every(cpNode => cpNode.isTerminating());
|
|
289
|
-
|
|
290
|
-
return isFullyTerminating;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Returns the first [[CpNode]] (from this one by successively applying
|
|
296
|
-
* .nextOnCircle) that exits the circle.
|
|
297
|
-
*/
|
|
298
|
-
public getFirstExit() {
|
|
299
|
-
const startNode = this as CpNode;
|
|
300
|
-
let cpNode = startNode;
|
|
301
|
-
|
|
302
|
-
while (cpNode.next === cpNode.prevOnCircle) {
|
|
303
|
-
cpNode = cpNode.next;
|
|
304
|
-
|
|
305
|
-
if (cpNode === startNode) {
|
|
306
|
-
// The very special case the MAT is a single point.
|
|
307
|
-
return undefined;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return cpNode;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Returns true if this [[CpNode]] represents a sharp corner, i.e. the
|
|
317
|
-
* limiting case of a two-prong having zero radius.
|
|
318
|
-
*
|
|
319
|
-
* Note that two [[CpNode]]s are stored for each sharp corner, one being
|
|
320
|
-
* terminating and one not. See [[isTerminating]] for more details.
|
|
321
|
-
*/
|
|
322
|
-
public isSharp() {
|
|
323
|
-
return this.cp.circle.radius === 0;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Returns true if this [[CpNode]]'s maximal disk has only one contact point
|
|
329
|
-
* on the shape boundary (up to planar coordinates). These includes sharp
|
|
330
|
-
* corners.
|
|
331
|
-
*
|
|
332
|
-
* Note, however, that two [[CpNode]]s are stored for each such point to
|
|
333
|
-
* preserve symmetry - see [[isTerminating]] for more details.
|
|
334
|
-
*/
|
|
335
|
-
public isOneProng() {
|
|
336
|
-
const cp1 = this;
|
|
337
|
-
|
|
338
|
-
if (cp1.cp.circle.radius === 0) {
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const cp2 = cp1.nextOnCircle;
|
|
343
|
-
|
|
344
|
-
const p1 = cp1.cp.pointOnShape.p;
|
|
345
|
-
const p2 = cp2.cp.pointOnShape.p;
|
|
346
|
-
|
|
347
|
-
return (p1[0] === p2[0] && p1[1] === p2[1]);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Returns the number of contact points on the maximal disk circle implied
|
|
353
|
-
* by this [[CpNode]].
|
|
354
|
-
*
|
|
355
|
-
* Note, however, that even one-prongs and sharp corners will return 2 (see
|
|
356
|
-
* [[isTerminating]] for more details); if this is not desired use
|
|
357
|
-
* [[getRealProngCount]] instead which will return 1 in these cases.
|
|
358
|
-
*/
|
|
359
|
-
public getProngCount() {
|
|
360
|
-
const startCp = this as CpNode;
|
|
361
|
-
let cp = startCp;
|
|
362
|
-
|
|
363
|
-
let i = 0;
|
|
364
|
-
|
|
365
|
-
do {
|
|
366
|
-
i++;
|
|
367
|
-
cp = cp.nextOnCircle;
|
|
368
|
-
} while (cp !== startCp)
|
|
369
|
-
|
|
370
|
-
return i;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Returns the number of contact points (up to planar coordinates) on the
|
|
376
|
-
* maximal disk circle implied by this [[CpNode]].
|
|
377
|
-
*
|
|
378
|
-
* See also [[getProngCount]].
|
|
379
|
-
*/
|
|
380
|
-
public getRealProngCount() {
|
|
381
|
-
if (this.isOneProng()) { return 1; }
|
|
382
|
-
|
|
383
|
-
return this.getProngCount();
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
export { CpNode }
|
package/src/find-mats.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
declare const _debug_: Debug;
|
|
3
|
-
|
|
4
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
|
-
import { simplifyPaths } from 'flo-boolean';
|
|
6
|
-
import { Debug } from './debug/debug.js';
|
|
7
|
-
import { CpNode } from './cp-node.js';
|
|
8
|
-
import { Loop } from './loop.js';
|
|
9
|
-
import { Mat } from './mat.js';
|
|
10
|
-
import { findAndAddAll3Prongs } from './mat/find-mat/find-and-add-3-prongs.js';
|
|
11
|
-
import { createInitialCpGraph } from './mat/find-mat/create-initial-cp-graph.js';
|
|
12
|
-
import { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 } from './mat/find-mat/add-debug-info.js';
|
|
13
|
-
import { getPotential2Prongs } from './mat/find-mat/get-potential-2-prongs.js';
|
|
14
|
-
import { getSharpCorners } from './mat/find-mat/get-sharp-corners.js';
|
|
15
|
-
import { findAndAdd2ProngsOnAllPaths } from './mat/find-mat/find-and-add-2-prongs-on-all-paths.js';
|
|
16
|
-
import { getInterestingPointsOnLoop } from './mat/find-mat/create-get-interesting-points-on-loop.js';
|
|
17
|
-
import { findAndAddHoleClosing2Prongs } from './mat/find-mat/find-and-add-hole-closing-2-prongs.js';
|
|
18
|
-
import { getLoopsMetrics } from './loop/get-max-coordinate.js';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Finds and returns the Medial Axis Transforms (MATs) from the given array of
|
|
23
|
-
* bezier loops representing shape boundaries.
|
|
24
|
-
*
|
|
25
|
-
* @param bezierLoops An array of (possibly intersecting) loops with each loop
|
|
26
|
-
* representing one or more piecewise smooth closed curves (i.e. shapes). Each
|
|
27
|
-
* loop consists of an array of beziers represented by an array of control
|
|
28
|
-
* points with 2,3 or 4 elements corresponding to linear, quadratic and cubic
|
|
29
|
-
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
30
|
-
* first of which is the x-coordinate and the second the y-coordinate.
|
|
31
|
-
*
|
|
32
|
-
* @param maxCurviness The maximum value the 'curviness' of a curve can have
|
|
33
|
-
* before an additional MAT point is inserted in between. Defaults to 0.4.
|
|
34
|
-
* (Curviness is measured as the total angle in radians between the consecutive
|
|
35
|
-
* vectors formed by the ordered control points of th bezier curve). The value
|
|
36
|
-
* is clipped in the range `[0.05,3]`.
|
|
37
|
-
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
38
|
-
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
39
|
-
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
40
|
-
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
41
|
-
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
42
|
-
* in [1,100].
|
|
43
|
-
*/
|
|
44
|
-
function findMats(
|
|
45
|
-
bezierLoops: number[][][][],
|
|
46
|
-
maxCurviness = 0.4,
|
|
47
|
-
maxLength = 4): Mat[] {
|
|
48
|
-
|
|
49
|
-
// if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
|
|
50
|
-
|
|
51
|
-
let maxCoordinate: number;
|
|
52
|
-
let minBezLength: number;
|
|
53
|
-
({ maxCurviness, maxLength, maxCoordinate, minBezLength } =
|
|
54
|
-
getSizeParams(bezierLoops, maxCurviness, maxLength));
|
|
55
|
-
|
|
56
|
-
const loopss = simplifyPaths(bezierLoops, maxCoordinate);
|
|
57
|
-
|
|
58
|
-
const mats: Mat[] = [];
|
|
59
|
-
for (const loops of loopss) {
|
|
60
|
-
const mat = findMat(
|
|
61
|
-
loops,
|
|
62
|
-
minBezLength,
|
|
63
|
-
maxCurviness,
|
|
64
|
-
maxLength,
|
|
65
|
-
maxCoordinate
|
|
66
|
-
);
|
|
67
|
-
if (mat) { mats.push(mat); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return mats;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
function getSizeParams(
|
|
75
|
-
bezierLoops: number[][][][],
|
|
76
|
-
maxCurviness: number,
|
|
77
|
-
maxLength: number) {
|
|
78
|
-
|
|
79
|
-
// Gather some shape metrics
|
|
80
|
-
const { maxCoordinate, maxRadius } = getLoopsMetrics(bezierLoops);
|
|
81
|
-
const expMax = Math.ceil(Math.log2(maxCoordinate));
|
|
82
|
-
const minBezLengthSigBits = 14;
|
|
83
|
-
/**
|
|
84
|
-
* If a curve is shorter than this value then no points on it will be
|
|
85
|
-
* selected for the purpose of finding the MAT.
|
|
86
|
-
*/
|
|
87
|
-
const minBezLength = 2**expMax * 2**(-minBezLengthSigBits);
|
|
88
|
-
|
|
89
|
-
// Limit the tolerance to a reasonable level
|
|
90
|
-
if (maxCurviness < 0.05) { maxCurviness = 0.05; }
|
|
91
|
-
if (maxCurviness > 3 ) { maxCurviness = 3; }
|
|
92
|
-
// Limit the tolerance to a reasonable level
|
|
93
|
-
if (maxLength < 0.1) { maxLength = 0.1; }
|
|
94
|
-
if (maxLength > 100) { maxLength = 100; }
|
|
95
|
-
// Adjust length tolerance according to a reference max coordinate
|
|
96
|
-
const expMaxRadius = Math.ceil(Math.log2(maxRadius));
|
|
97
|
-
const maxLengthSigBits = 10; // 1024 x 1024
|
|
98
|
-
maxLength = maxLength * (2**expMaxRadius * 2**(-maxLengthSigBits));
|
|
99
|
-
|
|
100
|
-
return { maxCurviness, maxLength, maxCoordinate, minBezLength };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @hidden
|
|
106
|
-
* Find the MAT of the given loops.
|
|
107
|
-
* @param loops The loops (that as a precondition must be ordered from highest
|
|
108
|
-
* (i.e. smallest y-value) topmost point loops to lowest)
|
|
109
|
-
*/
|
|
110
|
-
function findMat(
|
|
111
|
-
loops: Loop[],
|
|
112
|
-
minBezLength: number,
|
|
113
|
-
maxCurviness: number,
|
|
114
|
-
maxLength: number,
|
|
115
|
-
maxCoordinate: number): Mat {
|
|
116
|
-
|
|
117
|
-
addDebugInfo1(loops);
|
|
118
|
-
|
|
119
|
-
// Gets interesting points on the shape, i.e. those that makes sense to use
|
|
120
|
-
// for the 2-prong procedure.
|
|
121
|
-
const pointsPerLoop = loops.map(
|
|
122
|
-
getInterestingPointsOnLoop(minBezLength, maxCurviness, maxLength)
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
const for2ProngsPerLoop = getPotential2Prongs(pointsPerLoop);
|
|
126
|
-
const sharpCornersPerLoop = getSharpCorners(pointsPerLoop);
|
|
127
|
-
|
|
128
|
-
const cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
|
|
129
|
-
let cpNode = createInitialCpGraph(loops, cpTrees, sharpCornersPerLoop);
|
|
130
|
-
|
|
131
|
-
findAndAddHoleClosing2Prongs(loops, cpTrees, maxCoordinate);
|
|
132
|
-
|
|
133
|
-
if (typeof _debug_ !== 'undefined') {
|
|
134
|
-
if (_debug_.directives.stopAfterHoleClosers) {
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
addDebugInfo2();
|
|
140
|
-
|
|
141
|
-
cpNode = findAndAdd2ProngsOnAllPaths(
|
|
142
|
-
loops, cpTrees, for2ProngsPerLoop, maxCoordinate
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
addDebugInfo3();
|
|
146
|
-
|
|
147
|
-
if (typeof _debug_ !== 'undefined') {
|
|
148
|
-
if (_debug_.directives.stopAfterTwoProngs) {
|
|
149
|
-
return undefined;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (cpNode === undefined) { return undefined; }
|
|
154
|
-
|
|
155
|
-
findAndAddAll3Prongs(cpTrees, cpNode, maxCoordinate);
|
|
156
|
-
|
|
157
|
-
if (typeof _debug_ !== 'undefined') {
|
|
158
|
-
if (_debug_.directives.stopAfterThreeProngs) {
|
|
159
|
-
return undefined;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const mat = { cpNode, cpTrees };
|
|
164
|
-
|
|
165
|
-
addDebugInfo4(mat);
|
|
166
|
-
|
|
167
|
-
return mat;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
export { findMats }
|
package/src/loop.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Curve } from './curve.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents a two-way linked loop of [[ICurve]]s - mostly used internally to
|
|
6
|
-
* conveniently represent shape boundaries.
|
|
7
|
-
*/
|
|
8
|
-
interface Loop {
|
|
9
|
-
/** The curves that represent the shape boundary as an array. */
|
|
10
|
-
curves: Curve[];
|
|
11
|
-
/** A pre-ordered array of bezier curves to add initially.*/
|
|
12
|
-
beziers: number[][][];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param beziers A pre-ordered array of bezier curves to add initially.
|
|
18
|
-
*/
|
|
19
|
-
function loopFromBeziers(beziers: number[][][] = []) {
|
|
20
|
-
const curves: Curve[] = [];
|
|
21
|
-
|
|
22
|
-
const loop: Loop = {
|
|
23
|
-
beziers,
|
|
24
|
-
curves
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
if (!beziers.length) { return loop; }
|
|
28
|
-
|
|
29
|
-
let prev: Curve;
|
|
30
|
-
|
|
31
|
-
for (let i=0; i<beziers.length; i++) {
|
|
32
|
-
|
|
33
|
-
const curve: Curve = {
|
|
34
|
-
loop,
|
|
35
|
-
ps: beziers[i],
|
|
36
|
-
prev,
|
|
37
|
-
next: undefined,
|
|
38
|
-
idx: i
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
if (prev) { prev.next = curve; }
|
|
42
|
-
prev = curve;
|
|
43
|
-
|
|
44
|
-
curves.push(curve);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// close loop
|
|
48
|
-
const lastCurve = curves[curves.length-1];
|
|
49
|
-
curves[0].prev = lastCurve;
|
|
50
|
-
lastCurve.next = curves[0];
|
|
51
|
-
|
|
52
|
-
return loop;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export { Loop, loopFromBeziers }
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { deflate, allRootsPrecise } from 'flo-poly';
|
|
3
|
-
|
|
4
|
-
import { getObjClosestTo } from 'flo-vector2d';
|
|
5
|
-
import { evaluate, getTangentPolyFromPoint } from 'flo-bezier3';
|
|
6
|
-
|
|
7
|
-
import { Curve } from "../../curve";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** @hidden */
|
|
11
|
-
// TODO - remove delta
|
|
12
|
-
let DELTA = 1e-11;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
* @param curve The curve
|
|
18
|
-
* @param p The point from which to check
|
|
19
|
-
* @param tRange The allowed t range
|
|
20
|
-
* @param touchedCurve The bezier on which p is located
|
|
21
|
-
* @param t The t value of the bezier that locates p
|
|
22
|
-
*/
|
|
23
|
-
function closestPointOnCurve(
|
|
24
|
-
curve: Curve,
|
|
25
|
-
p: number[],
|
|
26
|
-
tRange: number[] = [0,1],
|
|
27
|
-
touchedCurve?: Curve,
|
|
28
|
-
t?: number) {
|
|
29
|
-
|
|
30
|
-
let poly = getTangentPolyFromPoint(curve.ps, p);
|
|
31
|
-
|
|
32
|
-
if (curve === touchedCurve) {
|
|
33
|
-
poly = deflate(poly, t);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let roots = allRootsPrecise(poly, tRange[0], tRange[1]);
|
|
37
|
-
|
|
38
|
-
// Also test the endpoints
|
|
39
|
-
let push0 = true;
|
|
40
|
-
let push1 = true;
|
|
41
|
-
if ((t === 1 && curve === touchedCurve.next) ||
|
|
42
|
-
(t === 0 && curve === touchedCurve)) {
|
|
43
|
-
push0 = false;
|
|
44
|
-
}
|
|
45
|
-
if ((t === 0 && curve === touchedCurve.prev) ||
|
|
46
|
-
(t === 1 && curve === touchedCurve)) {
|
|
47
|
-
push1 = false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (tRange[0] === 0) {
|
|
51
|
-
if (push0) { roots.push(0); }
|
|
52
|
-
} else if (tRange[0] === 1) {
|
|
53
|
-
if (push1) { roots.push(1); }
|
|
54
|
-
} else {
|
|
55
|
-
roots.push(tRange[0]);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (tRange[1] === 0) {
|
|
59
|
-
if (push0) { roots.push(0); }
|
|
60
|
-
} else if (tRange[1] === 1) {
|
|
61
|
-
if (push1) { roots.push(1); }
|
|
62
|
-
} else {
|
|
63
|
-
roots.push(tRange[1]);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// This is to take care of a numerical issue - see shape p1.svg.
|
|
67
|
-
let roots_: number[] = [];
|
|
68
|
-
for (let i=0; i<roots.length; i++) {
|
|
69
|
-
let root = roots[i];
|
|
70
|
-
if (root !== 0 && root < DELTA) {
|
|
71
|
-
root = 0;
|
|
72
|
-
} else if (root !== 1 && 1-root < DELTA) {
|
|
73
|
-
root = 1;
|
|
74
|
-
}
|
|
75
|
-
roots_.push(root);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let ev = evaluate(curve.ps);
|
|
79
|
-
let ps = roots_.map(
|
|
80
|
-
//let ps = roots.map(
|
|
81
|
-
root => ({ p: ev(root), t: root })
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
return getObjClosestTo(p, ps, p => p.p);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export { closestPointOnCurve }
|