Menu Close

How to clip Voronoi tesselation to arbitrary shape?

How to clip Voronoi tesselation to arbitrary shape?

: Expanding on the helpful answer above from mgc, and again using voronoi_finite_polygons_2d from https://stackoverflow.com/a/43023639/855617, here is a solution for clipping your Voronoi tesselation to an arbitrary shape (here from a binary mask). The only additional work here is making a Polygon from your mask.

How are Voronoi cells spaced in SciPy stack overflow?

I ideally want the boundary voronoi vertices to be spaced around the same amount as the rest of the voronoi cells in the centre i.e. I want the sizes of the voronoi cells at the boundaries to be similar to the ones in the centre.

How to create Voronoi cells with finite boundaries?

I am trying to adapt a code I found on stackoverflow to create a voronoi cell with finite boundaries. I found the code below on https://stackoverflow.com/a/20678647/2443944 however my problem is that whilst the voronoi cells do not go off to infinity at the boundaries, they are still too far away.

What should the radius of a Voronoi cell be?

I ideally want the boundary voronoi vertices to be spaced around the same amount as the rest of the voronoi cells in the centre i.e. I want the sizes of the voronoi cells at the boundaries to be similar to the ones in the centre. The pictures I return are below for a radius of radius = 0.

Which is the best description of a Voronoi tessellation?

I will call it a Voronoi tessellation. To form a Voronoi tessellation, consider a collection of points positioned or scattered on some space, like the plane, where it’s easier to picture things, especially when using a Euclidean metric.

How to check if Voronoi cells are unbounded?

The code checks which Voronoi cells are unbounded by seeing if they have vertices at infinity, which corresponds to a in the index arrays (stored in the structure array c ). To create the Voronoi tessellation, use the SciPy (Spatial) function Voronoi. This function does -dimensional tessellations.

Which is the first data structure in voronoin?

For voronoin, the first (output) data structure v is simply an two-dimensional array array that contain the Cartesian coordinates of every vertex in the Voronoi tessellation.

Is there a function to return a Voronoi diagram?

The solution returns a complete Voronoi diagram, including the outer lines where no triangle neighbours are present. I do not know of a function to do this, but it does not seem like an overly complicated task. The Voronoi graph is the junction of the circumcircles, as described in the wikipedia article.