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
|
@@ -3,19 +3,22 @@ declare const _debug_: Debug;
|
|
|
3
3
|
|
|
4
4
|
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
5
|
import { exponent } from 'big-float-ts';
|
|
6
|
-
import { Debug } from '
|
|
7
|
-
import { Loop
|
|
8
|
-
import { CpNode
|
|
9
|
-
import { Circle
|
|
10
|
-
import { ContactPoint } from '
|
|
11
|
-
import { PointOnShape
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
6
|
+
import { Debug } from '../debug/debug.js';
|
|
7
|
+
import { Loop } from 'flo-boolean';
|
|
8
|
+
import { CpNode, insertCpNode } from '../cp-node/cp-node.js';
|
|
9
|
+
import { Circle } from '../geometry/circle.js';
|
|
10
|
+
import { ContactPoint } from '../contact-point/contact-point.js';
|
|
11
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
12
|
+
import { calcPosOrder } from '../point-on-shape/calc-pos-order.js';
|
|
13
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
14
|
+
import { isAnotherCpCloseby } from '../mat/is-another-cp-closeby.js';
|
|
15
|
+
import { getNeighbouringPoints } from '../mat/get-neighboring-cps.js';
|
|
16
|
+
import { TwoProngForDebugging } from '../debug/two-prong-for-debugging.js';
|
|
17
|
+
import { Curve } from '../curve/curve.js';
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
|
-
* @
|
|
21
|
+
* @internal
|
|
19
22
|
* Adds a 2-prong contact circle to the shape.
|
|
20
23
|
* @param cpGraphs
|
|
21
24
|
* @param circle Circle containing the 2 contact points
|
|
@@ -28,45 +31,37 @@ import { TwoProngForDebugging } from '../../debug/two-prong-for-debugging.js';
|
|
|
28
31
|
function add2Prong(
|
|
29
32
|
cpGraphs : Map<Loop,LlRbTree<CpNode>>,
|
|
30
33
|
circle : Circle,
|
|
31
|
-
posSource :
|
|
32
|
-
posAntipodes :
|
|
34
|
+
posSource : PointOnShape,
|
|
35
|
+
posAntipodes : PointOnShape[],
|
|
33
36
|
holeClosing : boolean,
|
|
34
|
-
extreme : number): CpNode {
|
|
35
|
-
|
|
36
|
-
//let orderSource = PointOnShape.calcOrder(circle, posSource);
|
|
37
|
-
const orderSource = calcPosOrder(circle, posSource);
|
|
38
|
-
const orderAntipodes = posAntipodes.map(
|
|
39
|
-
posAntipode => {
|
|
40
|
-
//console.log(circle.center)
|
|
41
|
-
//return PointOnShape.calcOrder(circle, posAntipode.pos);
|
|
42
|
-
return calcPosOrder(circle, posAntipode.pos);
|
|
43
|
-
}
|
|
44
|
-
);
|
|
37
|
+
extreme : number): CpNode | undefined {
|
|
45
38
|
|
|
46
39
|
let t_s = posSource.t;
|
|
47
|
-
let curve;
|
|
48
40
|
if (t_s === 0) {
|
|
49
41
|
t_s = 1;
|
|
50
|
-
|
|
51
|
-
posSource = new PointOnShape(curve, t_s);
|
|
42
|
+
posSource = createPos(posSource.curve.prev, t_s, true);
|
|
52
43
|
}
|
|
53
44
|
|
|
45
|
+
const orderSource = calcPosOrder(circle, posSource);
|
|
46
|
+
const orderAntipodes = posAntipodes.map(
|
|
47
|
+
posAntipode => calcPosOrder(circle, posAntipode)
|
|
48
|
+
);
|
|
49
|
+
|
|
54
50
|
|
|
55
51
|
// Make sure there isn't already a ContactPoint close by - it can cause
|
|
56
52
|
// floating point stability issues.
|
|
57
|
-
// TODO - possibly combine n-prongs in this case
|
|
58
53
|
|
|
59
54
|
let isCloseByAntipodes = false;
|
|
60
55
|
for (let i=0; i<posAntipodes.length; i++) {
|
|
61
56
|
const posAntipode = posAntipodes[i];
|
|
62
57
|
const orderAntipode = orderAntipodes[i];
|
|
63
58
|
|
|
64
|
-
if (isAnotherCpCloseby(cpGraphs, posAntipode
|
|
59
|
+
if (!!isAnotherCpCloseby(cpGraphs, posAntipode, circle, orderAntipode, 0, extreme)) {
|
|
65
60
|
isCloseByAntipodes = true;
|
|
66
61
|
break;
|
|
67
62
|
}
|
|
68
63
|
}
|
|
69
|
-
if (isAnotherCpCloseby(cpGraphs, posSource, circle, orderSource, 0, extreme
|
|
64
|
+
if (!!isAnotherCpCloseby(cpGraphs, posSource, circle, orderSource, 0, extreme) ||
|
|
70
65
|
isCloseByAntipodes) {
|
|
71
66
|
|
|
72
67
|
if (typeof _debug_ !== 'undefined') {
|
|
@@ -89,18 +84,20 @@ function add2Prong(
|
|
|
89
84
|
const posAntipode = posAntipodes[i];
|
|
90
85
|
const orderAntipode = orderAntipodes[i];
|
|
91
86
|
|
|
92
|
-
const cpAntipode: ContactPoint = {
|
|
87
|
+
const cpAntipode: ContactPoint = {
|
|
88
|
+
pointOnShape: posAntipode, circle, order: orderAntipode, order2: 0
|
|
89
|
+
};
|
|
93
90
|
cpAntipodes.push(cpAntipode);
|
|
94
|
-
const loopAntipode = posAntipode.
|
|
91
|
+
const loopAntipode = posAntipode.curve.loop;
|
|
95
92
|
loopAntipodes.push(loopAntipode);
|
|
96
|
-
const cpTreeAntipode = cpGraphs.get(loopAntipode)
|
|
93
|
+
const cpTreeAntipode = cpGraphs.get(loopAntipode)!;
|
|
97
94
|
cpTreeAntipodes.push(cpTreeAntipode);
|
|
98
95
|
const deltaAntipode = getNeighbouringPoints(
|
|
99
|
-
cpTreeAntipode, posAntipode
|
|
96
|
+
cpTreeAntipode, posAntipode, orderAntipode, 0
|
|
100
97
|
);
|
|
101
98
|
deltaAntipodes.push(deltaAntipode);
|
|
102
99
|
|
|
103
|
-
newCpAntipodes.push(
|
|
100
|
+
newCpAntipodes.push(insertCpNode(
|
|
104
101
|
holeClosing,
|
|
105
102
|
false,
|
|
106
103
|
cpTreeAntipode,
|
|
@@ -113,11 +110,11 @@ function add2Prong(
|
|
|
113
110
|
// Source
|
|
114
111
|
const cpSource: ContactPoint = { pointOnShape: posSource, circle, order: orderSource, order2: 0 };
|
|
115
112
|
const loopSource = posSource.curve.loop;
|
|
116
|
-
const cpTreeSource = cpGraphs.get(loopSource)
|
|
113
|
+
const cpTreeSource = cpGraphs.get(loopSource)!;
|
|
117
114
|
const deltaSource = getNeighbouringPoints(
|
|
118
115
|
cpTreeSource, posSource, orderSource, 0
|
|
119
116
|
);
|
|
120
|
-
const newCpSource =
|
|
117
|
+
const newCpSource = insertCpNode(
|
|
121
118
|
holeClosing,
|
|
122
119
|
false,
|
|
123
120
|
cpTreeSource,
|
|
@@ -141,8 +138,8 @@ function add2Prong(
|
|
|
141
138
|
cpNodes.sort(byAngle(circle));
|
|
142
139
|
|
|
143
140
|
for (let i=0; i<cpNodes.length; i++) {
|
|
144
|
-
const iNext = (i+1 === cpNodes.length) ? 0 : i+1;
|
|
145
|
-
const iPrev = (i === 0) ? cpNodes.length-1 : i-1;
|
|
141
|
+
const iNext = (i + 1 === cpNodes.length) ? 0 : i + 1;
|
|
142
|
+
const iPrev = (i === 0) ? cpNodes.length-1 : i - 1;
|
|
146
143
|
|
|
147
144
|
const cpNodeCurr = cpNodes[i];
|
|
148
145
|
const cpNodeNext = cpNodes[iNext];
|
|
@@ -155,13 +152,13 @@ function add2Prong(
|
|
|
155
152
|
|
|
156
153
|
|
|
157
154
|
if (holeClosing) {
|
|
158
|
-
// TODO -
|
|
155
|
+
// TODO - take care of case where there are more than 1 antipode
|
|
159
156
|
// Duplicate ContactPoints
|
|
160
|
-
const cpB2: ContactPoint = { pointOnShape: posAntipodes[0]
|
|
161
|
-
const newCpB2Node =
|
|
157
|
+
const cpB2: ContactPoint = { pointOnShape: posAntipodes[0], circle, order: cpAntipodes[0].order, order2: +1 };
|
|
158
|
+
const newCpB2Node = insertCpNode(true, false, cpTreeAntipodes[0], cpB2, newCpAntipodes[0]);
|
|
162
159
|
|
|
163
160
|
const cpB1: ContactPoint = { pointOnShape: posSource, circle, order: cpSource.order, order2: -1 };
|
|
164
|
-
const newCpB1Node =
|
|
161
|
+
const newCpB1Node = insertCpNode(true, false, cpTreeSource, cpB1, newCpSource.prev);
|
|
165
162
|
|
|
166
163
|
// Connect graph
|
|
167
164
|
newCpB1Node.prevOnCircle = newCpB2Node;
|
|
@@ -195,65 +192,22 @@ function add2Prong(
|
|
|
195
192
|
}
|
|
196
193
|
|
|
197
194
|
|
|
198
|
-
/** @
|
|
199
|
-
function scale(n: number, exp: number) {
|
|
200
|
-
return n * (2**-(exp+1));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/** @hidden */
|
|
205
|
-
function getSize(x: number, y: number) {
|
|
206
|
-
// Get size of a
|
|
207
|
-
if (x > 0) {
|
|
208
|
-
if (x > 0.5) {
|
|
209
|
-
return y; // ~ -0.7 -> 0.7, i.e. -(sqrt(2)/2) -> +(sqrt(2)/2)
|
|
210
|
-
} else {
|
|
211
|
-
if (y < 0) {
|
|
212
|
-
return x - 2; // ~ -2.0 -> -1.3
|
|
213
|
-
} else {
|
|
214
|
-
return -x + 2; // ~ 1.3 -> 2.0
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
} else {
|
|
218
|
-
if (x < -0.5) {
|
|
219
|
-
return -y + 4; // ~ 3.3 -> 4.7
|
|
220
|
-
} else {
|
|
221
|
-
if (y < 0) {
|
|
222
|
-
return x + 6; // ~ 5.3 -> 6.0
|
|
223
|
-
} else {
|
|
224
|
-
return -x + 2; // ~ 2 -> 2.7
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
/** @hidden */
|
|
195
|
+
/** @internal */
|
|
232
196
|
function byAngle(circle: Circle) {
|
|
233
197
|
const c = circle.center;
|
|
234
|
-
const r = circle.radius;
|
|
235
|
-
|
|
236
|
-
const exp = exponent(r);
|
|
237
198
|
|
|
238
199
|
return function(_a: CpNode, _b: CpNode) {
|
|
239
200
|
let a = _a.cp.pointOnShape.p;
|
|
240
201
|
let b = _b.cp.pointOnShape.p;
|
|
241
202
|
|
|
242
203
|
// Move onto origin
|
|
243
|
-
a = [a[0]-c[0], a[1]-c[1]];
|
|
244
|
-
b = [b[0]-c[0], b[1]-c[1]];
|
|
245
|
-
|
|
246
|
-
// Scale
|
|
247
|
-
const ax = scale(a[0], exp);
|
|
248
|
-
const ay = scale(a[1], exp);
|
|
249
|
-
const bx = scale(b[0], exp);
|
|
250
|
-
const by = scale(b[1], exp);
|
|
204
|
+
a = [a[0] - c[0], a[1] - c[1]];
|
|
205
|
+
b = [b[0] - c[0], b[1] - c[1]];
|
|
251
206
|
|
|
252
|
-
|
|
253
|
-
const
|
|
254
|
-
const sb = getSize(bx, by);
|
|
207
|
+
const a_ = Math.atan2(a[1], a[0]);
|
|
208
|
+
const b_ = Math.atan2(b[1], b[0]);
|
|
255
209
|
|
|
256
|
-
return
|
|
210
|
+
return b_ - a_;
|
|
257
211
|
}
|
|
258
212
|
}
|
|
259
213
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
declare const _debug_: Debug;
|
|
3
|
+
|
|
4
|
+
import { Debug } from '../debug/debug.js';
|
|
5
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
6
|
+
import { Circle } from '../geometry/circle.js';
|
|
7
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
8
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
9
|
+
import { TwoProngForDebugging } from '../debug/two-prong-for-debugging.js';
|
|
10
|
+
import { getTwoProngType } from '../mat/get-two-prong-type.js';
|
|
11
|
+
import { ElemType_TwoProng } from '../mat/elem-type-two-prong.js';
|
|
12
|
+
import { TXForDebugging } from './x-for-debugging.js';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
function addDebugInfo(
|
|
17
|
+
bezierPieces: BezierPiece[],
|
|
18
|
+
failed: boolean,
|
|
19
|
+
x: number[],
|
|
20
|
+
y: PointOnShape,
|
|
21
|
+
z: PointOnShape,
|
|
22
|
+
circle: Circle,
|
|
23
|
+
δ: CpNode[],
|
|
24
|
+
xs: TXForDebugging[],
|
|
25
|
+
holeClosing: boolean) {
|
|
26
|
+
|
|
27
|
+
xs.push({ x, y, z, t: y.t });
|
|
28
|
+
|
|
29
|
+
const twoProng: TwoProngForDebugging = {
|
|
30
|
+
generated: _debug_.generated,
|
|
31
|
+
bezierPieces,
|
|
32
|
+
pos: y,
|
|
33
|
+
δ,
|
|
34
|
+
z: z ? z.p : undefined!,
|
|
35
|
+
circle,
|
|
36
|
+
xs,
|
|
37
|
+
failed,
|
|
38
|
+
holeClosing,
|
|
39
|
+
notAdded: false,
|
|
40
|
+
deleted: false,
|
|
41
|
+
cpNode: undefined!
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const twoProngType = getTwoProngType(twoProng) as ElemType_TwoProng;
|
|
45
|
+
_debug_.generated.elems[twoProngType].push(twoProng);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export { addDebugInfo }
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { getClosestSquareDistanceToRect } from '
|
|
2
|
-
import { BezierPiece } from '
|
|
3
|
-
import { getBoundingBox_ } from '
|
|
1
|
+
import { getClosestSquareDistanceToRect } from '../geometry/get-closest-square-distance-to-rect.js';
|
|
2
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
3
|
+
import { getBoundingBox_ } from '../geometry/get-bounding-box-.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
* Cull all bezierPieces not within given radius of a given point.
|
|
9
9
|
* @param extreme
|
|
10
10
|
* @param bezierPieces
|
|
11
11
|
* @param p
|
|
12
12
|
* @param rSquared
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
14
|
+
function cullBezierPieces2(
|
|
15
15
|
bezierPieces: BezierPiece[],
|
|
16
16
|
p: number[],
|
|
17
17
|
rSquared: number) {
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
// TODO - base delta on theory
|
|
21
|
-
const TOLERANCE = 1+1e-3;
|
|
19
|
+
const TOLERANCE = 1 + 2**-10;
|
|
22
20
|
|
|
23
|
-
if (bezierPieces.length <=
|
|
21
|
+
if (bezierPieces.length <= 1) {
|
|
24
22
|
return bezierPieces;
|
|
25
23
|
}
|
|
26
24
|
|
|
@@ -31,7 +29,7 @@ function cullBezierPieces(
|
|
|
31
29
|
|
|
32
30
|
const rect = getBoundingBox_(ps);
|
|
33
31
|
const bd = getClosestSquareDistanceToRect(rect, p);
|
|
34
|
-
if (bd <= rSquared
|
|
32
|
+
if (bd <= TOLERANCE*rSquared) {
|
|
35
33
|
newPieces.push(bezierPiece);
|
|
36
34
|
}
|
|
37
35
|
}
|
|
@@ -40,4 +38,4 @@ function cullBezierPieces(
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
|
|
43
|
-
export {
|
|
41
|
+
export { cullBezierPieces2 }
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
declare const _debug_: Debug;
|
|
3
|
+
|
|
4
|
+
import { Debug } from '../debug/debug.js';
|
|
5
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
6
|
+
import { distanceBetween, fromTo, interpolate, rotate, translate } from 'flo-vector2d';
|
|
7
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
8
|
+
import { Loop } from 'flo-boolean';
|
|
9
|
+
import { Circle } from '../geometry/circle.js';
|
|
10
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
11
|
+
import { getOsculatingCircle } from '../point-on-shape/get-osculating-circle.js';
|
|
12
|
+
import { addDebugInfo } from './add-debug-info.js';
|
|
13
|
+
import { TXForDebugging } from './x-for-debugging.js';
|
|
14
|
+
import { findEquidistantPointOnLineDd } from './find-equidistant-point-on-line-dd.js';
|
|
15
|
+
import { getInitialBezierPieces } from './get-initial-bezier-pieces.js';
|
|
16
|
+
import { getCloseBoundaryPointsCertified } from '../closest-boundary-point/get-close-boundary-points-certified.js';
|
|
17
|
+
import { reduceRadius } from './reduce-radius.js';
|
|
18
|
+
import { squaredDistanceBetweenDd } from './squared-distance-between-dd.js';
|
|
19
|
+
import { cullBezierPieces2 } from './cull-bezier-pieces.js';
|
|
20
|
+
import { add1Prong } from './add-1-prong.js';
|
|
21
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const { sqrt, abs, sin, cos } = Math;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
* Adds a 2-prong to the MAT. The first point on the shape boundary is given and
|
|
30
|
+
* the second one is found by the algorithm.
|
|
31
|
+
*
|
|
32
|
+
* A 2-prong is defined as a MAT circle that touches the shape at exactly 2
|
|
33
|
+
* points.
|
|
34
|
+
*
|
|
35
|
+
* Before any 2-prongs are added the entire shape is our δΩ.
|
|
36
|
+
*
|
|
37
|
+
* As per the paper by Choi, Choi, Moon and Wee:
|
|
38
|
+
* "The starting point of this algorithm is a choice of a circle Br(x)
|
|
39
|
+
* centered at an interior point x which contains two boundary portions c and
|
|
40
|
+
* d of dΩ as in Fig. 19."
|
|
41
|
+
* In fact, we (and they) start by fixing one point on the boundary beforehand.
|
|
42
|
+
* @param loops A shape represented by path loops
|
|
43
|
+
* @param extreme The extreme coordinate value of the shape
|
|
44
|
+
* @param squaredDiagonalLength The squared diagonal length of the shape
|
|
45
|
+
* bounding box.
|
|
46
|
+
* @param y The source point of the 2-prong to be found
|
|
47
|
+
* @param isHoleClosing True if this is a hole-closing two-prong, false otherwise
|
|
48
|
+
* @param k The loop array index
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
function find2Prong(
|
|
52
|
+
angle: number,
|
|
53
|
+
loops: Loop[],
|
|
54
|
+
extreme: number,
|
|
55
|
+
squaredDiagonalLength: number,
|
|
56
|
+
cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
57
|
+
y: PointOnShape,
|
|
58
|
+
isHoleClosing: boolean,
|
|
59
|
+
k: number,
|
|
60
|
+
for1Prong: boolean): { circle: Circle, zs: PointOnShape[] } | undefined {
|
|
61
|
+
|
|
62
|
+
const MAX_ITERATIONS = 25;
|
|
63
|
+
const squaredSeperationTolerance = ((2**-21)*extreme)**2;
|
|
64
|
+
const errorTolerance = (2**-46)*extreme;
|
|
65
|
+
const maxOsculatingCircleRadius = sqrt(squaredDiagonalLength);
|
|
66
|
+
const minCurvature = 1/maxOsculatingCircleRadius;
|
|
67
|
+
|
|
68
|
+
let xO: number[]; // the original x to mitigate drift
|
|
69
|
+
const p = y.p;
|
|
70
|
+
let rO: number;
|
|
71
|
+
if (isHoleClosing) {
|
|
72
|
+
xO = [p[0], p[1] - maxOsculatingCircleRadius];
|
|
73
|
+
rO = maxOsculatingCircleRadius;
|
|
74
|
+
} else {
|
|
75
|
+
if (angle === 0) {
|
|
76
|
+
({ center: xO, radius: rO } = getOsculatingCircle(minCurvature, y));
|
|
77
|
+
} else {
|
|
78
|
+
({ center: xO, radius: rO } = getOsculatingCircle(minCurvature, y, true));
|
|
79
|
+
const v = fromTo(y.p, xO);
|
|
80
|
+
const v_ = rotate(sin(angle), cos(angle))(v);
|
|
81
|
+
xO = translate(y.p)(v_);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// The boundary piece that should contain the other point of
|
|
86
|
+
// the 2-prong circle. (Defined by start and end points).
|
|
87
|
+
const { bezierPieces, δ } = getInitialBezierPieces(
|
|
88
|
+
angle, isHoleClosing, k, loops, cpTrees, y, { center: xO, radius: rO }
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
/** The center of the two-prong (successively refined) */
|
|
92
|
+
let x = xO;
|
|
93
|
+
|
|
94
|
+
// The lines below is an optimization.
|
|
95
|
+
const r_ = sqrt(reduceRadius(extreme, bezierPieces, p, xO));
|
|
96
|
+
if (rO > r_) {
|
|
97
|
+
x = interpolate(p, xO, r_/rO);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Trace the convergence (for debugging). */
|
|
101
|
+
const xs: TXForDebugging[] = [];
|
|
102
|
+
/** The antipode of the two-prong (successively refined) */
|
|
103
|
+
let zs: PointOnShape[] = undefined!;
|
|
104
|
+
let z: PointOnShape = undefined!;
|
|
105
|
+
let bezierPieces_ = bezierPieces;
|
|
106
|
+
|
|
107
|
+
let i = 0;
|
|
108
|
+
while (i < MAX_ITERATIONS) {
|
|
109
|
+
const xy = squaredDistanceBetweenDd(x, y.p);
|
|
110
|
+
|
|
111
|
+
if (i < 5) { bezierPieces_ = cullBezierPieces2(bezierPieces_, x, xy); }
|
|
112
|
+
|
|
113
|
+
zs = getCloseBoundaryPointsCertified(
|
|
114
|
+
bezierPieces_, x, y.curve, y.t,
|
|
115
|
+
for1Prong && i == 0 && rO !== 1/minCurvature,
|
|
116
|
+
angle
|
|
117
|
+
).map(info => createPos(info.curve, info.t, false));
|
|
118
|
+
|
|
119
|
+
z = zs[0];
|
|
120
|
+
|
|
121
|
+
if (z === undefined) {
|
|
122
|
+
addDebugInfo2(isHoleClosing);
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const xz = squaredDistanceBetweenDd(x, z.p);
|
|
127
|
+
const yz = squaredDistanceBetweenDd(y.p, z.p);
|
|
128
|
+
|
|
129
|
+
// if on first try
|
|
130
|
+
if (i === 0) {
|
|
131
|
+
if (rO < (1 - 2**-6)*sqrt(xz)) {
|
|
132
|
+
add1Prong(rO, xO, cpTrees, y);
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
// return undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (typeof _debug_ !== 'undefined') { xs.push({ x, y, z: createPos(z.curve, z.t, false), t: y.t }); }
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if (!isHoleClosing) {
|
|
142
|
+
if (yz <= squaredSeperationTolerance) {
|
|
143
|
+
// if (typeof _debug_ !== 'undefined') { console.log(`failed: seperation too small - ${sqrt(yz)}`); }
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Find the point on the line connecting y with x that is
|
|
149
|
+
// equidistant from y and z. This will be our next x.
|
|
150
|
+
const nextX = findEquidistantPointOnLineDd(x, y.p, z.p);
|
|
151
|
+
const error = abs(sqrt(xy) - sqrt(xz));
|
|
152
|
+
// if (xy < xz) { return undefined; }
|
|
153
|
+
|
|
154
|
+
x = nextX;
|
|
155
|
+
|
|
156
|
+
if (error < errorTolerance) {
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
i++;
|
|
161
|
+
|
|
162
|
+
if (i === MAX_ITERATIONS) {
|
|
163
|
+
// Convergence was too slow.
|
|
164
|
+
if (typeof _debug_ !== 'undefined') { console.log('failed (slow): max iterations reached'); }
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// const zs_ = zs;
|
|
170
|
+
// console.log(zs.length)
|
|
171
|
+
// const zPos = createPos(z.curve, z.t, false);
|
|
172
|
+
|
|
173
|
+
const circle = { center: x, radius: distanceBetween(x, z.p) };
|
|
174
|
+
|
|
175
|
+
if (typeof _debug_ !== 'undefined') { addDebugInfo(bezierPieces, false, x, y, z, circle!, δ!, xs, isHoleClosing); }
|
|
176
|
+
|
|
177
|
+
// return { circle, zs: zs_ };
|
|
178
|
+
return { circle, zs: zs };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
function addDebugInfo2(isHoleClosing: boolean) {
|
|
183
|
+
if (typeof _debug_ !== 'undefined') {
|
|
184
|
+
const elems = _debug_.generated.elems;
|
|
185
|
+
const elem = isHoleClosing ? elems.twoProng_holeClosing : elems.twoProng_regular
|
|
186
|
+
const elemStr = isHoleClosing ? 'hole-closing: ' + elem.length : 'regular: ' + elem.length;
|
|
187
|
+
console.log('failed: no closest point - ' + elemStr);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { find2Prong }
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
-
import { Loop } from '
|
|
3
|
-
import { CpNode } from '
|
|
4
|
-
import {
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
4
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
5
5
|
import { findAndAdd2Prongs } from './find-and-add-2-prongs.js';
|
|
6
|
+
import { fixOrdering } from '../find-mat/fix-ordering.js';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
* @
|
|
10
|
+
* @internal
|
|
10
11
|
* Add 2 prongs. See comments on the add2Prong function.
|
|
11
12
|
* @param loops
|
|
12
13
|
* @param cpGraphs
|
|
@@ -15,19 +16,21 @@ import { findAndAdd2Prongs } from './find-and-add-2-prongs.js';
|
|
|
15
16
|
* tolerances.
|
|
16
17
|
*/
|
|
17
18
|
function findAndAdd2ProngsOnAllPaths(
|
|
19
|
+
cpNode: CpNode | undefined,
|
|
18
20
|
loops: Loop[],
|
|
19
21
|
cpGraphs: Map<Loop,LlRbTree<CpNode>>,
|
|
20
|
-
for2Prongss:
|
|
21
|
-
extreme: number
|
|
22
|
-
|
|
23
|
-
let cpNode;
|
|
22
|
+
for2Prongss: PointOnShape[][],
|
|
23
|
+
extreme: number,
|
|
24
|
+
for1Prongs: boolean) {
|
|
24
25
|
|
|
25
26
|
for (let k=0; k<for2Prongss.length; k++) {
|
|
26
27
|
const for2Prongs = for2Prongss[k];
|
|
27
|
-
const _cpNode = findAndAdd2Prongs(loops, cpGraphs, k, for2Prongs, extreme);
|
|
28
|
+
const _cpNode = findAndAdd2Prongs(loops, cpGraphs, k, for2Prongs, extreme, for1Prongs);
|
|
28
29
|
cpNode = cpNode || _cpNode;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
fixOrdering(cpNode!);
|
|
33
|
+
|
|
31
34
|
return cpNode;
|
|
32
35
|
}
|
|
33
36
|
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { Loop } from 'flo-boolean';
|
|
7
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
8
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
9
|
+
import { getShapeBounds } from '../svg/get-shape-bounds.js';
|
|
10
|
+
import { find2Prong } from './find-2-prong.js';
|
|
11
|
+
import { add2Prong } from './add-2-prong.js';
|
|
12
|
+
import { isPosDullCorner } from '../point-on-shape/is-pos-dull-corner.js';
|
|
13
|
+
import { getCornerAtEnd } from '../curve/curve.js';
|
|
14
|
+
import { getCorner } from '../corner/get-corner.js';
|
|
15
|
+
import { rotate90Degrees, rotateNeg90Degrees } from 'flo-vector2d';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const { PI, atan2 } = Math;
|
|
19
|
+
const ANGLE = 15*PI/180; // 15 degrees - don't make smaller than 2 degrees
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* Find and add two-prongs.
|
|
25
|
+
* @param loops
|
|
26
|
+
* @param cpGraphs
|
|
27
|
+
* @param k
|
|
28
|
+
* @param for2Prongs
|
|
29
|
+
* @param extreme The maximum coordinate value used to calculate floating point
|
|
30
|
+
* tolerances.
|
|
31
|
+
*/
|
|
32
|
+
function findAndAdd2Prongs(
|
|
33
|
+
loops: Loop[],
|
|
34
|
+
cpGraphs: Map<Loop,LlRbTree<CpNode>>,
|
|
35
|
+
k: number,
|
|
36
|
+
for2Prongs: PointOnShape[],
|
|
37
|
+
extreme: number,
|
|
38
|
+
for1Prongs: boolean) {
|
|
39
|
+
|
|
40
|
+
let cpNode_;
|
|
41
|
+
|
|
42
|
+
const bounds = getShapeBounds(loops);
|
|
43
|
+
const squaredDiagonalLength =
|
|
44
|
+
(bounds.maxX.p[0] - bounds.minX.p[0])**2 +
|
|
45
|
+
(bounds.maxY.p[1] - bounds.minY.p[1])**2;
|
|
46
|
+
|
|
47
|
+
for (let i=0; i<for2Prongs.length; i++) {
|
|
48
|
+
// const angles = [0];
|
|
49
|
+
let angles = [0];
|
|
50
|
+
const pos = for2Prongs[i];
|
|
51
|
+
if (pos.t === 1) {
|
|
52
|
+
const { curve } = pos;
|
|
53
|
+
const corner = getCorner(curve.ps, curve.next.ps);
|
|
54
|
+
if (corner.isQuiteDull) {
|
|
55
|
+
const tangentI = rotateNeg90Degrees(corner.tangents[0]);
|
|
56
|
+
const tangentO = rotateNeg90Degrees(corner.tangents[1]);
|
|
57
|
+
const a1 = ((atan2(tangentI[1], tangentI[0]) + 2*PI)%(2*PI));
|
|
58
|
+
const a2 = ((atan2(tangentO[1], tangentO[0]) + 2*PI)%(2*PI));
|
|
59
|
+
const a3 = ((a2 - a1) + 2*PI)%(2*PI);
|
|
60
|
+
let angle = ANGLE;
|
|
61
|
+
while (angle <= a3 - (ANGLE/2)) {
|
|
62
|
+
angles.push(angle);
|
|
63
|
+
angle += ANGLE;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (let angle of angles) {
|
|
68
|
+
const twoProngInfo = find2Prong(
|
|
69
|
+
angle, loops, extreme, squaredDiagonalLength, cpGraphs, pos, false, k, for1Prongs
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (twoProngInfo) {
|
|
73
|
+
const { circle, zs } = twoProngInfo;
|
|
74
|
+
const cpNode = add2Prong(cpGraphs, circle, pos, zs, false, extreme);
|
|
75
|
+
cpNode_ = cpNode_ || cpNode;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (typeof _debug_ !== 'undefined') {
|
|
79
|
+
if (i + 1 === _debug_.directives.stopAfterTwoProngsNum) { return undefined; }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return cpNode_;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
export { findAndAdd2Prongs }
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
-
import { Loop } from '
|
|
3
|
-
import { CpNode } from '
|
|
4
|
-
import { getShapeBounds } from '
|
|
5
|
-
import { getMinYPos } from '
|
|
6
|
-
import { find2Prong } from './find-2-prong
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
4
|
+
import { getShapeBounds } from '../svg/get-shape-bounds.js';
|
|
5
|
+
import { getMinYPos } from '../svg/get-min-y-pos.js';
|
|
6
|
+
import { find2Prong } from './find-2-prong.js';
|
|
7
7
|
import { add2Prong } from './add-2-prong.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
* Find and add two-prongs that remove any holes in the shape.
|
|
13
13
|
* @param loops The loops (that as a precondition must be ordered from
|
|
14
14
|
* highest (i.e. smallest y-value) topmost point loops to lowest)
|
|
@@ -34,7 +34,7 @@ function findAndAddHoleClosing2Prongs(
|
|
|
34
34
|
const posSource = minYs[k];
|
|
35
35
|
|
|
36
36
|
const holeClosingTwoProng = find2Prong(
|
|
37
|
-
loops, extreme, squaredDiagonalLength, cpTrees, posSource, true, k
|
|
37
|
+
0, loops, extreme, squaredDiagonalLength, cpTrees, posSource, true, k, false
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
if (!holeClosingTwoProng) {
|