flo-mat 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs-same-curve.spec.ts +106 -0
- package/__tests__/find-2-prong/get-medial/dd-get-medial-point-coeffs.spec.ts +73 -0
- package/__tests__/find-2-prong/get-medial/get-closest-points.spec.ts +5 -2
- package/__tests__/helpers/close-to.ts +5 -5
- package/__tests__/specific-cases/load-svg/load-svg.ts +30 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +170 -0
- package/__tests__/specific-cases/test-svgs/achispado.svg +5052 -0
- package/browser/index.js +5129 -8785
- package/browser/index.min.js +1 -1
- package/{jest.config.cjs → jest.config.ts} +8 -3
- package/node/closest-boundary-point/get-close-boundary-points-certified.js +3 -2
- package/node/closest-boundary-point/get-close-boundary-points-certified.js.map +1 -1
- package/node/corner/get-corner.js +1 -1
- package/node/corner/get-corner.js.map +1 -1
- package/node/cp-node/fs/get-all-on-loop-by-loop.d.ts +11 -0
- package/node/cp-node/fs/get-all-on-loop-by-loop.js +42 -0
- package/node/cp-node/fs/get-all-on-loop-by-loop.js.map +1 -0
- package/node/cp-node/fs/get-boundary-beziers-to-next.d.ts +1 -0
- package/node/cp-node/fs/get-boundary-beziers-to-next.js +1 -59
- package/node/cp-node/fs/get-boundary-beziers-to-next.js.map +1 -1
- package/node/cp-node/fs/get-edge-direction.d.ts +3 -1
- package/node/cp-node/fs/get-edge-direction.js +5 -3
- package/node/cp-node/fs/get-edge-direction.js.map +1 -1
- package/node/cp-node/fs/get-mat-curve-between.js +6 -6
- package/node/cp-node/fs/get-mat-curve-between.js.map +1 -1
- package/node/cp-node/fs/is-fully-terminating.js +12 -0
- package/node/cp-node/fs/is-fully-terminating.js.map +1 -1
- package/node/cp-node/fs/is-on-same-loop.d.ts +3 -0
- package/node/cp-node/fs/is-on-same-loop.js +6 -0
- package/node/cp-node/fs/is-on-same-loop.js.map +1 -0
- package/node/debug/debug.d.ts +8 -22
- package/node/debug/debug.js +12 -50
- package/node/debug/debug.js.map +1 -1
- package/node/find-2-prong/add-1-prong.js +1 -4
- package/node/find-2-prong/add-1-prong.js.map +1 -1
- package/node/find-2-prong/find-2-prong.js +24 -10
- package/node/find-2-prong/find-2-prong.js.map +1 -1
- package/node/find-2-prong/get-medial/get-antipodal-points.d.ts +1 -1
- package/node/find-2-prong/get-medial/get-antipodal-points.js +2 -2
- package/node/find-2-prong/get-medial/get-antipodal-points.js.map +1 -1
- package/node/find-2-prong/get-medial/get-closest-points.d.ts +7 -1
- package/node/find-2-prong/get-medial/get-closest-points.js +60 -14
- package/node/find-2-prong/get-medial/get-closest-points.js.map +1 -1
- package/node/find-2-prong/reduce-radius.d.ts +3 -1
- package/node/find-2-prong/reduce-radius.js +8 -6
- package/node/find-2-prong/reduce-radius.js.map +1 -1
- package/node/find-3-prong/calc-better-x.js +1 -3
- package/node/find-3-prong/calc-better-x.js.map +1 -1
- package/node/find-3-prong/calc-initial-3-prong-center.js +1 -2
- package/node/find-3-prong/calc-initial-3-prong-center.js.map +1 -1
- package/node/find-3-prong/find-3-prong-for-delta3s.js +1 -4
- package/node/find-3-prong/find-3-prong-for-delta3s.js.map +1 -1
- package/node/find-3-prong/find-3-prong.js.map +1 -1
- package/node/find-3-prong/find-and-add-3-prong.js +0 -14
- package/node/find-3-prong/find-and-add-3-prong.js.map +1 -1
- package/node/find-mat/find-mat.js +2 -2
- package/node/find-mat/find-mat.js.map +1 -1
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/find-mat/get-dull-corners-on-loop.js +3 -2
- package/node/find-mat/get-dull-corners-on-loop.js.map +1 -1
- package/node/find-mat/get-for-1-prongs-on-loop.js +6 -3
- 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 +5 -1
- package/node/find-mat/get-for-2-prongs-on-loop.js.map +1 -1
- package/node/find-mat/get-meta.d.ts +4 -6
- package/node/find-mat/get-meta.js +12 -26
- package/node/find-mat/get-meta.js.map +1 -1
- package/node/find-mat/get-sharp-corners.js +4 -2
- package/node/find-mat/get-sharp-corners.js.map +1 -1
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.d.ts +21 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js +46 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js +97 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js +109 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.d.ts +29 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js +123 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.d.ts +30 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js +177 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.d.ts +29 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js +156 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.js.map +1 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.d.ts +28 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js +40 -0
- package/node/get-medial-points/double-double/dd-get-medial-point-coeffs.js.map +1 -0
- package/node/index.d.ts +6 -10
- package/node/index.js +5 -6
- package/node/index.js.map +1 -1
- package/node/point-on-shape/point-on-shape.d.ts +2 -0
- package/node/point-on-shape/to-p.d.ts +1 -1
- package/node/point-on-shape/to-p.js +1 -1
- package/node/point-on-shape/to-p.js.map +1 -1
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.d.ts +4 -0
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js +15 -0
- package/node/reconstruct-from-mat/get-cp-nodess-for-sat.js.map +1 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.d.ts +10 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.js +160 -0
- package/node/reconstruct-from-mat/reconstruct-from-mat.js.map +1 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.d.ts +12 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js +46 -0
- package/node/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.js.map +1 -0
- package/node/sat/add-debug-info.js +1 -2
- package/node/sat/add-debug-info.js.map +1 -1
- package/node/svg/get-loop-bounds.js +6 -2
- package/node/svg/get-loop-bounds.js.map +1 -1
- package/node/utils/map-deep.d.ts +15 -0
- package/node/utils/map-deep.js +34 -0
- package/node/utils/map-deep.js.map +1 -0
- package/package.json +14 -8
- package/src/closest-boundary-point/get-close-boundary-points-certified.ts +3 -2
- package/src/corner/get-corner.ts +1 -1
- package/src/cp-node/fs/get-all-on-loop-by-loop.ts +56 -0
- package/src/cp-node/fs/get-all-on-loop.ts +1 -1
- package/src/cp-node/fs/get-boundary-beziers-to-next.ts +1 -72
- package/src/cp-node/fs/get-edge-direction.ts +8 -4
- package/src/cp-node/fs/get-mat-curve-between.ts +6 -6
- package/src/cp-node/fs/is-fully-terminating.ts +16 -0
- package/src/cp-node/fs/is-on-same-loop.ts +15 -0
- package/src/debug/debug.ts +27 -87
- package/src/find-2-prong/add-1-prong.ts +1 -5
- package/src/find-2-prong/find-2-prong.ts +37 -14
- package/src/find-2-prong/get-medial/get-antipodal-points.ts +3 -2
- package/src/find-2-prong/get-medial/get-closest-points-d.ts +213 -0
- package/src/find-2-prong/get-medial/get-closest-points.ts +74 -13
- package/src/find-2-prong/reduce-radius.ts +8 -5
- package/src/find-3-prong/calc-better-x.ts +1 -3
- package/src/find-3-prong/calc-initial-3-prong-center.ts +1 -2
- package/src/find-3-prong/find-3-prong-for-delta3s.ts +1 -4
- package/src/find-3-prong/find-3-prong.ts +0 -1
- package/src/find-3-prong/find-and-add-3-prong.ts +1 -15
- package/src/find-mat/find-mat.ts +3 -2
- package/src/find-mat/find-mats.ts +0 -1
- package/src/find-mat/get-dull-corners-on-loop.ts +4 -3
- package/src/find-mat/get-for-1-prongs-on-loop.ts +8 -3
- package/src/find-mat/get-for-2-prongs-on-loop.ts +6 -1
- package/src/find-mat/get-meta.ts +14 -38
- package/src/find-mat/get-sharp-corners.ts +5 -1
- package/src/get-medial-curve/__pycache__/get-cubic-self-medial-curve.cpython-313.pyc +0 -0
- package/src/get-medial-curve/get-cubic-self-medial-curve.py +419 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0-with-running-err.ts +76 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez0.ts +61 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez1.ts +116 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2-same-curve.ts +129 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez2.ts +142 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.ts +199 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts +177 -0
- package/src/get-medial-points/double-double/dd-get-medial-point-coeffs.ts +48 -0
- package/src/get-medial-points/double-double/error-bound-calc.txt +72 -0
- package/src/index.ts +7 -11
- package/src/point-on-shape/point-on-shape.ts +3 -0
- package/src/point-on-shape/to-p.ts +2 -2
- package/src/reconstruct-from-mat/get-cp-nodess-for-sat.ts +24 -0
- package/src/reconstruct-from-mat/reconstruct-from-mat.ts +226 -0
- package/src/reconstruct-from-mat/remove-sat-induced-trivial-3prongs.ts +62 -0
- package/src/sat/add-debug-info.ts +1 -2
- package/src/svg/get-loop-bounds.ts +11 -3
- package/src/utils/clip.ts +13 -0
- package/src/utils/map-deep.ts +75 -0
- package/src/utils/map-map.ts +33 -0
- package/wallaby.mjs +4 -4
- package/node/debug/debug-elem-types.d.ts +0 -26
- package/node/debug/debug-elem-types.js +0 -22
- package/node/debug/debug-elem-types.js.map +0 -1
- package/node/debug/functions/draw/draw-beziers-as-single-path.d.ts +0 -2
- package/node/debug/functions/draw/draw-beziers-as-single-path.js +0 -30
- package/node/debug/functions/draw/draw-beziers-as-single-path.js.map +0 -1
- package/node/debug/functions/draw/xmlns.d.ts +0 -2
- package/node/debug/functions/draw/xmlns.js +0 -3
- package/node/debug/functions/draw/xmlns.js.map +0 -1
- package/node/debug/functions/draw-elem/bounding-hull.d.ts +0 -3
- package/node/debug/functions/draw-elem/bounding-hull.js +0 -8
- package/node/debug/functions/draw-elem/bounding-hull.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-branch.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-branch.js +0 -26
- package/node/debug/functions/draw-elem/draw-branch.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-circle-percent.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-circle-percent.js +0 -13
- package/node/debug/functions/draw-elem/draw-circle-percent.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-cp-node.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-cp-node.js +0 -26
- package/node/debug/functions/draw-elem/draw-cp-node.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-cull.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-cull.js +0 -9
- package/node/debug/functions/draw-elem/draw-cull.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-dull-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-dull-corner.js +0 -10
- package/node/debug/functions/draw-elem/draw-dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-elem.d.ts +0 -10
- package/node/debug/functions/draw-elem/draw-elem.js +0 -39
- package/node/debug/functions/draw-elem/draw-elem.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-leaves.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-leaves.js +0 -34
- package/node/debug/functions/draw-elem/draw-leaves.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loop.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-loop.js +0 -11
- package/node/debug/functions/draw-elem/draw-loop.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loops.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-loops.js +0 -6
- package/node/debug/functions/draw-elem/draw-loops.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js +0 -10
- package/node/debug/functions/draw-elem/draw-loose-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-mat.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-mat.js +0 -34
- package/node/debug/functions/draw-elem/draw-mat.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-max-vertex.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-max-vertex.js +0 -9
- package/node/debug/functions/draw-elem/draw-max-vertex.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-min-y.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-min-y.js +0 -10
- package/node/debug/functions/draw-elem/draw-min-y.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js +0 -22
- package/node/debug/functions/draw-elem/draw-one-prong-at-dull-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-one-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-one-prong.js +0 -13
- package/node/debug/functions/draw-elem/draw-one-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-sharp-corner.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-sharp-corner.js +0 -10
- package/node/debug/functions/draw-elem/draw-sharp-corner.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-three-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-three-prong.js +0 -26
- package/node/debug/functions/draw-elem/draw-three-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.d.ts +0 -3
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js +0 -8
- package/node/debug/functions/draw-elem/draw-tight-bounding-box.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-two-prong.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-two-prong.js +0 -49
- package/node/debug/functions/draw-elem/draw-two-prong.js.map +0 -1
- package/node/debug/functions/draw-elem/draw-vertex.d.ts +0 -4
- package/node/debug/functions/draw-elem/draw-vertex.js +0 -13
- package/node/debug/functions/draw-elem/draw-vertex.js.map +0 -1
- package/node/debug/functions/general.d.ts +0 -48
- package/node/debug/functions/general.js +0 -53
- package/node/debug/functions/general.js.map +0 -1
- package/node/find-3-prong/timed-cc.d.ts +0 -3
- package/node/find-3-prong/timed-cc.js +0 -5
- package/node/find-3-prong/timed-cc.js.map +0 -1
- package/node/point-on-shape/pos-to-human-string.d.ts +0 -8
- package/node/point-on-shape/pos-to-human-string.js +0 -12
- package/node/point-on-shape/pos-to-human-string.js.map +0 -1
- package/node/utils/time-function-call.d.ts +0 -14
- package/node/utils/time-function-call.js +0 -32
- package/node/utils/time-function-call.js.map +0 -1
- package/src/debug/debug-elem-types.ts +0 -43
- package/src/debug/elem-type-two-prong.ts +0 -8
- package/src/debug/functions/cmp-cp-on-delta.ts +0 -54
- package/src/debug/functions/draw-elem/bounding-hull.ts +0 -18
- package/src/debug/functions/draw-elem/culls.ts +0 -39
- package/src/debug/functions/draw-elem/draw-branch.ts +0 -37
- package/src/debug/functions/draw-elem/draw-circle-percent.ts +0 -23
- package/src/debug/functions/draw-elem/draw-cp-node.ts +0 -46
- package/src/debug/functions/draw-elem/draw-cull.ts +0 -21
- package/src/debug/functions/draw-elem/draw-dull-corner.ts +0 -21
- package/src/debug/functions/draw-elem/draw-elem.ts +0 -64
- package/src/debug/functions/draw-elem/draw-leaves.ts +0 -51
- package/src/debug/functions/draw-elem/draw-loop.ts +0 -16
- package/src/debug/functions/draw-elem/draw-loops.ts +0 -10
- package/src/debug/functions/draw-elem/draw-loose-bounding-box.ts +0 -21
- package/src/debug/functions/draw-elem/draw-mat.ts +0 -43
- package/src/debug/functions/draw-elem/draw-max-vertex.ts +0 -15
- package/src/debug/functions/draw-elem/draw-min-y.ts +0 -18
- package/src/debug/functions/draw-elem/draw-one-prong-at-dull-corner.ts +0 -40
- package/src/debug/functions/draw-elem/draw-one-prong.ts +0 -25
- package/src/debug/functions/draw-elem/draw-sharp-corner.ts +0 -21
- package/src/debug/functions/draw-elem/draw-three-prong.ts +0 -44
- package/src/debug/functions/draw-elem/draw-tight-bounding-box.ts +0 -18
- package/src/debug/functions/draw-elem/draw-two-prong.ts +0 -68
- package/src/debug/functions/draw-elem/draw-vertex.ts +0 -27
- package/src/debug/functions/draw-elem/dull-corner.ts +0 -21
- package/src/debug/functions/draw-elem/leaves.ts +0 -20
- package/src/debug/functions/draw-elem/loop.ts +0 -16
- package/src/debug/functions/draw-elem/loops.ts +0 -10
- package/src/debug/functions/draw-elem/loose-bounding-box.ts +0 -21
- package/src/debug/functions/draw-elem/mat.ts +0 -47
- package/src/debug/functions/draw-elem/max-vertex.ts +0 -15
- package/src/debug/functions/draw-elem/min-y.ts +0 -18
- package/src/debug/functions/draw-elem/one-prong-at-dull-corner.ts +0 -26
- package/src/debug/functions/draw-elem/one-prong.ts +0 -23
- package/src/debug/functions/draw-elem/sharp-corner.ts +0 -20
- package/src/debug/functions/draw-elem/three-prong.ts +0 -30
- package/src/debug/functions/draw-elem/tight-bounding-box.ts +0 -18
- package/src/debug/functions/draw-elem/two-prong.ts +0 -50
- package/src/debug/functions/draw-elem/vertex.ts +0 -51
- package/src/debug/functions/general.ts +0 -79
- package/src/debug/functions/three-prong.ts +0 -249
- package/src/debug/functions/two-prong.ts +0 -203
- package/src/find-2-prong/add-debug-info.ts +0 -45
- package/src/find-3-prong/timed-cc.ts +0 -9
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns polynomial coefficients for the same-curve cubic medial-point case,
|
|
3
|
+
* where `p = b(t)` on the same cubic bezier `ps` and `v` is normal to the
|
|
4
|
+
* curve at that parameter `t`.
|
|
5
|
+
*
|
|
6
|
+
* The returned coefficients encode:
|
|
7
|
+
* * `A`, `B`: `E2(s, τ) = (s - t)^2⋅(A(s)⋅τ + B(s))`
|
|
8
|
+
* * `C`, `D`: `E1(s, τ) = (s - t)⋅(C(s)⋅τ + D(s))`
|
|
9
|
+
* * `H`: the reduced eliminant in `s`
|
|
10
|
+
*
|
|
11
|
+
* Here `τ` is the ray parameter in `q(τ) = p + τ⋅v`.
|
|
12
|
+
* For a candidate root `s` of `H`, recover `τ` from `A(s)⋅τ + B(s) = 0`, i.e.
|
|
13
|
+
* `τ = -B(s)/A(s)` when `A(s) ≠ 0`.
|
|
14
|
+
*
|
|
15
|
+
* In this same-curve setup, the full eliminant has the form
|
|
16
|
+
* `H_full(s) = (s - t)^4*H(s)`. This function returns only the reduced factor
|
|
17
|
+
* `H(s)` (the repeated `(s - t)^4` factor is omitted).
|
|
18
|
+
*
|
|
19
|
+
* @param t parameter on `ps` where `p = b(t)`
|
|
20
|
+
* @param v ray direction from `p`; assumed normal to `ps` at `t`
|
|
21
|
+
* @param ps order 3 bezier control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
22
|
+
*/
|
|
23
|
+
declare function ddGetMedialPointCoeffsBez3_SameCurve(t: number, v: number[][], ps: number[][]): {
|
|
24
|
+
A: number[][];
|
|
25
|
+
B: number[][];
|
|
26
|
+
C: number[][];
|
|
27
|
+
D: number[][];
|
|
28
|
+
H: number[][];
|
|
29
|
+
};
|
|
30
|
+
export { ddGetMedialPointCoeffsBez3_SameCurve };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { toPowerBasisDd } from 'flo-bezier3';
|
|
2
|
+
import { ddMultDouble2, ddAddDd, ddMultDd, ddNegativeOf, ddMultByNeg2, ddMultBy2 } from 'double-double';
|
|
3
|
+
const qmd = ddMultDouble2;
|
|
4
|
+
const qaq = ddAddDd;
|
|
5
|
+
const qmq = ddMultDd;
|
|
6
|
+
const qno = ddNegativeOf;
|
|
7
|
+
const qmn2 = ddMultByNeg2;
|
|
8
|
+
const qm2 = ddMultBy2;
|
|
9
|
+
/**
|
|
10
|
+
* Returns polynomial coefficients for the same-curve cubic medial-point case,
|
|
11
|
+
* where `p = b(t)` on the same cubic bezier `ps` and `v` is normal to the
|
|
12
|
+
* curve at that parameter `t`.
|
|
13
|
+
*
|
|
14
|
+
* The returned coefficients encode:
|
|
15
|
+
* * `A`, `B`: `E2(s, τ) = (s - t)^2⋅(A(s)⋅τ + B(s))`
|
|
16
|
+
* * `C`, `D`: `E1(s, τ) = (s - t)⋅(C(s)⋅τ + D(s))`
|
|
17
|
+
* * `H`: the reduced eliminant in `s`
|
|
18
|
+
*
|
|
19
|
+
* Here `τ` is the ray parameter in `q(τ) = p + τ⋅v`.
|
|
20
|
+
* For a candidate root `s` of `H`, recover `τ` from `A(s)⋅τ + B(s) = 0`, i.e.
|
|
21
|
+
* `τ = -B(s)/A(s)` when `A(s) ≠ 0`.
|
|
22
|
+
*
|
|
23
|
+
* In this same-curve setup, the full eliminant has the form
|
|
24
|
+
* `H_full(s) = (s - t)^4*H(s)`. This function returns only the reduced factor
|
|
25
|
+
* `H(s)` (the repeated `(s - t)^4` factor is omitted).
|
|
26
|
+
*
|
|
27
|
+
* @param t parameter on `ps` where `p = b(t)`
|
|
28
|
+
* @param v ray direction from `p`; assumed normal to `ps` at `t`
|
|
29
|
+
* @param ps order 3 bezier control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
30
|
+
*/
|
|
31
|
+
function ddGetMedialPointCoeffsBez3_SameCurve(t, v, ps) {
|
|
32
|
+
// -----------------------------------------------------
|
|
33
|
+
// See get-medial-points.md for implementation details.
|
|
34
|
+
// -----------------------------------------------------
|
|
35
|
+
const [vx, vy] = v;
|
|
36
|
+
// Cubic bezier in power basis: b(s) = a*s^3 + b*s^2 + c*s + d
|
|
37
|
+
const [[ax, bx, cx], [ay, by, cy]] = toPowerBasisDd(ps);
|
|
38
|
+
// Shared dot products to reduce repeated multiplications.
|
|
39
|
+
// const va = vx*ax + vy*ay;
|
|
40
|
+
// const vb = vx*bx + vy*by;
|
|
41
|
+
// const vc = vx*cx + vy*cy;
|
|
42
|
+
// const aa = ax*ax + ay*ay;
|
|
43
|
+
// const ab = ax*bx + ay*by;
|
|
44
|
+
// const ac = ax*cx + ay*cy;
|
|
45
|
+
// const bb = bx*bx + by*by;
|
|
46
|
+
// const bc = bx*cx + by*cy;
|
|
47
|
+
// const cc = cx*cx + cy*cy;
|
|
48
|
+
// const vu0 = t*(t*(t*va + vb) + vc);
|
|
49
|
+
// const u0a = t*(t*(t*aa + ab) + ac);
|
|
50
|
+
// const u0b = t*(t*(t*ab + bb) + bc);
|
|
51
|
+
const va = qaq(qmq(vx, ax), qmq(vy, ay));
|
|
52
|
+
const vb = qaq(qmq(vx, bx), qmq(vy, by));
|
|
53
|
+
const vc = qaq(qmq(vx, cx), qmq(vy, cy));
|
|
54
|
+
const aa = qaq(qmq(ax, ax), qmq(ay, ay));
|
|
55
|
+
const ab = qaq(qmq(ax, bx), qmq(ay, by));
|
|
56
|
+
const ac = qaq(qmq(ax, cx), qmq(ay, cy));
|
|
57
|
+
const bb = qaq(qmq(bx, bx), qmq(by, by));
|
|
58
|
+
const bc = qaq(qmq(bx, cx), qmq(by, cy));
|
|
59
|
+
const cc = qaq(qmq(cx, cx), qmq(cy, cy));
|
|
60
|
+
const vu0 = qmd(t, qaq(qmd(t, qaq(qmd(t, va), vb)), vc));
|
|
61
|
+
const u0a = qmd(t, qaq(qmd(t, qaq(qmd(t, aa), ab)), ac));
|
|
62
|
+
const u0b = qmd(t, qaq(qmd(t, qaq(qmd(t, ab), bb)), bc));
|
|
63
|
+
// -----------------------------------------------------
|
|
64
|
+
// E1(s,t): (u(s) + t*v) * b'(s) = 0
|
|
65
|
+
// => C(s)*t + D(s) = 0
|
|
66
|
+
// const c2 = 3*va;
|
|
67
|
+
// const c1 = 2*vb;
|
|
68
|
+
const c2 = qmd(3, va);
|
|
69
|
+
const c1 = qm2(vb);
|
|
70
|
+
// v is normal at parameter t, so C(t) = 0.
|
|
71
|
+
// const c0 = -t*(c2*t + c1);
|
|
72
|
+
// Return reduced C such that C_full(s) = (s - t)*C(s).
|
|
73
|
+
// const cr0 = c1 + t*c2;
|
|
74
|
+
const cr0 = qaq(c1, qmd(t, c2));
|
|
75
|
+
// -----------------------------------------------------
|
|
76
|
+
// -----------------------------------------------------
|
|
77
|
+
// const d5 = -3*aa;
|
|
78
|
+
// const d4 = -5*ab;
|
|
79
|
+
// const d3 = -4*ac - 2*bb;
|
|
80
|
+
// const d2 = -3*bc + 3*u0a;
|
|
81
|
+
// const d1 = -cc + 2*u0b;
|
|
82
|
+
const d5 = qmd(-3, aa);
|
|
83
|
+
const d4 = qmd(-5, ab);
|
|
84
|
+
const d3 = qaq(qmd(-4, ac), qmn2(bb));
|
|
85
|
+
const d2 = qaq(qmd(-3, bc), qmd(3, u0a));
|
|
86
|
+
const d1 = qaq(qno(cc), qm2(u0b));
|
|
87
|
+
// p = b(t) => D(t) = u(t)⋅w(t) = 0.
|
|
88
|
+
// Return reduced D such that D_full(s) = (s - t)*D(s).
|
|
89
|
+
const dr4 = d5;
|
|
90
|
+
// const dr3 = d4 + t*dr4;
|
|
91
|
+
// const dr2 = d3 + t*dr3;
|
|
92
|
+
// const dr1 = d2 + t*dr2;
|
|
93
|
+
// const dr0 = d1 + t*dr1;
|
|
94
|
+
const dr3 = qaq(d4, qmd(t, dr4));
|
|
95
|
+
const dr2 = qaq(d3, qmd(t, dr3));
|
|
96
|
+
const dr1 = qaq(d2, qmd(t, dr2));
|
|
97
|
+
const dr0 = qaq(d1, qmd(t, dr1));
|
|
98
|
+
// -----------------------------------------------------
|
|
99
|
+
// -----------------------------------------------------
|
|
100
|
+
// E2(s,t): |t*v|^2 - |u(s) + t*v|^2 = 0
|
|
101
|
+
// => 2*(v*u(s))*t + |u(s)|^2 = 0
|
|
102
|
+
// => A(s)*t + B(s) = 0
|
|
103
|
+
// A'(s) = -2*C(s) identically for bezier curves, hence:
|
|
104
|
+
// const a3 = -2*va;
|
|
105
|
+
// const a2 = -2*vb;
|
|
106
|
+
const a3 = qmn2(va);
|
|
107
|
+
const a2 = qmn2(vb);
|
|
108
|
+
// const a1 = -2*vc;
|
|
109
|
+
// p = b(t) => A(t) = 0.
|
|
110
|
+
// const a0 = 2*vu0;
|
|
111
|
+
// -----------------------------------------------------
|
|
112
|
+
// -----------------------------------------------------
|
|
113
|
+
const b6 = aa;
|
|
114
|
+
// const b5 = 2*ab;
|
|
115
|
+
// const b4 = 2*ac + bb;
|
|
116
|
+
// const b3 = 2*bc - 2*u0a;
|
|
117
|
+
// const b2 = cc - 2*u0b;
|
|
118
|
+
const b5 = qm2(ab);
|
|
119
|
+
const b4 = qaq(qm2(ac), bb);
|
|
120
|
+
const b3 = qaq(qm2(bc), qmn2(u0a));
|
|
121
|
+
const b2 = qaq(cc, qmn2(u0b));
|
|
122
|
+
// -----------------------------------------------------
|
|
123
|
+
// -----------------------------------------------------
|
|
124
|
+
// Return reduced A and B such that:
|
|
125
|
+
// A_full(s) = (s - t)^2*A(s)
|
|
126
|
+
// B_full(s) = (s - t)^2*B(s)
|
|
127
|
+
// where A is degree 1 and B is degree 4.
|
|
128
|
+
const ar1 = a3;
|
|
129
|
+
// const ar0 = a2 + 2*t*ar1;
|
|
130
|
+
const ar0 = qaq(a2, qm2(qmd(t, ar1)));
|
|
131
|
+
const br4 = b6;
|
|
132
|
+
// const br3 = b5 + 2*t*br4;
|
|
133
|
+
// const br2 = b4 + t*(2*br3 - t*br4);
|
|
134
|
+
// const br1 = b3 + t*(2*br2 - t*br3);
|
|
135
|
+
// const br0 = b2 + t*(2*br1 - t*br2);
|
|
136
|
+
const br3 = qaq(b5, qm2(qmd(t, br4)));
|
|
137
|
+
const br2 = qaq(b4, qmd(t, qaq(qm2(br3), qno(qmd(t, br4)))));
|
|
138
|
+
const br1 = qaq(b3, qmd(t, qaq(qm2(br2), qno(qmd(t, br3)))));
|
|
139
|
+
const br0 = qaq(b2, qmd(t, qaq(qm2(br1), qno(qmd(t, br2)))));
|
|
140
|
+
// -----------------------------------------------------
|
|
141
|
+
// Eliminate t from:
|
|
142
|
+
// A(s)*t + B(s) = 0
|
|
143
|
+
// C(s)*t + D(s) = 0
|
|
144
|
+
// by taking A(s)*D(s) - B(s)*C(s) = 0 (degree <= 8 in s)
|
|
145
|
+
// H8 = a3*d5 - b6*c2 = (-2*va)*(-3*aa) - aa*(3*va) = 3*va*aa.
|
|
146
|
+
// const H8 = 3*va*aa;
|
|
147
|
+
// const H7 = 4*(va*ab + vb*aa);
|
|
148
|
+
// const H6 = va*b4 + 6*vb*ab + 5*vc*aa;
|
|
149
|
+
// const H5 = 2*vb*b4 + 8*vc*ab - 6*vu0*aa;
|
|
150
|
+
// const H4 = -va*b2 + vb*b3 + 3*vc*b4 - 10*vu0*ab;
|
|
151
|
+
const H8 = qmd(3, qmq(va, aa));
|
|
152
|
+
const H7 = qm2(qm2(qaq(qmq(va, ab), qmq(vb, aa))));
|
|
153
|
+
const H6 = qaq(qaq(qmq(va, b4), qmd(6, qmq(vb, ab))), qmd(5, qmq(vc, aa)));
|
|
154
|
+
const H5 = qaq(qaq(qm2(qmq(vb, b4)), qmd(8, qmq(vc, ab))), qno(qmd(6, qmq(vu0, aa))));
|
|
155
|
+
const H4 = qaq(qaq(qno(qmq(va, b2)), qmq(vb, b3)), qaq(qmd(3, qmq(vc, b4)), qno(qmd(10, qmq(vu0, ab)))));
|
|
156
|
+
// Reduce H_full(s) by its guaranteed (s - t)^4 factor:
|
|
157
|
+
// H_full(s) = (s - t)^4*(q4*s^4 + q3*s^3 + q2*s^2 + q1*s + q0)
|
|
158
|
+
// Match the high-order coefficients of H_full(s) explicitly.
|
|
159
|
+
const q4 = H8;
|
|
160
|
+
// const q3 = H7 + 4*t*q4;
|
|
161
|
+
// const q2 = H6 + t*(4*q3 - 6*t*q4);
|
|
162
|
+
// const q1 = H5 + t*(4*q2 + t*(-6*q3 + 4*t*q4));
|
|
163
|
+
// const q0 = H4 + t*(4*q1 + t*(-6*q2 + t*(4*q3 - t*q4)));
|
|
164
|
+
const q3 = qaq(H7, qm2(qm2(qmd(t, q4))));
|
|
165
|
+
const q2 = qaq(H6, qmd(t, qaq(qm2(qm2(q3)), qno(qmd(6, qmd(t, q4))))));
|
|
166
|
+
const q1 = qaq(H5, qmd(t, qaq(qm2(qm2(q2)), qmd(t, qaq(qmd(-6, q3), qm2(qm2(qmd(t, q4))))))));
|
|
167
|
+
const q0 = qaq(H4, qmd(t, qaq(qm2(qm2(q1)), qmd(t, qaq(qmd(-6, q2), qmd(t, qaq(qm2(qm2(q3)), qno(qmd(t, q4)))))))));
|
|
168
|
+
return {
|
|
169
|
+
A: [ar1, ar0],
|
|
170
|
+
B: [br4, br3, br2, br1, br0],
|
|
171
|
+
C: [c2, cr0],
|
|
172
|
+
D: [dr4, dr3, dr2, dr1, dr0],
|
|
173
|
+
H: [q4, q3, q2, q1, q0]
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export { ddGetMedialPointCoeffsBez3_SameCurve };
|
|
177
|
+
//# sourceMappingURL=dd-get-medial-point-coeffs-bez3-same-curve.js.map
|
package/node/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dd-get-medial-point-coeffs-bez3-same-curve.js","sourceRoot":"","sources":["../../../src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3-same-curve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAExG,MAAM,GAAG,GAAG,aAAa,CAAC;AAC1B,MAAM,GAAG,GAAG,OAAO,CAAC;AACpB,MAAM,GAAG,GAAG,QAAQ,CAAC;AACrB,MAAM,GAAG,GAAG,YAAY,CAAC;AACzB,MAAM,IAAI,GAAG,YAAY,CAAC;AAC1B,MAAM,GAAG,GAAG,SAAS,CAAC;AAGtB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAS,oCAAoC,CACrC,CAAS,EACT,CAAa,EACb,EAAc;IAElB,wDAAwD;IACxD,uDAAuD;IACvD,wDAAwD;IACxD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,8DAA8D;IAC9D,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;IAExD,0DAA0D;IAC1D,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,4BAA4B;IAC5B,sCAAsC;IACtC,sCAAsC;IACtC,sCAAsC;IACtC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,EAAC,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC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AAE,GAAG,CAAC;QACb,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC5B,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC;QACZ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC5B,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;KAC1B,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,oCAAoC,EAAE,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the polynomial coefficients for the ray parameter `t` and the
|
|
3
|
+
* curve parameter `s` that encode the medial condition for `q(t) = p + t⋅v`
|
|
4
|
+
* and a cubic bezier curve `ps`.
|
|
5
|
+
*
|
|
6
|
+
* The returned coefficients describe the equations whose common solutions
|
|
7
|
+
* satisfy:
|
|
8
|
+
* * `q(t)` is equidistant from `p` and the nearest point on `ps`
|
|
9
|
+
* * that common distance is locally minimal among such candidates
|
|
10
|
+
*
|
|
11
|
+
* More specifically, this function returns:
|
|
12
|
+
* * `A` and `B`: the coefficients of `E2(s,t) = A(s)⋅t + B(s)`
|
|
13
|
+
* * `C` and `D`: the coefficients of `E1(s,t) = C(s)⋅t + D(s)`
|
|
14
|
+
* * `H`: the eliminated polynomial `A(s)⋅D(s) - B(s)⋅C(s)` whose roots are
|
|
15
|
+
* candidate `s` values for medial points
|
|
16
|
+
*
|
|
17
|
+
* @param p base point
|
|
18
|
+
* @param v ray direction from `p`
|
|
19
|
+
* @param ps cubic bezier control points, i.e. an order 3 bezier curve
|
|
20
|
+
* given as an array of control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
21
|
+
*/
|
|
22
|
+
declare function ddGetMedialPointCoeffsBez3(p: number[][], v: number[][], ps: number[][]): {
|
|
23
|
+
A: number[][];
|
|
24
|
+
B: number[][];
|
|
25
|
+
C: number[][];
|
|
26
|
+
D: number[][];
|
|
27
|
+
H: number[][];
|
|
28
|
+
};
|
|
29
|
+
export { ddGetMedialPointCoeffsBez3 };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { toPowerBasisDd } from 'flo-bezier3';
|
|
2
|
+
import { twoDiff, ddMultDouble2, ddAddDd, ddMultDd, ddNegativeOf, ddMultByNeg2, ddMultBy2, ddDiffDouble } from 'double-double';
|
|
3
|
+
const td = twoDiff;
|
|
4
|
+
const qmd = ddMultDouble2;
|
|
5
|
+
const qaq = ddAddDd;
|
|
6
|
+
const qmq = ddMultDd;
|
|
7
|
+
const qno = ddNegativeOf;
|
|
8
|
+
const qmn2 = ddMultByNeg2;
|
|
9
|
+
const qm2 = ddMultBy2;
|
|
10
|
+
const qdd = ddDiffDouble;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the polynomial coefficients for the ray parameter `t` and the
|
|
13
|
+
* curve parameter `s` that encode the medial condition for `q(t) = p + t⋅v`
|
|
14
|
+
* and a cubic bezier curve `ps`.
|
|
15
|
+
*
|
|
16
|
+
* The returned coefficients describe the equations whose common solutions
|
|
17
|
+
* satisfy:
|
|
18
|
+
* * `q(t)` is equidistant from `p` and the nearest point on `ps`
|
|
19
|
+
* * that common distance is locally minimal among such candidates
|
|
20
|
+
*
|
|
21
|
+
* More specifically, this function returns:
|
|
22
|
+
* * `A` and `B`: the coefficients of `E2(s,t) = A(s)⋅t + B(s)`
|
|
23
|
+
* * `C` and `D`: the coefficients of `E1(s,t) = C(s)⋅t + D(s)`
|
|
24
|
+
* * `H`: the eliminated polynomial `A(s)⋅D(s) - B(s)⋅C(s)` whose roots are
|
|
25
|
+
* candidate `s` values for medial points
|
|
26
|
+
*
|
|
27
|
+
* @param p base point
|
|
28
|
+
* @param v ray direction from `p`
|
|
29
|
+
* @param ps cubic bezier control points, i.e. an order 3 bezier curve
|
|
30
|
+
* given as an array of control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
31
|
+
*/
|
|
32
|
+
function ddGetMedialPointCoeffsBez3(p, v, ps) {
|
|
33
|
+
// -----------------------------------------------------
|
|
34
|
+
// See get-medial-points.md for implementation details.
|
|
35
|
+
// -----------------------------------------------------
|
|
36
|
+
const [px, py] = p;
|
|
37
|
+
const [vx, vy] = v;
|
|
38
|
+
// Cubic bezier in power basis: b(s) = a*s^3 + b*s^2 + c*s + d
|
|
39
|
+
const [[ax, bx, cx, [, dx]], [ay, by, cy, [, dy]]] = toPowerBasisDd(ps);
|
|
40
|
+
// const u0x = px - dx;
|
|
41
|
+
// const u0y = py - dy;
|
|
42
|
+
const u0x = qdd(px, dx);
|
|
43
|
+
const u0y = qdd(py, dy);
|
|
44
|
+
// Reuse dot products across A, B, C, D, and H.
|
|
45
|
+
// const va = vx*ax + vy*ay;
|
|
46
|
+
// const vb = vx*bx + vy*by;
|
|
47
|
+
// const vc = vx*cx + vy*cy;
|
|
48
|
+
// const vu0 = vx*u0x + vy*u0y;
|
|
49
|
+
const va = qaq(qmq(vx, ax), qmq(vy, ay));
|
|
50
|
+
const vb = qaq(qmq(vx, bx), qmq(vy, by));
|
|
51
|
+
const vc = qaq(qmq(vx, cx), qmq(vy, cy));
|
|
52
|
+
const vu0 = qaq(qmq(vx, u0x), qmq(vy, u0y));
|
|
53
|
+
// const b6 = ax*ax + ay*ay;
|
|
54
|
+
// const ab = ax*bx + ay*by;
|
|
55
|
+
// const ac = ax*cx + ay*cy;
|
|
56
|
+
// const bb = bx*bx + by*by;
|
|
57
|
+
// const bc = bx*cx + by*cy;
|
|
58
|
+
// const cc = cx*cx + cy*cy;
|
|
59
|
+
const b6 = qaq(qmq(ax, ax), qmq(ay, ay));
|
|
60
|
+
const ab = qaq(qmq(ax, bx), qmq(ay, by));
|
|
61
|
+
const ac = qaq(qmq(ax, cx), qmq(ay, cy));
|
|
62
|
+
const bb = qaq(qmq(bx, bx), qmq(by, by));
|
|
63
|
+
const bc = qaq(qmq(bx, cx), qmq(by, cy));
|
|
64
|
+
const cc = qaq(qmq(cx, cx), qmq(cy, cy));
|
|
65
|
+
// const au0 = ax*u0x + ay*u0y;
|
|
66
|
+
// const bu0 = bx*u0x + by*u0y;
|
|
67
|
+
// const d0 = cx*u0x + cy*u0y;
|
|
68
|
+
// const b0 = u0x*u0x + u0y*u0y;
|
|
69
|
+
const au0 = qaq(qmq(ax, u0x), qmq(ay, u0y));
|
|
70
|
+
const bu0 = qaq(qmq(bx, u0x), qmq(by, u0y));
|
|
71
|
+
const d0 = qaq(qmq(cx, u0x), qmq(cy, u0y));
|
|
72
|
+
const b0 = qaq(qmq(u0x, u0x), qmq(u0y, u0y));
|
|
73
|
+
// -----------------------------------------------------
|
|
74
|
+
// E1(s,t): (u(s) + t*v) * b'(s) = 0
|
|
75
|
+
// => C(s)*t + D(s) = 0
|
|
76
|
+
// const c2 = 3*va;
|
|
77
|
+
// const c1 = 2*vb;
|
|
78
|
+
// const c0 = vc;
|
|
79
|
+
const c2 = qmd(3, va);
|
|
80
|
+
const c1 = qm2(vb);
|
|
81
|
+
const c0 = vc;
|
|
82
|
+
// -----------------------------------------------------
|
|
83
|
+
// -----------------------------------------------------
|
|
84
|
+
// const d5 = -3*b6;
|
|
85
|
+
// const d4 = -5*ab;
|
|
86
|
+
// const d3 = -4*ac - 2*bb;
|
|
87
|
+
// const d2 = 3*au0 - 3*bc;
|
|
88
|
+
// const d1 = 2*bu0 - cc;
|
|
89
|
+
const d5 = qmd(-3, b6);
|
|
90
|
+
const d4 = qmd(-5, ab);
|
|
91
|
+
const d3 = qaq(qmd(-4, ac), qmn2(bb));
|
|
92
|
+
const d2 = qaq(qmd(3, au0), qmd(-3, bc));
|
|
93
|
+
const d1 = qaq(qm2(bu0), qno(cc));
|
|
94
|
+
// -----------------------------------------------------
|
|
95
|
+
// -----------------------------------------------------
|
|
96
|
+
// E2(s,t): |t*v|^2 - |u(s) + t*v|^2 = 0
|
|
97
|
+
// => 2*(v*u(s))*t + |u(s)|^2 = 0
|
|
98
|
+
// => A(s)*t + B(s) = 0
|
|
99
|
+
// const a3 = -2*va;
|
|
100
|
+
// const a2 = -2*vb;
|
|
101
|
+
// const a1 = -2*vc;
|
|
102
|
+
// const a0 = 2*vu0;
|
|
103
|
+
const a3 = qmn2(va);
|
|
104
|
+
const a2 = qmn2(vb);
|
|
105
|
+
const a1 = qmn2(vc);
|
|
106
|
+
const a0 = qm2(vu0);
|
|
107
|
+
// -----------------------------------------------------
|
|
108
|
+
// -----------------------------------------------------
|
|
109
|
+
// const b5 = 2*ab;
|
|
110
|
+
// const b4 = 2*ac + bb;
|
|
111
|
+
// const b3 = 2*bc - 2*au0;
|
|
112
|
+
// const b2 = cc - 2*bu0;
|
|
113
|
+
// const b1 = -2*d0;
|
|
114
|
+
const b5 = qm2(ab);
|
|
115
|
+
const b4 = qaq(qm2(ac), bb);
|
|
116
|
+
const b3 = qaq(qm2(bc), qmn2(au0));
|
|
117
|
+
const b2 = qaq(cc, qmn2(bu0));
|
|
118
|
+
const b1 = qmn2(d0);
|
|
119
|
+
// -----------------------------------------------------
|
|
120
|
+
// Eliminate t from:
|
|
121
|
+
// A(s)*t + B(s) = 0
|
|
122
|
+
// C(s)*t + D(s) = 0
|
|
123
|
+
// by taking H(s) = A(s)*D(s) - B(s)*C(s) = 0 (degree <= 8 in s).
|
|
124
|
+
// Using:
|
|
125
|
+
// a2 = -c1, a1 = -2*c0,
|
|
126
|
+
// d5 = -3*b6, d4 = -(5/2)*b5, d3 = -2*b4, d2 = -(3/2)*b3,
|
|
127
|
+
// d1 = -b2, d0 = -(1/2)*b1,
|
|
128
|
+
// we can compute H directly with fewer operations.
|
|
129
|
+
// const H8 = 3*va*b6;
|
|
130
|
+
// const H7 = 4*(va*ab + vb*b6);
|
|
131
|
+
// const H6 = va*b4 + 6*vb*ab + 5*vc*b6;
|
|
132
|
+
// const H5 = 2*vb*b4 + 8*vc*ab - 6*vu0*b6;
|
|
133
|
+
// const H4 = -va*b2 + vb*b3 + 3*vc*b4 - 10*vu0*ab;
|
|
134
|
+
// const H3 = -2*va*b1 + 2*vc*b3 - 4*vu0*b4;
|
|
135
|
+
// const H2 = vc*b2 - vb*b1 - 3*vu0*b3 - 3*va*b0;
|
|
136
|
+
// const H1 = -2*vu0*b2 - 2*vb*b0;
|
|
137
|
+
// const H0 = -vu0*b1 - vc*b0;
|
|
138
|
+
const H8 = qmd(3, qmq(va, b6));
|
|
139
|
+
const H7 = qm2(qm2(qaq(qmq(va, ab), qmq(vb, b6))));
|
|
140
|
+
const H6 = qaq(qaq(qmq(va, b4), qmd(6, qmq(vb, ab))), qmd(5, qmq(vc, b6)));
|
|
141
|
+
const H5 = qaq(qaq(qm2(qmq(vb, b4)), qmd(8, qmq(vc, ab))), qno(qmd(6, qmq(vu0, b6))));
|
|
142
|
+
const H4 = qaq(qaq(qno(qmq(va, b2)), qmq(vb, b3)), qaq(qmd(3, qmq(vc, b4)), qno(qmd(10, qmq(vu0, ab)))));
|
|
143
|
+
const H3 = qaq(qaq(qmn2(qmq(va, b1)), qm2(qmq(vc, b3))), qno(qm2(qm2(qmq(vu0, b4)))));
|
|
144
|
+
const H2 = qaq(qaq(qaq(qmq(vc, b2), qno(qmq(vb, b1))), qno(qmd(3, qmq(vu0, b3)))), qno(qmd(3, qmq(va, b0))));
|
|
145
|
+
const H1 = qaq(qmn2(qmq(vu0, b2)), qmn2(qmq(vb, b0)));
|
|
146
|
+
const H0 = qaq(qno(qmq(vu0, b1)), qno(qmq(vc, b0)));
|
|
147
|
+
return {
|
|
148
|
+
A: [a3, a2, a1, a0],
|
|
149
|
+
B: [b6, b5, b4, b3, b2, b1, b0],
|
|
150
|
+
C: [c2, c1, c0],
|
|
151
|
+
D: [d5, d4, d3, d2, d1, d0],
|
|
152
|
+
H: [H8, H7, H6, H5, H4, H3, H2, H1, H0]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export { ddGetMedialPointCoeffsBez3 };
|
|
156
|
+
//# sourceMappingURL=dd-get-medial-point-coeffs-bez3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dd-get-medial-point-coeffs-bez3.js","sourceRoot":"","sources":["../../../src/get-medial-points/double-double/dd-get-medial-point-coeffs-bez3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/H,MAAM,EAAE,GAAG,OAAO,CAAC;AACnB,MAAM,GAAG,GAAG,aAAa,CAAC;AAC1B,MAAM,GAAG,GAAG,OAAO,CAAC;AACpB,MAAM,GAAG,GAAG,QAAQ,CAAC;AACrB,MAAM,GAAG,GAAG,YAAY,CAAC;AACzB,MAAM,IAAI,GAAG,YAAY,CAAC;AAC1B,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,GAAG,GAAG,YAAY,CAAC;AAGzB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,0BAA0B,CAC3B,CAAa,EACb,CAAa,EACb,EAAc;IAElB,wDAAwD;IACxD,uDAAuD;IACvD,wDAAwD;IAExD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAEnB,8DAA8D;IAC9D,MAAM,CAAC,CAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC,EAAC,CAAC,EAAE,EAAC,EAAE,EAAC,EAAE,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;IAE/D,uBAAuB;IACvB,uBAAuB;IACvB,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC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,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QACnB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QACf,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QAC3B,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;KAC1C,CAAC;AACN,CAAC;AAGD,OAAO,EAAE,0BAA0B,EAAE,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns polynomial coefficients for ray parameter values `t`, bezier
|
|
3
|
+
* parameter values `s` and medial points for points `q(t)` and b(s) (an order
|
|
4
|
+
* 0, 1, 2 or 3 bezier curve) that satisfy the medial condition with respect to `p` and `ps`:
|
|
5
|
+
*
|
|
6
|
+
* Let `p` be a fixed point in the plane.
|
|
7
|
+
* Let `v` be a direction vector defining the ray `q(t) = p + t⋅v`.
|
|
8
|
+
* Let `ps` be a cubic bezier curve.
|
|
9
|
+
*
|
|
10
|
+
* * `q(t)` is equidistant from `p` and the nearest point on `ps`
|
|
11
|
+
* * that common distance is locally minimal among such candidates
|
|
12
|
+
*
|
|
13
|
+
* In other words, this function returns candidate ray parameters for the
|
|
14
|
+
* sought medial point(s). Selecting physically valid solutions (if needed)
|
|
15
|
+
* is done by the caller or by a later stage of this routine.
|
|
16
|
+
*
|
|
17
|
+
* @param p base point
|
|
18
|
+
* @param v ray direction from `p`
|
|
19
|
+
* @param ps bezier control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
20
|
+
*/
|
|
21
|
+
declare function ddGetMedialPointCoeffs(p: number[][], v: number[][], ps: number[][]): {
|
|
22
|
+
A: number[][];
|
|
23
|
+
B: number[][];
|
|
24
|
+
C: number[][];
|
|
25
|
+
D: number[][];
|
|
26
|
+
H: number[][];
|
|
27
|
+
};
|
|
28
|
+
export { ddGetMedialPointCoeffs };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ddGetMedialPointCoeffsBez2 } from './dd-get-medial-point-coeffs-bez2.js';
|
|
2
|
+
import { ddGetMedialPointCoeffsBez1 } from './dd-get-medial-point-coeffs-bez1.js';
|
|
3
|
+
import { ddGetMedialPointCoeffsBez3 } from './dd-get-medial-point-coeffs-bez3.js';
|
|
4
|
+
import { ddGetMedialPointCoeffsBez0 } from './dd-get-medial-point-coeffs-bez0.js';
|
|
5
|
+
const getMedialPointCoeffss = [
|
|
6
|
+
,
|
|
7
|
+
,
|
|
8
|
+
ddGetMedialPointCoeffsBez1,
|
|
9
|
+
ddGetMedialPointCoeffsBez2,
|
|
10
|
+
ddGetMedialPointCoeffsBez3
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Returns polynomial coefficients for ray parameter values `t`, bezier
|
|
14
|
+
* parameter values `s` and medial points for points `q(t)` and b(s) (an order
|
|
15
|
+
* 0, 1, 2 or 3 bezier curve) that satisfy the medial condition with respect to `p` and `ps`:
|
|
16
|
+
*
|
|
17
|
+
* Let `p` be a fixed point in the plane.
|
|
18
|
+
* Let `v` be a direction vector defining the ray `q(t) = p + t⋅v`.
|
|
19
|
+
* Let `ps` be a cubic bezier curve.
|
|
20
|
+
*
|
|
21
|
+
* * `q(t)` is equidistant from `p` and the nearest point on `ps`
|
|
22
|
+
* * that common distance is locally minimal among such candidates
|
|
23
|
+
*
|
|
24
|
+
* In other words, this function returns candidate ray parameters for the
|
|
25
|
+
* sought medial point(s). Selecting physically valid solutions (if needed)
|
|
26
|
+
* is done by the caller or by a later stage of this routine.
|
|
27
|
+
*
|
|
28
|
+
* @param p base point
|
|
29
|
+
* @param v ray direction from `p`
|
|
30
|
+
* @param ps bezier control points, e.g. `[[0,0],[1,1],[2,1],[3,0]]`
|
|
31
|
+
*/
|
|
32
|
+
function ddGetMedialPointCoeffs(p, v, ps) {
|
|
33
|
+
if (ps.length === 1) {
|
|
34
|
+
const { a0, b0 } = ddGetMedialPointCoeffsBez0(p, v, ps[0]);
|
|
35
|
+
return { A: [a0], B: [b0], C: [], D: [], H: [] };
|
|
36
|
+
}
|
|
37
|
+
return getMedialPointCoeffss[ps.length](p, v, ps);
|
|
38
|
+
}
|
|
39
|
+
export { ddGetMedialPointCoeffs };
|
|
40
|
+
//# sourceMappingURL=dd-get-medial-point-coeffs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dd-get-medial-point-coeffs.js","sourceRoot":"","sources":["../../../src/get-medial-points/double-double/dd-get-medial-point-coeffs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,MAAM,qBAAqB,GAAG;IAC1B,AAD2B;IAC1B;IACD,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;CAC7B,CAAC;AAGF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,sBAAsB,CACvB,CAAa,EACb,CAAa,EACb,EAAc;IAElB,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,0BAA0B,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,qBAAqB,CAAC,EAAE,CAAC,MAAM,CAAE,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAGD,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
|
package/node/index.d.ts
CHANGED
|
@@ -6,13 +6,9 @@ export type { CpNode } from './cp-node/cp-node.js';
|
|
|
6
6
|
export type { PointOnShape } from './point-on-shape/point-on-shape.js';
|
|
7
7
|
export type { Circle } from './geometry/circle.js';
|
|
8
8
|
export type { CurvePiece } from './mat/curve-piece.js';
|
|
9
|
-
export type {
|
|
10
|
-
export type { ITiming } from './debug/debug.js';
|
|
11
|
-
export type { DebugElems } from './debug/debug-elem-types.js';
|
|
9
|
+
export type { Timing } from './debug/debug.js';
|
|
12
10
|
export type { Debug } from './debug/debug.js';
|
|
13
|
-
export type { DebugElemKey } from './debug/debug-elem-types.js';
|
|
14
11
|
export type { MatOptions } from './find-mat/mat-options.js';
|
|
15
|
-
export { drawBeziersAsSinglePath } from './debug/functions/draw/draw-beziers-as-single-path.js';
|
|
16
12
|
export { floydWarshall } from './floyd-warshall/floyd-warshall.js';
|
|
17
13
|
export { CpNodeFs } from './cp-node/cp-node-fs.js';
|
|
18
14
|
export { isVertexSpecial } from './cp-node/fs/is-vertex-special.js';
|
|
@@ -21,13 +17,9 @@ export { trimMat } from './mat/trim-mat.js';
|
|
|
21
17
|
export { toScaleAxis } from './sat/to-scale-axis.js';
|
|
22
18
|
export { getBranches } from './mat/get-branches.js';
|
|
23
19
|
export { enableDebugForMat } from './debug/debug.js';
|
|
24
|
-
export { drawBranch } from './debug/functions/draw-elem/draw-branch.js';
|
|
25
|
-
export { drawMat } from './debug/functions/draw-elem/draw-mat.js';
|
|
26
|
-
export { debugElemNames, emptyDebugElems } from './debug/debug-elem-types.js';
|
|
27
20
|
export { getShapeBounds } from './svg/get-shape-bounds.js';
|
|
28
21
|
export { getBoundaryPieceBeziers } from './mat/get-boundary-piece-beziers.js';
|
|
29
22
|
export { simplifyMat } from './mat/simplify-mat.js';
|
|
30
|
-
export { drawElemFs, drawElemFsDetailed } from './debug/functions/draw-elem/draw-elem.js';
|
|
31
23
|
export { sweepLine } from './sweep-line/sweep-line.js';
|
|
32
24
|
export { getClosestSquareDistanceToRect } from './geometry/get-closest-square-distance-to-rect.js';
|
|
33
25
|
export { getImpliedBoundaryBezierBetween } from './cp-node/fs/get-implied-boundary-bezier-between.js';
|
|
@@ -39,8 +31,10 @@ export { getSharpCornersOnLoop } from './find-mat/get-sharp-corners.js';
|
|
|
39
31
|
export { getFor2ProngsOnLoop } from './find-mat/get-for-2-prongs-on-loop.js';
|
|
40
32
|
export { getPotentialClosestPointsOnCurveCertified } from './closest-boundary-point/get-potential-closest-points-on-curve-certified.js';
|
|
41
33
|
export { getCloseBoundaryPointsCertified } from './closest-boundary-point/get-close-boundary-points-certified.js';
|
|
42
|
-
export { getPartialMeta
|
|
34
|
+
export { getPartialMeta } from './find-mat/get-meta.js';
|
|
43
35
|
export { findAndAddHoleClosing2Prongs } from './find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
36
|
+
export { reconstructFromMats } from './reconstruct-from-mat/reconstruct-from-mat.js';
|
|
37
|
+
export { getOsculatingCircle } from './point-on-shape/get-osculating-circle.js';
|
|
44
38
|
export { getChildren } from './cp-node/fs/get-children.js';
|
|
45
39
|
export { getVertexForwardChildren } from './cp-node/fs/get-vertex-forward-children.js';
|
|
46
40
|
export { getAllOnLoop } from './cp-node/fs/get-all-on-loop.js';
|
|
@@ -76,3 +70,5 @@ export { getInitialDegAngleBetweenMatCurves } from './cp-node/fs/get-angle-betwe
|
|
|
76
70
|
export { getAllVertices } from './cp-node/fs/get-all-vertices.js';
|
|
77
71
|
export { isTrivial } from './cp-node/fs/is-trivial.js';
|
|
78
72
|
export { scaleCircle } from './geometry/circle.js';
|
|
73
|
+
export { isOnSameLoop } from './cp-node/fs/is-on-same-loop.js';
|
|
74
|
+
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { loopFromBeziers, beziersToSvgPathStr, getPathsFromStr } from 'flo-boolean';
|
|
2
|
-
export { drawBeziersAsSinglePath } from './debug/functions/draw/draw-beziers-as-single-path.js';
|
|
3
2
|
export { floydWarshall } from './floyd-warshall/floyd-warshall.js';
|
|
4
3
|
export { CpNodeFs } from './cp-node/cp-node-fs.js';
|
|
5
4
|
export { isVertexSpecial } from './cp-node/fs/is-vertex-special.js';
|
|
@@ -8,13 +7,9 @@ export { trimMat } from './mat/trim-mat.js';
|
|
|
8
7
|
export { toScaleAxis } from './sat/to-scale-axis.js';
|
|
9
8
|
export { getBranches } from './mat/get-branches.js';
|
|
10
9
|
export { enableDebugForMat } from './debug/debug.js';
|
|
11
|
-
export { drawBranch } from './debug/functions/draw-elem/draw-branch.js';
|
|
12
|
-
export { drawMat } from './debug/functions/draw-elem/draw-mat.js';
|
|
13
|
-
export { debugElemNames, emptyDebugElems } from './debug/debug-elem-types.js';
|
|
14
10
|
export { getShapeBounds } from './svg/get-shape-bounds.js';
|
|
15
11
|
export { getBoundaryPieceBeziers } from './mat/get-boundary-piece-beziers.js';
|
|
16
12
|
export { simplifyMat } from './mat/simplify-mat.js';
|
|
17
|
-
export { drawElemFs, drawElemFsDetailed } from './debug/functions/draw-elem/draw-elem.js';
|
|
18
13
|
export { sweepLine } from './sweep-line/sweep-line.js';
|
|
19
14
|
export { getClosestSquareDistanceToRect } from './geometry/get-closest-square-distance-to-rect.js';
|
|
20
15
|
export { getImpliedBoundaryBezierBetween } from './cp-node/fs/get-implied-boundary-bezier-between.js';
|
|
@@ -26,8 +21,10 @@ export { getSharpCornersOnLoop } from './find-mat/get-sharp-corners.js';
|
|
|
26
21
|
export { getFor2ProngsOnLoop } from './find-mat/get-for-2-prongs-on-loop.js';
|
|
27
22
|
export { getPotentialClosestPointsOnCurveCertified } from './closest-boundary-point/get-potential-closest-points-on-curve-certified.js';
|
|
28
23
|
export { getCloseBoundaryPointsCertified } from './closest-boundary-point/get-close-boundary-points-certified.js';
|
|
29
|
-
export { getPartialMeta
|
|
24
|
+
export { getPartialMeta } from './find-mat/get-meta.js';
|
|
30
25
|
export { findAndAddHoleClosing2Prongs } from './find-2-prong/find-and-add-hole-closing-2-prongs.js';
|
|
26
|
+
export { reconstructFromMats } from './reconstruct-from-mat/reconstruct-from-mat.js';
|
|
27
|
+
export { getOsculatingCircle } from './point-on-shape/get-osculating-circle.js';
|
|
31
28
|
// CpNodeFs functions
|
|
32
29
|
export { getChildren } from './cp-node/fs/get-children.js';
|
|
33
30
|
export { getVertexForwardChildren } from './cp-node/fs/get-vertex-forward-children.js';
|
|
@@ -64,4 +61,6 @@ export { getInitialDegAngleBetweenMatCurves } from './cp-node/fs/get-angle-betwe
|
|
|
64
61
|
export { getAllVertices } from './cp-node/fs/get-all-vertices.js';
|
|
65
62
|
export { isTrivial } from './cp-node/fs/is-trivial.js';
|
|
66
63
|
export { scaleCircle } from './geometry/circle.js';
|
|
64
|
+
export { isOnSameLoop } from './cp-node/fs/is-on-same-loop.js';
|
|
65
|
+
export { getAllOnLoop_ByLoop } from './cp-node/fs/get-all-on-loop-by-loop.js';
|
|
67
66
|
//# sourceMappingURL=index.js.map
|
package/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAYpF,OAAO,E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AAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -23,6 +23,8 @@ interface PrePointOnShape {
|
|
|
23
23
|
readonly isSource: boolean;
|
|
24
24
|
/** The (cached) point on the shape boundary. */
|
|
25
25
|
readonly p: number[];
|
|
26
|
+
/** The (cached) double-double precision point on the shape boundary. */
|
|
27
|
+
readonly pDd: number[][];
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
30
|
* Represents a point on the shape boundary, including the `curve` it belongs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-p.js","sourceRoot":"","sources":["../../src/point-on-shape/to-p.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD;;;;;;GAMG;AACH,SAAS,GAAG,CACJ,EAAc,EACd,CAAS;IAEb,OAAO,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"to-p.js","sourceRoot":"","sources":["../../src/point-on-shape/to-p.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD;;;;;;GAMG;AACH,SAAS,GAAG,CACJ,EAAc,EACd,CAAS;IAEb,OAAO,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC;AAGD,OAAO,EAAE,GAAG,EAAE,CAAA"}
|