Open personnumber3377 opened 7 months ago
Yep, the problem here is in the robustness of the method to determine if a seed is inside a triangle. Your input set has some seeds that are perfectly aligned (seeds 16, 5, 3),
One silly solution is just to change the order of your input data, calling random.shuffle.
random.shuffle(seeds)
for s in seeds:
dt.addPoint(s)
with produce this graph:
If you don't want to relay into random.shuffle (which could produce another bad permutation of your seeds), you can also sort the seed by coordinate X or coordinate Y
#Compute the permutation that sort the input points by X-coordinate
perm = sorted(range(len(seeds)), key=lambda x: seeds[x][0])
#Add points to delaunay using that permutation order
for i in perm:
dt.addPoint(seeds[i])```
Hi! I used parts of your project in my own project (you can take a look at my project here: https://personnumber3377.github.io/projects/implementing_weighted_voronoi_stippling.html and here is the source code: https://github.com/personnumber3377/pythondelaunay )
If you set the points to this:
inside of delaunay2D_plotDemo.py and then when you try running it, you should get this error:
I don't really understand how your code works, so I don't really know how to fix it, but maybe you can add some insight to this?
Thanks in advance!