Comments (4)
I noticed this also, one has to do .extent(null)
before calling triangles()
See https://bl.ocks.org/Fil/6c028ce0d9b66d2796bce7f8166f32cd
from d3-voronoi.
When we add an extent, the Voronoi cells on the boundary of the rectangle have dangling halfedges. Removing those enables .triangles()
to work as expected (and documented).
- if (i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) {
+ if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) {
This is consistent with what .links()
already returns
The documentation could clarify that, in the case of a finite .extent(), what is returned is a subset of the Delaunay triangulation:
- Since the Delaunay triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, the Delaunay triangulation is likewise affected by the extent.
+ Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, a subset of the Delaunay triangulation is returned.
I have updated my block (https://bl.ocks.org/Fil/6c028ce0d9b66d2796bce7f8166f32cd) to demonstrate this. (Colors are ugly, but could be a basis for something that we link from the documentation.)
from d3-voronoi.
An alternative is #13 (claims to return the "full" Delaunay).
from d3-voronoi.
Including @adithyaphilip in the discussion.
from d3-voronoi.
Related Issues (20)
- New examples for 1.0.1 HOT 4
- Handle collinear (and cocircular) points? HOT 5
- Suggestion: small optimization by returning the tangent instead of the angle HOT 1
- Cannot read property '0' of null in clipCells() HOT 13
- Voronoi.find(x,y) HOT 5
- polygons() returning [null, null, null] HOT 4
- .find() throws exception when data contains two elements on the same same position
- Missing Triangle? HOT 2
- Inverse Voronoi? HOT 1
- TypeError: Cannot read property 'circle' of null HOT 6
- Feature request; polygon extent HOT 2
- d3.voronoi mutates data HOT 3
- voronoi.findAll(x,y,r) HOT 2
- voronoi.polygons crashes (runs out of memory) HOT 2
- Relation with d3-delaunay HOT 1
- Cell.js:75 Uncaught TypeError: Cannot read property '0' of null HOT 2
- voronoi.polygons will run out of memory or return incorrect polygons for certain data sets. HOT 1
- clipCells causes 'cannot read property 0 of null' HOT 6
- Incremental Voronoi?
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-voronoi.