This repository has been archived by the owner on Oct 2, 2019. It is now read-only.
Shifted from Voronoi to Delaunay triangulation, to direct Delaunay Triangulation #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes d3/d3#1895.
The issue stemmed from the fact that we first perform a Voronoi Tessellation and then attempt to derive the Delaunay Triangulation from it. This works fine in all cases except when there is a set of cocircular points (n >= 4) anywhere within the input, leading to the formation of degenerate Voronoi vertices (degree > 3). For such vertices, the standard technique of joining the sites of neighbouring cells will not produce a valid Delaunay triangulation (Chapter 4. Delaunay Triangulation in https://www.whitman.edu/Documents/Academics/Mathematics/dobrinat.pdf).
Instead of depending on the Voronoi Diagram, this PR aims to derive the Delaunay Triangulation directly using the fast implementation seen in https://github.com/ironwallaby/delaunay.
P.S.
A more efficient solution would be to first generate the Voronoi vertices from the Voronoi edges (that have already been computed), identify the degenerate vertices, and specially handle the triangulation for them. This would involve gathering all the input points (sites) that are involved with that vertex, and then triangulating them separately. This special triangulation could be made even more efficient by sorting these vertices, and triangulating in a clockwise manner instead of considering all possible triangulations (since any triangulation of a cocircular set of points should give a Delaunay triangulation). I'm not sure if this method is documented or something I just thought of, so I thought I'd wait for a go-ahead in case the added complexity was not worth the improvement in efficiency.