-
Notifications
You must be signed in to change notification settings - Fork 2
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
Polygon generation problems #1
Comments
After some investigation it turned out that a single site is responsible for this behaviour. The coordinate pair [555.64, 204.94]. When slightly modifying the coordinates to for example [556.64, 203.94] everything is working again. This is sadly not a good solution. I'm currently debugging through the code to see where it goes wrong but my guess is one edge "detection". Edit: Turns out that even a slight change to the coordinates like [555.65, 204.93] (+- 0.01) "fixes" it. |
Thank you for figuring that out and providing the detailed information. I have ported the site generation algorithm (fortunes algorithm) from the original C# code without understanding how it really works. There is some code which sorts points by their coordinates. I suspect that the problem is somewhere in that part of the code but I am not sure. I will look into that. As a workaround, I have added an option to randomly offset the site locations in version 1.0.1 You can set the optional parameter of Voronoi.runFortunesAlgorithm() to a small value like this:
The value 0.00001 should work well for your case. This is of course not optimal because it relies on randomness, but I hope it's a good enough pragmatic solution. |
Hello, you're welcome. If I find the time I'll see if the C# Version has the same problem and report an issue there too. That "fix" is actually the very same thing I did in my program. I offset every loaded point/coordinate by +-0.01. Thanks for your fast response :). |
The C# version sadly doesn't provide a way to generate polygons for the sites. So you probably won't be able to see any problems. However, when I play around with your values and the random offsets, I can sometimes see errors even without the polygons. |
Hello, I think I found a problem with the polygon generation algorithm. When using a specific set of coordinates I get a polygon with only 2 sides (in my code).
I adapted the iOS example with my own values to get a visualization for the problem at it is quite strange. Without filling in the polygons everything looks alright, but when turning on polygon fill you can clearly see that something is not right.
I modified the iOS example like this:
The text was updated successfully, but these errors were encountered: