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

does not produce convex hull #3

Open
qqwa opened this issue Jan 23, 2019 · 3 comments
Open

does not produce convex hull #3

qqwa opened this issue Jan 23, 2019 · 3 comments

Comments

@qqwa
Copy link

qqwa commented Jan 23, 2019

The Delaunay triangulation should produce a triangulation with a convex hull.

To fix it you would need to check if some of the triangles that have a point of the supertriangle need to have an edge flipped, before removing them from the triangulation.

Don't know if it matters to you, but just leaving it here in case someone wants to use this implementation and needs a convex hull.

@moritzbeck
Copy link

I guess it should matter for users of this crate as this means the function doesn't compute a (complete) Delaunay triangulation.

I stumbled across a set of 3 points for which triangulate returns an empty Vec:

use rtriangulate::{TriangulationPoint, triangulate};
fn main() {
	let points = [
		TriangulationPoint::new( 4., 11.),
		TriangulationPoint::new( 6., 10.),
		TriangulationPoint::new(10.,  8.)
	];
	// Do the triangulation.
	let triangles = triangulate(&points).unwrap();

	println!("{:?}", triangles); // Empty :-(
}

@tynril
Copy link
Owner

tynril commented Jul 8, 2020

@moritzbeck: These three points are collinear, so they can't form a triangle. What would be your expected output there?

@moritzbeck
Copy link

D'oh, you're right. I should have checked that.
(These points have "minimized" coordinates.)

My use case is the following: I want to compute the Euclidean minimum spanning tree of a set of points.
For this I compute a Delaunay triangulation, create a graph out of it (I am really only interested in the edges of the triangulation, not the triangles themselves.) and then compute the minimum spanning tree on that graph.

So for my use case I'd like the output to contain the degenerated triangle with those three vertices.

Having said that, the triangulation remains empty if I change the first point from (4, 11) to (4, 12) or even (4, 12.9).
With (4, 13) it does produce a triangle, so there might be a problem with float stability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants