Giter VIP home page Giter VIP logo

Comments (2)

Pomax avatar Pomax commented on September 13, 2024 1

Created a JSbin with your code, and modified it so it doesn't pretend what you're doing with bezierjs is even remotely the same as what you're doing in SVG: http://jsbin.com/fiyiyivefa/edit?js,output

Note that because bezier.js does not have a "get point at some distance" function, this is not a perfect match: we would have to find the point at i-step/2 and at i, and then we would have to do a second check in side of that range to find the exact point T for which curve.get(T) yields the point at 20% distance along the curve.

from bezierjs.

Pomax avatar Pomax commented on September 13, 2024

yes, obviously those are different points: Bezier curves are non-linear, evaluated based on a parameter of time, not a parameter of distance, so we cannot assume that t=0.2 lies at 20% of the total length of the curve, or that t=0.75 lies at 75% of the total length of the curve (read the previous link for a much more detailed explanation on why).

As such, get(0.2) and getPointAtLength(0.2 * totalLength) are completely different things, and even if we make the curve looks like a straight line, it is still defined as a non-linear plot, and so it is trivial to prove that .get(n) and getAtLength(total * n) always differ except at n=0 and n=1 and a possible handful of singleton points (where the number of points for where this is true depends on the order of the curve and the number of inflections expressed on it)

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.