Comments (2)
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.
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)
- geoArea should (?) also work with a list of coordinates HOT 3
- Circle intersection test HOT 1
- Point x and y accessors HOT 1
- More easily import polygon points HOT 1
- Why is Polygon.hull() result not counterclockwise ? HOT 2
- feature requests: polygon union, intersection, difference HOT 1
- broken link HOT 1
- Flipping flag for contain HOT 1
- How should a polygon be filled with a slash? HOT 2
- Merge into d3-geometry package? HOT 1
- Add concaveHull (in addition to convexHull) HOT 4
- Porting old function d3.geom.polygon to its newer version HOT 6
- segmentIntersect, lineIntersect?
- Rendering? HOT 1
- Clipping? HOT 12
- Point-in-polygon test.
- Why do counterclockwise polygons have positive area? HOT 1
- would it make sense to have a "polygon contains polygon" method? HOT 3
- Hull issue (for v3) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-polygon.