flo-mat 2.0.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.quokka +4 -0
- package/browser/index.js +18434 -14538
- package/browser/index.min.js +1 -1
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +9 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js +17 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.js +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.js +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.d.ts +25 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js +68 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +10 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js +2 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.js +2 -3
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +40 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js +42 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js.map +1 -0
- package/node/closest-boundary-point/get-p-from-box.d.ts +3 -0
- package/node/closest-boundary-point/get-p-from-box.js +11 -0
- package/node/closest-boundary-point/get-p-from-box.js.map +1 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +12 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +93 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +13 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +58 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -0
- package/node/{contact-point.d.ts → contact-point/contact-point.d.ts} +3 -3
- package/node/{contact-point.js → contact-point/contact-point.js} +1 -5
- package/node/contact-point/contact-point.js.map +1 -0
- package/node/{compare-curvatures-at-interface.js → corner/compare-curvatures-at-interface.js} +2 -2
- package/node/corner/compare-curvatures-at-interface.js.map +1 -0
- package/node/{mat → corner}/corner.d.ts +1 -1
- package/node/{mat → corner}/corner.js.map +1 -1
- package/node/corner/get-corner.d.ts +15 -0
- package/node/{curve.js → corner/get-corner.js} +6 -17
- package/node/corner/get-corner.js.map +1 -0
- package/node/{get-interface-ccw.js → corner/get-interface-ccw.js} +18 -33
- package/node/corner/get-interface-ccw.js.map +1 -0
- package/node/cp-node/clone.d.ts +1 -1
- package/node/cp-node/clone.js +6 -4
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +196 -0
- package/node/cp-node/cp-node.js +249 -0
- package/node/cp-node/cp-node.js.map +1 -0
- package/node/cp-node/create-cp-node.d.ts +4 -0
- package/node/cp-node/create-cp-node.js +8 -0
- package/node/cp-node/create-cp-node.js.map +1 -0
- package/node/cp-node/enhance-cp-node.d.ts +24 -0
- package/node/cp-node/enhance-cp-node.js +20 -0
- package/node/cp-node/enhance-cp-node.js.map +1 -0
- package/node/{get-boundary-bezier-parts-to-next.js → cp-node/get-boundary-bezier-parts-to-next.js} +1 -1
- package/node/cp-node/get-boundary-bezier-parts-to-next.js.map +1 -0
- package/node/{get-boundary-beziers-to-next.d.ts → cp-node/get-boundary-beziers-to-next.d.ts} +1 -1
- package/node/{get-boundary-beziers-to-next.js → cp-node/get-boundary-beziers-to-next.js} +1 -1
- package/node/cp-node/get-boundary-beziers-to-next.js.map +1 -0
- package/node/cp-node/get-cp-node-ordering.d.ts +8 -0
- package/node/cp-node/get-cp-node-ordering.js +12 -0
- package/node/cp-node/get-cp-node-ordering.js.map +1 -0
- package/node/{get-curve-to-next.js → cp-node/get-curve-to-next.js} +1 -1
- package/node/cp-node/get-curve-to-next.js.map +1 -0
- package/node/cp-node/remove.d.ts +1 -1
- package/node/cp-node/traverse-cp.d.ts +12 -0
- package/node/cp-node/traverse-cp.js +26 -0
- package/node/cp-node/traverse-cp.js.map +1 -0
- package/node/{traverse-edges.js → cp-node/traverse-edges.js} +4 -3
- package/node/cp-node/traverse-edges.js.map +1 -0
- package/node/{traverse-vertices.js → cp-node/traverse-vertices.js} +4 -3
- package/node/cp-node/traverse-vertices.js.map +1 -0
- package/node/{curve.d.ts → curve/curve.d.ts} +4 -17
- package/node/curve/curve.js +14 -0
- package/node/curve/curve.js.map +1 -0
- package/node/debug/cp-node-for-debugging.d.ts +2 -2
- package/node/debug/debug-elem-types.d.ts +8 -8
- package/node/debug/debug.d.ts +6 -6
- package/node/debug/debug.js +2 -2
- package/node/debug/debug.js.map +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +2 -2
- package/node/debug/functions/draw-elem/bounding-hull.js +3 -3
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.d.ts +2 -2
- package/node/debug/functions/draw-elem/branch.js +4 -3
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.d.ts +2 -2
- package/node/debug/functions/draw-elem/culls.js +2 -2
- package/node/debug/functions/draw-elem/culls.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/dull-corner.js +3 -4
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +2 -2
- package/node/debug/functions/draw-elem/leaves.js +1 -1
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loop.d.ts +2 -2
- package/node/debug/functions/draw-elem/loop.js +1 -2
- package/node/debug/functions/draw-elem/loop.js.map +1 -1
- package/node/debug/functions/draw-elem/loops.d.ts +1 -1
- package/node/debug/functions/draw-elem/loops.js +0 -1
- package/node/debug/functions/draw-elem/loops.js.map +1 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.d.ts +3 -3
- package/node/debug/functions/draw-elem/mat.js +9 -7
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.d.ts +2 -2
- package/node/debug/functions/draw-elem/max-vertex.js +1 -1
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.d.ts +3 -3
- package/node/debug/functions/draw-elem/min-y.js +2 -6
- package/node/debug/functions/draw-elem/min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong.js +6 -11
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/sharp-corner.js +3 -4
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/three-prong.js +8 -10
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/two-prong.js +7 -8
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.d.ts +4 -3
- package/node/debug/functions/draw-elem/vertex.js +11 -9
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +8 -8
- package/node/debug/functions/general.js +8 -8
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.d.ts +2 -2
- package/node/debug/functions/three-prong.js +10 -13
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +16 -5
- package/node/debug/functions/two-prong.js +56 -58
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/debug/three-prong-for-debugging.d.ts +6 -6
- package/node/debug/three-prong-for-debugging.js +1 -1
- package/node/debug/three-prong-for-debugging.js.map +1 -1
- package/node/debug/two-prong-for-debugging.d.ts +7 -7
- package/node/error-analysis/gamma.d.ts +26 -0
- package/node/error-analysis/gamma.js +35 -0
- package/node/error-analysis/gamma.js.map +1 -0
- package/node/find-2-prong/add-1-prong.d.ts +12 -0
- package/node/{mat/find-mat → find-2-prong}/add-1-prong.js +11 -11
- package/node/find-2-prong/add-1-prong.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.d.ts +6 -9
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.js +26 -74
- package/node/find-2-prong/add-2-prong.js.map +1 -0
- package/node/find-2-prong/add-debug-info.d.ts +8 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/add-debug-info.js +5 -4
- package/node/find-2-prong/add-debug-info.js.map +1 -0
- package/node/find-2-prong/cull-bezier-pieces.d.ts +11 -0
- package/node/find-2-prong/cull-bezier-pieces.js +28 -0
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/find-2-prong.d.ts +9 -13
- package/node/find-2-prong/find-2-prong.js +144 -0
- package/node/find-2-prong/find-2-prong.js.map +1 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.d.ts +15 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.js +5 -4
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs.d.ts +5 -5
- package/node/find-2-prong/find-and-add-2-prongs.js +60 -0
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.d.ts +3 -3
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.js +5 -5
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.d.ts +10 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js +56 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -0
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +15 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js +40 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -0
- package/node/find-2-prong/reduce-radius.d.ts +8 -0
- package/node/find-2-prong/reduce-radius.js +72 -0
- package/node/find-2-prong/reduce-radius.js.map +1 -0
- package/node/find-2-prong/squared-distance-between-dd.d.ts +2 -0
- package/node/find-2-prong/squared-distance-between-dd.js +17 -0
- package/node/find-2-prong/squared-distance-between-dd.js.map +1 -0
- package/node/find-2-prong/x-for-debugging.d.ts +9 -0
- package/node/find-2-prong/x-for-debugging.js.map +1 -0
- package/node/{mat/find-mat → find-3-prong.ts}/add-3-prong.d.ts +12 -7
- package/node/find-3-prong.ts/add-3-prong.js +82 -0
- package/node/find-3-prong.ts/add-3-prong.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.d.ts +4 -4
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.js +1 -1
- package/node/find-3-prong.ts/calc-better-x.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.d.ts +3 -3
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.js +5 -7
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.d.ts +6 -6
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.js +11 -12
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.d.ts +5 -5
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.js +52 -39
- package/node/find-3-prong.ts/find-3-prong.js.map +1 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.d.ts +5 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js +74 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-and-add-3-prongs.d.ts → find-3-prong.ts/find-and-add-all-3-prongs.d.ts} +3 -3
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js +66 -0
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/get-closest-points.d.ts +3 -3
- package/node/find-3-prong.ts/get-closest-points.js +14 -0
- package/node/find-3-prong.ts/get-closest-points.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/add-debug-info.d.ts +4 -4
- package/node/{mat/find-mat → find-mat}/add-debug-info.js +6 -6
- package/node/find-mat/add-debug-info.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.d.ts +5 -5
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.js +5 -6
- package/node/find-mat/create-initial-cp-graph.js.map +1 -0
- package/node/find-mat/find-mat.d.ts +10 -0
- package/node/find-mat/find-mat.js +57 -0
- package/node/find-mat/find-mat.js.map +1 -0
- package/node/{find-mats.d.ts → find-mat/find-mats.d.ts} +1 -1
- package/node/find-mat/find-mats.js +58 -0
- package/node/find-mat/find-mats.js.map +1 -0
- package/node/find-mat/fix-ordering.d.ts +8 -0
- package/node/find-mat/fix-ordering.js +59 -0
- package/node/find-mat/fix-ordering.js.map +1 -0
- package/node/find-mat/get-dull-corners.d.ts +5 -0
- package/node/find-mat/get-dull-corners.js +22 -0
- package/node/find-mat/get-dull-corners.js.map +1 -0
- package/node/find-mat/get-for-1-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js +28 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-for-2-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js +30 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-sharp-corners.d.ts +5 -0
- package/node/find-mat/get-sharp-corners.js +21 -0
- package/node/find-mat/get-sharp-corners.js.map +1 -0
- package/node/find-mat/get-size-params.d.ts +7 -0
- package/node/find-mat/get-size-params.js +33 -0
- package/node/find-mat/get-size-params.js.map +1 -0
- package/node/geometry/circle.js.map +1 -0
- package/node/geometry/get-bounding-box-.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.js +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.js +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -0
- package/node/get-curve/get-curve-between.d.ts +1 -1
- package/node/get-curve/get-curve-between.js +2 -2
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.d.ts +2 -2
- package/node/get-curve/get-edge-direction.js +2 -4
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/index.d.ts +24 -20
- package/node/index.js +21 -16
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.d.ts +1 -1
- package/node/loop/get-max-coordinate.js +1 -1
- package/node/mat/add-to-cp-graph.d.ts +8 -7
- package/node/mat/add-to-cp-graph.js +6 -4
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/bezier-piece.d.ts +2 -2
- package/node/mat/create-new-cp-tree.d.ts +3 -3
- package/node/mat/create-new-cp-tree.js +5 -7
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/elem-type-two-prong.d.ts +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
- package/node/mat/get-boundary-piece-beziers.js +4 -4
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/{get-branches.d.ts → mat/get-branches.d.ts} +1 -1
- package/node/{get-branches.js → mat/get-branches.js} +7 -6
- package/node/mat/get-branches.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +2 -2
- package/node/mat/get-largest-vertex.js +1 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/get-neighboring-cps.d.ts +6 -4
- package/node/mat/get-neighboring-cps.js +5 -3
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/get-two-prong-type.d.ts +1 -1
- package/node/mat/get-two-prong-type.js +1 -1
- package/node/mat/get-two-prong-type.js.map +1 -1
- package/node/mat/is-another-cp-closeby.d.ts +9 -8
- package/node/mat/is-another-cp-closeby.js +21 -29
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/{mat.d.ts → mat/mat.d.ts} +2 -2
- package/node/mat/mat.js.map +1 -0
- package/node/mat/simplify-mat-map-only.d.ts +1 -1
- package/node/mat/simplify-mat-map-only.js +4 -3
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/{simplify-mat.d.ts → mat/simplify-mat.d.ts} +3 -5
- package/node/{simplify-mat.js → mat/simplify-mat.js} +11 -13
- package/node/mat/simplify-mat.js.map +1 -0
- package/node/mat/trim-mat.d.ts +1 -1
- package/node/mat/trim-mat.js +1 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape/calc-pos-order.d.ts +13 -0
- package/node/point-on-shape/calc-pos-order.js +27 -0
- package/node/point-on-shape/calc-pos-order.js.map +1 -0
- package/node/point-on-shape/compare-poss.d.ts +10 -0
- package/node/point-on-shape/compare-poss.js +18 -0
- package/node/point-on-shape/compare-poss.js.map +1 -0
- package/node/point-on-shape/create-pos.d.ts +4 -0
- package/node/point-on-shape/create-pos.js +12 -0
- package/node/point-on-shape/create-pos.js.map +1 -0
- package/node/point-on-shape/get-osculating-circle.d.ts +10 -0
- package/node/point-on-shape/get-osculating-circle.js +25 -0
- package/node/point-on-shape/get-osculating-circle.js.map +1 -0
- package/node/point-on-shape/get-pos-corner.d.ts +7 -0
- package/node/point-on-shape/get-pos-corner.js +9 -0
- package/node/point-on-shape/get-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-corner.js +8 -0
- package/node/point-on-shape/is-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-dull-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-dull-corner.js +14 -0
- package/node/point-on-shape/is-pos-dull-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -0
- package/node/point-on-shape/point-on-shape.d.ts +11 -0
- package/node/point-on-shape/point-on-shape.js +2 -0
- package/node/point-on-shape/point-on-shape.js.map +1 -0
- package/node/point-on-shape/pos-to-human-string.d.ts +8 -0
- package/node/point-on-shape/pos-to-human-string.js +12 -0
- package/node/point-on-shape/pos-to-human-string.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/add-debug-info.d.ts +2 -2
- package/node/{mat/to-scale-axis → sat}/add-debug-info.js +1 -1
- package/node/sat/add-debug-info.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.js +6 -6
- package/node/sat/cull-non-cycles.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull.js +4 -4
- package/node/sat/cull.js.map +1 -0
- package/node/{mat → sat}/get-leaves.d.ts +2 -2
- package/node/sat/get-leaves.js +14 -0
- package/node/sat/get-leaves.js.map +1 -0
- package/node/{to-scale-axis.d.ts → sat/to-scale-axis.d.ts} +2 -2
- package/node/{to-scale-axis.js → sat/to-scale-axis.js} +11 -10
- package/node/sat/to-scale-axis.js.map +1 -0
- package/node/svg/get-loop-bounds.d.ts +7 -7
- package/node/svg/get-loop-bounds.js +11 -7
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +4 -4
- package/node/svg/get-min-y-pos.js +1 -1
- package/node/svg/get-shape-bounds.d.ts +6 -5
- package/node/svg/get-shape-bounds.js +6 -2
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.d.ts +1 -1
- package/node/sweep-line/sweep-line.js +4 -4
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/package.json +10 -10
- package/src/closest-boundary-point/closest-points-on-curve-precise.ts +75 -0
- package/src/closest-boundary-point/closest-points-on-curve.ts +72 -0
- package/src/closest-boundary-point/cull-bezier-pieces.ts +35 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.ts +4 -3
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.ts +2 -2
- package/src/closest-boundary-point/dd-deflate-with-running-error.ts +88 -0
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +16 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.ts +3 -4
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +69 -0
- package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +70 -0
- package/src/closest-boundary-point/get-p-from-box.ts +14 -0
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +122 -0
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +75 -0
- package/src/{contact-point.ts → contact-point/contact-point.ts} +4 -6
- package/src/{compare-curvatures-at-interface.ts → corner/compare-curvatures-at-interface.ts} +2 -2
- package/src/{mat → corner}/corner.ts +1 -1
- package/src/{curve.ts → corner/get-corner.ts} +10 -49
- package/src/{get-interface-ccw.ts → corner/get-interface-ccw.ts} +28 -35
- package/src/cp-node/clone.ts +17 -6
- package/src/cp-node/cp-node.ts +422 -0
- package/src/cp-node/create-cp-node.ts +21 -0
- package/src/cp-node/enhance-cp-node.ts +27 -0
- package/src/{get-boundary-bezier-parts-to-next.ts → cp-node/get-boundary-bezier-parts-to-next.ts} +3 -3
- package/src/{get-boundary-beziers-to-next.ts → cp-node/get-boundary-beziers-to-next.ts} +2 -2
- package/src/cp-node/get-cp-node-ordering.ts +17 -0
- package/src/{get-curve-to-next.ts → cp-node/get-curve-to-next.ts} +1 -1
- package/src/cp-node/remove.ts +1 -1
- package/src/cp-node/traverse-cp.ts +35 -0
- package/src/{traverse-edges.ts → cp-node/traverse-edges.ts} +5 -5
- package/src/{traverse-vertices.ts → cp-node/traverse-vertices.ts} +5 -5
- package/src/curve/curve.ts +46 -0
- package/src/debug/cp-node-for-debugging.ts +2 -2
- package/src/debug/debug-elem-types.ts +8 -8
- package/src/debug/debug.ts +11 -11
- package/src/debug/functions/draw-elem/bounding-hull.ts +5 -3
- package/src/debug/functions/draw-elem/branch.ts +4 -4
- package/src/debug/functions/draw-elem/culls.ts +3 -3
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +1 -1
- package/src/debug/functions/draw-elem/draw-elem.ts +10 -6
- package/src/debug/functions/draw-elem/dull-corner.ts +10 -6
- package/src/debug/functions/draw-elem/leaves.ts +2 -2
- package/src/debug/functions/draw-elem/loop.ts +4 -3
- package/src/debug/functions/draw-elem/loops.ts +1 -2
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +8 -3
- package/src/debug/functions/draw-elem/mat.ts +16 -8
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +4 -9
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +10 -2
- package/src/debug/functions/draw-elem/one-prong.ts +12 -15
- package/src/debug/functions/draw-elem/sharp-corner.ts +10 -6
- package/src/debug/functions/draw-elem/three-prong.ts +13 -11
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +9 -3
- package/src/debug/functions/draw-elem/two-prong.ts +12 -8
- package/src/debug/functions/draw-elem/vertex.ts +12 -11
- package/src/debug/functions/general.ts +10 -10
- package/src/debug/functions/three-prong.ts +16 -20
- package/src/debug/functions/two-prong.ts +89 -77
- package/src/debug/three-prong-for-debugging.ts +17 -16
- package/src/debug/two-prong-for-debugging.ts +7 -7
- package/src/error-analysis/gamma.ts +41 -0
- package/src/{mat/find-mat → find-2-prong}/add-1-prong.ts +19 -16
- package/src/{mat/find-mat → find-2-prong}/add-2-prong.ts +45 -91
- package/src/find-2-prong/add-debug-info.ts +49 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/cull-bezier-pieces.ts +9 -11
- package/src/find-2-prong/find-2-prong.ts +191 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.ts +12 -9
- package/src/find-2-prong/find-and-add-2-prongs.ts +88 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.ts +7 -7
- package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +77 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line.ts +1 -1
- package/src/find-2-prong/get-initial-bezier-pieces.ts +61 -0
- package/src/find-2-prong/pyth-trips.ts +146 -0
- package/src/find-2-prong/reduce-radius.ts +98 -0
- package/src/find-2-prong/squared-distance-between-dd.ts +25 -0
- package/src/find-2-prong/x-for-debugging.ts +13 -0
- package/src/find-3-prong.ts/add-3-prong.ts +110 -0
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.ts +5 -5
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.ts +11 -12
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.ts +28 -28
- package/src/find-3-prong.ts/find-3-prong.ts +148 -0
- package/src/find-3-prong.ts/find-and-add-3-prongs.ts +111 -0
- package/src/find-3-prong.ts/find-and-add-all-3-prongs.ts +109 -0
- package/src/find-3-prong.ts/get-closest-points.ts +24 -0
- package/src/{mat/find-mat → find-mat}/add-debug-info.ts +10 -10
- package/src/{mat/find-mat → find-mat}/create-initial-cp-graph.ts +11 -12
- package/src/find-mat/find-mat.ts +89 -0
- package/src/find-mat/find-mats.ts +83 -0
- package/src/find-mat/fix-ordering.ts +69 -0
- package/src/find-mat/get-dull-corners.ts +34 -0
- package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -0
- package/src/find-mat/get-for-2-prongs-on-loop.ts +44 -0
- package/src/find-mat/get-sharp-corners.ts +33 -0
- package/src/find-mat/get-size-params.ts +34 -0
- package/src/{mat/find-mat → find-mat}/get-total-by.ts +4 -4
- package/src/{mat/geometry → geometry}/get-closest-square-distance-to-rect.ts +1 -1
- package/src/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.ts +2 -2
- package/src/get-curve/get-curve-between.ts +7 -7
- package/src/get-curve/get-edge-direction.ts +11 -11
- package/src/index.ts +64 -21
- package/src/loop/get-max-coordinate.ts +1 -1
- package/src/mat/add-to-cp-graph.ts +15 -12
- package/src/mat/bezier-piece.ts +2 -2
- package/src/mat/cmp-cp-on-delta.ts +6 -3
- package/src/mat/create-new-cp-tree.ts +6 -9
- package/src/mat/elem-type-two-prong.ts +1 -1
- package/src/mat/get-boundary-piece-beziers.ts +7 -7
- package/src/{get-branches.ts → mat/get-branches.ts} +8 -8
- package/src/mat/get-edges-as-array.ts +2 -2
- package/src/mat/get-largest-three-prong.ts +3 -3
- package/src/mat/get-largest-vertex.ts +2 -2
- package/src/mat/get-neighboring-cps.ts +9 -6
- package/src/mat/get-two-prong-type.ts +1 -1
- package/src/mat/is-another-cp-closeby.ts +29 -44
- package/src/{mat.ts → mat/mat.ts} +2 -2
- package/src/mat/simplify-mat-map-only.ts +5 -5
- package/src/{simplify-mat.ts → mat/simplify-mat.ts} +12 -14
- package/src/mat/trim-mat.ts +3 -3
- package/src/point-on-shape/calc-pos-order.ts +35 -0
- package/src/point-on-shape/compare-poss.ts +26 -0
- package/src/point-on-shape/create-pos.ts +21 -0
- package/src/point-on-shape/get-osculating-circle.ts +39 -0
- package/src/point-on-shape/get-pos-corner.ts +16 -0
- package/src/point-on-shape/is-pos-corner.ts +12 -0
- package/src/point-on-shape/is-pos-dull-corner.ts +16 -0
- package/src/point-on-shape/is-pos-quite-dull-corner.ts +17 -0
- package/src/point-on-shape/is-pos-quite-sharp-corner.ts +17 -0
- package/src/point-on-shape/is-pos-sharp-corner.ts +17 -0
- package/src/point-on-shape/point-on-shape.ts +15 -0
- package/src/point-on-shape/pos-to-human-string.ts +16 -0
- package/src/{mat/to-scale-axis → sat}/add-debug-info.ts +3 -3
- package/src/{mat/to-scale-axis → sat}/cull-non-cycles.ts +7 -7
- package/src/{mat/to-scale-axis → sat}/cull.ts +6 -6
- package/src/{mat → sat}/get-leaves.ts +4 -4
- package/src/{mat/to-scale-axis → sat}/t-tree.ts +2 -2
- package/src/{to-scale-axis.ts → sat/to-scale-axis.ts} +16 -16
- package/src/{mat/to-scale-axis → sat}/traverse-spacial-tree.ts +5 -5
- package/src/svg/get-loop-bounds.ts +22 -17
- package/src/svg/get-min-y-pos.ts +3 -3
- package/src/svg/get-shape-bounds.ts +12 -9
- package/src/sweep-line/are-boxes-intersecting.ts +1 -1
- package/src/sweep-line/sweep-line.ts +7 -7
- package/tsconfig.json +3 -7
- package/wallaby.mjs +32 -0
- package/node/circle.js.map +0 -1
- package/node/compare-curvatures-at-interface.js.map +0 -1
- package/node/contact-point.js.map +0 -1
- package/node/cp-node.d.ts +0 -202
- package/node/cp-node.js +0 -321
- package/node/cp-node.js.map +0 -1
- package/node/curve.js.map +0 -1
- package/node/find-mats.js +0 -123
- package/node/find-mats.js.map +0 -1
- package/node/get-boundary-bezier-parts-to-next.js.map +0 -1
- package/node/get-boundary-beziers-to-next.js.map +0 -1
- package/node/get-bounding-box-.js.map +0 -1
- package/node/get-branches.js.map +0 -1
- package/node/get-curve-to-next.js.map +0 -1
- package/node/get-interface-ccw.js.map +0 -1
- package/node/loop.d.ts +0 -16
- package/node/loop.js +0 -35
- package/node/loop.js.map +0 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +0 -14
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +0 -73
- package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +0 -9
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +0 -20
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +0 -1
- package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +0 -17
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +0 -81
- package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +0 -1
- package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +0 -18
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +0 -41
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +0 -1
- package/node/mat/find-mat/add-1-prong.d.ts +0 -12
- package/node/mat/find-mat/add-1-prong.js.map +0 -1
- package/node/mat/find-mat/add-2-prong.js.map +0 -1
- package/node/mat/find-mat/add-3-prong.js +0 -55
- package/node/mat/find-mat/add-3-prong.js.map +0 -1
- package/node/mat/find-mat/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +0 -11
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +0 -52
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +0 -1
- package/node/mat/find-mat/create-initial-cp-graph.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +0 -8
- package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +0 -30
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +0 -233
- package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +0 -40
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +0 -38
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/x-for-debugging.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +0 -17
- package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +0 -15
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs.js +0 -74
- package/node/mat/find-mat/find-and-add-2-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-3-prongs.js +0 -147
- package/node/mat/find-mat/find-and-add-3-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-potential-2-prongs.d.ts +0 -4
- package/node/mat/find-mat/get-potential-2-prongs.js +0 -17
- package/node/mat/find-mat/get-potential-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-sharp-corners.d.ts +0 -4
- package/node/mat/find-mat/get-sharp-corners.js +0 -18
- package/node/mat/find-mat/get-sharp-corners.js.map +0 -1
- package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +0 -1
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +0 -1
- package/node/mat/get-contact-circles-at-interface.d.ts +0 -8
- package/node/mat/get-contact-circles-at-interface.js +0 -21
- package/node/mat/get-contact-circles-at-interface.js.map +0 -1
- package/node/mat/get-leaves.js +0 -13
- package/node/mat/get-leaves.js.map +0 -1
- package/node/mat/to-scale-axis/add-debug-info.js.map +0 -1
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +0 -1
- package/node/mat/to-scale-axis/cull.js.map +0 -1
- package/node/mat.js.map +0 -1
- package/node/point-on-shape.d.ts +0 -73
- package/node/point-on-shape.js +0 -168
- package/node/point-on-shape.js.map +0 -1
- package/node/simplify-mat.js.map +0 -1
- package/node/to-scale-axis.js.map +0 -1
- package/node/traverse-edges.js.map +0 -1
- package/node/traverse-vertices.js.map +0 -1
- package/src/cp-node.ts +0 -388
- package/src/find-mats.ts +0 -171
- package/src/loop.ts +0 -56
- package/src/mat/closest-boundary-point/closest-point-on-curve-old.ts_ +0 -88
- package/src/mat/closest-boundary-point/closest-point-on-curve.ts_ +0 -95
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +0 -84
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +0 -38
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +0 -107
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +0 -64
- package/src/mat/find-mat/add-3-prong.ts +0 -75
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +0 -73
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +0 -46
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +0 -316
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +0 -52
- package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +0 -13
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +0 -106
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +0 -28
- package/src/mat/find-mat/find-and-add-2-prongs.ts +0 -108
- package/src/mat/find-mat/find-and-add-3-prongs.ts +0 -218
- package/src/mat/find-mat/get-potential-2-prongs.ts +0 -24
- package/src/mat/find-mat/get-sharp-corners.ts +0 -25
- package/src/mat/find-mat/get-total-abs-curvature.ts +0 -17
- package/src/mat/get-contact-circles-at-interface.ts +0 -26
- package/src/mat/to-scale-axis/add-to-tree.ts +0 -66
- package/src/mat/to-scale-axis/calc-groups.ts +0 -82
- package/src/mat/to-scale-axis/create-spacial-tree.ts +0 -41
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +0 -135
- package/src/point-on-shape.ts +0 -231
- package/src/svg/get-curvature-at-interface.ts +0 -55
- /package/node/{compare-curvatures-at-interface.d.ts → corner/compare-curvatures-at-interface.d.ts} +0 -0
- /package/node/{mat → corner}/corner.js +0 -0
- /package/node/{get-interface-ccw.d.ts → corner/get-interface-ccw.d.ts} +0 -0
- /package/node/{get-boundary-bezier-parts-to-next.d.ts → cp-node/get-boundary-bezier-parts-to-next.d.ts} +0 -0
- /package/node/{get-curve-to-next.d.ts → cp-node/get-curve-to-next.d.ts} +0 -0
- /package/node/{traverse-edges.d.ts → cp-node/traverse-edges.d.ts} +0 -0
- /package/node/{traverse-vertices.d.ts → cp-node/traverse-vertices.d.ts} +0 -0
- /package/node/{mat/find-mat/find-2-prong → find-2-prong}/x-for-debugging.js +0 -0
- /package/node/{circle.d.ts → geometry/circle.d.ts} +0 -0
- /package/node/{circle.js → geometry/circle.js} +0 -0
- /package/node/{get-bounding-box-.d.ts → geometry/get-bounding-box-.d.ts} +0 -0
- /package/node/{get-bounding-box-.js → geometry/get-bounding-box-.js} +0 -0
- /package/node/{mat.js → mat/mat.js} +0 -0
- /package/src/{circle.ts → geometry/circle.ts} +0 -0
- /package/src/{get-bounding-box-.ts → geometry/get-bounding-box-.ts} +0 -0
|
@@ -1,218 +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 { CpNode } from '../../cp-node.js';
|
|
7
|
-
import { Loop } from '../../loop.js';
|
|
8
|
-
import { Circle } from '../../circle.js';
|
|
9
|
-
import { calcPosOrder, isPosSharpCorner } from '../../point-on-shape.js';
|
|
10
|
-
import { find3Prong } from './find-3-prong/find-3-prong.js';
|
|
11
|
-
import { add3Prong } from '../find-mat/add-3-prong.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
* Finds and adds all 3-prongs.
|
|
17
|
-
* @param cpGraphs
|
|
18
|
-
* @param cpStart The CpNode to start traversing from.
|
|
19
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
20
|
-
* tolerances.
|
|
21
|
-
*/
|
|
22
|
-
function findAndAddAll3Prongs(
|
|
23
|
-
cpGraphs : Map<Loop,LlRbTree<CpNode>>,
|
|
24
|
-
cpStart : CpNode,
|
|
25
|
-
extreme : number) {
|
|
26
|
-
|
|
27
|
-
// Don't change this function to be recursive, the call stack may overflow
|
|
28
|
-
// if there are too many two-prongs.
|
|
29
|
-
|
|
30
|
-
const visitedEdges = new Map<CpNode, Set<CpNode>>();
|
|
31
|
-
|
|
32
|
-
const edgesToCheck = [{ fromCpNode: undefined as CpNode, cpStart }];
|
|
33
|
-
|
|
34
|
-
while (edgesToCheck.length) {
|
|
35
|
-
const { fromCpNode, cpStart } = edgesToCheck.shift();
|
|
36
|
-
|
|
37
|
-
markEdgeAsTaken(visitedEdges, fromCpNode, cpStart);
|
|
38
|
-
|
|
39
|
-
for (const cpNode of cpStart.getCpNodesOnCircle()) {
|
|
40
|
-
|
|
41
|
-
//if (!PointOnShape.isSharpCorner(cpNode.cp.pointOnShape)) {
|
|
42
|
-
if (!isPosSharpCorner(cpNode.cp.pointOnShape)) {
|
|
43
|
-
if (findAndAdd3Prongs(cpGraphs, cpNode, extreme) === undefined) {
|
|
44
|
-
return; // only for debugging purposes
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (hasEdgeBeenTaken(visitedEdges, cpNode, cpNode.next)) {
|
|
49
|
-
continue; // We already visited this edge
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
edgesToCheck.push({ fromCpNode: cpStart, cpStart: cpNode.next });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @hidden
|
|
60
|
-
* Marks the given edge as already taken.
|
|
61
|
-
*/
|
|
62
|
-
function markEdgeAsTaken(
|
|
63
|
-
visitedEdges: Map<CpNode, Set<CpNode>>,
|
|
64
|
-
cp1: CpNode,
|
|
65
|
-
cp2: CpNode) {
|
|
66
|
-
|
|
67
|
-
if (cp1 === undefined) { return; }
|
|
68
|
-
|
|
69
|
-
f(cp1, cp2);
|
|
70
|
-
f(cp2, cp1);
|
|
71
|
-
|
|
72
|
-
function f(cp1: CpNode, cp2: CpNode) {
|
|
73
|
-
let visited = visitedEdges.get(cp1);
|
|
74
|
-
if (!visited) {
|
|
75
|
-
visited = new Set<CpNode>();
|
|
76
|
-
visitedEdges.set(cp1, visited);
|
|
77
|
-
}
|
|
78
|
-
visited.add(cp2);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
/** @hidden */
|
|
84
|
-
function hasEdgeBeenTaken(
|
|
85
|
-
visitedEdges: Map<CpNode, Set<CpNode>>,
|
|
86
|
-
cp1: CpNode,
|
|
87
|
-
cp2: CpNode) {
|
|
88
|
-
|
|
89
|
-
let cps: Set<CpNode>;
|
|
90
|
-
|
|
91
|
-
cps = visitedEdges.get(cp1);
|
|
92
|
-
const takenForward = cps && cps.has(cp2);
|
|
93
|
-
|
|
94
|
-
cps = visitedEdges.get(cp2);
|
|
95
|
-
const takenBackwards = cps && cps.has(cp1);
|
|
96
|
-
|
|
97
|
-
return takenForward || takenBackwards;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @hidden
|
|
103
|
-
* Traverses the shape from the given ContactPoint going around contact circles
|
|
104
|
-
* so that only a piece of the shape is traversed and returns the visited
|
|
105
|
-
* CpNodes (starting from the given CpNode).
|
|
106
|
-
* @param cpStart The ContactPoint from where to start the traversal.
|
|
107
|
-
*/
|
|
108
|
-
function traverseShape(cpStart: CpNode) {
|
|
109
|
-
let cpNode = cpStart;
|
|
110
|
-
|
|
111
|
-
if (cpNode === cpNode.next.prevOnCircle) {
|
|
112
|
-
return [cpNode];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const visitedCps = [];
|
|
116
|
-
do {
|
|
117
|
-
visitedCps.push(cpNode);
|
|
118
|
-
|
|
119
|
-
const next = cpNode.next.prevOnCircle;
|
|
120
|
-
cpNode = cpNode === next
|
|
121
|
-
? cpNode = cpNode.next.next // Terminal vertex
|
|
122
|
-
: cpNode = next // Take last exit
|
|
123
|
-
|
|
124
|
-
} while (cpNode !== cpStart);
|
|
125
|
-
|
|
126
|
-
return visitedCps;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* @hidden
|
|
132
|
-
* Starting from some ContactPoint, traverses the shape going around Vertices
|
|
133
|
-
* and if more than two Vertices have been visited in total then recursively
|
|
134
|
-
* adds 3-prongs until only one or two Vertices have been visited.
|
|
135
|
-
*
|
|
136
|
-
* This process further subdivides the shape.
|
|
137
|
-
* @param cpGraphs
|
|
138
|
-
* @param cpStart The ContactPoint from where to start the process.
|
|
139
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
140
|
-
* tolerances.
|
|
141
|
-
*/
|
|
142
|
-
let ii = 0;
|
|
143
|
-
function findAndAdd3Prongs(
|
|
144
|
-
cpGraphs : Map<Loop,LlRbTree<CpNode>>,
|
|
145
|
-
cpStart : CpNode,
|
|
146
|
-
extreme : number) {
|
|
147
|
-
|
|
148
|
-
let visitedCps: CpNode[];
|
|
149
|
-
|
|
150
|
-
do {
|
|
151
|
-
visitedCps = traverseShape(cpStart);
|
|
152
|
-
|
|
153
|
-
if (visitedCps.length > 2) {
|
|
154
|
-
findAndAdd3Prong(cpGraphs, visitedCps, extreme);
|
|
155
|
-
ii++;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (typeof _debug_ !== 'undefined') {
|
|
159
|
-
if (ii === _debug_.directives.stopAfterThreeProngsNum) {
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
} while (visitedCps.length > 2);
|
|
164
|
-
|
|
165
|
-
return visitedCps;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* @hidden
|
|
171
|
-
* Finds and add a 3-prong MAT circle to the given shape.
|
|
172
|
-
* @param cpGraphs
|
|
173
|
-
* @param visitedCps
|
|
174
|
-
* @param extreme The maximum coordinate value used to calculate floating point
|
|
175
|
-
* tolerances.
|
|
176
|
-
*/
|
|
177
|
-
function findAndAdd3Prong(
|
|
178
|
-
cpGraphs : Map<Loop,LlRbTree<CpNode>>,
|
|
179
|
-
visitedCps : CpNode[],
|
|
180
|
-
extreme : number) {
|
|
181
|
-
|
|
182
|
-
const δs = [];
|
|
183
|
-
for (const visitedCp of visitedCps) {
|
|
184
|
-
δs.push([visitedCp, visitedCp.next]);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const threeProng = find3Prong(δs, extreme);
|
|
188
|
-
|
|
189
|
-
const orders = [];
|
|
190
|
-
for (let i=0; i<3; i++) {
|
|
191
|
-
orders.push(
|
|
192
|
-
//PointOnShape.calcOrder(threeProng.circle, threeProng.ps[i])
|
|
193
|
-
calcPosOrder(threeProng.circle, threeProng.ps[i])
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const circle = add3Prong(cpGraphs, orders, threeProng);
|
|
198
|
-
|
|
199
|
-
if (typeof _debug_ !== 'undefined') {
|
|
200
|
-
add3ProngDebugInfo(circle, visitedCps);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
/** @hidden */
|
|
206
|
-
function add3ProngDebugInfo(
|
|
207
|
-
circle: Circle,
|
|
208
|
-
visitedCps: CpNode[]) {
|
|
209
|
-
|
|
210
|
-
const threeProngs = _debug_.generated.elems.threeProng;
|
|
211
|
-
const len = threeProngs.length;
|
|
212
|
-
const data = threeProngs[len-1];
|
|
213
|
-
data.visitedCps = visitedCps;
|
|
214
|
-
data.circle = circle;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
export { findAndAddAll3Prongs }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** @hidden */
|
|
5
|
-
function getPotential2Prongs(possPerLoop: IPointOnShape[][]) {
|
|
6
|
-
const for2ProngsArray = [];
|
|
7
|
-
|
|
8
|
-
for (const poss of possPerLoop) {
|
|
9
|
-
const for2Prongs = [];
|
|
10
|
-
|
|
11
|
-
for (const pos of poss) {
|
|
12
|
-
if (!isPosQuiteSharpCorner(pos)) {
|
|
13
|
-
for2Prongs.push(pos);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
for2ProngsArray.push(for2Prongs);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return for2ProngsArray;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export { getPotential2Prongs }
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IPointOnShape, isPosQuiteSharpCorner } from '../../point-on-shape.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** @hidden */
|
|
5
|
-
function getSharpCorners(possPerLoop: IPointOnShape[][]) {
|
|
6
|
-
const sharpCornersPerLoop = [];
|
|
7
|
-
|
|
8
|
-
for (const poss of possPerLoop) {
|
|
9
|
-
const sharpCorners = [];
|
|
10
|
-
|
|
11
|
-
for (const pos of poss) {
|
|
12
|
-
//if (PointOnShape.isQuiteSharpCorner(pos)) {
|
|
13
|
-
if (isPosQuiteSharpCorner(pos)) {
|
|
14
|
-
sharpCorners.push(pos);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
sharpCornersPerLoop.push(sharpCorners);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return sharpCornersPerLoop;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export { getSharpCorners }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { totalAbsoluteCurvature } from 'flo-bezier3';
|
|
2
|
-
import { getCurvatureAtInterface } from '../../svg/get-curvature-at-interface.js';
|
|
3
|
-
import { getTotalBy } from './get-total-by.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
const getTotalAbsoluteCurvature = getTotalBy(
|
|
10
|
-
curve => (
|
|
11
|
-
totalAbsoluteCurvature(curve.ps, [0,1]) +
|
|
12
|
-
Math.abs(getCurvatureAtInterface(curve))
|
|
13
|
-
)
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export { getTotalAbsoluteCurvature }
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Curve, getCornerAtEnd } from '../curve.js';
|
|
2
|
-
import { PointOnShape } from '../point-on-shape.js';
|
|
3
|
-
import { IPointOnShape } from '../point-on-shape.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
* @param curve
|
|
9
|
-
*/
|
|
10
|
-
function getContactCirclesAtInterface(curve: Curve): IPointOnShape[] {
|
|
11
|
-
const { isQuiteSharp, isQuiteDull } = getCornerAtEnd(curve);
|
|
12
|
-
|
|
13
|
-
if (isQuiteSharp) {
|
|
14
|
-
return [new PointOnShape(curve, 1)];
|
|
15
|
-
} else if (isQuiteDull) {
|
|
16
|
-
return [
|
|
17
|
-
new PointOnShape(curve, 1),
|
|
18
|
-
new PointOnShape(curve.next, 0)
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export { getContactCirclesAtInterface }
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Circle } from '../../circle.js';
|
|
2
|
-
import { calcGroups } from './calc-groups.js';
|
|
3
|
-
import { TTree } from './t-tree.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// DEPTH_LIMIT can be anything from 1 to 16, but from 2 to 6 seem to be the
|
|
7
|
-
// fastest.
|
|
8
|
-
/** @hidden */
|
|
9
|
-
const DEPTH_LIMIT = 6;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
* @param s
|
|
14
|
-
* @param tree
|
|
15
|
-
* @param coordinate
|
|
16
|
-
* @param limits
|
|
17
|
-
* @param circle
|
|
18
|
-
* @param depth
|
|
19
|
-
*/
|
|
20
|
-
function addToTree(
|
|
21
|
-
s: number,
|
|
22
|
-
tree: TTree,
|
|
23
|
-
coordinate: number,
|
|
24
|
-
limits: number[][],
|
|
25
|
-
circle: Circle,
|
|
26
|
-
depth: number) {
|
|
27
|
-
|
|
28
|
-
const { groups, newLimits } = calcGroups(
|
|
29
|
-
s,
|
|
30
|
-
coordinate,
|
|
31
|
-
limits,
|
|
32
|
-
circle
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// Create new edge if it does not exist yet.
|
|
36
|
-
if (groups.length === 1 && depth !== DEPTH_LIMIT) {
|
|
37
|
-
const group = groups[0];
|
|
38
|
-
|
|
39
|
-
if (!tree.trees!.get(group)) {
|
|
40
|
-
tree.trees!.set(group, { trees: new Map(), circles: new Set() } );
|
|
41
|
-
}
|
|
42
|
-
const t = tree.trees!.get(group)!;
|
|
43
|
-
|
|
44
|
-
// Flip coordinates
|
|
45
|
-
const newCoordinate = coordinate ? 0 : 1;
|
|
46
|
-
addToTree(
|
|
47
|
-
s,
|
|
48
|
-
t,
|
|
49
|
-
newCoordinate,
|
|
50
|
-
newLimits,
|
|
51
|
-
circle,
|
|
52
|
-
depth+1
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!tree.trees!.get(5)) {
|
|
59
|
-
tree.trees!.set(5, { trees: new Map(), circles: new Set() } );
|
|
60
|
-
}
|
|
61
|
-
const vertices = tree.trees!.get(5)!.circles;
|
|
62
|
-
vertices!.add(circle);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export { addToTree }
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Circle } from '../../circle.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
* Spacially divide into 5 special groups as follows:
|
|
7
|
-
*
|
|
8
|
-
* *******||*******|*******|*******|*******||*******
|
|
9
|
-
* 0 <--------------->
|
|
10
|
-
* 1 <--------------->
|
|
11
|
-
* 2 <--------------->
|
|
12
|
-
* 3 <--------------->
|
|
13
|
-
* 4 <--------------->
|
|
14
|
-
* 5 - If the circle does not fall in any of above 5 groups.
|
|
15
|
-
*
|
|
16
|
-
* Note: In the above, the double pipes denote the limits for
|
|
17
|
-
* a coordinate, so as can be seen groups 0 and 4 go outside
|
|
18
|
-
* the limits. Also, groups 1 and 3 are preferred and checked
|
|
19
|
-
* first.
|
|
20
|
-
*
|
|
21
|
-
* @param s Scale parameter, e.g. 1.1
|
|
22
|
-
* @param coordinate - 0 -> horizontal or 1 -> vertical.
|
|
23
|
-
* @param limits - The limits within which the circle bounds can fall.
|
|
24
|
-
* @param circle - The circle to categorize into a group.
|
|
25
|
-
*/
|
|
26
|
-
function calcGroups(
|
|
27
|
-
s: number,
|
|
28
|
-
coordinate: number,
|
|
29
|
-
limits: number[][],
|
|
30
|
-
circle: Circle) {
|
|
31
|
-
|
|
32
|
-
const limit = limits[coordinate];
|
|
33
|
-
const l1 = limit[0];
|
|
34
|
-
const l2 = limit[1];
|
|
35
|
-
|
|
36
|
-
// Relevant cut-off lines.
|
|
37
|
-
const q = (l2 - l1) / 4;
|
|
38
|
-
const w = q+q;
|
|
39
|
-
|
|
40
|
-
// Shift origin
|
|
41
|
-
const r = circle.radius;
|
|
42
|
-
const x = circle.center[coordinate] - l1;
|
|
43
|
-
const x0 = x - (r * s);
|
|
44
|
-
const x1 = x + (r * s);
|
|
45
|
-
|
|
46
|
-
let newLimit: (number | undefined)[] = [,];
|
|
47
|
-
const groups: number[] = []; // Group to which circle belongs;
|
|
48
|
-
|
|
49
|
-
const qStart = Math.floor(x0/q);
|
|
50
|
-
const qEnd = Math.floor(x1/q) + 1;
|
|
51
|
-
const qDiff = qEnd - qStart;
|
|
52
|
-
|
|
53
|
-
let group: number;
|
|
54
|
-
if (qDiff === 1) {
|
|
55
|
-
// If contained in sliver.
|
|
56
|
-
group = (2 * Math.floor(qStart/2)) + 1;
|
|
57
|
-
groups.push(group);
|
|
58
|
-
|
|
59
|
-
const lowerLimit = l1 + q*(group-1);
|
|
60
|
-
newLimit = [lowerLimit, lowerLimit + w];
|
|
61
|
-
|
|
62
|
-
} else if (qDiff === 2) {
|
|
63
|
-
group = qStart + 1;
|
|
64
|
-
groups.push(group);
|
|
65
|
-
|
|
66
|
-
const lowerLimit = l1 + q*(group-1);
|
|
67
|
-
newLimit = [lowerLimit, lowerLimit + w];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const newLimits: ((number | undefined)[] | undefined)[] = [,];
|
|
71
|
-
if (groups.length === 1) {
|
|
72
|
-
const otherCoordinate = coordinate ? 0 : 1;
|
|
73
|
-
|
|
74
|
-
newLimits[otherCoordinate] = limits[otherCoordinate];
|
|
75
|
-
newLimits[coordinate] = newLimit;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return { groups, newLimits };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export { calcGroups }
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Circle } from '../../circle.js';
|
|
2
|
-
import { TTree } from './t-tree.js';
|
|
3
|
-
import { addToTree } from './add-to-tree.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** @hidden */
|
|
7
|
-
const width = 1620; // TODO change to actual shape coordinates
|
|
8
|
-
/** @hidden */
|
|
9
|
-
const height = 1560; // ...
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
* @param s
|
|
15
|
-
* @param circles
|
|
16
|
-
*/
|
|
17
|
-
function createSpacialTree(
|
|
18
|
-
s: number,
|
|
19
|
-
circles: Circle[]) {
|
|
20
|
-
|
|
21
|
-
const coordinate = 0;
|
|
22
|
-
const limits = [[0, width], [0, height]];
|
|
23
|
-
|
|
24
|
-
const tree: TTree = { trees: new Map(), circles: new Set() };
|
|
25
|
-
|
|
26
|
-
for (const circle of circles) {
|
|
27
|
-
addToTree(
|
|
28
|
-
s,
|
|
29
|
-
tree,
|
|
30
|
-
coordinate,
|
|
31
|
-
limits,
|
|
32
|
-
circle,
|
|
33
|
-
0
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return tree;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export { createSpacialTree }
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { Circle, scaleCircle, engulfsCircle } from '../../circle.js';
|
|
2
|
-
import { TTree } from './t-tree.js';
|
|
3
|
-
import { calcGroups } from './calc-groups.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** @hidden */
|
|
7
|
-
const width = 1620; // TODO change to actual shape coordinates
|
|
8
|
-
/** @hidden */
|
|
9
|
-
const height = 1560; // ...
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
* Returns a map of engulfed MAT nodes determined to be engulfed by the given
|
|
15
|
-
* test node and scale factor and starting from the given spacial tree node.
|
|
16
|
-
* @param s The scale factor
|
|
17
|
-
* @param tree The spacial tree node from where to start
|
|
18
|
-
* @param circle The circle potentially engulfing other nodes
|
|
19
|
-
*/
|
|
20
|
-
function getEngulfedVertices(
|
|
21
|
-
s: number,
|
|
22
|
-
tree: TTree,
|
|
23
|
-
circle: Circle) {
|
|
24
|
-
|
|
25
|
-
const c1 = scaleCircle(circle, s);
|
|
26
|
-
|
|
27
|
-
const cullNodes: Set<Circle> = new Set();
|
|
28
|
-
|
|
29
|
-
const limits = [[0, width], [0, height]];
|
|
30
|
-
f(tree, 0, limits, 0);
|
|
31
|
-
|
|
32
|
-
return cullNodes;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function cullBranch5(tree: TTree) {
|
|
36
|
-
const t = tree.trees!.get(5);
|
|
37
|
-
if (!t) { return; }
|
|
38
|
-
|
|
39
|
-
const circles = t.circles!;
|
|
40
|
-
|
|
41
|
-
circles.forEach(function(circle, key) {
|
|
42
|
-
const c2 = scaleCircle(circle, s);
|
|
43
|
-
if (engulfsCircle(c1, c2)) {
|
|
44
|
-
cullNodes.add(circle);
|
|
45
|
-
circles.delete(key);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
function f(
|
|
52
|
-
tree: TTree,
|
|
53
|
-
coordinate: number,
|
|
54
|
-
limits: number[][] | null,
|
|
55
|
-
depth: number) {
|
|
56
|
-
|
|
57
|
-
if (limits === null) {
|
|
58
|
-
// If we already reached a circle which spans multiple groups
|
|
59
|
-
// previously, then check all circles in the tree.
|
|
60
|
-
cullBranch5(tree);
|
|
61
|
-
|
|
62
|
-
for (let i=0; i<=4; i++) {
|
|
63
|
-
const t = tree.trees!.get(i);
|
|
64
|
-
if (t) {
|
|
65
|
-
f(t, 0, null, depth+1);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const { groups, newLimits } = calcGroups(
|
|
73
|
-
s,
|
|
74
|
-
coordinate,
|
|
75
|
-
limits,
|
|
76
|
-
circle
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
if (groups.length === 1) {
|
|
80
|
-
cullBranch5(tree);
|
|
81
|
-
|
|
82
|
-
const group = groups[0];
|
|
83
|
-
const newCoordinate = coordinate ? 0 : 1;
|
|
84
|
-
|
|
85
|
-
if (group === 1 || group === 3) {
|
|
86
|
-
// One of the higher priority left/top or
|
|
87
|
-
// right/bottom half groups.
|
|
88
|
-
const t = tree.trees!.get(group);
|
|
89
|
-
|
|
90
|
-
if (t) {
|
|
91
|
-
f(
|
|
92
|
-
t,
|
|
93
|
-
newCoordinate,
|
|
94
|
-
newLimits,
|
|
95
|
-
depth+1
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
// One of the lower priority even groups (0,2 or 4).
|
|
100
|
-
|
|
101
|
-
const branches: TTree[] = [];
|
|
102
|
-
branches.push(tree.trees!.get(group)!);
|
|
103
|
-
if (group > 0) { branches.push(tree.trees!.get(group-1)!); }
|
|
104
|
-
if (group < 4) { branches.push(tree.trees!.get(group+1)!); }
|
|
105
|
-
|
|
106
|
-
for (const branch of branches) {
|
|
107
|
-
if (branch) {
|
|
108
|
-
f(
|
|
109
|
-
branch,
|
|
110
|
-
newCoordinate,
|
|
111
|
-
newLimits,
|
|
112
|
-
depth+1
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
cullBranch5(tree);
|
|
123
|
-
// Circle spans multiple groups at this level of the tree. Check all
|
|
124
|
-
// circles in all branches.
|
|
125
|
-
for (let i=0; i<=4; i++) {
|
|
126
|
-
const t = tree.trees!.get(i);
|
|
127
|
-
if (!t) { continue; }
|
|
128
|
-
|
|
129
|
-
f(t, 0, null, depth+1);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
export { getEngulfedVertices }
|