Giter Club home page Giter Club logo

Comments (6)

lehni avatar lehni commented on May 30, 2024 1

I think you're talking of different types of curve-fitting here: @soswow's link is to a port of Philip J. Schneider's algorithm that tries to put as few curves as possible through a list of points with an allowed maximum error. We have this same algorithm in Paper.js too (with some added tweaks), exposed through Path#simplify(): https://github.com/paperjs/paper.js/blob/develop/src/path/PathFitter.js
You can see the code in action here: http://paperjs.org/examples/path-simplification/

The fitting of catmull-rom splines is what we offer under Path#smooth(): It creates a smooth path by adjusting the handles of the curves using different methods (catmull-rom being one of them), but without changing the amounts of segments / curves in a path.

Both approaches are useful in different situations, e.g. curve-fitting can be used to process the point data received from a pointing device.

from bezierjs.

Pomax avatar Pomax commented on May 30, 2024

Good point, I forgot I hadn't ported Catmull-Rom to bezier.js yet.

from bezierjs.

soswow avatar soswow commented on May 30, 2024

@Pomax just in case this might be useful https://github.com/soswow/fit-curves

from bezierjs.

Pomax avatar Pomax commented on May 30, 2024

no really need (although thanks for the suggestion): they're already written up in http://pomax.github.io/bezierinfo/#catmullconv, just haven't had time to move them into bezier.js, too. https://github.com/Pomax/bezierjs/tree/gh-pages/test/autodraw makes use of the concept already, but in its own file. We're not working with rational B-splines, but plain Bezier curves, so we can just do a straight up Catmull-Rom fit and then trivially convert so that each segment uses Bezier instead of CR coordinates.

from bezierjs.

Pomax avatar Pomax commented on May 30, 2024

my bad, thanks for the correction.

from bezierjs.

behdad avatar behdad commented on May 30, 2024

I think you're talking of different types of curve-fitting here: @soswow's link is to a port of Philip J. Schneider's algorithm that tries to put as few curves as possible through a list of points with an allowed maximum error. We have this same algorithm in Paper.js too (with some added tweaks), exposed through Path#simplify(): https://github.com/paperjs/paper.js/blob/develop/src/path/PathFitter.js
You can see the code in action here: http://paperjs.org/examples/path-simplification/

Simplifying is in #26

from bezierjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.