arXiv:2610.03451cs.CGOct 2026

Manuscript Offprint

arXiv:2610.03451

Point and Line Nearest-Neighbor Searching in 3-Space

Pankaj K. Agarwal, Esther Ezra, Micha Sharir

Abstract

This paper presents data structures for nearest-neighbor (NN) searching problems involving points, lines, segments, and triangles in R3\mathbb{R}^3, achieving significantly better performance than the previously best-known results for these problems. For example, we present a linear-size data structure for answering NN queries with lines or segments amid nn points in R3\mathbb{R}^3 with O∗(n1/2)O^*(n^{1/2}) query time (where the O∗(⋅)O^*(\cdot) notation hides sub-polynomial factors). We also present a data structure of O∗(n4)O^*(n^4) size that answers such queries in O∗(1)O^*(1) time. For the converse problem, in which we seek the nearest neighbor of a query point amid nn lines, segments, or triangles in R3\mathbb{R}^3, we present a linear-size data structure with O∗(n2/3)O^*(n^{2/3}) query time. These results constitute a significant improvement over previous solutions. We obtain improved solutions for the two extreme regimes of (near-)linear storage and of fast query time. These results also yield trade-off bounds between the query time and the size of the data structure. Our results rely on several combinatorial and algorithmic results on arrangements of surfaces in R3\mathbb{R}^3 and R4\mathbb{R}^4, particularly on recent results on vertical decompositions of substructures in such arrangements established by the authors [8].

1 Introduction

The general nearest-neighbor searching problem can be formulated as follows: Given a set S\mathcal{S} of input objects, often referred to as sites, in Rd\mathbb{R}^d, for some d≥2d \geq 2, and a distance function ρ\rho, the goal is to preprocess S\mathcal{S} into a data structure that can efficiently find the object of S\mathcal{S} that lies closest to a query object qq (point, line, segment, or triangle) under the distance

*A preliminary partial presentation of the results in this paper appears in [8,9]. Work by Pankaj Agarwal has been partially supported by NSF grants CCF-20-07556 and CCF-22-23870 and by a US-Israel Binational Science Foundation Grant 2022131. Work by Esther Ezra has been partially supported by Israel Science Foundation Grant 800/22, and by a US-Israel Binational Science Foundation Grant 2022131. Work by Micha Sharir has been partially supported by Israel Science Foundation Grant 495/23.

†^{\dagger}Department of Computer Science, Duke University, Durham, NC 27708, USA; pankaj@cs.duke.edu, https://orcid.org/0000-0002-9439-181X

‡^{\ddagger}School of Computer Science, Bar Ilan University, Ramat Gan, Israel; ezraest@cs.biu.ac.il, https://orcid.org/0000-0001-8133-1335

§School of Computer Science, Tel Aviv University, Tel Aviv, Israel; michas@tauex.tau.ac.il, http://orcid.org/0000-0002-2541-3763 function ρ\rho. In its most classical form, referred to as the post-office problem [39], both the input sites and the queries are points in R2R^{2} and ρ\rho is the Euclidean metric. Because of its wide-ranging applications across many disciplines, nearest-neighbor searching has been extensively studied, for about half a century, not only in computational geometry but also in many fields, such as database systems, information retrieval, GIS, machine learning, computer vision, and natural language processing. The problem has been extended in numerous ways, e.g., to instances where the sites and/or the queries may come from families of more general geometric objects, and ρ\rho may be an arbitrary metric. Since NN searching is hard (i.e., inefficient) in high dimensions, much of the work has focused on computing approximate nearest neighbors for d large. We refer to a few comprehensive surveys on nearest-neighbor searching, for details on proximity problems of this kind and their solutions [19, 22, 47, 49, 51].

In this paper, we focus on answering exact NN queries where both the input sites and the query objects are points, lines, segments, or triangles in R3\mathbb{R}^3. For a closed subset X⊂R3X \subset \mathbb{R}^3 and a point p∈R3p \in \mathbb{R}^3, we define dist(p,X)=min⁡x∈X∥p−x∥\text{dist}(p, X) = \min_{x \in X} \|p - x\|, where ∥⋅∥\|\cdot\| denotes the Euclidean norm, and for two closed subsets X,Y⊂R3X, Y \subset \mathbb{R}^3, we define

dist(X,Y)=min⁡x∈Xdist(x,Y)=min⁡x∈X,y∈Ydist(x,y).\mathrm{dist}(X,Y)=\min_{x\in X}\mathrm{dist}(x,Y)=\min_{x\in X,y\in Y}\mathrm{dist}(x,y).

For a set S of geometric objects and for a query object q, we define

NN(q,S)=arg⁡min⁡σ∈Sdist(q,σ),\mathrm{NN}(q,\mathcal{S})=\arg\min_{\sigma\in\mathcal{S}}\mathrm{dist}(q,\sigma),

that is, the nearest neighbor of q in S. Our goal is to preprocess S into a data structure so that NN(q,S)\text{NN}(q, \mathcal{S}), for a query object q, can be computed efficiently. This general goal bifurcates into many specific variants, depending on the types of the query and the input objects, as well as for the storage allocated for the structure. See below.