Coder Social home page Coder Social logo

Comments (2)

mbostock avatar mbostock commented on July 28, 2024

polygonContains is not robust, so itโ€™s not guaranteed to return the correct result in edge cases like this. We could tweak the algorithm to make it perform better in special cases, but only at the expense of complexity and speed. I donโ€™t think we want to go all the way to making it robust.

See https://observablehq.com/@tmcw/understanding-point-in-polygon for an explanation of the algorithm.

from d3-polygon.

Kcnarf avatar Kcnarf commented on July 28, 2024

Thanks for the response and the provided links.

I discovered the use case while debugging some tests I did for d3-weighted-voronoi plugin, which sometimes were failing. I was positioning a site at the [1,1] vertex, considered outside of the unit square, and hence re-position the site in a random fashion (hence the rare failure).

Closing the issue as the non-robustness seems assumed.

PS: perhaps a hint in the documentation may help.

from d3-polygon.

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.