Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

enter image description here

This leads to the error:

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?

share|improve this question
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 &)]

enter image description here

Then information about Polygons and other geometry is available as

Cases[voronoi, _Polygon, Infinity]


voronoi // InputForm

or rebuilding

Graphics[{FaceForm[], EdgeForm[Black], 
  GraphicsComplex[voronoi[[1, 1]], Cases[voronoi, _Polygon, Infinity]]}]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.