Pytess icon indicating copy to clipboard operation
Pytess copied to clipboard

Polygons with no associated input point

Open strawdawg1 opened this issue 8 years ago • 2 comments

First off, great work on the pytess project. I am actively using it, but have run into an issue and wondering if you can help. My primary issue is that I am ending up with polygons in my output from the voronoi function. Those polygons are anomolies which do not have input points associated. There seems to be a pattern that there are always 4 polygons that occur around the centoid of the input set. I have tried this on several datasets of points (which are formatted as lat/long values of float data type). Do you have any ideas, or suggestions. See attached screenshots. screen shot 2016-08-02 at 9 05 14 am screen shot 2016-07-29 at 2 23 08 pm

strawdawg1 avatar Aug 02 '16 14:08 strawdawg1

I experience the same problem, it seems more severe with fewer sites. ex1 ex2

aau-ros avatar Sep 29 '16 16:09 aau-ros

Hi,

Sorry for the late reply. Unfortunately I didn't write the underlying tesselator/voronoi algorithm, so I don't know enough about the inner workings that might be causing this problem.

However, if you were to look into it (and I am very open to Pull requests), let me suggest three possibilities:

  • Could it be something about floating point rounding errors? Although strange why that would happen more around the center.
  • Look at lines 86-112 in main.py, that's where I tried to reconstruct the polygons from the original voronoi algorithm (which only returned the results as unordered edges). Maybe the edge-to-polygon reconstruction went awry somewhere...
  • Maybe the error comes from the fake buffer points that are added to the corners of the data bbox (this is done to ensure voronoi polygons cover the entire area) in main.py. Experiment with making the buffer box larger or smaller than 100 (%) and see if it helps.

Fork and PR if you find a solution :)

karimbahgat avatar Dec 29 '16 22:12 karimbahgat