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

Define Delaunay triangulation for n = 0, n = 1 and n = 2. #19

Closed
mbostock opened this issue Mar 21, 2018 · 3 comments
Closed

Define Delaunay triangulation for n = 0, n = 1 and n = 2. #19

mbostock opened this issue Mar 21, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

Currently we throw an error from Delaunator:

Error: No Delaunay triangulation exists for this input.

There is a valid Voronoi diagram for n = 1 and n = 2, so we should allow an empty Delaunay triangulation with no triangles in these cases. And similarly for n = 0, we can have an empty Voronoi diagram with no cells.

@BTOdell
Copy link

BTOdell commented Sep 10, 2018

Hello Mike,

The n=0 and n=1 cases are easy to work around (it's just the entire bounding area). But the n=2 requires cooperation from the underlying voronoi region algorithm. I'm not super familiar with the mathematics behind delaunay triangulation or voronoi regions or else I'd write up a pull request.

If you could find some time to fix this issue, it would be much appreciated.
Thanks!

@Fil
Copy link
Member

Fil commented May 21, 2019

Here's my tentative
https://observablehq.com/d/5e4da35146afd543

It's gross (try/catch, and add external points at near-infinity if the triangulation failed). But hey!

Fil added a commit that referenced this issue Jun 19, 2019
Fix Delaunay and Voronoi for degenerate cases

For 0, 1, 2 points, and for collinear points:
- returns the correct topology (neighbors, find)
- returns the correct Voronoi cells (bounding box, half plane…)
- resorts to deterministic jittering only in the case of multiple collinear points

Fixes:
-  #19
-  #20
-  #50
-  #65
@Fil
Copy link
Member

Fil commented Jun 20, 2019

Fixed by 2ee9847

@Fil Fil closed this as completed Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

4 participants