flo-mat 2.0.0 → 2.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/.eslintrc.cjs +69 -0
- package/README.md +9 -27
- package/browser/index.js +29720 -7345
- package/browser/index.min.js +1 -2
- package/node/circle.js +3 -3
- package/node/circle.js.map +1 -1
- package/node/compare-curvatures-at-interface.js +36 -36
- package/node/compare-curvatures-at-interface.js.map +1 -1
- package/node/cp-node/clone.js +6 -6
- package/node/cp-node/clone.js.map +1 -1
- package/node/cp-node/remove.js +4 -4
- package/node/cp-node/remove.js.map +1 -1
- package/node/cp-node.js +18 -18
- package/node/cp-node.js.map +1 -1
- package/node/curve.d.ts +1 -1
- package/node/curve.js +19 -19
- package/node/curve.js.map +1 -1
- package/node/debug/debug.d.ts +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.js +1 -1
- package/node/debug/functions/draw-elem/bounding-hull.js.map +1 -1
- package/node/debug/functions/draw-elem/branch.js +4 -4
- package/node/debug/functions/draw-elem/branch.js.map +1 -1
- package/node/debug/functions/draw-elem/culls.js +4 -4
- package/node/debug/functions/draw-elem/culls.js.map +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 +2 -2
- package/node/debug/functions/draw-elem/draw-elem.js +1 -1
- package/node/debug/functions/draw-elem/draw-elem.js.map +1 -1
- package/node/debug/functions/draw-elem/dull-corner.js +3 -3
- package/node/debug/functions/draw-elem/dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/leaves.js +4 -4
- package/node/debug/functions/draw-elem/leaves.js.map +1 -1
- package/node/debug/functions/draw-elem/loose-bounding-box.js +2 -2
- package/node/debug/functions/draw-elem/loose-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/mat.js +4 -4
- package/node/debug/functions/draw-elem/mat.js.map +1 -1
- package/node/debug/functions/draw-elem/max-vertex.js +2 -2
- package/node/debug/functions/draw-elem/max-vertex.js.map +1 -1
- package/node/debug/functions/draw-elem/min-y.js +3 -3
- package/node/debug/functions/draw-elem/min-y.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js +4 -4
- package/node/debug/functions/draw-elem/one-prong-at-dull-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/one-prong.js +4 -4
- package/node/debug/functions/draw-elem/one-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/sharp-corner.js +2 -2
- package/node/debug/functions/draw-elem/sharp-corner.js.map +1 -1
- package/node/debug/functions/draw-elem/three-prong.js +7 -7
- package/node/debug/functions/draw-elem/three-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.js +1 -1
- package/node/debug/functions/draw-elem/tight-bounding-box.js.map +1 -1
- package/node/debug/functions/draw-elem/two-prong.js +1 -1
- package/node/debug/functions/draw-elem/two-prong.js.map +1 -1
- package/node/debug/functions/draw-elem/vertex.js +13 -13
- package/node/debug/functions/draw-elem/vertex.js.map +1 -1
- package/node/debug/functions/general.d.ts +1 -1
- package/node/debug/functions/general.js +1 -1
- package/node/debug/functions/general.js.map +1 -1
- package/node/debug/functions/three-prong.d.ts +1 -1
- package/node/debug/functions/three-prong.js +37 -37
- package/node/debug/functions/three-prong.js.map +1 -1
- package/node/debug/functions/two-prong.d.ts +1 -1
- package/node/debug/functions/two-prong.js +15 -15
- package/node/debug/functions/two-prong.js.map +1 -1
- package/node/find-mats.js +16 -19
- package/node/find-mats.js.map +1 -1
- package/node/get-boundary-bezier-parts-to-next.js +8 -8
- package/node/get-boundary-bezier-parts-to-next.js.map +1 -1
- package/node/get-boundary-beziers-to-next.js +8 -8
- package/node/get-boundary-beziers-to-next.js.map +1 -1
- package/node/get-branches.js +7 -7
- package/node/get-branches.js.map +1 -1
- package/node/get-curve/get-curve-between.js +21 -21
- package/node/get-curve/get-curve-between.js.map +1 -1
- package/node/get-curve/get-edge-direction.js +13 -13
- package/node/get-curve/get-edge-direction.js.map +1 -1
- package/node/get-interface-ccw.js +12 -12
- package/node/get-interface-ccw.js.map +1 -1
- package/node/loop/get-max-coordinate.js +9 -9
- package/node/loop/get-max-coordinate.js.map +1 -1
- package/node/loop.js +4 -4
- package/node/loop.js.map +1 -1
- package/node/mat/add-to-cp-graph.js +8 -8
- package/node/mat/add-to-cp-graph.js.map +1 -1
- package/node/mat/closest-boundary-point/closest-points-on-curve.js +5 -6
- package/node/mat/closest-boundary-point/closest-points-on-curve.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js +1 -1
- package/node/mat/closest-boundary-point/cull-bezier-pieces.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js +5 -5
- package/node/mat/closest-boundary-point/cull-by-loose-bounding-box.js.map +1 -1
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js +5 -5
- package/node/mat/closest-boundary-point/cull-by-tight-boundary-box.js.map +1 -1
- package/node/mat/closest-boundary-point/get-best-distance-squared.js +5 -5
- package/node/mat/closest-boundary-point/get-best-distance-squared.js.map +1 -1
- package/node/mat/closest-boundary-point/get-close-boundary-points.js +15 -15
- package/node/mat/closest-boundary-point/get-close-boundary-points.js.map +1 -1
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js +4 -4
- package/node/mat/closest-boundary-point/get-closest-boundary-point.js.map +1 -1
- package/node/mat/create-new-cp-tree.js +3 -3
- 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/find-mat/add-1-prong.js +3 -3
- package/node/mat/find-mat/add-1-prong.js.map +1 -1
- package/node/mat/find-mat/add-2-prong.js +40 -40
- package/node/mat/find-mat/add-2-prong.js.map +1 -1
- package/node/mat/find-mat/add-3-prong.js +1 -1
- package/node/mat/find-mat/add-3-prong.js.map +1 -1
- package/node/mat/find-mat/add-debug-info.js +16 -18
- package/node/mat/find-mat/add-debug-info.js.map +1 -1
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js +4 -4
- package/node/mat/find-mat/create-get-interesting-points-on-loop.js.map +1 -1
- package/node/mat/find-mat/create-initial-cp-graph.js +11 -11
- package/node/mat/find-mat/create-initial-cp-graph.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/add-debug-info.js +2 -2
- package/node/mat/find-mat/find-2-prong/add-debug-info.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js +5 -5
- package/node/mat/find-mat/find-2-prong/cull-bezier-pieces.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/find-2-prong.js +25 -25
- package/node/mat/find-mat/find-2-prong/find-2-prong.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js +7 -7
- package/node/mat/find-mat/find-2-prong/find-equidistant-point-on-line.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js +4 -4
- package/node/mat/find-mat/find-2-prong/get-initial-bezier-pieces.js.map +1 -1
- package/node/mat/find-mat/find-2-prong/x-for-debugging.d.ts +1 -1
- package/node/mat/find-mat/find-3-prong/calc-better-x.js +4 -4
- package/node/mat/find-mat/find-3-prong/calc-better-x.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js +3 -3
- package/node/mat/find-mat/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js +35 -35
- package/node/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/find-3-prong.js +14 -14
- package/node/mat/find-mat/find-3-prong/find-3-prong.js.map +1 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.js +1 -1
- package/node/mat/find-mat/find-3-prong/get-closest-points.js.map +1 -1
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js +2 -2
- package/node/mat/find-mat/find-and-add-2-prongs-on-all-paths.js.map +1 -1
- package/node/mat/find-mat/find-and-add-2-prongs.js +12 -13
- package/node/mat/find-mat/find-and-add-2-prongs.js.map +1 -1
- package/node/mat/find-mat/find-and-add-3-prongs.js +16 -17
- package/node/mat/find-mat/find-and-add-3-prongs.js.map +1 -1
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js +6 -6
- package/node/mat/find-mat/find-and-add-hole-closing-2-prongs.js.map +1 -1
- package/node/mat/find-mat/get-potential-2-prongs.js +4 -4
- package/node/mat/find-mat/get-potential-2-prongs.js.map +1 -1
- package/node/mat/find-mat/get-sharp-corners.js +4 -4
- package/node/mat/find-mat/get-sharp-corners.js.map +1 -1
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js +3 -3
- package/node/mat/geometry/get-closest-squared-distance-to-rotated-rect.js.map +1 -1
- package/node/mat/get-boundary-piece-beziers.js +5 -5
- package/node/mat/get-boundary-piece-beziers.js.map +1 -1
- package/node/mat/get-contact-circles-at-interface.js +1 -1
- package/node/mat/get-contact-circles-at-interface.js.map +1 -1
- package/node/mat/get-leaves.js +2 -2
- package/node/mat/get-leaves.js.map +1 -1
- package/node/mat/get-neighboring-cps.js +1 -1
- package/node/mat/get-neighboring-cps.js.map +1 -1
- package/node/mat/is-another-cp-closeby.js +9 -9
- package/node/mat/is-another-cp-closeby.js.map +1 -1
- package/node/mat/simplify-mat-map-only.js +15 -15
- package/node/mat/simplify-mat-map-only.js.map +1 -1
- package/node/mat/to-scale-axis/add-debug-info.js +1 -1
- package/node/mat/to-scale-axis/add-debug-info.js.map +1 -1
- package/node/mat/to-scale-axis/cull-non-cycles.js +5 -5
- package/node/mat/to-scale-axis/cull-non-cycles.js.map +1 -1
- package/node/mat/to-scale-axis/cull.js +5 -5
- package/node/mat/to-scale-axis/cull.js.map +1 -1
- package/node/mat/trim-mat.js +1 -1
- package/node/mat/trim-mat.js.map +1 -1
- package/node/point-on-shape.d.ts +4 -4
- package/node/point-on-shape.js +16 -16
- package/node/point-on-shape.js.map +1 -1
- package/node/simplify-mat.js +10 -10
- package/node/simplify-mat.js.map +1 -1
- package/node/svg/get-loop-bounds.d.ts +1 -1
- package/node/svg/get-loop-bounds.js +13 -13
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/svg/get-shape-bounds.d.ts +2 -2
- package/node/svg/get-shape-bounds.js +4 -4
- package/node/svg/get-shape-bounds.js.map +1 -1
- package/node/sweep-line/sweep-line.js +8 -8
- package/node/sweep-line/sweep-line.js.map +1 -1
- package/node/to-scale-axis.js +16 -15
- package/node/to-scale-axis.js.map +1 -1
- package/node/traverse-edges.js +2 -2
- package/node/traverse-edges.js.map +1 -1
- package/node/traverse-vertices.js +2 -2
- package/node/traverse-vertices.js.map +1 -1
- package/package.json +30 -25
- package/src/circle.ts +3 -3
- package/src/compare-curvatures-at-interface.ts +36 -36
- package/src/cp-node/clone.ts +6 -6
- package/src/cp-node/remove.ts +4 -4
- package/src/cp-node.ts +20 -20
- package/src/curve.ts +19 -19
- package/src/debug/functions/draw-elem/bounding-hull.ts +2 -2
- package/src/debug/functions/draw-elem/branch.ts +4 -4
- package/src/debug/functions/draw-elem/culls.ts +4 -4
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +2 -2
- package/src/debug/functions/draw-elem/draw-elem.ts +1 -1
- package/src/debug/functions/draw-elem/dull-corner.ts +3 -3
- package/src/debug/functions/draw-elem/leaves.ts +4 -4
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +2 -2
- package/src/debug/functions/draw-elem/mat.ts +4 -4
- package/src/debug/functions/draw-elem/max-vertex.ts +2 -2
- package/src/debug/functions/draw-elem/min-y.ts +3 -3
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +4 -4
- package/src/debug/functions/draw-elem/one-prong.ts +4 -4
- package/src/debug/functions/draw-elem/sharp-corner.ts +2 -2
- package/src/debug/functions/draw-elem/three-prong.ts +7 -7
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +1 -1
- package/src/debug/functions/draw-elem/two-prong.ts +1 -1
- package/src/debug/functions/draw-elem/vertex.ts +20 -14
- package/src/debug/functions/general.ts +3 -3
- package/src/debug/functions/three-prong.ts +37 -37
- package/src/debug/functions/two-prong.ts +15 -15
- package/src/find-mats.ts +19 -19
- package/src/get-boundary-bezier-parts-to-next.ts +8 -8
- package/src/get-boundary-beziers-to-next.ts +8 -8
- package/src/get-branches.ts +7 -7
- package/src/get-curve/get-curve-between.ts +21 -21
- package/src/get-curve/get-edge-direction.ts +13 -14
- package/src/get-interface-ccw.ts +12 -12
- package/src/loop/get-max-coordinate.ts +7 -7
- package/src/loop.ts +4 -4
- package/src/mat/add-to-cp-graph.ts +8 -8
- package/src/mat/closest-boundary-point/closest-points-on-curve.ts +5 -6
- package/src/mat/closest-boundary-point/cull-bezier-pieces.ts +1 -1
- package/src/mat/closest-boundary-point/cull-by-loose-bounding-box.ts +5 -5
- package/src/mat/closest-boundary-point/cull-by-tight-boundary-box.ts +5 -5
- package/src/mat/closest-boundary-point/get-best-distance-squared.ts +5 -5
- package/src/mat/closest-boundary-point/get-close-boundary-points.ts +15 -15
- package/src/mat/closest-boundary-point/get-closest-boundary-point.ts +4 -4
- package/src/mat/cmp-cp-on-delta.ts +5 -5
- package/src/mat/create-new-cp-tree.ts +3 -3
- package/src/mat/find-mat/add-1-prong.ts +5 -5
- package/src/mat/find-mat/add-2-prong.ts +42 -42
- package/src/mat/find-mat/add-3-prong.ts +1 -1
- package/src/mat/find-mat/add-debug-info.ts +18 -20
- package/src/mat/find-mat/create-get-interesting-points-on-loop.ts +4 -4
- package/src/mat/find-mat/create-initial-cp-graph.ts +11 -11
- package/src/mat/find-mat/find-2-prong/add-debug-info.ts +4 -4
- package/src/mat/find-mat/find-2-prong/cull-bezier-pieces.ts +5 -5
- package/src/mat/find-mat/find-2-prong/find-2-prong.ts +27 -27
- package/src/mat/find-mat/find-2-prong/find-equidistant-point-on-line.ts +7 -7
- package/src/mat/find-mat/find-2-prong/get-initial-bezier-pieces.ts +4 -4
- package/src/mat/find-mat/find-3-prong/calc-better-x.ts +4 -4
- package/src/mat/find-mat/find-3-prong/calc-initial-3-prong-center.ts +3 -3
- package/src/mat/find-mat/find-3-prong/find-3-prong-for-delta3s.ts +37 -37
- package/src/mat/find-mat/find-3-prong/find-3-prong.ts +16 -16
- package/src/mat/find-mat/find-3-prong/get-closest-points.ts +1 -1
- package/src/mat/find-mat/find-and-add-2-prongs-on-all-paths.ts +2 -2
- package/src/mat/find-mat/find-and-add-2-prongs.ts +14 -16
- package/src/mat/find-mat/find-and-add-3-prongs.ts +19 -19
- package/src/mat/find-mat/find-and-add-hole-closing-2-prongs.ts +6 -6
- package/src/mat/find-mat/get-potential-2-prongs.ts +4 -4
- package/src/mat/find-mat/get-sharp-corners.ts +4 -4
- package/src/mat/find-mat/get-total-abs-curvature.ts +1 -1
- package/src/mat/geometry/get-closest-squared-distance-to-rotated-rect.ts +3 -3
- package/src/mat/get-boundary-piece-beziers.ts +5 -5
- package/src/mat/get-contact-circles-at-interface.ts +1 -1
- package/src/mat/get-edges-as-array.ts +2 -2
- package/src/mat/get-leaves.ts +2 -2
- package/src/mat/get-neighboring-cps.ts +1 -1
- package/src/mat/is-another-cp-closeby.ts +9 -9
- package/src/mat/simplify-mat-map-only.ts +15 -15
- package/src/mat/to-scale-axis/add-debug-info.ts +6 -3
- package/src/mat/to-scale-axis/add-to-tree.ts +10 -10
- package/src/mat/to-scale-axis/calc-groups.ts +19 -19
- package/src/mat/to-scale-axis/create-spacial-tree.ts +4 -4
- package/src/mat/to-scale-axis/cull-non-cycles.ts +5 -5
- package/src/mat/to-scale-axis/cull.ts +5 -5
- package/src/mat/to-scale-axis/get-engulfed-vertices.ts +18 -18
- package/src/mat/trim-mat.ts +1 -1
- package/src/point-on-shape.ts +16 -16
- package/src/simplify-mat.ts +10 -10
- package/src/svg/get-curvature-at-interface.ts +6 -8
- package/src/svg/get-extreme.ts +1 -1
- package/src/svg/get-loop-bounds.ts +13 -13
- package/src/svg/get-shape-bounds.ts +4 -4
- package/src/sweep-line/are-boxes-intersecting.ts +4 -4
- package/src/sweep-line/sweep-line.ts +8 -8
- package/src/to-scale-axis.ts +18 -17
- package/src/traverse-edges.ts +2 -2
- package/src/traverse-vertices.ts +2 -2
- package/webpack.config.cjs +12 -63
- package/browser/index.min.js.LICENSE.txt +0 -2907
- package/browser/index.module.js +0 -7369
- package/browser/index.module.min.js +0 -2
- package/browser/index.module.min.js.LICENSE.txt +0 -2907
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-vertices.js","sourceRoot":"","sources":["../src/traverse-vertices.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACvB,MAAc,EACd,CAA2B;IAE5B,CAAC,CAAC,MAAM,CAAC,CAAC;IAEV,wEAAwE;IACxE,iBAAiB;IACjB,MAAM,CAAC,kBAAkB,EAAE;SACzB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;SACzC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC1B,OAAO,CAAC,EAAE,CAAC,CAAC;IAEd,SAAS,EAAE,CAAC,MAAc;QACzB,
|
|
1
|
+
{"version":3,"file":"traverse-vertices.js","sourceRoot":"","sources":["../src/traverse-vertices.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACvB,MAAc,EACd,CAA2B;IAE5B,CAAC,CAAC,MAAM,CAAC,CAAC;IAEV,wEAAwE;IACxE,iBAAiB;IACjB,MAAM,CAAC,kBAAkB,EAAE;SACzB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;SACzC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;SAC1B,OAAO,CAAC,EAAE,CAAC,CAAC;IAEd,SAAS,EAAE,CAAC,MAAc;QACzB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC,MAAM,EAAE;YAClB,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;YACrB,CAAC,CAAC,EAAE,CAAC,CAAC;YACN,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC;SAC/B;IACF,CAAC;AACF,CAAC;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flo-mat",
|
|
3
|
+
"sideEffects": false,
|
|
3
4
|
"description": "Medial / Scale Axis Transform (MAT/SAT) Library.",
|
|
4
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.2",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "Floris Steenkamp"
|
|
7
8
|
},
|
|
@@ -30,33 +31,37 @@
|
|
|
30
31
|
"skeleton"
|
|
31
32
|
],
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"big-float-ts": "^3.0.
|
|
34
|
-
"double-double": "^2.0.
|
|
35
|
-
"flo-bezier3": "^4.
|
|
36
|
-
"flo-boolean": "^2.
|
|
37
|
-
"flo-draw": "^2.0.
|
|
38
|
-
"flo-gauss-quadrature": "^2.1.
|
|
39
|
-
"flo-ll-rb-tree": "^0.3.
|
|
40
|
-
"flo-memoize": "^1.0.
|
|
41
|
-
"flo-poly": "^6.0.
|
|
42
|
-
"flo-vector2d": "^4.0.
|
|
34
|
+
"big-float-ts": "^3.0.3",
|
|
35
|
+
"double-double": "^2.0.7",
|
|
36
|
+
"flo-bezier3": "^4.1.4",
|
|
37
|
+
"flo-boolean": "^2.1.5",
|
|
38
|
+
"flo-draw": "^2.0.2",
|
|
39
|
+
"flo-gauss-quadrature": "^2.1.2",
|
|
40
|
+
"flo-ll-rb-tree": "^0.3.3",
|
|
41
|
+
"flo-memoize": "^1.0.2",
|
|
42
|
+
"flo-poly": "^6.0.5",
|
|
43
|
+
"flo-vector2d": "^4.0.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@types/chai": "^4.3.
|
|
46
|
-
"@types/mocha": "^
|
|
47
|
-
"@types/node": "^
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"source-map-support": "^0.5.21",
|
|
53
|
-
"ts-loader": "^9.3.0",
|
|
54
|
-
"ts-node": "^10.7.0",
|
|
55
|
-
"typescript": "^4.6.4",
|
|
56
|
-
"webpack": "^5.72.1",
|
|
57
|
-
"webpack-cli": "^4.9.2",
|
|
46
|
+
"@types/chai": "^4.3.4",
|
|
47
|
+
"@types/mocha": "^10.0.1",
|
|
48
|
+
"@types/node": "^18.11.18",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^5.48.2",
|
|
50
|
+
"@typescript-eslint/parser": "^5.48.2",
|
|
51
|
+
"c8": "^7.12.0",
|
|
52
|
+
"chai": "^4.3.7",
|
|
58
53
|
"circular-dependency-plugin": "^5.2.2",
|
|
59
|
-
"
|
|
54
|
+
"eslint": "^8.32.0",
|
|
55
|
+
"eslint-plugin-tree-shaking": "^1.10.0",
|
|
56
|
+
"mocha": "^10.2.0",
|
|
57
|
+
"resolve-typescript-plugin": "^2.0.0",
|
|
58
|
+
"rimraf": "^4.1.1",
|
|
59
|
+
"source-map-support": "^0.5.21",
|
|
60
|
+
"ts-loader": "^9.4.2",
|
|
61
|
+
"ts-node": "^10.9.1",
|
|
62
|
+
"typescript": "^4.9.4",
|
|
63
|
+
"webpack": "^5.75.0",
|
|
64
|
+
"webpack-cli": "^5.0.1"
|
|
60
65
|
},
|
|
61
66
|
"scripts": {
|
|
62
67
|
"build": "npm run build-browser && npm run build-node",
|
package/src/circle.ts
CHANGED
|
@@ -30,9 +30,9 @@ function engulfsCircle(c1: Circle, c2: Circle) {
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const d = squaredDistanceBetween(c1.center, c2.center);
|
|
34
|
+
const dr = c1.radius - c2.radius;
|
|
35
|
+
const δ = dr*dr;
|
|
36
36
|
|
|
37
37
|
return δ > d;
|
|
38
38
|
}
|
|
@@ -24,14 +24,14 @@ function compareCurvaturesAtInterface(
|
|
|
24
24
|
psO: number[][]) {
|
|
25
25
|
|
|
26
26
|
// Get x' and y' for incoming curve evaluated at 0
|
|
27
|
-
|
|
27
|
+
const [dxI, dyI] = tangentAt0(psI); // max bitlength increase / max shift === 3
|
|
28
28
|
// Get x'' and y'' for incoming curve evaluated at 0
|
|
29
|
-
|
|
29
|
+
const [ddxI, ddyI] = evaluate2ndDerivativeAt0(psI); // max bitlength increase / max shift === 5
|
|
30
30
|
|
|
31
31
|
// Get x' and y' for outgoing curve evaluated at 0
|
|
32
|
-
|
|
32
|
+
const [dxO, dyO] = tangentAt0(psO); // max bitlength increase / max shift === 3
|
|
33
33
|
// Get x'' and y'' for outgoing curve evaluated at 0
|
|
34
|
-
|
|
34
|
+
const [ddxO, ddyO] = evaluate2ndDerivativeAt0(psO); // max bitlength increase / max shift === 5
|
|
35
35
|
|
|
36
36
|
//console.log('κI: ', κ(psI, 0));
|
|
37
37
|
//console.log('κO: ', κ(psO, 0));
|
|
@@ -59,40 +59,40 @@ function compareCurvaturesAtInterface(
|
|
|
59
59
|
//let d = (dxI*dxI + dyI*dyI )**3;
|
|
60
60
|
|
|
61
61
|
// We need to resort to exact floating point arithmetic at this point
|
|
62
|
-
|
|
62
|
+
const a = eDiff(
|
|
63
63
|
twoProduct(dxI, ddyI),
|
|
64
64
|
twoProduct(dyI, ddxI)
|
|
65
65
|
);
|
|
66
|
-
|
|
66
|
+
const c = eDiff(
|
|
67
67
|
twoProduct(dxO, ddyO),
|
|
68
68
|
twoProduct(dyO, ddxO)
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const signA = eSign(a);
|
|
72
|
+
const signC = eSign(c);
|
|
73
73
|
if (signA !== signC) {
|
|
74
74
|
//console.log('branch 3');
|
|
75
75
|
return signA - signC;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
const b = fastExpansionSum(
|
|
79
79
|
twoProduct(dxO, dxO),
|
|
80
80
|
twoProduct(dyO, dyO)
|
|
81
81
|
);
|
|
82
|
-
|
|
82
|
+
const d = fastExpansionSum(
|
|
83
83
|
twoProduct(dxI, dxI),
|
|
84
84
|
twoProduct(dyI, dyI)
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
const b2 = expansionProduct(b, b);
|
|
88
|
+
const b3 = expansionProduct(b2, b);
|
|
89
|
+
const d2 = expansionProduct(d, d);
|
|
90
|
+
const d3 = expansionProduct(d2, d);
|
|
91
91
|
|
|
92
92
|
if (signA !== 0 || signC !== 0) {
|
|
93
93
|
//console.log('branch 4');
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const a2 = expansionProduct(a, a);
|
|
95
|
+
const c2 = expansionProduct(c, c);
|
|
96
96
|
|
|
97
97
|
// max aggregate bitlength increase (let original bitlength === p):
|
|
98
98
|
// κ -> (2 x ((p+3)+(p+5) + 1)) + (3 x ((p+3) + 1)) === 7p + 30
|
|
@@ -101,9 +101,9 @@ function compareCurvaturesAtInterface(
|
|
|
101
101
|
// results without resorting to infinite precision) we get 51 bits.
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
const κI = expansionProduct(a2,b3);
|
|
105
|
+
const κO = expansionProduct(c2,d3);
|
|
106
|
+
const δκ = eSign(eDiff(κI, κO));
|
|
107
107
|
|
|
108
108
|
if (δκ !== 0) {
|
|
109
109
|
//console.log('branch 5');
|
|
@@ -125,32 +125,32 @@ function compareCurvaturesAtInterface(
|
|
|
125
125
|
// <=> i²b⁵ > j²d⁵
|
|
126
126
|
|
|
127
127
|
// Get x′′′ and y′′′ for incoming curve evaluated at 1
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const [dddxI, dddyI] = toPowerBasis_3rdDerivative(psI); // max bitlength increase === max shift === 6
|
|
129
|
+
const [dddxO, dddyO] = toPowerBasis_3rdDerivative(psO); // max bitlength increase === max shift === 6
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
const e = eDiff(
|
|
132
132
|
twoProduct(dxI, dddyI),
|
|
133
133
|
twoProduct(dyI, dddxI)
|
|
134
134
|
);
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
const f = fastExpansionSum(
|
|
137
137
|
twoProduct(dxI, ddxI),
|
|
138
138
|
twoProduct(dyI, ddyI)
|
|
139
139
|
);
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
const g = eDiff(
|
|
142
142
|
twoProduct(dxO, dddyO),
|
|
143
143
|
twoProduct(dyO, dddxO)
|
|
144
144
|
);
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const h = fastExpansionSum(
|
|
147
147
|
twoProduct(dxO, ddxO),
|
|
148
148
|
twoProduct(dyO, ddyO)
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
// (de - 3af)²b⁵ > (bg - 3ch)²d⁵
|
|
152
152
|
// i²b⁵ > j²d⁵
|
|
153
|
-
|
|
153
|
+
const i = eDiff(
|
|
154
154
|
expansionProduct(d, e),
|
|
155
155
|
scaleExpansion(
|
|
156
156
|
expansionProduct(a, f),
|
|
@@ -158,7 +158,7 @@ function compareCurvaturesAtInterface(
|
|
|
158
158
|
)
|
|
159
159
|
);
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
const j = eDiff(
|
|
162
162
|
expansionProduct(b, g),
|
|
163
163
|
scaleExpansion(
|
|
164
164
|
expansionProduct(c, h),
|
|
@@ -166,8 +166,8 @@ function compareCurvaturesAtInterface(
|
|
|
166
166
|
)
|
|
167
167
|
);
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
const signI = eSign(i);
|
|
170
|
+
const signJ = eSign(j);
|
|
171
171
|
if (signA !== signC) {
|
|
172
172
|
return signI - signJ;
|
|
173
173
|
}
|
|
@@ -177,15 +177,15 @@ function compareCurvaturesAtInterface(
|
|
|
177
177
|
return 0;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
const i2 = expansionProduct(i,i);
|
|
181
|
+
const b5 = expansionProduct(b2,b3);
|
|
182
|
+
const j2 = expansionProduct(j,j);
|
|
183
|
+
const d5 = expansionProduct(d2,d3);
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const dκI = expansionProduct(i2,b5);
|
|
186
|
+
const dκO = expansionProduct(j2,d5);
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
const sgn = eSign(eDiff(dκI, dκO));
|
|
189
189
|
|
|
190
190
|
return signI > 0 ? sgn : -sgn;
|
|
191
191
|
|
package/src/cp-node/clone.ts
CHANGED
|
@@ -21,18 +21,18 @@ function clone(cpNode: CpNode): CpNode {
|
|
|
21
21
|
// Don't change this function to be recursive, the call stack may
|
|
22
22
|
// overflow if there are too many CpNodes.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
const nodeMap: Map<CpNode, CpNode> = new Map();
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const newCpNode = new CpNode(cpNode.cp, cpNode.isHoleClosing, cpNode.isIntersection);
|
|
27
27
|
|
|
28
28
|
nodeMap.set(cpNode, newCpNode);
|
|
29
|
-
|
|
29
|
+
const cpStack = [{ cpNode, newCpNode }];
|
|
30
30
|
|
|
31
31
|
while (cpStack.length) {
|
|
32
|
-
|
|
32
|
+
const { cpNode, newCpNode } = cpStack.pop();
|
|
33
33
|
|
|
34
|
-
for (
|
|
35
|
-
|
|
34
|
+
for (const edge of EDGES) {
|
|
35
|
+
const node = cpNode[edge];
|
|
36
36
|
let newNode = nodeMap.get(node);
|
|
37
37
|
if (!newNode) {
|
|
38
38
|
newNode = new CpNode(node.cp, node.isHoleClosing, node.isIntersection);
|
package/src/cp-node/remove.ts
CHANGED
|
@@ -8,13 +8,13 @@ import { CpNode } from "../cp-node.js";
|
|
|
8
8
|
* @param cpNode The [[CpNode]] to remove.
|
|
9
9
|
*/
|
|
10
10
|
function removeCpNode(cpNode: CpNode, cpTree?: LlRbTree<CpNode>): void {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const prev = cpNode.prev;
|
|
12
|
+
const next = cpNode.next;
|
|
13
13
|
prev.next = next;
|
|
14
14
|
next.prev = prev;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const nextOpposite = next.prevOnCircle;
|
|
17
|
+
const prevOpposite = prev.nextOnCircle;
|
|
18
18
|
nextOpposite.next = prevOpposite;
|
|
19
19
|
prevOpposite.prev = nextOpposite;
|
|
20
20
|
|
package/src/cp-node.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @
|
|
2
|
-
declare
|
|
1
|
+
/** @internal */
|
|
2
|
+
declare const _debug_: Debug;
|
|
3
3
|
|
|
4
4
|
import { LlRbTree } from 'flo-ll-rb-tree';
|
|
5
5
|
import { Debug } from './debug/debug.js';
|
|
@@ -115,9 +115,9 @@ class CpNode {
|
|
|
115
115
|
* edges.
|
|
116
116
|
*/
|
|
117
117
|
getChildren() {
|
|
118
|
-
|
|
118
|
+
const children: CpNode[] = [];
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
const cp = this.next;
|
|
121
121
|
let cp_ = cp;
|
|
122
122
|
do {
|
|
123
123
|
children.push(cp_);
|
|
@@ -141,8 +141,8 @@ class CpNode {
|
|
|
141
141
|
get vertexChildren() {
|
|
142
142
|
if (this.isTerminating()) { return []; }
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
const cp: CpNode = this;
|
|
145
|
+
const children: CpNode[] = [];
|
|
146
146
|
|
|
147
147
|
let cp_ = cp;
|
|
148
148
|
while (cp_ !== cp.prevOnCircle) {
|
|
@@ -159,8 +159,8 @@ class CpNode {
|
|
|
159
159
|
* starting from the current one and going anti-clockwise around the shape.
|
|
160
160
|
*/
|
|
161
161
|
public getAllOnLoop() {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
const cpStart: CpNode = this;
|
|
163
|
+
const cps: CpNode[] = [cpStart];
|
|
164
164
|
let cp: CpNode = this.next;
|
|
165
165
|
|
|
166
166
|
while (cp !== cpStart) {
|
|
@@ -193,7 +193,7 @@ class CpNode {
|
|
|
193
193
|
cp: ContactPoint,
|
|
194
194
|
prev_: CpNode) {
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
const cpNode = new CpNode(cp, isHoleClosing, isIntersection);
|
|
197
197
|
if (typeof _debug_ !== 'undefined') {
|
|
198
198
|
_debug_.generated.elems.cpNode.push({
|
|
199
199
|
generated: _debug_.generated,
|
|
@@ -231,10 +231,10 @@ class CpNode {
|
|
|
231
231
|
* [[CpNode]].
|
|
232
232
|
*/
|
|
233
233
|
public getCpNodesOnCircle(exclThis = false) {
|
|
234
|
-
|
|
234
|
+
const startCp = this as CpNode;
|
|
235
235
|
let cp = startCp;
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
const cps: CpNode[] = [];
|
|
238
238
|
do {
|
|
239
239
|
if (exclThis) {
|
|
240
240
|
exclThis = false;
|
|
@@ -255,7 +255,7 @@ class CpNode {
|
|
|
255
255
|
* @param cpNode2 Another [[CpNode]]
|
|
256
256
|
*/
|
|
257
257
|
static isOnSameCircle(cpNode1: CpNode, cpNode2: CpNode) {
|
|
258
|
-
|
|
258
|
+
const cpNodes = cpNode1.getCpNodesOnCircle(true);
|
|
259
259
|
|
|
260
260
|
return cpNodes.indexOf(cpNode2) >= 0;
|
|
261
261
|
}
|
|
@@ -284,8 +284,8 @@ class CpNode {
|
|
|
284
284
|
* (except this.prevOnCircle) is terminating.
|
|
285
285
|
*/
|
|
286
286
|
public isFullyTerminating() {
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
const otherOnCircle = this.prevOnCircle.getCpNodesOnCircle(true);
|
|
288
|
+
const isFullyTerminating = otherOnCircle.every(cpNode => cpNode.isTerminating());
|
|
289
289
|
|
|
290
290
|
return isFullyTerminating;
|
|
291
291
|
}
|
|
@@ -296,7 +296,7 @@ class CpNode {
|
|
|
296
296
|
* .nextOnCircle) that exits the circle.
|
|
297
297
|
*/
|
|
298
298
|
public getFirstExit() {
|
|
299
|
-
|
|
299
|
+
const startNode = this as CpNode;
|
|
300
300
|
let cpNode = startNode;
|
|
301
301
|
|
|
302
302
|
while (cpNode.next === cpNode.prevOnCircle) {
|
|
@@ -333,16 +333,16 @@ class CpNode {
|
|
|
333
333
|
* preserve symmetry - see [[isTerminating]] for more details.
|
|
334
334
|
*/
|
|
335
335
|
public isOneProng() {
|
|
336
|
-
|
|
336
|
+
const cp1 = this;
|
|
337
337
|
|
|
338
338
|
if (cp1.cp.circle.radius === 0) {
|
|
339
339
|
return true;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
const cp2 = cp1.nextOnCircle;
|
|
343
343
|
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
const p1 = cp1.cp.pointOnShape.p;
|
|
345
|
+
const p2 = cp2.cp.pointOnShape.p;
|
|
346
346
|
|
|
347
347
|
return (p1[0] === p2[0] && p1[1] === p2[1]);
|
|
348
348
|
}
|
|
@@ -357,7 +357,7 @@ class CpNode {
|
|
|
357
357
|
* [[getRealProngCount]] instead which will return 1 in these cases.
|
|
358
358
|
*/
|
|
359
359
|
public getProngCount() {
|
|
360
|
-
|
|
360
|
+
const startCp = this as CpNode;
|
|
361
361
|
let cp = startCp;
|
|
362
362
|
|
|
363
363
|
let i = 0;
|
package/src/curve.ts
CHANGED
|
@@ -66,37 +66,37 @@ const DEGREE_LIMIT = DEGREES[4];
|
|
|
66
66
|
function getCorner(psI: number[][], psO: number[][]): Corner {
|
|
67
67
|
// getInterfaceCcw must return a number !== 0 if psI and psO are not the
|
|
68
68
|
// same as seen as a curve extension with t ∈ [-∞,+∞]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const ccw = getInterfaceCcw(psI, psO);
|
|
70
|
+
const isSharp = ccw < 0;
|
|
71
|
+
const isDull = ccw > 0;
|
|
72
72
|
|
|
73
73
|
// Find (non-normalized) tangent of curve.ps at t === 1
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const p0E = psI[psI.length-2];
|
|
75
|
+
const p1E = psI[psI.length-1];
|
|
76
|
+
const xE = p1E[0] - p0E[0];
|
|
77
|
+
const yE = p1E[1] - p0E[1];
|
|
78
|
+
const tangentAtEnd = [xE,yE];
|
|
79
79
|
|
|
80
80
|
// Find (non-normalized) tangent of curve.next.ps at t === 0
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
const p0S = psO[0];
|
|
82
|
+
const p1S = psO[1];
|
|
83
|
+
const xS = p1S[0] - p0S[0];
|
|
84
|
+
const yS = p1S[1] - p0S[1];
|
|
85
|
+
const tangentAtStart = [xS,yS];
|
|
86
86
|
|
|
87
87
|
// These use square root and are thus not exact
|
|
88
|
-
|
|
88
|
+
const tangents_ = [
|
|
89
89
|
toUnitVector(tangentAtEnd),
|
|
90
90
|
toUnitVector(tangentAtStart),
|
|
91
91
|
];
|
|
92
92
|
|
|
93
93
|
// The cross calculated below should be exact due to beziers having been
|
|
94
94
|
// normalized!
|
|
95
|
-
|
|
95
|
+
const crossTangents = cross(tangents_[0], tangents_[1]);
|
|
96
96
|
|
|
97
97
|
let isQuiteSharp: boolean;
|
|
98
98
|
let isQuiteDull: boolean;
|
|
99
|
-
|
|
99
|
+
const dotTangents = dot(tangentAtEnd, tangentAtStart);
|
|
100
100
|
if (dotTangents > 0) {
|
|
101
101
|
// Curves go in same direction
|
|
102
102
|
isQuiteSharp = crossTangents < -DEGREE_LIMIT;
|
|
@@ -122,9 +122,9 @@ function getCorner(psI: number[][], psO: number[][]): Corner {
|
|
|
122
122
|
* Returns information about the corner created at the end of this curve
|
|
123
123
|
* (at t === 1) and the start of the next curve (at t === 0).
|
|
124
124
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
const getCornerAtEnd = memoize(function(curve: Curve) {
|
|
126
|
+
const psE = curve.ps;
|
|
127
|
+
const psS = curve.next.ps;
|
|
128
128
|
|
|
129
129
|
return getCorner(psE, psS);
|
|
130
130
|
});
|
|
@@ -5,9 +5,9 @@ import { drawFs } from 'flo-draw';
|
|
|
5
5
|
function boundingHull(
|
|
6
6
|
g: SVGGElement,
|
|
7
7
|
hull: number[][],
|
|
8
|
-
style
|
|
8
|
+
style = 'thin5 black nofill') {
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const $polygon = drawFs.polygon(g, hull, style);
|
|
11
11
|
|
|
12
12
|
return $polygon;
|
|
13
13
|
}
|
|
@@ -6,15 +6,15 @@ import { getCurveToNext } from '../../../get-curve-to-next.js';
|
|
|
6
6
|
/** @hidden */
|
|
7
7
|
function drawBranch(g: SVGGElement, branch: CpNode[], delay?: number) {
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const classes = 'thin5 purple nofill';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const $svgs: SVGElement[] = [];
|
|
12
12
|
let i = 0;
|
|
13
13
|
|
|
14
|
-
for (
|
|
14
|
+
for (const cpNode of branch) {
|
|
15
15
|
if (cpNode.isTerminating()) { continue; }
|
|
16
16
|
//let bezier = cpNode.matCurveToNextVertex;
|
|
17
|
-
|
|
17
|
+
const bezier = getCurveToNext(cpNode);
|
|
18
18
|
if (!bezier) { continue; }
|
|
19
19
|
i++;
|
|
20
20
|
$svgs.push( ...drawFs.bezier(g, bezier, classes, delay));
|
|
@@ -3,10 +3,10 @@ import { Circle } from '../../../circle.js';
|
|
|
3
3
|
|
|
4
4
|
/** @hidden */
|
|
5
5
|
function culls(g: SVGGElement, culls: Circle[]) {
|
|
6
|
-
|
|
6
|
+
const $elems: SVGElement[] = [];
|
|
7
7
|
|
|
8
|
-
for (
|
|
9
|
-
|
|
8
|
+
for (const circle of culls) {
|
|
9
|
+
const p = circle.center;
|
|
10
10
|
|
|
11
11
|
$elems.push(drawCircle(g, p, 0.4, 'cyan thin5 nofill'));
|
|
12
12
|
}
|
|
@@ -24,7 +24,7 @@ function drawCircle(
|
|
|
24
24
|
|
|
25
25
|
const XMLNS = 'http://www.w3.org/2000/svg';
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
const $circle = document.createElementNS(XMLNS, 'circle');
|
|
28
28
|
$circle.setAttributeNS(null, "cx", center[0].toString());
|
|
29
29
|
$circle.setAttributeNS(null, "cy", center[1].toString());
|
|
30
30
|
$circle.setAttributeNS(null, "r", radiusPercent.toString() + '%');
|
|
@@ -6,9 +6,9 @@ function drawCirclePercent(
|
|
|
6
6
|
radiusPercent: number,
|
|
7
7
|
classes: string) {
|
|
8
8
|
|
|
9
|
-
const XMLNS = 'http://www.w3.org/2000/svg';
|
|
9
|
+
const XMLNS = 'http://www.w3.org/2000/svg';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const $circle = document.createElementNS(XMLNS, 'circle');
|
|
12
12
|
$circle.setAttributeNS(null, "cx", center[0].toString());
|
|
13
13
|
$circle.setAttributeNS(null, "cy", center[1].toString());
|
|
14
14
|
$circle.setAttributeNS(null, "r", radiusPercent.toString() + '%');
|
|
@@ -6,9 +6,9 @@ import { Curve } from '../../../curve.js';
|
|
|
6
6
|
function dullCorner(g: SVGGElement, curve: Curve) {
|
|
7
7
|
const scaleFactor = 1;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const ps = curve.ps;
|
|
10
|
+
const p = curve.ps[ps.length-1];
|
|
11
|
+
const $pos = drawFs.dot(g, p, 0.5*scaleFactor, 'orange');
|
|
12
12
|
|
|
13
13
|
return $pos;
|
|
14
14
|
}
|
|
@@ -4,11 +4,11 @@ import { drawCirclePercent } from './draw-circle-percent.js';
|
|
|
4
4
|
|
|
5
5
|
/** @hidden */
|
|
6
6
|
function leaves(g: SVGGElement, leaves: CpNode[]) {
|
|
7
|
-
|
|
7
|
+
const $elems: SVGElement[] = [];
|
|
8
8
|
|
|
9
|
-
for (
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (const cpNode of leaves) {
|
|
10
|
+
const cp = cpNode.cp;
|
|
11
|
+
const p = cp.circle.center;
|
|
12
12
|
|
|
13
13
|
$elems.push(drawCirclePercent(g, p, 0.5, 'pinker thin5 nofill'));
|
|
14
14
|
}
|
|
@@ -4,10 +4,10 @@ import { drawFs } from "flo-draw";
|
|
|
4
4
|
/** @hidden */
|
|
5
5
|
function looseBoundingBox(g: SVGGElement, box: number[][]) {
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const [[x0, y0],[x1, y1]] = box;
|
|
8
8
|
box = [[x0, y0],[x1, y0],[x1,y1],[x0,y1]];
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const $box = drawFs.polygon(g, box, 'thin5 brown nofill');
|
|
11
11
|
|
|
12
12
|
return $box;
|
|
13
13
|
}
|
|
@@ -7,22 +7,22 @@ import { getCurveToNext } from '../../../get-curve-to-next.js';
|
|
|
7
7
|
/** @hidden */
|
|
8
8
|
function drawMat(type: 'mat' | 'sat') {
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const classes: string = type === 'mat'
|
|
11
11
|
? 'thin5 purple nofill'
|
|
12
12
|
: 'thin10 red nofill';
|
|
13
13
|
|
|
14
14
|
return (g: SVGGElement, mat: Mat) => {
|
|
15
|
-
|
|
15
|
+
const cpNode = mat.cpNode;
|
|
16
16
|
|
|
17
17
|
if (!cpNode) { return undefined; }
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const $svgs: SVGElement[] = [];
|
|
20
20
|
let i = 0;
|
|
21
21
|
|
|
22
22
|
traverseEdges(cpNode, cpNode => {
|
|
23
23
|
if (cpNode.isTerminating()) { return; }
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const bezier = getCurveToNext(cpNode);
|
|
26
26
|
|
|
27
27
|
if (!bezier) { return; }
|
|
28
28
|
|
|
@@ -4,9 +4,9 @@ import { CpNode } from '../../../cp-node.js';
|
|
|
4
4
|
|
|
5
5
|
/** @hidden */
|
|
6
6
|
function maxVertex(g: SVGGElement, cpNode: CpNode) {
|
|
7
|
-
|
|
7
|
+
const circle = cpNode.cp.circle;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const $elems = drawFs.circle(g, circle, 'brown thin10 nofill');
|
|
10
10
|
|
|
11
11
|
return $elems;
|
|
12
12
|
}
|