Giter Club home page Giter Club logo

Comments (4)

Pomax avatar Pomax commented on May 31, 2024

that is very curious - thanks for reporting it, I'll have a look at why this happens.

from bezierjs.

Pomax avatar Pomax commented on May 31, 2024

it looks like the inflections function got overwritten at some point to only test cubic inflections... no idea why, but restoring that to cover the other cases again now.

from bezierjs.

Pomax avatar Pomax commented on May 31, 2024

Interestingly that's only part of the problem. Solving for inflections, there is a super fascination split result:

{ left:
   { [String: '[330/592, 330/592, 330/592, 330/592]']
     _3d: false,
     order: 3,
     points: [ [Object], [Object], [Object], [Object] ],
     dims: [ 'x', 'y' ],
     dimlen: 2,
     _linear: true,
     _t1: 0,
     _t2: 0,
     dpoints: [ [Object], [Object], [Object] ],
     clockwise: false },
  right:
   { [String: '[330/592, 330/557, 315/522, 315/485]']
     _3d: false,
     order: 3,
     points: [ [Object], [Object], [Object], [Object] ],
     dims: [ 'x', 'y' ],
     dimlen: 2,
     _linear: false,
     _t1: 0,
     _t2: 1,
     dpoints: [ [Object], [Object], [Object] ],
     clockwise: true },
  span:
   [ { x: 330, y: 592 },
     { x: 330, y: 557 },
     { x: 315, y: 522 },
     { x: 315, y: 485 },
     { x: 330, y: 592 },
     { x: 330, y: 557 },
     { x: 315, y: 522 },
     { x: 330, y: 592 },
     { x: 330, y: 557 },
     { x: 330, y: 592 } ],
  _t1: -0,
  _t2: 0 }

I can't remember the last time I saw -0 in JavaScript...

from bezierjs.

Pomax avatar Pomax commented on May 31, 2024

Turns out the error came from extrema(), which would happily return a list like [-0, 0, 0.5, 1], which would then lead to the code forming segments between each of those t values, which would lead to it trying to form a segment by calling thing.split(-0,0) which broke all the things.

I've extended the tests to explicitly check the result of extrema() using your curve parameters to prevent any code changes in the future screwing this back up, and published v2.0.2 to npm =)

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.