Giter VIP home page Giter VIP logo

Comments (6)

veltman avatar veltman commented on June 1, 2024

Thanks for the demonstration case! I think what's going on here is that maxSegmentLength is 10 by default and it's in pixel space, so these paths are so short that not enough points are getting added (this only affects path string inputs, not array inputs).

For an immediate fix you can specify a maxSegmentLength that's less than 1/3 the total length:

https://runkit.com/590ff00e90d6f10011380a19/593ebcea407b44001216b817

In the short term I'll fix so that it always polygonizes a path string into a minimum of three points. Longer term I'm planning to turn maxSegmentLength into a relative value anyway (e.g. 0.1 means no segment can be longer than 10% of the whole perimeter), which should help.

from flubber.

ejfox avatar ejfox commented on June 1, 2024

Thanks so much for Flubber! I'm really excited to use it. I'm running into a similar problem that I'm not able to fix with the maxSegmentLength solution you have here. I've added a sample path to runkit here: https://runkit.com/ejfox/594bd75bc5101e00118c0f5a

I've uploaded a snapshot of my project in case that helps as well: http://stenographer-access-43136.netlify.com/

Appreciate any help you can offer!

from flubber.

veltman avatar veltman commented on June 1, 2024

Will look into it - I notice that your runkit sample is using an old version (0.2.2), and your app bundle might be also. This was patched in 0.2.6, so try installing the latest?

from flubber.

veltman avatar veltman commented on June 1, 2024

Strangely, I'm not able to reproduce this even with 0.2.2 in Node or in browser. Let me know if you're still getting it with a 0.2.6+ version?

from flubber.

ejfox avatar ejfox commented on June 1, 2024

Thanks Noah,

I've been playing around with things for the last few days after updating to 0.3.0 and going through the demos to figure out my bug a little better. I've made some progress but still encountering some paths that return errors.

I've made a new runkit with a problematic path using 0.3.0 https://runkit.com/ejfox/flubber-error
screen shot 2017-06-26 at 1 18 14 pm

from flubber.

veltman avatar veltman commented on June 1, 2024

So your example path string has two individual rings. By default, flubber will only use the first ring, which in this case is:

M673.504130256738,582.2362322253204
L673.4952926184682,582.137462231841
L673.504130256738,582.2362322253204Z

The first and third points are identical, so it's really only a two-point line segment rather than a polygon with any interior area, which is why it fails the test.

I'm still undecided on how to handle cases like this, but in the meantime if you want to avoid this error you could take the second ring from the path string instead, which seems like the important shape anyway:

var interpolate = f.toCircle(f.splitPathString(a)[1], 0, 0, 8);

from flubber.

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.