# Bounded Voronoi Diagram

I am trying to compute a Voronoi diagram bounded by a box. In some cases, the points used to compute the diagram form a diagram such that at least two boundary points are within the same polygon. For Example:

centres = {{0, 1250}, {4750, 2000}, {-2500, -2500}, {500, 750}};
boundaries = {{10000, 10000}, {-10000,
10000}, {-10000, -10000}, {10000, -10000}};
{diagvert, diagval} = BoundedDiagram[boundaries, centres];


With the Voronoi diagram:

BoundedDiagram::notuniq: BoundedDiagram requires that boundary vertices lie in unique Voronoi polygons.

Since I am trying to generalize the scenario, I can't design a specific boundary for the points, and I would like to use a general big enough boundary. Is there any way to allow multiple boundary points within the same polygon? Or perhaps a different approach?

-
I see you're new to SE sites. So, welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign – Vitaliy Kaurov Jan 4 '14 at 22:25

If I understood correctly that bounding box needs to be automated, you can just use this trick:

centres = RandomReal[1, {50, 2}];

voronoi = ListDensityPlot[Append[#, 0] & /@ centres, InterpolationOrder -> 0,
BoundaryStyle -> Black, Frame -> False, ColorFunction -> (White &)]


Then information about Polygons and other geometry is available as

Cases[voronoi, _Polygon, Infinity]


or

voronoi // InputForm


or rebuilding

Graphics[{FaceForm[], EdgeForm[Black],
GraphicsComplex[voronoi[[1, 1]], Cases[voronoi, _Polygon, Infinity]]}]

-