flo-mat 3.0.1 → 3.0.2
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/.mocharc.cjs +1 -1
- package/README.md +7 -7
- package/browser/index.min.js +1 -1
- package/newdocs/README.md +41 -0
- package/newdocs/babel.config.js +3 -0
- package/newdocs/blog/2019-05-28-first-blog-post.md +12 -0
- package/newdocs/blog/2019-05-29-long-blog-post.md +44 -0
- package/newdocs/blog/2021-08-01-mdx-blog-post.mdx +20 -0
- package/newdocs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/newdocs/blog/2021-08-26-welcome/index.md +25 -0
- package/newdocs/blog/authors.yml +17 -0
- package/newdocs/docs/Introduction.md +78 -0
- package/newdocs/docs/aaa.md +23 -0
- package/newdocs/docusaurus.config.js +139 -0
- package/newdocs/package-lock.json +12697 -0
- package/newdocs/package.json +46 -0
- package/newdocs/sidebars.js +33 -0
- package/newdocs/src/components/HomepageFeatures/index.tsx +46 -0
- package/newdocs/src/components/HomepageFeatures/styles.module.css +11 -0
- package/newdocs/src/css/custom.css +30 -0
- package/newdocs/src/pages/index.module.css +23 -0
- package/newdocs/src/pages/index.tsx +43 -0
- package/newdocs/src/pages/markdown-page.md +7 -0
- package/newdocs/static/.nojekyll +0 -0
- package/newdocs/static/img/docusaurus-social-card.jpg +0 -0
- package/newdocs/static/img/docusaurus.png +0 -0
- package/newdocs/static/img/favicon.ico +0 -0
- package/newdocs/static/img/favicon1.ico +0 -0
- package/newdocs/static/img/favicon_io/android-chrome-192x192.png +0 -0
- package/newdocs/static/img/favicon_io/android-chrome-512x512.png +0 -0
- package/newdocs/static/img/favicon_io/apple-touch-icon.png +0 -0
- package/newdocs/static/img/favicon_io/favicon-16x16.png +0 -0
- package/newdocs/static/img/favicon_io/favicon-32x32.png +0 -0
- package/newdocs/static/img/favicon_io/favicon.ico +0 -0
- package/newdocs/static/img/favicon_io/site.webmanifest +1 -0
- package/newdocs/static/img/favicon_io.zip +0 -0
- package/newdocs/static/img/logo.png +0 -0
- package/newdocs/static/img/logo.svg +1 -0
- package/newdocs/static/img/undraw_books_re_8gea.svg +1 -0
- package/newdocs/static/img/undraw_docusaurus_mountain.svg +171 -0
- package/newdocs/static/img/undraw_docusaurus_react.svg +170 -0
- package/newdocs/static/img/undraw_docusaurus_tree.svg +40 -0
- package/newdocs/tsconfig.json +7 -0
- package/node/add-n-prong.ts/join-spokes.d.ts +4 -0
- package/node/add-n-prong.ts/join-spokes.js +24 -0
- package/node/add-n-prong.ts/join-spokes.js.map +1 -0
- package/node/bezier/fit-quads-to-cubic.d.ts +19 -0
- package/node/bezier/fit-quads-to-cubic.js +83 -0
- package/node/bezier/fit-quads-to-cubic.js.map +1 -0
- package/node/bezier/total-curvature.d.ts +2 -0
- package/node/bezier/total-curvature.js +5 -0
- package/node/bezier/total-curvature.js.map +1 -0
- package/node/bezier/total-length.d.ts +2 -0
- package/node/bezier/total-length.js +5 -0
- package/node/bezier/total-length.js.map +1 -0
- package/node/closest-boundary-point/cull-bezier-pieces.d.ts +2 -2
- package/node/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
- package/node/closest-boundary-point/cull-by-loose-bounding-box.d.ts +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js +2 -2
- package/node/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
- package/node/closest-boundary-point/cull-by-tight-boundary-box.d.ts +2 -2
- package/node/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
- package/node/closest-boundary-point/dd-deflate-with-running-error.js.map +1 -1
- package/node/closest-boundary-point/foot-and-endpoint-info.d.ts +1 -1
- package/node/closest-boundary-point/get-best-distance-squared.d.ts +2 -2
- package/node/closest-boundary-point/get-best-distance-squared.js.map +1 -1
- package/node/closest-boundary-point/get-close-boundary-points-certified.d.ts +6 -3
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +6 -3
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.d.ts +5 -1
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js +22 -5
- package/node/closest-boundary-point/get-potential-closest-points-on-curve-certified.js.map +1 -1
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.d.ts +1 -1
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js +13 -8
- package/node/closest-boundary-point/root-interval-to-distance-squared-interval.js.map +1 -1
- package/node/contact-point/contact-point.js.map +1 -1
- package/node/corner/compare-curvatures-at-interface.js +37 -54
- package/node/corner/compare-curvatures-at-interface.js.map +1 -1
- package/node/corner/corner.d.ts +0 -1
- package/node/corner/get-corner.d.ts +1 -1
- package/node/corner/get-corner.js +9 -21
- package/node/corner/get-corner.js.map +1 -1
- package/node/corner/get-interface-ccw.d.ts +6 -7
- package/node/corner/get-interface-ccw.js +63 -46
- package/node/corner/get-interface-ccw.js.map +1 -1
- package/node/cp-node/cp-node-fs.d.ts +225 -0
- package/node/cp-node/cp-node-fs.js +228 -0
- package/node/cp-node/cp-node-fs.js.map +1 -0
- package/node/cp-node/cp-node.d.ts +22 -128
- package/node/cp-node/cp-node.js +1 -248
- package/node/cp-node/cp-node.js.map +1 -1
- package/node/cp-node/{clone.d.ts → fs/clone.d.ts} +1 -1
- package/node/cp-node/{clone.js → fs/clone.js} +14 -5
- package/node/cp-node/fs/clone.js.map +1 -0
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.d.ts +3 -0
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js +6 -0
- package/node/cp-node/fs/cp-nodes-to-boundary-beziers.js.map +1 -0
- package/node/cp-node/{enhance-cp-node.d.ts → fs/enhance-cp-node.d.ts} +14 -4
- package/node/cp-node/{enhance-cp-node.js → fs/enhance-cp-node.js} +8 -1
- package/node/cp-node/fs/enhance-cp-node.js.map +1 -0
- package/node/cp-node/fs/find-first.d.ts +3 -0
- package/node/cp-node/fs/find-first.js +16 -0
- package/node/cp-node/fs/find-first.js.map +1 -0
- package/node/cp-node/fs/get-all-between.d.ts +17 -0
- package/node/cp-node/fs/get-all-between.js +31 -0
- package/node/cp-node/fs/get-all-between.js.map +1 -0
- package/node/cp-node/fs/get-all-on-circle.d.ts +3 -0
- package/node/cp-node/fs/get-all-on-circle.js +14 -0
- package/node/cp-node/fs/get-all-on-circle.js.map +1 -0
- package/node/cp-node/fs/get-all-on-loop.d.ts +3 -0
- package/node/cp-node/fs/get-all-on-loop.js +12 -0
- package/node/cp-node/fs/get-all-on-loop.js.map +1 -0
- package/node/cp-node/fs/get-all-vertices.d.ts +3 -0
- package/node/cp-node/fs/get-all-vertices.js +10 -0
- package/node/cp-node/fs/get-all-vertices.js.map +1 -0
- package/node/cp-node/fs/get-angle-between-mat-curves.d.ts +9 -0
- package/node/cp-node/fs/get-angle-between-mat-curves.js +18 -0
- package/node/cp-node/fs/get-angle-between-mat-curves.js.map +1 -0
- package/node/cp-node/{get-boundary-bezier-parts-to-next.d.ts → fs/get-boundary-bezier-parts-to-next.d.ts} +1 -6
- package/node/cp-node/{get-boundary-bezier-parts-to-next.js → fs/get-boundary-bezier-parts-to-next.js} +0 -5
- package/node/cp-node/fs/get-boundary-bezier-parts-to-next.js.map +1 -0
- package/node/cp-node/fs/get-boundary-beziers-between.d.ts +17 -0
- package/node/cp-node/fs/get-boundary-beziers-between.js +22 -0
- package/node/cp-node/fs/get-boundary-beziers-between.js.map +1 -0
- package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +3 -0
- package/node/cp-node/{get-boundary-beziers-to-next.js → fs/get-boundary-beziers-to-next.js} +2 -7
- package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -0
- package/node/cp-node/fs/get-branch-beziers.d.ts +8 -0
- package/node/cp-node/fs/get-branch-beziers.js +12 -0
- package/node/cp-node/fs/get-branch-beziers.js.map +1 -0
- package/node/cp-node/fs/get-branch.d.ts +10 -0
- package/node/cp-node/fs/get-branch.js +33 -0
- package/node/cp-node/fs/get-branch.js.map +1 -0
- package/node/cp-node/fs/get-children.d.ts +3 -0
- package/node/cp-node/fs/get-children.js +12 -0
- package/node/cp-node/fs/get-children.js.map +1 -0
- package/node/cp-node/{get-cp-node-ordering.d.ts → fs/get-cp-node-ordering.d.ts} +5 -1
- package/node/cp-node/{get-cp-node-ordering.js → fs/get-cp-node-ordering.js} +4 -0
- package/node/cp-node/fs/get-cp-node-ordering.js.map +1 -0
- package/node/cp-node/fs/get-distance-to-next.d.ts +4 -0
- package/node/cp-node/fs/get-distance-to-next.js +11 -0
- package/node/cp-node/fs/get-distance-to-next.js.map +1 -0
- package/node/cp-node/fs/get-edge-direction.d.ts +3 -0
- package/node/{get-curve → cp-node/fs}/get-edge-direction.js +1 -7
- package/node/cp-node/fs/get-edge-direction.js.map +1 -0
- package/node/cp-node/fs/get-first-exit.d.ts +3 -0
- package/node/cp-node/fs/get-first-exit.js +15 -0
- package/node/cp-node/fs/get-first-exit.js.map +1 -0
- package/node/cp-node/fs/get-hole-closers.d.ts +3 -0
- package/node/cp-node/fs/get-hole-closers.js +7 -0
- package/node/cp-node/fs/get-hole-closers.js.map +1 -0
- package/node/cp-node/fs/get-implied-boundary-bezier-between.d.ts +3 -0
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js +58 -0
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -0
- package/node/cp-node/fs/get-mat-curve-between.d.ts +3 -0
- package/node/{get-curve/get-curve-between.js → cp-node/fs/get-mat-curve-between.js} +3 -9
- package/node/cp-node/fs/get-mat-curve-between.js.map +1 -0
- package/node/cp-node/fs/get-mat-curve-to-next.d.ts +4 -0
- package/node/cp-node/fs/get-mat-curve-to-next.js +8 -0
- package/node/cp-node/fs/get-mat-curve-to-next.js.map +1 -0
- package/node/cp-node/fs/get-mat-curves-between.d.ts +3 -0
- package/node/cp-node/fs/get-mat-curves-between.js +13 -0
- package/node/cp-node/fs/get-mat-curves-between.js.map +1 -0
- package/node/cp-node/fs/get-non-terminating-on-circle.d.ts +3 -0
- package/node/cp-node/fs/get-non-terminating-on-circle.js +15 -0
- package/node/cp-node/fs/get-non-terminating-on-circle.js.map +1 -0
- package/node/cp-node/fs/get-prong-count.d.ts +3 -0
- package/node/cp-node/fs/get-prong-count.js +12 -0
- package/node/cp-node/fs/get-prong-count.js.map +1 -0
- package/node/cp-node/fs/get-real-prong-count.d.ts +3 -0
- package/node/cp-node/fs/get-real-prong-count.js +9 -0
- package/node/cp-node/fs/get-real-prong-count.js.map +1 -0
- package/node/cp-node/fs/get-salience.d.ts +7 -0
- package/node/cp-node/fs/get-salience.js +20 -0
- package/node/cp-node/fs/get-salience.js.map +1 -0
- package/node/cp-node/fs/get-smoothed-speed.d.ts +3 -0
- package/node/cp-node/fs/get-smoothed-speed.js +75 -0
- package/node/cp-node/fs/get-smoothed-speed.js.map +1 -0
- package/node/cp-node/fs/get-speed.d.ts +4 -0
- package/node/cp-node/fs/get-speed.js +40 -0
- package/node/cp-node/fs/get-speed.js.map +1 -0
- package/node/cp-node/fs/get-vertex-forward-children.d.ts +3 -0
- package/node/cp-node/fs/get-vertex-forward-children.js +15 -0
- package/node/cp-node/fs/get-vertex-forward-children.js.map +1 -0
- package/node/cp-node/fs/insert-cp-node.d.ts +5 -0
- package/node/cp-node/fs/insert-cp-node.js +21 -0
- package/node/cp-node/fs/insert-cp-node.js.map +1 -0
- package/node/cp-node/fs/is-fully-terminating.d.ts +3 -0
- package/node/cp-node/fs/is-fully-terminating.js +8 -0
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -0
- package/node/cp-node/fs/is-on-same-circle.d.ts +3 -0
- package/node/cp-node/fs/is-on-same-circle.js +8 -0
- package/node/cp-node/fs/is-on-same-circle.js.map +1 -0
- package/node/cp-node/fs/is-one-prong.d.ts +3 -0
- package/node/cp-node/fs/is-one-prong.js +13 -0
- package/node/cp-node/fs/is-one-prong.js.map +1 -0
- package/node/cp-node/fs/is-order-correct.d.ts +5 -0
- package/node/cp-node/fs/is-order-correct.js +26 -0
- package/node/cp-node/fs/is-order-correct.js.map +1 -0
- package/node/cp-node/fs/is-sharp.d.ts +3 -0
- package/node/cp-node/fs/is-sharp.js +5 -0
- package/node/cp-node/fs/is-sharp.js.map +1 -0
- package/node/cp-node/fs/is-special.d.ts +3 -0
- package/node/cp-node/fs/is-special.js +9 -0
- package/node/cp-node/fs/is-special.js.map +1 -0
- package/node/cp-node/fs/is-terminating.d.ts +3 -0
- package/node/cp-node/fs/is-terminating.js +5 -0
- package/node/cp-node/fs/is-terminating.js.map +1 -0
- package/node/cp-node/fs/is-trivial.d.ts +6 -0
- package/node/cp-node/fs/is-trivial.js +10 -0
- package/node/cp-node/fs/is-trivial.js.map +1 -0
- package/node/cp-node/fs/is-two-prong.d.ts +3 -0
- package/node/cp-node/fs/is-two-prong.js +6 -0
- package/node/cp-node/fs/is-two-prong.js.map +1 -0
- package/node/cp-node/fs/is-vertex-special.d.ts +2 -0
- package/node/cp-node/fs/is-vertex-special.js +5 -0
- package/node/cp-node/fs/is-vertex-special.js.map +1 -0
- package/node/cp-node/fs/is-vertex.d.ts +3 -0
- package/node/cp-node/fs/is-vertex.js +6 -0
- package/node/cp-node/fs/is-vertex.js.map +1 -0
- package/node/cp-node/fs/remove-cp-node.d.ts +5 -0
- package/node/cp-node/fs/remove-cp-node.js +10 -0
- package/node/cp-node/fs/remove-cp-node.js.map +1 -0
- package/node/cp-node/fs/traverse-cp.d.ts +3 -0
- package/node/cp-node/{traverse-cp.js → fs/traverse-cp.js} +2 -10
- package/node/cp-node/fs/traverse-cp.js.map +1 -0
- package/node/cp-node/fs/traverse-edges.d.ts +5 -0
- package/node/cp-node/fs/traverse-edges.js +47 -0
- package/node/cp-node/fs/traverse-edges.js.map +1 -0
- package/node/cp-node/fs/traverse-vertices.d.ts +3 -0
- package/node/cp-node/fs/traverse-vertices.js +21 -0
- package/node/cp-node/fs/traverse-vertices.js.map +1 -0
- package/node/curve/curve.d.ts +1 -8
- package/node/curve/curve.js +1 -13
- package/node/curve/curve.js.map +1 -1
- package/node/debug/debug-elem-types.d.ts +24 -29
- package/node/debug/debug-elem-types.js +22 -1
- package/node/debug/debug-elem-types.js.map +1 -1
- package/node/debug/debug.d.ts +4 -8
- package/node/debug/debug.js +16 -17
- package/node/debug/debug.js.map +1 -1
- package/node/debug/functions/draw/draw-beziers-as-single-path.d.ts +2 -0
- package/node/debug/functions/draw/draw-beziers-as-single-path.js +30 -0
- package/node/debug/functions/draw/draw-beziers-as-single-path.js.map +1 -0
- package/node/debug/functions/draw/xmlns.d.ts +2 -0
- package/node/debug/functions/draw/xmlns.js +3 -0
- package/node/debug/functions/draw/xmlns.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-branch.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-branch.js +26 -0
- package/node/debug/functions/draw-elem/draw-branch.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-cp-node.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-cp-node.js +26 -0
- package/node/debug/functions/draw-elem/draw-cp-node.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-cull.d.ts +3 -0
- package/node/debug/functions/draw-elem/draw-cull.js +9 -0
- package/node/debug/functions/draw-elem/draw-cull.js.map +1 -0
- package/node/debug/functions/draw-elem/{dull-corner.js → draw-dull-corner.js} +1 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-elem.d.ts +7 -5
- package/node/debug/functions/draw-elem/draw-elem.js +33 -36
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/draw-leaves.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-leaves.js +34 -0
- package/node/debug/functions/draw-elem/draw-leaves.js.map +1 -0
- package/node/debug/functions/draw-elem/{loop.js → draw-loop.js} +1 -1
- package/node/debug/functions/draw-elem/draw-loop.js.map +1 -0
- package/node/debug/functions/draw-elem/{loops.js → draw-loops.js} +1 -1
- package/node/debug/functions/draw-elem/draw-loops.js.map +1 -0
- package/node/debug/functions/draw-elem/{loose-bounding-box.js → draw-loose-bounding-box.js} +1 -1
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-mat.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-mat.js +38 -0
- package/node/debug/functions/draw-elem/draw-mat.js.map +1 -0
- package/node/debug/functions/draw-elem/{max-vertex.js → draw-max-vertex.js} +1 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.js.map +1 -0
- package/node/debug/functions/draw-elem/{min-y.js → draw-min-y.js} +1 -1
- package/node/debug/functions/draw-elem/draw-min-y.js.map +1 -0
- package/node/debug/functions/draw-elem/{one-prong-at-dull-corner.js → draw-one-prong-at-dull-corner.js} +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +1 -0
- package/node/debug/functions/draw-elem/{one-prong.js → draw-one-prong.js} +1 -1
- package/node/debug/functions/draw-elem/draw-one-prong.js.map +1 -0
- package/node/debug/functions/draw-elem/{sharp-corner.js → draw-sharp-corner.js} +1 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-speed.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-speed.js +21 -0
- package/node/debug/functions/draw-elem/draw-speed.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-three-prong.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-three-prong.js +26 -0
- package/node/debug/functions/draw-elem/draw-three-prong.js.map +1 -0
- package/node/debug/functions/draw-elem/{tight-bounding-box.js → draw-tight-bounding-box.js} +1 -1
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +1 -0
- package/node/debug/functions/draw-elem/draw-two-prong.d.ts +4 -0
- package/node/debug/functions/draw-elem/draw-two-prong.js +48 -0
- package/node/debug/functions/draw-elem/draw-two-prong.js.map +1 -0
- package/node/debug/functions/draw-elem/{vertex.d.ts → draw-vertex.d.ts} +1 -2
- package/node/debug/functions/draw-elem/draw-vertex.js +15 -0
- package/node/debug/functions/draw-elem/draw-vertex.js.map +1 -0
- package/node/find-2-prong/add-1-prong.d.ts +3 -5
- package/node/find-2-prong/add-1-prong.js +15 -16
- package/node/find-2-prong/add-1-prong.js.map +1 -1
- package/node/find-2-prong/add-2-prong.d.ts +6 -6
- package/node/find-2-prong/add-2-prong.js +45 -124
- package/node/find-2-prong/add-2-prong.js.map +1 -1
- package/node/find-2-prong/calc-seperation-tolerance.d.ts +2 -0
- package/node/find-2-prong/calc-seperation-tolerance.js +86 -0
- package/node/find-2-prong/calc-seperation-tolerance.js.map +1 -0
- package/node/find-2-prong/cull-bezier-pieces.d.ts +2 -2
- package/node/find-2-prong/cull-bezier-pieces.js +2 -2
- package/node/find-2-prong/cull-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/find-2-prong.d.ts +4 -6
- package/node/find-2-prong/find-2-prong.js +69 -54
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/find-and-add-2-prong.d.ts +11 -0
- package/node/find-2-prong/find-and-add-2-prong.js +19 -0
- package/node/find-2-prong/find-and-add-2-prong.js.map +1 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-loops.d.ts +14 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-loops.js +21 -0
- package/node/find-2-prong/find-and-add-2-prongs-on-all-loops.js.map +1 -0
- package/node/find-2-prong/find-and-add-2-prongs.d.ts +5 -9
- package/node/find-2-prong/find-and-add-2-prongs.js +17 -21
- package/node/find-2-prong/find-and-add-2-prongs.js.map +1 -1
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.d.ts +3 -4
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js +8 -8
- package/node/find-2-prong/find-and-add-hole-closing-2-prongs.js.map +1 -1
- package/node/find-2-prong/find-equidistant-point-on-line-dd.js.map +1 -1
- package/node/find-2-prong/get-initial-bezier-pieces.d.ts +2 -8
- package/node/find-2-prong/get-initial-bezier-pieces.js +13 -21
- package/node/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/find-2-prong/reduce-radius.d.ts +2 -2
- package/node/find-2-prong/reduce-radius.js +10 -19
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/find-3-prong.ts/calc-better-x.d.ts +3 -3
- package/node/find-3-prong.ts/calc-better-x.js +4 -4
- package/node/find-3-prong.ts/calc-better-x.js.map +1 -1
- package/node/find-3-prong.ts/calc-initial-3-prong-center.d.ts +2 -2
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js +6 -3
- package/node/find-3-prong.ts/calc-initial-3-prong-center.js.map +1 -1
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.d.ts +4 -4
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js +24 -33
- package/node/find-3-prong.ts/find-3-prong-for-delta3s.js.map +1 -1
- package/node/find-3-prong.ts/find-3-prong.d.ts +1 -1
- package/node/find-3-prong.ts/find-3-prong.js +2 -61
- package/node/find-3-prong.ts/find-3-prong.js.map +1 -1
- package/node/find-3-prong.ts/find-and-add-3-prong.d.ts +15 -0
- package/node/find-3-prong.ts/find-and-add-3-prong.js +43 -0
- package/node/find-3-prong.ts/find-and-add-3-prong.js.map +1 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.d.ts +11 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.js +63 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs-on-loop.js.map +1 -0
- package/node/find-3-prong.ts/find-and-add-3-prongs.d.ts +22 -3
- package/node/find-3-prong.ts/find-and-add-3-prongs.js +28 -55
- package/node/find-3-prong.ts/find-and-add-3-prongs.js.map +1 -1
- package/node/find-3-prong.ts/get-closest-points.d.ts +2 -2
- package/node/find-3-prong.ts/get-closest-points.js +2 -1
- package/node/find-3-prong.ts/get-closest-points.js.map +1 -1
- package/node/find-mat/clip-options.d.ts +3 -0
- package/node/find-mat/clip-options.js +32 -0
- package/node/find-mat/clip-options.js.map +1 -0
- package/node/find-mat/{create-initial-cp-graph.d.ts → create-initial-cp-tree.d.ts} +5 -2
- package/node/find-mat/{create-initial-cp-graph.js → create-initial-cp-tree.js} +11 -10
- package/node/find-mat/create-initial-cp-tree.js.map +1 -0
- package/node/find-mat/find-mat.d.ts +7 -2
- package/node/find-mat/find-mat.js +34 -22
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/find-mats.d.ts +4 -2
- package/node/find-mat/find-mats.js +27 -10
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/{get-dull-corners.js → get-dull-corners-on-loop.js} +3 -3
- package/node/find-mat/get-dull-corners-on-loop.js.map +1 -0
- package/node/find-mat/get-for-1-prongs-on-loop.js +15 -5
- package/node/find-mat/get-for-1-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-for-2-prongs-on-loop.js +14 -10
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +11 -0
- package/node/find-mat/get-meta.js +82 -0
- package/node/find-mat/get-meta.js.map +1 -0
- package/node/find-mat/get-sharp-corners.js +3 -2
- package/node/find-mat/get-sharp-corners.js.map +1 -1
- package/node/find-mat/mat-options.d.ts +88 -0
- package/node/find-mat/mat-options.js +36 -0
- package/node/find-mat/mat-options.js.map +1 -0
- package/node/floyd-warshall/floyd-warshall.d.ts +7 -0
- package/node/floyd-warshall/floyd-warshall.js +67 -0
- package/node/floyd-warshall/floyd-warshall.js.map +1 -0
- package/node/floyd-warshall/get-graph.d.ts +3 -0
- package/node/floyd-warshall/get-graph.js +54 -0
- package/node/floyd-warshall/get-graph.js.map +1 -0
- package/node/floyd-warshall/get-hole-closer-pairs.d.ts +3 -0
- package/node/floyd-warshall/get-hole-closer-pairs.js +19 -0
- package/node/floyd-warshall/get-hole-closer-pairs.js.map +1 -0
- package/node/geometry/circle.js.map +1 -1
- package/node/geometry/get-bounding-box-.d.ts +2 -2
- package/node/geometry/get-bounding-box-.js +2 -2
- package/node/geometry/get-bounding-box-.js.map +1 -1
- package/node/geometry/get-closest-square-distance-to-rect.js.map +1 -1
- package/node/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/index.d.ts +50 -40
- package/node/index.js +34 -37
- package/node/index.js.map +1 -1
- package/node/loop/get-max-coordinate.js.map +1 -1
- package/node/mat/{add-to-cp-graph.d.ts → add-to-cp-tree.d.ts} +6 -4
- package/node/mat/add-to-cp-tree.js +34 -0
- package/node/mat/add-to-cp-tree.js.map +1 -0
- package/node/mat/connect-hole-closers.d.ts +3 -0
- package/node/mat/connect-hole-closers.js +5 -0
- package/node/mat/connect-hole-closers.js.map +1 -0
- package/node/mat/create-new-cp-tree.d.ts +1 -1
- package/node/mat/create-new-cp-tree.js +2 -1
- package/node/mat/create-new-cp-tree.js.map +1 -1
- package/node/mat/{bezier-piece.d.ts → curve-piece.d.ts} +2 -2
- package/node/mat/curve-piece.js +2 -0
- package/node/mat/curve-piece.js.map +1 -0
- package/node/mat/get-boundary-piece-beziers.d.ts +3 -2
- package/node/mat/get-boundary-piece-beziers.js +2 -3
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-branches.d.ts +1 -10
- package/node/mat/get-branches.js +23 -60
- package/node/mat/get-branches.js.map +1 -1
- package/node/mat/get-closeby-cp-if-exist.d.ts +17 -0
- package/node/mat/{is-another-cp-closeby.js → get-closeby-cp-if-exist.js} +17 -13
- package/node/mat/get-closeby-cp-if-exist.js.map +1 -0
- package/node/mat/get-cp-node-to-left-or-same.d.ts +18 -0
- package/node/mat/get-cp-node-to-left-or-same.js +29 -0
- package/node/mat/get-cp-node-to-left-or-same.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +1 -1
- package/node/mat/get-largest-vertex.js +3 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/node/mat/mat-meta.d.ts +24 -0
- package/node/mat/mat-meta.js +2 -0
- package/node/mat/mat-meta.js.map +1 -0
- package/node/mat/mat.d.ts +6 -6
- package/node/mat/simplify-mat.d.ts +2 -2
- package/node/mat/simplify-mat.js +31 -20
- package/node/mat/simplify-mat.js.map +1 -1
- package/node/mat/trim-mat.js +8 -2
- package/node/mat/trim-mat.js.map +1 -1
- package/node/memoize-primitive.d.ts +11 -0
- package/node/memoize-primitive.js +25 -0
- package/node/memoize-primitive.js.map +1 -0
- package/node/point-on-shape/calc-pos-order.js +1 -2
- package/node/point-on-shape/calc-pos-order.js.map +1 -1
- package/node/point-on-shape/compare-poss.js.map +1 -1
- package/node/point-on-shape/create-pos.d.ts +1 -1
- package/node/point-on-shape/create-pos.js +2 -3
- package/node/point-on-shape/create-pos.js.map +1 -1
- package/node/point-on-shape/get-osculating-circle.d.ts +3 -1
- package/node/point-on-shape/get-osculating-circle.js +6 -2
- package/node/point-on-shape/get-osculating-circle.js.map +1 -1
- package/node/point-on-shape/get-pos-corner.js +4 -2
- package/node/point-on-shape/get-pos-corner.js.map +1 -1
- package/node/point-on-shape/is-pos-quite-sharp-corner.js.map +1 -1
- package/node/point-on-shape/is-pos-sharp-corner.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +1 -1
- package/node/sat/add-debug-info.d.ts +1 -2
- package/node/sat/add-debug-info.js +1 -2
- package/node/sat/add-debug-info.js.map +1 -1
- package/node/sat/cull-non-cycles.js +2 -2
- package/node/sat/cull-non-cycles.js.map +1 -1
- package/node/sat/cull.d.ts +2 -2
- package/node/sat/cull.js +44 -29
- package/node/sat/cull.js.map +1 -1
- package/node/sat/get-leaves.js +4 -2
- package/node/sat/get-leaves.js.map +1 -1
- package/node/sat/get-sat-culls.d.ts +4 -0
- package/node/sat/get-sat-culls.js +33 -0
- package/node/sat/get-sat-culls.js.map +1 -0
- package/node/sat/to-scale-axis.js +13 -44
- package/node/sat/to-scale-axis.js.map +1 -1
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-min-y-pos.d.ts +1 -1
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/node/utils/dual-set.d.ts +27 -0
- package/node/utils/dual-set.js +55 -0
- package/node/utils/dual-set.js.map +1 -0
- package/node/utils/sleep.d.ts +2 -0
- package/node/utils/sleep.js +5 -0
- package/node/utils/sleep.js.map +1 -0
- package/node/utils/sum.d.ts +2 -0
- package/node/utils/sum.js +9 -0
- package/node/utils/sum.js.map +1 -0
- package/node/utils/tri-map.d.ts +27 -0
- package/node/utils/tri-map.js +49 -0
- package/node/utils/tri-map.js.map +1 -0
- package/node/vertex/remove-vertex.d.ts +5 -0
- package/node/vertex/remove-vertex.js +12 -0
- package/node/vertex/remove-vertex.js.map +1 -0
- package/package.json +21 -25
- package/src/add-n-prong.ts/join-spokes.ts +39 -0
- package/src/bezier/fit-quads-to-cubic.ts +103 -0
- package/src/bezier/total-curvature.ts +8 -0
- package/src/bezier/total-length.ts +8 -0
- package/src/closest-boundary-point/closest-points-on-curve-precise.ts +62 -62
- package/src/closest-boundary-point/cull-bezier-pieces.ts +2 -2
- package/src/closest-boundary-point/cull-by-loose-bounding-box.ts +4 -4
- package/src/closest-boundary-point/cull-by-tight-boundary-box.ts +2 -2
- package/src/closest-boundary-point/foot-and-endpoint-info.ts +2 -2
- package/src/closest-boundary-point/get-best-distance-squared.ts +2 -2
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +8 -3
- package/src/closest-boundary-point/get-closest-boundary-point-certified.ts +56 -56
- package/src/closest-boundary-point/get-potential-closest-points-on-curve-certified.ts +24 -6
- package/src/closest-boundary-point/root-interval-to-distance-squared-interval.ts +12 -6
- package/src/corner/compare-curvatures-at-interface.ts +49 -69
- package/src/corner/corner.ts +1 -1
- package/src/corner/get-corner.ts +9 -23
- package/src/corner/get-interface-ccw.ts +96 -60
- package/src/cp-node/cp-node-fs.ts +234 -0
- package/src/cp-node/cp-node.ts +27 -348
- package/src/cp-node/fs/add-distance-from.ts +50 -0
- package/src/cp-node/{clone.ts → fs/clone.ts} +27 -17
- package/src/cp-node/fs/cp-nodes-to-boundary-beziers.ts +10 -0
- package/src/cp-node/fs/create-cp-node.ts +21 -0
- package/src/cp-node/{enhance-cp-node.ts → fs/enhance-cp-node.ts} +10 -4
- package/src/cp-node/fs/find-first.ts +25 -0
- package/src/cp-node/fs/get-all-between.ts +44 -0
- package/src/cp-node/fs/get-all-on-circle.ts +23 -0
- package/src/cp-node/fs/get-all-on-loop.ts +18 -0
- package/src/cp-node/fs/get-all-vertices.ts +17 -0
- package/src/cp-node/fs/get-angle-between-mat-curves.ts +33 -0
- package/src/cp-node/fs/get-avg-speed.ts +31 -0
- package/src/cp-node/{get-boundary-bezier-parts-to-next.ts → fs/get-boundary-bezier-parts-to-next.ts} +2 -9
- package/src/cp-node/fs/get-boundary-beziers-between.ts +31 -0
- package/src/cp-node/{get-boundary-beziers-to-next.ts → fs/get-boundary-beziers-to-next.ts} +5 -10
- package/src/cp-node/fs/get-boundary-distance-to-next.ts +16 -0
- package/src/cp-node/fs/get-branch-beziers.ts +18 -0
- package/src/cp-node/fs/get-branch.ts +43 -0
- package/src/cp-node/fs/get-children.ts +18 -0
- package/src/cp-node/{get-cp-node-ordering.ts → fs/get-cp-node-ordering.ts} +5 -1
- package/src/cp-node/fs/get-distance-between.ts +16 -0
- package/src/cp-node/fs/get-distance-to-next.ts +19 -0
- package/src/cp-node/fs/get-edge-direction.ts +64 -0
- package/src/cp-node/fs/get-first-exit.ts +22 -0
- package/src/cp-node/fs/get-hole-closers.ts +13 -0
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +78 -0
- package/src/cp-node/fs/get-mat-curve-between.ts +74 -0
- package/src/cp-node/fs/get-mat-curve-to-next.ts +13 -0
- package/src/cp-node/fs/get-mat-curves-between.ts +22 -0
- package/src/cp-node/fs/get-non-terminating-on-circle.ts +24 -0
- package/src/cp-node/fs/get-prong-count.ts +18 -0
- package/src/cp-node/fs/get-real-prong-count.ts +14 -0
- package/src/cp-node/fs/get-salience.ts +28 -0
- package/src/cp-node/fs/get-smoothed-speed.ts +97 -0
- package/src/cp-node/fs/get-smoothed.ts +62 -0
- package/src/cp-node/fs/get-speed.ts +61 -0
- package/src/cp-node/fs/get-terminating-on-circle.ts +24 -0
- package/src/cp-node/fs/get-vertex-forward-children.ts +22 -0
- package/src/cp-node/fs/insert-cp-node.ts +40 -0
- package/src/cp-node/fs/is-fully-terminating.ts +13 -0
- package/src/cp-node/fs/is-on-same-circle.ts +16 -0
- package/src/cp-node/fs/is-one-prong.ts +21 -0
- package/src/cp-node/fs/is-order-correct.ts +36 -0
- package/src/cp-node/fs/is-sharp.ts +9 -0
- package/src/cp-node/fs/is-single-3-prong.ts +15 -0
- package/src/cp-node/fs/is-special.ts +16 -0
- package/src/cp-node/fs/is-terminating.ts +9 -0
- package/src/cp-node/fs/is-trivial.ts +16 -0
- package/src/cp-node/fs/is-two-prong.ts +10 -0
- package/src/cp-node/fs/is-vertex-special.ts +8 -0
- package/src/cp-node/fs/is-vertex.ts +12 -0
- package/src/cp-node/fs/iterate-all-on-loop.ts +15 -0
- package/src/cp-node/fs/remove-cp-node.ts +20 -0
- package/src/cp-node/fs/traverse-all-forward.ts +24 -0
- package/src/cp-node/{traverse-cp.ts → fs/traverse-cp.ts} +3 -11
- package/src/cp-node/fs/traverse-edges.ts +71 -0
- package/src/cp-node/fs/traverse-vertices.ts +32 -0
- package/src/curve/curve.ts +1 -16
- package/src/dbscan/dbscan.ts +91 -0
- package/src/debug/debug-elem-types.ts +37 -29
- package/src/debug/debug.ts +20 -25
- package/src/debug/functions/check-ordering.ts +97 -0
- package/src/debug/functions/cmp-cp-on-delta.ts +54 -0
- package/src/debug/functions/draw/draw-bezier-pieces.ts +35 -0
- package/src/debug/functions/draw/draw-beziers-as-single-path.ts +40 -0
- package/src/debug/functions/draw/draw-disk.ts +34 -0
- package/src/debug/functions/draw/xmlns.ts +5 -0
- package/src/debug/functions/draw-elem/branch.ts +0 -1
- package/src/debug/functions/draw-elem/draw-branch.ts +39 -0
- package/src/debug/functions/draw-elem/draw-cp-node.ts +47 -0
- package/src/debug/functions/draw-elem/draw-cull.ts +21 -0
- package/src/debug/functions/draw-elem/draw-dull-corner.ts +21 -0
- package/src/debug/functions/draw-elem/draw-elem.ts +51 -48
- package/src/debug/functions/draw-elem/draw-leaves.ts +51 -0
- package/src/debug/functions/draw-elem/draw-loop.ts +16 -0
- package/src/debug/functions/draw-elem/draw-loops.ts +10 -0
- package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +21 -0
- package/src/debug/functions/draw-elem/draw-mat.ts +53 -0
- package/src/debug/functions/draw-elem/draw-max-vertex.ts +15 -0
- package/src/debug/functions/draw-elem/draw-min-y.ts +18 -0
- package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +26 -0
- package/src/debug/functions/draw-elem/draw-one-prong.ts +23 -0
- package/src/debug/functions/draw-elem/draw-sharp-corner.ts +20 -0
- package/src/debug/functions/draw-elem/draw-speed.ts +35 -0
- package/src/debug/functions/draw-elem/draw-three-prong.ts +44 -0
- package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +18 -0
- package/src/debug/functions/draw-elem/draw-two-prong.ts +67 -0
- package/src/debug/functions/draw-elem/draw-vertex.ts +30 -0
- package/src/debug/two-prong-for-debugging.ts +2 -2
- package/src/dijkstra/dijkstra.ts +418 -0
- package/src/find-2-prong/add-1-prong.ts +15 -22
- package/src/find-2-prong/add-2-prong.ts +68 -173
- package/src/find-2-prong/add-debug-info.ts +21 -25
- package/src/find-2-prong/calc-seperation-tolerance.ts +121 -0
- package/src/find-2-prong/cull-bezier-pieces.ts +4 -4
- package/src/find-2-prong/find-2-prong.ts +86 -65
- package/src/find-2-prong/find-and-add-2-prong.ts +30 -0
- package/src/find-2-prong/find-and-add-2-prongs-on-all-loops.ts +37 -0
- package/src/find-2-prong/find-and-add-2-prongs.ts +20 -33
- package/src/find-2-prong/find-and-add-hole-closing-2-prongs.ts +13 -14
- package/src/find-2-prong/get-initial-bezier-pieces.ts +23 -31
- package/src/find-2-prong/reduce-radius.ts +13 -24
- package/src/find-3-prong.ts/array-set.ts +47 -0
- package/src/find-3-prong.ts/calc-better-x.ts +7 -7
- package/src/find-3-prong.ts/calc-initial-3-prong-center.ts +8 -3
- package/src/find-3-prong.ts/find-3-prong-for-delta3s.ts +28 -42
- package/src/find-3-prong.ts/find-3-prong.ts +7 -107
- package/src/find-3-prong.ts/find-and-add-3-prong.ts +61 -0
- package/src/find-3-prong.ts/find-and-add-3-prongs-on-loop.ts +89 -0
- package/src/find-3-prong.ts/find-and-add-3-prongs.ts +31 -81
- package/src/find-3-prong.ts/get-closest-points.ts +3 -3
- package/src/find-mat/add-2-prongs-by-error.ts +122 -0
- package/src/find-mat/clip-options.ts +38 -0
- package/src/find-mat/cp-node-for-insertion.ts +13 -0
- package/src/find-mat/create-initial-cp-tree.ts +59 -0
- package/src/find-mat/find-mat.ts +50 -38
- package/src/find-mat/find-mats.ts +39 -22
- package/src/find-mat/get-dull-corners-on-loop.ts +34 -0
- package/src/find-mat/get-for-1-prongs-on-loop.ts +25 -6
- package/src/find-mat/get-for-2-prongs-on-loop.ts +16 -8
- package/src/find-mat/get-half-angles.ts +95 -0
- package/src/find-mat/get-meta.ts +115 -0
- package/src/find-mat/get-sharp-corners.ts +3 -2
- package/src/find-mat/get-total-by.ts +5 -5
- package/src/find-mat/mat-options.ts +140 -0
- package/src/floyd-warshall/floyd-warshall.ts +89 -0
- package/src/floyd-warshall/get-graph.ts +73 -0
- package/src/floyd-warshall/get-hole-closer-pairs.ts +27 -0
- package/src/geometry/get-bounding-box-.ts +3 -2
- package/src/heap/heap.ts +96 -0
- package/src/index.ts +52 -133
- package/src/mat/add-to-cp-tree.ts +56 -0
- package/src/mat/clone-mat.ts +14 -0
- package/src/mat/clone-meta.ts +17 -0
- package/src/mat/connect-hole-closers.ts +9 -0
- package/src/mat/create-new-cp-tree.ts +4 -1
- package/src/mat/{bezier-piece.ts → curve-piece.ts} +2 -2
- package/src/mat/get-boundary-piece-beziers.ts +10 -11
- package/src/mat/get-branches.ts +25 -75
- package/src/mat/get-closeby-cp-if-exist.ts +75 -0
- package/src/mat/get-cp-node-to-left-or-same.ts +43 -0
- package/src/mat/get-edges-as-array.ts +12 -12
- package/src/mat/get-largest-3-prong.ts +21 -0
- package/src/mat/get-largest-vertex.ts +4 -1
- package/src/mat/mat-meta.ts +31 -0
- package/src/mat/mat.ts +7 -7
- package/src/mat/simplify-mat.ts +39 -23
- package/src/mat/trim-mat.ts +8 -2
- package/src/memoize-primitive.ts +31 -0
- package/src/point-on-shape/calc-pos-order.ts +1 -2
- package/src/point-on-shape/create-pos.ts +2 -3
- package/src/point-on-shape/get-osculating-circle.ts +4 -1
- package/src/point-on-shape/get-pos-corner.ts +10 -6
- package/src/point-on-shape/is-pos-dull-corner.ts +6 -4
- package/src/point-on-shape/point-on-shape.ts +1 -1
- package/src/sat/add-debug-info.ts +0 -4
- package/src/sat/cull-by-salience.ts +115 -0
- package/src/sat/cull-non-cycles.ts +4 -2
- package/src/sat/cull.ts +53 -33
- package/src/sat/get-leaves.ts +7 -2
- package/src/sat/get-sat-culls.ts +46 -0
- package/src/sat/to-scale-axis.ts +13 -57
- package/src/svg/get-extreme.ts +1 -1
- package/src/utils/bezier-piece-to-bezier.ts +13 -0
- package/src/utils/deg-to-rad.ts +7 -0
- package/src/utils/dual-map.ts +55 -0
- package/src/utils/dual-set.ts +82 -0
- package/src/utils/rad-to-deg.ts +7 -0
- package/src/utils/rotate.ts +17 -0
- package/src/utils/sleep.ts +7 -0
- package/src/utils/sum.ts +12 -0
- package/src/utils/tri-map.ts +76 -0
- package/src/vertex/remove-vertex.ts +22 -0
- package/webpack.config.cjs +38 -36
- package/browser/index.js +0 -33589
- package/node/closest-boundary-point/get-closest-boundary-point-certified.d.ts +0 -15
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js +0 -42
- package/node/closest-boundary-point/get-closest-boundary-point-certified.js.map +0 -1
- package/node/cp-node/clone.js.map +0 -1
- package/node/cp-node/create-cp-node.d.ts +0 -4
- package/node/cp-node/create-cp-node.js +0 -8
- package/node/cp-node/create-cp-node.js.map +0 -1
- package/node/cp-node/enhance-cp-node.js.map +0 -1
- package/node/cp-node/get-boundary-bezier-parts-to-next.js.map +0 -1
- package/node/cp-node/get-boundary-beziers-to-next.d.ts +0 -8
- package/node/cp-node/get-boundary-beziers-to-next.js.map +0 -1
- package/node/cp-node/get-cp-node-ordering.js.map +0 -1
- package/node/cp-node/get-curve-to-next.d.ts +0 -9
- package/node/cp-node/get-curve-to-next.js +0 -12
- package/node/cp-node/get-curve-to-next.js.map +0 -1
- package/node/cp-node/remove.d.ts +0 -9
- package/node/cp-node/remove.js +0 -20
- package/node/cp-node/remove.js.map +0 -1
- package/node/cp-node/traverse-cp.d.ts +0 -12
- package/node/cp-node/traverse-cp.js.map +0 -1
- package/node/cp-node/traverse-edges.d.ts +0 -10
- package/node/cp-node/traverse-edges.js +0 -23
- package/node/cp-node/traverse-edges.js.map +0 -1
- package/node/cp-node/traverse-vertices.d.ts +0 -12
- package/node/cp-node/traverse-vertices.js +0 -29
- package/node/cp-node/traverse-vertices.js.map +0 -1
- package/node/debug/functions/draw-elem/branch.d.ts +0 -4
- package/node/debug/functions/draw-elem/branch.js +0 -24
- package/node/debug/functions/draw-elem/branch.js.map +0 -1
- package/node/debug/functions/draw-elem/culls.d.ts +0 -4
- package/node/debug/functions/draw-elem/culls.js +0 -22
- package/node/debug/functions/draw-elem/culls.js.map +0 -1
- package/node/debug/functions/draw-elem/dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/leaves.d.ts +0 -4
- package/node/debug/functions/draw-elem/leaves.js +0 -13
- package/node/debug/functions/draw-elem/leaves.js.map +0 -1
- package/node/debug/functions/draw-elem/loop.js.map +0 -1
- package/node/debug/functions/draw-elem/loops.js.map +0 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/mat.d.ts +0 -4
- package/node/debug/functions/draw-elem/mat.js +0 -33
- package/node/debug/functions/draw-elem/mat.js.map +0 -1
- package/node/debug/functions/draw-elem/max-vertex.js.map +0 -1
- package/node/debug/functions/draw-elem/min-y.js.map +0 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/one-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/sharp-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/three-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/three-prong.js +0 -15
- package/node/debug/functions/draw-elem/three-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/two-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/two-prong.js +0 -36
- package/node/debug/functions/draw-elem/two-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/vertex.js +0 -30
- package/node/debug/functions/draw-elem/vertex.js.map +0 -1
- package/node/debug/functions/three-prong.d.ts +0 -11
- package/node/debug/functions/three-prong.js +0 -182
- package/node/debug/functions/three-prong.js.map +0 -1
- package/node/debug/functions/two-prong.d.ts +0 -24
- package/node/debug/functions/two-prong.js +0 -116
- package/node/debug/functions/two-prong.js.map +0 -1
- package/node/debug/three-prong-for-debugging.d.ts +0 -31
- package/node/debug/three-prong-for-debugging.js +0 -21
- package/node/debug/three-prong-for-debugging.js.map +0 -1
- package/node/debug/two-prong-for-debugging.d.ts +0 -26
- package/node/debug/two-prong-for-debugging.js +0 -2
- package/node/debug/two-prong-for-debugging.js.map +0 -1
- package/node/find-2-prong/add-debug-info.d.ts +0 -8
- package/node/find-2-prong/add-debug-info.js +0 -23
- package/node/find-2-prong/add-debug-info.js.map +0 -1
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.d.ts +0 -15
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js +0 -22
- package/node/find-2-prong/find-and-add-2-prongs-on-all-paths.js.map +0 -1
- package/node/find-2-prong/x-for-debugging.d.ts +0 -9
- package/node/find-2-prong/x-for-debugging.js +0 -2
- package/node/find-2-prong/x-for-debugging.js.map +0 -1
- package/node/find-3-prong.ts/add-3-prong.d.ts +0 -24
- package/node/find-3-prong.ts/add-3-prong.js +0 -82
- package/node/find-3-prong.ts/add-3-prong.js.map +0 -1
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.d.ts +0 -13
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js +0 -66
- package/node/find-3-prong.ts/find-and-add-all-3-prongs.js.map +0 -1
- package/node/find-mat/add-debug-info.d.ts +0 -9
- package/node/find-mat/add-debug-info.js +0 -68
- package/node/find-mat/add-debug-info.js.map +0 -1
- package/node/find-mat/create-initial-cp-graph.js.map +0 -1
- package/node/find-mat/fix-ordering.d.ts +0 -8
- package/node/find-mat/fix-ordering.js +0 -59
- package/node/find-mat/fix-ordering.js.map +0 -1
- package/node/find-mat/get-dull-corners.js.map +0 -1
- package/node/find-mat/get-size-params.d.ts +0 -7
- package/node/find-mat/get-size-params.js +0 -33
- package/node/find-mat/get-size-params.js.map +0 -1
- package/node/get-curve/get-curve-between.d.ts +0 -9
- package/node/get-curve/get-curve-between.js.map +0 -1
- package/node/get-curve/get-edge-direction.d.ts +0 -9
- package/node/get-curve/get-edge-direction.js.map +0 -1
- package/node/mat/add-to-cp-graph.js +0 -33
- package/node/mat/add-to-cp-graph.js.map +0 -1
- package/node/mat/bezier-piece.js +0 -2
- package/node/mat/bezier-piece.js.map +0 -1
- package/node/mat/elem-type-two-prong.d.ts +0 -3
- package/node/mat/elem-type-two-prong.js +0 -2
- package/node/mat/elem-type-two-prong.js.map +0 -1
- package/node/mat/get-neighboring-cps.d.ts +0 -16
- package/node/mat/get-neighboring-cps.js +0 -33
- package/node/mat/get-neighboring-cps.js.map +0 -1
- package/node/mat/get-two-prong-type.d.ts +0 -5
- package/node/mat/get-two-prong-type.js +0 -9
- package/node/mat/get-two-prong-type.js.map +0 -1
- package/node/mat/is-another-cp-closeby.d.ts +0 -21
- package/node/mat/is-another-cp-closeby.js.map +0 -1
- package/node/mat/simplify-mat-map-only.d.ts +0 -23
- package/node/mat/simplify-mat-map-only.js +0 -82
- package/node/mat/simplify-mat-map-only.js.map +0 -1
- package/node/point-on-shape/is-pos-dull-corner.d.ts +0 -6
- package/node/point-on-shape/is-pos-dull-corner.js +0 -14
- package/node/point-on-shape/is-pos-dull-corner.js.map +0 -1
- package/src/cp-node/create-cp-node.ts +0 -21
- package/src/cp-node/get-curve-to-next.ts +0 -16
- package/src/cp-node/remove.ts +0 -27
- package/src/cp-node/traverse-edges.ts +0 -29
- package/src/cp-node/traverse-vertices.ts +0 -37
- /package/{test → __tests__}/lib-load.spec.ts +0 -0
- /package/node/debug/functions/draw-elem/{dull-corner.d.ts → draw-dull-corner.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{loop.d.ts → draw-loop.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{loops.d.ts → draw-loops.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{loose-bounding-box.d.ts → draw-loose-bounding-box.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{max-vertex.d.ts → draw-max-vertex.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{min-y.d.ts → draw-min-y.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{one-prong-at-dull-corner.d.ts → draw-one-prong-at-dull-corner.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{one-prong.d.ts → draw-one-prong.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{sharp-corner.d.ts → draw-sharp-corner.d.ts} +0 -0
- /package/node/debug/functions/draw-elem/{tight-bounding-box.d.ts → draw-tight-bounding-box.d.ts} +0 -0
- /package/node/find-mat/{get-dull-corners.d.ts → get-dull-corners-on-loop.d.ts} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { tangent, toPowerBasis_1stDerivative } from "flo-bezier3";
|
|
2
|
+
import { allRoots } from "flo-poly";
|
|
3
|
+
import { CpNode } from "../cp-node/cp-node.js";
|
|
4
|
+
import { createPos } from "../point-on-shape/create-pos.js";
|
|
5
|
+
import { PointOnShape } from "../point-on-shape/point-on-shape.js";
|
|
6
|
+
|
|
7
|
+
const { atan2, abs, sin, cos } = Math;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const MIN_ANGLE = 1/180*Math.PI;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function getHalfAngle(
|
|
14
|
+
cpNodeS: CpNode) {
|
|
15
|
+
|
|
16
|
+
const cpNodeE = cpNodeS.next;
|
|
17
|
+
|
|
18
|
+
// Get half angle
|
|
19
|
+
const { curve: curveS, t: tS } = cpNodeS.cp.pointOnShape;
|
|
20
|
+
const { curve: curveE, t: tE } = cpNodeE.cp.pointOnShape;
|
|
21
|
+
const { ps: psS } = curveS;
|
|
22
|
+
const { ps: psE } = curveE;
|
|
23
|
+
|
|
24
|
+
if (psS === psE && psS.length < 3) {
|
|
25
|
+
return createPos(curveS, (tS + tE)/2);
|
|
26
|
+
// return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const tanS = tangent(psS, tS);
|
|
30
|
+
const tanE = tangent(psE, tE);
|
|
31
|
+
const angleS = atan2(tanS[1], tanS[0]);
|
|
32
|
+
const angleE = atan2(tanE[1], tanE[0]);
|
|
33
|
+
const angle = angleS + angleE;
|
|
34
|
+
|
|
35
|
+
if (abs(angle) <= MIN_ANGLE) {
|
|
36
|
+
return curveS === curveE
|
|
37
|
+
? createPos(curveS, (tS + tE)/2)
|
|
38
|
+
: tS < 1 - tE // start closer to endpoint than end?
|
|
39
|
+
? createPos(curveS, (1 - tS)/2)
|
|
40
|
+
: createPos(curveE, tE/2)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const halfAngle = angle/2;
|
|
44
|
+
const x = cos(halfAngle);
|
|
45
|
+
const y = sin(halfAngle);
|
|
46
|
+
const q = x/y;
|
|
47
|
+
/////////
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
const tE_ = curveS === curveE ? tE : 1;
|
|
51
|
+
const roots = getHalfAngleRoots(psS, tS, tE_, q);
|
|
52
|
+
if (roots.length > 0) {
|
|
53
|
+
return createPos(curveS, roots[0]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
{
|
|
57
|
+
const tS_ = curveS === curveE ? tS : 0;
|
|
58
|
+
const roots = getHalfAngleRoots(psE, tS_, tE, q);
|
|
59
|
+
if (roots.length > 0) {
|
|
60
|
+
return createPos(curveE, roots[0]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
function getHalfAngleRoots(
|
|
69
|
+
ps: number[][],
|
|
70
|
+
tS: number,
|
|
71
|
+
tE: number,
|
|
72
|
+
q: number): number[] {
|
|
73
|
+
|
|
74
|
+
let roots: number[] = [];
|
|
75
|
+
if (ps.length === 3) {
|
|
76
|
+
const pbS = toPowerBasis_1stDerivative(ps);
|
|
77
|
+
const [[a,b],[c,d]] = pbS;
|
|
78
|
+
// Solve: (a - cq)t + b - dq = 0
|
|
79
|
+
roots = [(-b + d*q)/(a - c*q)];
|
|
80
|
+
} else if (ps.length === 4) {
|
|
81
|
+
const pbS = toPowerBasis_1stDerivative(ps);
|
|
82
|
+
const [[a,b,c],[d,e,f]] = pbS;
|
|
83
|
+
// Solve: (a - dq)t^2 + (b - eq)t + c - fq = 0
|
|
84
|
+
const ts = [a - d*q, b - e*q, c - f*q];;
|
|
85
|
+
roots = allRoots(ts)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return roots.filter(r =>
|
|
89
|
+
r > tS &&
|
|
90
|
+
r < tE
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
export { getHalfAngle }
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { getBoundingHull, getBoundingBoxTight } from 'flo-bezier3';
|
|
2
|
+
import { Debug } from '../debug/debug.js';
|
|
3
|
+
import { Loop } from 'flo-boolean';
|
|
4
|
+
import { Curve } from '../curve/curve.js';
|
|
5
|
+
import { getBoundingBox$ } from '../geometry/get-bounding-box-.js';
|
|
6
|
+
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
7
|
+
import { CpNode } from '../cp-node/cp-node.js';
|
|
8
|
+
import { TriMap, TriMapFs } from '../utils/tri-map.js';
|
|
9
|
+
import { MatMeta } from '../mat/mat-meta.js';
|
|
10
|
+
import { getCorner } from '../corner/get-corner.js';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
declare const _debug_: Debug;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
let timingStart: number;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
function getMeta(
|
|
22
|
+
maxCoordinate: number,
|
|
23
|
+
squaredDiagonalLength: number,
|
|
24
|
+
loops: Loop[],
|
|
25
|
+
cpTrees: Map<Loop, LlRbTree<CpNode>>): MatMeta {
|
|
26
|
+
|
|
27
|
+
timingStart = performance.now();
|
|
28
|
+
|
|
29
|
+
const pointToCpNode: TriMap<Loop,number,number,CpNode> = new Map();
|
|
30
|
+
|
|
31
|
+
const looseBoundingBoxes: number[][][] = [];
|
|
32
|
+
const tightBoundingBoxes: number[][][] = [];
|
|
33
|
+
const boundingHulls: number[][][] = [];
|
|
34
|
+
const sharpCorners: Curve[] = [];
|
|
35
|
+
const dullCorners: Curve[] = [];
|
|
36
|
+
|
|
37
|
+
for (const loop of loops) {
|
|
38
|
+
// Populate `posMap`
|
|
39
|
+
const cpTree = cpTrees.get(loop)!;
|
|
40
|
+
const cpNodes = cpTree.toArrayInOrder();
|
|
41
|
+
for (const cpNode of cpNodes) {
|
|
42
|
+
const { p, t } = cpNode.cp.pointOnShape;
|
|
43
|
+
TriMapFs.set(pointToCpNode,loop,p[0],p[1],cpNode);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (let curve of loop.curves) {
|
|
47
|
+
const ps = curve.ps;
|
|
48
|
+
const hull = getBoundingHull(ps, true)!;
|
|
49
|
+
|
|
50
|
+
boundingHulls.push(hull);
|
|
51
|
+
|
|
52
|
+
const looseBoundingBox = getBoundingBox$(ps);
|
|
53
|
+
looseBoundingBoxes.push(looseBoundingBox);
|
|
54
|
+
|
|
55
|
+
const tightBoundingBox = getBoundingBoxTight(ps);
|
|
56
|
+
tightBoundingBoxes.push(tightBoundingBox);
|
|
57
|
+
|
|
58
|
+
const corner = getCorner(curve.ps, curve.next.ps);
|
|
59
|
+
if (corner.isQuiteSharp) {
|
|
60
|
+
sharpCorners.push(curve);
|
|
61
|
+
} else if (corner.isQuiteDull) {
|
|
62
|
+
dullCorners.push(curve);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
maxCoordinate,
|
|
69
|
+
squaredDiagonalLength,
|
|
70
|
+
looseBoundingBoxes,
|
|
71
|
+
tightBoundingBoxes,
|
|
72
|
+
boundingHulls,
|
|
73
|
+
sharpCorners,
|
|
74
|
+
dullCorners,
|
|
75
|
+
loops,
|
|
76
|
+
cpTrees,
|
|
77
|
+
pointToCpNode
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
function addDebugInfo2() {
|
|
84
|
+
if (typeof _debug_ === 'undefined') { return; }
|
|
85
|
+
|
|
86
|
+
const timing = _debug_.generated.timing;
|
|
87
|
+
const now = performance.now();
|
|
88
|
+
timing.holeClosers += now - timingStart;
|
|
89
|
+
timingStart = now;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
function addDebugInfo3() {
|
|
94
|
+
if (typeof _debug_ === 'undefined') { return; }
|
|
95
|
+
|
|
96
|
+
const generated = _debug_.generated;
|
|
97
|
+
const timing = generated.timing;
|
|
98
|
+
const now = performance.now();
|
|
99
|
+
|
|
100
|
+
timing.oneAnd2Prongs += now - timingStart;
|
|
101
|
+
timingStart = now;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
function addDebugInfo4() {
|
|
106
|
+
if (typeof _debug_ === 'undefined') { return; }
|
|
107
|
+
|
|
108
|
+
const generated = _debug_.generated;
|
|
109
|
+
const timing = generated.timing;
|
|
110
|
+
|
|
111
|
+
timing.threeProngs += performance.now() - timingStart;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export { getMeta, addDebugInfo2, addDebugInfo3, addDebugInfo4 }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PointOnShape } from '../point-on-shape/point-on-shape.js';
|
|
2
2
|
import { Loop } from 'flo-boolean';
|
|
3
3
|
import { createPos } from '../point-on-shape/create-pos.js';
|
|
4
|
-
import { getCornerAtEnd } from '../curve/curve.js';
|
|
5
4
|
import { controlPointLinesLength } from 'flo-bezier3';
|
|
5
|
+
import { getCorner } from '../corner/get-corner.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/** @internal */
|
|
@@ -19,11 +19,12 @@ function getSharpCornersOnLoop(
|
|
|
19
19
|
continue;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
if (
|
|
22
|
+
if (getCorner(curve.ps, curve.next.ps).isQuiteSharp) {
|
|
23
23
|
sharpCorners.push(createPos(curve, 1, true));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// console.log(sharpCorners)
|
|
27
28
|
return sharpCorners;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Loop } from 'flo-boolean';
|
|
2
|
+
import type { Curve } from '../curve/curve.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
* Helper function.
|
|
8
8
|
* @internal
|
|
9
|
-
* @param
|
|
9
|
+
* @param totalByF
|
|
10
10
|
*/
|
|
11
|
-
function getTotalBy(
|
|
11
|
+
function getTotalBy(totalByF: (curve: Curve) => number) {
|
|
12
12
|
|
|
13
13
|
return function(loop: Loop) {
|
|
14
14
|
let node = loop.curves[0];
|
|
15
15
|
let total = 0;
|
|
16
16
|
do {
|
|
17
|
-
total +=
|
|
17
|
+
total += totalByF(node);
|
|
18
18
|
|
|
19
19
|
node = node.next;
|
|
20
20
|
} while (node !== loop.curves[0]);
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
|
|
2
|
+
interface MatOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The maximum value the 'curviness' of a curve can have
|
|
5
|
+
* before an additional MAT point is inserted in between.
|
|
6
|
+
* (Curviness is measured as the total angle in radians between the consecutive
|
|
7
|
+
* vectors formed by the ordered control points of th bezier curve).
|
|
8
|
+
*
|
|
9
|
+
* * Defaults to `0.05`.
|
|
10
|
+
* * The value is clipped in the range `[0.01,3]`.
|
|
11
|
+
*/
|
|
12
|
+
maxCurviness?: number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The maximum length a curve can have before an additional MAT
|
|
16
|
+
* point is inserted. This value is scaled to a reference 1024 x 1024
|
|
17
|
+
* grid (e.g. if the shape fits in a 512 x 512 axis-aligned box the value will be
|
|
18
|
+
* halved, e.g. from 10 to 5). Together with maxCurviness it represents a
|
|
19
|
+
* tolerance for the accuracy of the MAT.
|
|
20
|
+
*
|
|
21
|
+
* * Defaults to `40`.
|
|
22
|
+
* * The value is clipped in `[1,1024]`.
|
|
23
|
+
*/
|
|
24
|
+
maxLength?: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* If `true` then `toScaleAxis` will be applied to the MAT (and before
|
|
28
|
+
* inserting phatoms) that could dramatically simplify the MAT skeleton.
|
|
29
|
+
*
|
|
30
|
+
* * Defaults to `true`
|
|
31
|
+
*/
|
|
32
|
+
applySat?: boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The higher this value, the more aggresively the
|
|
36
|
+
* Scale Axis is applied.
|
|
37
|
+
*
|
|
38
|
+
* * Only applies if `applySat` is `true`
|
|
39
|
+
* * Defaults to 2
|
|
40
|
+
* * The value is clipped in `[1,Number.POSITIVE_INFINITY]`
|
|
41
|
+
* * Should be larger than one to have an effect
|
|
42
|
+
*/
|
|
43
|
+
satScale?: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* If `true` then the `simplyfiMats` will be applied which will replace
|
|
47
|
+
* multiple MAT curves with a single one to within a specified tolerance
|
|
48
|
+
* determined by the Hausdorff distance between curves and can dramatically
|
|
49
|
+
* reduce the number of MAT curves and 2-prongs.
|
|
50
|
+
*
|
|
51
|
+
* * Defaults to `true`
|
|
52
|
+
*/
|
|
53
|
+
simplify?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The tolerance, given as the Hausdorff distance between curves, to
|
|
57
|
+
* determine the accuracy of the simplification. The higher this value the
|
|
58
|
+
* more simplification will be applied but the less accurate the result.
|
|
59
|
+
*
|
|
60
|
+
* * Only applies if `simplify` is `true`
|
|
61
|
+
* * Defaults to `1/16`
|
|
62
|
+
* * The value is clipped in `[2**-10,1024]`
|
|
63
|
+
* * scaled to a 1024x1024 vector image size, i.e. a value of `1` on such
|
|
64
|
+
* a vector image will have a `1` pixel accuracy. If the vector is, say,
|
|
65
|
+
* 512x400 then the accuracy is scaled to `1/2` a pixel. This ensures
|
|
66
|
+
* scale invariance on the accuracy.
|
|
67
|
+
*/
|
|
68
|
+
simplifyTolerance?: number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Minimum bezier length before no `CpNode` will attach to it.
|
|
72
|
+
*
|
|
73
|
+
* * it is not recommended to change this value
|
|
74
|
+
* * scaled to a 1024x1024 vector image size
|
|
75
|
+
* * Defaults to `1/16`
|
|
76
|
+
*/
|
|
77
|
+
minBezLength?: number;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Angle (in degrees) increments around sharp obtuse corners. The lower the
|
|
81
|
+
* angle, the better the accuracy.
|
|
82
|
+
*
|
|
83
|
+
* * Defaults to `15`
|
|
84
|
+
*/
|
|
85
|
+
angleIncrement?: number;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* If `true` then 2-prongs will be inserted apatively according to the
|
|
89
|
+
* error between the MAT implied boundary curve and the actual curve
|
|
90
|
+
*/
|
|
91
|
+
// adaptiveTolerance?: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const defaultMatOptions: Required<MatOptions> = {
|
|
96
|
+
maxCurviness: 0.05,
|
|
97
|
+
maxLength: 40,
|
|
98
|
+
applySat: true,
|
|
99
|
+
satScale: 2,
|
|
100
|
+
simplify: true,
|
|
101
|
+
simplifyTolerance: 2**-4,
|
|
102
|
+
minBezLength: 2**-6,
|
|
103
|
+
angleIncrement: 15
|
|
104
|
+
// adaptiveTolerance: true,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
type MatOptionMeta = {
|
|
109
|
+
range: [number,number],
|
|
110
|
+
scaleByMaxCoordinate?: boolean | undefined,
|
|
111
|
+
scaleByMaxRadius?: boolean | undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
const matOptionRanges: Partial<{ [K in keyof MatOptions]: MatOptionMeta }> = {
|
|
116
|
+
maxCurviness: {
|
|
117
|
+
range: [0.01,3]
|
|
118
|
+
},
|
|
119
|
+
maxLength: {
|
|
120
|
+
range: [1,1024],
|
|
121
|
+
scaleByMaxRadius: true
|
|
122
|
+
},
|
|
123
|
+
angleIncrement: {
|
|
124
|
+
range: [0.1, 360]
|
|
125
|
+
},
|
|
126
|
+
satScale: {
|
|
127
|
+
range: [1, Number.POSITIVE_INFINITY],
|
|
128
|
+
},
|
|
129
|
+
simplifyTolerance: {
|
|
130
|
+
range: [2**-10,1024],
|
|
131
|
+
scaleByMaxCoordinate: true
|
|
132
|
+
},
|
|
133
|
+
minBezLength: {
|
|
134
|
+
range: [2**-20,2],
|
|
135
|
+
scaleByMaxCoordinate: true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
export { MatOptions, MatOptionMeta, defaultMatOptions, matOptionRanges }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// A JavaScript program for Floyd Warshall All Pairs Shortest Path algorithm.
|
|
2
|
+
// From https://www.geeksforgeeks.org/floyd-warshall-algorithm-dp-16/
|
|
3
|
+
// This code is contributed by rdtaank.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns a matrix of all distances between all nodes (O(n**3))
|
|
8
|
+
*
|
|
9
|
+
* @param graph
|
|
10
|
+
*/
|
|
11
|
+
function floydWarshall(graph: number[][]) {
|
|
12
|
+
const V = graph.length;
|
|
13
|
+
const dist: number[][] = Array.from(
|
|
14
|
+
Array(V),
|
|
15
|
+
() => new Array(V).fill(0)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// Initialize the solution matrix same as input graph matrix Or we can
|
|
20
|
+
// say the initial values of shortest distances are based on shortest
|
|
21
|
+
// paths considering no intermediate vertex
|
|
22
|
+
for (let i=0; i<V; i++) {
|
|
23
|
+
for (let j=0; j<V; j++) {
|
|
24
|
+
dist[i][j] = graph[i][j];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// Add all vertices one by one to the set of intermediate vertices.
|
|
30
|
+
// ---> Before start of a iteration, we have shortest distances
|
|
31
|
+
// between all pairs of vertices such that the shortest distances
|
|
32
|
+
// consider only the vertices in set {0, 1, 2, .. k-1} as
|
|
33
|
+
// intermediate vertices.
|
|
34
|
+
// ---> After the end of a iteration, vertex no. k is added to the set
|
|
35
|
+
// of intermediate vertices and the set becomes {0, 1, 2, .. k}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
for (let k=0; k<V; k++) {
|
|
39
|
+
// Pick all vertices as source one by one
|
|
40
|
+
for (let i=0; i<V; i++) {
|
|
41
|
+
// Pick all vertices as destination for the above picked source
|
|
42
|
+
for (let j=0; j<V; j++) {
|
|
43
|
+
// If vertex k is on the shortest path from i to j, then update
|
|
44
|
+
// the value of dist[i][j]
|
|
45
|
+
if (dist[i][k] + dist[k][j] < dist[i][j]) {
|
|
46
|
+
dist[i][j] = dist[i][k] + dist[k][j];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return dist;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export { floydWarshall }
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// floydWarshall(graph)
|
|
60
|
+
|
|
61
|
+
// TESTING
|
|
62
|
+
|
|
63
|
+
// Let us create the following weighted graph
|
|
64
|
+
//
|
|
65
|
+
// 10
|
|
66
|
+
// (0)--------->(3)
|
|
67
|
+
// | /|\
|
|
68
|
+
// 5 | |
|
|
69
|
+
// | | 1
|
|
70
|
+
// \|/ |
|
|
71
|
+
// (1)--------->(2)
|
|
72
|
+
// 3
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// const INF = Number.POSITIVE_INFINITY;
|
|
76
|
+
// const graph = [
|
|
77
|
+
// [0, 5, INF, 10],
|
|
78
|
+
// [INF, 0, 3, INF],
|
|
79
|
+
// [INF, INF, 0, 1],
|
|
80
|
+
// [INF, INF, INF, 0],
|
|
81
|
+
// ];
|
|
82
|
+
|
|
83
|
+
// 0 5 8 9
|
|
84
|
+
// INF 0 3 4
|
|
85
|
+
// INF INF 0 1
|
|
86
|
+
// INF INF INF 0
|
|
87
|
+
|
|
88
|
+
// floydWarshall(graph);//?
|
|
89
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CpNode } from "../cp-node/cp-node.js";
|
|
2
|
+
import { getAllOnCircle } from "../cp-node/fs/get-all-on-circle.js";
|
|
3
|
+
import { getMatDistanceToNext$ } from "../cp-node/fs/get-distance-to-next.js";
|
|
4
|
+
import { isOnSameCircle } from "../cp-node/fs/is-on-same-circle.js";
|
|
5
|
+
import { isVertexSpecial } from "../cp-node/fs/is-vertex-special.js";
|
|
6
|
+
import { getHoleCloserPairs } from "./get-hole-closer-pairs.js";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function getGraph(
|
|
10
|
+
specialVertices: CpNode[],
|
|
11
|
+
holeClosers: CpNode[]) {
|
|
12
|
+
|
|
13
|
+
const pairs = getHoleCloserPairs(holeClosers);
|
|
14
|
+
|
|
15
|
+
const V = specialVertices.length;
|
|
16
|
+
|
|
17
|
+
const graph: number[][] = [];
|
|
18
|
+
for (let i=0; i<V; i++) {
|
|
19
|
+
const cpNodeA = specialVertices[i];
|
|
20
|
+
|
|
21
|
+
const row: number[] = [];
|
|
22
|
+
for (let j=0; j<V; j++) {
|
|
23
|
+
const cpNodeB = specialVertices[j];
|
|
24
|
+
if (i === j) {
|
|
25
|
+
row.push(0);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let minD = Number.POSITIVE_INFINITY;
|
|
30
|
+
for (const toChild of getAllOnCircle(cpNodeA)) {
|
|
31
|
+
let d = getMatDistanceToNext$(toChild);
|
|
32
|
+
let child = toChild.next;
|
|
33
|
+
while (true) {
|
|
34
|
+
if (isOnSameCircle(child, cpNodeB)) {
|
|
35
|
+
break; // Found path from A to B
|
|
36
|
+
}
|
|
37
|
+
if (child.isHoleClosing) {
|
|
38
|
+
// Hole closer found - don't go around loop
|
|
39
|
+
child = holeCloserNext(pairs, child);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (isVertexSpecial(child)) {
|
|
43
|
+
// we only find the immediate next special ones
|
|
44
|
+
d = Number.POSITIVE_INFINITY;
|
|
45
|
+
break; // Next special vertex found but it's not B
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
d += getMatDistanceToNext$(child);
|
|
49
|
+
child = child.next;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (d < minD) { minD = d; }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
row.push(minD);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
graph.push(row);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return graph;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function holeCloserNext(
|
|
66
|
+
pairs: Map<CpNode,CpNode>,
|
|
67
|
+
holeCloser: CpNode) {
|
|
68
|
+
|
|
69
|
+
return pairs.get(holeCloser)!.next;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
export { getGraph }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CpNode } from "../cp-node/cp-node.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function getHoleCloserPairs(
|
|
5
|
+
holeClosers: CpNode[]): Map<CpNode,CpNode> {
|
|
6
|
+
|
|
7
|
+
const pairs: Map<CpNode,CpNode> = new Map();
|
|
8
|
+
for (let hcA of holeClosers) {
|
|
9
|
+
for (let hcB of holeClosers) {
|
|
10
|
+
const cA = hcA.cp.circle.center;
|
|
11
|
+
const cB = hcB.cp.circle.center;
|
|
12
|
+
const cpA = hcA.cp.pointOnShape.p;
|
|
13
|
+
const cpB = hcB.cp.pointOnShape.p;
|
|
14
|
+
if (hcB !== hcA &&
|
|
15
|
+
cA[0] === cB[0] && cA[1] === cB[1] &&
|
|
16
|
+
cpA[0] === cpB[0] && cpA[1] === cpB[1]) {
|
|
17
|
+
|
|
18
|
+
pairs.set(hcA,hcB);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return pairs;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export { getHoleCloserPairs }
|
package/src/heap/heap.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* see [Wikipedia](https://en.wikipedia.org/wiki/Heap_(data_structure))
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
class Heap<T> {
|
|
8
|
+
public heap: T[] = [];
|
|
9
|
+
|
|
10
|
+
constructor(private compare: (a: T, b: T) => number) {}
|
|
11
|
+
|
|
12
|
+
public isEmpty() {
|
|
13
|
+
return this.heap.length === 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public insert(t: T): void {
|
|
17
|
+
const heap = this.heap;
|
|
18
|
+
|
|
19
|
+
heap.push(t);
|
|
20
|
+
|
|
21
|
+
// Swim up
|
|
22
|
+
let i = heap.length-1;
|
|
23
|
+
while (true) {
|
|
24
|
+
const parentIdx = (i - 1 - (i+1)%2)/2;
|
|
25
|
+
if (parentIdx === -1) { return; }
|
|
26
|
+
|
|
27
|
+
const parent = heap[parentIdx];
|
|
28
|
+
if (this.compare(t, parent) < 0) {
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Swap and update indexes and variables
|
|
33
|
+
heap[parentIdx] = t;
|
|
34
|
+
heap[i] = parent;
|
|
35
|
+
i = parentIdx;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
public popMax(): T {
|
|
41
|
+
const heap = this.heap;
|
|
42
|
+
const maxT = heap[0];
|
|
43
|
+
heap[0] = heap[heap.length - 1];
|
|
44
|
+
heap.length--;
|
|
45
|
+
this.swimDown();
|
|
46
|
+
|
|
47
|
+
return maxT;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
private swimDown() {
|
|
52
|
+
const heap = this.heap;
|
|
53
|
+
|
|
54
|
+
const len = heap.length;
|
|
55
|
+
|
|
56
|
+
let i = 0;
|
|
57
|
+
// Swim down
|
|
58
|
+
while (true) {
|
|
59
|
+
const leftIdx = 2*i + 1;
|
|
60
|
+
if (leftIdx >= len) {
|
|
61
|
+
break; // there's no left or right child
|
|
62
|
+
}
|
|
63
|
+
const rightIdx = 2*i + 2;
|
|
64
|
+
|
|
65
|
+
const swapIdx = (rightIdx >= len) || (this.compare(heap[leftIdx], heap[rightIdx]) > 0)
|
|
66
|
+
? leftIdx
|
|
67
|
+
: rightIdx;
|
|
68
|
+
|
|
69
|
+
const swapChild = heap[swapIdx];
|
|
70
|
+
|
|
71
|
+
const parent = heap[i];
|
|
72
|
+
if (this.compare(parent, swapChild) > 0) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Swap and update indexes
|
|
77
|
+
heap[swapIdx] = parent;
|
|
78
|
+
heap[i] = swapChild;
|
|
79
|
+
i = swapIdx;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
public swapMinOrMax(t: T): void {
|
|
85
|
+
this.heap[0] = t;
|
|
86
|
+
this.swimDown();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ignore coverage */
|
|
90
|
+
public static getParentIdx(i: number) { return (i - 1 - (i+1)%2)/2; }
|
|
91
|
+
public static getLeftChild(i: number) { return 2*i + 1; }
|
|
92
|
+
public static getRightChild(i: number) { return 2*i + 2; }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
export { Heap }
|