flo-mat 2.0.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.quokka +4 -0
- package/browser/index.js +18434 -14538
- package/browser/index.min.js +1 -1
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +9 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js +17 -0
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.js +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.js +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.d.ts +25 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js +68 -0
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +10 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js +2 -0
- package/node/closest-boundary-point/foot-and-endpoint-info.js.map +1 -0
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.d.ts +2 -2
- package/node/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.js +2 -3
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +40 -0
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.d.ts +15 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js +42 -0
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js.map +1 -0
- package/node/closest-boundary-point/get-p-from-box.d.ts +3 -0
- package/node/closest-boundary-point/get-p-from-box.js +11 -0
- package/node/closest-boundary-point/get-p-from-box.js.map +1 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +12 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +93 -0
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +13 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +58 -0
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -0
- package/node/{contact-point.d.ts → contact-point/contact-point.d.ts} +3 -3
- package/node/{contact-point.js → contact-point/contact-point.js} +1 -5
- package/node/contact-point/contact-point.js.map +1 -0
- package/node/{compare-curvatures-at-interface.js → corner/compare-curvatures-at-interface.js} +2 -2
- package/node/corner/compare-curvatures-at-interface.js.map +1 -0
- package/node/{mat → corner}/corner.d.ts +1 -1
- package/node/{mat → corner}/corner.js.map +1 -1
- package/node/corner/get-corner.d.ts +15 -0
- package/node/{curve.js → corner/get-corner.js} +6 -17
- package/node/corner/get-corner.js.map +1 -0
- package/node/{get-interface-ccw.js → corner/get-interface-ccw.js} +18 -33
- package/node/corner/get-interface-ccw.js.map +1 -0
- package/node/cp-node/clone.d.ts +1 -1
- package/node/cp-node/clone.js +6 -4
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/cp-node.d.ts +196 -0
- package/node/cp-node/cp-node.js +249 -0
- package/node/cp-node/cp-node.js.map +1 -0
- package/node/cp-node/create-cp-node.d.ts +4 -0
- package/node/cp-node/create-cp-node.js +8 -0
- package/node/cp-node/create-cp-node.js.map +1 -0
- package/node/cp-node/enhance-cp-node.d.ts +24 -0
- package/node/cp-node/enhance-cp-node.js +20 -0
- package/node/cp-node/enhance-cp-node.js.map +1 -0
- package/node/{get-boundary-bezier-parts-to-next.js → cp-node/get-boundary-bezier-parts-to-next.js} +1 -1
- package/node/cp-node/get-boundary-bezier-parts-to-next.js.map +1 -0
- package/node/{get-boundary-beziers-to-next.d.ts → cp-node/get-boundary-beziers-to-next.d.ts} +1 -1
- package/node/{get-boundary-beziers-to-next.js → cp-node/get-boundary-beziers-to-next.js} +1 -1
- package/node/cp-node/get-boundary-beziers-to-next.js.map +1 -0
- package/node/cp-node/get-cp-node-ordering.d.ts +8 -0
- package/node/cp-node/get-cp-node-ordering.js +12 -0
- package/node/cp-node/get-cp-node-ordering.js.map +1 -0
- package/node/{get-curve-to-next.js → cp-node/get-curve-to-next.js} +1 -1
- package/node/cp-node/get-curve-to-next.js.map +1 -0
- package/node/cp-node/remove.d.ts +1 -1
- package/node/cp-node/traverse-cp.d.ts +12 -0
- package/node/cp-node/traverse-cp.js +26 -0
- package/node/cp-node/traverse-cp.js.map +1 -0
- package/node/{traverse-edges.js → cp-node/traverse-edges.js} +4 -3
- package/node/cp-node/traverse-edges.js.map +1 -0
- package/node/{traverse-vertices.js → cp-node/traverse-vertices.js} +4 -3
- package/node/cp-node/traverse-vertices.js.map +1 -0
- package/node/{curve.d.ts → curve/curve.d.ts} +4 -17
- package/node/curve/curve.js +14 -0
- package/node/curve/curve.js.map +1 -0
- package/node/debug/cp-node-for-debugging.d.ts +2 -2
- package/node/debug/debug-elem-types.d.ts +8 -8
- package/node/debug/debug.d.ts +6 -6
- package/node/debug/debug.js +2 -2
- package/node/debug/debug.js.map +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +2 -2
- package/node/debug/functions/draw-elem/bounding-hull.js +3 -3
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.d.ts +2 -2
- package/node/debug/functions/draw-elem/branch.js +4 -3
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.d.ts +2 -2
- package/node/debug/functions/draw-elem/culls.js +2 -2
- package/node/debug/functions/draw-elem/culls.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js +1 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js +3 -3
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/dull-corner.js +3 -4
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +2 -2
- package/node/debug/functions/draw-elem/leaves.js +1 -1
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loop.d.ts +2 -2
- package/node/debug/functions/draw-elem/loop.js +1 -2
- package/node/debug/functions/draw-elem/loop.js.map +1 -1
- package/node/debug/functions/draw-elem/loops.d.ts +1 -1
- package/node/debug/functions/draw-elem/loops.js +0 -1
- package/node/debug/functions/draw-elem/loops.js.map +1 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/loose-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.d.ts +3 -3
- package/node/debug/functions/draw-elem/mat.js +9 -7
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.d.ts +2 -2
- package/node/debug/functions/draw-elem/max-vertex.js +1 -1
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.d.ts +3 -3
- package/node/debug/functions/draw-elem/min-y.js +2 -6
- package/node/debug/functions/draw-elem/min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +2 -2
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/one-prong.js +6 -11
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.d.ts +3 -3
- package/node/debug/functions/draw-elem/sharp-corner.js +3 -4
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/three-prong.js +8 -10
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.d.ts +2 -2
- package/node/debug/functions/draw-elem/tight-bounding-box.js +3 -3
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +2 -2
- package/node/debug/functions/draw-elem/two-prong.js +7 -8
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.d.ts +4 -3
- package/node/debug/functions/draw-elem/vertex.js +11 -9
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +8 -8
- package/node/debug/functions/general.js +8 -8
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.d.ts +2 -2
- package/node/debug/functions/three-prong.js +10 -13
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +16 -5
- package/node/debug/functions/two-prong.js +56 -58
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/debug/three-prong-for-debugging.d.ts +6 -6
- package/node/debug/three-prong-for-debugging.js +1 -1
- package/node/debug/three-prong-for-debugging.js.map +1 -1
- package/node/debug/two-prong-for-debugging.d.ts +7 -7
- package/node/error-analysis/gamma.d.ts +26 -0
- package/node/error-analysis/gamma.js +35 -0
- package/node/error-analysis/gamma.js.map +1 -0
- package/node/find-2-prong/add-1-prong.d.ts +12 -0
- package/node/{mat/find-mat → find-2-prong}/add-1-prong.js +11 -11
- package/node/find-2-prong/add-1-prong.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.d.ts +6 -9
- package/node/{mat/find-mat → find-2-prong}/add-2-prong.js +26 -74
- package/node/find-2-prong/add-2-prong.js.map +1 -0
- package/node/find-2-prong/add-debug-info.d.ts +8 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/add-debug-info.js +5 -4
- package/node/find-2-prong/add-debug-info.js.map +1 -0
- package/node/find-2-prong/cull-bezier-pieces.d.ts +11 -0
- package/node/find-2-prong/cull-bezier-pieces.js +28 -0
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -0
- package/node/{mat/find-mat/find-2-prong → find-2-prong}/find-2-prong.d.ts +9 -13
- package/node/find-2-prong/find-2-prong.js +144 -0
- package/node/find-2-prong/find-2-prong.js.map +1 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.d.ts +15 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.js +5 -4
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-2-prongs.d.ts +5 -5
- package/node/find-2-prong/find-and-add-2-prongs.js +60 -0
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -0
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.d.ts +3 -3
- package/node/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.js +5 -5
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.d.ts +10 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js +56 -0
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -0
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +15 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js +40 -0
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -0
- package/node/find-2-prong/reduce-radius.d.ts +8 -0
- package/node/find-2-prong/reduce-radius.js +72 -0
- package/node/find-2-prong/reduce-radius.js.map +1 -0
- package/node/find-2-prong/squared-distance-between-dd.d.ts +2 -0
- package/node/find-2-prong/squared-distance-between-dd.js +17 -0
- package/node/find-2-prong/squared-distance-between-dd.js.map +1 -0
- package/node/find-2-prong/x-for-debugging.d.ts +9 -0
- package/node/find-2-prong/x-for-debugging.js.map +1 -0
- package/node/{mat/find-mat → find-3-prong.ts}/add-3-prong.d.ts +12 -7
- package/node/find-3-prong.ts/add-3-prong.js +82 -0
- package/node/find-3-prong.ts/add-3-prong.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.d.ts +4 -4
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.js +1 -1
- package/node/find-3-prong.ts/calc-better-x.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.d.ts +3 -3
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.js +5 -7
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.d.ts +6 -6
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.js +11 -12
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.d.ts +5 -5
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong.js +52 -39
- package/node/find-3-prong.ts/find-3-prong.js.map +1 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.d.ts +5 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js +74 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-and-add-3-prongs.d.ts → find-3-prong.ts/find-and-add-all-3-prongs.d.ts} +3 -3
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js +66 -0
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js.map +1 -0
- package/node/{mat/find-mat/find-3-prong → find-3-prong.ts}/get-closest-points.d.ts +3 -3
- package/node/find-3-prong.ts/get-closest-points.js +14 -0
- package/node/find-3-prong.ts/get-closest-points.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/add-debug-info.d.ts +4 -4
- package/node/{mat/find-mat → find-mat}/add-debug-info.js +6 -6
- package/node/find-mat/add-debug-info.js.map +1 -0
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.d.ts +5 -5
- package/node/{mat/find-mat → find-mat}/create-initial-cp-graph.js +5 -6
- package/node/find-mat/create-initial-cp-graph.js.map +1 -0
- package/node/find-mat/find-mat.d.ts +10 -0
- package/node/find-mat/find-mat.js +57 -0
- package/node/find-mat/find-mat.js.map +1 -0
- package/node/{find-mats.d.ts → find-mat/find-mats.d.ts} +1 -1
- package/node/find-mat/find-mats.js +58 -0
- package/node/find-mat/find-mats.js.map +1 -0
- package/node/find-mat/fix-ordering.d.ts +8 -0
- package/node/find-mat/fix-ordering.js +59 -0
- package/node/find-mat/fix-ordering.js.map +1 -0
- package/node/find-mat/get-dull-corners.d.ts +5 -0
- package/node/find-mat/get-dull-corners.js +22 -0
- package/node/find-mat/get-dull-corners.js.map +1 -0
- package/node/find-mat/get-for-1-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js +28 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-for-2-prongs-on-loop.d.ts +11 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js +30 -0
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -0
- package/node/find-mat/get-sharp-corners.d.ts +5 -0
- package/node/find-mat/get-sharp-corners.js +21 -0
- package/node/find-mat/get-sharp-corners.js.map +1 -0
- package/node/find-mat/get-size-params.d.ts +7 -0
- package/node/find-mat/get-size-params.js +33 -0
- package/node/find-mat/get-size-params.js.map +1 -0
- package/node/geometry/circle.js.map +1 -0
- package/node/geometry/get-bounding-box-.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-square-distance-to-rect.js +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -0
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.d.ts +1 -1
- package/node/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.js +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -0
- package/node/get-curve/get-curve-between.d.ts +1 -1
- package/node/get-curve/get-curve-between.js +2 -2
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.d.ts +2 -2
- package/node/get-curve/get-edge-direction.js +2 -4
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/index.d.ts +24 -20
- package/node/index.js +21 -16
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.d.ts +1 -1
- package/node/loop/get-max-coordinate.js +1 -1
- package/node/mat/add-to-cp-graph.d.ts +8 -7
- package/node/mat/add-to-cp-graph.js +6 -4
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/bezier-piece.d.ts +2 -2
- package/node/mat/create-new-cp-tree.d.ts +3 -3
- package/node/mat/create-new-cp-tree.js +5 -7
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/elem-type-two-prong.d.ts +1 -1
- package/node/mat/get-boundary-piece-beziers.d.ts +2 -2
- package/node/mat/get-boundary-piece-beziers.js +4 -4
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/{get-branches.d.ts → mat/get-branches.d.ts} +1 -1
- package/node/{get-branches.js → mat/get-branches.js} +7 -6
- package/node/mat/get-branches.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +2 -2
- package/node/mat/get-largest-vertex.js +1 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/get-neighboring-cps.d.ts +6 -4
- package/node/mat/get-neighboring-cps.js +5 -3
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/get-two-prong-type.d.ts +1 -1
- package/node/mat/get-two-prong-type.js +1 -1
- package/node/mat/get-two-prong-type.js.map +1 -1
- package/node/mat/is-another-cp-closeby.d.ts +9 -8
- package/node/mat/is-another-cp-closeby.js +21 -29
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/{mat.d.ts → mat/mat.d.ts} +2 -2
- package/node/mat/mat.js.map +1 -0
- package/node/mat/simplify-mat-map-only.d.ts +1 -1
- package/node/mat/simplify-mat-map-only.js +4 -3
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/{simplify-mat.d.ts → mat/simplify-mat.d.ts} +3 -5
- package/node/{simplify-mat.js → mat/simplify-mat.js} +11 -13
- package/node/mat/simplify-mat.js.map +1 -0
- package/node/mat/trim-mat.d.ts +1 -1
- package/node/mat/trim-mat.js +1 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape/calc-pos-order.d.ts +13 -0
- package/node/point-on-shape/calc-pos-order.js +27 -0
- package/node/point-on-shape/calc-pos-order.js.map +1 -0
- package/node/point-on-shape/compare-poss.d.ts +10 -0
- package/node/point-on-shape/compare-poss.js +18 -0
- package/node/point-on-shape/compare-poss.js.map +1 -0
- package/node/point-on-shape/create-pos.d.ts +4 -0
- package/node/point-on-shape/create-pos.js +12 -0
- package/node/point-on-shape/create-pos.js.map +1 -0
- package/node/point-on-shape/get-osculating-circle.d.ts +10 -0
- package/node/point-on-shape/get-osculating-circle.js +25 -0
- package/node/point-on-shape/get-osculating-circle.js.map +1 -0
- package/node/point-on-shape/get-pos-corner.d.ts +7 -0
- package/node/point-on-shape/get-pos-corner.js +9 -0
- package/node/point-on-shape/get-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-corner.js +8 -0
- package/node/point-on-shape/is-pos-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-dull-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-dull-corner.js +14 -0
- package/node/point-on-shape/is-pos-dull-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +1 -0
- package/node/point-on-shape/is-pos-sharp-corner.d.ts +6 -0
- package/node/point-on-shape/is-pos-sharp-corner.js +14 -0
- package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -0
- package/node/point-on-shape/point-on-shape.d.ts +11 -0
- package/node/point-on-shape/point-on-shape.js +2 -0
- package/node/point-on-shape/point-on-shape.js.map +1 -0
- package/node/point-on-shape/pos-to-human-string.d.ts +8 -0
- package/node/point-on-shape/pos-to-human-string.js +12 -0
- package/node/point-on-shape/pos-to-human-string.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/add-debug-info.d.ts +2 -2
- package/node/{mat/to-scale-axis → sat}/add-debug-info.js +1 -1
- package/node/sat/add-debug-info.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull-non-cycles.js +6 -6
- package/node/sat/cull-non-cycles.js.map +1 -0
- package/node/{mat/to-scale-axis → sat}/cull.d.ts +3 -3
- package/node/{mat/to-scale-axis → sat}/cull.js +4 -4
- package/node/sat/cull.js.map +1 -0
- package/node/{mat → sat}/get-leaves.d.ts +2 -2
- package/node/sat/get-leaves.js +14 -0
- package/node/sat/get-leaves.js.map +1 -0
- package/node/{to-scale-axis.d.ts → sat/to-scale-axis.d.ts} +2 -2
- package/node/{to-scale-axis.js → sat/to-scale-axis.js} +11 -10
- package/node/sat/to-scale-axis.js.map +1 -0
- package/node/svg/get-loop-bounds.d.ts +7 -7
- package/node/svg/get-loop-bounds.js +11 -7
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +4 -4
- package/node/svg/get-min-y-pos.js +1 -1
- package/node/svg/get-shape-bounds.d.ts +6 -5
- package/node/svg/get-shape-bounds.js +6 -2
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.d.ts +1 -1
- package/node/sweep-line/sweep-line.js +4 -4
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/package.json +10 -10
- package/src/closest-boundary-point/closest-points-on-curve-precise.ts +75 -0
- package/src/closest-boundary-point/closest-points-on-curve.ts +72 -0
- package/src/closest-boundary-point/cull-bezier-pieces.ts +35 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-loose-bounding-box.ts +4 -3
- package/src/{mat/closest-boundary-point → closest-boundary-point}/cull-by-tight-boundary-box.ts +2 -2
- package/src/closest-boundary-point/dd-deflate-with-running-error.ts +88 -0
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +16 -0
- package/src/{mat/closest-boundary-point → closest-boundary-point}/get-best-distance-squared.ts +3 -4
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +69 -0
- package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +70 -0
- package/src/closest-boundary-point/get-p-from-box.ts +14 -0
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +122 -0
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +75 -0
- package/src/{contact-point.ts → contact-point/contact-point.ts} +4 -6
- package/src/{compare-curvatures-at-interface.ts → corner/compare-curvatures-at-interface.ts} +2 -2
- package/src/{mat → corner}/corner.ts +1 -1
- package/src/{curve.ts → corner/get-corner.ts} +10 -49
- package/src/{get-interface-ccw.ts → corner/get-interface-ccw.ts} +28 -35
- package/src/cp-node/clone.ts +17 -6
- package/src/cp-node/cp-node.ts +422 -0
- package/src/cp-node/create-cp-node.ts +21 -0
- package/src/cp-node/enhance-cp-node.ts +27 -0
- package/src/{get-boundary-bezier-parts-to-next.ts → cp-node/get-boundary-bezier-parts-to-next.ts} +3 -3
- package/src/{get-boundary-beziers-to-next.ts → cp-node/get-boundary-beziers-to-next.ts} +2 -2
- package/src/cp-node/get-cp-node-ordering.ts +17 -0
- package/src/{get-curve-to-next.ts → cp-node/get-curve-to-next.ts} +1 -1
- package/src/cp-node/remove.ts +1 -1
- package/src/cp-node/traverse-cp.ts +35 -0
- package/src/{traverse-edges.ts → cp-node/traverse-edges.ts} +5 -5
- package/src/{traverse-vertices.ts → cp-node/traverse-vertices.ts} +5 -5
- package/src/curve/curve.ts +46 -0
- package/src/debug/cp-node-for-debugging.ts +2 -2
- package/src/debug/debug-elem-types.ts +8 -8
- package/src/debug/debug.ts +11 -11
- package/src/debug/functions/draw-elem/bounding-hull.ts +5 -3
- package/src/debug/functions/draw-elem/branch.ts +4 -4
- package/src/debug/functions/draw-elem/culls.ts +3 -3
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +1 -1
- package/src/debug/functions/draw-elem/draw-elem.ts +10 -6
- package/src/debug/functions/draw-elem/dull-corner.ts +10 -6
- package/src/debug/functions/draw-elem/leaves.ts +2 -2
- package/src/debug/functions/draw-elem/loop.ts +4 -3
- package/src/debug/functions/draw-elem/loops.ts +1 -2
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +8 -3
- package/src/debug/functions/draw-elem/mat.ts +16 -8
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +4 -9
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +10 -2
- package/src/debug/functions/draw-elem/one-prong.ts +12 -15
- package/src/debug/functions/draw-elem/sharp-corner.ts +10 -6
- package/src/debug/functions/draw-elem/three-prong.ts +13 -11
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +9 -3
- package/src/debug/functions/draw-elem/two-prong.ts +12 -8
- package/src/debug/functions/draw-elem/vertex.ts +12 -11
- package/src/debug/functions/general.ts +10 -10
- package/src/debug/functions/three-prong.ts +16 -20
- package/src/debug/functions/two-prong.ts +89 -77
- package/src/debug/three-prong-for-debugging.ts +17 -16
- package/src/debug/two-prong-for-debugging.ts +7 -7
- package/src/error-analysis/gamma.ts +41 -0
- package/src/{mat/find-mat → find-2-prong}/add-1-prong.ts +19 -16
- package/src/{mat/find-mat → find-2-prong}/add-2-prong.ts +45 -91
- package/src/find-2-prong/add-debug-info.ts +49 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/cull-bezier-pieces.ts +9 -11
- package/src/find-2-prong/find-2-prong.ts +191 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-2-prongs-on-all-paths.ts +12 -9
- package/src/find-2-prong/find-and-add-2-prongs.ts +88 -0
- package/src/{mat/find-mat → find-2-prong}/find-and-add-hole-closing-2-prongs.ts +7 -7
- package/src/find-2-prong/find-equidistant-point-on-line-dd.ts +77 -0
- package/src/{mat/find-mat/find-2-prong → find-2-prong}/find-equidistant-point-on-line.ts +1 -1
- package/src/find-2-prong/get-initial-bezier-pieces.ts +61 -0
- package/src/find-2-prong/pyth-trips.ts +146 -0
- package/src/find-2-prong/reduce-radius.ts +98 -0
- package/src/find-2-prong/squared-distance-between-dd.ts +25 -0
- package/src/find-2-prong/x-for-debugging.ts +13 -0
- package/src/find-3-prong.ts/add-3-prong.ts +110 -0
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-better-x.ts +5 -5
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/calc-initial-3-prong-center.ts +11 -12
- package/src/{mat/find-mat/find-3-prong → find-3-prong.ts}/find-3-prong-for-delta3s.ts +28 -28
- package/src/find-3-prong.ts/find-3-prong.ts +148 -0
- package/src/find-3-prong.ts/find-and-add-3-prongs.ts +111 -0
- package/src/find-3-prong.ts/find-and-add-all-3-prongs.ts +109 -0
- package/src/find-3-prong.ts/get-closest-points.ts +24 -0
- package/src/{mat/find-mat → find-mat}/add-debug-info.ts +10 -10
- package/src/{mat/find-mat → find-mat}/create-initial-cp-graph.ts +11 -12
- package/src/find-mat/find-mat.ts +89 -0
- package/src/find-mat/find-mats.ts +83 -0
- package/src/find-mat/fix-ordering.ts +69 -0
- package/src/find-mat/get-dull-corners.ts +34 -0
- package/src/find-mat/get-for-1-prongs-on-loop.ts +40 -0
- package/src/find-mat/get-for-2-prongs-on-loop.ts +44 -0
- package/src/find-mat/get-sharp-corners.ts +33 -0
- package/src/find-mat/get-size-params.ts +34 -0
- package/src/{mat/find-mat → find-mat}/get-total-by.ts +4 -4
- package/src/{mat/geometry → geometry}/get-closest-square-distance-to-rect.ts +1 -1
- package/src/{mat/geometry → geometry}/get-closest-squared-distance-to-rotated-rect.ts +2 -2
- package/src/get-curve/get-curve-between.ts +7 -7
- package/src/get-curve/get-edge-direction.ts +11 -11
- package/src/index.ts +64 -21
- package/src/loop/get-max-coordinate.ts +1 -1
- package/src/mat/add-to-cp-graph.ts +15 -12
- package/src/mat/bezier-piece.ts +2 -2
- package/src/mat/cmp-cp-on-delta.ts +6 -3
- package/src/mat/create-new-cp-tree.ts +6 -9
- package/src/mat/elem-type-two-prong.ts +1 -1
- package/src/mat/get-boundary-piece-beziers.ts +7 -7
- package/src/{get-branches.ts → mat/get-branches.ts} +8 -8
- package/src/mat/get-edges-as-array.ts +2 -2
- package/src/mat/get-largest-three-prong.ts +3 -3
- package/src/mat/get-largest-vertex.ts +2 -2
- package/src/mat/get-neighboring-cps.ts +9 -6
- package/src/mat/get-two-prong-type.ts +1 -1
- package/src/mat/is-another-cp-closeby.ts +29 -44
- package/src/{mat.ts → mat/mat.ts} +2 -2
- package/src/mat/simplify-mat-map-only.ts +5 -5
- package/src/{simplify-mat.ts → mat/simplify-mat.ts} +12 -14
- package/src/mat/trim-mat.ts +3 -3
- package/src/point-on-shape/calc-pos-order.ts +35 -0
- package/src/point-on-shape/compare-poss.ts +26 -0
- package/src/point-on-shape/create-pos.ts +21 -0
- package/src/point-on-shape/get-osculating-circle.ts +39 -0
- package/src/point-on-shape/get-pos-corner.ts +16 -0
- package/src/point-on-shape/is-pos-corner.ts +12 -0
- package/src/point-on-shape/is-pos-dull-corner.ts +16 -0
- package/src/point-on-shape/is-pos-quite-dull-corner.ts +17 -0
- package/src/point-on-shape/is-pos-quite-sharp-corner.ts +17 -0
- package/src/point-on-shape/is-pos-sharp-corner.ts +17 -0
- package/src/point-on-shape/point-on-shape.ts +15 -0
- package/src/point-on-shape/pos-to-human-string.ts +16 -0
- package/src/{mat/to-scale-axis → sat}/add-debug-info.ts +3 -3
- package/src/{mat/to-scale-axis → sat}/cull-non-cycles.ts +7 -7
- package/src/{mat/to-scale-axis → sat}/cull.ts +6 -6
- package/src/{mat → sat}/get-leaves.ts +4 -4
- package/src/{mat/to-scale-axis → sat}/t-tree.ts +2 -2
- package/src/{to-scale-axis.ts → sat/to-scale-axis.ts} +16 -16
- package/src/{mat/to-scale-axis → sat}/traverse-spacial-tree.ts +5 -5
- package/src/svg/get-loop-bounds.ts +22 -17
- package/src/svg/get-min-y-pos.ts +3 -3
- package/src/svg/get-shape-bounds.ts +12 -9
- package/src/sweep-line/are-boxes-intersecting.ts +1 -1
- package/src/sweep-line/sweep-line.ts +7 -7
- package/tsconfig.json +3 -7
- package/wallaby.mjs +32 -0
- package/node/circle.js.map +0 -1
- package/node/compare-curvatures-at-interface.js.map +0 -1
- package/node/contact-point.js.map +0 -1
- package/node/cp-node.d.ts +0 -202
- package/node/cp-node.js +0 -321
- package/node/cp-node.js.map +0 -1
- package/node/curve.js.map +0 -1
- package/node/find-mats.js +0 -123
- package/node/find-mats.js.map +0 -1
- package/node/get-boundary-bezier-parts-to-next.js.map +0 -1
- package/node/get-boundary-beziers-to-next.js.map +0 -1
- package/node/get-bounding-box-.js.map +0 -1
- package/node/get-branches.js.map +0 -1
- package/node/get-curve-to-next.js.map +0 -1
- package/node/get-interface-ccw.js.map +0 -1
- package/node/loop.d.ts +0 -16
- package/node/loop.js +0 -35
- package/node/loop.js.map +0 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.d.ts +0 -14
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +0 -73
- package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.d.ts +0 -9
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +0 -20
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +0 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +0 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +0 -1
- package/node/mat/closest-boundary-point/get-close-boundary-points.d.ts +0 -17
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +0 -81
- package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +0 -1
- package/node/mat/closest-boundary-point/get-closest-boundary-point.d.ts +0 -18
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +0 -41
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +0 -1
- package/node/mat/find-mat/add-1-prong.d.ts +0 -12
- package/node/mat/find-mat/add-1-prong.js.map +0 -1
- package/node/mat/find-mat/add-2-prong.js.map +0 -1
- package/node/mat/find-mat/add-3-prong.js +0 -55
- package/node/mat/find-mat/add-3-prong.js.map +0 -1
- package/node/mat/find-mat/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/create-get-interesting-points-on-loop.d.ts +0 -11
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +0 -52
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +0 -1
- package/node/mat/find-mat/create-initial-cp-graph.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/add-debug-info.d.ts +0 -8
- package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +0 -30
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +0 -233
- package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +0 -40
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.d.ts +0 -11
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +0 -38
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +0 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +0 -9
- package/node/mat/find-mat/find-2-prong/x-for-debugging.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +0 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +0 -17
- package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.d.ts +0 -15
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +0 -1
- package/node/mat/find-mat/find-and-add-2-prongs.js +0 -74
- package/node/mat/find-mat/find-and-add-2-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-3-prongs.js +0 -147
- package/node/mat/find-mat/find-and-add-3-prongs.js.map +0 -1
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-potential-2-prongs.d.ts +0 -4
- package/node/mat/find-mat/get-potential-2-prongs.js +0 -17
- package/node/mat/find-mat/get-potential-2-prongs.js.map +0 -1
- package/node/mat/find-mat/get-sharp-corners.d.ts +0 -4
- package/node/mat/find-mat/get-sharp-corners.js +0 -18
- package/node/mat/find-mat/get-sharp-corners.js.map +0 -1
- package/node/mat/geometry/get-closest-square-distance-to-rect.js.map +0 -1
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +0 -1
- package/node/mat/get-contact-circles-at-interface.d.ts +0 -8
- package/node/mat/get-contact-circles-at-interface.js +0 -21
- package/node/mat/get-contact-circles-at-interface.js.map +0 -1
- package/node/mat/get-leaves.js +0 -13
- package/node/mat/get-leaves.js.map +0 -1
- package/node/mat/to-scale-axis/add-debug-info.js.map +0 -1
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +0 -1
- package/node/mat/to-scale-axis/cull.js.map +0 -1
- package/node/mat.js.map +0 -1
- package/node/point-on-shape.d.ts +0 -73
- package/node/point-on-shape.js +0 -168
- package/node/point-on-shape.js.map +0 -1
- package/node/simplify-mat.js.map +0 -1
- package/node/to-scale-axis.js.map +0 -1
- package/node/traverse-edges.js.map +0 -1
- package/node/traverse-vertices.js.map +0 -1
- package/src/cp-node.ts +0 -388
- package/src/find-mats.ts +0 -171
- package/src/loop.ts +0 -56
- package/src/mat/closest-boundary-point/closest-point-on-curve-old.ts_ +0 -88
- package/src/mat/closest-boundary-point/closest-point-on-curve.ts_ +0 -95
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +0 -84
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +0 -38
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +0 -107
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +0 -64
- package/src/mat/find-mat/add-3-prong.ts +0 -75
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +0 -73
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +0 -46
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +0 -316
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +0 -52
- package/src/mat/find-mat/find-2-prong/x-for-debugging.ts +0 -13
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +0 -106
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +0 -28
- package/src/mat/find-mat/find-and-add-2-prongs.ts +0 -108
- package/src/mat/find-mat/find-and-add-3-prongs.ts +0 -218
- package/src/mat/find-mat/get-potential-2-prongs.ts +0 -24
- package/src/mat/find-mat/get-sharp-corners.ts +0 -25
- package/src/mat/find-mat/get-total-abs-curvature.ts +0 -17
- package/src/mat/get-contact-circles-at-interface.ts +0 -26
- package/src/mat/to-scale-axis/add-to-tree.ts +0 -66
- package/src/mat/to-scale-axis/calc-groups.ts +0 -82
- package/src/mat/to-scale-axis/create-spacial-tree.ts +0 -41
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +0 -135
- package/src/point-on-shape.ts +0 -231
- package/src/svg/get-curvature-at-interface.ts +0 -55
- /package/node/{compare-curvatures-at-interface.d.ts → corner/compare-curvatures-at-interface.d.ts} +0 -0
- /package/node/{mat → corner}/corner.js +0 -0
- /package/node/{get-interface-ccw.d.ts → corner/get-interface-ccw.d.ts} +0 -0
- /package/node/{get-boundary-bezier-parts-to-next.d.ts → cp-node/get-boundary-bezier-parts-to-next.d.ts} +0 -0
- /package/node/{get-curve-to-next.d.ts → cp-node/get-curve-to-next.d.ts} +0 -0
- /package/node/{traverse-edges.d.ts → cp-node/traverse-edges.d.ts} +0 -0
- /package/node/{traverse-vertices.d.ts → cp-node/traverse-vertices.d.ts} +0 -0
- /package/node/{mat/find-mat/find-2-prong → find-2-prong}/x-for-debugging.js +0 -0
- /package/node/{circle.d.ts → geometry/circle.d.ts} +0 -0
- /package/node/{circle.js → geometry/circle.js} +0 -0
- /package/node/{get-bounding-box-.d.ts → geometry/get-bounding-box-.d.ts} +0 -0
- /package/node/{get-bounding-box-.js → geometry/get-bounding-box-.js} +0 -0
- /package/node/{mat.js → mat/mat.js} +0 -0
- /package/src/{circle.ts → geometry/circle.ts} +0 -0
- /package/src/{get-bounding-box-.ts → geometry/get-bounding-box-.ts} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
twoDiff, twoSum, twoProduct, doubleDivDouble, ddDivDd,
|
|
3
|
+
ddAddDd, ddDiffDd, ddMultDd, ddMultBy2, ddMultDouble1
|
|
4
|
+
} from "double-double";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const { abs } = Math;
|
|
8
|
+
|
|
9
|
+
const td = twoDiff;
|
|
10
|
+
const tp = twoProduct;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the point on the line from y to x that is equidistant from y and z.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
* @param x
|
|
19
|
+
* @param y
|
|
20
|
+
* @param z
|
|
21
|
+
*/
|
|
22
|
+
function findEquidistantPointOnLineDd(
|
|
23
|
+
x: number[],
|
|
24
|
+
y: number[],
|
|
25
|
+
z: number[]) {
|
|
26
|
+
// Some basic algebra (not shown) finds the required point.
|
|
27
|
+
|
|
28
|
+
// Swap axes if x and y are more aligned to y-axis than to x-axis.
|
|
29
|
+
const swapAxes = abs(x[1] - y[1]) > abs(x[0] - y[0]);
|
|
30
|
+
|
|
31
|
+
// Cache
|
|
32
|
+
let x1: number;
|
|
33
|
+
let x2: number;
|
|
34
|
+
let y1: number;
|
|
35
|
+
let y2: number;
|
|
36
|
+
let z1: number;
|
|
37
|
+
let z2: number;
|
|
38
|
+
|
|
39
|
+
if (swapAxes) {
|
|
40
|
+
x1 = x[1]; x2 = x[0];
|
|
41
|
+
y1 = y[1]; y2 = y[0];
|
|
42
|
+
z1 = z[1]; z2 = z[0];
|
|
43
|
+
} else {
|
|
44
|
+
x1 = x[0]; x2 = x[1];
|
|
45
|
+
y1 = y[0]; y2 = y[1];
|
|
46
|
+
z1 = z[0]; z2 = z[1];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// a <= 1 (due to swapped axes)
|
|
50
|
+
// const a = (x2 - y2) / (x1 - y1);
|
|
51
|
+
// const b = y2 - a*y1;
|
|
52
|
+
// const c = (y1*y1 + y2*y2 - z1*z1 - z2*z2) + 2*b*(z2 - y2);
|
|
53
|
+
// const d = y1 - z1 + a*(y2 - z2);
|
|
54
|
+
// const t1 = c/(2*d);
|
|
55
|
+
// const t2 = a*t1 + b;
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const a = ddDivDd(td(x2,y2),td(x1,y1));
|
|
59
|
+
const b = ddDiffDd([0,y2], ddMultDouble1(y1,a));
|
|
60
|
+
|
|
61
|
+
const c = ddAddDd(
|
|
62
|
+
(ddDiffDd(
|
|
63
|
+
ddAddDd(tp(y1,y1), tp(y2,y2)),
|
|
64
|
+
ddAddDd(tp(z1,z1), tp(z2,z2))
|
|
65
|
+
)),
|
|
66
|
+
ddMultBy2(ddMultDd(b,(td(z2,y2))))
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const d = ddAddDd(td(y1,z1), ddMultDd(a,td(y2,z2)));
|
|
70
|
+
const t1 = ddDivDd(c,ddMultBy2(d));
|
|
71
|
+
const t2 = ddAddDd(ddMultDd(a,t1), b);
|
|
72
|
+
|
|
73
|
+
return swapAxes ? [t2[1],t1[1]] : [t1[1],t2[1]];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
export { findEquidistantPointOnLineDd }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
2
|
+
import { Loop } from 'flo-boolean';
|
|
3
|
+
import { getNeighbouringPoints } from '../mat/get-neighboring-cps.js';
|
|
4
|
+
import { getBoundaryPieceBeziers } from '../mat/get-boundary-piece-beziers.js';
|
|
5
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
6
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
7
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
8
|
+
import { isPosDullCorner } from '../point-on-shape/is-pos-dull-corner.js';
|
|
9
|
+
import { calcPosOrder } from '../point-on-shape/calc-pos-order.js';
|
|
10
|
+
import { Circle } from '../geometry/circle.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
function getInitialBezierPieces(
|
|
15
|
+
angle: number,
|
|
16
|
+
isHoleClosing: boolean,
|
|
17
|
+
k: number,
|
|
18
|
+
loops: Loop[],
|
|
19
|
+
cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
20
|
+
y: PointOnShape,
|
|
21
|
+
circle: Circle) {
|
|
22
|
+
|
|
23
|
+
if (isHoleClosing) {
|
|
24
|
+
const bezierPieces: BezierPiece[] = [];
|
|
25
|
+
for (let k2=0; k2<k; k2++) {
|
|
26
|
+
const pieces: BezierPiece[] = loops[k2].curves
|
|
27
|
+
.map(curve => ({ curve, ts: [0,1] }))
|
|
28
|
+
bezierPieces.push(...pieces);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { bezierPieces, δ: undefined };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let bezierPieces: BezierPiece[];
|
|
35
|
+
const order = isPosDullCorner(y)
|
|
36
|
+
? y.t === 1 && angle === 0
|
|
37
|
+
? -1
|
|
38
|
+
: y.t === 0
|
|
39
|
+
? +1
|
|
40
|
+
: calcPosOrder(circle, y)
|
|
41
|
+
: 0;
|
|
42
|
+
|
|
43
|
+
const loop = loops[k];
|
|
44
|
+
const cpNode = getNeighbouringPoints(cpTrees.get(loop)!, y, order, 0)[0];
|
|
45
|
+
const δ = [cpNode, cpNode];
|
|
46
|
+
if (!cpNode ||
|
|
47
|
+
// The special case if there is only a single sharp corner or
|
|
48
|
+
// terminating 2-prong currently in the MAT. Don't remove!
|
|
49
|
+
(cpNode === cpNode.next.next)
|
|
50
|
+
) {
|
|
51
|
+
bezierPieces = loop.curves
|
|
52
|
+
.map(curve => ({ curve, ts: [0,1] }))
|
|
53
|
+
} else {
|
|
54
|
+
bezierPieces = getBoundaryPieceBeziers(δ);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return { bezierPieces, δ };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export { getInitialBezierPieces }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { primitivePart } from "flo-poly";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* From https://www.geeksforgeeks.org/generate-pythagorean-triplets/
|
|
5
|
+
*
|
|
6
|
+
* Function to generate pythagorean triplets smaller than limit
|
|
7
|
+
*/
|
|
8
|
+
function pythagoreanTriplets(
|
|
9
|
+
limit: number): number[][] {
|
|
10
|
+
|
|
11
|
+
// Triplet: a^2 + b^2 = c^2
|
|
12
|
+
let a = 0;
|
|
13
|
+
let b = 0;
|
|
14
|
+
let c = 0;
|
|
15
|
+
|
|
16
|
+
// Loop from 2 to max_limit
|
|
17
|
+
let m = 2;
|
|
18
|
+
|
|
19
|
+
const triples: number[][] = [];
|
|
20
|
+
// Limiting c would limit all a, b and c
|
|
21
|
+
while (c < limit) {
|
|
22
|
+
for(let n=1; n<m; ++n) {
|
|
23
|
+
a = m*m - n*n;
|
|
24
|
+
b = 2*m*n;
|
|
25
|
+
c = m*m + n*n;
|
|
26
|
+
|
|
27
|
+
if (c > limit) { break; }
|
|
28
|
+
|
|
29
|
+
triples.push([a,b,c]);
|
|
30
|
+
}
|
|
31
|
+
m++;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return triples;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
function get1DegreeSpacingTriples() {
|
|
39
|
+
let limit = 10000;
|
|
40
|
+
const triplesRaw = pythagoreanTriplets(limit);
|
|
41
|
+
const triplesRed = triplesRaw.map(triple => {
|
|
42
|
+
let [x,y] = triple;
|
|
43
|
+
[x,y] = primitivePart([x,y]);
|
|
44
|
+
if (x > y) { [x,y] = [y,x]; }
|
|
45
|
+
|
|
46
|
+
return [x,y];
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
triplesRed.sort((a,b) => {
|
|
50
|
+
let res = a[0] - b[0];
|
|
51
|
+
|
|
52
|
+
if (res !== 0) { return res; }
|
|
53
|
+
|
|
54
|
+
return a[1] - b[1];
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const triples: number[][] = [];
|
|
58
|
+
for (let i=0; i<triplesRed.length; i++) {
|
|
59
|
+
const tripleRedPrev = triplesRed[i-1];
|
|
60
|
+
const tripleRed = triplesRed[i];
|
|
61
|
+
if (tripleRedPrev === undefined ||
|
|
62
|
+
tripleRed[0] !== tripleRedPrev[0] ||
|
|
63
|
+
tripleRed[1] !== tripleRedPrev[1]) {
|
|
64
|
+
|
|
65
|
+
triples.push(tripleRed);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function toDeg(angle: number) {
|
|
71
|
+
return angle*180/Math.PI;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const triplesWithAngles = triples.map(triple => {
|
|
75
|
+
const [x,y] = triple;
|
|
76
|
+
|
|
77
|
+
return [x,y,toDeg(Math.atan2(y,x))];
|
|
78
|
+
}).sort((a,b) => a[2] - b[2]);//?
|
|
79
|
+
|
|
80
|
+
triplesWithAngles.length;//?
|
|
81
|
+
triplesWithAngles[0];//?
|
|
82
|
+
triplesWithAngles[triplesWithAngles.length-1];//?
|
|
83
|
+
|
|
84
|
+
const trips: number[][] = [];
|
|
85
|
+
const GAP = 1;
|
|
86
|
+
let prev = 45;
|
|
87
|
+
for (let t of triplesWithAngles) {
|
|
88
|
+
if (t[2] - prev > GAP) {
|
|
89
|
+
trips.push(t);
|
|
90
|
+
prev = t[2];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return trips;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
// get1DegreeSpacingTriples();
|
|
99
|
+
|
|
100
|
+
const triples = [
|
|
101
|
+
[ 2184, 2263, 46.017740165645755 ],
|
|
102
|
+
[ 2928, 3145, 47.046418040919235 ],
|
|
103
|
+
[ 2760, 3071, 48.0530131573584 ],
|
|
104
|
+
[ 1675, 1932, 49.075456953155594 ],
|
|
105
|
+
[ 3003, 3596, 50.13492687612096 ],
|
|
106
|
+
[ 3885, 4828, 51.177026282632845 ],
|
|
107
|
+
[ 1825, 2352, 52.19084831477669 ],
|
|
108
|
+
[ 3220, 4371, 53.621908600697374 ],
|
|
109
|
+
[ 3036, 4277, 54.63121594688451 ],
|
|
110
|
+
[ 935, 1368, 55.64819276850652 ],
|
|
111
|
+
[ 2813, 4284, 56.70992357064812 ],
|
|
112
|
+
[ 836, 1323, 57.71132243943304 ],
|
|
113
|
+
[ 175, 288, 58.715507085582544 ],
|
|
114
|
+
[ 1955, 3348, 59.718032329846196 ],
|
|
115
|
+
[ 276, 493, 60.75825202273669 ],
|
|
116
|
+
[ 8, 15, 61.92751306414704 ],
|
|
117
|
+
[ 1404, 2747, 62.92828726173151 ],
|
|
118
|
+
[ 39, 80, 64.01076641616699 ],
|
|
119
|
+
[ 2825, 6072, 65.04978057558209 ],
|
|
120
|
+
[ 1144, 2583, 66.11164562310735 ],
|
|
121
|
+
[ 5, 12, 67.38013505195958 ],
|
|
122
|
+
[ 168, 425, 68.4314042648748 ],
|
|
123
|
+
[ 1995, 5332, 69.48636031660722 ],
|
|
124
|
+
[ 1408, 3975, 70.49515011669244 ],
|
|
125
|
+
[ 301, 900, 71.5077745088735 ],
|
|
126
|
+
[ 1887, 6016, 72.5852594569592 ],
|
|
127
|
+
[ 7, 24, 73.73979529168804 ],
|
|
128
|
+
[ 2159, 7920, 74.75161499109633 ],
|
|
129
|
+
[ 1815, 7208, 75.86654056719784 ],
|
|
130
|
+
[ 1469, 6300, 76.87460298212505 ],
|
|
131
|
+
[ 924, 4307, 77.89161621177033 ],
|
|
132
|
+
[ 1008, 5135, 78.8940579339264 ],
|
|
133
|
+
[ 204, 1147, 79.91509786165818 ],
|
|
134
|
+
[ 315, 1972, 80.92445498418671 ],
|
|
135
|
+
[ 355, 2508, 81.94347266702972 ],
|
|
136
|
+
[ 520, 4209, 82.95709324615554 ],
|
|
137
|
+
[ 19, 180, 83.97442499163333 ],
|
|
138
|
+
[ 23, 264, 85.0208941560017 ],
|
|
139
|
+
[ 29, 420, 86.05013197823607 ],
|
|
140
|
+
[ 39, 760, 87.06239857122834 ],
|
|
141
|
+
[ 120, 3599, 88.09031749225564 ],
|
|
142
|
+
[ 127, 8064, 89.09772290642545 ]
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
export { triples }
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { evalDeCasteljau } from "flo-bezier3";
|
|
2
|
+
import { dot, lineLineIntersection, squaredDistanceBetween } from "flo-vector2d";
|
|
3
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*
|
|
9
|
+
* Reduces the circle radius initially as an optimization step.
|
|
10
|
+
*/
|
|
11
|
+
function reduceRadius(
|
|
12
|
+
extreme: number,
|
|
13
|
+
bezierPieces: BezierPiece[],
|
|
14
|
+
p: number[],
|
|
15
|
+
x: number[]) {
|
|
16
|
+
|
|
17
|
+
const TOLERANCE = 1 + 2**-10;
|
|
18
|
+
|
|
19
|
+
let prevP: number[] | undefined = undefined;
|
|
20
|
+
let minRadius = Number.POSITIVE_INFINITY;
|
|
21
|
+
for (let i=0; i<bezierPieces.length; i++) {
|
|
22
|
+
const bezierPiece = bezierPieces[i];
|
|
23
|
+
|
|
24
|
+
const ps = bezierPiece.curve.ps;
|
|
25
|
+
|
|
26
|
+
let r1 = Number.POSITIVE_INFINITY;
|
|
27
|
+
const p1 = evalDeCasteljau(ps, bezierPiece.ts[0]);
|
|
28
|
+
|
|
29
|
+
// Prevent evaluating the same points twice
|
|
30
|
+
if (!prevP || prevP[0] !== p1[0] || prevP[1] !== p1[1]) {
|
|
31
|
+
const cc1 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p1);
|
|
32
|
+
if (cc1) { r1 = squaredDistanceBetween(p, cc1); }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let r2 = Number.POSITIVE_INFINITY;
|
|
36
|
+
const p2 = evalDeCasteljau(ps, bezierPiece.ts[1]);
|
|
37
|
+
|
|
38
|
+
const cc2 = getCircleCenterFrom2PointsAndNormal(extreme, p, x, p2);
|
|
39
|
+
if (cc2) { r2 = squaredDistanceBetween(p, cc2); }
|
|
40
|
+
|
|
41
|
+
prevP = p2;
|
|
42
|
+
|
|
43
|
+
const d = Math.min(r1, r2);
|
|
44
|
+
|
|
45
|
+
if (d < minRadius) {
|
|
46
|
+
minRadius = d;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The extra bit is to account for floating point precision.
|
|
51
|
+
return TOLERANCE*minRadius;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
* @param p A point on the circle with normal pointing to x towards the center
|
|
58
|
+
* of the circle.
|
|
59
|
+
* @param x
|
|
60
|
+
* @param p1 Another point on the circle.
|
|
61
|
+
*/
|
|
62
|
+
function getCircleCenterFrom2PointsAndNormal(
|
|
63
|
+
extreme: number,
|
|
64
|
+
p: number[],
|
|
65
|
+
x: number[],
|
|
66
|
+
p1: number[]) {
|
|
67
|
+
|
|
68
|
+
const TOLERANCE = (2**-14*extreme)**2;
|
|
69
|
+
|
|
70
|
+
// Ignore if p and p1 are too close together
|
|
71
|
+
if (squaredDistanceBetween(p,p1) < TOLERANCE) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The perpindicular bisector between the two given points on the circle */
|
|
76
|
+
const pb = [
|
|
77
|
+
(p[0] + p1[0]) / 2,
|
|
78
|
+
(p[1] + p1[1]) / 2,
|
|
79
|
+
];
|
|
80
|
+
const tan = [p1[0] - p[0], p1[1] - p[1]];
|
|
81
|
+
const norm = [-tan[1], tan[0]]; // Rotate by 90 degrees
|
|
82
|
+
const pb2 = [pb[0] + norm[0], pb[1] + norm[1]];
|
|
83
|
+
|
|
84
|
+
const res = lineLineIntersection([p,x], [pb, pb2]);
|
|
85
|
+
|
|
86
|
+
if (!res) { return undefined; }
|
|
87
|
+
|
|
88
|
+
const resO = [res[0] - p[0], res[1] - p[1]];
|
|
89
|
+
const xO = [x[0] - p[0], x[1] - p[1]];
|
|
90
|
+
if (dot(resO, xO) < 0) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return res;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export { reduceRadius }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ddMultDd, ddAddDd, twoDiff } from 'double-double';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function squaredDistanceBetweenDd(
|
|
5
|
+
x: number[], y: number[]) {
|
|
6
|
+
|
|
7
|
+
const [x0,y0] = x;
|
|
8
|
+
const [x1,y1] = y;
|
|
9
|
+
|
|
10
|
+
// xd = x0 - x1;
|
|
11
|
+
// yd = y0 - y1;
|
|
12
|
+
// xx = xd**2;
|
|
13
|
+
// yy = yd**2;
|
|
14
|
+
// return xx + yy
|
|
15
|
+
|
|
16
|
+
const xd = twoDiff(x0,x1);
|
|
17
|
+
const yd = twoDiff(y0,y1);
|
|
18
|
+
const xx = ddMultDd(xd,xd);
|
|
19
|
+
const yy = ddMultDd(yd,yd);
|
|
20
|
+
|
|
21
|
+
return ddAddDd(xx,yy)[1];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export { squaredDistanceBetweenDd }
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
declare const _debug_: Debug;
|
|
2
|
+
|
|
3
|
+
import { Debug } from '../debug/debug.js';
|
|
4
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
6
|
+
import { Loop } from 'flo-boolean';
|
|
7
|
+
import { Circle } from '../geometry/circle.js';
|
|
8
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
9
|
+
import { addToCpGraph } from '../mat/add-to-cp-graph.js';
|
|
10
|
+
import { isAnotherCpCloseby } from '../mat/is-another-cp-closeby.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*
|
|
16
|
+
* Adds a 3-prong MAT circle according to the 3 given (previously calculated)
|
|
17
|
+
* points on the shape.
|
|
18
|
+
*
|
|
19
|
+
* Returns 3 CpNodes if successful, else return one CpNode that is an offending
|
|
20
|
+
* too close existing CpNode.
|
|
21
|
+
*
|
|
22
|
+
* @param cpTrees
|
|
23
|
+
* @param orders
|
|
24
|
+
* @param threeProng
|
|
25
|
+
*/
|
|
26
|
+
function add3Prong(
|
|
27
|
+
cpTrees: Map<Loop,LlRbTree<CpNode>>,
|
|
28
|
+
orders: number[],
|
|
29
|
+
threeProng: {
|
|
30
|
+
circle: Circle,
|
|
31
|
+
ps: PointOnShape[],
|
|
32
|
+
δ3s: CpNode[][]
|
|
33
|
+
}): CpNode[] {
|
|
34
|
+
|
|
35
|
+
const { circle, ps: poss, δ3s } = threeProng;
|
|
36
|
+
|
|
37
|
+
// Keep for possible future debugging.
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
let ii = -1;
|
|
41
|
+
if (typeof _debug_ !== 'undefined') {
|
|
42
|
+
for (let i=0; i<3; i++) {
|
|
43
|
+
const cpBef = threeProng.δ3s[i][0].cp;
|
|
44
|
+
const cpAft = threeProng.δ3s[i][1].cp;
|
|
45
|
+
|
|
46
|
+
//let cmpBef = PointOnShape.compareInclOrder(cpBef.pointOnShape, poss[i], cpBef.order, orders[i]);
|
|
47
|
+
//let cmpAft = PointOnShape.compareInclOrder(cpAft.pointOnShape, poss[i], cpAft.order, orders[i]);
|
|
48
|
+
const cmpBef = compareCps(cpBef, { pointOnShape: poss[i], order: orders[i], order2: 0, circle: undefined });
|
|
49
|
+
const cmpAft = compareCps(cpAft, { pointOnShape: poss[i], order: orders[i], order2: 0, circle: undefined });
|
|
50
|
+
|
|
51
|
+
// const cmpBef = comparePoss(cpBef.pointOnShape, poss[i]);
|
|
52
|
+
// const cmpAft = comparePoss(cpAft.pointOnShape, poss[i]);
|
|
53
|
+
|
|
54
|
+
// len is used by debug functions to reference a particular
|
|
55
|
+
// three-prong.
|
|
56
|
+
const len = _debug_.generated.elems.threeProng.length-1;
|
|
57
|
+
if (cmpBef > 0) {
|
|
58
|
+
console.log('----------------------------------------');
|
|
59
|
+
console.log(`3-prong order is wrong (bef) : i: ${i} - cmp: ${cmpBef} - n: ${len}`);
|
|
60
|
+
console.log(threeProng);
|
|
61
|
+
console.log(cpBef);
|
|
62
|
+
console.log(cpAft);
|
|
63
|
+
console.log(poss[i]);
|
|
64
|
+
ii = i;
|
|
65
|
+
}
|
|
66
|
+
if (cmpAft < 0) {
|
|
67
|
+
console.log('----------------------------------------');
|
|
68
|
+
console.log(`3-prong order is wrong (aft) : i: ${i} - cmp: ${cmpAft} - n: ${len}`);
|
|
69
|
+
console.log(threeProng);
|
|
70
|
+
console.log(cpBef);
|
|
71
|
+
console.log(cpAft);
|
|
72
|
+
console.log(poss[i]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
// TODO - replace 1000 below with correct value
|
|
79
|
+
const c1 = isAnotherCpCloseby(cpTrees, poss[0], circle, orders[0], 0, 1000);
|
|
80
|
+
const c2 = isAnotherCpCloseby(cpTrees, poss[1], circle, orders[1], 0, 1000);
|
|
81
|
+
const c3 = isAnotherCpCloseby(cpTrees, poss[2], circle, orders[2], 0, 1000);
|
|
82
|
+
|
|
83
|
+
// for (let pos of poss) {
|
|
84
|
+
// if (pos.t === 0.9978869234519733) {
|
|
85
|
+
// console.log(pos)
|
|
86
|
+
// }
|
|
87
|
+
// }
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// if (!!c1) {
|
|
91
|
+
// console.log(getRealProngCount(c1));
|
|
92
|
+
// }
|
|
93
|
+
// if (!!c2) {
|
|
94
|
+
// console.log(getRealProngCount(c2));
|
|
95
|
+
// }
|
|
96
|
+
// if (!!c3) {
|
|
97
|
+
// console.log(getRealProngCount(c3));
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
// if (!!c1) { return [c1]; }
|
|
101
|
+
// if (!!c2) { return [c2]; }
|
|
102
|
+
// if (!!c3) { return [c3]; }
|
|
103
|
+
|
|
104
|
+
const cps = addToCpGraph(circle, orders, cpTrees, poss, δ3s);
|
|
105
|
+
|
|
106
|
+
return cps;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
export { add3Prong }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { fromTo, circumCenter, len, scale, translate } from 'flo-vector2d';
|
|
2
|
-
import {
|
|
3
|
-
import { BezierPiece } from '
|
|
2
|
+
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
3
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
4
4
|
import { getClosestPoints } from './get-closest-points.js';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
* Find new x and ps that are a better estimate of the 3-prong circle.
|
|
10
10
|
* The potential function, V, is defined as the distance to the actual 3 prong
|
|
11
11
|
* circle center.
|
|
@@ -25,7 +25,7 @@ function calcBetterX(
|
|
|
25
25
|
let nu = 1;
|
|
26
26
|
let better;
|
|
27
27
|
let newX;
|
|
28
|
-
let newPs:
|
|
28
|
+
let newPs: (PointOnShape | undefined)[];
|
|
29
29
|
let newV;
|
|
30
30
|
let i = 0; // Safeguard
|
|
31
31
|
do {
|
|
@@ -36,7 +36,7 @@ function calcBetterX(
|
|
|
36
36
|
newPs = getClosestPoints(newX, bezierPiece3s);
|
|
37
37
|
|
|
38
38
|
// Point of zero V
|
|
39
|
-
const newCircleCenter = circumCenter(newPs.map(pos => pos
|
|
39
|
+
const newCircleCenter = circumCenter(newPs.map(pos => pos!.p));
|
|
40
40
|
const newVectorToZeroV = fromTo(newX, newCircleCenter);
|
|
41
41
|
newV = len(newVectorToZeroV);
|
|
42
42
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @internal */
|
|
2
2
|
import { circumCenter } from 'flo-vector2d';
|
|
3
|
-
import { CpNode } from '
|
|
4
|
-
import { BezierPiece } from '
|
|
5
|
-
import {
|
|
3
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
4
|
+
import { BezierPiece } from '../mat/bezier-piece.js';
|
|
5
|
+
import { getCloseBoundaryPointsCertified } from '../closest-boundary-point/get-close-boundary-points-certified.js';
|
|
6
|
+
import { createPos } from '../point-on-shape/create-pos.js';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
|
-
* @
|
|
10
|
+
* @internal
|
|
10
11
|
* Finds an initial 3-prong circle center point from which to iterate. The point
|
|
11
12
|
* must be within the shape.
|
|
12
13
|
* @param δ3s - The three boundary pieces of which we need to find the three
|
|
@@ -20,16 +21,14 @@ function calcInitial3ProngCenter(
|
|
|
20
21
|
|
|
21
22
|
const twoProngCircleCenter = δ3s[0][0].cp.circle.center;
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
undefined // t
|
|
28
|
-
);
|
|
24
|
+
const pos = getCloseBoundaryPointsCertified(
|
|
25
|
+
bezierPiece3s[1],
|
|
26
|
+
twoProngCircleCenter
|
|
27
|
+
)[0];
|
|
29
28
|
|
|
30
29
|
const meanPoints = [
|
|
31
30
|
δ3s[0][0].cp.pointOnShape.p,
|
|
32
|
-
|
|
31
|
+
pos.p,
|
|
33
32
|
δ3s[2][1].cp.pointOnShape.p,
|
|
34
33
|
];
|
|
35
34
|
|