Clipped Voronoi Tessellations
Now we consider a variant of the Voronoi tessellation called the clipped Voronoi tessellation. In the clipped Voronoi tessellation, the Voronoi polygons are clipped to the convex hull of the point set. This is useful when we want to ensure that the Voronoi polygons are bounded and do not extend to infinity. The computation of this tessellation is much more involved than the standard Voronoi tessellation. To be exact, we are interested in computing

At the end of this section, we also discuss the intersection of
Computing intersections of the Voronoi polygons and the convex hull
The main complication with clipping the Voronoi polygons to the convex hull is in computing all the intersections of the polygons with the convex hull. For this step, we use an iterative approach. The steps are described below. We will start by describing the algorithm in words, and then provide a clearer example.
Initialising the queue
We maintain a queue of edges to determine where we need to process the intersections. First, we initialise a set
Processing an edge
If either of
For the first step of this processing, we need to find any intersections of
Once we have processed all of the edges of
Let us give an example that illustrates this part of the procedure clearly.

In the first figure above, we are considering the processing of an edge
Clipping the polygons
Once all the intersections have been computed, clipping the polygons is straightforward. For each
Clipping a Voronoi polygon to a rectangle
Now let us describe clipping to some rectangle
The Sutherland-Hodgman algorithm
The Sutherland-Hodgman algorithm is an algorithm for clipping a polygon (called the subject polygon) to a convex polygon (called the clip polygon). The algorithm works by essentially extending each edge of the clip polygon to infinity and then iteratively clipping the subject polygon to each edge of the clip polygon. Let us give an example of this.

In the figure above, the black polygon shows the subject polygon and the red polygon is the clip polygon. Our aim is to clip the subject polygon to the clip polygon to obtain the blue polygon shown. Letting
- Define
and let . For each , we first let and then reset . - With this
, let , where and denotes the th element of . For , we consider the edge . If is left of , then it is outside of , and so we need to check if there is any intersection, i.e. if intersects , which can be easily checked by considering the position of relative to . If is not left of but is left, then there must be an intersection of with since and are on opposite sides of . In either of these cases, the intersection that we find gets pushed into , and we then set and continue onto the next . - Once we have processed each
, we set and then continue onto the next in . - Finally, once each vertex in
has been processed, the final polygon is defined by the points in .
Let's visualise this procedure.

In the figure above, we show the individual steps of this algorithm. In the second panel, the blue line shows the extended edge of the clip polygon that we use to slice the subject polygon, clipping it onto the edge. For the next four panels, the blue line never touches the subject polygon, and so nothing happens. The last two panels show the last two clips needed to obtain the final polygon.
The Liang-Barsky algorithm
Now we describe the Liang-Barsky algorithm, an algorithm for clipping a line segment to a rectangle. Let us take a line
- Left edge:
, . - Right edge:
, . - Bottom edge:
, . - Top edge:
, .
Using these inequalities, we can efficiently compute the intersections by processing each side of the rectangle at a time. Starting with
- If
and , then the line is parallel with the edge but outside of the rectangle, and so there are no intersections of the line with the rectangle. - If
and , then the the line enters the rectangle earlier than what is proposed by the current interval , and so the line is outside of the rectangle and we have no intersections to consider. If , then we update the intersection interval and let . - If
and , then just like above we see that the line is outside of the rectangle and so we return no intersections. If , set .
Applying these cases to each edge one at a time, updating
Clipping a bounded Voronoi polygon
Now that we have two important algorithms for clipping, let us begin our discussion on clipping the Voronoi polygons in particular, starting with bounded Voronoi polygons. This case is simple - simply apply the Sutherland-Hodgman algorithm to the polygon, using the clip polygon as the rectangle.
Clipping an unbounded Voronoi polygon
The case of clipping an unbounded Voronoi polygon is more complicated. Rather than trying to come up with an effective way to clip the unbounded rays of the polygon to a rectangle and taking care of all the possible edge cases, we use a more direct approach. Our aim is to convert the unbounded polygon into a finite polygon such that its intersection with the rectangle is the same as the intersection of the unbounded polygon with the rectangle. We do this in steps.
First, for the two unbounded edges, we let
and be the two midpoints of the edges of the convex hull that the unbounded edges go through.Next, we compute the maximum distance of the box to
and , letting .Now, starting with
inside = true
and , we do the following untilinside = false
.Replace
by , and compute , where is a unit vector in the direction of the unbounded edge associated with , and similarly .Apply the Liang-Barsky algorithm to
and the line segment through and , and check if the line segment is completely outside of . If it is, then setoutside = true
.We then need to be careful about the case where the generator associated with the polygon is outside of
. In this case, the unbounded edge might start outside of the rectangle and eventually find its way inside. To avoid this, we be conservative and check that the length of each ray is greater than the maximum distance from and to the clip rectangle. In particular, compute and . If , then the edge might possibly be inside . If this is the case, we letinside = true
and continue, and otherwise we letinside = false
.Once we stop iterating, the final values of
and are the points that the unbounded edges will now stop at, thus defining a bounded polygon.
The reason we start with

In the figure above, the polygon we are interested is the one corresponding to the black dot, and we want to clip this polygon to the red rectangle. The following figures show how we grow the polygon's unbounded edges to begin.

In these figures, the blue polygon shows the Voronoi polygon, and the green edges show the approximations to the unbounded rays; the top-most ray starts away from the polygon since the midpoint is further behind the associated circumcenter in this case. The magenta line shows the line segment joining the two approximations - the aim is to grow the green edges long enough such that the magenta line is completely outside of the red rectangle. Let's analyse each figure.
- At
, the line segment is outside of the rectangle, but there is still room to grow the green edges such that they go through the clip rectangle (in particular, the right-most edge). Since the maximum distance of the green edges is not larger than the maximum distance from the green edge's origins to the clip rectangle, our procedure will continue to grow the edges. - At
, we have the same problem as at in that the magenta edge is still outside of the clip rectangle but the green edges can still grow into the clip rectangle. - At
, the magenta edge is finally inside of the clip rectangle, but since it intersects it we need to keep growing the green edges until the magenta edge leaves again. - The situation at
is the same as at . - Finally, at
, the magenta edge is completely outside of the clip rectangle, and the length of the two green edges is now greater than the maximum distance from the green edge's origins to the clip rectangle. Thus, we can stop growing the unbounded edges here. - The final figure shows the bounded polygon obtained by growing the unbounded edges (with the left side of it out of frame).
Once a bounded polygon representing the unbounded polygon has been obtained, we apply the Sutherland-Hodgman algorithm as before to clip it to the rectangle. For the example above, the polygon we obtain is shown below.
Computing the intersection of the Voronoi tessellation with a convex polygon
We also provide support for clipping Voronoi tessellations to convex polygons. The mathematical details are not too complex in this case. To summarise, we simply, letting
- Find a bounding box for
, say . - Using the approach in the previous section, clip all Voronoi polygons to
. - Then, using the Sutherland-Hodgman algorithm (this is why the polygon must be convex), clip all these newly clipped Voronoi polygons to
.
The second approach is used because we need to ensure that we grow the unbounded polygons appropriately to guarantee that the third step is correct.