How to smooth a freehand drawn SVG path?

后端 未结 3 885
暗喜
暗喜 2021-01-31 10:59

I am looking for a solution to convert a freehand, user drawn SVG path, consisting of lots auf LineTo segments, into a smoother one.

Preferred language would be JavaScri

3条回答
  •  [愿得一人]
    2021-01-31 11:50

    i'm with the same problem, looking at paperjs examples i saw that they have one example for path simplification, lurking the algorithm behind it you can see it here: https://github.com/paperjs/paper.js/blob/master/src/path/PathFitter.js

    It's the algorithm that simplify the path witch is a js version (with optimizations) of a academic study named "An algorithm for automatically fitting digitized curves".

    I'm on the works of extracting this algorithm only and will probably publich it as a plugin to svg.js.

提交回复
热议问题