flo-mat 2.0.5 → 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 +18165 -14291
- 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/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line-dd.d.ts +4 -3
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line-dd.js +5 -7
- 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/{mat/find-mat → find-3-prong.ts}/add-3-prong.js +32 -9
- 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 +20 -17
- 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/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line-dd.ts +8 -10
- 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/{mat/find-mat → find-3-prong.ts}/add-3-prong.ts +42 -17
- 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 +3 -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 +27 -26
- 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 -76
- 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 -77
- 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.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 -53
- 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 -263
- 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-dd.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 -17
- 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-points-on-curve.ts +0 -88
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +0 -38
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +0 -103
- package/src/mat/closest-boundary-point/get-closest-boundary-point-dd.ts +0 -62
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +0 -64
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +0 -74
- 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 -351
- 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 -24
- 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 -232
- package/src/svg/get-curvature-at-interface.ts +0 -55
- /package/node/{compare-curvatures-at-interface.d.ts → corner/compare-curvatures-at-interface.d.ts} +0 -0
- /package/node/{mat → corner}/corner.js +0 -0
- /package/node/{get-interface-ccw.d.ts → corner/get-interface-ccw.d.ts} +0 -0
- /package/node/{get-boundary-bezier-parts-to-next.d.ts → cp-node/get-boundary-bezier-parts-to-next.d.ts} +0 -0
- /package/node/{get-curve-to-next.d.ts → cp-node/get-curve-to-next.d.ts} +0 -0
- /package/node/{traverse-edges.d.ts → cp-node/traverse-edges.d.ts} +0 -0
- /package/node/{traverse-vertices.d.ts → cp-node/traverse-vertices.d.ts} +0 -0
- /package/node/{mat/find-mat/find-2-prong → find-2-prong}/x-for-debugging.js +0 -0
- /package/node/{circle.d.ts → geometry/circle.d.ts} +0 -0
- /package/node/{circle.js → geometry/circle.js} +0 -0
- /package/node/{get-bounding-box-.d.ts → geometry/get-bounding-box-.d.ts} +0 -0
- /package/node/{get-bounding-box-.js → geometry/get-bounding-box-.js} +0 -0
- /package/node/{mat.js → mat/mat.js} +0 -0
- /package/src/{circle.ts → geometry/circle.ts} +0 -0
- /package/src/{get-bounding-box-.ts → geometry/get-bounding-box-.ts} +0 -0
|
@@ -1,351 +0,0 @@
|
|
|
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 { lineLineIntersection, distanceBetween, squaredDistanceBetween, interpolate, dot } from 'flo-vector2d';
|
|
7
|
-
import { evalDeCasteljau as evalDeCasteljau_ } from 'flo-bezier3';
|
|
8
|
-
import { getClosestBoundaryPoint } from
|
|
9
|
-
'../../closest-boundary-point/get-closest-boundary-point.js';
|
|
10
|
-
import { CpNode } from '../../../cp-node.js';
|
|
11
|
-
import { Loop } from '../../../loop.js';
|
|
12
|
-
import { Circle } from '../../../circle.js';
|
|
13
|
-
import { getOsculatingCircle, IPointOnShape } from '../../../point-on-shape.js';
|
|
14
|
-
import { BezierPiece } from '../../bezier-piece.js';
|
|
15
|
-
import { add1Prong } from '../add-1-prong.js';
|
|
16
|
-
import { addDebugInfo } from './add-debug-info.js';
|
|
17
|
-
import { TXForDebugging } from './x-for-debugging.js';
|
|
18
|
-
import { cullBezierPieces } from './cull-bezier-pieces.js';
|
|
19
|
-
import { findEquidistantPointOnLine } from './find-equidistant-point-on-line.js';
|
|
20
|
-
import { findEquidistantPointOnLineDd } from './find-equidistant-point-on-line-dd.js';
|
|
21
|
-
import { getInitialBezierPieces } from './get-initial-bezier-pieces.js';
|
|
22
|
-
import { getCloseBoundaryPoints } from '../../closest-boundary-point/get-close-boundary-points.js';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const evalDeCasteljau = evalDeCasteljau_;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @hidden
|
|
30
|
-
* Adds a 2-prong to the MAT. The first point on the shape boundary is given and
|
|
31
|
-
* the second one is found by the algorithm.
|
|
32
|
-
*
|
|
33
|
-
* A 2-prong is defined as a MAT circle that touches the shape at exactly 2
|
|
34
|
-
* points.
|
|
35
|
-
*
|
|
36
|
-
* Before any 2-prongs are added the entire shape is our δΩ (1-prongs do not
|
|
37
|
-
* reduce the boundary).
|
|
38
|
-
*
|
|
39
|
-
* As per the paper by Choi, Choi, Moon and Wee:
|
|
40
|
-
* "The starting point of this algorithm is a choice of a circle Br(x)
|
|
41
|
-
* centered at an interior point x which contains two boundary portions c and
|
|
42
|
-
* d of dΩ as in Fig. 19."
|
|
43
|
-
* In fact, we (and they) start by fixing one point on the boundary beforehand.
|
|
44
|
-
* @param loops A shape represented by path loops
|
|
45
|
-
* @param extreme The extreme coordinate value of the shape
|
|
46
|
-
* @param squaredDiagonalLength The squared diagonal length of the shape
|
|
47
|
-
* bounding box.
|
|
48
|
-
* @param y The source point of the 2-prong to be found
|
|
49
|
-
* @param isHoleClosing True if this is a hole-closing two-prong, false otherwise
|
|
50
|
-
* @param k The loop array index
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
function find2Prong(
|
|
54
|
-
loops: Loop[],
|
|
55
|
-
extreme: number,
|
|
56
|
-
squaredDiagonalLength: number,
|
|
57
|
-
cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
58
|
-
y: IPointOnShape,
|
|
59
|
-
isHoleClosing: boolean,
|
|
60
|
-
k: number) {
|
|
61
|
-
|
|
62
|
-
const MAX_ITERATIONS = 25;
|
|
63
|
-
const squaredSeperationTolerance = (1e-5 * extreme)**2;
|
|
64
|
-
// TODO - base deltas on theory or remove
|
|
65
|
-
const oneProngTolerance = (1e-4)**2;
|
|
66
|
-
// const oneProngTolerance = (1e-5)**2;
|
|
67
|
-
// const oneProngTolerance = 0;
|
|
68
|
-
const squaredErrorTolerance = 1e-2 * squaredSeperationTolerance;
|
|
69
|
-
const maxOsculatingCircleRadiusSquared = squaredDiagonalLength;
|
|
70
|
-
|
|
71
|
-
// The boundary piece that should contain the other point of
|
|
72
|
-
// the 2-prong circle. (Defined by start and end points).
|
|
73
|
-
const { bezierPieces, δ } = getInitialBezierPieces(
|
|
74
|
-
isHoleClosing, k, loops, cpTrees, y
|
|
75
|
-
);
|
|
76
|
-
//console.log(bezierPieces.length)
|
|
77
|
-
|
|
78
|
-
/** The center of the two-prong (successively refined) */
|
|
79
|
-
let x: number[];
|
|
80
|
-
let p: number[];
|
|
81
|
-
let r: number;
|
|
82
|
-
if (isHoleClosing) {
|
|
83
|
-
p = [y.p[0], y.p[1]];
|
|
84
|
-
x = [p[0], p[1] - Math.sqrt(maxOsculatingCircleRadiusSquared)];
|
|
85
|
-
r = maxOsculatingCircleRadiusSquared;
|
|
86
|
-
} else {
|
|
87
|
-
p = y.p;
|
|
88
|
-
x = getOsculatingCircle(maxOsculatingCircleRadiusSquared, y).center;
|
|
89
|
-
r = squaredDistanceBetween(p,x);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The lines below is an optimization.
|
|
93
|
-
const r_ = reduceRadius(extreme, bezierPieces, p, x);
|
|
94
|
-
if (r > r_) {
|
|
95
|
-
x = interpolate(p, x, Math.sqrt(r_/r));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/** Trace the convergence (for debugging). */
|
|
100
|
-
const xs: TXForDebugging[] = [];
|
|
101
|
-
/** The antipode of the two-prong (successively refined) */
|
|
102
|
-
let z: { pos: IPointOnShape; d: number };
|
|
103
|
-
let i = 0;
|
|
104
|
-
let done = 0;
|
|
105
|
-
let failed = false; // The failed flag is set if a 2-prong cannot be found.
|
|
106
|
-
let bezierPieces_ = bezierPieces;
|
|
107
|
-
// ---> for (let b of bezierPieces) { d.fs.draw.bezierPiece(document.getElementsByTagName('g')[0], b.curve.ps, b.ts, 'nofill thin10 red', 100); }
|
|
108
|
-
do {
|
|
109
|
-
i++
|
|
110
|
-
|
|
111
|
-
/** squared distance between source boundary point and circle center */
|
|
112
|
-
const xy = squaredDistanceBetween(x, y.p);
|
|
113
|
-
|
|
114
|
-
bezierPieces_ = cullBezierPieces(bezierPieces_, x, xy);
|
|
115
|
-
|
|
116
|
-
z = getClosestBoundaryPoint(
|
|
117
|
-
bezierPieces_,
|
|
118
|
-
x,
|
|
119
|
-
y.curve,
|
|
120
|
-
y.t
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
if (z === undefined) {
|
|
124
|
-
if (typeof _debug_ !== 'undefined') {
|
|
125
|
-
const elems = _debug_.generated.elems;
|
|
126
|
-
const elem = isHoleClosing
|
|
127
|
-
? elems.twoProng_holeClosing
|
|
128
|
-
: elems.twoProng_regular
|
|
129
|
-
const elemStr = isHoleClosing
|
|
130
|
-
? 'hole-closing: ' + elem.length
|
|
131
|
-
: 'regular: ' + elem.length;
|
|
132
|
-
console.log(
|
|
133
|
-
'failed: no closest point - ' + elemStr
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
failed = true;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (typeof _debug_ !== 'undefined') {
|
|
141
|
-
xs.push({ x, y, z: z.pos, t: y.t });
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/** squared distance between anti-pode boundary point and circle center */
|
|
145
|
-
const xz = squaredDistanceBetween(x, z.pos.p);
|
|
146
|
-
//if (i === 1 && d*oneProngTolerance >= r) {
|
|
147
|
-
if (i === 1 && xy < xz+oneProngTolerance) {
|
|
148
|
-
// It is a 1-prong.
|
|
149
|
-
// TODO2 - below line was removed (maybe)
|
|
150
|
-
add1Prong(Math.sqrt(maxOsculatingCircleRadiusSquared), cpTrees, y);
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// TODO - squaredSeperationTolerance should in future be replaced with
|
|
155
|
-
// a relative error, i.e. distance between y (or z) / length(y (or z)).
|
|
156
|
-
const yz = squaredDistanceBetween(y.p, z.pos.p);
|
|
157
|
-
if (!isHoleClosing && yz <= squaredSeperationTolerance) {
|
|
158
|
-
if (typeof _debug_ !== 'undefined') {
|
|
159
|
-
/*
|
|
160
|
-
let elems = _debug_.generated.elems;
|
|
161
|
-
let elem = isHoleClosing
|
|
162
|
-
? elems.twoProng_holeClosing
|
|
163
|
-
: elems.twoProng_regular
|
|
164
|
-
let elemStr = isHoleClosing
|
|
165
|
-
? 'hole-closing: ' + elem.length
|
|
166
|
-
: 'regular: ' + elem.length;
|
|
167
|
-
console.log(
|
|
168
|
-
'failed: two-prong radius too small - ' + elemStr
|
|
169
|
-
);
|
|
170
|
-
*/
|
|
171
|
-
}
|
|
172
|
-
failed = true;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// TODO - Accuracy optimization: tolerance should not be between x and
|
|
177
|
-
// nextX, but rather (distance from x to y) - (distance from x to z)
|
|
178
|
-
|
|
179
|
-
// Find the point on the line connecting y with x that is
|
|
180
|
-
// equidistant from y and z. This will be our next x.
|
|
181
|
-
// const nextX = findEquidistantPointOnLineDd(x, y.p, z.pos.p);
|
|
182
|
-
const nextX = findEquidistantPointOnLine(x, y.p, z.pos.p);
|
|
183
|
-
const squaredError = squaredDistanceBetween(x, nextX);
|
|
184
|
-
// const squaredError = Math.abs(xy - xz);
|
|
185
|
-
|
|
186
|
-
x = nextX;
|
|
187
|
-
|
|
188
|
-
if (squaredError < squaredErrorTolerance) {
|
|
189
|
-
done++; // Do one more iteration
|
|
190
|
-
} else if (i === MAX_ITERATIONS) {
|
|
191
|
-
// Convergence was too slow.
|
|
192
|
-
failed = true;
|
|
193
|
-
break; // We're done
|
|
194
|
-
}
|
|
195
|
-
} while (done < 1);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
/************************************************************************ */
|
|
199
|
-
/* Do one more double-double precision iteration
|
|
200
|
-
/************************************************************************ */
|
|
201
|
-
/*
|
|
202
|
-
z = getClosestBoundaryPoint(
|
|
203
|
-
bezierPieces_, x, y.curve, y.t
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
if (z === undefined) {
|
|
207
|
-
failed = true;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (typeof _debug_ !== 'undefined') {
|
|
211
|
-
xs.push({ x, y, z: z.pos, t: y.t });
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (!isHoleClosing && squaredDistanceBetween(y.p, z.pos.p) <= squaredSeperationTolerance) {
|
|
215
|
-
failed = true;
|
|
216
|
-
} else {
|
|
217
|
-
x = findEquidistantPointOnLineDd(x, y.p, z.pos.p);
|
|
218
|
-
}
|
|
219
|
-
/************************************************************************ */
|
|
220
|
-
/************************************************************************ */
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// TODO - Optimization: only do this if second closest point is within the
|
|
224
|
-
// tolerance which can be checked in getClosestBoundaryPoint algorithm
|
|
225
|
-
let zs: { pos: IPointOnShape; d: number; }[] = [];
|
|
226
|
-
if (!failed) {
|
|
227
|
-
zs = getCloseBoundaryPoints(
|
|
228
|
-
bezierPieces_,
|
|
229
|
-
x,
|
|
230
|
-
y,
|
|
231
|
-
distanceBetween(x, z.pos.p)
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
if (!zs.length) {
|
|
235
|
-
// TODO - Numerical issue - fix
|
|
236
|
-
zs.push(z);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
let circle: Circle;
|
|
241
|
-
if (z !== undefined) {
|
|
242
|
-
circle = { center: x, radius: distanceBetween(x, z.pos.p) };
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
// TODO2
|
|
247
|
-
// if (Math.random() > 0.8 && !isHoleClosing) { return undefined; }
|
|
248
|
-
|
|
249
|
-
if (typeof _debug_ !== 'undefined' && !failed) {
|
|
250
|
-
xs.push({ x, y, z: z.pos, t: y.t });
|
|
251
|
-
addDebugInfo(bezierPieces, failed, y, circle, z.pos, δ, xs, isHoleClosing);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return failed ? undefined : { circle, zs };
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @hidden
|
|
260
|
-
* Reduces the circle radius initially as an optimization step.
|
|
261
|
-
*/
|
|
262
|
-
function reduceRadius(
|
|
263
|
-
extreme: number,
|
|
264
|
-
bezierPieces: BezierPiece[],
|
|
265
|
-
p: number[],
|
|
266
|
-
x: number[]) {
|
|
267
|
-
|
|
268
|
-
const TOLERANCE = extreme * 1e-3;
|
|
269
|
-
|
|
270
|
-
let prevP = undefined;
|
|
271
|
-
let minRadius = Number.POSITIVE_INFINITY;
|
|
272
|
-
for (let i=0; i<bezierPieces.length; i++) {
|
|
273
|
-
const bezierPiece = bezierPieces[i];
|
|
274
|
-
|
|
275
|
-
const ps = bezierPiece.curve.ps;
|
|
276
|
-
|
|
277
|
-
const p1 = evalDeCasteljau(ps, bezierPiece.ts[0]);
|
|
278
|
-
let r1 = Number.POSITIVE_INFINITY;
|
|
279
|
-
|
|
280
|
-
// Prevent evaluating the same points twice
|
|
281
|
-
if (!prevP || prevP[0] !== p1[0] || prevP[1] !== p1[1]) {
|
|
282
|
-
const cc1 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p1);
|
|
283
|
-
if (cc1) { r1 = squaredDistanceBetween(p, cc1); }
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
let r2 = Number.POSITIVE_INFINITY;
|
|
287
|
-
const p2 = evalDeCasteljau(ps, bezierPiece.ts[1]);
|
|
288
|
-
|
|
289
|
-
const cc2 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p2);
|
|
290
|
-
if (cc2) { r2 = squaredDistanceBetween(p, cc2); }
|
|
291
|
-
|
|
292
|
-
prevP = p2;
|
|
293
|
-
|
|
294
|
-
const d = Math.min(r1, r2);
|
|
295
|
-
|
|
296
|
-
if (d < minRadius) {
|
|
297
|
-
minRadius = d;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// The extra bit is to account for floating point precision.
|
|
302
|
-
// TODO - base delta on theory
|
|
303
|
-
return minRadius + TOLERANCE;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* @hidden
|
|
309
|
-
* @param p A point on the circle with normal pointing to x towards the center
|
|
310
|
-
* of the circle.
|
|
311
|
-
* @param x
|
|
312
|
-
* @param p1 Another point on the circle.
|
|
313
|
-
*/
|
|
314
|
-
function getCircleCenterFrom2PointsAndNormal(
|
|
315
|
-
extreme: number,
|
|
316
|
-
p: number[],
|
|
317
|
-
x: number[],
|
|
318
|
-
p1: number[]) {
|
|
319
|
-
|
|
320
|
-
// TODO - remove delta
|
|
321
|
-
const TOLERANCE = (1e-4 * extreme)**2;
|
|
322
|
-
|
|
323
|
-
// Ignore if p and p1 are too close together
|
|
324
|
-
if (squaredDistanceBetween(p,p1) < TOLERANCE) {
|
|
325
|
-
return undefined;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/** The perpindicular bisector between the two given points on the circle */
|
|
329
|
-
const pb = [
|
|
330
|
-
(p[0] + p1[0]) / 2,
|
|
331
|
-
(p[1] + p1[1]) / 2,
|
|
332
|
-
];
|
|
333
|
-
const tan = [p1[0] - p[0], p1[1] - p[1]];
|
|
334
|
-
const norm = [-tan[1], tan[0]]; // Rotate by 90 degrees
|
|
335
|
-
const pb2 = [pb[0] + norm[0], pb[1] + norm[1]];
|
|
336
|
-
|
|
337
|
-
const res = lineLineIntersection([p,x], [pb, pb2]);
|
|
338
|
-
|
|
339
|
-
if (!res) { return undefined; }
|
|
340
|
-
|
|
341
|
-
const resO = [res[0] - p[0], res[1] - p[1]];
|
|
342
|
-
const xO = [x[0] - p[0], x[1] - p[1]];
|
|
343
|
-
if (dot(resO, xO) < 0) {
|
|
344
|
-
return undefined;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return res;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
export { find2Prong }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
-
import { getNeighbouringPoints } from '../../get-neighboring-cps.js';
|
|
3
|
-
import { getBoundaryPieceBeziers } from '../../get-boundary-piece-beziers.js';
|
|
4
|
-
import { BezierPiece } from '../../bezier-piece.js';
|
|
5
|
-
import { Loop } from '../../../loop.js';
|
|
6
|
-
import { CpNode } from '../../../cp-node.js';
|
|
7
|
-
import { isPosDullCorner, IPointOnShape } from '../../../point-on-shape.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** @hidden */
|
|
11
|
-
function getInitialBezierPieces(
|
|
12
|
-
isHoleClosing: boolean,
|
|
13
|
-
k: number,
|
|
14
|
-
loops: Loop[],
|
|
15
|
-
cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
16
|
-
y: IPointOnShape) {
|
|
17
|
-
|
|
18
|
-
let bezierPieces: BezierPiece[];
|
|
19
|
-
let δ: CpNode[];
|
|
20
|
-
|
|
21
|
-
if (isHoleClosing) {
|
|
22
|
-
bezierPieces = [];
|
|
23
|
-
for (let k2=0; k2<k; k2++) {
|
|
24
|
-
const pieces: BezierPiece[] = loops[k2].curves
|
|
25
|
-
.map(curve => ({ curve, ts: [0,1] }))
|
|
26
|
-
bezierPieces.push(...pieces);
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
//let order = PointOnShape.isDullCorner(y)
|
|
30
|
-
const order = isPosDullCorner(y)
|
|
31
|
-
? y.t === 1 ? -1 : +1
|
|
32
|
-
: 0;
|
|
33
|
-
const loop = loops[k];
|
|
34
|
-
const cpNode = getNeighbouringPoints(cpTrees.get(loop), y, order, 0)[0];
|
|
35
|
-
δ = [cpNode, cpNode];
|
|
36
|
-
if (!cpNode ||
|
|
37
|
-
// The special case if there is only a single sharp corner or
|
|
38
|
-
// terminating 2-prong currently in the MAT. Don't remove!
|
|
39
|
-
(cpNode === cpNode.next.next)
|
|
40
|
-
) {
|
|
41
|
-
bezierPieces = loop.curves
|
|
42
|
-
.map(curve => ({ curve, ts: [0,1] }))
|
|
43
|
-
} else {
|
|
44
|
-
bezierPieces = getBoundaryPieceBeziers(δ);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return { bezierPieces, δ };
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export { getInitialBezierPieces }
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
declare const _debug_: Debug;
|
|
3
|
-
|
|
4
|
-
import { fromTo } from 'flo-bezier3';
|
|
5
|
-
import { Debug } from '../../../debug/debug.js';
|
|
6
|
-
import { CpNode } from '../../../cp-node.js';
|
|
7
|
-
import { Circle } from '../../../circle.js';
|
|
8
|
-
import { IPointOnShape } from '../../../point-on-shape.js';
|
|
9
|
-
import { createEmptyThreeProngForDebugging } from '../../../debug/three-prong-for-debugging.js';
|
|
10
|
-
import { find3ProngForDelta3s } from './find-3-prong-for-delta3s.js';
|
|
11
|
-
import { getBoundaryPieceBeziers } from '../../get-boundary-piece-beziers.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
* Find and return a 3-prong from the given boundary piece.
|
|
17
|
-
* @param δs A boundary piece
|
|
18
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
19
|
-
* tolerances.
|
|
20
|
-
*/
|
|
21
|
-
function find3Prong(δs: CpNode[][], extreme: number) {
|
|
22
|
-
const bezierPiecess = δs.map(getBoundaryPieceBeziers);
|
|
23
|
-
|
|
24
|
-
if (typeof _debug_ !== 'undefined') {
|
|
25
|
-
const threeProngs = _debug_.generated.elems.threeProng;
|
|
26
|
-
threeProngs.push(createEmptyThreeProngForDebugging());
|
|
27
|
-
|
|
28
|
-
const d = threeProngs[threeProngs.length-1];
|
|
29
|
-
d.boundaries = [];
|
|
30
|
-
for (const bezierPieces of bezierPiecess) {
|
|
31
|
-
const boundary: number[][][] = [];
|
|
32
|
-
d.boundaries.push(boundary);
|
|
33
|
-
for (const bezierPiece of bezierPieces) {
|
|
34
|
-
/* qqq
|
|
35
|
-
let bezier = fromTo(bezierPiece.curve.ps)(
|
|
36
|
-
bezierPiece.ts[0], bezierPiece.ts[1]
|
|
37
|
-
);
|
|
38
|
-
*/
|
|
39
|
-
const bezier = fromTo(
|
|
40
|
-
bezierPiece.curve.ps,
|
|
41
|
-
bezierPiece.ts[0], bezierPiece.ts[1]
|
|
42
|
-
);
|
|
43
|
-
boundary.push(bezier);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
d.traces = [];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const candidateThreeProngs = [];
|
|
50
|
-
|
|
51
|
-
// The best candidate amongst the different 'permutations' of the given δs.
|
|
52
|
-
let threeProng: {
|
|
53
|
-
circle: Circle,
|
|
54
|
-
ps: IPointOnShape[],
|
|
55
|
-
δ3s: CpNode[][]
|
|
56
|
-
};
|
|
57
|
-
let bestIndx = undefined;
|
|
58
|
-
let smallestError = Number.POSITIVE_INFINITY;
|
|
59
|
-
for (let i=1; i<δs.length-1; i++) {
|
|
60
|
-
for (let k=0; k<3; k++) {
|
|
61
|
-
if (typeof _debug_ !== 'undefined') {
|
|
62
|
-
const threeProngs = _debug_.generated.elems.threeProng;
|
|
63
|
-
const d = threeProngs[threeProngs.length-1];
|
|
64
|
-
const trace: number[][] = [];
|
|
65
|
-
d.traces.push(trace);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const threeProngInfo =
|
|
69
|
-
find3ProngForDelta3s(δs, i, k, bezierPiecess, extreme);
|
|
70
|
-
if (!threeProngInfo) { continue; }
|
|
71
|
-
|
|
72
|
-
const { circle, ps, error, δ3s } = threeProngInfo;
|
|
73
|
-
|
|
74
|
-
if (typeof _debug_ !== 'undefined') {
|
|
75
|
-
candidateThreeProngs.push({ circle, ps });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (error < smallestError) {
|
|
79
|
-
smallestError = error;
|
|
80
|
-
|
|
81
|
-
bestIndx = i-1;
|
|
82
|
-
threeProng = { circle, ps, δ3s };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//threeProng.δ3s = [δs[0], δs[bestIndx+1], δs[δs.length-1]];
|
|
88
|
-
|
|
89
|
-
if (typeof _debug_ !== 'undefined') {
|
|
90
|
-
const threeProngs = _debug_.generated.elems.threeProng;
|
|
91
|
-
const d = threeProngs[threeProngs.length-1];
|
|
92
|
-
|
|
93
|
-
d.generated = _debug_.generated;
|
|
94
|
-
d.circle = threeProng.circle;
|
|
95
|
-
d.poss = threeProng.ps;
|
|
96
|
-
d.cp3ss = threeProng.δ3s;
|
|
97
|
-
d.cpss = δs;
|
|
98
|
-
d.bestIndx = bestIndx;
|
|
99
|
-
d.candidateThreeProngs = candidateThreeProngs;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return threeProng;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
export { find3Prong }
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BezierPiece } from '../../bezier-piece.js';
|
|
2
|
-
import { getClosestBoundaryPoint } from '../../closest-boundary-point/get-closest-boundary-point.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
* @param x
|
|
8
|
-
* @param bezierPiece3s
|
|
9
|
-
* @param extreme
|
|
10
|
-
*/
|
|
11
|
-
function getClosestPoints(
|
|
12
|
-
x: number[],
|
|
13
|
-
bezierPiece3s: BezierPiece[][]) {
|
|
14
|
-
|
|
15
|
-
return bezierPiece3s.map(bezierPieces => {
|
|
16
|
-
const posInfo = getClosestBoundaryPoint(
|
|
17
|
-
bezierPieces,
|
|
18
|
-
x,
|
|
19
|
-
undefined, // curve
|
|
20
|
-
undefined // t
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return posInfo ? posInfo.pos : undefined;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export { getClosestPoints }
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
declare const _debug_: Debug;
|
|
3
|
-
|
|
4
|
-
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
|
-
import { Debug } from '../../debug/debug.js';
|
|
6
|
-
import { Loop } from '../../loop.js';
|
|
7
|
-
import { CpNode } from '../../cp-node.js';
|
|
8
|
-
import { IPointOnShape } from '../../point-on-shape.js';
|
|
9
|
-
import { getShapeBounds } from '../../svg/get-shape-bounds.js';
|
|
10
|
-
import { Circle } from '../../circle.js';
|
|
11
|
-
import { find2Prong } from './find-2-prong/find-2-prong.js';
|
|
12
|
-
import { add2Prong } from './add-2-prong.js';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
* Find and add two-prongs.
|
|
18
|
-
* @param loops
|
|
19
|
-
* @param cpGraphs
|
|
20
|
-
* @param k
|
|
21
|
-
* @param for2Prongs
|
|
22
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
23
|
-
* tolerances.
|
|
24
|
-
*/
|
|
25
|
-
function findAndAdd2Prongs(
|
|
26
|
-
loops: Loop[],
|
|
27
|
-
cpGraphs: Map<Loop,LlRbTree<CpNode>>,
|
|
28
|
-
k: number,
|
|
29
|
-
for2Prongs: IPointOnShape[],
|
|
30
|
-
extreme: number) {
|
|
31
|
-
|
|
32
|
-
const len = for2Prongs.length;
|
|
33
|
-
const index = indexLinear(len);
|
|
34
|
-
//const index = indexInterlaced(len); // Keep for possible future use.
|
|
35
|
-
let cpNode_;
|
|
36
|
-
|
|
37
|
-
const bounds = getShapeBounds(loops);
|
|
38
|
-
const squaredDiagonalLength =
|
|
39
|
-
(bounds.maxX.p[0] - bounds.minX.p[0])**2 +
|
|
40
|
-
(bounds.maxY.p[1] - bounds.minY.p[1])**2;
|
|
41
|
-
|
|
42
|
-
for (let i=0; i<len; i++) {
|
|
43
|
-
const pos = for2Prongs[index[i]];
|
|
44
|
-
|
|
45
|
-
const twoProngInfo: { circle: Circle, zs: { pos: IPointOnShape, d: number }[] } = find2Prong(
|
|
46
|
-
loops, extreme, squaredDiagonalLength, cpGraphs, pos, false, k
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
if (twoProngInfo) {
|
|
50
|
-
const { circle, zs } = twoProngInfo;
|
|
51
|
-
const cpNode = add2Prong(cpGraphs, circle, pos, zs, false, extreme);
|
|
52
|
-
cpNode_ = cpNode_ || cpNode;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (typeof _debug_ !== 'undefined') {
|
|
56
|
-
if (i+1 === _debug_.directives.stopAfterTwoProngsNum) {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return cpNode_;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @hidden
|
|
68
|
-
* Simple linear array indexing.
|
|
69
|
-
* @param n
|
|
70
|
-
*/
|
|
71
|
-
function indexLinear(n: number) {
|
|
72
|
-
const arr = [];
|
|
73
|
-
for (let i=0; i<n; i++) {
|
|
74
|
-
arr.push(i);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return arr;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @hidden
|
|
83
|
-
* Creates a kind of interlaced index vector.
|
|
84
|
-
* @param n
|
|
85
|
-
*/
|
|
86
|
-
function indexInterlaced(n: number) {
|
|
87
|
-
const source: { [index:number]: boolean } = {};
|
|
88
|
-
const arr = [];
|
|
89
|
-
// l is the lowest power of 2 so that 2^l > n
|
|
90
|
-
let l = Math.pow(2, Math.floor(Math.log2(n)));
|
|
91
|
-
|
|
92
|
-
while (l >= 1) {
|
|
93
|
-
let k = 0;
|
|
94
|
-
while (k < n) {
|
|
95
|
-
if (!source[k]) {
|
|
96
|
-
arr.push(k);
|
|
97
|
-
source[k] = true;
|
|
98
|
-
}
|
|
99
|
-
k = k + l;
|
|
100
|
-
}
|
|
101
|
-
l = l/2;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return arr;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
export { findAndAdd2Prongs }
|