kcnarf / d3-weighted-voronoi Goto Github PK
View Code? Open in Web Editor NEWCompute a Weighted Voronoi diagram of a set of weighted two-dimensional sites
License: BSD 3-Clause "New" or "Revised" License
Compute a Weighted Voronoi diagram of a set of weighted two-dimensional sites
License: BSD 3-Clause "New" or "Revised" License
2 sites with the same x, y and weight raise a "Cannot read property 'x' of null".
stackTrace:
Uncaught TypeError: Cannot read property 'x' of null
at dot (VM2965 d3-weighted-voronoi.js:16)
at Face.orient (VM2965 d3-weighted-voronoi.js:399)
at ConvexHull.prep (VM2965 d3-weighted-voronoi.js:531)
at ConvexHull.compute (VM2965 d3-weighted-voronoi.js:635)
at computePowerDiagramIntegrated (VM2965 d3-weighted-voronoi.js:792)
at _weightedVoronoi (VM2965 d3-weighted-voronoi.js:876)
at computeAllCells (blob:http://blockbuilder.org/7558f499-9ca0-4287-9051-82ab1eb0ca1e:345)
at blob:http://blockbuilder.org/7558f499-9ca0-4287-9051-82ab1eb0ca1e:335
data:
[{x:halfWidth, y:halfHeight, weight: 0},
{x:halfWidth, y:halfHeight, weight: 0}]
next.conflicts.isEmpty() is false, so current is not increased
this.visible[jF].getHorizon() is null
this.horizon.length is 0
first and last are null
this.created.length is 0, so current is not increased
repeat...
Input to _weightedVoronoi :
[[0.3,-1.5,1.7542563288623765],[-0.3,-1.5,1.7542563288623765],[0.3,-0.8999999999999999,1.7542563288623765],[-0.3,-0.8999999999999999,1.7542563288623765],[-0.3,-0.3,1.7542563288623765],[-0.8999999999999999,-0.8999999999999999,1.7542563288623765],[0.8999999999999999,-1.5,1.7542563288623765],[-0.8999999999999999,-1.5,1.7542563288623765]]
Two questions about the cell<->site correspondance
How can I easily get all points that have no matching cell? In the classic (non-weighted) voronoi, all cells are returned in the same order as the points, but here it seems different.
In https://observablehq.com/d/128a52368e482305 I can see that for all cells we have cell.site.index == 0. Is this expected?
I did a basic experiment with the library on CodePen but weights don't seem to affect the result in the slightest. Any idea why? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.