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

Possible oversight? #1

Open
gregmulvihill opened this issue Jul 6, 2017 · 1 comment
Open

Possible oversight? #1

gregmulvihill opened this issue Jul 6, 2017 · 1 comment

Comments

@gregmulvihill
Copy link

I was studying your code to better understand Delaunay triangulation, and I found something puzzling.

https://github.com/jonghough/Voronoi-jx/blob/master/Voronoi-jx/VoronoiGenerator.cs#L358

The second half of the if statement, "he.GetTarget().Y() >= he.GetTarget().Y()", looks like it could be a mistake or maybe not needed?

Thank you for any insight you can offer.

@jonghough
Copy link
Owner

Thanks for pointing this out. You are correct, this is an issue, but rather than being unnecessary, the current if-clause is insufficient.
The whole point of the if-clause was to only use half the half-edges, because otherwise we're duplicating lines in the Delaunay graph, but in some cases the condition

(he.GetTarget().X() >= he.Twin().GetTarget().X() && he.GetTarget().Y() >= he.Twin().GetTarget().Y()

will not add any DelaunayEdges. e.g. Two points on the plane, P1= (98, 100) and P2 = (100, 200)
becaus eneither half-edge matches the above condition.
But then again, the condition

(he.GetTarget().X() >= he.Twin().GetTarget().X()

will not add any DelaunayEdges if P1 and P2 are (100,100), and (200,100).

So, I actually need a better condition to check. I don't think it is a hard problem to solve, but I don't have time today. And worst case, just forget the if condition and draw both half-edges.

Thanks for bringing this up though, I hadn't noticed it.

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

2 participants