Abstract
Let \(\mathcal {C}\) be a set of n axis-aligned cubes of arbitrary sizes in \({\mathbb R}^3\) in general position. Let \(\mathcal {U}:=\mathcal {U}(\mathcal {C})\) be their union, and let \(\kappa \) be the number of vertices on \(\partial \mathcal {U}\); \(\kappa \) can vary between O(1) and \(\Theta (n^2)\). We present a partition of \(\mathop {\textrm{cl}}({\mathbb R}^3\setminus \mathcal {U})\) into \(O(\kappa \log ^4 n)\) axis-aligned boxes with pairwise-disjoint interiors that can be computed in \(O(n \log ^2 n + \kappa \log ^6 n)\) time if the faces of \(\partial \mathcal {U}\) are pre-computed. We also show that a partition of size \(O(\sigma \log ^4 n + \kappa \log ^2 n)\), where \(\sigma \) is the number of input cubes that appear on \(\partial \mathcal {U}\), can be computed in \(O(n \log ^2 n + \sigma \log ^8 n + \kappa \log ^6 n)\) time if the faces of \(\partial \mathcal {U}\) are pre-computed. The complexity and runtime bounds improve to \(O(n\log n)\) if all cubes in \(\mathcal {C}\) are congruent and the faces of \(\partial \mathcal {U}\) are pre-computed. Finally, we show that if \(\mathcal {C}\) is a set of arbitrary axis-aligned boxes in \({\mathbb R}^3\), then a partition of \(\mathop {\textrm{cl}}({\mathbb R}^3\setminus \mathcal {U})\) into \(O(n^{3/2}+\kappa )\) boxes can be computed in time \(O((n^{3/2}+\kappa )\log n)\), where \(\kappa \) is, as above, the number of vertices in \(\mathcal {U}(\mathcal {C})\), which now can vary between O(1) and \(\Theta (n^3)\).
Similar content being viewed by others
Notes
Since vertices of \(\Pi _f\) that are not vertices of \(\Pi _\rho \) might lie on \({\varepsilon }\), we should apply Lemma 2.7 to the segment \({\varepsilon }'\) that is the slight translation of \(\mathop {\textrm{int}}({\varepsilon })\) into \(\mathop {\textrm{int}}(\rho )\); the number of edges of \(\Pi _f\) crossed by \({\varepsilon }'\) correspond to the outer vertices on \({\varepsilon }\), which is what we want to bound here.
As similarly remarked earlier, to use the lemma, we choose a mast parallel and very close to \(\delta _p\).
To distinguish from the face of the union \(\mathcal {U}\), we call the boundary face of an input cube a boundary square.
A purple vertex of \(\Pi _S^\nabla \) lying on an edge of \(S\) is a red vertex of \(\Pi _S\) and this red vertex may be charged \(O(\log ^2 n)\) times by a later stage.
The terminology comes from treating the edges as edges of \(\mathcal {K}\); it would be reversed if we were to regard them as edges of \(\mathcal {U}\).
References
Agarwal, P.K., Steiger, A.: An output-sensitive algorithm for computing the union of cubes and fat boxes in 3d. 48th Inter. Colloq. on Auto., Lang., and Prog. 10, 1–20 (2021)
Agarwal, P.K., Grove, E.F., Murali, T.M., Vitter, J.S.: Binary space partitions for fat rectangles. SIAM J. Comput. 29, 1422–1448 (2000)
Agarwal, P.K., Kaplan, H., Sharir, M.: Union of hypercubes and 3d Minkowski sums with random sizes. Discrete Comput. Geom. 65, 1136–1165 (2021)
Arya, S., Mount, D.M., Netanyahu, N.S., Silverman, R., Wu, A.Y.: An optimal algorithm for approximate nearest neighbor searching in fixed dimensions. J. ACM 45, 891–923 (1998)
Bern, M., Eppstein, D.: Mesh generation and optimal triangulation. In: Computing in Euclidean Geometry, pp. 23–90. World Scientific, Singapore (1992)
Boissonnat, J.D., Sharir, M., Tagansky, B., Yvinec, M.: Voronoi diagrams in higher dimensions under certain polyhedral distance functions. Discrete Comput. Geom. 19, 485–519 (1998)
Chazelle, B.: Convex partitions of polyhedra: a lower bound and worst-case optimal algorithm. SIAM J. Comput. 13, 488–508 (1984)
Chazelle, B., Palios, L.: Triangulating a nonconvex polytope. Discrete Comput. Geom. 5, 505–526 (1990)
Chazelle, B., Edelsbrunner, H., Guibas, L.J., Sharir, M.: A singly-exponential stratification scheme for real semi-algebraic varieties and its applications. Theor. Comput. Sci. 84, 77–105 (1991)
Cheng, S.-W., Dey, T.K., Shewchuk, J.: Delaunay Mesh Generation. Chapman & Hall/CRC, New York (2012)
Collins, G.: Quantifier elimination for real closed fields by cylindrical algebraic decomposition. In: Second GI Conference on Automata Theory and Formal Languages 33, pp. 134–183 (1975)
Cormen, T., Leiserson, C., Rivest, R., Stein, C.: Introduction to Algorithms, 4th edn., pp. 331–332. MIT Press, Cambridge (2022)
Dumitrescu, A., Mitchell, J.S.B., Sharir, M.: Binary space partitions for axis-parallel segments, rectangles, and hyperrectangles. Discrete Comput. Geom. 31, 207–227 (2004)
Edelsbrunner, H., Mücke, E.P.: Simulation of simplicity: a technique to cope with degenerate cases in geometric algorithms. ACM Trans. Graph. 9(9), 66–104 (1990)
Foley, J.D., Dam, A., Feiner, S., Hughes, J.F.: Computer Graphics—Principles and Practice, 2nd edn. Addison-Wesley, Boston (1992)
Frey, P.J., George, P.-L.: Mesh Generation: Application to Finite Elements. Wiley, Hoboken (2007)
Fuchs, H., Kedem, Z., Naylor, B.: On visible surface generation by a priori tree structures. Proc. 7th Annu. Conf. Comp. Graph. Interact. Tech., 124–133 (1980)
Giora, Y., Kaplan, H.: Optimal dynamic vertical ray shooting in rectilinear planar subdivisions. ACM Trans. Algorithm (5) 3(28), 1–28 (2009)
Laidla, D.H., Trumbore, W.B., Hughes, J.F.: Constructive solid geometry for polyhedral objects. Proc. 13th Annu. Conf. Comp. Graph. Interact. Tech., 161–170 (1986)
LaValle, S.M.: Planning Algorithms. Cambridge University Press, Cambridge (2006)
Overmars, M.H., Yap, C.-K.: New upper bounds in Klee’s measure problem. SIAM J. Comput. 20(6), 1035–1045 (1991)
Paterson, M.S., Yao, F.F.: Efficient binary space partitions for hidden-surface removal and solid modeling. Discrete Comput. Geom. 5, 485–503 (1990)
Paterson, M., Yao, F.F.: Optimal binary space partitions for orthogonal objects. J. Algorithms 13, 99–113 (1992)
Schwartz, J.T., Sharir, M.: On the “piano movers’’ problem ii: general techniques for computing topological properties of real algebraic manifolds. Adv. Appl. Math. 4, 298–351 (1983)
Sharir, M., Agarwal, P.K.: Davenport-Schinzel Sequences and Their Geometric Applications. Cambridge University Press, Cambridge (1995)
Tóth, C.D.: Binary space partitions for axis-aligned fat rectangles. SIAM J. Comput. 38, 429–447 (2008)
Acknowledgements
We thank Boris Aronov and Mark de Berg for helpful discussions.
Author information
Authors and Affiliations
Corresponding author
Additional information
Editor in Charge: Csaba D. Tóth
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Dedicated to the memory of Eli Goodman.
Appendix A: Balanced-Box Decomposition (BBD) Trees
Appendix A: Balanced-Box Decomposition (BBD) Trees
In this appendix we prove Lemma 2.1, but we first review additional properties of BBD trees that were not required to describe our algorithms but are needed for the proof here. For the full details of BBD trees and their construction, we refer the reader to [4].
For a box B, let x(B), y(B), z(B) denote its projection on the x-, y-, and z-axis, respectively, and we refer to them as its x-span, y-span, and z-span, respectively.
Consider two nested boxes \(\square ^O\) and \(\square ^I\) such that \(\square ^I\subseteq \square ^O\). For each axis \(q \in \{x,y,z\}\), let \([q_I^-,q_I^+]\) (resp., \([q_O^-,q_O^+]\)) be the q-span of \(\square ^I\) (resp., \(\square ^O\)). Using the terminology from [4], \(\square ^I\) is said to be q-sticky for \(\square ^O\) if each of \(q_I^- - q_O^-\) and \(q_O^+ - q_I^+\) is either 0 or at least \(q_I^+ - q_I^-\), and \(\square ^I\) is said to be sticky for \(\square ^O\) if \(\square ^I\) is q-sticky for all axes \(q \in \{x,y,z\}\).
Let \(P \subseteq \mathbb {R}^3\) be a set of n points, and let \(\mathcal {T}\) be a BBD tree constructed on P. The following additional properties hold for each node u of \(\mathcal {T}\): (i) \(\square ^I_u\) is sticky for \(\square ^O_u\) (if \(\square ^I_u\) exists), and (ii) \(\square ^O_u\) and \(\square ^I_u\) have aspect ratio at most three, i.e., the length of the longest span (edge length) of \(\square ^O_u\) (resp., \(\square ^I_u\)) is at most three times the length of the shortest span of \(\square ^O_u\) (resp., \(\square ^I_u\)).
Using these properties, we establish Lemma 2.1:
Lemma 2.1. Let u be a node of a BBD tree \(\mathcal {T}\) for a point set \(P \subseteq {\mathbb R}^3\). There is a set \(H_u\) of at most 24 planes that induces a subdivision of into O(1) axis-aligned boxes such that any axis-aligned cube C that intersects but none its vertices lie in the interior of contains an edge of each box that it intersects.
Proof
Let C be an axis-aligned cube that intersects the interior of and has all vertices outside . The proof is trivial if \(\square ^O_u \subseteq C\), so assume otherwise. For concreteness, we also assume \(\square ^I_u \ne \varnothing \); the proof for the other case is similar.
For each axis \(q \in \{x,y,z\}\), let \([q_I^-,q_I^+] :=q(\square ^I_u)\) be the q-span of \(\square ^I_u\), let \([q_O^-,q_O^+] :=q(\square ^O_u)\) be the q-span of \(\square ^O_u\), and let \([q_C^-,q_C^+] :=q(C)\) be the q-span of C. Let \(q_I^1 :=(q_I^+-q_I^-)/3\) and \(q_I^2 :=2(q_I^+-q_I^-)/3\) be the points that trisect \(q(\square ^I_u)\), and let \(q_O^1 :=(q_O^+-q_O^-)/3\) and \(q_O^2 :=2(q_O^+-q_O^-)/3\) be the points that trisect \(q(\square ^O_u)\). Set \(T_{I,q} :=\{q_I^-, q_I^1, q_I^2, q_I^+\}\) and \(T_{O,q} :=\{q_O^-, q_O^1, q_O^2,q_O^+\}\).
Let \(H_u\) be the set of planes of the form \(q = t\) for each \(t \in T_{I,q} \cup T_{O,q}\) and \(q \in \{x,y,z\}\). Clearly \(\mathopen | H_u \mathclose | \le 24\). Let \(\Xi _u\) be the set of boxes in the subdivision of induced by \(H_u\), and let \(B \in \Xi _u\) be a box whose interior intersects C. We prove that C contains an edge of B.
First observe that if \(q(C) \not \supseteq q(B)\) for all \(q \in \{x,y,z\}\) then a vertex of C lies inside B, which contradicts the assumption that no vertex of C lies in . Hence, assume that \(x(C) \supseteq x(B)\). To prove that an x-edge of B lies inside C, we will prove that for each \(q \in \{y,z\}\), at least one of the endpoints of the q-span \(q(B) = [q_B^-,q_B^+]\) lies in q(C), as this will imply that both endpoints of an x-edge of B lie inside C. Note that \(q_B^-,q_B^+ \in T_{I,q} \cup T_{O,q}\), by construction.
We claim that for each \(q \in \{y,z\}\), q(C) contains at least one element of \(T_{I,q} \cup T_{O,q}\). Assuming that the claim is true, let \(q_i \in (T_{I,q} \cup T_{O,q}) \cap q(C)\). If \(q_i\) is \(q_B^-\) or \(q_B^+\), we are done so assume that \(q_i \ne q_B^-,q_B^+\). On the other hand, by construction, \(q_i \notin q(B)\), so we conclude that \(q(C) \not \subseteq q(B)\). But \(q(B) \cap q(C) \ne \varnothing \). Hence, at least one of the endpoints of q(B) lies in q(C), as desired. What now remains is to prove the above claim.
The proof of the claim consists of two parts. We first consider the case where no vertex of C lies in \(\square ^I_u\). Then all of the vertices lie outside \(\square ^O_u\). If no span q(C) contains \(q(\square ^O_u)\), a vertex of C lies in \(\mathop {\textrm{int}}(\square ^O_u)\), which is a contradiction. Without loss of generality, assume that \(x(\square ^O_u) \subseteq x(C)\). By property (ii) of \(\mathcal {T}\), we have that \(3\mathopen | x(\square ^O_u) \mathclose | \ge \mathopen | y(\square ^O_u) \mathclose |,\mathopen | z(\square ^O_u) \mathclose |\). Since C is a cube, \(\mathopen | x(C) \mathclose | = \mathopen | y(C) \mathclose | = \mathopen | z(C) \mathclose |\), so \(\mathopen | y(C) \mathclose | \ge \mathopen | y(\square ^O_u) \mathclose |/3\) and \(\mathopen | z(C) \mathclose | \ge \mathopen | z(\square ^O_u) \mathclose |/3\). It follows that at least one point \(y_i \in T_{O,y}\) (resp., \(z_i \in T_{O,z}\)) lies in y(C) (resp., z(C)), thereby proving the claim in this case.
Next, suppose at least one vertex of C lies in \(\square ^I_u\). For each axis \(q \in \{x,y,z\}\), if \(q(C) \subseteq q(\square ^I_u)\) we say q(C) is enclosed, and crossing if \(q(C) \supseteq [q_O^-,q_I^-]\) or \(q(C) \supseteq [q_I^+,q_O^+]\). If all spans of C are enclosed, C is contained in \(\square ^I_u\), a contradiction. Hence, there is a crossing span of C, say, x(C). Without loss of generality, assume each crossing span q(C) contains \([q_O^-,q_I^-]\). In particular, \(\mathopen | x(C) \mathclose | \ge x_I^- - x_O^-\) and x(C) contains \(x_I^- \in T_{I,x}\) and \(x_O^- \in T_{O,x}\). By property (i) of \(\mathcal {T}\), we have \(x_I^- - x_O^- \ge \mathopen | x(\square ^I_u) \mathclose |\), and by property (ii) of \(\mathcal {T}\), we have \(3\mathopen | x(\square ^I_u) \mathclose | \ge \mathopen | y(\square ^I_u) \mathclose |,\mathopen | z(\square ^I_u) \mathclose |\). Since C is a cube, \(\mathopen | x(C) \mathclose | = \mathopen | y(C) \mathclose | = \mathopen | z(C) \mathclose |\), so \(\mathopen | y(C) \mathclose | \ge \mathopen | y(\square ^I_u) \mathclose |/3\) and \(\mathopen | z(C) \mathclose | \ge \mathopen | z(\square ^I_u) \mathclose |/3\). Hence, if y(C) is enclosed, then it contains either \(y_I^1\) or \(y_I^2\); otherwise, y(C) is crossing and contains \(y_O^-\) and \(y_I^-\). In either case, at least one point \(y_i \in T_{I,y} \cup T_{O,y}\) lies in y(C). By a symmetric argument, some point \(z_i \in T_{I,z} \cup T_{O,z}\) lies in z(C). This completes the proof of the claim and of the lemma. \(\square \)
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Agarwal, P.K., Sharir, M. & Steiger, A. Decomposing the Complement of the Union of Cubes and Boxes in Three Dimensions. Discrete Comput Geom (2024). https://doi.org/10.1007/s00454-024-00632-2
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s00454-024-00632-2