Question

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.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top