Abstract 1 Introduction 2 Preliminaries: The ๐’Œ-Level of Planes and Planar Triangulations 3 Optimal ๐’Œ-lowest Queries with Fast Plane Insertion 4 Reducing Space to Linear 5 Applications References Appendix A Proof of Lemma 1

Incremental k-Lowest Planes and Planar k-Nearest Neighbor with Optimal Query Time

John Iacono ORCID Universitรฉ libre de Bruxelles, Belgium โ€ƒโ€ƒ Yakov Nekrich ORCID Michigan Technological University, Houghton, MI, USA โ€ƒโ€ƒ Martin P. Seybold ORCID Faculty of Computer Science, Theory and Applications of Algorithms, University of Vienna, Austria
Universitรฉ libre de Bruxelles, Belgium
Abstract

In a set of planes in โ„3, the k-lowest planes query asks for the k lowest planes pierced by a vertical line q. In this paper we describe a semi-dynamic insertion-only data structure that answers k-lowest planes queries in optimal Oโข(logโกn+k) time. Our data structure uses Oโข(n) space, where n is the number of stored planes, and supports insertions in Oโข(log8โกn) amortized time. This result provides the first query optimal data structures for several fundamental problems:

  • โ– 

    An insertion-only structure that answers 3D halfspace range reporting queries on a set of n points in Oโข(logโกn+k) time, where k is the number of reported points.

  • โ– 

    An insertion-only structure that answers 3D vertical ray shooting queries on a set of n planes in Oโข(logโกn+k) time, where k is the number of reported planes.

  • โ– 

    An insertion-only structure that answers planar k-nearest neighbor queries in Oโข(logโกn+k) time for any prescribed k (specified at query time).

  • โ– 

    An insertion-only structure that answers planar circular range reporting queries in time Oโข(logโกn+k), where k is the number of reported points.

For all of the above problems the query bound Oโข(logโกn+k) is optimal, even in the static scenario. All of the above structures use linear Oโข(n) space and support insertions in Oโข(log8โกn) amortized time.

We also obtain a query optimal static structure for a 4D problem. That is, one can compute in near-linear time a data structure that answers weighted halfspace range reporting queries in Oโข(logโกn+k) time, where k is the number of reported points. The structure uses near-linear space.

Keywords and phrases:
Data Structures, Dynamic Data Structures, k Nearest-Neighbor Queries
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image]โ€‚ยฉ John Iacono, Yakov Nekrich, and Martin P. Seybold; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation โ†’ Computational geometry
; Theory of computation โ†’ Data structures design and analysis
Acknowledgements:
Many thanks to all contributors of Vorosketch and Ipe.
Funding:
Work supported by the Fonds de la Recherche Scientifique โ€“ FNRS. Supported by the National Science Foundation under NSF grant 2203278. This research was funded in whole or in part by the Austrian Science Fund (FWF) 10.55776/PAT2190825.
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

Data structures for sets of 3D planes have been studied extensively. Some important examples of such problems are 3D halfspace range reporting [1] and dynamic 3D convex hull [5].

In this paper we study the following k-lowest planes problem: A set of three-dimensional planes is stored in a data structure. For any query tuple (q,k), where q is a vertical line and k is a positive integer, we must report the k-lowest planes pierced by q. We investigate this problem in the semi-dynamic insertion-only scenario and describe a data structure with Oโข(log8โกn) amortized insertion time that supports k-lowest planes queries in optimal Oโข(logโกn+k) time. Using this, we obtain improved solutions for extensively studied problems.

Results.

Our main result is the insertion-only data structure that answers k-lowest planes queries in optimal time Oโข(logโกn+k). This data structure can be used to obtain optimal query time for several semi-dynamic and static problems. Henceforth we use n to denote the number of geometric objects (points, planes) stored in the data structure and we use k to denote the number of geometric objects that are reported when we answer a query.

  1. 1.

    Vertical ray shooting in a set of 3D planes. A vertical ray shooting query q, for a three-dimensional point q, asks for all planes that are pierced by the downward vertical ray from q. We obtain a semi-dynamic insertion-only data structure that answers vertical ray shooting queries in Oโข(logโกn+k) time.

  2. 2.

    Halfspace range reporting in a set of 3D points. A halfspace range reporting query h asks for all points that are below a plane h. We obtain a semi-dynamic insertion-only data structure that answers halfspace range reporting queries in Oโข(logโกn+k) time.

  3. 3.

    Nearest neighbor in a set of planar points. A nearest neighbor query q, for a two-dimensional point q, asks for the point that is closest to q. A k-nearest neighbor query (q,k), for a point q and integer kโ‰ฅ1, asks for k points that are closest to q. We describe a semi-dynamic insertion-only data structure that answers k-nearest neighbor queries in Oโข(logโกn+k) time for any k; integer k can be specified at query time.

  4. 4.

    Circular range reporting in a set of planar points. A circular range reporting query (q,R) asks for all points in the circle with center q and radius R. We obtain a semi-dynamic insertion-only data structure that answers circular range reporting queries in Oโข(logโกn+k) time.

  5. 5.

    Weighted halfspace range reporting. In this generalization of halfspace reporting, each 3D point has an additional coordinate called weight. A weighted halfspace reporting query (h,w1,w2), for a 3D plane h and reals w1 and w2, asks for all points that are below h and have weight within [w1,w2]. We describe a static data structure that answers weighted halfspace reporting queries in Oโข(logโกn+k) time.
    (This result is somewhat unexpected because weighted halfspace reporting is a 4D problem. For comparison, the fastest currently known data structure for orthogonal range reporting in 4D answers queries in Oโข(logโกnโขlogโกlogโกn+k) time in the pointer machine model [22].)

All semi-dynamic data structures use Oโข(n) space and support insertions in Oโข(log8โกn) amortized time. Our static structure for weighted halfspace reporting uses Oโข(nโขlog9โกn) space.

Related Work.

The complexity of the k-lowest planes problem, and almost all its applications that we consider in this paper, are well understood in static scenarios. If k is fixed at preprocessing time, we can work with the k-level of the set of planes. The k-level of a set of n planes is a polyhedral terrain of complexity Oโข(nโ‹…k3/2) [23]. The fastest known deterministic construction takes Oโข(nโขlogโกn+nโขk3/2) time [8]. In order to answer the k-lowest planes query it is sufficient to find the face of the k-level that is pierced by q, which can be solved in Oโข(logโกn) time. If k is prescribed at query time, state-of-the-art solutions are based on a hierarchy of ki-shallow cuttings with values ki that form a geometric series. Chan and Tsakalidis [9] showed that such a hierarchy can be computed in Oโข(nโขlogโกn) deterministic time, which yields a simple data structure with Oโข(logโกn+k) query time. The space bound of this approach can be made Oโข(n), while retaining the query bound, using 3D halfspace range reporting queries from the (recursive) structure of Afshani and Chan [1], which was derandomized in [9].

Halfspace range reporting with Oโข(logโกn+k) query time and polylogโก(n) updates is only known for 2D, which degrades to Oโข(log2โกn/logโกlogโกn+k) query time in 3D [6, Section 3], since interval trees and fractional cascading do not generalize [11].

For weighted halfspace reporting, one can use a range tree on the weights of points to obtain a data structure with Oโข(nโขlogโกn) space and Oโข(log2โกn+k) query time. Since this variant of halfspace reporting is a 4D problem, this query time appears to be close to optimal. However, the very recent data structure of Afshani et al. [2] supports weighted halfspace reporting queries in Oโข(log3/2โกn+k) time, for a given query plane h and weight range [w1,w2].

If insertions and deletions are required, one can answer 1-nearest neighbor queries in Oโข(log2โกn) time with polylogarithmic updates [7]. In [13] de Berg and Staals extended this result to k-nearest neighbor and obtained a data structure with Oโข(log2โกn/logโกlogโกn+k) query time. Improving the query time of these works is challenging; most progress has been made on update time [5, 19, 7].

Recently, Iacono and Nekrich [17] described a novel, insertion-only structure that answers 1-nearest neighbor queries in Oโข(logโกn) time with Oโข(log1+ฮตโกn) amortized insertion time, where ฮต>0 can be made an arbitrary small constant.

Contribution and Overview.

This work is inspired by the Oโข(logโกn) query time result in [17] for incremental planar 1-nearest neighbor, that introduced a sampling technique that allows maintaining the optimal Oโข(logโกn) query time, with Oโข(log1+ฮตโกn) amortized insertion cost. However, immediate extension to the incremental k-lowest planes problem is quite unclear, already for k=1, since the algorithms and correctness arguments heavily rely on Euclidean distances and geometric observations about the Voronoi cells around points.

One contribution of our work is to simplify their approach into a more general framework, that applies to the incremental k-lowest planes problem. Specifically, we show in Sectionย 3 that query correctness, and the Oโข(logโกn) query time, can be established based on a suitable implicit representation of (sample augmented) sets of planes. This is somehow surprising, as a query may, for example, ask for the โŒˆlog3/2โกnโŒ‰-lowest planes in some q. In obtaining the explicit answer of the reporting query, we are tackling the difficulty that our technique, which gives the speedup, prevents direct access to the known Heap-Selection techniques from [13, 15, 18]. To solve this, we introduce a Deduplication Lemma in Subsectionย 3.1 for such sampling techniques, which allows us to obtain the optimal Oโข(logโกn+k) query time.

Our Sectionย 4 shows how to reduce space to Oโข(n), which we believe is of general interest for several dynamic problems (beside k-lowest planes). Sectionย 5 shows how to obtain the first optimal bounds for aforementioned applications 1-5 from our proposed method.

We see the obtained generalization to the k-lowest problem and the Deduplication Lemma as the main technical contributions of this work. Furthermore, our proofs in Sectionย 3 proceed in three abstract steps (i) query correctness, (ii) construction time, and (iii) query runtime, which makes our framework easily accessible for future work on optimal query time.

Though our Oโข(log8โกn) insertion bound for the k-lowest planes problem is considerably larger than the almost logarithmic bound for planar 1-nearest neighbor from [17], we believe that it is very challenging to improve the insertion bound to a sub-cubic exponent (see proof of Lemma 5). While it is an interesting technical problem to accelerate our Skip-Decider construction, one barrier would remain. A central obstacle that comes with our approach is the apparent complexity of the โŒˆlog2โกnโŒ‰-level of a set of n planes, where the best known bound Oโข(nโขlog3โกn) remained unchanged for decades [23].

The new optimal bounds improve the state-of-the-art for fundamental problems planar k-nearest-neighbor [13], 3D halfspace reporting [6, 7], and weighted halfspace reporting [2].

2 Preliminaries: The ๐’Œ-Level of Planes and Planar Triangulations

We rely on the standard, general position assumption: Any point pโˆˆโ„3 is contained in |{hโˆˆH:pโˆˆh}|โ‰ค3 planes, and no plane in H contains a vertical line. For example, any vertical query line q intersects all |H| planes. The at most k-level of a set of planes H, denoted by Lโข(k,H), is the set of points from โ„3 that is the closure of the region of points that have <k planes below it. The k-level Lโข(k,H) is a polyhedral surface with Oโข(|H|โขk3/2) vertices [3, Sec. 3][23], and the fastest known algorithm computes it in deterministic Oโข(|H|โขlogโก|H|+|H|โขk3/2) time [8]. Recall that the k-level of planes, tangent to the (downward opened) lifting paraboloid [12, Sec. 11.5], is in one-to-one relation to the planar order-k Voronoi diagram.

Figure 1: Order-2 Voronoi diagram of fives sites (black), its triangulation (dotted green lines), and triangle-adjacency graph (green).

We will frequently project (sets of) points in 3D with an orthogonal projection down into the xโขy-plane at z=โˆ’โˆž, and work with 2D objects in that plane. This will simply be referred to as projection (into the plane) throughout the entire paper.

In our insertion algorithm, we will frequently compute the kยฏ-level of certain subsets Hโ€ฒโІH where kยฏ is a fixed integer, project it into the plane, and triangulate the faces. The number of faces in the triangulation is near-linear Oโข(|Hโ€ฒ|โขkยฏ3/2) in |Hโ€ฒ| for small kยฏ. Any face of the triangulation shares a common boundary with two or three other faces, and any unbounded face is bounded by two rays and possibly one segment. We call the unbounded faces degenerate triangles, as they may contain only one or two corner points. (See Figureย 1.) For a vertical query line that intersects an edge of the k-level, we allow either set of k-lowest planes from the faces as query result. That is, we allow that ties are broken arbitrarily in reporting queries, and thus assume that queries intersect triangles in their interior.

We will also use algorithms for computing separators in a planar graph with n nodes [15, 16, 21], specifically in the triangle-adjacency graph described above. Using [21, Sec. 2.5], for given integer r<n one can compute in Oโข(n) time a decomposition in Oโข(n/r) connected components, where each connected component contains Oโข(r) nodes, from which Oโข(r) are in the separator. Such a separator has Oโข(n/r) nodes.

Let us remark that points on the k-level with equal sets of planes below are connected; see Lemma 1. We denote the k-lowest planes of H in vertical line q by k-lowest(q,H).

Lemma 1 (Convexity).

Let q1 and q2 denote the vertical lines through some points q1โˆ— and q2โˆ— respectively. Let qโˆ— be an arbitrary point on the segment q1โˆ—โขq2โˆ—ยฏ, spanned by q1โˆ— and q2โˆ— and let q denote the vertical line through the point qโˆ—.

If k-lowest(q1,H)=k-lowest(q2,H)=Hโ€ฒ, then k-lowest(q,H)=Hโ€ฒ.

(See Appendixย A for a standard proof.)

3 Optimal ๐’Œ-lowest Queries with Fast Plane Insertion

Our insertion-only data structure is based on the Bentley-Saxe (BS) partial-rebuilding approach for decomposable search problems [4]. There, a list of subsets that partition the semi-dynamic set H=Hfโˆชโ€ฆโˆชH0 is maintained, with one static structure for each non-empty Hi. Let integer N=|Hf| denote the number of planes at time of the last complete rebuild of one static structure (N=|H| and Hi=โˆ… for i<f). Taking d:=โŒˆlog2โกNโŒ‰, and maintaining set sizes |Hi|=Oโข(di+1) leads to f=Oโข(logโกnlogโกlogโกn) sets in the partition, and amortized insertion cost Oโข(fโขg), where g bounds the ratios Pโข(|Hi|)/di of the construction time P, of static structures for Hi, after di insertions.

Static data structures with Oโข(logโกn+k) query time can be obtained from the known deterministic Oโข(nโขlogโกn) time construction of (a hierarchy of) shallow cuttings in [9]. The Oโข(nโขlogโกn) space bound can be reduced to Oโข(n) by on-the-fly recomputation of conflict-lists with a known optimal half-space range-reporting structure [1, 9]. (This idea is credited to Afshani after Corollary 10 in [7].) Running the standard linear time k-Selection algorithm [14, Sec. 1.8] then yields the k planes that are lowest in vertical line q in Oโข(logโกn+k) time. Using this optimal static structure, combined with the Heap-Selection method of [13, Thm. 1], immediately yields Oโข(log2โกn+k) query time for k-lowest planes in the insertion-only setting. This solution is optimal for queries with large k.

Thus, the remainder of this section is concerned with the difficult cases of k=oโข(log2โกn), though we will combine our approach (Subsectionย 3.1) with the structure from [9] and Heap-Selection from [13], and in Sectionย 4 with the known, optimal static structure above.

Let kยฏ:=โŒˆlog22โกNโŒ‰ throughout the entire paper. Our data structure contains:

  • โ– 

    H0,โ€ฆโขHf: A partition of the semi-dynamic set H. Set Hi has size Oโข(di+1).

  • โ– 

    H^0,โ€ฆโขH^f: Set H^i contains all planes of Hi as well as some from the sets Hj, j>i.
    The added planes serve a similar purpose as samples in classical fractional cascading.

  • โ– 

    Di: A triangulation of the projection of the kยฏ-level of H^i.

  • โ– 

    For any ฮ”โˆˆDi, Hโข(ฮ”) is the set of kยฏ-lowest planes from H^i for any q that intersects ฮ”.

  • โ– 

    ๐–ฒ๐–ฌ๐–ฏ๐–ซ๐—‚โข(โ„“) is a subset of the triangles of Di. The planes โˆชฮ”โˆˆ๐–ฒ๐–ฌ๐–ฏ๐–ซ๐—‚โข(โ„“)Hโข(ฮ”) are in H^iโˆ’โ„“.

Description here omits additional search structures attached to each set H^i, and each triangle ฮ”โˆˆDi. The full details are described in Lemma 5, which shows that they can be computed in near-linear time. Our query method is a greedy trial-and-error approach, that relies on two functions FIX and SKIP, that we formalize in Lemma 2 and Lemma 4.

Intuitively, any greedy-step assumes that a โ€œtentative resultโ€ for [0,i] is โ€œcorrectโ€ for even larger prefixes [0,i+โ„“] of BS sets. For certain extension lengths โ„“, this assumption is checked โ€œquicklyโ€ with an approximate decider111Suitable approximate deciders have a one-sided error, i.e. have reliable True answers but may return False even if a tentative result is valid for the prefix. SKIP. On rejection, the FIX step then โ€œquicklyโ€ computes a new tentative result, and index iโ€ฒ>i, such that the result is correct for the prefix [0,iโ€ฒ]. Transition from i to iโ€ฒ is called a greedy-step, and it involves several SKIP and one FIX calls. This completes the abstract high-level description of our query method, which we formalize in detail below.

Next, we specify what โ€œquicklyโ€ means for a greedy-step in the context of BS sets, after which we will specify what โ€œtentative resultโ€ and โ€œcorrect for a prefixโ€ means in the context of our search problem, kยฏ-lowest planes in q.

Doing a greedy-step โ€œquicklyโ€.

As it turns out for the kยฏ-lowest planes problem, the structures obtained from algorithm CONSTRUCT in Lemma 5 will allow performing one greedy-step, from i to iโ€ฒ, in (iโ€ฒโˆ’i)โขOโข(logโกd) time (cf. Lemmas 6 and 7). That is, the total query time then telescopes to optimal

โˆ€i0<i1<โ€ฆ<im:โˆ‘j<m(ij+1โˆ’ij)โขOโข(logโกd) =(imโˆ’i0)โขOโข(logโกd) (1)
=Oโข(fโขlogโกd)=Oโข(logโกNlogโกdโขlogโกd) (2)

time, regardless of the number m of greedy-steps. With respect to the kยฏ-lowest planes problem, the proposed greedy trial-and-error approach for queries can be described concisely with the pseudo-code in Figureย 2.

1QueryLowest(k,q):
2 Let ฮ”โˆˆDi be intersected by q, i minimal
3 ๐—Œ๐–พ๐—Š:=(ฮ”)
4 WHILE i<f {
5 j:=0; WHILE ๐–ฒ๐–ช๐–จ๐–ฏโข(ฮ”,q,2j) { j++ }
6 (iโ€ฒ,ฮ”โ€ฒ) := ๐–ฅ๐–จ๐–ทโข(ฮ”,q,2j)
7 i:=iโ€ฒ; ฮ”:=ฮ”โ€ฒ; append ฮ” to ๐—Œ๐–พ๐—Š
8 }
9 RETURN ๐–ฏ๐–ฑ๐–ด๐–ญ๐–ค(k,q,๐—Œ๐–พ๐—Š)
Figure 2: Greedy algorithm for k-lowest queries in pseudo-code form. See below for SKIP and FIX.

A naรฏve implementation for the post-processing PRUNE(k,โ€ฆ) runs in Oโข(kยฏโขlogdโกN) time, since each of Oโข(logdโกN) triangles in the sequence has kยฏ elements in Hโข(ฮ”).

In the following lemma, we define the semantics of SKIP(ฮ”,q,โ„“) and what an evaluation to True implies for kยฏ-lowest(q,H^iโˆชโ€ฆโˆชH^i+โ„“). After this, Lemma 4 will then discuss the semantic of FIX and what โ€œtentative resultโ€ and โ€œcorrect for a prefixโ€ means. Discussion of how quickly SKIP and FIX can be computed with suitable data structures is carried out in Lemmas 5, 6, and 7.

Lemma 2 (SKIP-Correctness).

Let indices i<โ„“, triangle ฮ”โˆˆDi intersect q in point qโˆ—โˆˆโ„2, planar region Sj=โ‹ƒฮ”โ€ฒโˆˆ๐–ฒ๐–ฌ๐–ฏ๐–ซjโข(jโˆ’i)ฮ”โ€ฒ for any j>i, and Hโข(ฮ”โ€ฒ)โІH^iโˆ–Hi for all triangles ฮ”โ€ฒโˆˆ๐–ฒ๐–ฌ๐–ฏ๐–ซjโข(jโˆ’i).

Define SKIP(ฮ”,q,โ„“):โŸบqโˆ—โˆˆโ‹‚j=i+1i+โ„“๐—๐—Ž๐—…๐—…(ฮ”โˆฉSj).

If SKIP(ฮ”,q,โ„“)=๐–ณ๐—‹๐—Ž๐–พ, then kยฏ-lowest(q,H^i)=kยฏ-lowest(q,H^iโˆชโ€ฆโˆชH^i+โ„“).

Figure 3: ฮ”โˆˆDi intersecting q (black), SjโІโ„2 of some j>i (green), and ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSj) (blue).
Proof.

We call degenerate triangles just triangles in the following, as the arguments will hold regardless of corner count. It suffices to show for arbitrary j>i, that

qโˆ—โˆˆ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSj)โŸนkยฏโข-lowestโข(q,H^i)=kยฏโข-lowestโข(q,H^iโˆชH^j). (3)

Since ฮ”โˆˆDi is the triangle that intersects vertical line q, we have kยฏ-lowest(q,H^i)=Hโข(ฮ”). See Figureย 3.

Consider the set of points on the polyhedral surface AโІLโข(kยฏ,H^iโˆชH^j) where the kยฏ-lowest planes coincide with Hโข(ฮ”). Let Aโˆ—โІโ„2 be the orthogonal projection of A. (In other words, the region of queries that may be skipped as their set of kยฏ-lowest planes is equal to Hโข(ฮ”).) The implication (3) follows, if we can show that ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSj)โІAโˆ— is true.

If ฮ”โˆฉSj=โˆ…, then ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSj)=โˆ… and the implication is true222In other words, SKIP returns False in this case.. So let qโ€ฒโˆˆฮ”โˆฉSj be arbitrary. Since qโ€ฒโˆˆฮ”โ€ฒ of some ฮ”โ€ฒโˆˆ๐–ฒ๐–ฌ๐–ฏ๐–ซjโข(jโˆ’i), we have kยฏ-lowest(qโ€ฒ,H^j)=Hโข(ฮ”โ€ฒ) are in the augmented set, i.e. Hโข(ฮ”โ€ฒ)โІH^iโˆ–Hi. From qโ€ฒโˆˆฮ”, we have that kยฏ-lowest(qโ€ฒ,H^i)=Hโข(ฮ”). Thus, qโ€ฒโˆˆAโˆ— and Aโˆ—โ‰ โˆ…โ‰ A.

The lemma now follows from Aโˆ— being convex, due to A being convex (Lemma 1).โ—€

In the following, we define the necessary semantic of FIX, โ€œtentative resultโ€, and โ€œcorrect for a prefixโ€, which allows us to establish the correctness of our greedy trial-and-error approach for the kยฏ-lowest planes problem. Establishing runtime efficiency, with suitable data structures, is carried out in Lemmas 5, 6, and 7.

Definition 3 (Tentative Result, Prefix-Validity).

A sequence of triangles (ฮ”i0,ฮ”i1,โ€ฆ,ฮ”im) is called a tentative result for prefix [0,i], if ฮ”ijโˆˆDij and 0โ‰คi0<i1<โ€ฆ<im=i. Let Hยฏ=โ‹ƒj=0mHโข(ฮ”ij) denote the planes appearing in the tentative result.

A tentative result is valid for prefix [0,i], if kยฏ-lowest(q,Hยฏ)=kยฏ-lowest(q,H^0โˆชโ€ฆโˆชH^i).

Lemma 4 (FIX-Correctness).

Let ฮ”โˆˆDi be the triangle intersecting q, and jโ‰ฅ0 the smallest integer with SKIP(ฮ”,q,2j)=๐–ฅ๐–บ๐—…๐—Œ๐–พ.

Define FIX(ฮ”,q,2j) to return pair (iโ€ฒ,ฮ”โ€ฒ), such that triangle ฮ”โ€ฒโˆˆDiโ€ฒ intersects q and index iโ€ฒโˆˆ[i+2j,i+2j+1) is the smallest index with SKIP(ฮ”,q,iโ€ฒ)=๐–ฅ๐–บ๐—…๐—Œ๐–พ.

If (ฮ”ij)jโ‰คm is valid for prefix [0,i] and (iโ€ฒ,ฮ”โ€ฒ)=๐–ฅ๐–จ๐–ทโข(ฮ”im,q,2j), then (ฮ”i0,โ€ฆ,ฮ”im,ฮ”โ€ฒ) is valid for prefix [0,iโ€ฒ].

In particular, defined semantics for SKIP and FIX maintain the prefix-validity throughout any greedy-step of the query algorithm. That is, the final triangle sequence is valid for [0,f].

Proof.

The proof is by induction. The prefix invariant holds for [0,i] for some iโ‰ฅ0, since the query algorithm always determines the intersected triangle in Di with minimal index i in the BS partition as the first triangle in a tentative result. Let ฮ”โˆˆDi be the last triangle in the sequence that is valid for [0,i]. Apply Lemma 2, and use that iโ€ฒ is minimal, and ฮ”โ€ฒโˆˆDiโ€ฒ with qโˆฉฮ”โ€ฒโ‰ โˆ…, so true for [0,iโ€ฒ]. โ—€

Next, we discuss the algorithm ๐–ข๐–ฎ๐–ญ๐–ฒ๐–ณ๐–ฑ๐–ด๐–ข๐–ณ for computing H^i and its associated triangulation Di, including how the triangles ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(j)โІDi are obtained for all possible integers jโˆˆ[1,i], and the three kinds of planar point-location structures associated to Di that we will need to establish that ๐–ฒ๐–ช๐–จ๐–ฏ and ๐–ฅ๐–จ๐–ท can be computed sufficiently fast during queries.

Lemma 5 (Construction).

There is an algorithm ๐–ข๐–ฎ๐–ญ๐–ฒ๐–ณ๐–ฑ๐–ด๐–ข๐–ณโข({H0,โ€ฆโขHi},{Di+1,โ€ฆโขDf}) that computes a planar triangulation Di of projected L(kยฏ,H^i), where |H^i|=Oโข(|Hi|).

The triangulation has size |Di|=Oโข(|Hi|โขkยฏ3/2), and is augmented with the structures:

  1. 1.

    Global-Search: A point-location structure for determining a triangle ฮ”โˆˆDi.

  2. 2.

    Samples: For each integer โ„“โˆˆ[1,i] a subset ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)โІDi of triangles, such that every connected component of Diโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“) has Oโข(d16+2โขโ„“) triangles, is adjacent to Oโข(d8+โ„“) triangles from ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“), and the separator contains |๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)|=Oโข(|Di|/d8+โ„“) triangles.

  3. 3.

    Fix-Search: For each integer โ„“โˆˆ[1,i] and each connected component of Diโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“), a point-location structure for the triangles in that component.

  4. 4.

    Fix-Pointer: For every ฮ”โˆˆDi and integer โ„“โˆˆ(i,f], Oโข(1) pointers identifying the connected component of Dโ„“โˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i) containing the corners of ฮ”.

  5. 5.

    Skip-Decider: For each ฮ”โˆˆDi and 2jโˆˆ[1,fโˆ’i] one point-location structure, for the overlay of {๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSiโ€ฒ):iโ€ฒโˆˆ(i,i+2j]}, with worst-case query time Oโข(2jโขlogโกd).

Construction of these data structures takes Oโข(|Di|โขlog3โกN) time, they occupy Oโข(fโข|Di|) space.

Proof.

We first assemble Hi by merging the old prefix sets โ‹ƒโ„“โ‰คiHโ„“ from the partition, drop all structures related to the old prefix sets, and then add all planes from the sampled triangles from higher indices to obtain the augmented set

H^i=Hiโˆชโ‹ƒโ„“>iโ‹ƒฮ”โˆˆ๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i)Hโข(ฮ”).

Then we compute kยฏ-level Lโข(kยฏ,H^i), project its faces into the plane, and compute its triangulation Di, which takes Oโข(|H^i|โขlog3โกN) deterministic time, since kยฏ=Oโข(log2โกN).

We will show that the size of the augmented set remains of the same order |H^i|=Oโข(|Hi|), by showing that kยฏโข|๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i)| is sufficiently small in the following.

Samples.

The number of triangles in the triangulation is at most |Di|=Oโข(|H^i|โขkยฏ3/2), i.e. bounding the nodes in its planar face-adjacency graph (cf. Sectionย 2). Next, we compute a triangle subset ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“) from the face-adjacency graph for each integer โ„“โˆˆ[1,i]. That is, we compute in linear time a planar-separator ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)โІDi such that each connected component of Diโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“) contains โ‰คrโ„“:=d16+2โขโ„“ triangles, is adjacent to Oโข(d8+โ„“) triangles from the separator, and contains a number of triangles that is at most |๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)|โ‰คOโข(|Di|/d8+โ„“). Note that invocations with rโ„“โ‰ฅ|Di| are trivial, as this yields one connected component containing all nodes and empty separator ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)=โˆ…. (E.g. any skip-range containing such an empty ๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“) evaluates to False.)

To show the claimed |H^i|=Oโข(|Hi|), we first consider the right-most BS set (i=f), where Hf=H^f and |Hf|=N=Oโข(df) holds.

Since |Df|=Oโข(|Hf|โขkยฏ3/2)=Oโข(Nโขlog3โกN), the number of planes in the down-samples at index distance โ„“ is kยฏโข|๐–ฒ๐–ฌ๐–ฏ๐–ซfโข(โ„“)|=Oโข(Nโขd5/d8+โ„“).

Thus, |H^fโˆ’1|โ‰ค|Hfโˆ’1|โข(1+Oโข(|Hf|โขd5/d8+1)|Hfโˆ’1|)โ‰ค|Hfโˆ’1|โข(1+Oโข(df+5โˆ’9)dfโˆ’1)=Oโข(|Hfโˆ’1|).

Using this, we have for |H^fโˆ’2|โ‰ค|Hfโˆ’2|โข(1+Oโข(|H^fโˆ’1|โขd5โˆ’(8+1))+Oโข(|Hf|โขd5โˆ’(8+2))dfโˆ’2), that |H^fโˆ’2|โ‰ค|Hfโˆ’2|โข(1+Oโข(df+5โˆ’9)+Oโข(df+5โˆ’10)dfโˆ’2). Thus, |H^fโˆ’2|=Oโข(|Hfโˆ’2|). Consequently,

|H^i| โ‰ค|Hi|โข(1+1diโขโˆ‘โ„“=1fโˆ’iOโข(|H^i+โ„“|โขd5/d8+โ„“)โŸโ‰คfโ‹…Oโข(diโˆ’2)โฃ=Oโข(diโˆ’1))=Oโข(|Hi|).

That is, |Di|=Oโข(|Hi|โขkยฏ3/2), as claimed.

The planar separator algorithm takes linear Oโข(|Di|) time for one execution, and is executed โ„“โ‰คi=Oโข(f) times. Thus computing the samples takes Oโข(fโข|Di|) total time, also bounding the space for storing the obtained triangle subsets {๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“)โІDi}.

Global-Search.

Computing a planar point-location structure for triangulation Di takes Oโข(|Di|โขlogโกN) time and occupies Oโข(|Di|) space.

Fix-Pointer.

For each corner p of a ฮ”โˆˆDi and each integer โ„“โˆˆ(i,f], we perform a global search in Dโ„“ to determine its containing triangle ฮ”, and store the obtained connected component of ฮ” in Dโ„“โˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i) with corner p. In case ฮ” is a degenerate triangle, two of its boundaries are infinite rays in the plane. There we determine the component membership for the furthest points inside the ray. (Recall that any degenerate triangle is described by two points at infinity and one or two ordinary corner points, and that all standard planar point location structures naturally support queries for a point at infinity specified as ray.) As with a corner point, this also yields either a connected component or a triangle from separator ๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i). That is, every ฮ”โˆˆDi stores at most four pointers to connected components, and locating given point in Dโ„“ takes Oโข(logโกN) time, and determining if found triangle is in the separator ๐–ฒ๐–ฌ๐–ฏ๐–ซโ„“โข(โ„“โˆ’i)โІDโ„“, or the connected component, also takes Oโข(logโกN) time. This takes Oโข(|Di|โขfโขlogโกN) total time and occupies Oโข(|Di|โขf) space.

Fix-Search.

For each integer โ„“โˆˆ[1,i] and each connected component of Diโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซiโข(โ„“), we compute a point-location structure for the triangles in this connected component. This takes Oโข(|Di|โขfโขlogโกN) total time and occupies Oโข(|Di|โขf) space.

Skip-Decider.

For every ฮ”โˆˆDi and skip-length 2jโˆˆ[1,fโˆ’i], we compute the planar subdivision that is the overlay of the regions {๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSโ„“):โ„“โˆˆ(i,i+2j]}. Note that j=Oโข(logโกf). The size is bounded by the number of vertices, so bounded by the total number of vertices in the given convex regions plus the total number of intersection points of edges from the given convex regions. We first bound the total size for fixed j. For the first kind, the number of vertices, across all ฮ”โˆˆDi, is already bounded by Oโข(|Di|) due to the sampling bound above. For the second kind, we consider one ฮ”โˆˆDi. There, any hull edge can intersect only Oโข(1) many edges from another convex hull, and there are Oโข(2j) many hulls to consider. Let Mฮ” be the complexity of the largest of these hulls within ฮ”. Any of these hulls is composed of at most four sections of boundaries of connected-components, referenced by the fix-pointers of ฮ”, note that Mฮ” has a worst-case bound of Oโข(d8+2j). (See Figureย 4.) Thus, the overlay within ฮ” is a planar subdivision of size Oโข(2jโขMฮ”). Consequently, the total number of vertices of the second kind is bounded within an Oโข(2j)-factor of โˆ‘ฮ”โˆˆDiMฮ”, where the latter sum is bounded by the number of vertices of the first kind. That is, the total size of all overlays for fixed j is Oโข(2jโข|Di|); summing over j=Oโข(logโกf) shows that the total space is Oโข(fโข|Di|). With the space bound, it follows that the total construction time, for all ฮ” and j, is Oโข(fโข|Di|โ‹…logโกN).

Next, we label each face, in the overlay for given ฮ” and j. We label (the interior of) each face with the largest integer iโ€ฒโ€ฒโ‰คi+2j so that its points are contained in each region (๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSi+1),โ€ฆ,๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSiโ€ฒโ€ฒ)). Taking a point p within the face, we determine for iโ€ฒโ€ฒ=i+1,i+2,โ€ฆ if p is contained in ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSiโ€ฒโ€ฒ). This takes Oโข(logโกN) time for given point p, as discussed for corner point component membership in Diโ€ฒโ€ฒ above, and determining iโ€ฒโ€ฒ for p thus takes Oโข(2jโขlogโกN) time. Summing over j=Oโข(logโกf), this is Oโข(fโขlogโกN) time. Thus, the total time to label each of the Oโข(fโข|Di|) faces for all j=Oโข(logโกf) is Oโข(f2โข|Di|โขlogโกN)=Oโข(|Di|โขlog3โกN)333This time bound here is the dominating factor in the construction time..

Finally, we compute a planar point-location structure for each labeled overlay, which retains the space bound and takes Oโข(|Di|โขfโขlogโกN) total time. For given j and ฮ” intersected by q, the query time to report the largest integer iโ€ฒโ€ฒโ‰คi+2j that q is contained in each hull (๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSi+1),โ€ฆ,๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSiโ€ฒโ€ฒ)) is Oโข(logโก(2jโขd8+2j))=Oโข(j+(8+2j)โขlogโกd), as required. โ—€

It remains to show that the computed structures of Di allow us to compute ๐–ฒ๐–ช๐–จ๐–ฏ and ๐–ฅ๐–จ๐–ท sufficiently fast for the outlined telescoping argument above.

Figure 4: For ฮ”โˆˆDi and j>i, any connected component of Djโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซjโข(jโˆ’i) containing a corner has Oโข(d16+2โข(jโˆ’i)) triangles, and is bounded by Oโข(d8+(jโˆ’i)) triangles, from ๐–ฒ๐–ฌ๐–ฏ๐–ซjโข(jโˆ’i).
Lemma 6 (SKIP-Runtime).

Let jโ‰ฅ0 be the index where SKIP(ฮ”,q,2j) returns false. The structures stored with ฮ” allow to answer the j+1 calls of SKIP in Oโข(2jโขlogโกd) total time.

Proof.

Recall the construction of Di computed for each ฮ”โˆˆDi and integer 2โ„“=Oโข(f) query structures, that allow to answer if qโˆ—โˆˆ๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSi+1โˆฉโ€ฆโˆฉSi+2โ„“), and return the smallest integer iโ€ฒ of a Siโ€ฒ where it is not contained. Answering a planar point-location query in the overlay for skip-length 2โ„“ takes Oโข(2โ„“โขlogโกd) time. Consequently, answering j+1 such queries takes (20+21+โ€ฆ+2j)โขOโข(logโกd) time using the skip-decider structures. โ—€

Lemma 7 (FIX-Runtime).

Finding the smallest integer iโ€ฒโˆˆ[i+2j,i+2j+1) where SKIP is false on prefix [0,iโ€ฒ] can be implemented in (iโ€ฒโˆ’i)โขOโข(logโกd) time. Moreover, obtaining the triangle ฮ”โ€ฒโˆˆDiโ€ฒ that intersects q takes (iโ€ฒโˆ’i)โขOโข(logโกd) time.

Proof.

Recall that Lemma 5 precomputed a point-location structure for the planar subdivision that is the overlay of the subdivisions in {๐—๐—Ž๐—…๐—…โข(ฮ”โˆฉSiโ€ฒ):iโ€ฒโˆˆ[i+2j,i+2j+1)}. As each region of that subdivision was labeled with the largest integer iโ€ฒโ€ฒ where its points are contained in all hull(ฮ”โˆฉSiโ€ฒโ€ฒ), we obtain the smallest iโ€ฒ in time Oโข(2jโขlogโกd)=(iโ€ฒโˆ’i)โขOโข(logโกd), since 2j=Oโข(iโ€ฒโˆ’i). Recall that corner-component membership information was precomputed in construction of Di for all iโ€ฒ>i. For any given iโ€ฒ>i and connected component of Diโ€ฒโˆ–๐–ฒ๐–ฌ๐–ฏ๐–ซiโ€ฒโข(iโ€ฒโˆ’i), a point-location query takes Oโข(logโกd16+2โข(iโ€ฒโˆ’i))=(iโ€ฒโˆ’i)โขOโข(logโกd) time, and there are Oโข(1) connected components to query. โ—€

Note that both time bounds, of Lemmas 6 and 7, are (iโ€ฒโˆ’i)โขOโข(logโกd), as desired.

Theorem 8.

Maintaining a query structure for a semi-dynamic set H of planes under insertions such that for given vertical line q we can report a sequence of at most f=Oโข(logโก|H|logโกlogโก|H|) triangles such that kยฏ-lowest(q,H)=kยฏ-lowest(q,Hยฏ) is possible with Oโข(fโขlog7โก|H|)=Oโข(log8โก|H|) amortized insertion time. The structure has size Oโข(|H|โขlog4โก|H|logโกlogโก|H|).

The worst-case query time to obtain the triangle sequence is Oโข(logโก|H|).

Proof.

Lemmas 2 and 4 showed that the triangle sequence (ฮ”ij) has a set of planes Hยฏ=Hโข(ฮ”i1)โˆชโ€ฆโˆชHโข(ฮ”im) with kยฏ-lowest(q,Hยฏ)=kยฏ-lowest(q,H). The query time of Oโข(fโขlogโกd)=Oโข(logโก|H|) follows from Lemmas 6 and 7 in the telescoping argument Eq. (1). The amortized update time of Oโข(fโขg)=Oโข(fโข|Hi|โขlog6โกNdi)=Oโข(log8โก|H|), follows from Lemma 5, showing a construction time of Oโข(|Di|โขlog3โก|H|)=Oโข(|Hi|โขlog6โก|H|), where |Hi|=Oโข(di+1). From Lemma 5, space is dominated by the bound for Df, i.e. Oโข(fโข|Df|)=Oโข(fโข|H|โขlog3โก|H|). โ—€

In Subsectionย 3.1, we introduce a Deduplication Lemma that enables us to apply known techniques for our efficient post-processing PRUNE(k,โ€ฆ) of the triangle sequence.

3.1 PRUNE: Searching the ๐’Œยฏ k

-lists of โ‰ค๐’‡ triangles in ๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต+๐’Œ) time

This section capitalizes on the fact that the cardinality ๐’Œยฏ sets ๐‘ฏโข(๐šซ) in our proposed structure are fixed at construction time. That is, we will augment each triangle ๐šซ, of any triangulation, with a static query structure that allows us to quickly retrieve the ๐Ÿ๐’™-lowest for desired granularity ๐Ÿ๐’™=๐‘ถโข(๐’Œ) during the post-processing phase of the โ‰ค๐’‡ triangles.

Our main technical difficulty in obtaining the optimal query bound is avoiding duplicate entries in the sets (๐‘ฏโข(๐šซ๐’Š๐Ÿ),๐‘ฏโข(๐šซ๐’Š๐Ÿ),โ€ฆ,๐‘ฏโข(๐šซ๐’Š๐’Ž)) of triangles in the sequence (๐šซ๐’Š๐’‹โˆˆ๐‘ซ๐’Š๐’‹), as the sets ๐‘ฏ^๐’Š are, unlike the sets ๐‘ฏ๐’Š, not necessarily disjoint, preventing us direct access to the Heap-Selection method from [13]. To this end, we define the pruned set ๐‘ฏโˆ—โข(๐šซ) of a triangle ๐šซโˆˆ๐‘ซ๐’Š to be

๐‘ฏโˆ—โข(๐šซ):=๐‘ฏโข(๐šซ)โˆ–โ‹ƒโ„“<๐’Š,๐šซโ€ฒโˆˆ๐—ฆ๐— ๐—ฃ๐—Ÿ๐’Šโข(โ„“)๐‘ฏโข(๐šซโ€ฒ),

i.e. those planes in ๐‘ฏโข(๐šซ) that do not appear by sampling in some ๐‘ฏ^โ„“ with index โ„“<๐’Š.

Note that this definition does not involve query locations, i.e. we can build one static ๐Ÿ๐’™-lowest query structure for ๐‘ฏโข(๐šซ), and one for ๐‘ฏโˆ—โข(๐šซ), during the construction of ๐šซโˆˆ๐‘ซ๐’Š.

Lemma 9 (Deduplication).

Let ๐‡ยฏ=โ‹ƒ๐ฃ=๐Ÿ๐ฆ๐‡โข(๐šซ๐ข๐ฃ) be the union over the triangle sequence obtained by the query algorithm, ๐‡โˆ—=โ‹ƒ๐ฃ=๐Ÿ๐ฆ๐‡โˆ—โข(๐šซ๐ข๐ฃ), and ๐‡โŠฅ=๐‡โข(๐šซ๐ข๐Ÿ) from the leftmost triangle in the sequence.

Then, the sets {๐‡โŠฅ,๐‡โˆ—โข(๐šซ๐ข๐Ÿ),โ€ฆ,๐‡โˆ—โข(๐šซ๐ข๐ฆ)} are disjoint and the deduplicated sets have ๐คยฏ-lowest(๐ช,๐‡ยฏ)=๐คยฏ-lowest(๐ช,๐‡โŠฅโˆช๐‡โˆ—).

Proof.

Disjointness follows immediately from the definition. For the first triangle in the sequence |๐‘ฏโŠฅ|=๐’Œยฏ. For ๐’Ž>๐Ÿ triangles, we argue as follows.

For a contradiction, assume there is a plane ๐’‰โˆˆ๐’Œยฏ-lowest(๐’’,๐‘ฏยฏ)โˆ–๐’Œยฏ-lowest(๐’’,๐‘ฏโŠฅโˆช๐‘ฏโˆ—), i.e. ๐’‰ is contained in the ๐’Œยฏ-lowest on the original set ๐‘ฏยฏ but not in the deduplicated set.

Let index ๐’Šโ‰ฅ๐’Š๐Ÿ be minimal with ๐’‰โˆˆ๐‘ฏ^๐’Š (leftmost BS set), and ๐šซโˆˆ๐‘ซ๐’Š intersecting ๐’’.

There are two possible cases, ๐šซ may be present/absent in the triangle sequence.

If ๐šซ is present, we argue as follows. Since ๐’‰ is a ๐’Œยฏ-lowest plane in the result, the triangle ๐šซโˆˆ๐‘ซ๐’Š intersecting ๐’’ must contain ๐’‰โˆˆ๐‘ฏโข(๐šซ). As ๐‘ฏ^๐’Š is the left-most set containing ๐’‰, i.e. ๐’Š is minimal, we have that the plane must also be contained post-deduplication ๐’‰โˆˆ๐‘ฏโˆ—โข(๐šซ). So ๐’‰โˆˆ๐‘ฏโŠฅโˆช๐‘ฏโˆ—, and consequently ๐’‰โˆˆ๐’Œยฏ-lowest(๐’’,๐‘ฏโŠฅโˆช๐‘ฏโˆ—), a contradiction.

Otherwise ๐šซ is absent in the triangle sequence generated by our query algorithm. For ๐šซโˆˆ๐‘ซ๐’Š being absent, index ๐’Š must have been skipped by the query algorithm. Consider largest ๐’Šโ€ฒ<๐’Š with ๐’’โˆ—โˆˆ๐šซโ€ฒโˆˆ๐‘ซ๐’Šโ€ฒ that appears in the sequence. Indeed, ๐’Šโ€ฒ exists, since ๐šซ cannot be the first triangle in the sequence. However, ๐šซ absent in the sequence requires that ๐’’ is in the region ๐’’โˆ—โˆˆ๐—ต๐˜‚๐—น๐—นโข(๐šซโ€ฒโˆฉ๐‘บ๐’Š). By Lemma 2, ๐’Œยฏ-lowest(๐’’,๐‘ฏ^๐’Šโ€ฒโˆชโ€ฆโˆช๐‘ฏ^๐’Š)=๐’Œยฏ-lowest(๐’’,๐‘ฏ^๐’Šโ€ฒ). Thus ๐’Œยฏ-lowest(๐’’,๐‘ฏ^๐’Šโ€ฒ)=๐‘ฏโข(๐šซโ€ฒ) must contain ๐’‰, contradicting ๐’Š is minimal. โ—€

Thus, our implementation of PRUNE uses static query structures obtained from a shallow-cutting hierarchy for the planes for ๐‘ฏโข(๐šซ), and a separate data structure for ๐‘ฏโˆ—โข(๐šซ), for all ๐‘ซ๐’Š and ๐šซโˆˆ๐‘ซ๐’Š. Recall444See start of Sectionย 3 for discussion of related work [9]. that computing such a query structure takes near-linear ๐‘ถโข(๐’Œยฏโข๐ฅ๐จ๐ โก๐’Œยฏ)=๐‘ถโข(๐ฅ๐จ๐ ๐Ÿโก๐‘ตโข๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) time and space. This increases the time, and space, bound for our construction algorithm by no more than one ๐‘ถโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) factor (see proof of Lemma 5), thus giving a ๐‘ถโข(|๐‘ฏ|โข๐ฅ๐จ๐ ๐Ÿ’โก|๐‘ฏ|) space and ๐‘ถโข(๐ฅ๐จ๐ ๐Ÿ–โก|๐‘ฏ|) amortized insertion bound from Theorem 8. With those, querying any of the โ‰ค๐’‡ sets (๐‘ฏโŠฅ,๐‘ฏโˆ—โข(๐šซ๐’Š๐Ÿ),โ€ฆ,๐‘ฏโˆ—โข(๐šซ๐’Š๐’Ž)) for the ๐’Œ-lowest takes ๐‘ถโข(๐ฅ๐จ๐ โก๐’Œยฏ+๐’Œ) time.

With our Deduplication Lemma, the result follows immediately from the adaptation [13, Thm. 1] of the Heap-Selection algorithm [15], since we have ๐’‡=๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) structures over disjoint sets with ๐‘ถโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก(๐‘ต)+๐’Œ) query time each.

Corollary 10.

Increasing the space and amortized insertion bounds in Theorem 8 by one ๐Žโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก|๐‡|) factor allows reporting the ๐ค-lowest in ๐Žโข(๐Ÿโข๐ฅ๐จ๐ โก๐คยฏ+๐ค)=๐Žโข(๐ฅ๐จ๐ โก|๐‡|+๐ค) time.

We conclude this section by presenting an alternative path to obtain the result, combining some basic ideas from [13, Thm. 1] with the, remarkable powerful, Soft-Heaps [10, 20] that are known to offer an alternative to Heap-Selection [18, Sec. 3].

Note that, for very small ๐’Œ=๐‘ถโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต), we can just query the ๐’Œ-lowest from each triangle and run the standard ๐’Œ-Selection algorithm, taking ๐‘ถโข(๐’Œโข๐’‡)=๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต) time.

Simple ๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต+๐’Œโข๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) queries with standard min-heaps

The following simplistic algorithm gives optimal query time for all ๐’Œ=๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต).

We query ๐’Œ๐ŸŽ=โŒˆ๐ฅ๐จ๐ ๐Ÿโก๐ฅ๐จ๐ ๐Ÿโก๐‘ตโŒ‰ lowest planes from each set, and insert all in a min-heap using the ๐’›-coordinate of ๐’’โˆฉ๐’‰ as key, i.e. we start on a min-heap with ๐‘ถโข(๐’‡โข๐’Œ๐ŸŽ)=๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต) items. Then, we keep extracting the element with smallest key, until we extracted the ๐’Œ-lowest globally. Whenever the elements from one set (of a ๐šซ in the sequence) were all extracted, we double that set size with a fresh query from ๐šซ and insert the new items of its larger batch into the heap, which takes ๐‘ถโข(๐ฅ๐จ๐ โก๐’Œยฏ+๐Ÿ๐’™โข๐’Œ๐ŸŽ)=๐‘ถโข(๐Ÿ๐’™โข๐’Œ๐ŸŽ) time. This completes the description of the basic algorithm.

From the disjointness, we have that the ๐’Œ planes from the final set are partitioned among the ๐’Žโ‰ค๐’‡ disjoint subsets of โ‰ค๐’Œยฏ planes, that is there are integers ๐’Œ๐’‹โˆ—โ‰ฅ๐ŸŽ with ๐’Œ=โˆ‘๐’‹=๐Ÿ๐’Ž๐’Œ๐’‹โˆ—. Consequently, the total time for the iterated queries from ๐šซ๐’Š๐’‹, to obtain the replenishment items, remains (๐Ÿ+๐Ÿ๐Ÿ+๐Ÿ๐Ÿ’+โ€ฆ)โข๐‘ถโข(๐’Œ๐’‹โˆ—). That is ๐‘ถโข(๐’Œ) time overall to insert replenishment items. Since there are ๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต+๐’Œ) items in the heap throughout the processing, we have that each of the ๐’Œ extract-min operations takes ๐‘ถโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) time. That is, the basic algorithm takes ๐‘ถโข(๐ฅ๐จ๐ โก๐‘ต+๐’Œ+๐’Œโข๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) total time for initializing, inserting, and extracting.

The bottleneck for obtaining optimal bounds for larger ๐’Œ=๐Žโข(๐ฅ๐จ๐ โก๐‘ต๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) is due to extractMin requiring ๐‘ถโข(๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐‘ต) time with standard heaps. (The planes are reported in sorted order.)

Soft-Heaps: Allowing Key-Corruption accelerates operations to ๐‘ถโข(๐ฅ๐จ๐ โก๐Ÿ/๐œบ).

As observed in [18, Sec. 3.1], one can use Soft-Heaps to simplify the Heap-Selection in [15]. Using a Soft-Heap with constant error parameter, ๐œบ=๐Ÿ/๐Ÿ’, one can obtain the ๐’Œ-smallest keys, in not necessarily sorted order, with ๐‘ถโข(๐Ÿ) amortized cost per operation, as ๐œบ is constant.

4 Reducing Space to Linear

Lemma 11.

Space of the insertion-only ๐ค-lowest structure can be reduced to linear ๐Žโข(|๐‡|), without increasing the query and update bounds.

Proof.

Since our approach uses ๐’…=โŒˆ๐ฅ๐จ๐ ๐Ÿโก๐‘ตโŒ‰, we can reduce our ๐‘ถโข(|๐‘ฏ|โข๐ฅ๐จ๐ ๐Ÿ’โก|๐‘ฏ|) space bound to ๐‘ถโข(|๐‘ฏ|) as follows.

We apply our proposed data structure (Theoremย 8 and Corollary 10) only to the set ๐‘ฏโˆ’=โ‹ƒ๐’Š<๐’‡โˆ’๐Ÿ–๐‘ฏ๐’Š of planes from the first ๐’‡โˆ’๐Ÿ– sets of the partition ๐‘ฏ=โ‹ƒ๐’Šโ‰ค๐’‡๐‘ฏ๐’Š. Since โˆ‘๐’Š<๐’‡โˆ’๐Ÿ–|๐‘ฏ๐’Š|=๐‘ถโข(๐’…๐’‡โˆ’๐Ÿ–), and |๐‘ฏ|=๐šฏโข(๐’…๐’‡), this set has |๐‘ฏโˆ’|=๐‘ถโข(|๐‘ฏ|/๐ฅ๐จ๐ ๐Ÿ’โก๐‘ต) planes; thus occupies ๐‘ถโข(|๐‘ฏ|) space. For the last ๐‘ถโข(๐Ÿ) sets ๐‘ฏ๐’Š of the partition with ๐’Šโˆˆ[๐’‡โˆ’๐Ÿ–,๐’‡], we use an optimal, static ๐‘ถโข(|๐‘ฏ๐’Š|) space structure from [9, 1] that allows reporting the ๐’Œ-lowest planes in ๐‘ถโข(๐ฅ๐จ๐ โก|๐‘ฏ๐’Š|+๐’Œ) time. The expected construction time was made deterministic in [9].

To answer a query, we simply compute the ๐’Œ-lowest(๐’’,๐‘ฏโˆ’) in ๐‘ถโข(๐ฅ๐จ๐ โก|๐‘ฏ|+๐’Œ) time, and the ๐’Œ-lowest(๐’’,๐‘ฏ๐’Š) for each in the ๐‘ถโข(๐Ÿ) sets with ๐’Šโˆˆ[๐’‡โˆ’๐Ÿ–,๐’‡]. The resulting set contains ๐‘ถโข(๐’Œ) planes, and we run the standard ๐’Œ-Selection algorithm (see also Subsectionย 3.1) to obtain the ๐’Œ-lowest planes in vertical query line ๐’’, which takes ๐‘ถโข(๐’Œ) time. โ—€

Corollary 12.

There exists a deterministic ๐Žโข(๐ง) space data structure that answers ๐ค-lowest planes queries in ๐Žโข(๐ฅ๐จ๐ โก๐ง+๐ค) time and supports insertions in ๐Žโข(๐ฅ๐จ๐ ๐Ÿ–โก๐ง) amortized time.

5 Applications

The applications stated in Sectionย 1 follow immediately by the standard paraboloid lifting of 2D points (๐’Œ-Nearest neighbor and circular range), or by the standard point-plane duality (vertical ray shooting and halfspace range reporting) and using iterated queries, with ๐’Œ๐’Š=๐Ÿ๐’ŠโขโŒˆ๐ฅ๐จ๐ ๐Ÿโก๐‘ตโŒ‰, for the ๐’Œ๐’Š-lowest planes from our proposed structure. (Applications 1-4.)

The only exception is the application 5, weighted halfspace range reporting. There we reduce the problem to two, one-sided queries. Our solution for the one-sided queries then observes that our proposed structure from Corollary 10 can be turned into a partially-persistent data structure with standard techniques (see Subsectionย 5.1).

Weighted halfspace range reporting.

The two-sided problem reduces to answering two one-sided queries, i.e. queries of the form [โˆ’โˆž,๐‘พ]. By inserting the elements with ascending weights into our proposed structure, the one-sided queries reduce to halfspace reporting among the ๐’•-oldest elements of the insertion sequence, where ๐’• is the number of elements with weight โ‰ค๐‘พ. The symmetric approach applies for one-sided queries of the form [๐‘พ,+โˆž].

To reduce a two-sided query [๐’˜๐Ÿ,๐’˜๐Ÿ] to two one-sided queries, we build a balanced, binary tree over the ๐’ leaves, sorted by their weight ๐’‘๐’˜. There we determine the successor of ๐’˜๐Ÿ, called ๐’‘๐Ÿ, and predecessor of ๐’˜๐Ÿ, called ๐’‘๐Ÿ. Let ๐’— be the lowest common ancestor of ๐’‘๐Ÿ and ๐’‘๐Ÿ in the tree, and ๐’–โ„“ and ๐’–๐’“ be the left and right child of ๐’—, respectively. Having precomputed a static structure for all elements within a subtree of a node, we can answer one one-sided reporting query in the structure of ๐’–โ„“ in time ๐‘ถโข(๐ฅ๐จ๐ โก๐’+๐’Œโ„“). Answering another one-sided reporting query in the structure of ๐’–๐’“ takes time ๐‘ถโข(๐ฅ๐จ๐ โก๐’+๐’Œ๐’“). Since ๐’Œ=๐’Œโ„“+๐’Œ๐’“, the query time is ๐‘ถโข(๐ฅ๐จ๐ โก๐’+๐’Œ).

It remains to obtain an ๐‘ถโข(๐ฅ๐จ๐ โก๐’+๐’Œ) query time for the ๐’Œ-lowest, among the ๐’•-oldest inserted planes, from our proposed structure.

5.1 Partial Persistence: Finding the ๐’Œ-lowest among the ๐’•-oldest planes

During the entire sequence of insertions ๐’‰๐Ÿ,๐’‰๐Ÿ,โ€ฆ , we keep track of the time, that is the number of insertions to the semi-dynamic set |๐‘ฏ|=๐’•. Whenever the ๐’•-th insertion, ๐’‰๐’•, triggers a rebuild of a prefix of Bentley-Saxe sets, we tag all structures ๐‘ซ๐’Š that are dropped with timestamp ๐’•โ€ :=๐’• and the newly created structure with timestamp ๐’•โˆ—:=๐’•.

Our extension to partial persistence is now to simply keep the obsolete data structures in memory, without deleting them. There are ๐‘ถโข(๐’) structures in total, and we store their [๐’•โˆ—,๐’•โ€ ) intervals in a tree. To answer a query among the ๐’•-oldest planes {๐’‰๐Ÿ,โ€ฆ,๐’‰๐’•}, we first determine those โ‰ค๐’‡=๐‘ถโข(๐ฅ๐จ๐ โก๐’๐ฅ๐จ๐ โก๐ฅ๐จ๐ โก๐’) data-structures {๐‘ซ๐’Š} that are alive at time ๐’•, i.e. have ๐’•โˆˆ[๐’•โˆ—,๐’•โ€ ). Since the fix-pointers of our proposed data structure only refer to structures with higher indices (see proof of Lemma 5), we can simply run the greedy query algorithm on this set of data structures.

Since our structure has ๐‘ถโข(๐ฅ๐จ๐ ๐Ÿ–โก๐’) amortized insertion time, total space remains ๐‘ถโข(๐’โข๐ฅ๐จ๐ ๐Ÿ–โก๐’). Consequently, we can answer ๐’Œ-lowest queries among any ๐’•-oldest planes in ๐‘ถโข(๐ฅ๐จ๐ โก๐’+๐’Œ) time.

References

  • [1] Peyman Afshani and Timothy M. Chan. Optimal halfspace range reporting in three dimensions. In 20th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 180โ€“186, 2009. doi:10.1137/1.9781611973068.21.
  • [2] Peyman Afshani, Yakov Nekrich, and Frank Staals. Convexity helps iterated search in 3d. In 41st International Symposium on Computational Geometry (SoCG), pages 3:1โ€“3:14, 2025. doi:10.4230/LIPIcs.SOCG.2025.3.
  • [3] Pankaj K. Agarwal, Boris Aronov, Timothy M. Chan, and Micha Sharir. On Levels in Arrangements of Lines, Segments, Planes, and Triangles. Discret. Comput. Geom., 19(3):315โ€“331, 1998. doi:10.1007/PL00009348.
  • [4] Jon Louis Bentley and James B. Saxe. Decomposable searching problems I: static-to-dynamic transformation. Journal of Algorithms, 1(4):301โ€“358, 1980. doi:10.1016/0196-6774(80)90015-2.
  • [5] Timothy M. Chan. A dynamic data structure for 3-d convex hulls and 2-d nearest neighbor queries. Journal of the ACM, 57(3):16:1โ€“16:15, 2010. doi:10.1145/1706591.1706596.
  • [6] Timothy M. Chan. Three problems about dynamic convex hulls. Int. J. Comput. Geom. Appl., 22(4):341โ€“364, 2012. doi:10.1142/S0218195912600096.
  • [7] Timothy M. Chan. Dynamic geometric data structures via shallow cuttings. In 35th International Symposium on Computational Geometry (SoCG), pages 24:1โ€“24:13, 2019. doi:10.4230/LIPIcs.SOCG.2019.24.
  • [8] Timothy M. Chan, Pingan Cheng, and Da Wei Zheng. An Optimal Algorithm for Higher-Order Voronoi Diagrams in the Plane: The Usefulness of Nondeterminism. In 35th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4451โ€“4463, 2024. doi:10.1137/1.9781611977912.156.
  • [9] Timothy M. Chan and Konstantinos Tsakalidis. Optimal Deterministic Algorithms for 2-d and 3-d Shallow Cuttings. Discret. Comput. Geom., 56(4):866โ€“881, 2016. doi:10.1007/S00454-016-9784-4.
  • [10] Bernard Chazelle. The soft heap: an approximate priority queue with optimal error rate. J. ACM, 47(6):1012โ€“1027, 2000. doi:10.1145/355541.355554.
  • [11] Bernard Chazelle and Ding Liu. Lower bounds for intersection searching and fractional cascading in higher dimension. J. Comput. Syst. Sci., 68(2):269โ€“284, 2004. doi:10.1016/J.JCSS.2003.07.003.
  • [12] Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational geometry: algorithms and applications, 3rd Edition. Springer, 2008. doi:10.1007/978-3-540-77974-2.
  • [13] Sarita de Berg and Frank Staals. Dynamic data structures for k-nearest neighbor queries. Comput. Geom., 111:101976, 2023. doi:10.1016/J.COMGEO.2022.101976.
  • [14] Jeff Erickson. Algorithms, 2019. URL: http://archive.org/details/Algorithms-Jeff-Erickson.
  • [15] Greg N. Frederickson. An Optimal Algorithm for Selection in a Min-Heap. Inf. Comput., 104(2):197โ€“214, 1993. doi:10.1006/INCO.1993.1030.
  • [16] Michael T. Goodrich. Planar Separators and Parallel Polygon Triangulation. J. Comput. Syst. Sci., 51(3):374โ€“389, 1995. doi:10.1006/JCSS.1995.1076.
  • [17] John Iacono and Yakov Nekrich. Incremental Planar Nearest Neighbor Queries with Optimal Query Time. In 41st Symposium on Computational Geometry (SoCG), pages 59:1โ€“59:15, 2025. doi:10.4230/LIPIcs.SOCG.2025.59.
  • [18] Haim Kaplan, Lรกszlรณ Kozma, Or Zamir, and Uri Zwick. Selection from Heaps, Row-Sorted Matrices, and X+Y Using Soft Heaps. In 2nd Symposium on Simplicity in Algorithms (SOSA), pages 5:1โ€“5:21, 2019. doi:10.4230/OASIcs.SOSA.2019.5.
  • [19] Haim Kaplan, Wolfgang Mulzer, Liam Roditty, Paul Seiferth, and Micha Sharir. Dynamic planar voronoi diagrams for general distance functions and their algorithmic applications. In 28th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2495โ€“2504, 2017. doi:10.1137/1.9781611974782.165.
  • [20] Haim Kaplan and Uri Zwick. A simpler implementation and analysis of Chazelleโ€™s soft heaps. In 20th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 477โ€“485, 2009. doi:10.1137/1.9781611973068.53.
  • [21] Philip N. Klein, Shay Mozes, and Christian Sommer. Structured recursive separator decompositions for planar graphs in linear time. In Symposium on Theory of Computing Conference (STOC), pages 505โ€“514, 2013. doi:10.1145/2488608.2488672.
  • [22] Yakov Nekrich and Saladi Rahul. 4d range reporting in the pointer machine model in almost-optimal time. In 34th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1862โ€“1876, 2023. doi:10.1137/1.9781611977554.CH71.
  • [23] Micha Sharir, Shakhar Smorodinsky, and Gรกbor Tardos. An improved bound for k-sets in three dimensions. In 16th Symposium on Computational Geometry (SoCG), pages 43โ€“49, 2000. doi:10.1145/336154.336173.

Appendix A Proof of Lemma 1

Figure 5: Illustration of the proof of Lemma 1.
Proof.

We consider the problem in the plane ๐‘ฎ spanned by the segment ๐’’๐Ÿโˆ—โข๐’’๐Ÿโˆ—ยฏ and vertical line ๐’’๐Ÿ, thus containing ๐’’๐Ÿ as well. Any intersection of ๐’‰โˆˆ๐‘ฏ with ๐‘ฎ is a line, as any ๐’‰ does not contain vertical lines. Let ๐’‘๐Ÿ be the intersection point of ๐’’๐Ÿ with its ๐’Œ-lowest plane, and ๐’‘๐Ÿ the intersection point of ๐’’๐Ÿ with its ๐’Œ-lowest plane. That is, the orthogonal projection of ๐’‘๐Ÿโข๐’‘๐Ÿยฏ is ๐’’๐Ÿโˆ—โข๐’’๐Ÿโˆ—ยฏ. (See Figureย 5.)

The proof is by contradiction. Assume there is a vertical line ๐’’ with ๐’’โˆ—โˆˆ๐’’๐Ÿโˆ—โข๐’’๐Ÿโˆ—ยฏ that has a different set ๐’Œ-lowest(๐’’,๐‘ฏ)โ‰ ๐‘ฏโ€ฒ planes.

Let ๐’‰ be one such plane not in ๐‘ฏโ€ฒ. The projection of its intersection with ๐’‘๐Ÿโข๐’‘๐Ÿยฏ is ๐’’โˆ—. Now, if ๐’‰ intersects the downward vertical ray in ๐’‘๐Ÿ we have a contradiction to ๐’‰โˆ‰๐‘ฏโ€ฒ, and the same argument applies to the ray in ๐’‘๐Ÿ. So ๐’‰ would need to contain a vertical line, which is not possible for any ๐’‰โˆˆ๐‘ฏ, or intersect ๐’‘๐Ÿโข๐’‘๐Ÿยฏ more than once, which is also not possible for any line and segment pair. โ—€