Comments (4)
The third argument is currently i, a starting node (default: 0). It helps speed up the search a bit when you start close to the solution (e.g. when you track a mouse's movements).
In d3-voronoi this is an internal value, that is updated after each search. I can't think of a use-case where it would be useful to have it in the API.
from d3-delaunay.
My doubt was in regards implementing something like your block but with a distance-limited interaction. Using d3-voronoi you can just a third argument for the radius.
How would you do something like that with this library? For example, by passing a number close to the current index?
from d3-delaunay.
You can always check the distance between your point and the site found, something like (pseudocode):
v.find_with_radius = function(x,y, radius) {
n = v.find(x,y);
if (n !== null && distance(site[n], [x,y]) < radius) return n;
}
But I wonder if it should not be put into the API in lieu of [site]. @mbostock we can prepare a PR if you agree with this change.
from d3-delaunay.
The radius (distance) test happens after finding the closest site; it doesn’t optimize the search. So, you should perform your radius test after calling find, as @Fil suggests.
The reason that find takes a starting index is that I don’t want find to mutate the internal state of the delaunay instance (as d3-voronoi does). By keeping the internal state immutable, you have greater flexibility in employing your search optimizations.
from d3-delaunay.
Related Issues (20)
- Generating higher-order Voronoi diagrams HOT 1
- Adding points incrementally without retriangulating HOT 3
- voronoi.cellPolygons skips null cells, and doesn’t report the cell’s index. HOT 3
- README misleading with "no-dependency library" line HOT 2
- Error with es6 worker + es6 modules HOT 18
- Would it be possible to make this work with a convex hull boundary for the Voronoi cells? HOT 2
- Delaunay points are a list of NaN HOT 1
- _edge() Comparison of numbers is unsafe HOT 5
- voronoi tiling goes a bit crazy when points are duplicated in the input HOT 1
- Broken voronoi HOT 3
- Update rollup and rollup-plugin-terser HOT 2
- Cosmetic Index out of bound check fix. HOT 1
- Minor change: Only compute bl and cl when needed. HOT 1
- renderPoints(5) crashes
- context.moveTo and context.lineTo implementation HOT 1
- Voronoi Polygon generator HOT 1
- convenience delaunay.edges() function?
- voronoi don't cover the rectangle? HOT 7
- Edges that both sides are clipped sometimes will not be identified as voronoi neighbor HOT 2
- Odd failure HOT 4
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-delaunay.