首页 > 代码库 > 一篇关于完全动态凸包的paper(侵删)
一篇关于完全动态凸包的paper(侵删)
先放原文,挖个坑,到时候再来说人话ε=(′ο`*)))
作者:Franco P. Preparata
出处:Computational geometry An introduction
The technique described in the preceding section could be viewed as the maintenance of a data structure, describing the convex hull of a set of points, when the only operations permitted are insertions. The most natural question arising at this point is: Can we design a data structure, organizing a set of points in the plane and describing their current convex hull, under the hypothesis that not only insertions but also deletions are permitted?
This question, as may be expected, has no simple answer. Indeed, whereas in the on-line convex hull algorithm of Section 3.3.6 points found to be internal to the current convex hull are definitively eliminated from consideration, in this new situation we must carefully organize all points currently in the set because the deletion of a current hull point may cause several internal points to resurface on the hull boundary (refer to Figure 3.18).
This was the problem considered by Overmars and van Leeuwen, which can be formalized as follows.
PROBLEM CH7 (HULL MAINTENANCE). Given an initially empty set S and a sequence of N points (PI ,P2, . . . , PN) each of which corresponds either to an insertion or to a deletion from S (of course, a point can be deleted only if present in S), maintain the convex hull of S.
We shall now illustrate the very interesting solution of this problem proposed by Overmars and van Leeuwen (1981).
First, we exploit the fact that the convex hull boundary is the union of two (convex) monotone chains. Typically, one may consider the two chains comprised between two points of smallest and largest x-coordinate, respectively. These chains are upward and downward convex, and have been appropriately called the U-hull and L-hull of the point set, respectively (U for upper, L for lower). For example, the U-hull of a point set S is obtained (see Figure 3.19) as the ordinary convex hull of Su {TL}, where OOL is the point (0, — 00) in the plane. [ This notion was also used in Andrew‘s variant of Graham‘s algorithm (see Section 3.3.2).] After observing that the convex hull of S is obtained by trivially intersecting (concatenating) its U-hull and L-hull, we may restrict our analysis to one of the latter, say the U-hull.
Not surprisingly, both the on-line convex hull technique of Section 3.3.6 and the present fully dynamic technique use trees as data structures. However, there is a basic difference in the representation of the hull in the two approaches. In the former, each tree node represents a point. In the latter, only leaves are used to represent points, while each internal node represents the Uhull of its leaves.
The data structure T is organized as follows. Its skeletal component is a height-balanced binary search tree T (with some care, a 2-3 tree [Aho— Hopcroft—Ullman (1974), p. 146] could be used instead) whose leaves aredesigned to store the points in the current set. The search is intended to operate on the abscissa x, so that the left-to-right leaf traversal gives the point set in sorted horizontal order. Note now that the sequence of points on the Uhull (the vertices of it) is also ordered by increasing abscissa, so that it is a subsequence of the global point sequence stored in the leaves.
Let v denote a node of T, with LSON[v] and RSON[v] denoting its left and right offsprings, respectively. We wish to be able to construct the U-hull of the (points stored in the) leaves of the subtree rooted at v. Since we shall have to perform splitting and splicing of chains of vertices, we assume that each such chain is represented as a concatenable queue (see Section 3.3.6). Notationally, let U(v) denote the U-hull of the set of points stored in the leaves of the subtree rooted at v. Now, assume inductively that U(LSON[v]) and U(RSON[v]) are available, i.e., the U-hulls pertaining to the offsprings of node v. How can we construct U(v)? Referring to Figure 3.20, all we need is to identify the two support points and P2 of the single common supporting segment of the two hulls. To this end we need a function BRIDGE(UI, U2) to produce the support segment of two U-hulls UI and U2. BRIDGE effectively allows us to split UI into the ordered pair of chains (UI 1, UI 2) (refer to Figure 3.20) and similarly U2 into (UM, Um). We stipulate that support point PI e UI be assigned to UI 1, and pointp2 e U2 be assigned to U22 (i.e., in both cases to the ‘external" subchain). At this stage, by splicing Ull to U22 we obtain the desired U-hull of UI u U2. It is natural to have each node v of T point to a concatenable queue representing that portion of U(v) which does not belong
Suppose we wish to perform the converse operation, i.e., reassemble U(LSON[v]) and U(RSON[v]) assuming that U(v) is available. All that is needed in this case is, with the above notation, knowledge of the bridging edge pi p2, i.e., a single integer J[v] denoting the position of in the vertex chain U(v). With this information U(v) can be split into chains UI 1 and U22, which in turn can be spliced with the chains stored at LSON[v] and RSON[v], respectively. In conclusion, the data structure T is completed by adding to each node v of T the following items.
i.A pointer to a concatenable queue Q[v], storing the portion of U(v) not belonging to (if v is the root, then Q[v] = U(v)).
ii.An integer J[v] denoting the position of the left support point on U(v).
This interesting data structure uses only O(N) space, where N is the size of the current point set. Indeed, the skeletal tree T has N leaves and N — I internal nodes, while the points stored in the concatenable queues represent a partition of the point set.
Since the operations of splitting and splicing concatenable queues are standard, we shall concentrate on the operation BRIDGE for which Overmars and van Leeuwen (1981) propose the following solution.
Lemma 3.1. The bridging of two separated convex chains of N points (in total) can be done in O(log N) steps.
PROOF. Given two U-hulls UI and U2 and two vertices qi e UI and q2 e U2, each of these two vertices can be readily classified with respect to the segment q1q2 as either reflex, or supporting, or concave. (See Section 3.3.6 for an explanation of these terms.) Depending upon this classification there are nine possible cases, which are schematically illustrated in Figure 3.21 (a). The wiggly subchains are those which can be eliminated from further contention for containing a support point. All cases are self-explanatory, except the case (concave, concave), which is further illustrated in Figure 3.21 (b). Let line 11 contain qi and its right neighbor on UI ; similarly let 12 contain q2 and its left neighbor on U2, and let p be the intersection of 11 and 12. Recall that UI and U2 are separated, by hypothesis, by a vertical line l. Assume, at first that p is to the right of l. We observe that support point pi can only belong to the shaded region, and that u has a lower ordinate than v. This implies that each vertex q" on the subchain to the right of % appears concave with respect to the segment q‘q", where q‘ is any vertex of UI . This shows that the chain to the right of q2 can be eliminated from contention, but no similar statement can be made for the chain to the left of qi . If intersection p is to the left of l, then we can show that the chain to the left of qi can be eliminated.
In all cases a portion of one or both hulls is eliminated. If this process starts from the roots of both trees representing UI and U2, respectively, since these trees are balanced, BRIDGE(UI , U2) will run in time O(log N), where N is as usual the total number of vertices in the two hulls.
With the function BRIDGE at our disposal, we may analyze the dynamic maintenance of the planar convex hull. A typical situation is illustrated in Figure 3.22. Here points are indexed by their order of insertion into the set. In the data structure T, each leaf corresponds to a point, whereas each nonleaf node corresponds to a bridge and is shown with the pair Q[v], J[v]. It is immediate to realize that data structure T describes a free tree on the set ofpoints currently being maintained and is appropriately referred to as the hull tree. It is suggested that the reader spend a little time to fully absorb the details of Figure 3.22.
Suppose now we wish to insert a new point p. The insertion must not only produce a height-balanced T by employing the usual rebalancing techniques [Reingold—Nievergelt—Deo (1977)], but must also perform whatever is necessary to ensure that the concatenable queue associated with each vertex still conforms with the definition of the data structure T. For simplicity, let us assume that no rebalancing is necessary (all rebalancing activities simply increase in no significant way the number of nodes to be processed, with no basic conceptual difference). Therefore let PI 3, the point to be inserted in the point set of Figure 3.22, be as shown in Figure 3.23. In this figure, we have also shown the state of the data structure T after the insertion ofPI 3. Note that 3 uniquely identifies a path from the root of T to a leaf (where PI 3 is to be inserted). While we trace this path from the root, at each node v we visit we assemble the U-hull U(v) pertaining to that node and subsequently we disassemble it—using the parameter J[v] in order to pass the appropriate portions to its two offsprings. In this manner we have at the sibling u of each node on the path the complete representation—as a concatenable queue U[u]—of U(u). Less informally this descent in the tree T for the insertion of a point p is carried out by a call where is the following recursive procedure using the functions SPLIT and SPLICE discussed earlier.
procedure DESCEND(v, p) begin if (v leaf) thenAt this point, we insert the new leaf and begin tracing the same path of T toward the root. At each node v on this path we arrive with the complete U-hull pertaining to that node. We have just shown that at v also the U-hull of the sibling of v is available. So we now bridge these two hulls, effectively splitting the U-hull U[v] into two portions QI and Q2, and, correspondingly, U[SIBLING[v]] into Q3 and Q4. The portions Q2 and Q3 are to be kept at v and SIBLING[v], respectively, while the portiom QI is to be passed to the father of v, where it will be spliced with the analogous portion Q4 forwarded by the sibling of v. In this manner we have obtained the U-hull of the father of v and the ascent toward the root can proceed. Less informally again, we use the following procedure.
procedure ASCEND(v) begin if (v root) thenend; else Q[v] U[v] end.
From the performance standpoint, we recall that SPLIT and SPLICE each run in time O(logk), where k is the size of the queue, before splitting or after splicing. Since k N, we see that each node visit in DESCEND costs O(log N) time. Since the depth of Tis also O(log N), DESCEND has a worstcase running time O(log2 N). As to ASCEND, we have shown earlier that BRIDGE also runs in time O(log N), whereby the same bound applies to this case.
A similar analysis applies to the deletion ofa point from the current set, and we leave it as a challenging exercise for the reader. We may therefore summarize this section with the following theorem.
Theorem 3.12. The U-hull and the L-hull of a set of N points in the plane can be dynamically maintained at the worst-case cost of O(log2 N) per insertion or deletion.
Notice that if we use this technique to construct the convex hull of an N-point set on-line—that is, requiring only insertions—we achieve an O(Nlog2 N) running time against the O(Nlog N) of the less powerful technique. Clearly, we are paying a price for using a technique which is more powerful than demanded by the application.
一篇关于完全动态凸包的paper(侵删)