Next Article in Journal
Achieving the Best Symmetry by Finding the Optimal Clustering Filters for Specific Lighting Conditions
Previous Article in Journal
Research on Pricing and Dynamic Replenishment Planning Strategies for Perishable Vegetables Based on the RF-GWO Model
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Stacking Monotone Polytopes

1
Graduate School of Artificial Intelligence, Department of Computer Science and Engineering, Pohang University of Science and Technology, Pohang 37673, Republic of Korea
2
Department of Computer Science and Engineering, Pohang University of Science and Technology, Pohang 37673, Republic of Korea
3
Department of Service Design Engineering, Sungshin Women’s University, Seoul 02844, Republic of Korea
*
Author to whom correspondence should be addressed.
Symmetry 2024, 16(9), 1246; https://doi.org/10.3390/sym16091246
Submission received: 21 August 2024 / Revised: 16 September 2024 / Accepted: 20 September 2024 / Published: 23 September 2024
(This article belongs to the Section Computer)

Abstract

:
This paper addresses the problem of computing the optimal stacking of two monotone polytopes P and Q in R d . A monotone polytope in R d is defined as a polytope whose intersection with any line parallel to the last coordinate axis x d is connected, and the stacking of P and Q is defined as a translation of Q, such that “Q touches P from above”. To evaluate the stack, we use three different scoring criteria: (1) the height of the stack, (2) the maximum pointwise distance along the x d -axis, and (3) the volume between P and Q. We propose exact algorithms to compute the optimal stacking for each scoring criterion.

1. Introduction

The stacking problem is a class of geometric optimization problems that aims to find the optimal way to stack geometric objects, represented as polytopes in d-dimensional space R d . The study of the stacking problem began in earnest with Johannes Kepler’s conjecture in 1611 about the densest way to stack congruent spheres [1], and the simple yet fundamental problem of stacking identical rectangular blocks has also been actively researched up to the present [2,3]. Solutions to stacking problems are theoretically meaningful, and have applications in industrial fields, including logistics, making it a topic of active research these days [4,5,6].
In this paper, we present algorithms for the optimal stacking of two monotone polytopes, P and Q, in R d , where a monotone polytope in R d is defined as a polytope whose intersection with any line parallel to the last coordinate axis x d is connected. The optimal stacking can be defined in various ways, and we use three different scoring criteria: (1) the height of the stack, (2) the maximum pointwise distance along the x d -axis, and (3) the volume between P and Q.
For d = 2 and 3, the optimal stacking under the first scoring criterion minimizes the height of the container enclosing the stacking, making it applicable in the field of logistics, where optimal packing is necessary. Under the second and third scoring criteria, the optimal stacking minimizes the “gap” between P and Q, which can be utilized for optimal occlusion in dentistry [7]. Additionally, we expect that the optimal stacking for d > 3 dimensions can be utilized to measure the similarity of data, defined by piecewise linear functions in high-dimensional spaces.
The rest of the paper is organized as follows. Section 2 introduces the formal definition of the stacking problem and three scoring criteria. Section 3, Section 4 and Section 5 introduce methods for computing the translation vector that minimizes each of the scoring criteria: (1) the height of the stack, (2) the maximum pointwise distance along the x d -axis, and (3) the volume, respectively. In each of these sections, we first solve the problem for the two-dimensional case to enhance understanding of our algorithm and then extend it to higher dimensions d 3 . Finally, Section 6 discusses potential applications of the proposed algorithm and outlines possible directions for future research.

2. Preliminaries

Let x 1 , x 2 , , x d be the coordinate axes in d-dimensional space R d , where d is a constant. We say that a line , a vector τ , or a hyperplane H in R d is vertical if , τ , or H is parallel to the x d -axis. A polytope P in R d is called x d -monotone if the intersection of P with any vertical line is connected. We define the domain of P as the projection of P onto the plane x d = 0 along the x d -axis, and denote it by D P .
We consider the stacking problem for two given x d -monotone polytopes P and Q in R d . We assume that both D P and D Q are convex domains without holes in R d 1 . For a vector τ R d , let Q + τ : = { q + τ | q Q } be the translation of Q by τ . We say that Q + τ is placed on top of P if the following conditions are hold:
  • C1. The domain D Q + τ of Q + τ is contained in D P .
  • C2. For a vertical line , any point q ( Q + τ ) has the same or larger x d -coordinate than that of any point p P .
  • C3. P and Q + τ have a non-empty intersection.
Figure 1 includes examples of situations where Q + τ is placed on top of P or not. When Q + τ and P satisfy C2, we say that Q + τ lies above P, or Plies below Q + τ . When Q + τ lies above P, the length of the shortest vertical vector τ , such that Q + τ + τ P , is called the vertical distance between Q + τ and P.
The translation space  T is defined as a set of all vectors t R d 1 , such that D Q + t D P , where D Q + t : = { x + t | x D Q } is the translation of D Q by t. For a vector t = ( t 1 , t 2 , , t d 1 ) T and a real number r, we could construct a d-dimensional vector ( t , r ) : = ( t 1 , t 2 , , t d 1 , r ) by concatenating r to t. From the definition of T , Q + ( t , r ) and P satisfy C1. If r t is the largest value of r, such that P Q + ( t , r ) , then Q + ( t , r t ) and P satisfy the conditions C 2 and C 3 , so Q + ( t , r t ) is placed on top of P. Let h : T R be the function that maps t to r t , and h [ T ] : = { ( t , h ( t ) ) | t T } be the graph of h. We denote ( t , h ( t ) ) h [ T ] by h [ t ] .
For a point p D P , let u p be the point with the largest x d -coordinate in P p , where p is the vertical line passing through p. Then, the set P c : = { u p | p D P } is the upper boundary of P. Similarly, for a point q D Q , let q be the point with the smallest x d -coordinate in Q q . Then, the set Q c : = { q | q D Q } is the lower boundary of Q. Observe that when Q + τ is placed on top of P, P ( Q + τ ) is the same as P c ( Q c + τ ) . We assume that P c and Q c are triangulated, and have n and m vertices, respectively.
We define a piecewise linear function f P : D P R that maps p D P to the x d -coordinate of p P c . Similarly, we define a piecewise linear function f Q : D Q R for Q c . Also, even when Q is translated by h [ t ] R d for t T , we define a function f Q + h [ t ] : D Q + h [ t ] R for Q c + h [ t ] accordingly. We assume that D P and D Q are also triangulated by the projection of P c and Q c , respectively.
In this paper, we use three scoring criteria to determine the optimal placement of Q. For t T , the first scoring criteria d 1 ( t ) measures the maximum x d -coordinate of Q c + h [ t ] as follows:
d 1 ( t ) : = max x D Q + h [ t ] ( f Q + h [ t ] ( x ) )
With the vector t * T minimizing d 1 , we could minimize the height of the stack. The second scoring criterion d 2 ( t ) measures the maximum pointwise vertical distance between Q c + h [ t ] and P c as follows:
d 2 ( t ) : = max x D Q + h [ t ] ( f Q + h [ t ] ( x ) f P ( x ) )
The third scoring criterion d 3 ( t ) measures the volume between Q c + h [ t ] and P c as follows:
d 3 ( t ) : = x D Q + h [ t ] ( f Q + h [ t ] ( x ) f P ( x ) ) d x
With the vector t * T that minimizes d 2 or d 3 , we could minimize the gap between P c and Q c + h [ t ] in terms of pointwise vertical distance or volume.
Note that we use big-O notation when analyzing the time and space complexities of algorithms.

3. Minimizing Scoring Criterion (1)

In this section, we demonstrate how to find the translation vector that minimizes the scoring criterion d 1 .

3.1. The Case When d = 2

In R 2 , P and Q are y-monotone polygons, and P c and Q c are y-monotone piecewise linear curves. Let p 1 , p 2 , , p n and q 1 , q 2 , , q m be the vertices of P c and Q c , which are labeled sequentially from left to right, and p ¯ i and q ¯ j be the projection of p i and q j onto the x-axis for 1 i n and 1 j m , respectively. Then, D P = [ p ¯ 1 , p ¯ n ] and D Q = [ q ¯ 1 , q ¯ m ] are intervals, and T = [ p ¯ 1 q ¯ 1 , p ¯ n q ¯ m ] is also an interval.
For a vector t T , d 1 ( t ) measures the maximum y-coordinate of Q c + h [ t ] . Therefore, the optimal vector t * T which minimizes d 1 also minimizes the function h; hence, h [ t * ] is the lowest point in the graph h [ T ] .
Observe that when Q + h [ t ] is placed on top of P, either a vertex of Q c + h [ t ] is contained in an edge of P c , or a vertex of P c is contained in an edge of Q c + h [ t ] . For two sets S 1 and S 2 in R k , the set of all vectors τ R k such that S 1 S 2 + τ can be computed from the Minkowski difference as follows:
S 1 S 2 : = { s 1 s 2 | s 1 S 1 , s 2 S 2 }
Hence, the set of vectors τ such that q j + τ p i p i + 1 is p i p i + 1 q j , and the set of vectors τ such that p i q j q j + 1 + τ is p i q j q j + 1 . Let C be the union of p i p i + 1 q j and p i q j q j + 1 for all possible combinations. The following lemma describes the relation between the set C and the graph h [ T ] .
Lemma 1.
The upper envelope of C on T is h [ T ] .
Proof. 
It is obvious that h [ T ] is a subset of C.
For a vector t T , let t be the vertical line passing through t. From the construction of C, a point ( t , h ) in C t corresponds to a vertex–edge pair ( p i , q j q j + 1 ) or ( q j , p i p i + 1 ) such that p i q j q j + 1 + ( t , h ) or q j + ( t , h ) p i p i + 1 . So, if Q is translated by ( t , h ) for a real h > h , p i lies below q j q j + 1 + ( t , h ) , or q j + ( t , h ) lies above p i p i + 1 .
Let ( t , h t ) be the point with the maximum y-coordinate in C t . When Q is translated by ( t , h t ) , every vertex of Q c + ( t , h t ) lies on or above P c , and every vertex of P c lies on or below Q c + ( t , h t ) . This implies that Q + ( t , h t ) is placed on top of P. The upper envelope U C of C on T is defined as the set of points ( t , h t ) in C t for t T . So, the lemma follows. □
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 1.
Let P and Q be two y-monotone polygons in R 2 , such that P c and Q c have n and m vertices, respectively. The optimal placement of Q on top of P, which minimizes the height of the stack along the y-axis, can be computed in O ( m n ( log m + log n ) ) time using O ( m n α ( m n ) ) space.
Proof. 
Observe that C is a set of O ( m n ) line segments. By Lemma 1, the graph h [ T ] is the upper envelope of O ( m n ) line segments on T = [ p ¯ 1 q ¯ 1 , p ¯ n q ¯ m ] , so we could compute h [ T ] in O ( m n ( log m + log n ) ) time using O ( m n α ( m n ) ) space, where α ( · ) is the inverse of Ackermann’s function [8]. Since h [ T ] is a piecewise linear curve of size O ( m n α ( m n ) ) , finding the lowest point in h [ T ] can be performed in O ( m n α ( m n ) ) time. □

3.2. The Case When d 3

Similar to the case when d = 2 , we find the vector h [ t * ] with the minimum x d -coordinate in h [ T ] .
When Q + h [ t ] is placed on top of P for t T , there exists a pair ( p i , q d i 1 ) such that p i q d i 1 + h [ t ] , where p i is an i-dimensional face, simply i-face, of P c and q d i 1 is a ( d i 1 ) -face of Q c , for 0 i d 1 . Figure 2 shows examples of such pairs when d = 3 .
For a pair ( p i , q d i 1 ) stated above, the set of vectors τ R d such that p i q d i 1 + τ is p i q d i 1 . Let C be the union of p i q d i 1 for all possible pairs of ( p i , q d i 1 ) . From the upper bound theorem [9], the number of such pairs is O ( ( m n ) d / 2 ) . From the assumption that P c and Q c are triangulated, p i q d i 1 is a convex subset of a hyperplane in R d . Also, since d is a constant, p i q d i 1 can be triangulated into O ( 1 ) many ( d 1 ) -simplices (a convex hull of d linearly independent points). Overall, the set C is union of O ( ( m n ) d / 2 ) many ( d 1 ) -simplices.
The upper envelope U C of C on T is also h [ T ] , based on the same argument of Lemma 1. The point with the smallest x d -coordinate in h [ T ] can be found from one of the following two cases: a vertex of U C whose projection onto x d = 0 lies in T ; and the intersection between an edge (1-face) of U C and a vertical hyperplane containing a facet ( ( d 2 ) -face) of the boundary of T , where the projection of this intersection onto x d = 0 lies in T .
First, we show how to determine whether a point t R d 1 lies in T . From the convexity of D P and D Q , if every vertex v D Q satisfies v + t D P for t R d 1 , then t T . For a vertex v D Q , the set of vectors t is such that v + t D P is a translated copy of D P . Hence, T is the common intersection of m translated copies of D P .
When d = 3 , T becomes a convex polygon with O ( n ) edges, and can be computed in O ( m n ) time. By constructing a point location structure for T with O ( n log n ) time and O ( n ) space [10], we can determine whether t T in O ( log n ) time.
When d > 3 , we use the hierarchical representations suggested by Dobkin and Kirkpatrick [11,12]. The hierarchical representation of a convex polytope C of n vertices in R d allows the determination of whether a point is contained in C in O ( log n ) time, with O ( n ) preprocessing time and space. By constructing the hierarchical representation of D P , we can determine whether t R d 1 belongs to T in O ( m log n ) time by checking whether v + t is contained in D P for each vertex v of D Q .
Next, we show how to find the intersection between an edge e of U C and a vertical hyperplane H containing a boundary facet of T , where the projection of e H onto x d = 0 lies in T . Let v and v be the endpoints of the projection of e. To satisfy the above conditions, v must be inside T , and v must be outside T . Also, the projection of e H is last point where the ray from v to v intersects T .
When d = 3 , from the point location structure for T , we can determine whether v T and v T , and compute the intersection in O ( log n ) time.
When d > 3 , from the hierarchical representation of D P , we determine whether v T and v T in O ( m log n ) time. Using the hierarchical representation again, we can determine the facet of D P that a ray from q + v to q + v intersects last, where q is a vertex of D Q , such that q + v D P and q + v D P in O ( log n ) time. Hence, we can compute the boundary facet of T where the projection of e intersects in O ( m log n ) time.
Lastly, we show how to compute the vertices and the edges of U C . When d = 3 , the upper envelope of N triangles in R 3 can be computed in O ( N 2 α ( N ) ) time, and the size of the upper envelope is also O ( N 2 α ( N ) ) [13]. When d > 3 , the number of vertices and the edge in the upper envelope of N simplices is O ( N d 1 + ϵ ) for any ϵ > 0 , and they can be computed in O ( N d 1 + ϵ ) expected time [14].
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 2.
Let P and Q be two x d -monotone polytopes in R d for d 3 , such that P c and Q c have n and m vertices, respectively. The optimal placement of Q on top of P which minimizes the height of the stack can be computed in O ( m 2 n 2 α ( m n ) log n ) ) time using O ( m 2 n 2 α ( m n ) ) space for d = 3 , and in O ( ( m n ) d / 2 ( d 1 + ϵ ) m log n ) expected time and O ( ( m n ) d / 2 ( d 1 + ϵ ) ) space for d > 3 .
Proof. 
First, we consider the case when d = 3 . The union C consists of O ( m n ) triangles, so U C can be computed in O ( m 2 n 2 α ( m n ) ) time using O ( m 2 n 2 α ( m n ) ) space. We find the vertices and edges of h [ T ] by checking whether each vertex or edge of U C lies above T . The number of vertices and edges of U C is O ( m 2 n 2 α ( m n ) ) , and this checking can be performed in O ( log n ) time after an O ( n log n ) -time preprocessing step using O ( n ) space. Therefore, we can find the optimal translation vector in O ( m 2 n 2 α ( m n ) log n ) time using O ( m 2 n 2 α ( m n ) ) space.
When d > 3 , the union C consists of O ( ( m n ) d / 2 ) many ( d 1 ) -simplices, and we compute the vertices and edges of U C in O ( ( m n ) d / 2 ( d 1 + ϵ ) ) expected time and space. The number of vertices and edges of U C is O ( ( m n ) d / 2 ( d 1 + ϵ ) ) , and we can check whether each vertex or edge of U C lies above T in O ( m log n ) time after an O ( n ) -time preprocessing step using O ( n ) space. Therefore, we can find the optimal translation vector in O ( ( m n ) d / 2 ( d 1 + ϵ ) m log n ) expected time and O ( ( m n ) d / 2 ( d 1 + ϵ ) ) space. □

4. Minimizing Scoring Criterion (2)

In this section, we demonstrate how to find the translation vector that minimizes the scoring criterion d 2 .

4.1. The Case When d = 2

When Q + h [ t ] is placed on top of P for t T , d 2 ( t ) measures the maximum pointwise vertical distance between Q c + h [ t ] and P c , which is realized by a vertex–edge pair ( v , e ) , where v P c and e Q c , or vice versa. See Figure 3 as an example.
Let C ( t ) denote the set of vertex–edge pairs that need to be considered to compute d 2 ( t ) . We will refer to C ( t ) as the combinatorial structure of t. Since each vertex of P c and Q c can be part of at most two pairs, the size of C ( t ) is O ( m + n ) .
We subdivide T into S T based on whether the combinatorial structure C ( t ) are the same. For a vertex v of Q c , the set of vectors τ such that v + τ P c is P c v . If we subdivide T using the projection of P c v , we have C ( t ) C ( t ) for any two vectors t and t chosen from two different intervals. Since the projection of P c v is a translated copy of D P , T is divided into O ( n ) intervals. By applying the same argument to every vertex of P c and Q c , S T consists of O ( m n ) intervals, and can be computed in O ( m n ( log m + log n ) ) time.
For each interval s of S T , we find a vector t s s that minimizes d 2 . For a vertex–edge pair ( v , e ) where v Q c and e P c , the set of all vectors τ R 2 is such that v + τ e forms a segment e : = e v . Moreover, for any vector τ lying above e , v + τ also lies above e and the vertical distance between τ and e is the same as the vertical distance between v + τ and e. See Figure 4. Similarly, for a vertex–edge pair ( v , e ) where v P c and e Q c , any vector τ lying above e : = v e makes v lie below e + τ , and the vertical distance between τ and e is the same as the vertical distance between v and e + τ .
Let E s be a set of all segments e computed as above for every pair ( v , e ) in C ( t ) for t s , and let U s and L s be the upper and lower envelopes of E s on s, respectively. From the same argument of Lemma 1, we observe U s h [ T ] . Moreover, the scoring criterion d 2 ( t ) is the same as the vertical distance between ( t , h ( t ) ) and L s . Therefore, the vector t s s that minimizes the scoring criterion d 2 also minimizes the pointwise vertical distance between U s and L s . See Figure 4.
Let t i t i + 1 be the endpoints of the interval s. See every edge e in E s that intersects the vertical lines x = t i and x = t i + 1 . This implies that U s (resp. L s ) is a convex (resp. concave) piecewise linear curve of O ( m + n ) complexity. Hence, we could find t s s in O ( log n + log m ) time using binary search, once we compute U s and L s .
Observe that the combinatorial structures corresponding to adjacent intervals in S T have only O ( 1 ) different pairs. Herschberger and Suri [15] proposed an algorithm maintains the convex hull throughout the process of updating points in R 2 . More specifically, given an insert/delete sequence of points of length N, their algorithm maintains the convex hull using O ( N log N ) time and O ( N ) space. With the point-line duality [10], we can maintain the upper and lower envelopes for a updating sequence of lines. We scan the intervals in S T from left to right, and compute the updating sequence of lines of length O ( m n ) , which corresponds to the changes in C ( t ) . By applying [15], we compute U s and L s corresponding to each interval s in S T in a total of O ( m n ( log m + log n ) ) time.
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 3.
Let P and Q be two y-monotone polygons in R 2 , such that P c and Q c have n and m vertices, respectively. The optimal placement of Q on top of P which minimizes the maximum pointwise vertical distance between P c and Q c can be computed in O ( m n ( log m + log n ) ) time using O ( m n ) space.
Proof. 
We subdivide T into S T , such that the translation vectors belonging to the same interval of S T have the same combinatorial structure. This can be performed in O ( m n ( log m + log n ) ) time, and the size of S T is O ( m n ) . The size of the combinatorial structure corresponding to an interval s of S T is O ( m + n ) , so the sizes of U s and L s are O ( m + n ) .
The vector that minimizes the vertical distance between U s and L s can be computed in O ( log m + log n ) time by applying binary searches on U s and L s .
When scanning the intervals in S T sequentially, we can maintain U s and L s in total O ( m n ( log m + log n ) ) time. Therefore, we can find the optimal translation vector in O ( m n ( log m + log n ) ) time using O ( m n ) space. □

4.2. The Case When d 3

Similarly to the case when d = 2 , we calculate the subdivision S T of T such that C ( t ) remains the same for vectors t in a cell. Next, by traversing each cell of S T , we update C ( t ) and solve a linear programming problem to find the vector in the cell that minimizes d 2 .
When Q + h [ t ] is placed on top of P for t T , the maximum pointwise vertical distance Q c + h [ t ] and P c is realized by a pair ( p i , q d i 1 ) , such that p i is an i-face of P c and q d i 1 is a ( d i 1 ) -face of Q c for 0 i d 1 and q d i 1 + h [ t ] lies above p i . Therefore, C ( t ) becomes the set of pairs ( p i , q d i 1 ) that need to be considered to compute d 2 ( t ) for a vector t T .
We calculate the subdivision S T of T based on whether C ( t ) remains the same. C ( t ) changes when a vertex of D P starts or stops intersecting a face of D Q + t , or vice versa. Therefore, S T is the intersection of T with the overlay of m translated copies of D P and n translated copies of D Q . Note that D P and D Q are triangulations of complexity O ( n ( d 1 ) / 2 ) and O ( m ( d 1 ) / 2 ) , respectively [9]. Furthermore, T is the set of translation vectors that place every vertex of D Q inside D P , so T can be described as common intersection of O ( n ( d 1 ) / 2 ) half-spaces in R d 1 . Hence, S T has a complexity of O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) , and can be computed in O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) time [16,17]. When d = 3 , we could apply more efficient algorithm in [18], and compute S T with O ( ( m n ) 2 ) time and space.
Let s be a cell in S T . For a vector t s , the size of C ( t ) is O ( ( m n ) ( d 1 ) / 2 ) , since the number of faces in P c and Q c is O ( n ( d 1 ) / 2 ) and O ( m ( d 1 ) / 2 ) , respectively. Let ( p i , q d i 1 ) be a pair of C ( t ) . The set of vectors τ R d that make p i and q d i 1 + τ intersect is p i q d i 1 . Among these vectors, let s ( p i , q d i 1 ) denotes the set of vectors whose projection onto the plane x d = 0 lies in s. Let E s be the union of s ( p i , q d i 1 ) for all pairs in C ( t ) , and the upper and lower envelope of E s be U s and L s , respectively. Same as the case when d = 2 , U s h [ T ] and the optimal vector of t s that minimizes d 2 realizes the minimum pointwise vertical distance between U s and L s .
However, for dimensions d 3 , t s cannot be found through a simple binary search. For a pair ( p i , q d i 1 ) in C ( t ) , consider the ( d + 1 ) -dimensional points ( t , l , v ( t , l ) ) , where t s and l , v ( t , l ) R , such that v ( t , l ) is the vertical distance between p i and q d i 1 + ( t , l ) . The set of points ( t , l , v ( t , l ) ) forms (a part of) a ( d + 1 ) -dimensional hyperplane. From the upper envelope of the hyperplanes formed for all pairs in C ( t ) and O ( ( m n ) ( d 1 ) / 2 ) , many additional hyperplanes that make q d i 1 lie above p i , and the point with the smallest x d + 1 -coordinate corresponds to the optimal vector t s . Matoušek and Schwarzkopf [19] presented an algorithm for N hyperplanes in R d + 1 such that, after O ( N 1 + 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) preprocessing time, one can insert or delete a hyperplane and find the point with the smallest x d + 1 -coordinate in O ( N 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) time for a constant δ > 0 . By traversing O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) cells in S T , we update hyperplanes and find the optimal vector in each cell in O ( ( m n ) ( d 1 ) 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) time. When d = 3 , the size of C ( t ) is O ( m + n ) , and we find the optimal vector in s in O ( ( m n ) 1 / 3 + δ ) time.
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 4.
Let P and Q be two x d -monotone polytopes in R d for d 3 , such that P c and Q c have n and m vertices, respectively. For a constant δ > 0 , the optimal placement of Q on top of P which minimizes the maximum pointwise vertical distance that can be computed in O ( ( m n ) 7 / 3 + δ ) time using O ( ( m n ) 2 ) space for d = 3 , and in O ( ( m n ) ( d 1 ) ( d 1 ) / 2 ( d + 1 ) / 2 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) time and O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) space for d > 3 .
Proof. 
We subdivide T into S T , such that the translation vectors belonging to the same cell of S T have the same combinatorial structure. When d = 3 , this can be performed in O ( ( m n ) 2 ) time and space, and when d > 3 , it can be performed in O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) time and space.
The size of the combinatorial structure corresponding to a cell s of S T is O ( ( m n ) ( d 1 ) / 2 ) , and we find the optimal translation vector in s by solving a linear programming problem in R d + 1 with O ( ( m n ) ( d 1 ) / 2 ) constraints.
When traversing the cells in S T sequentially, using a data structure that supports the insertion and deletion of the constraints, we find the optimal translation vector in s in O ( ( m n ) 1 / 3 + δ ) time when d = 3 or O ( ( m n ) ( d 1 ) / 2 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) time when d > 3 . Therefore, we can find the optimal translation vector in O ( ( m n ) 7 / 3 + δ ) time using O ( ( m n ) 2 ) space for d = 3 , and in O ( ( m n ) ( d 1 ) ( d 1 ) / 2 ( d + 1 ) / 2 1 + δ ( d + 1 ) / 2 1 + δ + ( d + 1 ) / 2 ) time and O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) space for d > 3 . □

5. Minimizing Scoring Criterion (3)

In this section, we demonstrate how to find the translation vector that minimizes the scoring criterion d 3 .

5.1. The Case When d = 2

When Q + h [ t ] is placed on top of P for t T , the scoring criterion d 3 measures the sum of the area between pairs of edges ( e P , e Q ) , such that e P P c , e Q Q c and e Q + h [ t ] lies above e P . Let C ( t ) denotes the set of edge pairs that need to be considered to compute d 3 ( t ) . We subdivide T into S T based on whether the combinatorial structure C ( t ) are the same. As in Section 4.1, S T is defined as the overlay of m translated copies of D P and m translated copies of D Q . Therefore, S T can be computed in O ( m n ( log m + log n ) ) time and O ( m n ) space. Also, the size of C ( t ) is O ( m + n ) .
As we did in Section 4.1, we can sequentially compute U s corresponding to the intervals s of S T in O ( m n ( log m + log n ) ) time and O ( m n ) space. Let u be a segment of U s . For vectors τ u , the area between e Q + τ and e P can be expressed as a constant degree polynomial. See Figure 5 as an example. Therefore, the area between Q c + τ and P c can also be expressed as a constant degree polynomial. Consequently, the vector in u that minimizes the area between Q c + τ and P c can be found in O ( 1 ) time using a numerical method. The total number of segments in U s that apply this method is bounded by the complexity of h [ T ] , which is O ( m n α ( m n ) ) .
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 5.
Let P and Q be two y-monotone polygons in R 2 , such that P c and Q c have n and m vertices, respectively. The optimal placement of Q on top of P which minimizes the volume between P c and Q c can be computed in O ( m n ( log m + log n ) ) time using O ( m n ) space.
Proof. 
We subdivide T into S T , such that the translation vectors belonging to the same interval of S T have the same combinatorial structure. This can be performed in O ( m n ( log m + log n ) ) time, and the size of S T is O ( m n ) . The size of the combinatorial structure corresponding to an interval s of S T is O ( m + n ) , so the sizes of U s is O ( m + n ) .
For an interval s of S T , the vector t s s that minimizes the volume between P c and Q c + t s can be computed in O ( 1 ) time, once we have the function corresponding to the volume between P c and Q c + t s .
When scanning the intervals in S T sequentially, we compute U s 0 for the first interval s 0 of S T and the volume function for the first segment of U s 0 in O ( ( m + n ) ( log m + log n ) ) time. For the remaining intervals, we can maintain U s and the volume function in total O ( m n ( log m + log n ) ) time. Therefore, we can find the optimal translation vector in O ( m n ( log m + log n ) ) time using O ( m n ) space. □

5.2. The Case When d 3

Similarly to the case when d = 2 , we calculate the subdivision S T of T such that C ( t ) remains the same. Next, by traversing each cell s in S T , we compute h [ T ] on s and find the vector minimizing the volume between Q c + τ and P c .
When Q + h [ t ] is placed on top of P for t T , the scoring criterion d 3 measures the sum of the area between pairs of ( d 1 ) -faces ( e P , e Q ) , such that e P P c , e Q Q c and e Q + h [ t ] lies above e P . Let C ( t ) denotes the set of ( d 1 ) -face pairs that need to be considered to compute d 3 ( t ) . We subdivide T into S T based on whether the combinatorial structure C ( t ) are the same. As we did in Section 4.2, S T is defined as the overlay of m translated copies of D P and m translated copies of D Q within T . Hence, S T has a complexity of O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) , and can be computed in O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) time [16,17] for d > 3 , and O ( ( m n ) 2 ) time and space [18] for d = 3 .
For a cell s in S T , consider the pair ( e P , e Q ) in C ( t ) for t s . For any face k in the triangulation of h [ s ] , the volume between e Q + τ and e P for τ k can be expressed as a constant degree polynomial. Therefore, the volume between Q c + τ and P c can also be expressed as a constant degree polynomial, and the vector in k that minimizes the volume can be calculated in O ( 1 ) time using numerical methods. Since h [ s ] is the upper envelope on s of O ( ( m n ) ( d 1 ) / 2 ) hyperplanes in R d corresponding to the i-face and ( d i 1 ) -face pairs of P c and Q c , it can be computed in O ( ( m n ) d / 2 ( d 1 ) / 2 + m n ( log m + log n ) ) time [20]. Similarly, the triangulation of s can be computed within the same time and space complexity.
We conclude this section with the following theorem, which analyzes the time and space complexities of finding the optimal translation vector.
Theorem 6.
Let P and Q be two x d -monotone polygons in R d for d 3 , such that P c and Q c have n and m vertices, respectively. The optimal placement of Q on top of P which minimizes the volume between P c and Q c can be computed in O ( ( m n ) ( d 1 ) ( d 1 ) / 2 d / 2 ( d + 1 ) / 2 ) time and space.
Proof. 
We subdivide T into S T , such that the translation vectors belonging to the same cell of S T have the same combinatorial structure. This can be performed in O ( ( m n ) ( d 1 ) ( d + 1 ) / 2 ) time and space. The size of the combinatorial structure corresponding to a cell s of S T is O ( ( m n ) ( d 1 ) / 2 ) . Hence, we can compute the graph h [ s ] in O ( ( m n ) d / 2 ( d 1 ) / 2 + m n ( log m + log n ) ) time.
For a face k in h [ s ] , we can find the optimal translation vector in k in O ( 1 ) time, once we have the function corresponding to the volume between P c and Q c + t k for t k k . The volume function can be computed in O ( ( m n ) ( d 1 ) / 2 ) time for the first face k 0 of h [ s ] , and then updated in O ( 1 ) time along any (continuous) traversal order of the faces of h [ s ] from k 0 . Therefore, we can find the optimal translation vector in O ( ( m n ) ( d 1 ) ( d 1 ) / 2 d / 2 ( d + 1 ) / 2 ) time and space. □

6. Discussion and Conclusions

In this paper, we propose algorithms to find the optimal location of Q on top of P under three different scoring criteria. The proposed algorithms are based on a detailed analysis of the geometric configurations and the careful application of suitable data structures. More specifically, the vector minimizing d 1 is computed by finding the point with the minimum x d -coordinate in the graph h [ T ] . To find the vector minimizing d 2 , we first subdivide T into S T such that the combinatorial structure remains the same in a cell of S T . Then, we find the optimal vector in s by solving a linear programming (LP) problem, and we also improve the time complexity by applying data structures that support constraint updates, leveraging the similarity of the LP problems corresponding to each cell. To find the vector minimizing d 3 , we use the same subdivision S T as in the case for d 2 . For each cell s S T , the volume function between P c and Q c + τ for τ h [ s ] is expressed as a constant degree polynomial when τ is restricted in a face of h [ s ] that has non-zero volume. Hence, we explicitly compute h [ s ] and find the optimal vector in each face of h [ s ] using numerical methods.
We expect that a careful implementation of the algorithm proposed in this paper can be applied to various real-world applications. Additionally, if the input polytope is composed of triangles that satisfy conditions such as “fat” [21], we anticipate that the calculation of the optimal stacking can be performed more efficiently in practice than the worst-case analysis presented in this paper.
Future research may extend to cases where D P and D Q are non-convex, where P and Q are not x d -monotone, where P and Q have symmetry, or where both translation and rotation are considered. We expect that the algorithms presented in this paper will serve as a solid baseline for these diverse follow-up studies.

Author Contributions

Conceptualization, methodology and writing: H.-K.A., S.J.L. and S.D.Y.; Writing—review and editing: S.D.Y. All authors have read and agreed to the published version of the manuscript.

Funding

Sang Duk Yoon was supported by the Sungshin Women’s University Research Grant of H20200060.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Kepler, J. The Six-Cornered Snowflake; Paul Dry Books: Philadelphia, PA, USA, 2010. [Google Scholar]
  2. Paterson, M.; Peres, Y.; Thorup, M.; Winkler, P.; Zwick, U. Maximum overhang. Am. Math. Mon. 2009, 116, 763–787. [Google Scholar] [CrossRef]
  3. Lee, S.J. Efficient Algorithms for Stacking Polytopes. Master’s Thesis, Pohang University of Science and Technology, Pohang, Republic of Korea, 2019. [Google Scholar]
  4. Ahn, H.K.; Abardia, J.; Bae, S.W.; Cheong, O.; Dann, S.; Park, D.; Shin, C.S. The minimum convex container of two convex polytopes under translations. Comput. Geom. 2019, 77, 40–50. [Google Scholar] [CrossRef]
  5. Egeblad, J.; Nielsen, B.K.; Brazil, M. Translational packing of arbitrary polytopes. Comput. Geom. 2009, 42, 269–288. [Google Scholar]
  6. Trivella, A.; Pisinger, D. Bin-Packing Problems with Load Balancing and Stability Constraints. In Proceedings of the INFORMS Transportation and Logistics Society, Chicago, IL, USA, 26–29 July 2017. [Google Scholar]
  7. Casko, J.S.; Vaden, J.L.; Kokich, V.G.; Damone, J.; James, R.D.; Cangialosi, T.J.; Riolo, M.L.; Owens, S.E.; Bills, E.D. Objective grading system for dental casts and panoramic radiographs. Am. J. Orthod. Dentofac. Orthop. 1998, 114, 589–599. [Google Scholar] [CrossRef] [PubMed]
  8. Hershberger, J. Finding the upper envelope of n line segments in O(n log n) time. Inf. Process. Lett. 1989, 33, 169–174. [Google Scholar] [CrossRef]
  9. McMullen, P. The maximum numbers of faces of a convex polytope. Mathematika 1970, 17, 179–184. [Google Scholar] [CrossRef]
  10. Berg, M.; Cheong, O.; Kreveld, M.; Overmars, M. Computational Geometry: Algorithms and Applications; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2000. [Google Scholar]
  11. Dobkin, D.P.; Kirkpatrick, D.G. A linear algorithm for determining the separation of convex polyhedra. J. Algorithms 1985, 6, 381–392. [Google Scholar] [CrossRef]
  12. Dobkin, D.P.; Kirkpatrick, D.G. Determining the separation of preprocessed polyhedra—A unified approach. In International Colloquium on Automata, Languages, and Programming; Springer: Berlin/Heidelberg, Germany, 1990; pp. 400–413. [Google Scholar]
  13. Edelsbrunner, H.; Guibas, L.J.; Sharir, M. The upper envelope of piecewise linear functions: Algorithms and applications. Discret. Comput. Geom. 1989, 4, 311–336. [Google Scholar] [CrossRef]
  14. Agarwal, P.K.; Aronov, B.; Sharir, M. Computing envelopes in four dimensions with applications. In Proceedings of the Tenth Annual Symposium on Computational Geometry, Stony Brook, NY, USA, 6–8 June 1994; pp. 348–358. [Google Scholar]
  15. Herschberger, J.; Suri, S. Offline maintenance of planar configurations. In Proceedings of the Second Annual ACM-SIAM Symposium on Discrete Algorithms, San Francisco, CA, USA, 28–30 January 1991; pp. 32–41. [Google Scholar]
  16. Clarkson, K.L. New applications of random sampling in computational geometry. Discret. Comput. Geom. 1987, 2, 195–222. [Google Scholar] [CrossRef]
  17. Edelsbrunner, H.; O’Rourke, J.; Seidel, R. Constructing arrangements of lines and hyperplanes with applications. Siam J. Comput. 1986, 15, 341–363. [Google Scholar] [CrossRef]
  18. Balaban, I.J. An optimal algorithm for finding segments intersections. In Proceedings of the Eleventh Annual Symposium on Computational Geometry, Vancouver, BC, Canada, 5–7 June 1995; pp. 211–219. [Google Scholar]
  19. Matoušek, J.; Schwarzkopf, O. Linear optimization queries. In Proceedings of the Eighth Annual Symposium on Computational Geometry, Berlin, Germany, 10–12 June 1992; pp. 16–25. [Google Scholar]
  20. Chazelle, B. An optimal convex hull algorithm in any fixed dimension. Discret. Comput. Geom. 1993, 10, 377–409. [Google Scholar] [CrossRef]
  21. Moet, E.; van Kreveld, M.; der Stappen, A.F.v. On realistic terrains. Comput. Geom. 2008, 41, 48–67. [Google Scholar] [CrossRef]
Figure 1. (a) Q + τ is placed on top of P. (bd) The conditions C1, C3, and C2 are violated, respectively.
Figure 1. (a) Q + τ is placed on top of P. (bd) The conditions C1, C3, and C2 are violated, respectively.
Symmetry 16 01246 g001
Figure 2. (a) i = 2 . ( p 2 , q 0 ) is a facet-vertex pair. (b) i = 1 . ( p 1 , q 1 ) is an edge-edge pair. (c) i = 0 . ( p 0 , q 2 ) is a vertex-facet pair.
Figure 2. (a) i = 2 . ( p 2 , q 0 ) is a facet-vertex pair. (b) i = 1 . ( p 1 , q 1 ) is an edge-edge pair. (c) i = 0 . ( p 0 , q 2 ) is a vertex-facet pair.
Symmetry 16 01246 g002
Figure 3. All vertex–edge pairs are depicted with arrows. The black arrow corresponds to the maximum distance.
Figure 3. All vertex–edge pairs are depicted with arrows. The black arrow corresponds to the maximum distance.
Symmetry 16 01246 g003
Figure 4. (left,middle) The pairs ( v + τ , e ) and ( τ , e ) have the same geometric configuration. (right) The red arrow is the minimum pointwise vertical distance between U s and L s .
Figure 4. (left,middle) The pairs ( v + τ , e ) and ( τ , e ) have the same geometric configuration. (right) The red arrow is the minimum pointwise vertical distance between U s and L s .
Symmetry 16 01246 g004
Figure 5. e Q lies above e P , and 2 x 1 where ( x , y ) is the left endpoint of e Q . The volume between e Q and e P is 0.5 x + 1.5 y + 1 .
Figure 5. e Q lies above e P , and 2 x 1 where ( x , y ) is the left endpoint of e Q . The volume between e Q and e P is 0.5 x + 1.5 y + 1 .
Symmetry 16 01246 g005
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ahn, H.-K.; Lee, S.J.; Yoon, S.D. Stacking Monotone Polytopes. Symmetry 2024, 16, 1246. https://doi.org/10.3390/sym16091246

AMA Style

Ahn H-K, Lee SJ, Yoon SD. Stacking Monotone Polytopes. Symmetry. 2024; 16(9):1246. https://doi.org/10.3390/sym16091246

Chicago/Turabian Style

Ahn, Hee-Kap, Seung Joon Lee, and Sang Duk Yoon. 2024. "Stacking Monotone Polytopes" Symmetry 16, no. 9: 1246. https://doi.org/10.3390/sym16091246

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop