@antv/util 3.0.2 → 3.1.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/README.md +167 -4
- package/dist/util.min.js +1 -1
- package/esm/color/arr2rgb.js +3 -3
- package/esm/color/arr2rgb.js.map +1 -1
- package/esm/color/gradient.js +9 -9
- package/esm/color/gradient.js.map +1 -1
- package/esm/color/tocssgradient.js +18 -18
- package/esm/color/tocssgradient.js.map +1 -1
- package/esm/color/torgb.js +6 -6
- package/esm/color/torgb.js.map +1 -1
- package/esm/helper/to-radian.js +1 -1
- package/esm/helper/to-radian.js.map +1 -1
- package/esm/matrix/index.js +8 -8
- package/esm/matrix/index.js.map +1 -1
- package/esm/path/convert/path-2-absolute.d.ts +2 -0
- package/esm/path/convert/path-2-absolute.js +83 -0
- package/esm/path/convert/path-2-absolute.js.map +1 -0
- package/esm/path/convert/path-2-curve.d.ts +2 -0
- package/esm/path/convert/path-2-curve.js +56 -0
- package/esm/path/convert/path-2-curve.js.map +1 -0
- package/esm/path/convert/path-2-string.d.ts +6 -0
- package/esm/path/convert/path-2-string.js +11 -0
- package/esm/path/convert/path-2-string.js.map +1 -0
- package/esm/path/index.d.ts +17 -16
- package/esm/path/index.js +17 -16
- package/esm/path/index.js.map +1 -1
- package/esm/path/parser/finalize-segment.d.ts +5 -0
- package/esm/path/parser/finalize-segment.js +27 -0
- package/esm/path/parser/finalize-segment.js.map +1 -0
- package/esm/path/parser/is-arc-command.d.ts +4 -0
- package/esm/path/parser/is-arc-command.js +7 -0
- package/esm/path/parser/is-arc-command.js.map +1 -0
- package/esm/path/parser/is-digit-start.d.ts +6 -0
- package/esm/path/parser/is-digit-start.js +11 -0
- package/esm/path/parser/is-digit-start.js.map +1 -0
- package/esm/path/parser/is-path-command.d.ts +4 -0
- package/esm/path/parser/is-path-command.js +23 -0
- package/esm/path/parser/is-path-command.js.map +1 -0
- package/esm/path/parser/is-space.d.ts +4 -0
- package/esm/path/parser/is-space.js +22 -0
- package/esm/path/parser/is-space.js.map +1 -0
- package/esm/path/parser/params-count.d.ts +13 -0
- package/esm/path/parser/params-count.js +14 -0
- package/esm/path/parser/params-count.js.map +1 -0
- package/esm/path/parser/params-parser.d.ts +10 -0
- package/esm/path/parser/params-parser.js +11 -0
- package/esm/path/parser/params-parser.js.map +1 -0
- package/esm/path/parser/parse-path-string.d.ts +6 -0
- package/esm/path/parser/parse-path-string.js +21 -0
- package/esm/path/parser/parse-path-string.js.map +1 -0
- package/esm/path/parser/path-parser.d.ts +16 -0
- package/esm/path/parser/path-parser.js +18 -0
- package/esm/path/parser/path-parser.js.map +1 -0
- package/esm/path/parser/scan-flag.d.ts +6 -0
- package/esm/path/parser/scan-flag.js +20 -0
- package/esm/path/parser/scan-flag.js.map +1 -0
- package/esm/path/parser/scan-param.d.ts +6 -0
- package/esm/path/parser/scan-param.js +83 -0
- package/esm/path/parser/scan-param.js.map +1 -0
- package/esm/path/parser/scan-segment.d.ts +6 -0
- package/esm/path/parser/scan-segment.js +57 -0
- package/esm/path/parser/scan-segment.js.map +1 -0
- package/esm/path/parser/skip-spaces.d.ts +7 -0
- package/esm/path/parser/skip-spaces.js +13 -0
- package/esm/path/parser/skip-spaces.js.map +1 -0
- package/esm/path/process/arc-2-cubic.d.ts +7 -1
- package/esm/path/process/arc-2-cubic.js +276 -133
- package/esm/path/process/arc-2-cubic.js.map +1 -1
- package/esm/path/process/clone-path.d.ts +2 -0
- package/esm/path/process/clone-path.js +4 -0
- package/esm/path/process/clone-path.js.map +1 -0
- package/esm/path/process/fix-arc.d.ts +2 -0
- package/esm/path/process/fix-arc.js +16 -0
- package/esm/path/process/fix-arc.js.map +1 -0
- package/esm/path/process/line-2-cubic.js +17 -32
- package/esm/path/process/line-2-cubic.js.map +1 -1
- package/esm/path/process/normalize-path.d.ts +8 -0
- package/esm/path/process/normalize-path.js +35 -0
- package/esm/path/process/normalize-path.js.map +1 -0
- package/esm/path/process/normalize-segment.d.ts +6 -0
- package/esm/path/process/normalize-segment.js +42 -0
- package/esm/path/process/normalize-segment.js.map +1 -0
- package/esm/path/process/quad-2-cubic.js +2 -2
- package/esm/path/process/quad-2-cubic.js.map +1 -1
- package/esm/path/process/reverse-curve.d.ts +2 -0
- package/esm/path/process/reverse-curve.js +13 -0
- package/esm/path/process/reverse-curve.js.map +1 -0
- package/esm/path/process/round-path.d.ts +6 -0
- package/esm/path/process/round-path.js +20 -0
- package/esm/path/process/round-path.js.map +1 -0
- package/esm/path/process/segment-2-cubic.d.ts +2 -2
- package/esm/path/process/segment-2-cubic.js +23 -19
- package/esm/path/process/segment-2-cubic.js.map +1 -1
- package/esm/path/types.d.ts +114 -17
- package/esm/path/util/distance-square-root.d.ts +1 -0
- package/esm/path/util/distance-square-root.js +4 -0
- package/esm/path/util/distance-square-root.js.map +1 -0
- package/esm/path/util/equalize-segments.d.ts +2 -0
- package/esm/path/util/equalize-segments.js +68 -0
- package/esm/path/util/equalize-segments.js.map +1 -0
- package/esm/path/util/get-draw-direction.d.ts +2 -0
- package/esm/path/util/get-draw-direction.js +5 -0
- package/esm/path/util/get-draw-direction.js.map +1 -0
- package/esm/path/util/get-path-area.d.ts +8 -0
- package/esm/path/util/get-path-area.js +68 -0
- package/esm/path/util/get-path-area.js.map +1 -0
- package/esm/path/util/get-path-bbox-total-length.d.ts +5 -0
- package/esm/path/util/get-path-bbox-total-length.js +37 -0
- package/esm/path/util/get-path-bbox-total-length.js.map +1 -0
- package/esm/path/util/get-path-bbox.d.ts +5 -0
- package/esm/path/util/get-path-bbox.js +35 -0
- package/esm/path/util/get-path-bbox.js.map +1 -0
- package/esm/path/util/get-point-at-length.d.ts +5 -0
- package/esm/path/util/get-point-at-length.js +8 -0
- package/esm/path/util/get-point-at-length.js.map +1 -0
- package/esm/path/util/get-properties-at-length.d.ts +6 -0
- package/esm/path/util/get-properties-at-length.js +58 -0
- package/esm/path/util/get-properties-at-length.js.map +1 -0
- package/esm/path/util/get-properties-at-point.d.ts +7 -0
- package/esm/path/util/get-properties-at-point.js +69 -0
- package/esm/path/util/get-properties-at-point.js.map +1 -0
- package/esm/path/util/get-rotated-curve.d.ts +2 -0
- package/esm/path/util/get-rotated-curve.js +34 -0
- package/esm/path/util/get-rotated-curve.js.map +1 -0
- package/esm/path/util/get-total-length.d.ts +8 -0
- package/esm/path/util/get-total-length.js +11 -0
- package/esm/path/util/get-total-length.js.map +1 -0
- package/esm/path/util/is-absolute-array.d.ts +6 -0
- package/esm/path/util/is-absolute-array.js +11 -0
- package/esm/path/util/is-absolute-array.js.map +1 -0
- package/esm/path/util/is-curve-array.d.ts +9 -0
- package/esm/path/util/is-curve-array.js +12 -0
- package/esm/path/util/is-curve-array.js.map +1 -0
- package/esm/path/util/is-normalized-array.d.ts +7 -0
- package/esm/path/util/is-normalized-array.js +10 -0
- package/esm/path/util/is-normalized-array.js.map +1 -0
- package/esm/path/util/is-path-array.d.ts +5 -0
- package/esm/path/util/is-path-array.js +12 -0
- package/esm/path/util/is-path-array.js.map +1 -0
- package/esm/path/util/is-point-in-stroke.d.ts +5 -0
- package/esm/path/util/is-point-in-stroke.js +9 -0
- package/esm/path/util/is-point-in-stroke.js.map +1 -0
- package/esm/path/util/mid-point.d.ts +1 -0
- package/esm/path/util/mid-point.js +8 -0
- package/esm/path/util/mid-point.js.map +1 -0
- package/esm/path/util/path-length-factory.d.ts +7 -0
- package/esm/path/util/path-length-factory.js +94 -0
- package/esm/path/util/path-length-factory.js.map +1 -0
- package/esm/path/util/rotate-vector.d.ts +4 -0
- package/esm/path/util/rotate-vector.js +6 -0
- package/esm/path/util/rotate-vector.js.map +1 -0
- package/esm/path/util/segment-arc-factory.d.ts +6 -0
- package/esm/path/util/segment-arc-factory.js +135 -0
- package/esm/path/util/segment-arc-factory.js.map +1 -0
- package/esm/path/util/segment-cubic-factory.d.ts +6 -0
- package/esm/path/util/segment-cubic-factory.js +63 -0
- package/esm/path/util/segment-cubic-factory.js.map +1 -0
- package/esm/path/util/segment-line-factory.d.ts +6 -0
- package/esm/path/util/segment-line-factory.js +35 -0
- package/esm/path/util/segment-line-factory.js.map +1 -0
- package/esm/path/util/segment-quad-factory.d.ts +6 -0
- package/esm/path/util/segment-quad-factory.js +65 -0
- package/esm/path/util/segment-quad-factory.js.map +1 -0
- package/lib/color/arr2rgb.js +3 -3
- package/lib/color/arr2rgb.js.map +1 -1
- package/lib/color/gradient.js +12 -12
- package/lib/color/gradient.js.map +1 -1
- package/lib/color/tocssgradient.js +18 -18
- package/lib/color/tocssgradient.js.map +1 -1
- package/lib/color/torgb.js +7 -7
- package/lib/color/torgb.js.map +1 -1
- package/lib/helper/to-radian.js +1 -1
- package/lib/helper/to-radian.js.map +1 -1
- package/lib/matrix/index.js +9 -9
- package/lib/matrix/index.js.map +1 -1
- package/lib/path/convert/path-2-absolute.d.ts +2 -0
- package/lib/path/convert/path-2-absolute.js +87 -0
- package/lib/path/convert/path-2-absolute.js.map +1 -0
- package/lib/path/convert/path-2-curve.d.ts +2 -0
- package/lib/path/convert/path-2-curve.js +60 -0
- package/lib/path/convert/path-2-curve.js.map +1 -0
- package/lib/path/convert/path-2-string.d.ts +6 -0
- package/lib/path/convert/path-2-string.js +15 -0
- package/lib/path/convert/path-2-string.js.map +1 -0
- package/lib/path/index.d.ts +17 -16
- package/lib/path/index.js +42 -31
- package/lib/path/index.js.map +1 -1
- package/lib/path/parser/finalize-segment.d.ts +5 -0
- package/lib/path/parser/finalize-segment.js +31 -0
- package/lib/path/parser/finalize-segment.js.map +1 -0
- package/lib/path/parser/is-arc-command.d.ts +4 -0
- package/lib/path/parser/is-arc-command.js +11 -0
- package/lib/path/parser/is-arc-command.js.map +1 -0
- package/lib/path/parser/is-digit-start.d.ts +6 -0
- package/lib/path/parser/is-digit-start.js +16 -0
- package/lib/path/parser/is-digit-start.js.map +1 -0
- package/lib/path/parser/is-path-command.d.ts +4 -0
- package/lib/path/parser/is-path-command.js +27 -0
- package/lib/path/parser/is-path-command.js.map +1 -0
- package/lib/path/parser/is-space.d.ts +4 -0
- package/lib/path/parser/is-space.js +26 -0
- package/lib/path/parser/is-space.js.map +1 -0
- package/lib/path/parser/params-count.d.ts +13 -0
- package/lib/path/parser/params-count.js +17 -0
- package/lib/path/parser/params-count.js.map +1 -0
- package/lib/path/parser/params-parser.d.ts +10 -0
- package/lib/path/parser/params-parser.js +14 -0
- package/lib/path/parser/params-parser.js.map +1 -0
- package/lib/path/parser/parse-path-string.d.ts +6 -0
- package/lib/path/parser/parse-path-string.js +25 -0
- package/lib/path/parser/parse-path-string.js.map +1 -0
- package/lib/path/parser/path-parser.d.ts +16 -0
- package/lib/path/parser/path-parser.js +22 -0
- package/lib/path/parser/path-parser.js.map +1 -0
- package/lib/path/parser/scan-flag.d.ts +6 -0
- package/lib/path/parser/scan-flag.js +24 -0
- package/lib/path/parser/scan-flag.js.map +1 -0
- package/lib/path/parser/scan-param.d.ts +6 -0
- package/lib/path/parser/scan-param.js +87 -0
- package/lib/path/parser/scan-param.js.map +1 -0
- package/lib/path/parser/scan-segment.d.ts +6 -0
- package/lib/path/parser/scan-segment.js +61 -0
- package/lib/path/parser/scan-segment.js.map +1 -0
- package/lib/path/parser/skip-spaces.d.ts +7 -0
- package/lib/path/parser/skip-spaces.js +17 -0
- package/lib/path/parser/skip-spaces.js.map +1 -0
- package/lib/path/process/arc-2-cubic.d.ts +7 -1
- package/lib/path/process/arc-2-cubic.js +276 -133
- package/lib/path/process/arc-2-cubic.js.map +1 -1
- package/lib/path/process/clone-path.d.ts +2 -0
- package/lib/path/process/clone-path.js +8 -0
- package/lib/path/process/clone-path.js.map +1 -0
- package/lib/path/process/fix-arc.d.ts +2 -0
- package/lib/path/process/fix-arc.js +20 -0
- package/lib/path/process/fix-arc.js.map +1 -0
- package/lib/path/process/line-2-cubic.js +17 -32
- package/lib/path/process/line-2-cubic.js.map +1 -1
- package/lib/path/process/normalize-path.d.ts +8 -0
- package/lib/path/process/normalize-path.js +39 -0
- package/lib/path/process/normalize-path.js.map +1 -0
- package/lib/path/process/normalize-segment.d.ts +6 -0
- package/lib/path/process/normalize-segment.js +46 -0
- package/lib/path/process/normalize-segment.js.map +1 -0
- package/lib/path/process/quad-2-cubic.js +2 -2
- package/lib/path/process/quad-2-cubic.js.map +1 -1
- package/lib/path/process/reverse-curve.d.ts +2 -0
- package/lib/path/process/reverse-curve.js +17 -0
- package/lib/path/process/reverse-curve.js.map +1 -0
- package/lib/path/process/round-path.d.ts +6 -0
- package/lib/path/process/round-path.js +24 -0
- package/lib/path/process/round-path.js.map +1 -0
- package/lib/path/process/segment-2-cubic.d.ts +2 -2
- package/lib/path/process/segment-2-cubic.js +26 -22
- package/lib/path/process/segment-2-cubic.js.map +1 -1
- package/lib/path/types.d.ts +114 -17
- package/lib/path/util/distance-square-root.d.ts +1 -0
- package/lib/path/util/distance-square-root.js +8 -0
- package/lib/path/util/distance-square-root.js.map +1 -0
- package/lib/path/util/equalize-segments.d.ts +2 -0
- package/lib/path/util/equalize-segments.js +72 -0
- package/lib/path/util/equalize-segments.js.map +1 -0
- package/lib/path/util/get-draw-direction.d.ts +2 -0
- package/lib/path/util/get-draw-direction.js +9 -0
- package/lib/path/util/get-draw-direction.js.map +1 -0
- package/lib/path/util/get-path-area.d.ts +8 -0
- package/lib/path/util/get-path-area.js +72 -0
- package/lib/path/util/get-path-area.js.map +1 -0
- package/lib/path/util/get-path-bbox-total-length.d.ts +5 -0
- package/lib/path/util/get-path-bbox-total-length.js +41 -0
- package/lib/path/util/get-path-bbox-total-length.js.map +1 -0
- package/lib/path/util/get-path-bbox.d.ts +5 -0
- package/lib/path/util/get-path-bbox.js +39 -0
- package/lib/path/util/get-path-bbox.js.map +1 -0
- package/lib/path/util/get-point-at-length.d.ts +5 -0
- package/lib/path/util/get-point-at-length.js +12 -0
- package/lib/path/util/get-point-at-length.js.map +1 -0
- package/lib/path/util/get-properties-at-length.d.ts +6 -0
- package/lib/path/util/get-properties-at-length.js +62 -0
- package/lib/path/util/get-properties-at-length.js.map +1 -0
- package/lib/path/util/get-properties-at-point.d.ts +7 -0
- package/lib/path/util/get-properties-at-point.js +73 -0
- package/lib/path/util/get-properties-at-point.js.map +1 -0
- package/lib/path/util/get-rotated-curve.d.ts +2 -0
- package/lib/path/util/get-rotated-curve.js +38 -0
- package/lib/path/util/get-rotated-curve.js.map +1 -0
- package/lib/path/util/get-total-length.d.ts +8 -0
- package/lib/path/util/get-total-length.js +15 -0
- package/lib/path/util/get-total-length.js.map +1 -0
- package/lib/path/util/is-absolute-array.d.ts +6 -0
- package/lib/path/util/is-absolute-array.js +15 -0
- package/lib/path/util/is-absolute-array.js.map +1 -0
- package/lib/path/util/is-curve-array.d.ts +9 -0
- package/lib/path/util/is-curve-array.js +16 -0
- package/lib/path/util/is-curve-array.js.map +1 -0
- package/lib/path/util/is-normalized-array.d.ts +7 -0
- package/lib/path/util/is-normalized-array.js +14 -0
- package/lib/path/util/is-normalized-array.js.map +1 -0
- package/lib/path/util/is-path-array.d.ts +5 -0
- package/lib/path/util/is-path-array.js +16 -0
- package/lib/path/util/is-path-array.js.map +1 -0
- package/lib/path/util/is-point-in-stroke.d.ts +5 -0
- package/lib/path/util/is-point-in-stroke.js +13 -0
- package/lib/path/util/is-point-in-stroke.js.map +1 -0
- package/lib/path/util/mid-point.d.ts +1 -0
- package/lib/path/util/mid-point.js +12 -0
- package/lib/path/util/mid-point.js.map +1 -0
- package/lib/path/util/path-length-factory.d.ts +7 -0
- package/lib/path/util/path-length-factory.js +98 -0
- package/lib/path/util/path-length-factory.js.map +1 -0
- package/lib/path/util/rotate-vector.d.ts +4 -0
- package/lib/path/util/rotate-vector.js +10 -0
- package/lib/path/util/rotate-vector.js.map +1 -0
- package/lib/path/util/segment-arc-factory.d.ts +6 -0
- package/lib/path/util/segment-arc-factory.js +139 -0
- package/lib/path/util/segment-arc-factory.js.map +1 -0
- package/lib/path/util/segment-cubic-factory.d.ts +6 -0
- package/lib/path/util/segment-cubic-factory.js +67 -0
- package/lib/path/util/segment-cubic-factory.js.map +1 -0
- package/lib/path/util/segment-line-factory.d.ts +6 -0
- package/lib/path/util/segment-line-factory.js +39 -0
- package/lib/path/util/segment-line-factory.js.map +1 -0
- package/lib/path/util/segment-quad-factory.d.ts +6 -0
- package/lib/path/util/segment-quad-factory.js +69 -0
- package/lib/path/util/segment-quad-factory.js.map +1 -0
- package/package.json +1 -1
- package/src/path/convert/path-2-absolute.ts +90 -0
- package/src/path/convert/path-2-curve.ts +68 -0
- package/src/path/convert/path-2-string.ts +12 -0
- package/src/path/index.ts +18 -16
- package/src/path/parser/finalize-segment.ts +30 -0
- package/src/path/parser/is-arc-command.ts +6 -0
- package/src/path/parser/is-digit-start.ts +13 -0
- package/src/path/parser/is-path-command.ts +22 -0
- package/src/path/parser/is-space.ts +23 -0
- package/src/path/parser/params-count.ts +13 -0
- package/src/path/parser/params-parser.ts +10 -0
- package/src/path/parser/parse-path-string.ts +26 -0
- package/src/path/parser/path-parser.ts +35 -0
- package/src/path/parser/scan-flag.ts +24 -0
- package/src/path/parser/scan-param.ts +98 -0
- package/src/path/parser/scan-segment.ts +68 -0
- package/src/path/parser/skip-spaces.ts +14 -0
- package/src/path/process/arc-2-cubic.ts +332 -215
- package/src/path/process/clone-path.ts +5 -0
- package/src/path/process/fix-arc.ts +17 -0
- package/src/path/process/line-2-cubic.ts +17 -33
- package/src/path/process/normalize-path.ts +42 -0
- package/src/path/process/normalize-segment.ts +42 -0
- package/src/path/process/reverse-curve.ts +18 -0
- package/src/path/process/round-path.ts +22 -0
- package/src/path/process/segment-2-cubic.ts +28 -27
- package/src/path/types.ts +190 -17
- package/src/path/util/distance-square-root.ts +3 -0
- package/src/path/util/equalize-segments.ts +79 -0
- package/src/path/util/get-draw-direction.ts +6 -0
- package/src/path/util/get-path-area.ts +83 -0
- package/src/path/util/get-path-bbox-total-length.ts +45 -0
- package/src/path/util/get-path-bbox.ts +42 -0
- package/src/path/util/get-point-at-length.ts +9 -0
- package/src/path/util/get-properties-at-length.ts +65 -0
- package/src/path/util/get-properties-at-point.ts +73 -0
- package/src/path/util/get-rotated-curve.ts +42 -0
- package/src/path/util/get-total-length.ts +12 -0
- package/src/path/util/is-absolute-array.ts +14 -0
- package/src/path/util/is-curve-array.ts +13 -0
- package/src/path/util/is-normalized-array.ts +11 -0
- package/src/path/util/is-path-array.ts +15 -0
- package/src/path/util/is-point-in-stroke.ts +10 -0
- package/src/path/util/mid-point.ts +7 -0
- package/src/path/util/path-length-factory.ts +98 -0
- package/src/path/util/rotate-vector.ts +5 -0
- package/src/path/util/segment-arc-factory.ts +186 -0
- package/src/path/util/segment-cubic-factory.ts +92 -0
- package/src/path/util/segment-line-factory.ts +36 -0
- package/src/path/util/segment-quad-factory.ts +90 -0
- package/esm/path/catmull-rom-2-bezier.d.ts +0 -10
- package/esm/path/catmull-rom-2-bezier.js +0 -115
- package/esm/path/catmull-rom-2-bezier.js.map +0 -1
- package/esm/path/fill-path-by-diff.d.ts +0 -5
- package/esm/path/fill-path-by-diff.js +0 -110
- package/esm/path/fill-path-by-diff.js.map +0 -1
- package/esm/path/fill-path.d.ts +0 -1
- package/esm/path/fill-path.js +0 -129
- package/esm/path/fill-path.js.map +0 -1
- package/esm/path/format-path.d.ts +0 -1
- package/esm/path/format-path.js +0 -139
- package/esm/path/format-path.js.map +0 -1
- package/esm/path/get-arc-params.d.ts +0 -17
- package/esm/path/get-arc-params.js +0 -90
- package/esm/path/get-arc-params.js.map +0 -1
- package/esm/path/get-line-intersect.d.ts +0 -14
- package/esm/path/get-line-intersect.js +0 -33
- package/esm/path/get-line-intersect.js.map +0 -1
- package/esm/path/is-polygons-intersect.d.ts +0 -1
- package/esm/path/is-polygons-intersect.js +0 -81
- package/esm/path/is-polygons-intersect.js.map +0 -1
- package/esm/path/parse-path-array.d.ts +0 -1
- package/esm/path/parse-path-array.js +0 -5
- package/esm/path/parse-path-array.js.map +0 -1
- package/esm/path/parse-path-string.d.ts +0 -1
- package/esm/path/parse-path-string.js +0 -61
- package/esm/path/parse-path-string.js.map +0 -1
- package/esm/path/parse-path.d.ts +0 -1
- package/esm/path/parse-path.js +0 -33
- package/esm/path/parse-path.js.map +0 -1
- package/esm/path/path-2-absolute.d.ts +0 -1
- package/esm/path/path-2-absolute.js +0 -124
- package/esm/path/path-2-absolute.js.map +0 -1
- package/esm/path/path-2-curve.d.ts +0 -2
- package/esm/path/path-2-curve.js +0 -63
- package/esm/path/path-2-curve.js.map +0 -1
- package/esm/path/path-2-segments.d.ts +0 -1
- package/esm/path/path-2-segments.js +0 -138
- package/esm/path/path-2-segments.js.map +0 -1
- package/esm/path/path-intersection.d.ts +0 -9
- package/esm/path/path-intersection.js +0 -366
- package/esm/path/path-intersection.js.map +0 -1
- package/esm/path/point-in-polygon.d.ts +0 -5
- package/esm/path/point-in-polygon.js +0 -49
- package/esm/path/point-in-polygon.js.map +0 -1
- package/esm/path/rect-path.d.ts +0 -4
- package/esm/path/rect-path.js +0 -19
- package/esm/path/rect-path.js.map +0 -1
- package/lib/path/catmull-rom-2-bezier.d.ts +0 -10
- package/lib/path/catmull-rom-2-bezier.js +0 -119
- package/lib/path/catmull-rom-2-bezier.js.map +0 -1
- package/lib/path/fill-path-by-diff.d.ts +0 -5
- package/lib/path/fill-path-by-diff.js +0 -117
- package/lib/path/fill-path-by-diff.js.map +0 -1
- package/lib/path/fill-path.d.ts +0 -1
- package/lib/path/fill-path.js +0 -133
- package/lib/path/fill-path.js.map +0 -1
- package/lib/path/format-path.d.ts +0 -1
- package/lib/path/format-path.js +0 -143
- package/lib/path/format-path.js.map +0 -1
- package/lib/path/get-arc-params.d.ts +0 -17
- package/lib/path/get-arc-params.js +0 -95
- package/lib/path/get-arc-params.js.map +0 -1
- package/lib/path/get-line-intersect.d.ts +0 -14
- package/lib/path/get-line-intersect.js +0 -37
- package/lib/path/get-line-intersect.js.map +0 -1
- package/lib/path/is-polygons-intersect.d.ts +0 -1
- package/lib/path/is-polygons-intersect.js +0 -85
- package/lib/path/is-polygons-intersect.js.map +0 -1
- package/lib/path/parse-path-array.d.ts +0 -1
- package/lib/path/parse-path-array.js +0 -9
- package/lib/path/parse-path-array.js.map +0 -1
- package/lib/path/parse-path-string.d.ts +0 -1
- package/lib/path/parse-path-string.js +0 -65
- package/lib/path/parse-path-string.js.map +0 -1
- package/lib/path/parse-path.d.ts +0 -1
- package/lib/path/parse-path.js +0 -37
- package/lib/path/parse-path.js.map +0 -1
- package/lib/path/path-2-absolute.d.ts +0 -1
- package/lib/path/path-2-absolute.js +0 -128
- package/lib/path/path-2-absolute.js.map +0 -1
- package/lib/path/path-2-curve.d.ts +0 -2
- package/lib/path/path-2-curve.js +0 -67
- package/lib/path/path-2-curve.js.map +0 -1
- package/lib/path/path-2-segments.d.ts +0 -1
- package/lib/path/path-2-segments.js +0 -142
- package/lib/path/path-2-segments.js.map +0 -1
- package/lib/path/path-intersection.d.ts +0 -9
- package/lib/path/path-intersection.js +0 -370
- package/lib/path/path-intersection.js.map +0 -1
- package/lib/path/point-in-polygon.d.ts +0 -5
- package/lib/path/point-in-polygon.js +0 -53
- package/lib/path/point-in-polygon.js.map +0 -1
- package/lib/path/rect-path.d.ts +0 -4
- package/lib/path/rect-path.js +0 -23
- package/lib/path/rect-path.js.map +0 -1
- package/src/path/catmull-rom-2-bezier.ts +0 -141
- package/src/path/fill-path-by-diff.ts +0 -116
- package/src/path/fill-path.ts +0 -129
- package/src/path/format-path.ts +0 -142
- package/src/path/get-arc-params.ts +0 -102
- package/src/path/get-line-intersect.ts +0 -46
- package/src/path/is-polygons-intersect.ts +0 -95
- package/src/path/parse-path-array.ts +0 -5
- package/src/path/parse-path-string.ts +0 -62
- package/src/path/parse-path.ts +0 -34
- package/src/path/path-2-absolute.ts +0 -132
- package/src/path/path-2-curve.ts +0 -69
- package/src/path/path-2-segments.ts +0 -142
- package/src/path/path-intersection.ts +0 -419
- package/src/path/point-in-polygon.ts +0 -56
- package/src/path/rect-path.ts +0 -22
|
@@ -1,144 +1,287 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.arcToCubic = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
4
|
+
const rotate_vector_1 = require("../util/rotate-vector");
|
|
5
|
+
/**
|
|
6
|
+
* Converts A (arc-to) segments to C (cubic-bezier-to).
|
|
7
|
+
*
|
|
8
|
+
* For more information of where this math came from visit:
|
|
9
|
+
* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
|
10
|
+
*/
|
|
11
|
+
function arcToCubic(X1, Y1, RX, RY, angle, LAF, SF, X2, Y2, recursive) {
|
|
12
|
+
let x1 = X1;
|
|
13
|
+
let y1 = Y1;
|
|
14
|
+
let rx = RX;
|
|
15
|
+
let ry = RY;
|
|
16
|
+
let x2 = X2;
|
|
17
|
+
let y2 = Y2;
|
|
18
|
+
// for more information of where this Math came from visit:
|
|
19
|
+
// http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
|
20
|
+
const d120 = (Math.PI * 120) / 180;
|
|
21
|
+
const rad = (Math.PI / 180) * (+angle || 0);
|
|
22
|
+
/** @type {number[]} */
|
|
23
|
+
let res = [];
|
|
24
|
+
let xy;
|
|
25
|
+
let f1;
|
|
26
|
+
let f2;
|
|
27
|
+
let cx;
|
|
28
|
+
let cy;
|
|
29
|
+
if (!recursive) {
|
|
30
|
+
xy = (0, rotate_vector_1.rotateVector)(x1, y1, -rad);
|
|
31
|
+
x1 = xy.x;
|
|
32
|
+
y1 = xy.y;
|
|
33
|
+
xy = (0, rotate_vector_1.rotateVector)(x2, y2, -rad);
|
|
34
|
+
x2 = xy.x;
|
|
35
|
+
y2 = xy.y;
|
|
36
|
+
const x = (x1 - x2) / 2;
|
|
37
|
+
const y = (y1 - y2) / 2;
|
|
38
|
+
let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);
|
|
39
|
+
if (h > 1) {
|
|
40
|
+
h = Math.sqrt(h);
|
|
41
|
+
rx *= h;
|
|
42
|
+
ry *= h;
|
|
43
|
+
}
|
|
44
|
+
const rx2 = rx * rx;
|
|
45
|
+
const ry2 = ry * ry;
|
|
46
|
+
const k = (LAF === SF ? -1 : 1) *
|
|
47
|
+
Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
|
|
48
|
+
cx = (k * rx * y) / ry + (x1 + x2) / 2;
|
|
49
|
+
cy = (k * -ry * x) / rx + (y1 + y2) / 2;
|
|
50
|
+
// eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise
|
|
51
|
+
f1 = Math.asin(((((y1 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9));
|
|
52
|
+
// eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise
|
|
53
|
+
f2 = Math.asin(((((y2 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9));
|
|
54
|
+
f1 = x1 < cx ? Math.PI - f1 : f1;
|
|
55
|
+
f2 = x2 < cx ? Math.PI - f2 : f2;
|
|
56
|
+
if (f1 < 0)
|
|
57
|
+
f1 = Math.PI * 2 + f1;
|
|
58
|
+
if (f2 < 0)
|
|
59
|
+
f2 = Math.PI * 2 + f2;
|
|
60
|
+
if (SF && f1 > f2) {
|
|
61
|
+
f1 -= Math.PI * 2;
|
|
62
|
+
}
|
|
63
|
+
if (!SF && f2 > f1) {
|
|
64
|
+
f2 -= Math.PI * 2;
|
|
65
|
+
}
|
|
48
66
|
}
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
else {
|
|
68
|
+
[f1, f2, cx, cy] = recursive;
|
|
51
69
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
radicant = 0;
|
|
70
|
+
let df = f2 - f1;
|
|
71
|
+
if (Math.abs(df) > d120) {
|
|
72
|
+
const f2old = f2;
|
|
73
|
+
const x2old = x2;
|
|
74
|
+
const y2old = y2;
|
|
75
|
+
f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);
|
|
76
|
+
x2 = cx + rx * Math.cos(f2);
|
|
77
|
+
y2 = cy + ry * Math.sin(f2);
|
|
78
|
+
res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);
|
|
62
79
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
df = f2 - f1;
|
|
81
|
+
const c1 = Math.cos(f1);
|
|
82
|
+
const s1 = Math.sin(f1);
|
|
83
|
+
const c2 = Math.cos(f2);
|
|
84
|
+
const s2 = Math.sin(f2);
|
|
85
|
+
const t = Math.tan(df / 4);
|
|
86
|
+
const hx = (4 / 3) * rx * t;
|
|
87
|
+
const hy = (4 / 3) * ry * t;
|
|
88
|
+
const m1 = [x1, y1];
|
|
89
|
+
const m2 = [x1 + hx * s1, y1 - hy * c1];
|
|
90
|
+
const m3 = [x2 + hx * s2, y2 - hy * c2];
|
|
91
|
+
const m4 = [x2, y2];
|
|
92
|
+
m2[0] = 2 * m1[0] - m2[0];
|
|
93
|
+
m2[1] = 2 * m1[1] - m2[1];
|
|
94
|
+
if (recursive) {
|
|
95
|
+
return [...m2, ...m3, ...m4, ...res];
|
|
77
96
|
}
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
res = [...m2, ...m3, ...m4, ...res];
|
|
98
|
+
const newres = [];
|
|
99
|
+
for (let i = 0, ii = res.length; i < ii; i += 1) {
|
|
100
|
+
newres[i] = i % 2 ? (0, rotate_vector_1.rotateVector)(res[i - 1], res[i], rad).y : (0, rotate_vector_1.rotateVector)(res[i], res[i + 1], rad).x;
|
|
80
101
|
}
|
|
81
|
-
return
|
|
82
|
-
};
|
|
83
|
-
var arcToBezier = function (_a) {
|
|
84
|
-
var px = _a.px, py = _a.py, cx = _a.cx, cy = _a.cy, rx = _a.rx, ry = _a.ry, _b = _a.xAxisRotation, xAxisRotation = _b === void 0 ? 0 : _b, _c = _a.largeArcFlag, largeArcFlag = _c === void 0 ? 0 : _c, _d = _a.sweepFlag, sweepFlag = _d === void 0 ? 0 : _d;
|
|
85
|
-
var curves = [];
|
|
86
|
-
if (rx === 0 || ry === 0) {
|
|
87
|
-
return [{ x1: 0, y1: 0, x2: 0, y2: 0, x: cx, y: cy }];
|
|
88
|
-
}
|
|
89
|
-
var sinphi = Math.sin((xAxisRotation * TAU) / 360);
|
|
90
|
-
var cosphi = Math.cos((xAxisRotation * TAU) / 360);
|
|
91
|
-
var pxp = (cosphi * (px - cx)) / 2 + (sinphi * (py - cy)) / 2;
|
|
92
|
-
var pyp = (-sinphi * (px - cx)) / 2 + (cosphi * (py - cy)) / 2;
|
|
93
|
-
if (pxp === 0 && pyp === 0) {
|
|
94
|
-
return [{ x1: 0, y1: 0, x2: 0, y2: 0, x: cx, y: cy }];
|
|
95
|
-
}
|
|
96
|
-
rx = Math.abs(rx);
|
|
97
|
-
ry = Math.abs(ry);
|
|
98
|
-
var lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);
|
|
99
|
-
if (lambda > 1) {
|
|
100
|
-
rx *= Math.sqrt(lambda);
|
|
101
|
-
ry *= Math.sqrt(lambda);
|
|
102
|
-
}
|
|
103
|
-
var _e = getArcCenter(px, py, cx, cy, rx, ry, largeArcFlag, sweepFlag, sinphi, cosphi, pxp, pyp), centerx = _e[0], centery = _e[1], ang1 = _e[2], ang2 = _e[3];
|
|
104
|
-
// If 'ang2' == 90.0000000001, then `ratio` will evaluate to
|
|
105
|
-
// 1.0000000001. This causes `segments` to be greater than one, which is an
|
|
106
|
-
// unecessary split, and adds extra points to the bezier curve. To alleviate
|
|
107
|
-
// this issue, we round to 1.0 when the ratio is close to 1.0.
|
|
108
|
-
var ratio = Math.abs(ang2) / (TAU / 4);
|
|
109
|
-
if (Math.abs(1.0 - ratio) < 0.0000001) {
|
|
110
|
-
ratio = 1.0;
|
|
111
|
-
}
|
|
112
|
-
var segments = Math.max(Math.ceil(ratio), 1);
|
|
113
|
-
ang2 /= segments;
|
|
114
|
-
for (var i = 0; i < segments; i++) {
|
|
115
|
-
curves.push(approxUnitArc(ang1, ang2));
|
|
116
|
-
ang1 += ang2;
|
|
117
|
-
}
|
|
118
|
-
return curves.map(function (curve) {
|
|
119
|
-
var _a = mapToEllipse(curve[0], rx, ry, cosphi, sinphi, centerx, centery), x1 = _a.x, y1 = _a.y;
|
|
120
|
-
var _b = mapToEllipse(curve[1], rx, ry, cosphi, sinphi, centerx, centery), x2 = _b.x, y2 = _b.y;
|
|
121
|
-
var _c = mapToEllipse(curve[2], rx, ry, cosphi, sinphi, centerx, centery), x = _c.x, y = _c.y;
|
|
122
|
-
return { x1: x1, y1: y1, x2: x2, y2: y2, x: x, y: y };
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
function arcToCubic(x1, y1, rx, ry, angle, LAF, SF, x2, y2) {
|
|
126
|
-
var curves = arcToBezier({
|
|
127
|
-
px: x1,
|
|
128
|
-
py: y1,
|
|
129
|
-
cx: x2,
|
|
130
|
-
cy: y2,
|
|
131
|
-
rx: rx,
|
|
132
|
-
ry: ry,
|
|
133
|
-
xAxisRotation: angle,
|
|
134
|
-
largeArcFlag: LAF,
|
|
135
|
-
sweepFlag: SF,
|
|
136
|
-
});
|
|
137
|
-
return curves.reduce(function (prev, cur) {
|
|
138
|
-
var x1 = cur.x1, y1 = cur.y1, x2 = cur.x2, y2 = cur.y2, x = cur.x, y = cur.y;
|
|
139
|
-
prev.push(x1, y1, x2, y2, x, y);
|
|
140
|
-
return prev;
|
|
141
|
-
}, []);
|
|
102
|
+
return newres;
|
|
142
103
|
}
|
|
143
104
|
exports.arcToCubic = arcToCubic;
|
|
105
|
+
// const TAU = Math.PI * 2;
|
|
106
|
+
// const mapToEllipse = (
|
|
107
|
+
// { x, y }: { x: number; y: number },
|
|
108
|
+
// rx: number,
|
|
109
|
+
// ry: number,
|
|
110
|
+
// cosphi: number,
|
|
111
|
+
// sinphi: number,
|
|
112
|
+
// centerx: number,
|
|
113
|
+
// centery: number,
|
|
114
|
+
// ) => {
|
|
115
|
+
// x *= rx;
|
|
116
|
+
// y *= ry;
|
|
117
|
+
// const xp = cosphi * x - sinphi * y;
|
|
118
|
+
// const yp = sinphi * x + cosphi * y;
|
|
119
|
+
// return {
|
|
120
|
+
// x: xp + centerx,
|
|
121
|
+
// y: yp + centery,
|
|
122
|
+
// };
|
|
123
|
+
// };
|
|
124
|
+
// const approxUnitArc = (ang1: number, ang2: number) => {
|
|
125
|
+
// // If 90 degree circular arc, use a constant
|
|
126
|
+
// // as derived from http://spencermortensen.com/articles/bezier-circle
|
|
127
|
+
// const a =
|
|
128
|
+
// ang2 === 1.5707963267948966
|
|
129
|
+
// ? 0.551915024494
|
|
130
|
+
// : ang2 === -1.5707963267948966
|
|
131
|
+
// ? -0.551915024494
|
|
132
|
+
// : (4 / 3) * Math.tan(ang2 / 4);
|
|
133
|
+
// const x1 = Math.cos(ang1);
|
|
134
|
+
// const y1 = Math.sin(ang1);
|
|
135
|
+
// const x2 = Math.cos(ang1 + ang2);
|
|
136
|
+
// const y2 = Math.sin(ang1 + ang2);
|
|
137
|
+
// return [
|
|
138
|
+
// {
|
|
139
|
+
// x: x1 - y1 * a,
|
|
140
|
+
// y: y1 + x1 * a,
|
|
141
|
+
// },
|
|
142
|
+
// {
|
|
143
|
+
// x: x2 + y2 * a,
|
|
144
|
+
// y: y2 - x2 * a,
|
|
145
|
+
// },
|
|
146
|
+
// {
|
|
147
|
+
// x: x2,
|
|
148
|
+
// y: y2,
|
|
149
|
+
// },
|
|
150
|
+
// ];
|
|
151
|
+
// };
|
|
152
|
+
// const vectorAngle = (ux: number, uy: number, vx: number, vy: number) => {
|
|
153
|
+
// const sign = ux * vy - uy * vx < 0 ? -1 : 1;
|
|
154
|
+
// let dot = ux * vx + uy * vy;
|
|
155
|
+
// if (dot > 1) {
|
|
156
|
+
// dot = 1;
|
|
157
|
+
// }
|
|
158
|
+
// if (dot < -1) {
|
|
159
|
+
// dot = -1;
|
|
160
|
+
// }
|
|
161
|
+
// return sign * Math.acos(dot);
|
|
162
|
+
// };
|
|
163
|
+
// const getArcCenter = (
|
|
164
|
+
// px: any,
|
|
165
|
+
// py: any,
|
|
166
|
+
// cx: any,
|
|
167
|
+
// cy: any,
|
|
168
|
+
// rx: number,
|
|
169
|
+
// ry: number,
|
|
170
|
+
// largeArcFlag: number,
|
|
171
|
+
// sweepFlag: number,
|
|
172
|
+
// sinphi: number,
|
|
173
|
+
// cosphi: number,
|
|
174
|
+
// pxp: number,
|
|
175
|
+
// pyp: number,
|
|
176
|
+
// ) => {
|
|
177
|
+
// const rxsq = Math.pow(rx, 2);
|
|
178
|
+
// const rysq = Math.pow(ry, 2);
|
|
179
|
+
// const pxpsq = Math.pow(pxp, 2);
|
|
180
|
+
// const pypsq = Math.pow(pyp, 2);
|
|
181
|
+
// let radicant = rxsq * rysq - rxsq * pypsq - rysq * pxpsq;
|
|
182
|
+
// if (radicant < 0) {
|
|
183
|
+
// radicant = 0;
|
|
184
|
+
// }
|
|
185
|
+
// radicant /= rxsq * pypsq + rysq * pxpsq;
|
|
186
|
+
// radicant = Math.sqrt(radicant) * (largeArcFlag === sweepFlag ? -1 : 1);
|
|
187
|
+
// const centerxp = ((radicant * rx) / ry) * pyp;
|
|
188
|
+
// const centeryp = ((radicant * -ry) / rx) * pxp;
|
|
189
|
+
// const centerx = cosphi * centerxp - sinphi * centeryp + (px + cx) / 2;
|
|
190
|
+
// const centery = sinphi * centerxp + cosphi * centeryp + (py + cy) / 2;
|
|
191
|
+
// const vx1 = (pxp - centerxp) / rx;
|
|
192
|
+
// const vy1 = (pyp - centeryp) / ry;
|
|
193
|
+
// const vx2 = (-pxp - centerxp) / rx;
|
|
194
|
+
// const vy2 = (-pyp - centeryp) / ry;
|
|
195
|
+
// const ang1 = vectorAngle(1, 0, vx1, vy1);
|
|
196
|
+
// let ang2 = vectorAngle(vx1, vy1, vx2, vy2);
|
|
197
|
+
// if (sweepFlag === 0 && ang2 > 0) {
|
|
198
|
+
// ang2 -= TAU;
|
|
199
|
+
// }
|
|
200
|
+
// if (sweepFlag === 1 && ang2 < 0) {
|
|
201
|
+
// ang2 += TAU;
|
|
202
|
+
// }
|
|
203
|
+
// return [centerx, centery, ang1, ang2];
|
|
204
|
+
// };
|
|
205
|
+
// const arcToBezier = ({ px, py, cx, cy, rx, ry, xAxisRotation = 0, largeArcFlag = 0, sweepFlag = 0 }) => {
|
|
206
|
+
// const curves = [];
|
|
207
|
+
// if (rx === 0 || ry === 0) {
|
|
208
|
+
// return [{ x1: 0, y1: 0, x2: 0, y2: 0, x: cx, y: cy }];
|
|
209
|
+
// }
|
|
210
|
+
// const sinphi = Math.sin((xAxisRotation * TAU) / 360);
|
|
211
|
+
// const cosphi = Math.cos((xAxisRotation * TAU) / 360);
|
|
212
|
+
// const pxp = (cosphi * (px - cx)) / 2 + (sinphi * (py - cy)) / 2;
|
|
213
|
+
// const pyp = (-sinphi * (px - cx)) / 2 + (cosphi * (py - cy)) / 2;
|
|
214
|
+
// if (pxp === 0 && pyp === 0) {
|
|
215
|
+
// return [{ x1: 0, y1: 0, x2: 0, y2: 0, x: cx, y: cy }];
|
|
216
|
+
// }
|
|
217
|
+
// rx = Math.abs(rx);
|
|
218
|
+
// ry = Math.abs(ry);
|
|
219
|
+
// const lambda = Math.pow(pxp, 2) / Math.pow(rx, 2) + Math.pow(pyp, 2) / Math.pow(ry, 2);
|
|
220
|
+
// if (lambda > 1) {
|
|
221
|
+
// rx *= Math.sqrt(lambda);
|
|
222
|
+
// ry *= Math.sqrt(lambda);
|
|
223
|
+
// }
|
|
224
|
+
// let [centerx, centery, ang1, ang2] = getArcCenter(
|
|
225
|
+
// px,
|
|
226
|
+
// py,
|
|
227
|
+
// cx,
|
|
228
|
+
// cy,
|
|
229
|
+
// rx,
|
|
230
|
+
// ry,
|
|
231
|
+
// largeArcFlag,
|
|
232
|
+
// sweepFlag,
|
|
233
|
+
// sinphi,
|
|
234
|
+
// cosphi,
|
|
235
|
+
// pxp,
|
|
236
|
+
// pyp,
|
|
237
|
+
// );
|
|
238
|
+
// // If 'ang2' == 90.0000000001, then `ratio` will evaluate to
|
|
239
|
+
// // 1.0000000001. This causes `segments` to be greater than one, which is an
|
|
240
|
+
// // unecessary split, and adds extra points to the bezier curve. To alleviate
|
|
241
|
+
// // this issue, we round to 1.0 when the ratio is close to 1.0.
|
|
242
|
+
// let ratio = Math.abs(ang2) / (TAU / 4);
|
|
243
|
+
// if (Math.abs(1.0 - ratio) < 0.0000001) {
|
|
244
|
+
// ratio = 1.0;
|
|
245
|
+
// }
|
|
246
|
+
// const segments = Math.max(Math.ceil(ratio), 1);
|
|
247
|
+
// ang2 /= segments;
|
|
248
|
+
// for (let i = 0; i < segments; i++) {
|
|
249
|
+
// curves.push(approxUnitArc(ang1, ang2));
|
|
250
|
+
// ang1 += ang2;
|
|
251
|
+
// }
|
|
252
|
+
// return curves.map((curve) => {
|
|
253
|
+
// const { x: x1, y: y1 } = mapToEllipse(curve[0], rx, ry, cosphi, sinphi, centerx, centery);
|
|
254
|
+
// const { x: x2, y: y2 } = mapToEllipse(curve[1], rx, ry, cosphi, sinphi, centerx, centery);
|
|
255
|
+
// const { x, y } = mapToEllipse(curve[2], rx, ry, cosphi, sinphi, centerx, centery);
|
|
256
|
+
// return { x1, y1, x2, y2, x, y };
|
|
257
|
+
// });
|
|
258
|
+
// };
|
|
259
|
+
// export function arcToCubic(
|
|
260
|
+
// x1: number,
|
|
261
|
+
// y1: number,
|
|
262
|
+
// rx: number,
|
|
263
|
+
// ry: number,
|
|
264
|
+
// angle: number,
|
|
265
|
+
// LAF: number,
|
|
266
|
+
// SF: number,
|
|
267
|
+
// x2: number,
|
|
268
|
+
// y2: number,
|
|
269
|
+
// ) {
|
|
270
|
+
// const curves = arcToBezier({
|
|
271
|
+
// px: x1,
|
|
272
|
+
// py: y1,
|
|
273
|
+
// cx: x2,
|
|
274
|
+
// cy: y2,
|
|
275
|
+
// rx,
|
|
276
|
+
// ry,
|
|
277
|
+
// xAxisRotation: angle,
|
|
278
|
+
// largeArcFlag: LAF,
|
|
279
|
+
// sweepFlag: SF,
|
|
280
|
+
// });
|
|
281
|
+
// return curves.reduce((prev, cur) => {
|
|
282
|
+
// const { x1, y1, x2, y2, x, y } = cur;
|
|
283
|
+
// prev.push(x1, y1, x2, y2, x, y);
|
|
284
|
+
// return prev;
|
|
285
|
+
// }, [] as number[]);
|
|
286
|
+
// }
|
|
144
287
|
//# sourceMappingURL=arc-2-cubic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc-2-cubic.js","sourceRoot":"src/","sources":["path/process/arc-2-cubic.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"arc-2-cubic.js","sourceRoot":"src/","sources":["path/process/arc-2-cubic.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AAErD;;;;;GAKG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xB,IAAI"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clonePath = void 0;
|
|
4
|
+
function clonePath(path) {
|
|
5
|
+
return path.map((x) => (Array.isArray(x) ? [...x] : x));
|
|
6
|
+
}
|
|
7
|
+
exports.clonePath = clonePath;
|
|
8
|
+
//# sourceMappingURL=clone-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone-path.js","sourceRoot":"src/","sources":["path/process/clone-path.ts"],"names":[],"mappings":";;;AAEA,SAAgB,SAAS,CAAC,IAA6B;IACrD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAc,CAAC;AACvE,CAAC;AAFD,8BAEC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixArc = void 0;
|
|
4
|
+
function fixArc(pathArray, allPathCommands, i) {
|
|
5
|
+
if (pathArray[i].length > 7) {
|
|
6
|
+
pathArray[i].shift();
|
|
7
|
+
const pi = pathArray[i];
|
|
8
|
+
// const ni = i + 1;
|
|
9
|
+
let ni = i;
|
|
10
|
+
while (pi.length) {
|
|
11
|
+
// if created multiple C:s, their original seg is saved
|
|
12
|
+
allPathCommands[i] = 'A';
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
pathArray.splice((ni += 1), 0, ['C'].concat(pi.splice(0, 6)));
|
|
15
|
+
}
|
|
16
|
+
pathArray.splice(i, 1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.fixArc = fixArc;
|
|
20
|
+
//# sourceMappingURL=fix-arc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-arc.js","sourceRoot":"src/","sources":["path/process/fix-arc.ts"],"names":[],"mappings":";;;AAEA,SAAgB,MAAM,CAAC,SAAoB,EAAE,eAAyB,EAAE,CAAS;IAC/E,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QACxB,oBAAoB;QACpB,IAAI,EAAE,GAAG,CAAC,CAAC;QACX,OAAO,EAAE,CAAC,MAAM,EAAE;YAChB,uDAAuD;YACvD,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACzB,aAAa;YACb,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/D;QACD,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACxB;AACH,CAAC;AAdD,wBAcC"}
|
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// export function getPointAtSegLength(p1x: number, p1y: number, c1x: number, c1y: number, c2x: number, c2y: number, p2x: number, p2y: number, t: number) {
|
|
3
|
-
// const t1 = 1 - t;
|
|
4
|
-
// return {
|
|
5
|
-
// x: (t1 ** 3) * p1x
|
|
6
|
-
// + t1 * t1 * 3 * t * c1x
|
|
7
|
-
// + t1 * 3 * t * t * c2x
|
|
8
|
-
// + (t ** 3) * p2x,
|
|
9
|
-
// y: (t1 ** 3) * p1y
|
|
10
|
-
// + t1 * t1 * 3 * t * c1y
|
|
11
|
-
// + t1 * 3 * t * t * c2y
|
|
12
|
-
// + (t ** 3) * p2y,
|
|
13
|
-
// };
|
|
14
|
-
// }
|
|
15
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.lineToCubic = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// const ay = a[1];
|
|
20
|
-
// const bx = b[0];
|
|
21
|
-
// const by = b[1];
|
|
22
|
-
// return [ax + (bx - ax) * t, ay + (by - ay) * t];
|
|
23
|
-
// }
|
|
4
|
+
const segment_line_factory_1 = require("../util/segment-line-factory");
|
|
5
|
+
const mid_point_1 = require("../util/mid-point");
|
|
24
6
|
function lineToCubic(x1, y1, x2, y2) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
const t = 0.5;
|
|
8
|
+
const p0 = [x1, y1];
|
|
9
|
+
const p1 = [x2, y2];
|
|
10
|
+
const p2 = (0, mid_point_1.midPoint)(p0, p1, t);
|
|
11
|
+
const p3 = (0, mid_point_1.midPoint)(p1, p2, t);
|
|
12
|
+
const p4 = (0, mid_point_1.midPoint)(p2, p3, t);
|
|
13
|
+
const p5 = (0, mid_point_1.midPoint)(p3, p4, t);
|
|
14
|
+
const p6 = (0, mid_point_1.midPoint)(p4, p5, t);
|
|
15
|
+
const seg1 = [...p0, ...p2, ...p4, ...p6, t];
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
const cp1 = (0, segment_line_factory_1.segmentLineFactory)(...seg1).point;
|
|
18
|
+
const seg2 = [...p6, ...p5, ...p3, ...p1, 0];
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
const cp2 = (0, segment_line_factory_1.segmentLineFactory)(...seg2).point;
|
|
21
|
+
return [cp1.x, cp1.y, cp2.x, cp2.y, x2, y2];
|
|
37
22
|
}
|
|
38
23
|
exports.lineToCubic = lineToCubic;
|
|
39
24
|
//# sourceMappingURL=line-2-cubic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-2-cubic.js","sourceRoot":"src/","sources":["path/process/line-2-cubic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"line-2-cubic.js","sourceRoot":"src/","sources":["path/process/line-2-cubic.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAClE,iDAA6C;AAE7C,SAAgB,WAAW,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;IACxE,MAAM,CAAC,GAAG,GAAG,CAAC;IACd,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACpB,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7C,aAAa;IACb,MAAM,GAAG,GAAG,IAAA,yCAAkB,EAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC;IAC9C,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7C,aAAa;IACb,MAAM,GAAG,GAAG,IAAA,yCAAkB,EAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAjBD,kCAiBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PathArray, NormalArray } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* const path = 'M0 0 H50';
|
|
5
|
+
* const normalizedPath = SVGPathCommander.normalizePath(path);
|
|
6
|
+
* // result => [['M', 0, 0], ['L', 50, 0]]
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePath(pathInput: string | PathArray): NormalArray;
|