Maximum overlap area of a convex polyhedron and a convex polygon under translation
Abstract.
Let be a convex polyhedron and be a convex polygon with vertices in total in three-dimensional space. We present a deterministic algorithm that finds a translation vector maximizing the overlap area in time. We then apply our algorithm to solve two related problems. We give an time algorithm that finds the maximum overlap area of three convex polygons with vertices in total. We also give an time algorithm that minimizes the symmetric difference of two convex polygons under scaling and translation.
1. Introduction
Shape matching is an important topic in computational geometry, with useful applications in areas such as computer graphics. In a typical problem of shape matching, we are supplied two or more shapes, and we want to determine how much the shapes resemble each other. More precisely, given a similarity measure and a set of allowed transformations, we want to transform the shapes to maximize their similarity measure.
There are many candidates for the similarity measure, such as the Hausdorff distance and the Fréchet distance between the boundaries of the shapes. We can also consider the area/volume of overlap or of symmetric difference. The advantage to these is that they are more robust against noise on the boundary of the shapes [deberg1996].
The maximum overlap problem of convex polytopes has been studied by many. In dimension , de Berg et al. [deberg1996] give an time algorithm for finding a translation maximizing the area of intersection of two convex polygons (where denotes the total number of vertices of the polygons). In dimension , Ahn et al. [ahn2008] give an expected time algorithm finding the maximum overlap of two convex polyhedra under translation. For the same problem, Ahn et al. [ahn2013] present an algorithm that runs in time with probability and an additive error. For , given two convex polytopes of dimension with facets in total, Ahn et al. [ahn2013] give an algorithm that finds the maximum overlap under translation in time with probability and an additive error.
In the plane, when all rigid motions are allowed, Ahn et al. [ahn2007] give an approximate algorithm that finds a rigid motion realizing at least times the maximal overlap in time. In dimension , Ahn et al. [ahn2014] present an approximate algorithm that finds a rigid motion realizing at least times the maximal overlap in with probability .
When considering the maximum overlap as a similarity measure, we obviously can only allow area/volume-preserving transformations. However, we may want to allow scaling as a transformation—two similar triangles are supposed to be very “similar,” though they may have different sizes. In this case, the area of symmetric difference is a better measure of similarity. Yon et al. [yon2016] give an algorithm minimizing the symmetric difference of two convex polygons under translation and scaling in expected time.
Our results
While many have studied the matching problem for two convex polytopes of the same dimension, to our knowledge no one has examined the problem for polytopes of different dimensions or matching more than two polytopes.
The main result in this paper is a deterministic algorithm for the problem of matching a convex polyhedron and a convex polygon under translation in three-dimensional space.
theoremalgo Let be a convex polyhedron and a convex polygon with vertices in total. We can find a vector that maximizes the overlap area in time.
We also present two applications of our algorithm to other problems in computational geometry. First, we give a deterministic algorithm for maximizing the overlap of three convex polygons under translations.
theoremthreepolys Let , , be three convex polygons with vertices in total in the plane. We can find a pair of translations that maximizes the overlap area in time.
We also give a deterministic time algorithm for minimizing the symmetric difference of two convex polygons under a homothety (a translation and a scaling), which is an improvement to Yon et al.’s randomized algorithm [yon2016].
theoremsymmdiff Let and be convex polygons with vertices in total. Then we can find a homothety that minimizes the area of symmetric difference in time.
The main ingredient in the proof of Section 1 is a new technique we introduce which generalizes Megiddo’s prune-and-search [megiddo1984]. This allows us to efficiently prune among groups of parallel lines.
theorempruneandsearch Let be a union of sets of parallel lines in the plane, none of which are parallel to the -axis, and suppose the lines in each are indexed from left to right.
Suppose there is an unknown point and we are given an oracle that decides in time the relative position of to any line in the plane. Then we can find the relative position of to every line in in time.
Organization of the Paper
In Section 2, we introduce the problem of matching a convex polyhedron and a convex polygon under translation in three-dimensional space. In Section 3, we present a core technique we use in our algorithm, which is a generalization of Megiddo’s prune-and-search technique [megiddo1984]. In Section 4, we present the algorithm for Section 1. In Section 5, we apply our algorithm to solve the problem of maximizing the intersection of three polygons under translation. In Section 6, we give the algorithm for minimizing the symmetric difference of two convex polygons under homothety.
Acknowledgements
This paper is the result of the MIT SPUR 2022, a summer undergraduate research program organized by the MIT math department. The authors would like to thank the faculty advisors David Jerison and Ankur Moitra for their support and the math department for providing this research opportunity. We thank the anonymous referees of SoCG 2023 for providing helpful comments that increased the quality of this paper.
2. Preliminaries
Let be a convex polyhedron and be a convex polygon with vertices in total. Throughout the paper, we assume that is in the -plane, and that the point in with minimal coordinate is on the -plane. We want to find a translation vector that maximizes the overlap area .
It is easy to observe that is continuous and piecewise quadratic on the interior of its support. As noted in [deberg1996, ahn2008, ahn2013], is smooth on a region if is combinatorially equivalent for all , that is, if we have the same set of face-edge incidences between and . Following the convention of [ahn2008], we call the polygons that form the boundaries of these regions the event polygons, and as in [deberg1996], we call the space of translations of the configuration space. The arrangement of the event polygons partition the configuration space into cells with disjoint interiors. The overlap function is quadratic on each cell. Thus, to locate a translation maximizing , we need to characterize the event polygons.
For two sets , we write the Minkowski sum of and as
We will make no distinction between the translation and the Minkowski sum for a vector . We also write for the Minkowski sum of with . We categorize the event polygons into three types and describe them in terms of Minkowski sums:
-
(I)
When contains a vertex of . For each vertex of , we have an event polygon . There are event polygons of this type.
-
(II)
When a vertex of is contained in a face of . For each face of and each vertex of , we have an event polygon . There are event polygons of this type.
-
(III)
When an edge of intersects an edge of . For each edge of and each edge of , we have an event polygon . There are event polygons of this type.
The reason that convexity is fundamental is due to the following standard fact, as noted and proved in [deberg1996, yon2016].
Proposition 2.1.
Let be a -dimensional convex polytope and let be a -dimensional convex polytope. Suppose . Let be the volume of the overlap function. Then, is concave on its support .
As in [avis1996], we say a function is unimodal if it increases to a maximum value, possibly stays there for some interval, and then decreases. It is strictly unimodal if it strictly increases to the maximum and then strictly decreases. Furthermore, we say a function is (strictly) unimodal if its restriction to any line is (strictly) unimodal.
The following corollary of Proposition 2.1 allows us to employ a divide-and-conquer strategy in our algorithm.
Corollary 2.2 ([avis1996]).
For any line parameterized by in for , the function is strictly unimodal.
We also use the following two techniques in our algorithm.
Lemma 2.3 ([frederickson1984]).
Let be an matrix of real numbers, where . If every row and every column of is in increasing order, then we say is a sorted matrix. For any positive integer smaller or equal to , the -th smallest entry of can be found in time, assuming an entry of can be accessed in time.
For our purposes, we will use this result in the weaker form of .
Lemma 2.4 ([chazelle1993]).
Given hyperplanes in and a region , a -cutting is a collection of simplices with disjoint interiors, which together cover and such that the interior of each simplex intersects at most hyperplanes. A -cutting of size can be computed deterministically in time. In addition, the set of hyperplanes intersecting each simplex of the cutting is reported in the same time.
3. Generalized two-dimensional prune-and-search
In this section, we prove Section 1, our generalization of Megiddo’s prune-and-search technique [megiddo1984]. This technique is of independent interest and can likely be applied to other problems.
In [megiddo1984], Megiddo proves the following:
Theorem 3.1 ([megiddo1984]).
Suppose there exists a point not known to us. Suppose further that we have an oracle that can tell us for any line whether , and if , the side of that belongs to. Let be the running time of the oracle. Then given lines in the plane, we can find the position of relative to each of the lines in time.
We are interested in a generalized version of Megiddo’s problem. Suppose, instead of lines, we are given sets of parallel lines , each of size . In addition, suppose the lines in each are indexed from left to right (assuming none of the lines are parallel to the -axis). Again, we want to know the position of relative to every line in . Megiddo’s algorithm solves this problem in time, but we want a faster algorithm for large by exploiting the structure of .
Without loss of generality, suppose that there are no lines parallel to the -axis. For each between and , suppose . Suppose that . To report our final answer, we simply need to provide, for each , the two consecutive indices and such that lies strictly between and or the single index such that .
In our algorithm, we keep track of a feasible region containing , which is either the interior of a (possibly unbounded) triangle or an open line segment if we find a line that lies on. Together with , we keep track of the indices and such that is the set of lines intersecting , which is also the set of lines we do not yet know the relative position to . In the beginning, . Each step, we find lines to run the oracle on to find a new feasible region such that and recurse on . An outline is given in Algorithm 3.1.
One extra computational effort is updating by computing and . Since the feasible region is always a convex set of constant complexity, we can use binary search on to find the new bounds for in time. Thus, the total time involved in this process, assuming decreases by at least each iteration, is
We will use the following well-known result:
Lemma 3.2 ([cormen2009]).
Suppose we are given distinct real numbers with positive weights that sum to . Then we can find the weighted median of these numbers in time.
Given and , we want to find to recurse on.
Lemma 3.3.
If , then in time, we can find a region of constant complexity containing so that its interior intersects no more than of all the lines in .
Proof 3.4.
For convenience, we write . We first find the weighted median of the slopes of the lines in , where the slope of the lines of is weighted by . This can be done in time by Lemma 3.2.
If this slope is equal to the slope of some line in and , then we can simply divide the plane using the median line of and the -axis and the interior of each quadrant will avoid at least of the lines of .
Otherwise, at least of the lines have slopes strictly greater than/less than the median slope. Without loss of generality, we assume at least of the lines have positive slope and at least of the lines have negative slope. Now let and denote the set of lines with postive/negative slope, respectively. We remove lines from the larger of the two sets until they have the same size.
We partition into subsets each containing the same number of lines from and in the following way: going in lexicographical order by the indices of the lines, we put a line from and a line from into until we exhaust one of the sets (say it is ). Then, we move on to put a line from the remaining and a line from into until we exhaust one of them, and so on. Each is then of the form , and can be represented by the indices and (see Figure 1). We can compute this partition in time. For each , we compute the intersection of the median line in with positive slope and the median line with negative slope, and assign a weight . Then, the weights of the sum to . The significance of this is that if we know the relative position of to the lines and , then we know the relative position of to at least of the lines in , which is at least of all the lines in .
We find the median point of the ’s by weight in -coordinate in time by Lemma 3.2. We run the oracle on the line . Let be the points such that we now know the relative position of to . Then the weights of these points sum to at least . We find the median point of these by weight in -coordinate in time. We run the oracle on the line . Then, for points with weights that sum to at least , we now know the relative position of to the vertical line and the horizontal line through those points. This means that we know the relative position of to at least of all the lines in . We get a new feasible region according to the two oracle calls whose interior avoids at least of the lines in , and we triangulate it with more oracle calls to get our desired region, in time total.
Proof 3.5 (Proof of Section 1).
After recursive iterations of Lemma 3.3, we arrive at a feasible region intersecting at most lines in , and we can finish by brute force. Therefore, our algorithm runs in time.
Remark 3.6.
A simpler and probably more practical algorithm for Lemma 3.3 is simply choosing a random line from and to intersect and run the oracle on the horizontal and vertical line through the intersection. This method gives the same run time in expectation.
4. Maximum overlap of convex polyhedron and convex polygon
In section, we give the algorithm that finds a translation maximizing the area of overlap function . Following the convention in [deberg1996], we call such a translation a goal placement. In the algorithm, we keep track of a closed target region which we know contains a goal placement and decrease its size until for each event polygon , either or . Then, is quadratic on and we can find the maximum of on using standard calculus. Thus, the goal of our algorithm is to efficiently trim to eliminate event polygons that intersect it.
In the beginning of the algorithm, the target region is the interior of the Minkowski sum , where the overlap function is positive. By the unimodality of the overlap function, the set of goal placements is convex. Thus, for a plane in the configuration space, either it contains a goal placement, or all goal placements lie on one of the two open half spaces separated by the plane. If we have a way of knowing which case it is for any plane, we can decrease the size of our target region by cutting it with planes and finding the piece to recurse. More precisely, we need a subroutine PlaneDecision that decides the relative position of the set of goal placements to a plane .
Whenever PlaneDecision reports that a goal placement is found on a plane, we can let the algorithm terminate. Thus, we can assume it always reports a half-space containing a goal placement.
As in Algorithm 4.1, we break down our algorithm into three stages.
4.1. Stage 1
In the first stage of our algorithm, we make use of [deberg1996] to simplify our problem so that can be taken as a convex polyhedron with all of its vertices on two horizontal planes.
We sort the vertices of by -coordinate in increasing order and sort the vertices of in counterclockwise order. Next, we trim the target region with horizontal planes (planes parallel to the -plane) to get to a slice that does not contain any vertices of .
Lemma 4.1.
In time, we can locate a strip whose interior contains a goal placement and has no vertices with .
Proof 4.2.
Starting with the median -coordinate of the vertices of , we perform a binary search on the levels containing a vertex of . For a horizontal plane , [deberg1996, Theorem 3.8] allows us to compute the maximum overlap of and under translation in -time. The two planes and with the largest maximum values will be the bounding planes for the slice containing a goal placement by the unimodality of . Thus, by a binary search, we can locate this slice in time.
By Chazelle’s algorithm [chazelle1992], the convex polyhedron can be computed in time. From now on, we replace with (see Figure 2). Without loss of generality, assume and .
The region in the configuration space where is the Minkowski sum . Since only has two levels and that contain vertices, the Minkowski sum is simply the convex hull of , which has vertices. We can compute and in time and compute their convex hull in time by Chazelle’s algorithm [chazelle1993b].
4.2. PlaneDecision
With the simplification of the problem in Stage , we now show that the subroutine PlaneDecision can be performed in time. Let be a fixed plane in the configuration space. We call a translation that achieves a good placement. First, we can compute the intersection of with in time by Chazelle’s algorithm [chazelle1992]. If the intersection is empty, we just report the side of containing . From now on assume this is not the case.
The following lemma shows that PlaneDecision runs in the same time bound as the algorithm that just finds the maximum of on a plane.
Lemma 4.3.
Suppose we can compute for any plane in time , then we can perform PlaneDecision for any plane in time .
Proof 4.4.
The idea is to compute for certain that are perturbed slightly from to see in which direction relative to does increase.
We compute over an extension of the reals , where is smaller than any real number. Let be the maximum of over a plane . Let and be the two planes parallel to that have distance from . We compute and in time. Since is piecewise quadratic, and as symbolic expression will only involve quadratic terms in . Since is strictly unimodal on , there are three possibilities:
-
(1)
If , then halfspace on the side of contains the set of goal placements.
-
(2)
If , then halfspace on the side of contains the set of goal placements.
-
(3)
If and , then is the global maximum of .
Thus, in time, we can finish PlaneDecision.
Finding a good placement on is similar to finding a goal placement on the whole configuration space. is partitioned into cells by the intersections of event polygons with . We need to find a region on containing a good placement that does not intersect any event polygons.
We present a subroutine LineDecision that finds, for a line , the relative position of the set of good placements on to .
Proposition 4.5.
For a line , we can perform LineDecision in time.
Proof 4.6.
First, we compute and a vector achieving the maximum. We parameterize the line by where is the parameter and . The horizontal cross-section of at height has area . Since is the intersection of two convex polytopes with vertices (see Figure 3), Chazelle’s algorithm [chazelle1992] computes in time. Then, [avis1996, Theorem 3.2] computes the maximum cross-section in time.
Now, by the same argument and method as in the proof of Lemma 4.3, we can finish LineDecision in time. In the case where , we report the side of containing .
Whenever our subroutine LineDecision reports a good placement is found on a line, we can let the algorithm terminate. Thus, we can assume it always reports a half-plane of containing a good placement.
We now present PlaneDecision. If is horizontal, then we only need to find the maximum overlap of the convex polygons and using De Berg et al.’s algorithm [deberg1996], which takes time. Thus, we assume is non-horizontal.
As in Algorithm 4.2, we break down PlaneDecision into three steps. We have already explained Step , where we compute , so we begin with Step .
4.2.1. PlaneDecision: Step 2
We want to find a strip on strictly between and that intersects event polygons. Since there are no vertices of with -coordinate in the interval , there are no event polygons of type (I) in this range, and we will only need to consider event polygons of type (II) and type (III).
We look at the intersection points of with the edges of the event polygons. These edges come from the set . Without loss of generality, assume that is parallel to the -axis. We are interested in the -coordinates of the intersections, so we project everything into the -plane. Then, becomes a line, which we denote by , and each edge becomes a segment whose endpoints lie on and . Suppose each edge projects to a segment , and each projects to a point on the -axis. Then, we get segments with endpoints on and , and the line that intersect them in some places.
Lemma 4.7.
In time, we can locate a strip whose interior contains a good placement and intersects none of the edges of the event polygons.
Proof 4.8.
By our setup, we want to find a segment on whose interior does not intersect any segment of the form .
Since are projections of edges of a convex polyhedron, we can separate them into two sets such that edges from the same set do not intersect (we take the segments that are projections of the edges of the “front” side and “back” side, respectively), allowing the two extremal edges to appear in both sets. We will process each set separately. This can be done by identifying the extremal points points on the top and bottom faces of in the direction, which can be done in time.
For a set of non-intersecting segments, since they all have endpoints on the line and , we can sort them by the sum of the -coordinates of their two endpoints. This takes time. We further separate these segments into two sets by slope: those that make a smaller angle than with the positive -axis, and those that make a larger angle.
Suppose we now have a set of non-intersecting segments that all make larger angles than with the positive -axis, , where . We also sort the projections of the vertices of , , in decreasing order by -coordinate. This can be done in time by identifying the extremal vertices of in the -direction.
Let be the -coordinate of the intersection of the line containing with . Let be an matrix with -th entry given by
We claim that is a sorted matrix. To see this, consider any fixed row and indices . Then the line containing lies strictly to the left of the line containing since . This means that . Thus, every row of is in increasing order. Similarly, for a fixed column and indices , the segment lies strictly to the left of the segment . Then, if they both intersect , we must have . If does not intersect and does, then must lie on the left of and thus . Similarly, if intersects and does not, then must lie on the right of and thus . If they both do not intersect , then still since it is impossible to have and . This proves our claim.
By Lemma 2.3, we can find the -th smallest value in in time. Thus, we can perform a binary search on these -coordinates of the intersections of the edges with . Each time we perform a LineDecision on the line with the median -coordinate of the remaining entries to eliminate half of the intersections. After iterations or time, we find a strip on containing a good placement that contains no intersections with this group of edges.
We repeat the same procedure for the other three groups and compute the intersection of the four strips to find a strip containing a good placement that contains no intersections with any edge of the event polygons.
Our current target region, the strip we obtained from Lemma 4.7 (see Figure 4), intersects few event polygons and we can compute them efficiently.
Lemma 4.9.
The interior of the region intersects event polygons, and we can compute them in time.
Proof 4.10.
For a vertex of , it contributes the event polygons of type (II) that are the faces of . The intersection of the boundary of with is a convex polygon. Since there are no intersections with edges of event polygons inside the strip , at most two edges of the convex polygon can lie inside , one on the “front side” and the other on the “back side.”
To compute these two segments on , we first consider the two sorted matrices given in the proof of Lemma 4.7 that together describe the edges on the “front side” and look at the column associated to . We find, for each column, the two (or zero) adjacent entries that contain the -coordinates of in between. The two of the at most four that are closest to the strip will be the endpoints of the segment that intersect the strip on the “front side.” Computing this segment takes time since we can use binary search on the columns to find the desired entries. We do the same to find the segment on the “back side.” We do this for all vertices of to find the intersections with the event polygons of type (II) in time.
For an edge of , it contributes event polygons of type (III) that form the surrounding sides of a “cylinder” with base congruent to . Again, each of these “cylinders” intersect the strip in at most two faces, so there are intersections of with event polygons of type (III). We can compute these segments by performing the binary search on the row of one of the sorted matrices associated to the edge . The two entries immediately below the strip and the two immediately above the strip define the at most two segments intersecting . Similar to the procedure above, this takes time for each edge of , thus time in total.
4.2.2. PlaneDecision: Step 3
Now, we have a target region and the intersections it makes with the event polygons.
Lemma 4.11.
In time, we can find a region containing a good placement that does not intersect any of the event polygons.
Proof 4.12.
We recursively construct a -cutting of the target region. By Lemma 2.4, a -cutting of constant size can be computed in time. We perform LineDecision on the lines of the cutting to decide on which triangle to recurse. After iterations, we have a target region that intersects no event polygons. This procedure runs in time.
Finally, since the overlap function is quadratic on our final region , we can solve for the maximum using standard calculus. After finding and a vector achieving it time, by Lemma 4.3, we can perform PlaneDecision on in the same time bound.
Proposition 4.13.
For a plane , we can perform PlaneDecision in time.
4.3. Stage 2
With the general PlaneDecision at our disposal, we now move on to State , the main component of our algorithm. We project the entire configuration space and the event polygons onto the -plane in order to find a target region whose preimage intersects few event polygons, where is the -axis (see Figure 5).
The non-horizontal edges of the event polygons project to segments on the strip on the -plane. We characterize our desired region in the following lemma.
Lemma 4.14.
For a region that does not intersect any of the segments that are the projections of the non-horizontal edges of the event polygons, the preimage intersects event polygons.
Proof 4.15.
For any region on the -plane, the set of event polygons that the “tube” intersects is precisely the set of projected event polygons that intersects. Now, let be a region that does not intersect any segment from the projections of the event polygons.
Let be the segments that are the projections of the non-horizontal edges of , and let be the projections of the vertices of on the -axis and assume that they are sorted by decreasing -coordinate. Then, the projections of the non-horizontal edges of the event polygons are precisely .
We first split the segments into four groups. Let be the projections of the non-horizontal edges of on the “front side,” and be those on the “back side.” The at most two edges visible on both the front and the back may be repeated. Then the segments from either group are pairwise non-intersecting. Similarly, we split the vertices of into a front side and a backside, including the at most two vertices visible on both the front and back in both sets. We consider the segments in the configuration space made by one of the two groups of edges of and one of the two groups of vertices of . The other three sets of segments are processed similarly.
Suppose that the segments we consider are , and the projected vertices are . Suppose the segments are sorted by increasing sum of the -coordinates of their endpoints, and that the vertices are sorted by decreasing -coordinate. The event polygons of type (II) are the trapezoids or triangles between segments and for each of the four groups of segments. For each fixed projected vertex , the region intersects at most one event polygon of type (II) for each group. Thus, intersects event polygons of type (II). Similarly, the event polygons of type (III) are the parallelograms between segments and for each of the four groups of segments. For each fixed segment , intersects at most one event polygon of type (III), thus it intersects event polygons of type (III) in total.
Now it remains to efficiently find such a region with containing a goal placement and compute the event polygons that intersect its interior.
Lemma 4.16.
In time, we can find a triangle in the -plane such that the interior of contains a goal placement and intersects event polygons. We can compute these event polygons in the same time bound.
Proof 4.17.
The computation of is a direct application of Section 1, where . Calling the oracle on a line in the -plane is running the PlaneDecision algorithm on the plane parallel to the -axis that projects to . We compute a triangle for each of the four groups of segments, take their intersection, and triangulate the intersection using calls to PlaneDecision. Thus, we can compute the desired triangle in time.
To compute the event polygons intersecting the interior of is simple, since we have shown in the proof of Lemma 4.14 that intersects at most one projection of an event polygon of each type in each of the four groups for a fixed vertex (for type (II)) or segment (for type (III)). Once we have , we can compute these polygons by binary search on each of the groups of non-intersecting segments to find the two between which lies. Also, the event polygons all have constant complexity so computing all of them takes linear time. We can recover the event polygons from their projections and compute the planes that contain them in linear time. Thus, this entire process can be done in time.
4.4. Stage 3
Now, we have a target region whose interior contains a goal placement, and we have the event polygons that intersect it.
Lemma 4.18.
In time, we can find a region containing a goal placement that does not intersect any of the event polygons.
Proof 4.19.
We recursively construct a -cutting of the target region. By Lemma 2.4, a -cutting of constant size can be computed in time. We perform PlaneDecision on the planes of the cutting to decide on which simplex to recurse. After iterations, we have a target region that intersects no event polygons. This procedure runs in time.
Finally, since the overlap function is quadratic on our final region , we can solve for the maximum using standard calculus. This concludes the proof of Section 1.
5. Maximum overlap of three convex polygons
Let , , be three convex polygons with vertices in total in the plane. We want to find a pair of translations that maximizes the overlap area .
In this problem, the configuration space is four-dimensional. An easy extension of Proposition 2.1 and Corollary 2.2 shows that the function of overlap area is again unimodal. This time, we have four-dimensional event polyhedra instead of event polygons that divide the configuration space into four-dimensional cells on which is quadratic. We call a hyperplane containing an event polyhedron an event hyperplane, and they are defined by two types of events:
-
(I)
When one vertex of , or lies on an edge of another polygon. There are groups of parallel event hyperplanes of this type.
-
(II)
When an edge from each of the three polygons intersect at one point. There are event hyperplanes of this type.
To overcome the difficulty of dealing with the event hyperplanes of type (II), we first prune the configuration space to a region intersecting no event hyperplanes of type (I). We then show that the resulting region only intersects event hyperplanes of type (II).
Similar to Section 1, we want an algorithm HyperplaneDecision that computes, for a hyperplane , the maximum and the relative location of the goal placement to . In fact, we will only need to perform HyperplaneDecision on some hyperplanes.
Proposition 5.1.
Suppose is a hyperplane that satisfies one of the following three conditions:
-
(1)
is orthogonal to a vector for some .
-
(2)
is orthogonal to a vector for some .
-
(3)
is orthogonal to a vector for some .
Then, we can perform HyperplaneDecision on in time.
Proof 5.2.
We provide the algorithm for orthogonal to for some , and the other two types follow similarly.
We reinterpret the problem of finding as a polyhedron-polygon matching problem. In , we allow to move freely, and moves in a line perpendicular to . We parameterize by , and form the convex polyhedron (see Figure 6)
By [chazelle1992], can be computed in time. In addition, the cross-section of at is . Then, we see that finding is the same as finding a translation maximizing the intersection of and . By Section 1, this can be done in time.
Using the formal perturbation argument in Lemma 4.3, HyperplaneDecision on can be completed in the same time bound.
Using Proposition 5.1, we can prune the configuration space to a region that intersects no event hyperplanes of type (I) and event hyperplanes of type (II).
Proposition 5.3.
We can compute a 4-polytope of complexity in time such that
-
(1)
the goal placement lies on ,
-
(2)
no hyperplane of type (I) intersects the interior of , and
-
(3)
only event polyhedrons of type (II) passes through .
The hyperplanes of type (II) intersecting the interior of are obtained in the same time bound. Furthermore, the 3-tuples of edges of , and defining the hyperplanes are also obtained in the same time bound.
Proof 5.4.
If a HyperplaneDecision reports a goal placement, we are done. Thus, we assume that HyperplaneDecision always reports a halfspace containing a goal placement.
Each event hyperplane containing an event polyhedron of a vertex of on an edge of or an event polyhedron of a vertex of on an edge of is orthogonal to some . We project all these event hyperplanes into the -flat . Then, the images are groups of parallel lines. We can therefore apply Section 1 to these lines, where an oracle call on a line is running HyperplaneDecision on the hyperplane that projects to on , which is orthogonal to some . Thus, by Proposition 5.1, we can find a triangle whose interior does not intersect any event hyperplane as described above in time.
Similarly, we can find the triangles
corresponding to the other event hyperplanes of type (I) in time. Then, the interior of
does not intersect any event hyperplane of type (I) and contains a goal placement.
Since the interior of intersects no event hyperplane of type (I), the pairwise configuration of and , and , and are fixed (the pairwise edge incidences are fixed). Since any edge of intersects at most two edges of and at most two edges of inside , there are at most four event hyperplanes of type (II) where is concurrent with an edge of and an edge of . Thus, at most event hyperplanes of type (II) intersect the interior of .
In the rest of the section, we fix as in Proposition 5.3. Moreover, let
Proposition 5.5.
Let be any -flat in the configuration space. In time, we can find a point in , or report that is empty.
Proof 5.6.
Notice that is a convex 4-polytope whose face are hyperplanes of type I or type II. Let be a hyperplane of type II intersecting the interior of . Then contains a face of if and only if a polygon is tangent to in . This can be tested in constant time, so we can find all faces of in time. Our problem become a feasibility test of a linear programming of size , which can be solved in time by Megiddo’s algorithm [megiddo1984].
Proof 5.7 (Proof of Section 1).
Take as in Proposition 5.3. Let
Then is unimodal and the maximum of is the goal placement. Given an -flat , we want to compute the maximum of on in time by induction on .
If , this can be done in time by Proposition 4.5. Assume that . Then can be computed in time. Given an -flat , we can use Proposition 5.5 and the perturbation method as in Lemma 4.3 to report the relative position of the maximum over . There are event hyperplane intersecting . Thus, by Lemma 2.4, we can recursively construct -cuttings to give an time algorithm to find the maximum of on .
6. Minimum symmetric difference of two convex polygons under homothety
A homothety is a composition of a scaling and a translation. Let be the scaling factor and be the translation vector of . Then
Define the symmetric difference of sets to be
Let and be convex polygons with vertices in total. We want to find a homothety of that minimizes the area of symmetric difference
where .
Yon et al. [yon2016] consider a slightly more general problem, where they minimize the function
where is some constant. When , this is the area of symmetric difference function. They give a randomized algorithm that solves this problem in expected time. We present a faster determinisitc algorithm by relating this problem to the polyhedron-polygon matching problem and then applying a modified version of Section 1.
As in [yon2016], we rewrite the objective function :
Thus, minimizing is the same as maximizing , where . Consider the cone , where (see Figure 7). Then is negative for so it is never maximized. We also put into by . Since , the problem reduces to maximizing the overlap area of the cone and under translation subtracted by a quadratic function. To show that we can still use a divide-and-conquer strategy, we identify a region where is strictly unimodal.
Lemma 6.1 ([yon2016]).
The closure of the set is convex. Furthermore, is strictly unimodal on .
Proof 6.2.
This follows from [yon2016, Lemma 2.2] and [yon2016, Lemma 2.7].
Although it is difficult to directly compute , note that . With this observation, we show that we can still find the relative position of the set of goal placements to certain planes in time with some modifications to LineDecision and PlaneDecision.
Lemma 6.3.
For any , we can compute or report it is a negative number in time.
Proof 6.4.
If is horizontal, then we can apply Proposition 4.5 since is constant. Otherwise, we parameterize by and construct the convex polyhedron whose cross-section at has area as in the proof of Proposition 4.5. It comes down to maximizing , where is the -coordinate of . Since is a concave function, is also concave, and has the same complexity as . Thus, we can apply [avis1996, Theorem 3.2] to find the maximum of . Supposed it is achieved at . Although may not be where the maximum of is, it tells us whether the maximum is positive. If not, we can simply terminate the process. If it is, we know that intersects , and . This allows us to use divide-and-conquer as in [avis1996], since we can recurse in the direction of whenever we query a point and find .
Proposition 6.5.
Let be a plane. If is horizontal or if intersects the polygon , then we can perform PlaneDecision on in time.
Proof 6.6.
If is horizontal, then we can apply Algorithm 4.2. If the maximum is negative, then we simply report the side of containing , otherwise we proceed as in Lemma 4.3.
Now assume is non-horizontal and intersects . Let . Then we know that . Let be a line we want to run the subroutine LineDecision on. By Lemma 6.3, we can find or report it is negative in time. If it is the latter case, we report the side of containing . Otherwise, intersects , and we can proceed as in Lemma 4.3. Thus, we can still find in time. Since intersects , we can use Lemma 4.3 to complete PlaneDecision on .
Theorem 6.7.
Let and be convex polygons with vertices in total. Suppose is a constant. We can find a homothety that minimizes
in time.
Proof 6.8.
We want to maximize over , where . In order to apply our algorithm for Section 1, we need to show that we only run PlaneDecision on horizontal planes and planes that intersect .
In the first stage (as outlined in Algorithm 4.1), we only run PlaneDecision on horizontal planes.
In the second stage, we apply Section 1 to the groups of lines that are the projections of the lines containing edges of event polygons on the -plane. Observe that these lines all intersect the projection of on the -plane. In each recursive step of our algorithm, we query a horizontal (parallel to the -axis) line and a line that goes “between” two lines in the lines. The planes they represent both satisfy the condition for Proposition 6.5. Then we run PlaneDecision more times to triangulate our feasible region. Here, we make a small modification: instead of maintaining a triangular feasible region, we maintain a trapezoidal one by making horizontal cuts to make the region a trapezoid.
In the third stage, we have a “tube” and event polygons that intersect it. As usual, we recursively construct a -cutting by Lemma 2.4. Chazelle’s algorithm [chazelle1993] picks planes intersecting the target region as the cutting, along with extra planes to triangulate each piece. All the planes containing the event polygons intersect , so we can run PlaneDecision on them. Instead of triangulating our target region, it suffices to reduce it to constant complexity. We do this by cutting it with horizontal planes such that the remaining region only has vertices on two levels. Then, let be any non-horizontal edge. With planes through , we can cut the target region into prisms and pyramids with triangular bases. These planes all intersect since they are between the two faces of the target region containing , and the planes containing them intersect .
Therefore, with slight modifications to Section 1, we obtain a deterministic algorithm for minimizing .
Section 1 follows as a direct corollary of Theorem 6.7.