-
Notifications
You must be signed in to change notification settings - Fork 6
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
Problem to build diagram on dense point set #1
Comments
Hi, Indeed duplicated points are not supported by the algorithm. The reason is that it makes little sense: the two cells would be exactly the same and the Voronoi diagram would not be a partitioning of the plane anymore which is not desirable. I will add in the documentation that the points must all be unique. Maybe I will add a check at the beginning of the algorithm to ensure that. After removing the duplicated points, I obtain the same diagram as you. I am almost sure the problem does not come from the density of points. But rather that some points are aligned along the y-axis. For instance, if I only take your first five points (without the duplicates):
I obtain the same problem (a vertical line and the intersection algorithm makes a seg fault ...): However, if I slightly change the y-coordinates so that no two points are aligned along the y-axis anymore:
Then, the diagram is correct: Slightly changing the y-coordinates of (1, 0) and (1, 1) also works on your full example: This problem is a known issue and I will work on it. Thanks for reporting! |
Hello, just added one more use case with points with same Y coordinates. |
Hello Pierre! Just wanted to ask, do you plan to continue development around your project? Best wishes in your continued success! |
Hello! I was working on another project for a while but I will get back to this one shortly. I hope in the next month. Thanks for your interest! |
Hi! I have updated the project. I fixed lots of edge cases. The algorithms are way more robust now. In particular, I have added some tests with some special configurations (line: all points aligned, grid: points are placed on a 2D grid, circle: points are on a circle) where many points share the same x or y coordinates and many cells meet on a same vertex. And it works fine. It is still possible to find configurations which lead to error but it is harder. I don't know if it is really possible to prevent all errors with the method I used to manage floating point issues. But I want to keep the code as simple as possible. The next steps are to set up the CI and improve the cmake file so that it is easy to install and use the library. Best! |
Hello! Thanks a lot, it has become much better. However, I have faced some use cases that prevent integration into target project. I could share some of them later if you are interested. Best regards! |
Hello! That would be very nice if you find some time! If it is not too complicated to fix, I will gladly fix these issues. Best |
Dear Pierre! I have just came to that the code intended to collection of triangles is messy a bit... Here is the question: how it would be possible to collect unique triangles in the most appropriate and fastest way? What I actually would like to ask in addition: as the algorithm uses half-edge data structure, is it possible to use this feature to speed up collection of triangles (without maps) by introduction of some kind of iterator over half-edges and extending half-edge structure (or iterator itself) by bool flags that indicate visited ones? Finally, I have found one more case failing production of correct diagram regular.txt : |
Hi, Indeed, I think that in your first example (with the circle), the problem comes from the way you enumerate the triangles: it is not exhaustive. The If you want the triangles, I think that the best way is to use the vertices of the diagram. Each vertex is the center of the circumcircle of three sites. So for each vertex of the Voronoi diagram, there should be a triangle in the Delaunay triangulation. The next question is how to get the three sites for each vertex. Once you have a half-edge that is incident with a vertex you can obtain the other half-edges and thus the other sites using I will try to find some time to implement this. Concerning, the second issue, I am sorry but I do not think I can do anything more. I have already done as much as I can to prevent floating point issues from occurring. But with the method I used, I can not prevent them all. In this reddit comment, someone advises me to use Shewchuk's robust floating point primitives. But I think it is beyond my abilities to implement that. Moreover, I am happy enough with the robustness of the current implementation as I only use it with random points, so there is really low probability to have aligned points. If you have data that contain a lot of aligned points, you should maybe consider another implementation that uses more advanced techniques, as the one mentioned above, to manage floating point issues. Best, |
Well, in any case your implementation is a very good cross-platform solution. Regards! |
Hello Pierre,
I continue to experiment with your algorithm.
Now I'm trying to run it on some real data.
I have attached file with points.
When I read it, I have got segmentation fault during intersection stage.
Seems it is caused by duplicating points.
The matter is that halfEdge in do-while loop in intersect(Box box) method becomes a null pointer.
If I change condition to "while (halfEdge && halfEdge != site.face->outerComponent);" it goes to infinite loop until it hangs entire system.
If duplicates are removed, it works, but produces redundant (to my view) link crossing several zones in the middle:
Best Regards!
case.txt
The text was updated successfully, but these errors were encountered: