The minimum convex container of two convex polytopes under translations

The minimum convex container of two convex polytopes under translations

JID:COMGEO AID:1520 /FLA [m3G; v1.232; Prn:26/02/2018; 15:24] P.1 (1-11) Computational Geometry ••• (••••) •••–••• Contents lists available at Scie...

675KB Sizes 1 Downloads 80 Views

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.1 (1-11)

Computational Geometry ••• (••••) •••–•••

Contents lists available at ScienceDirect

Computational Geometry: Theory and Applications www.elsevier.com/locate/comgeo

The minimum convex container of two convex polytopes under translations ✩ Hee-Kap Ahn a , Judit Abardia b , Sang Won Bae c,∗ , Otfried Cheong d , Susanna Dann e , Dongwoo Park a , Chan-Su Shin f a

Department of Computer Science and Engineering, POSTECH, South Korea Institut für Mathematik, Goethe-Universität, Frankfurt, Germany Department of Computer Science, Kyonggi University, Suwon, South Korea d Department of Computer Science, KAIST, South Korea e Institute of Discrete Mathematics and Geometry, Vienna University of Technology, Vienna, Austria f Division of Computer and Electronic Systems Engineering, Hankuk University of Foreign Studies, Yongin, South Korea b c

a r t i c l e

i n f o

Article history: Received 7 December 2014 Received in revised form 14 February 2017 Accepted 11 January 2018 Available online xxxx Keywords: Packing problem Optimization problem Convex polytope Exact algorithm

a b s t r a c t Given two convex d-polytopes P and Q in Rd for d  3, we study the problem of bundling P and Q in a smallest convex container. More precisely, our problem asks to find a minimum convex set containing P and a translate of Q that do not properly overlap each other. We present the first exact algorithm for the problem for any fixed dimension d  3. d +1

The running time is O (n(d−1) 2  ), where n denotes the number of vertices of P and Q . In particular, in dimension d = 3, our algorithm runs in O (n4 ) time. We also give an example of polytopes P and Q such that in the smallest container the translates of P and Q do not touch. © 2018 Elsevier B.V. All rights reserved.

1. Introduction Given two convex d-polytopes P and Q in a d-dimensional space for some constant d  3, we study the problem of bundling them under translations. More precisely, the problem asks to find a translation vector t ∈ Rd of Q that minimizes the volume or the surface area of the convex hull of P ∪ Q t under the restriction that their interiors remain disjoint, where Q t = {q + t | q ∈ Q }. For two convex polygons in the plane, Lee and Woo showed that the area and perimeter can be minimized in O (n) time [10], where n denotes the number of vertices of P and Q . One natural research direction is towards bundling more than two polygons. If the number of polygons is part of the input, the problem is NP-hard, even if the input polygons are rectangles. This follows by a reduction from the Partition problem [6]. Recently, Ahn et al. [1] considered the problem of

✩ The work by H.-K. Ahn, O. Cheong, and D. Park was supported by the NRF grant 2011-0030044 (SRC-GAIA) funded by the Korea government (MSIP). The work by H.-K. Ahn was supported by the MSIT (Ministry of Science and ICT), Korea, under the SW Starlab support program (IITP–2017–0–00905) supervised by the IITP (Institute for Information & communications Technology Promotion). Work by S.W. Bae was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (2015R1D1A1A01057220). J. Abardia was partially supported by DFG grant AB 584/1-1. Susanna Dann thanks the Oberwolfach Research Institute for Mathematics for its hospitality and support, where part of this work was carried out. Work by C.-S. Shin was supported by Research Grant of Hankuk University of Foreign Studies. Corresponding author. E-mail addresses: [email protected] (H.-K. Ahn), [email protected] (J. Abardia), [email protected] (S.W. Bae), [email protected] (O. Cheong), [email protected] (S. Dann), [email protected] (D. Park), [email protected] (C.-S. Shin).

*

https://doi.org/10.1016/j.comgeo.2018.02.004 0925-7721/© 2018 Elsevier B.V. All rights reserved.

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.2 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

2

Fig. 1. Two polytopes P and Q that are separated in their optimal placement with respect to both (a) volume and (b) surface area.

bundling three convex polygons in the plane. They showed that the complexity of the configuration space is O (n2 ) and an optimal solution can be computed in O (n2 ) time, where n denotes the total number of vertices of the three input polygons. The topic of this paper is to consider the bundling problem in dimensions higher than two. To the best of our knowledge, for dimension d  3, there was no known exact algorithm, prior to our work, that finds a minimum convex set containing two given polytopes P and Q under translations without overlap between their interiors. Ahn et al. [2] considered the problem of minimizing the volume of the convex hull of two convex polytopes under translations for dimension d  3 where the polytopes are allowed to freely overlap. They presented an algorithm that computes the optimal translation in 3

O (nd+1− d logd+1 n) expected time, where n is the total complexity of P and Q . A special case of this problem, called the packing problem, has been studied in the literature, where the shape of the container is predetermined. Then the problem is to find a minimum size container of the predetermined shape into which input objects can be placed. In most cases, the containers are of simple convex shapes such as rectangles and circles, and input objects are polygons in the plane. Milenkovic [11] gave an O (nk−1 log n)-time algorithm for packing k convex n-gons into a minimum area axis-parallel rectangle. Alt and Hurtado [4] presented a near-linear time algorithm for packing two convex polygons into a rectangle with the minimum area or perimeter. Sugihara et al. [13] considered a circle container enclosing a set of input disks in the plane, and gave a “shake-and-shrink” algorithm that shakes the disks and shrinks the enclosing circle step by step. In this paper, we consider the bundling problem for two convex d-polytopes under translations, where the translated polytopes are restricted to be in contact. Note that the case where the polytopes in the optimal placement should be separated can be handled by existing algorithms, such as Ahn et al. [2] (see Section 2 for further discussion). We give an O (n4 )-time algorithm for d = 3 to find a translation vector t ∗ that attains the minimum volume or surface area of the convex hull of P ∪ Q t ∗ , where n denotes the total number of vertices of both polytopes P and Q . Our algorithm constructs an arrangement in our translation space and evaluates the volume or surface area function on each cell of the arrangement. Our approach extends to any fixed dimension d > 3, yielding a first exact algorithm with running time O (n(d−1)

d+1  2

).

2. Preliminaries For any subset A ⊆ Rd , let bd( A ) be the boundary of A and conv( A ) the convex hull of A. We denote by | A | and  A  the surface area and the volume of A, respectively, when both are well defined for A. Let P and Q be convex d-polytopes in Rd and n denote the number of vertices of P and Q in total. Without loss of generality, we assume that P is stationary and only Q can be translated by vectors t ∈ Rd . We denote by Q t the translate of Q by t ∈ Rd , that is, Q t = {q + t | q ∈ Q }. Let vol(t ) :=  conv( P ∪ Q t ) and surf(t ) := | conv( P ∪ Q t )|. Once t is fixed and the description of conv( P ∪ Q t ) is identified, we can evaluate vol(t ) and surf(t ) in time linear in the complexity of conv( P ∪ Q t ). Ahn et al. [2] showed that the function vol(t ) is convex on the whole domain Rd . The convexity of the function surf(t ) was proven by Ahn and Cheong [3] for the 2-dimensional case only, but their argument can easily be extended to higher dimensions by using Cauchy’s surface area formula for a compact convex set (see Theorem 5.5.2 in [9]). For our problem where no overlap between the two polytopes is allowed, one might conjecture that there should be an optimal solution such that the two polytopes are in contact with each other. Much to our surprise, this is not always the case. Fig. 1 illustrates an example of two polytopes P and Q such that their translates must be separated at their optimal placement with respect to both the volume vol(t ) and the surface area surf(t ). The construction starts with a tetrahedron

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.3 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

3

T = conv({(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)}) in R3 with the (x, y , z)-coordinate system. Let P be the polytope obtained by intersecting T with the halfspace {x + y  0.1}, and let Q be the line segment between two points (0, 0, 0) and (0, 0, 1). Then, this original placement of P and Q minimizes the volume function vol(t ), that is, vol(t ) attains its minimum at t = (0, 0, 0). Observe that the corresponding convex container is T = conv( P ∪ Q ) as illustrated in Fig. 1(a). One can check that the volume vol(t ) increases if Q translates in any direction from its original position. The convexity of vol(t ) implies that this placement is indeed the unique minimum of vol(t ). Clearly, P and Q are separated in this optimal placement. Further, the minimum surface area of the convex hull of P and Q t occurs at t ≈ (0.041, 0.041, −0.035), as illustrated in Fig. 1(b). In this placement, P and Q t are separated as well. Note that this construction of P and Q can be extended to dimensions higher than 3. As discussed above, the objective functions vol(t ) and surf(t ) are convex in t ∈ Rd . Thus, if t ∗ is an optimal solution to our problem without overlap, then either P and Q t ∗ are separated or P and Q t ∗ are in contact. In the former case, which is also the case of the construction in Fig. 1, t ∗ minimizes vol(t ) or surf(t ) over the whole domain Rd , so any algorithm minimizing vol(t ) or surf(t ) when overlap is allowed can handle this case, see for example [2]. While it is not mentioned in [2], their algorithm also works for minimizing the surface area function surf(t ). In this paper, we therefore focus on the problem where the two polytopes P and Q t are required to be in contact with each other. That is, we want to minimize the volume or the surface area of the convex hull under the restriction that the two polytopes are in contact but do not properly overlap. Representing the configuration space Without loss of generality, we assume that Q contains the origin. Let r be a point of Q that corresponds to the origin. We call it the reference point of Q . Any translation of Q is then specified by a location of the reference point. Imagine that we slide Q along the boundary of P over all possible translations t such that P and Q t are in contact. Then, the trajectory of r forms the boundary of the Minkowski difference of P and Q , denoted by P ⊕ (− Q ), where ⊕ denotes the Minkowski sum and − Q denotes the point reflection of Q with respect to the origin. This fact is well known in motion planning [7]. Lemma 1. The set of translations t ∈ Rd such that P and Q t are in contact forms the boundary of P ⊕ (− Q ). In our problem, we restrict the two polytopes P and Q to be in contact, and thus the set of all such translations determines the space of all configurations. Lemma 1 suggests that the configuration space K should be defined as the boundary of P ⊕ (− Q ). Since P and Q are convex, computing the configuration space K = bd( P ⊕ (− Q )) for P and Q , and consequently specifying all the faces of K can be done efficiently by a lifting technique, called the Cayley trick. In this technique, one considers the weighted Minkowski sum (1 − λ) P 1 ⊕ λ P 2 of two convex d-polytopes P 1 and P 2 with 0  λ  1. The Cayley trick lifts P 1 and P 2 into a space of one dimension higher with a (d + 1)-st coordinate xd+1 as follows: P 1 is embedded in the hyperplane {xd+1 = 0} and P 2 in {xd+1 = 1}. To obtain the weighted Minkowski sum of P 1 and P 2 for any 0  λ  1, one computes the convex hull conv( P 1 ∪ P 2 ) in Rd+1 and slices it with the hyperplane {xd+1 = λ}. Observe that the Minkowski sum P 1 ⊕ P 2 is just a scaled copy of the slice at λ = 12 . We refer to Huber et al. [8] for more details regarding the Cayley trick. Note that the convex hull of P 1 and P 2 in Rd+1 coincides with the convex hull of the vertices of P 1 and P 2 . Since the d +1 complexity of P 1 ⊕ P 2 does not exceed that of the convex hull conv( P 1 ∪ P 2 ), we have the upper bound O ((n1 + n2 ) 2  ) on the complexity of the Minkowski sum P 1 ⊕ P 2 of two convex d-polytopes [12], where n1 and n2 denote the number of

vertices of P 1 and P 2 , respectively. Computing P 1 ⊕ P 2 can be done in O ((n1 + n2 ) log(n1 + n2 ) + (n1 + n2 ) for any fixed d  2. For our configuration space K, this yields:

d+1  2

) time [5]

Lemma 2. Let P and Q be convex d-polytopes with n vertices in total for any fixed d  2. The configuration space K = bd( P ⊕ (− Q )) for P and Q has O (n

d+1  2

) combinatorial complexity and can be computed in O (n log n + n

d +1  2

) time.

In the following sections, we introduce a decomposition of the configuration space K and describe our algorithm for dimension d = 3. This leads to a direct extension to higher dimension for d > 3. 3. Subdividing the configuration space In this section, we assume d = 3. For any translation t ∈ K, P and Q t are in contact. More precisely, a vertex, edge, or facet f of P touches a vertex, edge, or facet g + t of Q t for t ∈ K, while the interiors of P and Q t are disjoint. We call the pair ( f , g ) the contact pair at translation t ∈ K, denoted by C (t ), if f and g are maximal faces of P and Q , respectively, such that f and g + t intersect. Our approach is to subdivide the configuration space K into cells so that the contact pair and the convex hull structure of the polytopes do not change within each cell. We then obtain an expression for the volume or surface area function, vol(t ) or surf(t ), in each cell, and compute its minimum. By Lemmas 1 and 2, the configuration space K = bd( P ⊕ (− Q )) describes all possible translation vectors and can be constructed in O (n2 ) time for d = 3. In the following, we further investigate the structure of the configuration space K to understand the correspondence between each of its faces and a contact pair.

JID:COMGEO AID:1520 /FLA

4

[m3G; v1.232; Prn:26/02/2018; 15:24] P.4 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

Fig. 2. Contact pairs between P and Q , and the configuration space K. Each of vertex-facet pairs, ( f , u ) and ( v , g ), defines a facet, an edge–edge pair ( v v , uu ) defines a facet, a vertex-edge pair ( v v , u ) defines an edge, and a vertex-vertex pair ( v , u ) defines a vertex in the configuration space K.

Imagine that Q is translated around P in all possible ways, staying in contact with each other. This motion is piecewise linear: For any face a of P and face b of Q , let σa,b ⊂ K denote the set of translations t ∈ K such that C (t ) = (a, b). (1) When a is a facet and b is a vertex, σa,b forms a polygon, which is in fact a translate of a. See ( f , u ) in Fig. 2. When a is a vertex and b is a facet, then σa,b forms a polygon which is a translate of the point reflection of b. See ( v , g ) in Fig. 2. More importantly, observe that σa,b = a ⊕ (−b) forms a facet (or a 2-face) of K. (2) When both a and b are nonparallel edges, the subset σa,b forms a parallelogram a ⊕ (−b) that is a facet of K. See ( v v , uu ) in Fig. 2. (3) When a is a vertex and b is an edge, σa,b forms a line segment that is a translate of −b by translation vector a. When a is an edge and b is a vertex, σa,b forms a line segment that is a translate of a. See ( v v , u ) in Fig. 2. In this case, σa,b forms an edge of K. (4) When both a and b are vertices, σa,b is a point a − b, which is a vertex of K. See ( v , u ) in Fig. 2. (5) Two faces a and b can be parallel when they are edges or facets. If a and b are parallel edges, σa,b forms a line segment a ⊕ (−b), an edge of K. If a is an edge and b is a facet that are parallel, or vice versa, then σa,b = a ⊕ (−b) forms a facet of K. Finally, if both a and b are facets that are parallel, then σa,b = a ⊕ (−b) forms a facet of K. These observations are summarized as follows. Lemma 3. Each face (of any dimension) of the configuration space K is the set of all translations t with a common contact pair C (t ). Hull event planes and horizons In addition, we have to handle changes in the combinatorial structure of the convex hull conv( P ∪ Q t ) while t continuously varies over K. Those t ∈ K such that we have a change in the structure of conv( P ∪ Q t ) locally at t will be called hull events. At each hull event t, a vertex of P or of Q t is about to appear on or disappear from the boundary of conv( P ∪ Q t ), or an edge of P and another edge of Q t form a facet of conv( P ∪ Q t ). In either case, observe that a face (vertex, edge, or facet) of P and another of Q t are coplanar at such a moment t. In general, at each hull event t, we have a degenerate scene described as follows: There is an i-face f of P and a j-face f of Q with i , j ∈ {0, 1, 2} and i + j  2 satisfying the following condition: (*) f and f are not parallel edges, f and f + t lie in a common plane, and the interior of conv( P ∪ Q t ) lies on one side of this plane. The case of parallel edges should be avoided since this does not make any structural change in conv ( P ∪ Q t ) locally at t unless there is another pair of faces satisfying condition (*). We call a pair ( f , f ) of faces a hull event pair if and only if f and f satisfy condition (*) at some translation vector t ∈ R3 . For any hull event pair ( f , f ), define  f f to be the set of all translation vectors t ∈ R3 such that the pair ( f , f ) satisfies condition (*) at t. We observe that  f f forms a plane in the space R3 of translation vectors, since the plane that contains f and f + t for each t ∈  f f is uniquely determined and is common for every t ∈  f f . This also implies that it suffices to consider only maximal hull event pairs. A hull event pair ( f , f ) is called maximal if and only if there is no hull event pair ( g , g ) such that f is contained in g and f is contained in g . For any hull event pair ( g , g ), there is a maximal pair ( f , f ) such that  gg =  f f . Let F be the set of all maximal hull event pairs. For any ( f , f ) ∈ F , we define h f f :=  f f ∩ K. We call  f f the hull event plane and h f f the hull event horizon for each ( f , f ) ∈ F . Lemma 4. For any ( f , f ) ∈ F , the hull event horizon h f f forms a closed polygonal curve in K consisting of O (n2 ) line segments. Proof. By definition,  f f is a plane and h f f =  f f ∩ K. Thus, h f f is an intersection between a plane and K. As observed in Lemmas 1 and 2, K is a convex polytope of complexity O (n2 ). Hence the lemma follows. 2

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.5 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

5

Now, we consider the subdivision A of K induced by h f f for all pairs ( f , f ) ∈ F . Observe that for each cell σ of A, the structure of the convex hull conv( P ∪ Q t ) for all t ∈ σ does not change, as such a change would require that at least one hull event horizon be crossed. Since all hull event horizons are polygonal on K, A refines the faces of K. We thus regard A as another convex polytope with parallel facets and edges. Together with Lemma 3, we conclude the following. Lemma 5. Let σ be a face of A. Then both the contact pair C (t ) and the structure of the convex hull conv( P ∪ Q t ) stay constant over all t ∈ σ . We now bound the complexity of A with the help of the following observation. Lemma 6. For any two distinct pairs ( f , f ), ( g , g ) ∈ F , the two hull event horizons h f f and h gg cross at most twice. Proof. By definition, h f f ∩ h gg =  f f ∩  gg ∩ K. Also, we have  f f =  gg since both ( f , f ) and ( g , g ) are maximal and distinct. Thus, the intersection of two hull event horizons is the intersection of K and a line. Since K is a convex polytope, h f f ∩ h gg consists of at most two points. 2 We then characterize the set F of pairs of faces. Lemma 7. Let f be an i-face of P and f be a j-face of Q for some i , j ∈ {0, 1, 2}. Then, ( f , f ) ∈ F if and only if f ⊕ f forms a facet of the Minkowski sum P ⊕ Q of P and Q . Proof. Suppose that ( f , f ) ∈ F . By definition of F , the sum i + j of dimensions of f and f is at least two, and f and f are not parallel edges. So, f ⊕ f is either a 2-polytope or a 3-polytope in three dimensions. We exclude the possibility of 3-polytope since for some t ∈ R3 , f and f + t lie on a common plane, and thus f and f are parallel if i + j > 2. Thus, f ⊕ f is always a 2-polytope. In addition, we know that conv( P ∪ Q t ) lies on one side of the plane spanning f and f + t. This implies that conv( f ∪ ( f + t )) appears as a facet of conv( P ∪ Q t ), and thus that there is a unique, common normal vector for f in P and f in Q . Also, since ( f , f ) is maximal, there is no other pair ( g , g ) of faces of P and Q such that f ⊕ f ⊆ g ⊕ g . Thus, f ⊕ f forms a facet of P ⊕ Q . Conversely, any facet of P ⊕ Q is the Minkowski sum of an i-face f of P and a j-face f of Q for some i , j ∈ {0, 1, 2} with i + j  2 whose common normal vector v is unique. So, f and f are not parallel edges. Consider the plane  that is orthogonal to v such that  ∩ P = f . Let t ∈ R3 be any translation vector such that  is tangent to Q t and both P and Q t lie on the same side of . Since v is the unique common normal vector of f and f , we have  ∩ Q t = f . Also, the interior of the convex hull conv( P ∪ Q t ) lies on one side of . This implies that ( f , f ) is a hull event pair, so ( f , f ) ∈ F . Finally, consider any hull event pair ( g , g ) ∈ F with f ⊆ g and f ⊆ g . Then, as we have just shown, g ⊕ g forms a facet of P ⊕ Q . Since f ⊆ g and f ⊆ g , we have f ⊕ f ⊆ g ⊕ g , that is, f ⊕ f = g ⊕ g since both are facets of P ⊕ Q . This implies that g = f and g = f . Hence, ( f , f ) is maximal and ( f , f ) ∈ F . 2 Hence, the number of pairs in F is exactly the same as the number of facets of the Minkowski sum P ⊕ Q . Since P ⊕ Q has at most O (n2 ) facets, Lemmas 4 and 6 imply an immediate upper bound O (n4 ) on the complexity of A. Lemma 8. The polytope A consists of O (n4 ) faces (vertices, edges, and facets). This bound, O (n4 ), is shown to be tight in the worst case. Tight lower bound construction for A Fig. 3 illustrates an instance of two polytopes which produce (n2 ) hull event horizons on K, each consisting of (n2 ) line segments. The remainder of this paragraph provides a precise construction of these two polytopes P and Q . Fig. 3(a) illustrates Q viewed at approximately 7 times magnification. Notice that the right corner around w 1 is carved in a fan-like shape such that the polygonal curve w 1 w 2 w 3 w 4 w 5 u makes a sharp turn from w 1 to w 5 and forms a convex polygonal curve, as shown in details in Fig. 3(a). By the blade edges of Q , we mean those opposite to edge uu , depicted as thick segments in the figure. The polytope P is illustrated in Fig. 3(b), which can be described as the convex hull of a folding fan with a rotating center (pivot) at c and the zigzag edges (thick segments) along its tip. Then we observe that every blade edge of P constitutes an edge–edge contact pair with each zigzag edge of Q as the chain of blade edges is turning dull. Fig. 3(c) shows the configuration space K for P and Q , which has (n2 ) parallelogram facets corresponding to those edge–edge contact pairs. Note that all front facets of P incident to c have almost the same normal vector, and all back facets of P incident to c have almost the same normal vector as well. Let f be one of these front facets of P , say triangle cv 2 v 3 . Then, ( f , w 1 ) forms a maximal hull event pair, that is, ( f , w 1 ) ∈ F . Consider the motion of Q t (in the original scale) as t moves along the

JID:COMGEO AID:1520 /FLA

6

[m3G; v1.232; Prn:26/02/2018; 15:24] P.6 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

Fig. 3. A construction of two polytopes P and Q such that each hull event horizon crosses (n2 ) facets of K. (a) Polytope Q (at 7 times magnification). (b) Polytope P . (c) P ⊕ (− Q ) whose boundary is K. (d) The hull event horizon (blue) defined by facet cv 2 v 3 and vertex w 1 and the hull event horizon (red) defined by edge v 2 v 3 and edge w 1 w 2 are drawn on K. Each of them crosses (n2 ) facets of K. (For interpretation of the colors in the figure(s), the reader is referred to the web version of this article.)

corresponding hull event horizon h f w 1 . During this motion, the vertex w 1 + t of Q t lies on the supporting plane of f , and each zigzag edge of P sweeps over all the blade edges of Q t , resulting in (n2 ) crossings with parallelogram facets of K. See the blue curves in Fig. 3(d). Similarly, for any other front and back facet f , the motion of Q t along its corresponding hull event horizon results in (n2 ) crossings over the parallelogram facets of K. Next, we consider hull event horizons hee for a pair (e , e ) ∈ F of an edge e of P and another edge e of Q . In particular, we are interested in the edges along the chain v 1 v 2 v 3 v 4 v 5 of P and those along the chain w 1 w 2 w 3 w 4 w 5 of Q . By construction, it can be made that for any 1  i , j  4 v i v i +1 and w j w j +1 + t appear on the boundary of conv( P ∪ Q t ) and lie in a common plane for some t ∈ K. This implies that ( v i v i +1 , w j w j +1 ) ∈ F is a maximal hull event pair for any 1  i , j  4. Now pick any pair ( v i v i +1 , w j w j +1 ) of two of these edges and consider the hull event horizon hee defined by this pair, where e = v i v i +1 and e = w j w j +1 . During the motion of Q t as t moves along hee , each zigzag edge of P sweeps over all blade edges of Q , resulting in (n2 ) crossings with parallelogram facets of K. For instance, the red curve in Fig. 3(d) depicts the hull horizon of ( v 2 v 3 , w 1 w 2 ). Since P has (n) front facets and Q has (n) edges in the convex polygonal curve near w 1 , there can be (n2 ) hull event horizons each of complexity (n2 ). Therefore, the subdivision A of K has complexity (n4 ).

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.7 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

7

4. Algorithm In this section, we describe our algorithm for the case of dimension d = 3. We are given two convex 3-polytopes P and Q with n vertices in total. Before running our algorithm described below, we run the algorithm by Ahn et al. [2] in O (n3 log4 n) time to test if P and Q t ∗ do not touch each other at the optimal translation t ∗ ∈ R3 . If P ∩ Q t ∗ = ∅, then we output the result t ∗ of the above algorithm. Otherwise, we execute our algorithm. Our algorithm runs through three stages: (i) Compute the configuration space K. (ii) Compute the subdivision A of the faces of K. (iii) For each face σ of A, minimize the volume vol(t ) or surface area surf(t ) over t ∈ σ . This algorithm performs an optimization process over the whole configuration space K. Thus, the correctness of our algorithm follows directly. In the following, we describe each stage in more details. Stage (i) can be done by computing the Minkowski sum P ⊕ (− Q ), which takes O (n2 ) time as described in Lemma 2. Recall that K consists of O (n2 ) faces. In Stage (ii), we specify the set F and repeatedly insert every hull event horizon h f f for ( f , f ) ∈ F into K; that is, we cut those faces of K crossed by h f f and produce new faces. By Lemma 7, we compute F in O (n2 ) time by constructing P ⊕ Q and specifying its facets. We then iterate over all pairs ( f , f ) in F . Let Ai be the resulting subdivision after the i-th insertion of a hull event horizon, so K = A0 and A = Am , where m = O (n2 ) denotes the number of pairs in F . At the i-th insertion, let h f f be the horizon to be inserted. We then compute the corresponding hull event plane  f f and merge it with Ai −1 by tracing h f f and specifying those faces of Ai −1 crossed by h f f . This process can be done in time proportional to the number of faces of Ai −1 crossed by h f f , which is bounded by O (n2 + i ) according to Lemmas 4 and 6. Summing this bound over all i = 1, . . . , m results in O (mn2 + m2 ) = O (n4 ). Stage (iii) finds an optimal placement in each face σ of A. By Lemma 5, we know that restricting our objective function to each face σ of A guarantees no change in the contact pair C (t ) and the structure of the convex hull over all t ∈ σ . This means that every vertex of conv( P ∪ Q t ) can be represented by a linear function of t, and conv( P ∪ Q t ) can be triangulated into the same family of tetrahedra in the following way: (1) Triangulate each facet of conv( P ∪ Q t ) if it is not a triangle, and (2) triangulate the interior of conv( P ∪ Q t ) by choosing a point c in the interior of P and connecting c to all the vertices of conv( P ∪ Q t ) with edges. Let Tσ be the set of those triangles on bd(conv( P ∪ Q t )) obtained in step (1). Also, for each triangle  ∈ Tσ , let + be the tetrahedron with base  and apex c. Since P is assumed to be stationary, c is fixed and the vertices of each triangle +  ∈ Tσ are linear functions of t on σ . We hence write (t ) and  (t ) as+ functions of t ∈ σto denote the geometric triangle and tetrahedron for any fixed t ∈ σ . Observe that vol(t ) = ∈Tσ  (t ) and surf(t ) = ∈Tσ |(t )|. The volume of a tetrahedron is represented by a cubic polynomial in the coordinates of its vertices, and the area of a triangle by a quadratic polynomial. That is, in a face σ of A, the volume and surface area functions are represented by polynomials of degree three or two. Hence, they can be minimized in O (1) time after having its explicit formula in O (card(Tσ )) = O (n) time, where card(Tσ ) is the cardinality of Tσ . Hence, O (n) time is sufficient for each face of A to minimize vol(t ) or surf(t ). This implies an O (n5 )-time algorithm as A consists of O (n4 ) faces. Below, we will show that we can do this task in O (1) average time for each face σ of A by exploiting coherence between adjacent facets. Exploiting coherence Let σ and σ be two adjacent facets of A, sharing an edge e. Assume that we have just processed σ and we are about to process σ . We maintain Tσ and all formulas representing |(t )| and + (t ) for each  ∈ Tσ and their sums (which are surf(t ) and vol(t )). In order to efficiently process the next facet σ , we need to update these invariants. We have two cases here: the edge e is either a portion of an edge of K or a portion of a hull event horizon h f f for some ( f , f ) ∈ F . For the former case, we have Tσ = Tσ , but the coordinates of the vertices of conv( P ∪ Q t ) should be changed, since the contact pair C (t ) changes by Lemma 3. This causes changes in all formulas for |(t )| and + (t ) for  ∈ Tσ . Thus, in this case, we spend O (n) time because Tσ consists of O (n) triangles. For the latter case, where e is a portion of h f f for some ( f , f ) ∈ F , both σ and σ belong to a common facet of K. Thus, the contact pair C (t ) does not change over σ ∪ σ , while the triangulations Tσ and Tσ differ. Note that for  ∈ Tσ ∩ Tσ , the formulas for |(t )| and + (t ) remain the same over t ∈ σ ∪ σ . Thus, in this case, we are interested in those triangles , which are in the symmetric difference between Tσ and Tσ , denoted by Te . Each triangle in Te is either (1) a triangle in a triangulation of f or f , or (2) a triangle formed either by an edge of f and a vertex of f , or vice versa. The number of triangles in Te of the former type is bounded by O ( N ( f ) + N ( f )), where N ( f ) denotes the complexity of face f . On the other hand, the number of those of the latter type is bounded by O ( N ( f ) N ( f )). Thus, we have card(Te ) = O ( N ( f ) N ( f )). Note that in the same time bound O ( N ( f ) N ( f )), we also can specify the triangles in Te . After specifying Te , the invariants of our algorithm are maintained by updating the formulas for the volume or surface area. We then bound the cost of crossing an edge e of A that is a portion of some hull event horizon.

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.8 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

8

Lemma 9. The total number of triangles in Te over all edges e of A that are portions of some hull event horizon is bounded by O (n4 ). Proof. For any ( f , f ) ∈ F , let E f f be the set of edges of A that are portions of h f f . By Lemma 4, we have | E f f | = O (n2 ). Let e ∈ E f f . We know that card(Te ) = O ( N ( f ) N ( f )) as discussed above. First,  consider all pairs ( f2, f ) ∈ F such that both f and f are edges. In this case, we have N ( f )4 = N ( f ) = O (1). Thus, e ∈ E card(Te ) = O (n ). Hence, summing up the above over all those pairs ( f , f ) results in O (n ) triangles, since ff

|F | = O (n2 ) by Lemma 7. Next, consider those ( f , f ) ∈ F such that either f or f is a facet of P or of Q . Recall that each pair ( f , f ) ∈ F corresponds to a facet of P ⊕ Q by Lemma 7. Note that for each facet f of P , there is a unique face (of any dimension) f of Q such that f ⊕ f forms a facet of P ⊕ Q , and vice versa. This implies that for any facet f of P or Q , there is a unique maximal hull event pair in F that involves f . Hence, summing up N ( f ) N ( f ) over all such pairs ( f , f ) results in

 f:

=

facet of P f :



f : facet of P

 ( f , f )∈F



O (nN ( f )) +





N ( f )N ( f ) +

f : facet of Q f

:

N ( f )N ( f )

( f , f )∈F



O (nN ( f ))

f : facet of Q

= O (n2 ), since the total complexity of P and Q is bounded by O (n). Again, since



e∈ E f f

card(Te ) = O (n2 N ( f ) N ( f )), the total

number of triangles in Te for all edges e that are portions of h f f such that either f or f is 2-face is bounded by O (n4 ). Thus, the lemma follows. 2 We are now ready to describe stage (iii) of our algorithm. We traverse all facets of A from an arbitrary initial facet σ0 . For the first time, we compute conv( P ∪ Q t ) for some t ∈ σ0 and all the invariants from scratch in O (n2 ) time. We then minimize our objective function vol(t ) or surf(t ) over t ∈ σ0 . As we move on to the next facet σ from the current facet σ , we update our invariants as described above, according to the type of the edge e between σ and σ , and minimize the objective function. We repeat this procedure until we traverse all the facets of A. By a standard traversal, such as the depth first search, we do not cross the same edge more than twice. This implies that the total cost of crossing edges that come from hull event horizons is not more than O (n4 ) by Lemma 9. Moreover, if we take a little smarter traverse order, then we can bound the number of crossed edges that are portions of edges of K, by O (n2 ). Since each edge crossing of this type costs O (n) time, we finally bound the total cost of updates by O (n4 ) time. We finally conclude the following theorem. Theorem 1. Given two convex 3-polytopes P and Q with n vertices in total, a convex container of minimum volume or minimum surface area that bundles P and Q under translations without overlap can be computed in O (n4 ) time. 5. Extension to higher dimensions Our approach for dimension d = 3 immediately extends to any fixed dimension higher than three. In this section, we let d  2 be any fixed number, and P and Q be two convex d-polytopes with n vertices in total. It is easy to check that Lemma 3 holds for any d > 3. Hull event hyperplanes As for d = 3, a change in the structure of conv( P ∪ Q t ) occurs at t ∈ K when a degenerate situation happens described as follows: There is an i-face f of P and a j-face f of Q with i , j ∈ {0, 1, . . . , d − 1} and i + j  d − 1 such that (**) f ⊕ f is of dimension d − 1, f and f + t lie in a common hyperplane, and the interior of conv( P ∪ Q t ) lies on one side of the hyperplane. This extends the condition (*) for d = 3 to higher dimensions. The definitions of hull event pairs and maximal hull event pairs are also analogous to the case d = 3. Let F be the set of all maximal hull event pairs. Then, the characterization of F stated in Lemma 7 for d = 3 also holds for any d > 3. For each ( f , f ) ∈ F , analogously define the hull event hyperplane  f f and the hull event horizon h f f . The subdivision A of K induced by all the hull event horizons possesses the property of Lemma 5. One important task is to bound the complexity of the subdivision A. Lemma 10. For any fixed d  2, the complexity of the subdivision A is O (n(d−1)

d+1  2

).

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.9 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

9

Proof. The configuration space K for dimension d is the boundary of P ⊕ (− Q ) by Lemma 1. It consists of O (n 1  d+ 2 

d+1 2 

) faces.

By Lemma 7, we also have O (n ) many hull event horizons. In order to bound the complexity of the subdivision A, we count the new faces created by the hull event horizons on K. Each of these new faces is an intersection between a face of K and one or more hull event horizons. For 1  k  d − 1, let F k be the number of those new faces that are intersections of a face of K and k hull event horizons. Then, we claim that



Fk =

O (n(k+1)

d +1  2

O (n(d−1)

d +1  2

), 1  k  d − 2 ), k = d − 1

.

Recall that a hull event horizon is the intersection of a hull event hyperplane and K. That is, F k counts the new faces of A that are intersections of a face of K and k hyperplanes. If k = d − 1, then the intersection of k = d − 1 hyperplanes is a 1-flat, which is a line. Since the intersection of a line and the boundary of a convex d-polytope consists of at most two points, we have

 F d −1 =

O (n

d +1 2 

 )

d−1

= O (n(d−1)

d +1  2

).

For k < d − 1, the intersection of k hyperplanes is a (d − k)-flat, and it crosses at most O (n that, for any 1  k  d − 2,

 Fk =

O (n

d +1  2

 )

k

= O (n(k+1)

d +1  2

· O (n

d +1 2 

d+1 2 

) faces of K. This implies

)

),

as claimed.  (d−1) d+2 1  The complexity of A is not more than ). 1kd−1 F k , which is bounded by O (n

2

Note that the bound for d = 2 or 3 in Lemma 10 matches the previously known upper bounds: Lee and Woo [10] for d = 2 and the previous sections of this paper for d = 3. Algorithm We then show how to extend our algorithm to higher dimension d  4. In order to find out if P ∪ Q t ∗ = ∅ at the 3

optimal translation vector t ∗ ∈ Rd , we run the algorithm of Ahn et al. [2]. This takes O (nd+1− d logd n) time. If P and Q t ∗ must touch, then we run our algorithm in three stages described as follows. d+1

d+1

Stage (i) can be done in O (n 2  ) time, resulting in the configuration space K of complexity O (n 2  ) by Lemmas 1 and 2. d+1 For stage (ii), we compute the Minkowski sum P ⊕ Q in time O (n 2  ) to specify all hull event hyper-planes. As for d = 3, we compute the subdivision A of K by adding the hull event horizons one by one. This can be done in time d+1

O (n(d−1) 2  ) by Lemma 10. Stage (iii) performs optimization over each facet σ of A based on the triangulation Tσ . For convenience, we assume that every face (of any dimension) of P and Q is already triangulated. In this case, the triangulation Tσ subdivides the boundary of conv( P ∪ Q t ) into (d − 1)-simplices  (i.e., simplices of dimension d − 1). For each  ∈ Tσ , we augment one more interior point c ∈ P to obtain + as the d-simplex and thus to triangulate the interior of conv( P ∪ Q t ). Note that d

the number of (d − 1)-simplices in Tσ is at most O (n 2  ). The d-dimensional volume of a d-simplex is represented by a polynomial of degree d in the coordinates of its vertices, and so is the volume function vol(t ). The surface area function surf(t ) is represented by a polynomial of degree d − 1 since it is the sum of (d − 1)-dimensional volumes of all  ∈ Tσ . In stage (iii), we exploit the coherence among the facets of A, as for d = 3. Let σ and σ be two adjacent facets ((d − 1)-faces) of A, sharing a (d − 2)-face e incident both to σ and σ . Assume that we have just processed σ and are about to process σ . For the purpose, we maintain our invariants: Tσ and all formulas representing |(t )| and + (t ) for  ∈ Tσ , and their sums surf(t ) and vol(t ). We have two cases: the (d − 2)-face is either a portion of a (d − 2)-face of K or a portion of a hull event horizon. In the former case, we have Tσ = Tσ while the formulas for |(t )| and + (t ) for  ∈ Tσ should be updated. Since d

d

card(Tσ ) = O (n 2  ), we spend O (n 2  ) time in this case. In the latter case, where e is a portion of h f f for some ( f , f ) ∈ F , both σ and σ belong to a common facet of K. Thus, the contact pair C (t ) does not change over σ ∪ σ , while Tσ and Tσ differ. As done for d = 3, we let Te be the symmetric difference between Tσ and Tσ . Each (d − 1)-simplex in Te is either one in the triangulation of f or f , or one formed by choosing a k-simplex in the triangulation of f and a (d − 1 − k)-simplex in the triangulation of f for some 0  k  d − 2. The number of possible (d − 1)-simplices of the former case is not more than the total number of simplices of all dimensions in the triangulation of f and f , which is bounded by O ( N ( f ) + N ( f )), where N ( f ) denotes the total

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.10 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

10

number of faces g with g ⊆ f . On the other hand, the number of possible (d − 1)-simplices of the latter case is bounded by O ( N ( f ) N ( f )). We then bound the cost of crossing (d − 2)-face e of A that is a portion of some hull event horizon. Lemma 11. The total number of (d − 1)-simplices in Te over all (d − 2)-faces e of A that are portions of some hull event horizon is bounded by O (n2(d−1) ). Proof. Let ( f , f ) ∈ F , and let E f f be the set of all (d − 2)-faces of A that are portions of h f f . Also, let i and j be the dimensions of f and f , respectively. As discussed above, it holds that card(Te ) = O ( N ( f ) N ( f )). We distinguish two cases: (i) when both i and j are strictly less than d − 1, and (ii) when either f or f is a facet ((d − 1)-face). In the former case, observe that f is an i-polytope and f is a j-polytope. Thus, we have N ( f ) = O (ni /2 ) and N ( f ) = O (n j /2 ) since the number of vertices in f and f is not more than n. So, it holds that j

i

N ( f ) N ( f ) = O (n 2 + 2  ) = O (n2 as i , j < d − 1. Since h f f crosses O (n



card(Te ) = O (n

1  d+ 2 

2  d+2 1 +2 d− 2 

d −2 2 

),

) facets of K, we have

).

e∈ E f f

Summing this over all ( f , f ) ∈ F such that none of f and f is of dimension d − 1, we have



O

n



1 d −2 2  d+ 2 + 2 



= O (n2(d−1) ),

d+1

since |F | = O (n 2  ). Now consider the latter case, where either f or f is a (d − 1)-face. Without loss of generality, we assume that f is a facet of P . Note that there is a unique face f of Q such that ( f , f ) ∈ F since f ⊕ f forms a facet of P ⊕ Q . Also, we have N ( f ) = O (n(d−1)/2 ) as f is a j-polytope with j  d − 1. Thus, we have





card(Te )

( f , f )∈F , f : facet of P e∈ E f f



=

( f , f )∈F , f



=

O (n

d +1 2 

N ( f ) N ( f ))

: facet of P

O (n

d +1  2

n

d −1  2

N ( f ))

f : facet of P



= O ⎝n



1 1  d+ + d−  2 2

⎞ N ( f )⎠

f : facet of P

= O (n Since

1 1  d+ + d2 + d−  2 2

).

 d+2 1  +  d2  +  d−2 1 

 2(d − 1) for d  2, the claimed bound is shown. 2

In stage (iii), we traverse all facets of A from an initial facet d

σ0 . At σ0 , we compute conv( P ∪ Q t ) for some t ∈ σ0 and

all the invariants from scratch in O (n 2  ) time. Then, we minimize surf(t ) or vol(t ) over t ∈ σ0 . Note that this optimization takes time proportional to the complexity of σ0 . As we move on to the next facet σ from the current facet σ , we update the invariants as described above. If the (d − 2)-face e between σ and σ is a portion of a (d − 2)-face of K, then it takes d

O (n 2  ) time; while if e is a portion of a hull event horizon h f f , then it takes O ( N ( f ) N ( f )) time. By taking a traversal

of a standard order, one can bound the number of crossings of the first type by O (n in K. Thus, the total cost of updating invariants during the traversal is at most

O (n

d +1 2 

d +1  2

) since there are O (n

d +1  2

) facets

d

) · O (n 2  ) + O (n2(d−1) ) = O (n2(d−1) )

by Lemma 11 for d  3. The total running time of stage (iii) is bounded by the cost of updating the invariants plus the d+1 complexity of A, which is O (n(d−1) 2  ). We finally conclude the following.

Theorem 2. For any fixed d  3 and two convex d-polytopes P and Q with n vertices in total, a minimum convex container bundling P and Q under translations without overlap can be computed in O (n(d−1)

d +1  2

) time with respect to volume or surface area.

JID:COMGEO AID:1520 /FLA

[m3G; v1.232; Prn:26/02/2018; 15:24] P.11 (1-11)

H.-K. Ahn et al. / Computational Geometry ••• (••••) •••–•••

11

References [1] H.-K. Ahn, H. Alt, S.W. Bae, D. Park, Bundling three convex polygons to minimize area or perimeter, in: Proc. 13th Algorithms and Data Structures Symposium, WADS 2013, 2013, pp. 13–24. [2] H.-K. Ahn, P. Brass, C.-S. Shin, Maximum overlap and minimum convex hull of two convex polyhedra under translations, Comput. Geom. 40 (2008) 171–177. [3] H.-K. Ahn, O. Cheong, Aligning two convex figures to minimize area or perimeter, Algorithmica 62 (2012) 464–479. [4] H. Alt, F. Hurtado, Packing convex polygons into rectangular boxes, in: Proc. 3rd Japanese Conference on Discrete and Computational Geometry, JCDCG 2000, in: LNCS, vol. 2098, 2001, pp. 67–80. [5] B. Chazelle, An optimal convex hull algorithm in any fixed dimension, Discrete Comput. Geom. 10 (1993) 377–409. [6] K. Daniels, V. Milenkovic, Multiple translational containment, Part I: An approximation algorithm, Algorithmica 19 (1997) 148–182. [7] M. de Berg, O. Cheong, M. van Kreveld, M. Overmars, Computational Geometry: Algorithms and Applications, 3rd edition, Springer-Verlag, 2008. [8] B. Huber, J. Rambau, F. Santos, The Cayley trick, lifting subdivisions and the Bohne–Dress theorem on zonotopal tilings, J. Eur. Math. Soc. 2 (2000) 179–198. [9] D.A. Klain, G.-C. Rota, Introduction to Geometric Probability, Cambridge University Press, 1997. [10] H. Lee, T. Woo, Determining in linear time the minimum area convex hull of two polygons, IIE Trans. 20 (1988) 338–345. [11] V. Milenkovic, Translational polygon containment and minimum enclosure using linear programming based restriction, in: Proc. 28th Annual ACM Symposium on Theory of Computation, STOC’96, 1996, pp. 109–118. [12] R. Seidel, The upper bound theorem for polytopes: an easy proof of its asymptotic version, Comput. Geom. 5 (1995) 115–116. [13] K. Sugihara, M. Sawai, H. Sano, D.-S. Kim, D. Kim, Disk packing for the estimation of the size of a wire bundle, Jpn. J. Ind. Appl. Math. 21 (2004) 259–278.