Kcnarf / d3-weighted-voronoi

Compute a Weighted Voronoi diagram of a set of weighted two-dimensional sites
BSD 3-Clause "New" or "Revised" License
63 stars 12 forks source link

"Cannot read property 'x' of null" with identical sites (same locations, same weights) #1

Closed Kcnarf closed 4 years ago

Kcnarf commented 7 years ago

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}]

Kcnarf commented 7 years ago

Adding an epsilonesque difference (on x, y, or weight) no longer raises the error, eg.: [{x:halfWidth, y:halfHeight, weight: 0}, {x:halfWidth, y:halfHeight, weight: 1E-10}]