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
|
@@ -0,0 +1,89 @@
|
|
|
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 { CpNode } from '../cp-node/cp-node.js';
|
|
7
|
+
import { Loop } from 'flo-boolean';
|
|
8
|
+
import { Mat } from '../mat/mat.js';
|
|
9
|
+
import { findAndAddAll3Prongs } from '../find-3-prong.ts/find-and-add-all-3-prongs.js';
|
|
10
|
+
import { createInitialCpGraph } from './create-initial-cp-graph.js';
|
|
11
|
+
import { addDebugInfo1, addDebugInfo2, addDebugInfo3, addDebugInfo4 } from './add-debug-info.js';
|
|
12
|
+
import { getSharpCornersOnLoop } from './get-sharp-corners.js';
|
|
13
|
+
import { getDullCornersOnLoop } from './get-dull-corners.js';
|
|
14
|
+
import { findAndAdd2ProngsOnAllPaths } from '../find-2-prong/find-and-add-2-prongs-on-all-paths.js';
|
|
15
|
+
import { getFor2ProngsOnLoop } from './get-for-2-prongs-on-loop.js';
|
|
16
|
+
import { getFor1ProngsOnLoop } from './get-for-1-prongs-on-loop.js';
|
|
17
|
+
import { findAndAddHoleClosing2Prongs } from '../find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Find the MAT of the given loops.
|
|
23
|
+
* @param loops The loops (that as a precondition must be ordered from highest
|
|
24
|
+
* (i.e. smallest y-value) topmost point loops to lowest)
|
|
25
|
+
*/
|
|
26
|
+
function findMat(
|
|
27
|
+
loops: Loop[],
|
|
28
|
+
minBezLength: number,
|
|
29
|
+
maxCurviness: number,
|
|
30
|
+
maxLength: number,
|
|
31
|
+
maxCoordinate: number): Mat {
|
|
32
|
+
|
|
33
|
+
addDebugInfo1(loops);
|
|
34
|
+
|
|
35
|
+
const getSharpCornersOnLoop_ = getSharpCornersOnLoop(minBezLength);
|
|
36
|
+
const getDullCornersOnLoop_ = getDullCornersOnLoop(minBezLength);
|
|
37
|
+
const sharpCornersPerLoop = loops.map(getSharpCornersOnLoop_);
|
|
38
|
+
const dullCornersPerLoop = loops.map(getDullCornersOnLoop_);
|
|
39
|
+
|
|
40
|
+
const cpTrees: Map<Loop, LlRbTree<CpNode>> = new Map();
|
|
41
|
+
createInitialCpGraph(loops, cpTrees, sharpCornersPerLoop);
|
|
42
|
+
|
|
43
|
+
findAndAddHoleClosing2Prongs(loops, cpTrees, maxCoordinate);
|
|
44
|
+
|
|
45
|
+
if (typeof _debug_ !== 'undefined') {
|
|
46
|
+
if (_debug_.directives.stopAfterHoleClosers) { return undefined!; }
|
|
47
|
+
}
|
|
48
|
+
addDebugInfo2();
|
|
49
|
+
|
|
50
|
+
const for1ProngsPerLoop = loops.map(
|
|
51
|
+
getFor1ProngsOnLoop(minBezLength)
|
|
52
|
+
);
|
|
53
|
+
const for2ProngsPerLoop = loops.map(
|
|
54
|
+
getFor2ProngsOnLoop(minBezLength, maxCurviness, maxLength)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
let cpNode: CpNode | undefined;
|
|
58
|
+
cpNode = findAndAdd2ProngsOnAllPaths(
|
|
59
|
+
cpNode, loops, cpTrees, dullCornersPerLoop, maxCoordinate, false
|
|
60
|
+
);
|
|
61
|
+
cpNode = findAndAdd2ProngsOnAllPaths(
|
|
62
|
+
cpNode, loops, cpTrees, for1ProngsPerLoop, maxCoordinate, true
|
|
63
|
+
);
|
|
64
|
+
cpNode = findAndAdd2ProngsOnAllPaths(
|
|
65
|
+
cpNode, loops, cpTrees, for2ProngsPerLoop, maxCoordinate, false
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
addDebugInfo3();
|
|
69
|
+
if (typeof _debug_ !== 'undefined') {
|
|
70
|
+
if (_debug_.directives.stopAfterTwoProngs) { return undefined!; }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (cpNode === undefined) { return undefined!; }
|
|
74
|
+
|
|
75
|
+
findAndAddAll3Prongs(cpTrees, cpNode, maxCoordinate);
|
|
76
|
+
|
|
77
|
+
if (typeof _debug_ !== 'undefined') {
|
|
78
|
+
if (_debug_.directives.stopAfterThreeProngs) { return undefined!; }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const mat = { cpNode, cpTrees };
|
|
82
|
+
|
|
83
|
+
addDebugInfo4(mat);
|
|
84
|
+
|
|
85
|
+
return mat;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
export { findMat }
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
declare const _debug_: Debug;
|
|
3
|
+
|
|
4
|
+
import { beziersToSvgPathStr, simplifyPaths } from 'flo-boolean';
|
|
5
|
+
import { Debug } from '../debug/debug.js';
|
|
6
|
+
import { Mat } from '../mat/mat.js';
|
|
7
|
+
import { findMat } from './find-mat.js';
|
|
8
|
+
import { getSizeParams } from './get-size-params.js';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Finds and returns the Medial Axis Transforms (MATs) from the given array of
|
|
13
|
+
* bezier loops representing shape boundaries.
|
|
14
|
+
*
|
|
15
|
+
* @param bezierLoops An array of (possibly intersecting) loops with each loop
|
|
16
|
+
* representing one or more piecewise smooth closed curves (i.e. shapes). Each
|
|
17
|
+
* loop consists of an array of beziers represented by an array of control
|
|
18
|
+
* points with 2,3 or 4 elements corresponding to linear, quadratic and cubic
|
|
19
|
+
* beziers respectively. Each point is a two-element array (ordered pair), the
|
|
20
|
+
* first of which is the x-coordinate and the second the y-coordinate.
|
|
21
|
+
*
|
|
22
|
+
* @param maxCurviness The maximum value the 'curviness' of a curve can have
|
|
23
|
+
* before an additional MAT point is inserted in between. Defaults to 0.4.
|
|
24
|
+
* (Curviness is measured as the total angle in radians between the consecutive
|
|
25
|
+
* vectors formed by the ordered control points of th bezier curve). The value
|
|
26
|
+
* is clipped in the range `[0.05,3]`.
|
|
27
|
+
* @param maxLength The maximum length a curve can have before an additional MAT
|
|
28
|
+
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
29
|
+
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
30
|
+
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
31
|
+
* tolerance for the accuracy of the MAT. Defaults to 4. The value is clipped
|
|
32
|
+
* in [1,100].
|
|
33
|
+
*/
|
|
34
|
+
function findMats(
|
|
35
|
+
bezierLoops: number[][][][],
|
|
36
|
+
maxCurviness = 0.4,
|
|
37
|
+
maxLength = 4): Mat[] {
|
|
38
|
+
|
|
39
|
+
// if (typeof _debug_ !== 'undefined') { var timingStart = performance.now(); }
|
|
40
|
+
|
|
41
|
+
let maxCoordinate: number;
|
|
42
|
+
let minBezLength: number;
|
|
43
|
+
({ maxCurviness, maxLength, maxCoordinate, minBezLength } =
|
|
44
|
+
getSizeParams(bezierLoops, maxCurviness, maxLength));
|
|
45
|
+
|
|
46
|
+
const loopss = simplifyPaths(bezierLoops);
|
|
47
|
+
// console.log(loopsToSvgPathStr(bezierLoops.map(v => v.map(v => v.map(v => v.map(v => v*2**4))))));
|
|
48
|
+
// console.log(loopsToSvgPathStr(loopss[0].map(loop => loop.beziers)));
|
|
49
|
+
|
|
50
|
+
const mats: Mat[] = [];
|
|
51
|
+
for (const loops of loopss) {
|
|
52
|
+
const mat = findMat(
|
|
53
|
+
loops,
|
|
54
|
+
minBezLength,
|
|
55
|
+
maxCurviness,
|
|
56
|
+
maxLength,
|
|
57
|
+
maxCoordinate
|
|
58
|
+
);
|
|
59
|
+
if (mat) { mats.push(mat); }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return mats;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns an SVG path string representation of the given bezier loops.
|
|
68
|
+
* @param loops An array of loops having an array of bezier curves each given as
|
|
69
|
+
* an array of control points.
|
|
70
|
+
*/
|
|
71
|
+
function loopsToSvgPathStr(
|
|
72
|
+
loops: number[][][][]) {
|
|
73
|
+
|
|
74
|
+
let str = '';
|
|
75
|
+
for (const loop of loops) {
|
|
76
|
+
str = str + beziersToSvgPathStr(loop) + '\n';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return str;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export { findMats }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CpNode, cpNodeComparator, getAllOnLoop } from "../cp-node/cp-node.js";
|
|
2
|
+
import { enhanceCpNode } from "../cp-node/enhance-cp-node.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*
|
|
8
|
+
* Use only for debugging. Check all nodes around the loop.
|
|
9
|
+
*/
|
|
10
|
+
function fixOrdering(
|
|
11
|
+
cpNode: CpNode) {
|
|
12
|
+
|
|
13
|
+
const cpStart = cpNode;
|
|
14
|
+
|
|
15
|
+
/* holeCloser order causes an issue here
|
|
16
|
+
{
|
|
17
|
+
const cpNodes = getAllOnLoop(cpStart);
|
|
18
|
+
|
|
19
|
+
cpNodes.sort(cpNodeComparator);
|
|
20
|
+
// console.log(cpNodes.map(cpn => enhanceCpNode(cpn).ordering))
|
|
21
|
+
|
|
22
|
+
const len = cpNodes.length;
|
|
23
|
+
for (let i=0; i<len; i++) {
|
|
24
|
+
const cpNode = cpNodes[i];
|
|
25
|
+
const prev = cpNodes[(i + len - 1)%len];
|
|
26
|
+
const next = cpNodes[(i + len + 1)%len];
|
|
27
|
+
if (cpNode.prev !== prev) {
|
|
28
|
+
// console.log(enhanceCpNode(cpNode));
|
|
29
|
+
}
|
|
30
|
+
if (cpNode.next !== next) {
|
|
31
|
+
// console.log(enhanceCpNode(cpNode));
|
|
32
|
+
}
|
|
33
|
+
// cpNode.prev = prev;
|
|
34
|
+
// cpNode.next = next;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
{
|
|
41
|
+
let cpNode2 = cpStart.next;
|
|
42
|
+
while (cpNode2 !== cpStart) {
|
|
43
|
+
const cpNode1 = cpNode2;
|
|
44
|
+
cpNode2 = cpNode2.next;
|
|
45
|
+
|
|
46
|
+
const c = cpNodeComparator(cpNode1, cpNode2)!;
|
|
47
|
+
const looplen = cpNode1.cp.pointOnShape.curve.loop.beziers.length;
|
|
48
|
+
if (c > 0 && !cpNode1.isHoleClosing && !cpNode2.isHoleClosing) {
|
|
49
|
+
const o1 = cpNode1.cp.pointOnShape.curve.idx;
|
|
50
|
+
const o2 = cpNode2.cp.pointOnShape.curve.idx;
|
|
51
|
+
if (if) {
|
|
52
|
+
1;
|
|
53
|
+
} else {
|
|
54
|
+
console.log('ORDER IS WRONG!', looplen, o1, o2)
|
|
55
|
+
console.log(c);
|
|
56
|
+
console.log(enhanceCpNode(cpNode1));
|
|
57
|
+
console.log(enhanceCpNode(cpNode2));
|
|
58
|
+
console.log('');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
// return cpNodes;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
export { fixOrdering }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
4
|
+
import { getCornerAtEnd } from '../curve/curve.js';
|
|
5
|
+
import { controlPointLinesLength } from 'flo-bezier3';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
function getDullCornersOnLoop(
|
|
10
|
+
minBezLength: number) {
|
|
11
|
+
|
|
12
|
+
return (loop: Loop) => {
|
|
13
|
+
const dullCorners: PointOnShape[] = [];
|
|
14
|
+
|
|
15
|
+
for (let i=0; i<loop.curves.length; i++) {
|
|
16
|
+
const curve = loop.curves[i];
|
|
17
|
+
|
|
18
|
+
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (getCornerAtEnd(curve).isQuiteDull) {
|
|
23
|
+
dullCorners.push(createPos(curve, 1, true));
|
|
24
|
+
dullCorners.push(createPos(curve.next, 0, true));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return dullCorners;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export { getDullCornersOnLoop }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getCurvatureExtremaDd, getCurvatureExtremaE, controlPointLinesLength, getCurvatureExtrema } from 'flo-bezier3';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
4
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Get useful points on the shape - these incude points of maximum curvature and
|
|
10
|
+
* points at the bezier-bezier interfaces.
|
|
11
|
+
* @param loop
|
|
12
|
+
* @param additionalPointCount
|
|
13
|
+
*/
|
|
14
|
+
function getFor1ProngsOnLoop(
|
|
15
|
+
minBezLength: number) {
|
|
16
|
+
|
|
17
|
+
return function(loop: Loop) {
|
|
18
|
+
const for1Prongs: PointOnShape[] = [];
|
|
19
|
+
|
|
20
|
+
for (let i=0; i<loop.curves.length; i++) {
|
|
21
|
+
const curve = loop.curves[i];
|
|
22
|
+
|
|
23
|
+
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// const { minima, maxima } = getCurvatureExtrema(curve.ps);
|
|
28
|
+
const { minima, maxima } = getCurvatureExtremaDd(curve.ps);
|
|
29
|
+
// const { minima, maxima } = getCurvatureExtremaE(curve.ps);
|
|
30
|
+
const maxAbsCurvatures = [...minima, ...maxima].map(t => createPos(curve, t, true));
|
|
31
|
+
|
|
32
|
+
for1Prongs.push(...maxAbsCurvatures);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return for1Prongs;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export { getFor1ProngsOnLoop }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { splitByCurvatureAndLength, controlPointLinesLength } from 'flo-bezier3';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
4
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Get useful points on the shape - these incude points of maximum curvature and
|
|
10
|
+
* points at the bezier-bezier interfaces.
|
|
11
|
+
* @param loop
|
|
12
|
+
* @param additionalPointCount
|
|
13
|
+
*/
|
|
14
|
+
function getFor2ProngsOnLoop(
|
|
15
|
+
minBezLength: number,
|
|
16
|
+
maxCurviness: number,
|
|
17
|
+
maxLength: number) {
|
|
18
|
+
|
|
19
|
+
return function(loop: Loop) {
|
|
20
|
+
const for2Prongs: PointOnShape[] = [];
|
|
21
|
+
|
|
22
|
+
for (let i=0; i<loop.curves.length; i++) {
|
|
23
|
+
const curve = loop.curves[i];
|
|
24
|
+
|
|
25
|
+
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let ts = splitByCurvatureAndLength(curve.ps, maxCurviness, maxLength);
|
|
30
|
+
// add at least one in the middle
|
|
31
|
+
if (ts.length === 2) { ts = [0, 0.5, 1]; }
|
|
32
|
+
|
|
33
|
+
const byCurvatureAndLength =
|
|
34
|
+
ts.slice(1,ts.length-1).map(t => createPos(curve, t, true));
|
|
35
|
+
|
|
36
|
+
for2Prongs.push(...byCurvatureAndLength);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return for2Prongs;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export { getFor2ProngsOnLoop }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
4
|
+
import { getCornerAtEnd } from '../curve/curve.js';
|
|
5
|
+
import { controlPointLinesLength } from 'flo-bezier3';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
function getSharpCornersOnLoop(
|
|
10
|
+
minBezLength: number) {
|
|
11
|
+
|
|
12
|
+
return (loop: Loop) => {
|
|
13
|
+
const sharpCorners: PointOnShape[] = [];
|
|
14
|
+
|
|
15
|
+
for (let i=0; i<loop.curves.length; i++) {
|
|
16
|
+
const curve = loop.curves[i];
|
|
17
|
+
|
|
18
|
+
if (controlPointLinesLength(curve.ps) < minBezLength) {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (getCornerAtEnd(curve).isQuiteSharp) {
|
|
23
|
+
sharpCorners.push(createPos(curve, 1, true));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return sharpCorners;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export { getSharpCornersOnLoop }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getLoopsMetrics } from '../loop/get-max-coordinate.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function getSizeParams(
|
|
5
|
+
bezierLoops: number[][][][],
|
|
6
|
+
maxCurviness: number,
|
|
7
|
+
maxLength: number) {
|
|
8
|
+
|
|
9
|
+
// Gather some shape metrics
|
|
10
|
+
const { maxCoordinate, maxRadius } = getLoopsMetrics(bezierLoops);
|
|
11
|
+
const expMax = Math.ceil(Math.log2(maxCoordinate));
|
|
12
|
+
const minBezLengthSigBits = 16;
|
|
13
|
+
/**
|
|
14
|
+
* If a curve is shorter than this value then no points on it will be
|
|
15
|
+
* selected for the purpose of finding the MAT.
|
|
16
|
+
*/
|
|
17
|
+
const minBezLength = 2**expMax * 2**(-minBezLengthSigBits);
|
|
18
|
+
|
|
19
|
+
// Limit the tolerance to a reasonable level
|
|
20
|
+
if (maxCurviness < 0.05) { maxCurviness = 0.05; }
|
|
21
|
+
if (maxCurviness > 3 ) { maxCurviness = 3; }
|
|
22
|
+
// Limit the tolerance to a reasonable level
|
|
23
|
+
if (maxLength < 0.1) { maxLength = 0.1; }
|
|
24
|
+
if (maxLength > 100) { maxLength = 100; }
|
|
25
|
+
// Adjust length tolerance according to a reference max coordinate
|
|
26
|
+
const expMaxRadius = Math.ceil(Math.log2(maxRadius));
|
|
27
|
+
const maxLengthSigBits = 10; // 1024 x 1024
|
|
28
|
+
maxLength = maxLength * (2**expMaxRadius * 2**(-maxLengthSigBits));
|
|
29
|
+
|
|
30
|
+
return { maxCurviness, maxLength, maxCoordinate, minBezLength };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export { getSizeParams }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Curve } from '
|
|
2
|
-
import { Loop } from '
|
|
1
|
+
import { Curve } from '../curve/curve.js';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @internal
|
|
7
7
|
* Helper function.
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
* @param f
|
|
10
10
|
*/
|
|
11
11
|
function getTotalBy(f: (curve: Curve) => number) {
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
*/
|
|
9
9
|
function getClosestSquaredDistanceToRotatedRect(ps: number[][], p: number[]) {
|
|
10
10
|
const ds = [0,1,2,3].map(i => squaredDistanceBetweenPointAndLineSegment(
|
|
11
11
|
p,
|
|
12
|
-
[ps[i], ps[(i+1) % 4]]
|
|
12
|
+
[ps[i], ps[(i + 1) % 4]]
|
|
13
13
|
)
|
|
14
14
|
);
|
|
15
15
|
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
fromTo, dot, cross, rotate90Degrees, interpolate, translate,
|
|
3
3
|
lineLineIntersection
|
|
4
4
|
} from 'flo-vector2d';
|
|
5
|
-
import { CpNode } from '../cp-node.js';
|
|
5
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
6
6
|
import { getEdgeDirection } from './get-edge-direction.js';
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
/** @
|
|
9
|
+
/** @internal */
|
|
10
10
|
const TOLERANCE_ADD_2PRONG = 0.01;
|
|
11
|
-
/** @
|
|
11
|
+
/** @internal */
|
|
12
12
|
const TOLERANCE_USE_LINE = 0.0001; // else cubic
|
|
13
13
|
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ const TOLERANCE_USE_LINE = 0.0001; // else cubic
|
|
|
20
20
|
*/
|
|
21
21
|
function getCurveBetween(
|
|
22
22
|
cpNodeFrom: CpNode,
|
|
23
|
-
cpNodeTo: CpNode) {
|
|
23
|
+
cpNodeTo: CpNode): number[][] {
|
|
24
24
|
|
|
25
25
|
const fromCc = cpNodeFrom.cp.circle.center;
|
|
26
26
|
const fromL = getEdgeDirection(cpNodeFrom);
|
|
@@ -43,7 +43,7 @@ function getCurveBetween(
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (!twisted) {
|
|
46
|
-
return [fromCc, mid
|
|
46
|
+
return [fromCc, mid!, toCc];
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const r = rotate90Degrees(c);
|
|
@@ -66,8 +66,8 @@ function getCurveBetween(
|
|
|
66
66
|
const v2 = translate(r, m2);
|
|
67
67
|
const l1 = [m1,v1];
|
|
68
68
|
const l2 = [m2,v2];
|
|
69
|
-
const mid1 = lineLineIntersection(fromL, l1)
|
|
70
|
-
const mid2 = lineLineIntersection(toL, l2)
|
|
69
|
+
const mid1 = lineLineIntersection(fromL, l1)!;
|
|
70
|
+
const mid2 = lineLineIntersection(toL, l2)!;
|
|
71
71
|
|
|
72
72
|
return [fromCc, mid1, mid2, toCc];
|
|
73
73
|
}
|
|
@@ -2,12 +2,13 @@ import {
|
|
|
2
2
|
toUnitVector, fromTo, rotate, translate, rotate90Degrees, reverse, dot
|
|
3
3
|
} from 'flo-vector2d';
|
|
4
4
|
import { tangent } from 'flo-bezier3';
|
|
5
|
-
import { CpNode } from '../cp-node.js';
|
|
6
|
-
import { isPosSharpCorner } from '../point-on-shape.js';
|
|
5
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
6
|
+
import { isPosSharpCorner } from '../point-on-shape/is-pos-sharp-corner.js';
|
|
7
|
+
import { Curve } from '../curve/curve.js';
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
|
-
* @
|
|
11
|
+
* @internal
|
|
11
12
|
* Returns a line segment of unit length starting in the given Vertex center and
|
|
12
13
|
* pointing in the direction of the medial axis (viewed as a rooted tree).
|
|
13
14
|
* @param cpNode
|
|
@@ -26,7 +27,6 @@ function getEdgeDirection(cpNode: CpNode) {
|
|
|
26
27
|
|
|
27
28
|
let vDir;
|
|
28
29
|
|
|
29
|
-
//if (!PointOnShape.isSharpCorner(pos1)) {
|
|
30
30
|
if (!isPosSharpCorner(pos1)) {
|
|
31
31
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
32
32
|
vDir = fromTo(p1, circleCenter); // A 1-prong
|
|
@@ -34,9 +34,9 @@ function getEdgeDirection(cpNode: CpNode) {
|
|
|
34
34
|
vDir = rotate90Degrees( fromTo(p1, p2) ); // not a 1-prong.
|
|
35
35
|
}
|
|
36
36
|
} else {
|
|
37
|
-
let curve1;
|
|
38
|
-
let curve2;
|
|
39
|
-
|
|
37
|
+
let curve1: Curve;
|
|
38
|
+
let curve2: Curve;
|
|
39
|
+
|
|
40
40
|
if (pos1.t === 0) {
|
|
41
41
|
curve1 = pos1.curve;
|
|
42
42
|
curve2 = pos1.curve.prev;
|
|
@@ -45,15 +45,15 @@ function getEdgeDirection(cpNode: CpNode) {
|
|
|
45
45
|
curve2 = pos1.curve;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const tan1 = toUnitVector(tangent(curve1
|
|
49
|
-
const tan2 = reverse( toUnitVector(tangent(curve2
|
|
48
|
+
const tan1 = toUnitVector(tangent(curve1!.ps, 0));
|
|
49
|
+
const tan2 = reverse( toUnitVector(tangent(curve2!.ps, 1)) );
|
|
50
50
|
|
|
51
51
|
const x = dot(tan1, tan2);
|
|
52
52
|
// Recall the identities sin(acos(x)) = sqrt(1-x^2), etc. Also
|
|
53
53
|
// recall the half angle formulas. Then the rotation matrix, R, can
|
|
54
54
|
// be calculated.
|
|
55
|
-
const cosθ = Math.sqrt((1+x)/2);
|
|
56
|
-
const sinθ = Math.sqrt((1-x)/2);
|
|
55
|
+
const cosθ = Math.sqrt((1 + x)/2);
|
|
56
|
+
const sinθ = Math.sqrt((1 - x)/2);
|
|
57
57
|
|
|
58
58
|
vDir = rotate(sinθ, cosθ, tan2);
|
|
59
59
|
}
|