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
package/src/mat/trim-mat.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Mat } from '
|
|
1
|
+
import { Mat } from './mat.js';
|
|
2
2
|
import { createNewCpTree } from './create-new-cp-tree.js';
|
|
3
|
-
import { cullNonCycles } from '
|
|
3
|
+
import { cullNonCycles } from '../sat/cull-non-cycles.js';
|
|
4
4
|
import { clone } from '../cp-node/clone.js';
|
|
5
5
|
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ import { clone } from '../cp-node/clone.js';
|
|
|
12
12
|
function trimMat(mat: Mat): Mat {
|
|
13
13
|
const cpNode = cullNonCycles(clone(mat.cpNode));
|
|
14
14
|
|
|
15
|
-
if (!cpNode) { return undefined
|
|
15
|
+
if (!cpNode) { return undefined!; }
|
|
16
16
|
|
|
17
17
|
return { cpNode, cpTrees: createNewCpTree(cpNode) };
|
|
18
18
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { dot, fromTo, rotateNeg90Degrees, toUnitVector } from "flo-vector2d";
|
|
2
|
+
import { Circle } from "../geometry/circle.js";
|
|
3
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
4
|
+
import { isPosCorner } from './is-pos-corner.js';
|
|
5
|
+
import { isPosDullCorner } from "./is-pos-dull-corner.js";
|
|
6
|
+
import { getPosCorner } from './get-pos-corner.js';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* Calculates the order (to distinguish between points lying on top of each
|
|
14
|
+
* other) of the contact point if it is a dull corner.
|
|
15
|
+
*
|
|
16
|
+
* @param circle
|
|
17
|
+
* @param pos
|
|
18
|
+
*/
|
|
19
|
+
function calcPosOrder(
|
|
20
|
+
circle: Circle,
|
|
21
|
+
pos: PointOnShape): number {
|
|
22
|
+
|
|
23
|
+
if (!isPosCorner(pos)) { return 0; }
|
|
24
|
+
if (!isPosDullCorner(pos)) { return 0; }
|
|
25
|
+
|
|
26
|
+
const corner = getPosCorner(pos);
|
|
27
|
+
|
|
28
|
+
const n = rotateNeg90Degrees(corner.tangents[0]);
|
|
29
|
+
const v = toUnitVector( fromTo(pos.p, circle.center) );
|
|
30
|
+
|
|
31
|
+
return -dot(n, v);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export { calcPosOrder }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compares two [[PointOnShape]]s according to their cyclic ordering imposed
|
|
6
|
+
* by their relative positions on the shape boundary.
|
|
7
|
+
* @param a The first [[PointOnShape]].
|
|
8
|
+
* @param b The second [[PointOnShape]].
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function comparePoss(
|
|
12
|
+
a: PointOnShape,
|
|
13
|
+
b: PointOnShape): number {
|
|
14
|
+
|
|
15
|
+
let res;
|
|
16
|
+
|
|
17
|
+
res = a.curve.idx - b.curve.idx;
|
|
18
|
+
if (res !== 0) { return res; }
|
|
19
|
+
|
|
20
|
+
res = a.t - b.t;
|
|
21
|
+
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export { comparePoss }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { evalDeCasteljauDd } from "flo-bezier3"
|
|
2
|
+
import { Curve } from "../curve/curve.js"
|
|
3
|
+
import { PointOnShape } from "./point-on-shape.js"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function createPos(
|
|
7
|
+
curve: Curve,
|
|
8
|
+
t: number,
|
|
9
|
+
source: boolean): PointOnShape {
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
curve,
|
|
13
|
+
t,
|
|
14
|
+
p: evalDeCasteljauDd(curve.ps, [0,t]).map(c => c[1]),
|
|
15
|
+
// angle
|
|
16
|
+
source
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export { createPos }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { tangentExact, ddCurvature } from 'flo-bezier3';
|
|
2
|
+
import { Circle } from '../geometry/circle.js';
|
|
3
|
+
import { PointOnShape } from './point-on-shape.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the osculating circle at this point of the curve.
|
|
9
|
+
* @param maxOsculatingCircleRadius If not Number.POSITIVE_INFINITY then the
|
|
10
|
+
* circle radius will be limited to this value.
|
|
11
|
+
* @param pos The [[PointOnShape]] identifying the point.
|
|
12
|
+
*/
|
|
13
|
+
function getOsculatingCircle(
|
|
14
|
+
minCurvature: number,
|
|
15
|
+
pos: PointOnShape,
|
|
16
|
+
useMaxRadius = false): Circle {
|
|
17
|
+
|
|
18
|
+
const ps = pos.curve.ps;
|
|
19
|
+
const { p, t } = pos;
|
|
20
|
+
|
|
21
|
+
let k = -ddCurvature(ps, t);
|
|
22
|
+
|
|
23
|
+
if (k < minCurvature || useMaxRadius) {
|
|
24
|
+
k = minCurvature;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const tangent_ = tangentExact(ps,t).map(c => c[c.length-1]);
|
|
28
|
+
const normal_ = [-tangent_[1],tangent_[0]];
|
|
29
|
+
const l = Math.sqrt(normal_[0]**2 + normal_[1]**2);
|
|
30
|
+
const circleCenter = [
|
|
31
|
+
p[0] - normal_[0]/(k*l),
|
|
32
|
+
p[1] - normal_[1]/(k*l)
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
return { center: circleCenter, radius: 1/k };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export { getOsculatingCircle }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getCornerAtEnd } from "../curve/curve.js";
|
|
2
|
+
import { Corner } from "../corner/corner.js";
|
|
3
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function getPosCorner(pos: PointOnShape): Corner {
|
|
10
|
+
return getCornerAtEnd(
|
|
11
|
+
pos.t === 1 ? pos.curve : pos.curve.prev
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export { getPosCorner }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { memoize } from "flo-memoize";
|
|
2
|
+
import { getPosCorner } from "./get-pos-corner.js";
|
|
3
|
+
import { isPosCorner } from "./is-pos-corner.js";
|
|
4
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
const isPosDullCorner = memoize((pos: PointOnShape) => {
|
|
10
|
+
if (!isPosCorner(pos)) { return false; }
|
|
11
|
+
|
|
12
|
+
return getPosCorner(pos).isDull;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export { isPosDullCorner }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { memoize } from 'flo-memoize';
|
|
2
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
3
|
+
import { isPosCorner } from './is-pos-corner.js';
|
|
4
|
+
import { getPosCorner } from './get-pos-corner.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
const isPosQuiteDullCorner = memoize((pos: PointOnShape) => {
|
|
11
|
+
if (!isPosCorner(pos)) { return false; }
|
|
12
|
+
|
|
13
|
+
return getPosCorner(pos).isQuiteDull;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export { isPosQuiteDullCorner }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { memoize } from 'flo-memoize';
|
|
2
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
3
|
+
import { isPosCorner } from './is-pos-corner.js';
|
|
4
|
+
import { getPosCorner } from './get-pos-corner.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
const isPosQuiteSharpCorner = memoize((pos: PointOnShape) => {
|
|
11
|
+
if (!isPosCorner(pos)) { return false; }
|
|
12
|
+
|
|
13
|
+
return getPosCorner(pos).isQuiteSharp;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export { isPosQuiteSharpCorner }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { memoize } from "flo-memoize";
|
|
2
|
+
import { getPosCorner } from "./get-pos-corner.js";
|
|
3
|
+
import { isPosCorner } from "./is-pos-corner.js";
|
|
4
|
+
import { PointOnShape } from "./point-on-shape.js";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
const isPosSharpCorner = memoize((pos: PointOnShape) => {
|
|
11
|
+
if (!isPosCorner(pos)) { return false; }
|
|
12
|
+
|
|
13
|
+
return getPosCorner(pos).isSharp;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export { isPosSharpCorner }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Curve } from '../curve/curve.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
interface PointOnShape {
|
|
5
|
+
/** The [[ICurve]] on the shape boundary this points belong to. */
|
|
6
|
+
curve: Curve;
|
|
7
|
+
/** The bezier parameter value on the curve identifying the point coordinates. */
|
|
8
|
+
t: number;
|
|
9
|
+
p: number[];
|
|
10
|
+
/** just for debugging */
|
|
11
|
+
source: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { PointOnShape }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PointOnShape } from "./point-on-shape.js"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns a human-readable string of the given [[PointOnShape]].
|
|
6
|
+
* For debugging only.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
function posToHumanString(pos: PointOnShape) {
|
|
10
|
+
return '' + pos.p[0] + ', ' + pos.p[1] +
|
|
11
|
+
' | bz: ' + pos.curve.idx +
|
|
12
|
+
' | t: ' + pos.t
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export { posToHumanString }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _debug_: Debug;
|
|
2
2
|
|
|
3
|
-
import { Debug } from '
|
|
4
|
-
import { Mat } from '
|
|
3
|
+
import { Debug } from '../debug/debug.js';
|
|
4
|
+
import { Mat } from '../mat/mat.js';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
* @param sat
|
|
10
10
|
*/
|
|
11
11
|
function addDebugInfo(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { getLeaves } from '
|
|
2
|
-
import { CpNode } from '
|
|
1
|
+
import { getLeaves } from './get-leaves.js';
|
|
2
|
+
import { CpNode, getProngCount, isOnSameCircle, isTerminating } from '../cp-node/cp-node.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @internal
|
|
7
7
|
* Cull all edges not part of a cycle in the MAT planar graph.
|
|
8
8
|
* @param cpStart The start CpNode which must reprsesent the maximal 3-prong
|
|
9
9
|
* vertex.
|
|
@@ -16,7 +16,7 @@ function cullNonCycles(cpStart: CpNode) {
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
while (leaves.length) {
|
|
19
|
-
const leaf = leaves.pop()
|
|
19
|
+
const leaf = leaves.pop()!;
|
|
20
20
|
|
|
21
21
|
// Preserve topology - keep cycles.
|
|
22
22
|
if (leaf.isHoleClosing || leaf.isIntersection) { continue; }
|
|
@@ -28,19 +28,19 @@ function cullNonCycles(cpStart: CpNode) {
|
|
|
28
28
|
let cut = false;
|
|
29
29
|
const cp1 = cpNode.prevOnCircle;
|
|
30
30
|
|
|
31
|
-
if (
|
|
31
|
+
if (getProngCount(cpNode) > 2) {
|
|
32
32
|
//const cp2 = cp1.prevOnCircle;
|
|
33
33
|
const cp2 = cpNode.nextOnCircle;
|
|
34
34
|
|
|
35
35
|
//if (cpStart === cpNode || cpStart === cp1 || cpStart === cp2) {
|
|
36
|
-
if (
|
|
36
|
+
if (isOnSameCircle(cpNode, cpStart)) {
|
|
37
37
|
cut = true; // We are at the max disk - cut whole edge
|
|
38
38
|
} else if (cpNode.next === cp2) {
|
|
39
39
|
cpNode = cp2;
|
|
40
40
|
} else if (cp2.next !== cp1) {
|
|
41
41
|
cut = true; // Cut whole edge
|
|
42
42
|
}
|
|
43
|
-
} else if (
|
|
43
|
+
} else if (isTerminating(cpNode) && !cpNode.isIntersection) {
|
|
44
44
|
cpNodeKept = cpNode;
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Circle } from '
|
|
2
|
-
import { getLeaves } from '
|
|
3
|
-
import { CpNode } from '
|
|
1
|
+
import { Circle } from '../geometry/circle.js';
|
|
2
|
+
import { getLeaves } from './get-leaves.js';
|
|
3
|
+
import { CpNode, isOnSameCircle } from '../cp-node/cp-node.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
* Returns the set of Vertices passing the following test: walk the MAT tree and
|
|
9
9
|
* keep all Vertices not in the current cull set and any Vertices that have a
|
|
10
10
|
* non-culled node further down the line toward the tree leaves.
|
|
@@ -32,7 +32,7 @@ function cull(
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
while (leaves.length) {
|
|
35
|
-
const leaf = leaves.pop()
|
|
35
|
+
const leaf = leaves.pop()!;
|
|
36
36
|
|
|
37
37
|
// Preserve topology.
|
|
38
38
|
if (leaf.isHoleClosing || leaf.isIntersection) { continue; }
|
|
@@ -51,7 +51,7 @@ function cull(
|
|
|
51
51
|
if (!culls.has(cpNode.cp.circle)) {
|
|
52
52
|
// Cut off the edge once a non-cull has been reached.
|
|
53
53
|
cut = true;
|
|
54
|
-
} else if (
|
|
54
|
+
} else if (isOnSameCircle(cpNode, maxCpNode)) {
|
|
55
55
|
cut = true; // We are at the max disk - cut whole edge
|
|
56
56
|
} else {
|
|
57
57
|
const cps = getNonTrivialEdges(cpNode);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CpNode } from '../cp-node.js';
|
|
1
|
+
import { CpNode, getAllOnLoop, isTerminating } from '../cp-node/cp-node.js';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
/** @
|
|
4
|
+
/** @internal */
|
|
5
5
|
function getLeaves(cpNode: CpNode) {
|
|
6
6
|
const leaves: CpNode[] = [];
|
|
7
7
|
|
|
8
|
-
const cps =
|
|
8
|
+
const cps = getAllOnLoop(cpNode);
|
|
9
9
|
cps.forEach(function(cp) {
|
|
10
|
-
if (
|
|
10
|
+
if (isTerminating(cp)) {
|
|
11
11
|
leaves.push(cp);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
declare const _debug_: Debug;
|
|
3
3
|
|
|
4
4
|
import { length } from 'flo-bezier3';
|
|
5
|
-
import { Debug } from '
|
|
6
|
-
import { CpNode } from '
|
|
7
|
-
import { Circle } from '
|
|
8
|
-
import { Mat } from '
|
|
9
|
-
import { traverseEdges } from '
|
|
10
|
-
import { traverseVertices } from '
|
|
11
|
-
import { getLargestVertex } from '
|
|
12
|
-
import { createNewCpTree } from '
|
|
13
|
-
import { getLeaves } from './
|
|
14
|
-
import { cull } from './
|
|
15
|
-
import { addDebugInfo } from './
|
|
16
|
-
import { clone } from '
|
|
17
|
-
import { getCurveToNext } from '
|
|
5
|
+
import { Debug } from '../debug/debug.js';
|
|
6
|
+
import { CpNode, getCpNodesOnCircle } from '../cp-node/cp-node.js';
|
|
7
|
+
import { Circle } from '../geometry/circle.js';
|
|
8
|
+
import { Mat } from '../mat/mat.js';
|
|
9
|
+
import { traverseEdges } from '../cp-node/traverse-edges.js';
|
|
10
|
+
import { traverseVertices } from '../cp-node/traverse-vertices.js';
|
|
11
|
+
import { getLargestVertex } from '../mat/get-largest-vertex.js';
|
|
12
|
+
import { createNewCpTree } from '../mat/create-new-cp-tree.js';
|
|
13
|
+
import { getLeaves } from './get-leaves.js';
|
|
14
|
+
import { cull } from './cull.js';
|
|
15
|
+
import { addDebugInfo } from './add-debug-info.js';
|
|
16
|
+
import { clone } from '../cp-node/clone.js';
|
|
17
|
+
import { getCurveToNext } from '../cp-node/get-curve-to-next.js';
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
function linearScale(s: number) {
|
|
@@ -24,7 +24,7 @@ function linearScale(s: number) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
/** @
|
|
27
|
+
/** @internal */
|
|
28
28
|
//let len = length([0,1]);
|
|
29
29
|
|
|
30
30
|
|
|
@@ -85,7 +85,7 @@ function toScaleAxis(
|
|
|
85
85
|
const r = cpNode_.cp.circle.radius;
|
|
86
86
|
const r_ = f_(r);
|
|
87
87
|
if (R - l > r_) {
|
|
88
|
-
for (const cpNode of
|
|
88
|
+
for (const cpNode of getCpNodesOnCircle(cpNode_)) {
|
|
89
89
|
rMap.set(cpNode, R - l); // Update osculating radii
|
|
90
90
|
}
|
|
91
91
|
culls.add(cpNode_.cp.circle);
|
|
@@ -100,7 +100,7 @@ function toScaleAxis(
|
|
|
100
100
|
|
|
101
101
|
// TODO - put line below back - goes into infinite loop
|
|
102
102
|
//const sat: Mat = { cpNode, cpTrees: createNewCpTree(cpNode) };
|
|
103
|
-
const sat: Mat = { cpNode, cpTrees: undefined };
|
|
103
|
+
const sat: Mat = { cpNode, cpTrees: undefined! };
|
|
104
104
|
|
|
105
105
|
addDebugInfo(sat, timingStart);
|
|
106
106
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Circle } from '
|
|
1
|
+
import { Circle } from '../geometry/circle.js';
|
|
2
2
|
import { TTree } from './t-tree.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @internal
|
|
7
7
|
* Traverses the spacial tree and calls the given callback function for each
|
|
8
8
|
* MAT circle in the tree and iteravely for each subtree.
|
|
9
9
|
* @param tree The spacial tree to traverse
|
|
@@ -18,14 +18,14 @@ function traverseSpacialTree(
|
|
|
18
18
|
function g(tree: TTree) {
|
|
19
19
|
if (!tree) { return; }
|
|
20
20
|
|
|
21
|
-
if (tree.circles
|
|
22
|
-
tree.circles
|
|
21
|
+
if (tree.circles!.size) {
|
|
22
|
+
tree.circles!.forEach(f);
|
|
23
23
|
|
|
24
24
|
return; // Leaf reached
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
[5,0,2,4,1,3].forEach(
|
|
28
|
-
i => g(tree.trees
|
|
28
|
+
i => g(tree.trees!.get(i)!)
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { getBounds } from 'flo-bezier3';
|
|
2
2
|
import { memoize } from 'flo-memoize';
|
|
3
|
-
import { Loop } from '
|
|
4
|
-
import { Curve } from '../curve.js';
|
|
5
|
-
import { PointOnShape
|
|
3
|
+
import { Loop } from 'flo-boolean';
|
|
4
|
+
import { Curve } from '../curve/curve.js';
|
|
5
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
6
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
/** @
|
|
9
|
+
/** @internal */
|
|
9
10
|
const INF = Number.POSITIVE_INFINITY;
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
* @
|
|
14
|
+
* @internal
|
|
14
15
|
*/
|
|
15
16
|
const getLoopBounds = memoize(function(loop: Loop): {
|
|
16
|
-
minX:
|
|
17
|
-
minY:
|
|
18
|
-
maxX:
|
|
19
|
-
maxY:
|
|
17
|
+
minX: PointOnShape;
|
|
18
|
+
minY: PointOnShape;
|
|
19
|
+
maxX: PointOnShape;
|
|
20
|
+
maxY: PointOnShape } {
|
|
20
21
|
|
|
21
22
|
const extremes: {
|
|
22
23
|
bezier: Curve,
|
|
@@ -24,12 +25,12 @@ const getLoopBounds = memoize(function(loop: Loop): {
|
|
|
24
25
|
val: number
|
|
25
26
|
}[][] = [
|
|
26
27
|
[
|
|
27
|
-
{ bezier: undefined
|
|
28
|
-
{ bezier: undefined
|
|
28
|
+
{ bezier: undefined!, t: undefined!, val: INF},
|
|
29
|
+
{ bezier: undefined!, t: undefined!, val: INF}
|
|
29
30
|
],
|
|
30
31
|
[
|
|
31
|
-
{ bezier: undefined
|
|
32
|
-
{ bezier: undefined
|
|
32
|
+
{ bezier: undefined!, t: undefined!, val: -INF},
|
|
33
|
+
{ bezier: undefined!, t: undefined!, val: -INF}
|
|
33
34
|
]
|
|
34
35
|
];
|
|
35
36
|
|
|
@@ -93,10 +94,14 @@ const getLoopBounds = memoize(function(loop: Loop): {
|
|
|
93
94
|
});
|
|
94
95
|
|
|
95
96
|
return {
|
|
96
|
-
minX : new PointOnShape(extremes[0][0].bezier, extremes[0][0].t),
|
|
97
|
-
minY : new PointOnShape(extremes[0][1].bezier, extremes[0][1].t),
|
|
98
|
-
maxX : new PointOnShape(extremes[1][0].bezier, extremes[1][0].t),
|
|
99
|
-
maxY : new PointOnShape(extremes[1][1].bezier, extremes[1][1].t)
|
|
97
|
+
// minX : new PointOnShape(extremes[0][0].bezier, extremes[0][0].t),
|
|
98
|
+
// minY : new PointOnShape(extremes[0][1].bezier, extremes[0][1].t),
|
|
99
|
+
// maxX : new PointOnShape(extremes[1][0].bezier, extremes[1][0].t),
|
|
100
|
+
// maxY : new PointOnShape(extremes[1][1].bezier, extremes[1][1].t)
|
|
101
|
+
minY : createPos(extremes[0][1].bezier, extremes[0][1].t, true),
|
|
102
|
+
minX : createPos(extremes[0][0].bezier, extremes[0][0].t, true),
|
|
103
|
+
maxX : createPos(extremes[1][0].bezier, extremes[1][0].t, true),
|
|
104
|
+
maxY : createPos(extremes[1][1].bezier, extremes[1][1].t, true)
|
|
100
105
|
};
|
|
101
106
|
});
|
|
102
107
|
|
package/src/svg/get-min-y-pos.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/** @
|
|
2
|
-
import { Loop } from '
|
|
1
|
+
/** @internal */
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
3
|
import { getLoopBounds } from './get-loop-bounds.js';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @internal
|
|
8
8
|
* Get topmost PointOnShape of the given loop.
|
|
9
9
|
*/
|
|
10
10
|
function getMinYPos(loop: Loop) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { memoize } from 'flo-memoize';
|
|
2
|
-
import { Loop } from '
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
3
4
|
import { getLoopBounds } from './get-loop-bounds.js';
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
// TODO - move to another library
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
/** @internal */
|
|
10
8
|
const getShapeBounds = memoize(function(loops: Loop[]) {
|
|
11
9
|
let minX_ = Number.POSITIVE_INFINITY;
|
|
@@ -13,10 +11,10 @@ const getShapeBounds = memoize(function(loops: Loop[]) {
|
|
|
13
11
|
let minY_ = Number.POSITIVE_INFINITY;
|
|
14
12
|
let maxY_ = Number.NEGATIVE_INFINITY;
|
|
15
13
|
|
|
16
|
-
let minX;
|
|
17
|
-
let maxX;
|
|
18
|
-
let minY;
|
|
19
|
-
let maxY;
|
|
14
|
+
let minX: PointOnShape;
|
|
15
|
+
let maxX: PointOnShape;
|
|
16
|
+
let minY: PointOnShape;
|
|
17
|
+
let maxY: PointOnShape;
|
|
20
18
|
|
|
21
19
|
for (const loop of loops) {
|
|
22
20
|
const bounds = getLoopBounds(loop);
|
|
@@ -38,7 +36,12 @@ const getShapeBounds = memoize(function(loops: Loop[]) {
|
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
minX: minX!,
|
|
41
|
+
minY: minY!,
|
|
42
|
+
maxX: maxX!,
|
|
43
|
+
maxY: maxY!
|
|
44
|
+
};
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
/** @
|
|
2
|
+
/** @internal */
|
|
3
3
|
const EVENT_LEFT = 0;
|
|
4
|
-
/** @
|
|
4
|
+
/** @internal */
|
|
5
5
|
const EVENT_RIGHT = 1;
|
|
6
6
|
|
|
7
|
-
/** @
|
|
7
|
+
/** @internal */
|
|
8
8
|
type LEFT = 0;
|
|
9
|
-
/** @
|
|
9
|
+
/** @internal */
|
|
10
10
|
type RIGHT = 1;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
* Generalized sweepline algorithm.
|
|
15
15
|
*
|
|
16
16
|
* Typically used to turn O(n^2) algorithms into roughly O(n logn) algorithms.
|
|
@@ -71,7 +71,7 @@ function sweepLine<T>(
|
|
|
71
71
|
return pairedItems;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/** @
|
|
74
|
+
/** @internal */
|
|
75
75
|
interface IEvent<T> {
|
|
76
76
|
/** type - 0 -> left side, 1 -> right side */
|
|
77
77
|
type: LEFT|RIGHT;
|
|
@@ -85,7 +85,7 @@ interface IEvent<T> {
|
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* @
|
|
88
|
+
* @internal
|
|
89
89
|
* Compare two Events by their x-axis and then by their type. Since it is
|
|
90
90
|
* open boxes that are compared we must let the right endpoint type come
|
|
91
91
|
* before the left.
|