Maintaining the Union of Unit Discs under Insertions with Near-Optimal Overhead

We present efficient dynamic data structures for maintaining the union of unit discs and the lower envelope of pseudo-lines in the plane. More precisely, we present three main results in this paper: (i) We present a linear-size data structure to maintain the union of a set of unit discs under insertions. It can insert a disc and update the union in $O((k+1) \log^2 n)$ time, where $n$ is the current number of unit discs and $k$ is the combinatorial complexity of the structural change in the union due to the insertion of the new disc. It can also compute, within the same time bound, the area of the union after the insertion of each disc. (ii) We propose a linear-size data structure for maintaining the lower envelope of a set of $x$-monotone pseudo-lines. It can handle insertion/deletion of a pseudo-line in $O(\log^2 n)$ time; for a query point $x_0\in\mathbb{R}$, it can report, in $O(\log n)$ time, the point on the lower envelope with $x$-coordinate $x_0$; and for a query point $q\in\mathbb{R}^2$, it can return all $k$ pseudo-lines lying below $q$ in time $O(\log n+k\log^2 n)$. (iii) We present a linear-size data structure for storing a set of circular arcs of unit radius (not necessarily on the boundary of the union of the corresponding discs), so that for a query unit disc $D$, all input arcs intersecting $D$ can be reported in $O(n^{1/2+\varepsilon} + k)$ time, where $k$ is the output size and $\varepsilon>0$ is an arbitrarily small constant. A unit-circle arc can be inserted or deleted in $O(\log^2 n)$ time.


Introduction
Let S be set of n points in R 2 , and let U be the union of the unit discs centered at the points of S. We would like to maintain the boundary ∂U of U , as new points are added to S.
Even for discs of varying radii, the complexity of ∂U is O(n) [17], and it can be computed in O(n log n) time using power diagrams [6].An incremental algorithm [20] can maintain ∂U in total of O(n 2 ) time.This is worst-case optimal, as the overall complexity of the structural changes to ∂U under n insertions may be Ω(n 2 ); see an example in [3].Here, we describe in Section 3 an output-sensitive algorithm that uses O(n) space and updates ∂U in O(k log 2 n) time per insertion of a disc, where k is the combinatorial complexity of the structural changes to ∂U due to the insertion.Some of our ideas resemble those of de Berg at al. [12], who present a semi-dynamic (insertion only) point-location data structure for U .
The efficient manipulation of collections of unit discs is a widely and frequently studied topic, for example in the context of sensor networks, where every disc represents the area covered by a sensor.Here, we are motivated by multi-agent coverage of a region in search of a target [11], where we investigate the pace of coverage and wish to estimate at each stage the portion of the overall area covered up to a certain point in time.Since the simulation is discretized (i.e., each agents is modeled by a unit disc whose motion is simulated by changing its location at fixed time steps), we can apply the structure above to update the area of the union within the same time bound.We give more details in Section 3.
A set of pseudo-lines in the plane is a set of infinite x-monotone curves each pair of which intersects at exactly one point.Arrangements of pseudo-lines have been intensively studied in discrete and computational geometry; see the recent survey on arrangements [14] for a review of combinatorial bounds and algorithms for arrangements of pseudo-lines.At the heart of our solution to the dynamic maintenance of U lies an efficient data structure for the following problem: Given n pseudo-lines in the plane, dynamically maintain their lower envelope such that one can efficiently answer vertical ray shooting queries from y = −∞.Here, the dynamization allows insertions and deletions.For the case of lines (rather than pseudo-lines), there are several efficient data structures to choose from [8,9,18,7,16]; these are, however, not directly applicable for pseudo-lines.Also, there are powerful general structures based on shallow cuttings [5,10,15].These structures can handle general families of algebraic curves of bounded description complexity and typically also work in R 3 .However, the additional flexibility comes at a cost: the algorithms are quite involved, the performance guarantees are in the expected and amortized sense, and the operations have (comparatively) large polylogarithmic running times.For pseudo-lines, Chan's method [10], with improvements by Kaplan et al. [15], yields O(log 3 n) amortized expected insertion time, O(log 5 n) amortized expected deletion time, and O(log 2 n) worst-case query time.The solution that we propose here is, however, considerably simpler and more efficient: We devise a fully dynamic data structure with O(log 2 n) worst-case update-time, O(log n) worst-case ray-shooting query-time, and O(n) space.Additionally, we describe how to find all pseudo-lines below a given query point in O(log n + k log 2 n) time, where k is the output size.The structure is an adaptation of the Overmars-van Leeuwen structure [18], matching the performance of the original structure for the case of lines.The key innovation is a new algorithm for finding the intersection between two lower envelopes of planar pseudo-lines in O(log n) time, using tentative binary search (where each pseudo-line in one envelope is "smaller" than every pseudo-line in the other envelope, in a sense to be made precise below).To the best of our knowledge this is the most efficient data structure for the case of pseudo-lines to date.
For our solution to the union-maintenance problem, we need to answer intersectionsearching queries of the form: Given the collection C of unit-radius circular arcs that comprise ∂U and a query unit disc D, report the arcs in C intersecting D. This problem is a special case of the intersection searching problem in which we wish to preprocess a set of geometric objects into a data structure so that the set of objects intersected by a query object can be reported efficiently.Intersection-searching queries are typically answered using multi-level partition trees; see the recent survey [1] for a comprehensive review.Our final result is a data structure for the intersection-searching problem in which the input objects are arbitrary unit-radius circular arcs rather than arcs forming the boundary of the union of the unit discs, and the query is a unit disc.We present a linear-size data structure with O(n log n) preprocessing time, O(n 1/2+δ + ) query time and O(log 2 n) amortized update time, where is the size of the output and δ > 0 is a small constant.Note that because of lack of space, many proofs are omitted from this version and can be found in [3].

Dynamic lower envelope for pseudo-lines
We describe a data structure to dynamically maintain the lower envelope of an arrangement of planar pseudo-lines under insertions and deletions.Even though we present our data structure for pseudo-lines, it holds for more general classes of planar curves; see below.

Preliminaries
Let E be a planar family of pseudo-lines, and let be a vertical line strictly to the left of the first intersection point in E. The line defines a total order ≤ on the pseudo-lines in E, namely for e 1 , e 2 ∈ E, we have e 1 ≤ e 2 if and only if e 1 intersects below e 2 .Since each pair of pseudo-lines in E crosses exactly once, it follows that if we consider a vertical line strictly to the right of the last intersection point in E, the order of the intersection points between and E, from bottom to top, is exactly reversed.
The lower envelope L(E) of E is the x-monotone curve obtained by taking the pointwise minimum of the pseudo-lines in E. Combinatorially, the lower envelope L(E) is a sequence of connected segments of the pseudo-lines in E, where the first and last segment are unbounded.Two properties are crucial for our data structure: (A) every pseudo-line contributes at most one segment to L(E); and (B) the order of these segments corresponds exactly to the order ≤ on E defined above.In fact, our data structure works for every set of planar curves with properties (A) and (B) (with an appropriate order ≤), even if they are not pseudo-lines in the strict sense; this fact will prove useful in Section 3 below.
We assume a computational model in which primitive operations on pseudo-lines, such as computing the intersection point of two pseudo-lines or determining the intersection point of a pseudo-line with a vertical line can be performed in constant time.

Data structure and operations
The tree structure.Our primary data structure is a balanced binary search tree Ξ.Such a tree data structure supports insert and delete, each in O(log n) time.The leaves of Ξ contain the pseudo-lines, from left to right in the sorted order defined above.An internal node v ∈ Ξ represents the lower envelope of the pseudo-lines in its subtree.More precisely, every leaf v of Ξ stores a single pseudo-line e v ∈ E. For an inner node v of Ξ, we write E(v) for the set of pseudo-lines in the subtree rooted at v. We denote the lower envelope of E(v) by L v .The inner node v has the following variables: f , , r: a pointer to the parent, left child and right child of v, respectively; max: the last pseudo-line in E(V) (last in the ordering defined in Section 2.1) Λ: a balanced binary search tree that stores the prefix or suffix of L(v) that is not on the lower envelope L(f ) of the parent (in the root, we store the lower envelope of E).The leaves of Λ store the pseudo-lines that support the segments on the lower envelope, with the endpoints of the segments, sorted from left to right.An inner node of Λ stores the common point of the last segment in the left subtree and the first segment in the right subtree.We will need split and join operations on the binary trees, which can be implemented in O(log n) time.
Queries.We now describe the query operations available on our data structure.In a vertical ray-shooting query, we are given a value x 0 ∈ R, and we would like to find the pseudo-line e ∈ E where the vertical line : x = x 0 intersects L(E).Since the root of Ξ explicitly stores L(E) in a balanced binary search tree, this query can be answered easily in O(log n) time.
Lemma 1.Let : x = x 0 be a vertical ray shooting query.We can find the pseudo-line(s) where intersects L(E) in O(log n) time.
Lemma 2. Let q ∈ R 2 .We can report all pseudo-lines in E that lie below q ∈ R 2 in total time O(log n + k log 2 n), where k is the output size Update.To insert or delete a pseudo-line e in Ξ, we follow the method of Overmars and van Leeuwen [18].We delete or insert a leaf for e in Ξ using standard binary search tree techniques (the v. max pointers guide the search in Ξ).As we go down, we construct the lower envelopes for the nodes hanging off the search path, using split and join operations on the v.Λ trees.Going back up, we recompute the information v.Λ and v. max.To update the v.Λ trees, we need the following operation: given two lower envelopes L and L r , such that all pseudo-lines in L are smaller than all pseudo-lines in L r , compute the intersection point q of L and L r .In the next section, we see how to do this in O(log n) time, where n is the size of E. Since there are O(log n) nodes in Ξ affected by an update, this procedure takes O(log 2 n) time.More details can be found in [18,19].Lemma 3. It takes O(log 2 n) to insert or delete a pseudo-line in Ξ.

Finding the intersection point of two lower envelopes
Given two lower envelopes L and L r such that all pseudo-lines in L are smaller than all pseudo-lines in L r , we would like to find the intersection point q between L and L r in O(log n) time.We assume that L and L r are represented as balanced binary search trees.The leaves of L and L r store the pseudo-line segments on the lower envelopes, sorted from left to right.We assume that the pseudo-line segments in the leaves are half-open, containing their right, but not their left endpoint in L ; and their left, but not their right endpoint in L r . 1 Thus, it is uniquely determined which leaves of L and L r contain the intersection point q.A leaf v stores the pseudo-line L(v) that supports the segment for v, as well as an endpoint v.p of the segment, namely the left endpoint if v is a leaf of L , and the right endpoint if v is a leaf of L r . 2 An inner node v stores the intersection point v.p between the last pseudo-line in the left subtree v. of v and the first pseudo-line in the right subtree v.r of v, together with the lower envelope L(v) of these two pseudo-lines.These trees can be obtained by appropriate split and join operations from the Λ trees stored in Ξ.Let u * ∈ L and v * ∈ L r be the leaves whose segments contain q.Let π be the path in L from the root to u * and π r the path in L r from the root to v * .Our strategy is as follows: we simultaneously descend into L and into L r .Let u be the current node in L and v the current node in L r .In each step, we perform a local test on u and v to decide how to proceed.There are three possible outcomes: 1. u.p is on or above L(v): the intersection point q is equal to or to the left of u.p.If u is an inner node, then u * cannot lie in u.r; if u is a leaf, then u * lies strictly to the left of u; 2. v.p lies on or above L(u): the intersection point q is equal to or to the right of v.p.If v is an inner node, then v * cannot lie in v. ; if v is a leaf, then v * lies strictly to the right of v; 3. u.p lies below L(v) and v.p lies below L(u): then, u.p lies strictly to the left of v.p (since we are dealing with pseudo-lines).It must be the case that u.p is strictly to the left of q or v.p is strictly to the right of q (or both).In the former case, if u is an inner node, u * lies in or to the right of u.r and if u is a leaf, then u * is u or a leaf to the right of u.In the latter case, if v is an inner node, v * lies in or to the left of v. and if v is a leaf, then v * is v or a leaf to the left of v; see Figure 1.
The invariant: the current search nodes are u and v. uStack contains all nodes on the path from the root to u where the path goes to a right child (orange squares), vStack contains all nodes from the root to v where the path goes to a left child (orange squares).The final leaves u * and v * are in one of the gray subtrees; and at least one of them is under u or under v.
Although it is clear how to proceed in the first two cases, it is not immediately obvious how to proceed in the third case, because the correct step might be either to go to u.r or to v. .In the case of lines, Overmars and van Leeuwen can solve this ambiguity by comparing the slopes of the relevant lines.For pseudo-lines, however, this does not seem to be possible.For an example, refer to Figure 1, where the local situation at u and v does not determine the position of the intersection point q.Therefore, we present an alternative strategy.
; we go to u.r and to v. .We will maintain the invariant that the subtree at u contains u * or the subtree at v contains v * (or both).In Case 3, u * must be in u.r, or v * must be in v. ; see Figure 3.We move u to u.r and v to v. .One of these moves must be correct, but the other move might be mistaken: we might have gone to u.r even though u * is in u. or to v. even though v * is in v.r.To correct this, we remember the current u in a stack uStack and the current v in a stack vStack, so that we can revisit u. or v.r if it becomes necessary.This leads to the general situation shown in Figure 2: u * is below u or in a left subtree of a node on uStack, and v * is below v or in a right subtree of a node on vStack, and at least one of u * or v * must be below u or v, respectively.Now, if Case 1 occurs when comparing u to v, we can exclude the possibility that u * is in u.r.Thus, u * might be in u. , or in the left subtree of a node in uStack; see Figure 4. To make progress, we now compare u , the top of uStack, with v. Again, one of the three cases occurs.In Case 1, we can deduce that going to u .rwas mistaken, and we move u to u ., while v does not move.In the other cases, we cannot rule out that u * is to the right of u , and we move u to u. , keeping the invariant that u * is either below u or in the left subtree of a node on uStack.However, to ensure that the search progresses, we now must also move v.In Case 2, we can rule out v. , and we move v to v.r.In Case 3, we move v to v. .In this way, we keep the invariant and always make progress: in each step, we either discover a new node on the correct search paths, or we pop one erroneous move from one of the two stacks.Since the total length of the correct search paths is O(log n), and since we push an element onto the stack only when discovering a new correct node, the total search time is O(log n); see an example run in [3].For the full pseudocode and the formal proof see [3].
Comparing u to v: in Case 1, we know that u * cannot be in u.r.We compare u and v to decide how to proceed: in Case 1, we know that u * cannot be in u .r;we go to u .; in Case 2, we know that u * cannot be in u.r and that v * cannot be in v. ; we go to u. and to v.r; in Case 3, we know that u * is in u .r(and hence in u. ) or in v. ; we go to u. and to v. .

Maintaining the union of unit discs under insertions
To maintain the union of unit discs under insertions, we maintain dynamic data structures for representing the boundary of the union, for reporting the arcs of the boundary that intersect with the next disc to be inserted, and for updating the boundary representation due to the insertion of the new disc.This section is dedicated to these data structures.
Overview of the algorithm.We denote by D(x) the unit disc centered at x. Let U be the union of n unit discs and let D(x) be the new unit disc, which we wish to insert.In order to report the arcs of ∂U that intersect D(x), we overlay the plane with an implicit grid, where only cells that intersect with U are stored, and where the size of the diagonal of a grid cell is 1.The arcs of ∂U are divided into the cells of the grid -each arc of ∂U is associated with the cell that contains it.Note that if an arc belongs to more than one cell then we split it into (sub)arcs at the boundaries of the cells that it crosses (see an illustration of the structure in [3].We divide the arcs of a given cell into four sets: top, right, bottom and left, which we denote by E t , E r , E b and E l respectively (see Section 3.1).The algorithm consists of the following main steps: (1) Find the cells that D(x) intersects.( 2) For each such cell find the arcs of each one of the sets E t , E r , E b and E l that D(x) intersects.Cells of the union that contain no boundary arcs are treated in a special way.(3) Update ∂U using the arcs we found in the previous step and with ∂D(x).
Step 1 of the algorithm is implemented using a balanced binary tree Ω on the active cells, namely cells that have non-empty intersection with the current union U .The key of each active cell is the pair of coordinates of its bottom left corner.The active cells are stored at the leaves of the tree in ascending lexicographic order.Finding the cells intersected by a new disc, inserting or deleting a cell, take O(log n) time each.For details, see, e.g., [13].As we will see below, the structure Ω will also be used to decide whether a new disc is fully contained in the current union or lies completely outside the current union (Section 3.3).
Most of this section is dedicated to a description of Steps 2 and 3 of the algorithm for the set E t .The sets E r , E b , and E l can be handled in a similar manner.The basic property that we use is that D(x) intersects an arc e if and only if x belongs to e ⊕ D 1 , namely the Minkowski sum of e with a unit disc.
We split the boundaries of the Minkowski sums E t into upper and lower curves at the x-extremal points; in what follows, we refer to them as upper and lower curves, and denote their respective sets by Γ + and Γ − .(For clarity, we will refer to portions of the boundary of the union as arcs and to portions of the boundary of the Minkowski sums as curves.)The disc D(x) intersects the arc e ∈ E t if and only if x lies above the lower curve induced by e and below the upper curve induce by e.We will store the curves of Γ + in a dynamic structure ∆ + and the curves of Γ − in a dynamic structure ∆ − (both described in Section 3.2).
Another property that we use is the following (see Lemma 12 below): Let be a vertical line that passes through x, the center of the new disc.Then the intersection points of curves in Γ + with are all above the intersection points of curves of Γ − with .
Assume for the sake of exposition that we are given the point ξ of intersection between and the upper envelope of the curves in Γ − .If the center x of our new disc is above ξ then, since x is above all the lower curves that cross we only need to search the structure ∆ + for the upper curves that lie above x -these will determine the arcs of E t that are intersected by D(x).If the point x coincides with or lies below ξ then we only need to search the structure ∆ − for the lower curves that lie below x -now these will determine the arcs of E t that are intersected by D(x).
However, we cannot easily obtain the point ξ, and hence querying the data structures is a little more involved: We use ∆ + to iterate over the upper curves that lie above x.For every upper curve we check in O(1) time whether its corresponding arc (of E t ) intersects with D(x).If it intersects then we add this arc to the output list and continue to the next upper curve.If all the upper curves above x turn out to be induced by arcs intersecting D(x) we output this list of arcs and stop.
If all the reported arcs from the query of ∆ + indeed intersect D(x), then we are guaranteed that x is above ξ and this is the complete answer.Due to Lemma 12, if we detect that the arc induced by a curve reported by ∆ + to lie above x is not intersecting D(x), then we are guaranteed that x is on or below ξ and we will obtain the full reply by querying ∆ − .
We review the geometric foundations needed by our algorithms and data structures in Section 3.1, then describe the data structures in Section 3.2.Finally, in Section 3.3 we explain how we solve our motivating problem -dynamically reporting the area of the union.

Preliminaries
Let B be an axis-parallel square, which represents one grid cell with unit-length diagonal, and let 1 and 2 be lines that support the diagonals of B. These lines divide the plane into top, right, bottom and left quadrants, which we denote by Q t , Q r , Q b and Q l , respectively.
Let U be the union of n unit discs.We divide the arcs of ∂U that are contained in B into four sets according to the quadrant which contains their centers.In case that a center lies on one of the lines then it is added either to the top or to the bottom quadrant.Denote these four sets of arcs by E t , E r , E b and E l .The power of this subdivision into quadrants is that now the projections of the arcs in any one set onto a major axis (the x-axis for E t or E b , and the y-axis for E l or E r ), are pairwise interior disjoint.For example, E t contains the arcs whose centers are located in Q t , and the projections of the arcs in E t onto the x-axis are pairwise interior disjoint, as we show below in Lemma 6. Definition 4. For two bounded x-monotone arcs e i and e j we write e i ≤ x e j if and only if the right endpoint of e i is to the left of or coincides with the left endpoint of e j .Lemma 5.Each arc in E t is portion of a lower semicircle.

Lemma 6. The x-projections of the (relative interiors of) arcs in E t are pairwise disjoint.
Relying on Lemma 6, henceforth we assume that the arcs in E t are ordered from left to right: e 1 , . . ., e m .We wish to find which arcs of the set E t intersect with the new unit disc D(x) to be inserted.For this purpose, we compute the Minkowski sum of each arc e i of E t with a unit disc centred at the origin.Then, we divide the boundary of each Minkowski sum into upper and lower curves at the x-extremal points: denote the top curve by γ + i and the bottom curve by γ − i .We denote the set of the upper curves, {γ + i |e i ∈ E t }, by Γ + and the set of the lower curves, {γ − i |e i ∈ E t }, by Γ − .In the rest of this section we prove some useful properties regrading the curves in Γ + and Γ − : P1 Every lower curve in Γ − can appear at most once on the lower envelope of the curves in Γ − .Furthermore, if γ − i and γ − j appear on the lower envelope then γ − i appears to the left of γ − j if and only if e i < x e j .P2 Let e i , e i+1 and e i+2 be an ordered sequence of arcs in E t and q be a point.If q lies below γ + i and γ + i+2 then q lies also below γ + i+1 .P3 For every vertical line .The intersection points of the lower curves with are below the intersection points of the upper curves with .

26:10 Maintaining the Union of Unit Discs
In order to prove Property P1, we first need to show that every pair of lower curves intersect at most once.Lemma 7. Let e i and e j be arcs of E t .Then γ − i and γ − j intersect in exactly one point.For two x-monotone curves 1 , 2 that intersect exactly once, we say that 1 < 2 when 1 appears on their joint lower envelope immediately to the left of their intersection point and 2 < 1 otherwise.The proof of Lemma 7 also implies,

Corollary 8. For any pair of curves γ
and only if e i < x e j .We now turn to discuss the upper curves.To prove Property P2 (Lemma 10), we first consider the structure of the upper envelope of the upper curves.Observation 9. Let p and q be the endpoints of the arc e i in E t .The upper curve γ + i is the upper envelope of the upper boundaries (namely, semicircles) of the discs D(p) and D(q) Lemma 10.Let e i , e i+1 and e i+2 be an ordered sequence of arcs in E t and q be a point.If q is below γ + i and γ + i+2 then q is also below γ + i+1 .Proof.Let p 1 , p 2 , p 3 be points on arcs that belong to E t with p 1 < x p 2 < x p 3 .Let σ + 1 , σ + 2 and σ + 3 be the upper semicircles of ∂D(p 1 ), ∂D(p 2 ) and ∂D(p 3 ), respectively.Let p + 12 and p + 23 be the intersection points of σ + 1 ∩ σ + 2 and σ + 2 ∩ σ + 3 , respectively.These intersection points exist, since the distance between every pair of points in B is at most one.By the assumption, p 1 < x p 2 , which means that σ + 1 appears to the left of σ + 2 on the upper envelope of σ + 1 and σ + 2 .Let c be the center of the arc e of E t on which p 2 lies.The point c is on σ + 2 , since p 2 belongs to a lower semicircle of radius 1.In addition, c is not below σ + 1 since otherwise p 1 ∈ D(c) which would contradict that p 1 is a point on an arc in E t .This means that p + 12 ≤ x c.The same argument implies that p + 23 ≥ x c and therefore p + 12 ≤ x p + 23 .This in turn implies that the intersection point, p + 13 , between σ + 1 and σ + 3 is below or on σ + 2 and therefore every point that lies below σ + 1 and σ + 3 lies below σ + 2 .The only condition on p 1 , p 2 and p 3 is that they will be x-ordered.e i ≤ x e i+1 ≤ x e i+2 , so the claim holds (see Figure 5).For p an endpoint of e i ∈ E t , we call the upper semi-circle of the disc D(p) the upper curve of p.We denote the upper envelope of the curves in Γ + by U(Γ + ).Note that some of the upper curves may appear on U(Γ + ) as a single point, namely, they coincide with one of the breakpoints of U(Γ + ).The following corollary stems from the proof of Lemma 10.

Corollary 11. (i) The upper curve of each endpoint of every arc of E t appears on U(Γ + ).
(ii) The x-order of the curves on U(Γ + ) corresponds to the x-order of the endpoints of the arcs of E t .
Next, we prove that for any pair of arcs e i , e j ∈ E t , γ + i and γ − j are disjoint.Furthermore, we show that γ + i is above γ − j , and by that prove Property P3.

Lemma 12.
Let e i and e j be two distinct arcs in E t and let be a vertical line.If intersects with γ + i and γ − j at p and q, respectively, then p > y q.

Data structures
In this section we describe two data structures.The data structure ∆ + (resp.∆ − ), dynamically maintains the set Γ + of the upper curves (resp.Γ − of lower curves).The purpose of these structures is to efficiently answer the following queries: given a point x, report on the upper (resp.lower) curves which are above (resp.below) x.For the structure ∆ + it is required that we get the answer gradually, one curve after the other, since we need to test each curve for being relevant (in addition to being above x), and stop as soon as we detect the first irrelevant curve.

Dynamically maintaining the lower curves
For maintaining the lower curves Γ − induced by the arcs in E t , we implement ∆ − using the data structure described in Section 2. Recall that the data structure dynamically maintains a set of curves fulfilling property P1 and supports the following query: given a point x report the curves in Γ − that are below x.
Update.After we insert a new unit disc we may have to delete and insert many lower curves.If a lower curve γ − i is split into subcurves, then we delete γ − i and create two new subcurves instead.In order for Property P1 to hold at all times, we first delete the old lower curves from ∆ − and then insert the new ones.

Dynamically maintaining the upper curves
Description.Let p 1 , p 2 , . . ., p r be the endpoints of the arcs of E t sorted in ascending x-order.Recall that U(Γ + ) denotes the upper envelope of Γ + .Let s 1 , s 2 , . . ., s r be the arcs of U(Γ + ) ordered from left to right.Note that each endpoint of E t corresponds to an arc in U(Γ + ), i.e., p i corresponds to the curve s i .The data structure ∆ + is a balanced binary search tree.We store the points p i in the leaves of the tree in their left-to-right order.We also store in each leaf pointers rn and ln to its right and left neighboring leaves respectively, if exist.Each internal node stores a pointer lml to the leftmost leaf of its right subtree.To keep the a structure simple, if two arcs of E t meet at a single point, we keep only one of the endpoints incident to this point in the list {p i }.However, we mark in the leaf of p i which are the two arcs incident to it.Below, when we traverse the leaves of the tree and test the respective arcs of E t for intersection with the new disc, in some nodes we may need to test two arcs.
Query.Let q be a query point.By following a path from the root, we first find the leaf v such that the vertical line through p intersects the edge s v .The search down the tree is carried out as follows.Suppose we reached an internal node u.We use the pointer lml(u) to obtain the leaf w, and use ln(w) to find the point immediately to its left in the sequence {p i }.These two points will determine the breakpoint of U(Γ + ) that separates between the left and right portions of the envelope, which are represented by the subtrees rooted at the left and right children of u.
Recall that the structure ∆ + plays the extra role of deciding whether the center x of the new disc lies above the point ξ or not (see the overview the algorithm in the beginning of Section 3).Therefore the query process is somewhat more involved than if we used the structure only to determine which curves of Γ + pass above x.
Once we find the point p i whose arc s i of the envelope intersects the vertical line through the query point q, we will be traversing leaves of ∆ + starting at v going both rightward and leftward.At each leaf u we test whether q lies below the curve s j stored at u and if so, we check whether D(x) intersects the relevant arc of E t .If the answer to both predicates is true then we continue the search in the same direction.If while we search rightwards the first predicate is false then we go leftwards starting from v. If the first predicate is false and we search leftwards then we stop the search and report on the arcs that we found.If the first predicate is true and second predicate is false then we continue with ∆ − .Update.After we insert a new disc, many arcs may be deleted from E t and many new arcs may be inserted into E t .We simply remove the endpoints of the deleted arcs and insert the endpoints of the new arcs into ∆ + .
The correctness of the query procedure follows from Lemma 10.The performance of the structure is summarized in the following lemma whose proof is straightforward.When querying the data structures ∆ + and ∆ − we obtain the set I of arcs of the existing union-boundary that need to be deleted or partially cut since they are covered by the new disc D(x) to be inserted.However, we also need to update the structures with the arcs that the boundary of the new disc contributes to the union boundary.
To find which portions of ∂D(x) appear on the boundary of the union U ∪ D(x), we construct the arrangement A(I ∪ ∂D(x)) and look for faces of this arrangement that abut ∂D(x) and are not in the union U .One can show that in a face f of this type the arcs of ∂U appear on it as concave, meaning that any point inside this face is outside the disc bounded by the arcs.Denote the size of I by k.Assume first that k ≥ 1.We can construct the arrangement in O(k log k) time (recall that the arcs in I ∪ ∂D(x) are pairwise interior disjoint).Finding the arcs of ∂D(x) that should be inserted takes another O(k) time.
If k = 0, there are two cases based on whether D(x) ∩ U is (i) D(x) or (ii) the empty set.To distinguish between the cases we need to either (i) find a point that belongs to D(x) and U , or (ii) a point that belongs to D(x) but not to U .Recall that in order to find I we overlay the plane with a grid of cells of unit-length diagonal each.This implies that at least one of the cells, denoted by ω, is fully contained in D(x).If ω is an active cell, i.e., ω ∩ U = ∅, then ω is fully contained in U (I is an empty set) and therefore D(x) ∩ U = D(x); otherwise D 1 (x) ∩ U = ∅.To check whether ω is active, we search for it in the structure Ω.In case (i) we do nothing further, and in case (ii) we make all the grid cells covered by D(x) active, and we update the data structures of each grid cell crossed by ∂D(x) by the relevant portions of ∂D(x).To conclude, Theorem 14.The boundary arcs of the union of a set of n unit discs can be maintained under insertion in a data structure of O(n) size so that a new disc can be inserted in O(k log 2 n) time, where k is the total number of changes on the boundary of the union.

Maintaining the area of the union
We are now ready to solve our motivating problem, namely dynamically reporting the area of the union as we insert discs.At a a high level our algorithm proceeds as follows: 1. Find the set I of the arcs on the boundary of the union U that intersect with the new disc D(x) to be inserted.

Compute the arrangement A(I ∪ ∂D(x)).
3. Calculate the extra area (over the area of the union before inserting D(x)) that D(x) covers, using A(I ∪ ∂D(x)).
In order to find I we make use of the data strctures described above and summarized in Theorem 14.Let k denote the number of arcs in I and assume that k ≥ 1.We use a sweep-line algorithm to compute the arrangement A(I ∪ ∂D(x)) in time O(k log k).To calculate the extra area that D(x) covers, we go over the faces of the arrangement and sum up the area of the faces that are contained in D(x) \ U .If k = 0 then either the disc is fully contained in the current union (see above for how to determine this), in which case we do nothing, or it is disjoint from the union before the insertion of the disc, in which case we increase the area by π.To conclude, Theorem 15.Given a sequence of n unit discs in R 2 to be inserted one after the other, reporting the area of the union of the discs after each insertion can be carried out in O(k log 2 n) time and O(n) space, where k is the total number of structural changes to the boundary of the union incurred by the insertion of the new disc.

Intersection-searching of unit arcs with unit disc
In this section we address the following intersection-searching problem: Preprocess a collection C of circular arcs of unit radius into a data structure so that for a query unit disc D(x), centered at the point x, the arcs in C intersecting D(x) can be reported efficiently.We assume for simplicity that every arc in C belong to the lower semicircle.
Let e ∈ C be a unit-radius circular arc, and let p 1 and p 2 be its endpoints.A unit disc D(x) intersects e if and only if e ⊕ D(0), the Minkowski sum of e with a unit disc, contains the center x.Let z := D(p 1 )∪D(p 2 ), and let D + (c) be the disk of radius 2 centered at c; z divides D + (c) into three regions (see Fig. 6): (i) z + , the portion of D + (c) \ z above z, (ii) z itself, and (iii) z − , the portion of D + (c) \ z below z.It can be verified that e ⊕ D(0) = z ∪ z − .We give an alternate characterization of z ∪ z − , which will help in developing the data structure.
Proof.Assume that q exists.The quadrilateral (c, p 1 , q, p 2 ) is a rhombus since all its edges have length 1.Let α be the angle ∠p 1 qp 2 and β be the angle ∠cp 1 q.The angle ∠qp 1 p 1 is equal to α since the segment (c, p 1 ) is a diameter of D(p 1 ).The angle ∠p 1 qp 1 is equal to β 2 since p 1 qp 1 is an isosceles triangle.The same arguments apply to the angle ∠p 2 qp 2 implying that the angle ∠p 1 qp 2 is equal to π.
Assume that q does not exists then the segment (p 1 , p 2 ) is a diameter of D(c).The segment (c, p 1 ) is a diameter of D(p 1 ).The segment (p 1 , p 2 ) coincide with (c, p 1 ) at the segment (c, p 1 ).The same argument applies to the segment (c, p 2 ), implying that the angle ∠p 1 qp 2 is equal to π (see Fig 6).The following corollary summarizes the criteria for the intersection of a unit circular arc with a unit disc.We thus construct three separate data structures.The first data structure preprcesses the left endpoints of arcs in C for unit-disc range searching, the second data structure preprocesses the right endpoints of arcs in C for unit-disc range searching, and the third data structure preprocesses L = {L(e) | e ∈ C} for inverse range searching, i.e., reporting all regions in L that contain a query point.Using standard circle range searching data structures (see e.g.[4,2]), we can build these three data structures so that each of them takes O(n) space and answers a query in O(n 1/2+ + k) time, where k is the output size.Furthermore, these data structures can handle insertions/deletions in O(log 2 n) time.We omit all the details from here and conclude the following: Theorem 18.Let C be a set of n unit-circle arcs in R 2 .C can be preprocessed into a data structure of linear size so that for a query unit disk D, all arcs of C intersecting D can be reported in O(n 1/2+ + k) time, where is an arbitrarily small constant and k is the output size.Furthermore the data structure can be updated under insertion/deletion of a unit-circle arc in O(log 2 n) amortized time.

Figure 1 (
Figure 1 (On the top).An example of case 1. Case 2 is symmetric.(On the bottom).An example of Case 3. L is blue; Lr is red.The solid pseudo-lines are fixed.The dashed pseudo-lines are optional, namely, either none of the dashed pseudo-lines exists or exactly one of them exists.u.p and v.p are the current points; and Case 3 applies.Irrespective of the local situation at u and v, the intersection point can be to the left of u.p, between u.p and v.p, or to the right of v.p, depending on which one of the dashed pseudo-lines exists.

BFigure 5 (
Figure 5 (On the left).An example of ∂U ∩ B. e1, e2 and e3 are the arcs of Et whose centers are c1, c2 and c3, respectively.The red, green and blue outer shapes are the boundary of Minkowski sums of each of e1, e2 and e3 with a disc of radius 1, respectively.γ + 1 and γ − 1 are denoted by the upper and lower red curves whose endpoints are q1 and q2, respectively.(On the right) Illustration of the proof of Lemma 10.

Lemma 13 .
The query time of the data structure is O(log n + k), where k is the number of reported arcs.The update requires O(log n) time per operation.

Figure 6 (
Figure 6 (On the left) Partition of D2(c) into three regions: z + , z and z − .(On the right) Illustration of Lemma 16.

Corollary 17 .
Let e be a circular arc in C with endpoints p 1 and p 2 and center c.Then (i) z ∪ z − = z ∪ L(e).(ii) e intersects a unit disc D(x) if and only if at least one of the following conditions is satisfied: (a) x ∈ D(p 1 ) (or p 1 ∈ D(x)), (b) x ∈ D(p 2 ) (or p 2 ∈ D(x)), and (c) x ∈ L(e).