fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
28.72k stars 3.49k forks source link

Curve Fitting Support #2383

Open kaelumania opened 9 years ago

kaelumania commented 9 years ago

Are there any plan or current features that can be used to implement curve fitting?

asturur commented 9 years ago

curve fitting for what?

kaelumania commented 9 years ago

For drawing a shape (e.g. line) by hand and afterwards approximating the curve/line with bezier curves/segments. In order to finally flatten and simplifying this approximation to have a low memory footprint.

kangax commented 9 years ago

It's a good feature to add at some point in the future. Should be fairly straightforward to plug in at the moment when we create fabric.Path's on mouse up in free drawing mode.

Sent from my iPhone

On 03 Aug 2015, at 07:45, Stephan E. notifications@github.com wrote:

For drawing a shape (e.g. line) by hand and afterwards approximating the curve/line with bezier curves/segments. In order to finally flatten and simplifying this approximation to have a low memory footprint.

— Reply to this email directly or view it on GitHub.

kaelumania commented 9 years ago

could you give some further details, hints and examples how to implement this feature?

kangax commented 9 years ago

Take a look at where "path:created" event is fired in the repo to see what's going on there.

Sent from my iPhone

On 03 Aug 2015, at 08:50, Stephan E. notifications@github.com wrote:

could you give some further details, hints and examples how to implement this feature?

— Reply to this email directly or view it on GitHub.

iamappmaker commented 4 years ago

Need example for this. Currently i am using paperjs to import svg and edit its path using bezier curve, then importing output to fabricjs. All the work done in fabric only but i have to use paperjs for editing paths

ShaMan123 commented 2 years ago

cleanup: does decimatePoints cover this?

asturur commented 2 years ago

a bit. Not entirely. A curve fitting would create a smart beizer from many segments, we just reduce the segments