Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voronoi.triangles fails with square rectangle #1895

Closed
isaomatsunami opened this issue May 30, 2014 · 5 comments
Closed

voronoi.triangles fails with square rectangle #1895

isaomatsunami opened this issue May 30, 2014 · 5 comments
Assignees
Labels
bug Something isn’t working
Milestone

Comments

@isaomatsunami
Copy link

d3.geom.voronoi().triangles returns only one triangle when given 4 points that consists of rectangle.

var h = 100, w = 200, vertices = [[0,0],[w,0],[0,h],[w,h]];
console.log( d3.geom.voronoi().triangles(vertices).length ); // shows 1
vertices = [[0,0],[w,0],[0,h],[w,h + 0.001]];
console.log( d3.geom.voronoi().triangles(vertices).length ); // shows 2

And I hope any accessor to edges(.r/.l) variables inside, especially info about index-based triangles.

@jasondavies jasondavies self-assigned this Jun 12, 2014
@jasondavies jasondavies added this to the 3.4.x milestone Jun 12, 2014
@jasondavies
Copy link
Contributor

This is a specific instance of a more general problem: there is more than one possible Delaunay triangulation for n ≥ 4 cocircular points; otherwise there is always a unique triangulation satisfying the Delaunay property. I think a reasonable fix is to pick an arbitrary Delaunay triangulation in this situtation.

screen shot 2014-06-12 at 19 39 16

@isaomatsunami
Copy link
Author

regular

This problem is much grave.
The regular grids, which have much more possible triangulations, have the same problem. In this case above, d3.geom.delaunay(vertices).length is 25, instead of 50.

@jasondavies
Copy link
Contributor

Regular grids contain lots of instances of n = 4 cocircular points, for which there is no unique Delaunay triangulation.

@Fil
Copy link
Member

Fil commented Oct 2, 2016

This issue can be closed.

If anything, it is to be reopened on d3-voronoi; but see d3/d3-voronoi#13 which claims another computation method, and d3/d3-voronoi#12 which "solves" it by adding jitter.

@199600375707
Copy link

Issue3d/3d image_1895

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Development

No branches or pull requests

5 participants