1

I'm make use of Scipy's spatial package Voronoi class to generate a 3D tessellation of input points. I then randomly insert points within the "box" domain. Where I'm having trouble is figuring out how to check if a random point is within a given Voronoi region. I figure that since I have all the vertices for each Voronoi region I should be able to do this but I haven't been able to wrap my head around it. Any insight,example code, or python tools that can do this fairly straight forward?

Any help is most appreciated, SB

Update, I think I left out some critical information:

I need to loop over each Voronoi region generate random points within the entire region but only keep the points for that specific Voronoi region. I'm sampling a distribution over the entire Voronoi space for each region.

1 Answers1

1

When you have input points, the simplest way is to iterate over them and check which one is closest to your new point.

The closest of your input points will represent the region that contains your new point.

kolenda
  • 2,741
  • 2
  • 19
  • 30
  • This works, however there is a caveat with my problem. Essentially, I need to loop over each Voronoi region generate random points within the entire region but only keep the points for that specific Voronoi region. I'm sampling a distribution over the entire Voronoi space for each region. – user3611086 May 08 '14 at 03:38
  • Are you bound by performance or just want it to work? What is your typical region number and the number of random points? You can also do the region check by polygons of a convex hull. – kolenda May 08 '14 at 09:58
  • Just want it to work! The region number can be 1000's and number of random points can be 100,000's. Do give you a little more detail I'm essential trying to write my own code to do what this does: http://li.mit.edu/Archive/Graphics/A/utils.html#voronoirize – user3611086 May 08 '14 at 20:58
  • For so many regions it might be better to create a cutting planes for your region boundaries, which will result in a convex hull of the region. This way you could be able to check point-region collisions much faster. – kolenda May 12 '14 at 09:23