Algorithms for Two-Box Covering
Total Page:16
File Type:pdf, Size:1020Kb
Algorithms for Two-Box Covering Esther M. Arkin Gill Barequet Joseph S. B. Mitchell Dept. of Applied Mathematics Dept. of Computer Science Dept. of Applied Mathematics and Statistics The Technion—Israel Institute and Statistics Stony Brook University of Technology Stony Brook University Stony Brook, NY 11794 Haifa 32000, Israel Stony Brook, NY 11794 ABSTRACT 1. INTRODUCTION We study the problem of covering a set of points or polyhe- A common method of preprocessing spatial data for ef- dra in <3 with two axis-aligned boxes in order to minimize ¯cient manipulation and queries is to construct a spatial a function of the measures of the two boxes, such as the sum hierarchy, such as a bounding volume tree (BV-tree). Var- or the maximum of their volumes. This 2-box cover problem ious types of BV-trees have been widely used in computer arises naturally in the construction of bounding volume hi- graphics and animation (e.g., for collision detection, visibil- erarchies, as well as in shape approximation and clustering. ity culling, and nearest neighbor searching) and in spatial Existing algorithms solve the min-max version of the exact databases (e.g., for GIS and data mining). In order to be problem in quadratic time. Our results are more general, maximally e®ective at allowing pruning during a search of addressing min-max, min-sum and other versions. Our re- the hierarchy, it is important that the bounding volumes ¯t sults give the ¯rst approximation schemes for the problem, the data as tightly as possible. In a top-down construction which run in nearly linear time, as well as some new exact of the BV-tree, each step requires that one compute a good algorithms. We give (1 + ")-approximation algorithms for way to partition the data corresponding to a node of the hi- minimizing the maximum or sum of volumes (or surface ar- erarchy so that the data corresponding to the children of the eas, diameters, widths, or girths) of the two boxes in <3. node have bounding volumes that are as \small" as possible. We investigate also the problem of computing balanced cov- For the commonly used bounding volume of axis-aligned erings, in which each box covers at least a fraction of the bounding boxes (AABBs), we refer to the corresponding op- input objects, and we discuss the application to construct- timization problem as the 2-box cover problem. ing provably-good bounding volume hierarchies of polyhe- More generally, let S be a set of n points (or polyhe- d dra. We also generalize our results to higher dimensions. dra) in < . Our goal is to ¯nd a partition of S into two sets, S1 and S2, in order to minimize the combined measure, Categories and Subject Descriptors f(B1; B2), of the axis-aligned bounding boxes, B1 and B2, of the subsets S1 and S2. F.2.2 [Analysis of Algorithms and Problem Complex- We denote by (x(B); y(B); z(B)) the lengths of the coor- ity]: Nonnumerical Algorithms and Problems|Geometri- dinate extents of an axis-aligned box B ½ <3. We consider cal problems and computations; G.2.1 [Discrete Math- various ways of quantifying the \size" of B. A measure, ematics]: Combinatorics|combinatorial algorithms; I.3.5 ¹(B), of B is a nonnegative function that obeys ¹(B) · [Computer Graphics]: Computational Geometry and Ob- ¹(B0) if B B0. In much of our discussions we will focus ject Modeling|Geometric algorithms, languages, and sys- on the volume measure, given by ¹(B) = x(B) ¢ y(B) ¢ z(B), tems but most of our results apply also to the measures of surface area (x(B)y(B) + x(B)z(B) + y(B)z(B)), diameter (in L1) General Terms (max(x(B); y(B); z(B))), width (min(x(B); y(B); z(B))), and girth (x(B) + y(B) + z(B)). Algorithms By the combined measure of two boxes we mean some 0 function f(B1; B2) that satis¯es monotonicity: if B1 B1 0 0 0 Keywords and B2 B2, then f(B1; B2) · f(B1; B2). Often, we focus on the min-max (f(B1; B2) = maxf¹(B1); ¹(B2)g, for some Exact and approximate algorithms measure ¹), the min-sum (f(B1; B2) = ¹(B1) + ¹(B2)), or the union (f(B1; B2) = ¹(B1 [ B2)) combined measure, but some of our results apply more generally to other combined measures. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are 1.1 Summary of Results not made or distributed for profit or commercial advantage and that copies We have obtained the following results: bear this notice and the full citation on the first page. To copy otherwise, to (1) In <3, a (1 + ")-approximation of the min-max 2- republish, to post on servers or to redistribute to lists, requires prior specific box cover can be computed in time O(minfn log n; n="g + permission and/or a fee. (log n)="2). A (1 + ")-approximation of the min-sum 2-box SCG'06, June 5–7, 2006, Sedona, Arizona, USA. 2 Copyright 2006 ACM 1-59593-340-9/06/0006 ...$5.00. cover can be computed in time O(minfn log n; n="g+n=" ). (2) The exact min-sum (or min-union) 2-box cover can be 1.3 Motivation and Applications d d computed in time O(n ) in < . The 2-box cover of a set is a fundamental problem that (3) The min-sum (resp., min-max) surface area (or (d ¡ shows up in shape approximation, bounding volume hier- d 1)-volume) for a 2-box cover of S ½ < can be (1 + ")- archies, intersection detection, and range-search data struc- d d¡1 approximated in time O(n+(1=") ) (resp., O(n+(1=") )). tures (such as R-trees and their numerous variants [16, 1]). (4) We extend the min-sum and min-max surface area There has been considerable research on the problem of results to obtain (1 + ")-approximation algorithms for 2- collision detection in simulation systems, where bounding box covers that obey a balance (cardinality) constraint, in volume hierarchies are commonly used. For surveys, see, that each box contains at least a certain fraction, ®, of the e.g., [23, 29]. Of most relevance to our work here is the elements of S. widely-used method of bounding volume hierarchies (BV- (5) We show how to apply our methods to covering sets trees). The choice of bounding volume was often spheres [21, of polygons or polyhedra. We know of no prior result giving 22, 30] or axis-aligned bounding boxes (AABBs) [7, 15, a provably-good covering of a polyhedron by two AABBs. 19], due to the simplicity in checking two such volumes for (Typically, in graphics applications, simple heuristics are overlap (intersection) and in transforming AABBs when ob- used to partition the facets of a polyhedron; however, each of jects move. The system SOLID [34, 35, 36] achieves its the standard methods can perform arbitrarily poorly in the e±ciency using a carefully engineered hierarchy of AABBs. worst case.) Our approximation algorithms also then give Another popular bounding volume is the oriented bounding corresponding provable results on the quality of bounding box (OBB), a bounding box of arbitrary orientation, which volume hierarchies. is used in BOXTREEs [6] and OBBTrees [14], the basis for the popular RAPID system. The QuickCD system [18, 25] is based on BV-tree methods utilizing bounding \k-dops" (dis- 1.2 Related Work crete orientation polytopes), whose supporting hyperplanes Bespamyatnikh and Segal [8] have solved the exact min- have normals from a small number, k, of selected orienta- max 2-box cover problem for point sets in <d with an al- tions [24]. Zachmann [39, 40] and He [17] have developed gorithm that takes time O(n log n + nd¡1) and space O(n). related approaches (\DOP-trees," \restricted boxtrees," and Their algorithm minimizes the maximum of the measures of \QuOSPS trees"). Other shapes which have been used in the boxes, for any monotone measure function (e.g., volume, hierarchical decompositions are truncated tetrahedra [31], surface area, diameter, etc). Their algorithm crucially uses triangular prisms [6], cones [32], ellipsoids [ibid.], etc. BV- the structure of the min-max case and does not apply, e.g., trees are also useful for ray tracing [5, 13, 24, 37] and for to the min-sum problem. Here, we consider min-max, min- proximity queries [26, 38]. sum, or, more generally, any combined measure for the two boxes. 2. PRELIMINARIES There is a large family of related clustering problems, which include the k-center problem (minimize the maximum We let xi(B) denote the extent (length) of an axis-aligned radius in a covering with k disks), the k-median problem box B in the xi-coordinate direction. We let BB(X) de- (minimize the sum of distances to the centers), and the k- note the axis-aligned bounding box of X. Without loss of d clustering problem (minimize the sum of all interpoint dis- generality, we assume that BB(S) = U, the unit cube [0; 1] . tances within a cluster). Most facility-location problems are Since the MAX-GAP problem (the min-sum 2-interval hard (NP-complete) if k is part of the input. The Euclidean cover in one dimension) has an (n log n) lower bound, we k-medians problem has a PTAS [4]. Recent applications of get a similar result for exactly solving the 2-box cover ac- core-sets have yielded e±cient approximation schemes for cording to various measures in three dimensions: 2-centers and k-centers in higher dimensions (see B¸adoiu et al.