arXiv:2611.08556cs.CGNov 2026

Manuscript Offprint

arXiv:2611.08556

The Containment Polytope of a Triangle and a Convex Polygon

Yoonsung Choi, Sunghee Choi

Abstract

The containment polytope C\mathcal{C} for a triangle PP and a convex nn-gon QQ is a four-dimensional polytope representing the similarity transforms (translation, rotation, scaling) that place PP inside QQ. While it is known that the complexity of C\mathcal{C} and its silhouette Λ\Lambda, which represents all the largest placements of PP inside QQ for all orientations, can be quadratic in nn, we show that the silhouette can be partitioned into a linear number of planar convex chains and steps in O(nlog⁡n)O(n \log n) time.

Based on the linear number of convex chains and steps, we can compute the complexity of silhouette Λ\Lambda in O(nlog⁡n)O(n \log n) time and query the largest placement of PP inside QQ for a given orientation in O(log⁡n)O(\log n) time. We explain geometrically how the triangle PP rotates while continuously scaling and translating to be maximal inside QQ, leading to a parameterized algorithm for containment problems.

1 Introduction

For a convex mm-gon PP and a convex nn-gon QQ in the plane, it is a natural question to ask (1) whether PP can be placed inside QQ allowing translation and rotation, or, more generally, (2) what is the largest similar copy of PP that can be placed inside QQ allowing translation and rotation.

In 1983, Chazelle [5] gave an O(mn2)O(mn^2)-time algorithm for the first question. When PP is an equilateral triangle or a square, DePano, Ke and O'Rourke [6] gave an O(n2)O(n^2)-time algorithm for the second question. When PP is a general triangle, Sharir and Toledo [9] used parametric search to obtain an algorithm for the second question with running time O(n2log⁡2n)O(n^2 \log^2 n).

In 1998, Agarwal, Amenta and Sharir [1] gave an O(mn2log⁡n)O(mn^2 \log n)-time algorithm to compute the set of all possible placements of PP inside QQ under translation, rotation, and scaling. They followed Baird [3], to represent all similarity transforms (that is, combinations of scaling, rotation, and translation) by quadruples (s,t,u,v)(s,t,u,v) such that (s,t)=(λcos⁡θ,λsin⁡θ)(s,t) = (\lambda \cos \theta, \lambda \sin \theta) represent scaling λ\lambda and rotation θ\theta, while (u,v)(u,v) represents the translation. For (s,t,u,v)∈R4(s,t,u,v) \in \mathbb{R}^4, the corresponding similarity transform is the affine map (x,y)↦(sx−ty+u,tx+sy+v)(x,y) \mapsto (sx - ty + u, tx + sy + v). They define the set C⊂R4\mathcal{C} \subset \mathbb{R}^4 as the set of all similarity transforms π\pi such that πP⊆Q\pi P \subseteq Q.

We have πP⊆Q\pi P \subseteq Q if and only if all mm vertices of PP lie inside all the nn halfplanes that define the convex polygon QQ. For vertex vi=(xi,yi)v_i = (x_i, y_i) of PP and halfplane hj:ajx+bjy⩽1h_j : a_j x + b_j y \leqslant 1 of QQ, we have πvi∈hj\pi v_i \in h_j if and only if

aj(sxi−tyi+u)+bj(txi+syi+v)⩽1,a_j(sx_i - ty_i + u) + b_j(tx_i + sy_i + v) \leqslant 1,

which is a linear inequality in the four variables (s,t,u,v)(s,t,u,v). It follows that the set C\mathcal{C} is the four-dimensional convex polytope obtained as the intersection of mnmn half-spaces. We call C\mathcal{C} the con-tainment polytope of PP and QQ. The authors of [1] show that the complexity of the containment polytope is Θ(mn2)\Theta(mn^2).

If we project C\mathcal{C} onto the stst-plane, we obtain a two-dimensional convex polygon F\mathcal{F}. Scaling and rotation are the polar coordinates of this plane, which means that PP can be scaled by λ\lambda and rotated by θ\theta and placed in QQ if and only if (s,t)=(λcos⁡θ,λsin⁡θ)∈F(s,t)=(\lambda\cos\theta,\lambda\sin\theta)\in\mathcal{F}.

For an angle θ\theta, let us define PθP_\theta as PP rotated counter-clockwise by angle θ\theta around the origin. We next define λ(θ)\lambda(\theta) as the largest scaling factor such that λ(θ)Pθ\lambda(\theta)P_\theta can be placed inside QQ. From the above, it follows that the boundary of F\mathcal{F} is a representation of the function θ↦λ(θ)\theta\mapsto\lambda(\theta). The maximum is necessarily attained at a vertex of F\mathcal{F}. The authors of [1] show how to compute the vertices of C\mathcal{C}, and therefore of F\mathcal{F}, in O(mn2log⁡n)O(mn^2\log n) time, thus solving problem (2). They also construct convex polygons PP and QQ such that the containment polytope has Θ(mn2)\Theta(mn^2) complexity.

This lower bound was strengthened by the authors of [2], who, for every mm and nn construct convex polygons PP and QQ such that the projection F\mathcal{F} has complexity Θ(mn2)\Theta(mn^2). For m=3m=3, PP can even be chosen as the equilateral triangle. This implies that the function θ↦λ(θ)\theta\mapsto\lambda(\theta) does have complexity Θ(mn2)\Theta(mn^2). Various authors [5, 7, 1, 2] have taken this as an indication that solving problem (2) will require time Ω(mn2)\Omega(mn^2), even in the case of triangular PP.

Nevertheless, in 2024, Chan and Hair [4] achieved a break-through: they presented an O(n polylog n)O(n\text{ polylog }n)-time algorithm for problem (2) when PP is a triangle, making use of parametric search and divide-and-conquer to avoid having to look at all vertices of F\mathcal{F}. They extend this to an O(mO(1/ε)n1+ε)O(m^{O(1/\varepsilon)}n^{1+\varepsilon})-time algorithm (for any ε>0\varepsilon>0) when PP is a convex mm-gon

In some situations one is actually interested in other aspects of the function θ↦λ(θ)\theta\mapsto\lambda(\theta). The interest of [2] was to answer a question paused by Pál [8] in his work on Kakeya's problem: given two convex shapes (not necessarily polygons) PP and QQ and knowing that for every θ\theta, PθP_\theta can be placed in QQ, is it then true that PP can be rotated through 360∘360^\circ inside QQ? The paper shows that this is indeed true, and proves the following theorem (which for the polygonal case easily follows from the description using the containment polytope C\mathcal{C}):

Theorem 1 ([2]). For any convex shapes PP and QQ, there exists a continuous function τ:[0,2π]→R2\tau:[0,2\pi]\to\mathbb{R}^2 such that λ(θ)Pθ+τ(θ)⊆Q\lambda(\theta)P_\theta+\tau(\theta)\subseteq Q.

We can now formulate a third problem on the convex polygons PP and QQ: (3) find the largest scaling λ\lambda of PP such that λP\lambda P can be rotated through 360∘360^\circ inside QQ. Solving this problem requires finding the minimum of λ(θ)\lambda(\theta).

The function θ↦(λ(θ),τ(θ))\theta\mapsto(\lambda(\theta),\tau(\theta)) corresponds to the silhouette Λ\Lambda of the containment polytope C\mathcal{C}, that is, those edges of C\mathcal{C} that project onto the edges of F\mathcal{F}. The silhouette forms a closed loop in R4\mathbb{R}^4.

In this paper, we will study the geometry of the triangle λ(θ)Pθ+τ(θ)\lambda(\theta)P_\theta+\tau(\theta) as θ\theta rotates through 360∘360^\circ, in other words, as we trace the silhouette Λ\Lambda (see Figure 1).

Throughout the paper, we will assume that the containment polytope C\mathcal{C} is in general position. Specifically we require that it has no vertical faces, and that its defining hyperplanes are in general position: no three hyperplanes intersect in a plane, no four in a line, and no five in a point. The first condition ensures that the silhouette Λ\Lambda is indeed a closed polygonal chain consisting of edges (and does not include two-dimensional faces). This condition holds when QQ has no parallel edges. The second condition ensures that at every placement of the triangle λ(θ)Pθ+τ(θ)\lambda(\theta)P_\theta+\tau(\theta) on an edge of Λ\Lambda, we have exactly three incidences between vertices of PP and edges of QQ, and at every vertex of Λ\Lambda, we have exactly four such incidences. Geometrically, this assumption means that there is no scaled placement of PP in QQ with all vertices on the boundary of QQ and two vertices on vertices of QQ.

Figure

Figure 1: The triangles λ(θ)Pθ+τ(θ)\lambda(\theta)P_\theta + \tau(\theta) as we rotate through 360∘360^\circ.

Without these two assumptions, our proofs would need additional technical complications that we currently do not know how to handle.

To avoid confusion between the vertices and edges of PP and QQ on one side and of C\mathcal{C} on the other side, we will call the edges of the silhouette Λ\Lambda steps, and the vertices of Λ\Lambda pivots. We will also call the vertices of PP corners to avoid confusion with the vertices of QQ.

For an angle θ\theta, let P(θ)\mathcal{P}(\theta) be the unique largest placement of PθP_\theta in QQ, that is P(θ)=λ(θ)Pθ+τ(θ)\mathcal{P}(\theta) = \lambda(\theta)P_\theta + \tau(\theta), and let aθ,bθ,cθa_\theta, b_\theta, c_\theta be the vertices a,b,ca, b, c, respectively, of P(θ)\mathcal{P}(\theta).

A perfect rotation from θ1\theta_1 to θ2\theta_2 is the set P[θ1,θ2]={P(θ)∣θ1⩽θ⩽θ2}\mathcal{P}[\theta_1, \theta_2] = \{\mathcal{P}(\theta) \mid \theta_1 \leqslant \theta \leqslant \theta_2\}. A perfect rotation corresponds to a subpath of the silhouette Λ\Lambda. We naturally extend this notation to open and half-open intervals, P(θ1,θ2)\mathcal{P}(\theta_1, \theta_2), P[θ1,θ2)\mathcal{P}[\theta_1, \theta_2), P(θ1,θ2]\mathcal{P}(\theta_1, \theta_2], by excluding the corresponding endpoints. We call P[0,2π]\mathcal{P}[0, 2\pi] (the entire silhouette) the global perfect rotation. Throughout the paper, if we say P(θ)\mathcal{P}(\theta) rotates, this means that P(θ)\mathcal{P}(\theta) undergoes an perfect rotation inside QQ in counter-clockwise direction.

For a given pivot σ\sigma, we define the next pivot σ′\sigma' of σ\sigma as the smallest pivot strictly larger than σ\sigma. Then, the perfect rotation P[σ,σ′]\mathcal{P}[\sigma, \sigma'] corresponds to a step of Λ\Lambda.

We start by showing that along a single step of Λ\Lambda, the triangle PP performs a perfect rotation with center pp (See Figures 2 and 3 for illustrations).

Theorem 2. Let PP be a triangle and QQ a convex polygon in general position, and consider a single step P[σ,σ′]\mathcal{P}[\sigma, \sigma'] of the silhouette Λ\Lambda. While the triangle P(θ)\mathcal{P}(\theta) moves along this step, it performs a perfect rotation around a center pp (which can lie outside of QQ), scaling around pp to remain in contact with the same edges of QQ.

On a single step of Λ\Lambda, the same three corner-edge incidences between PP and QQ hold. This means that either all three corners of PP lie (in the relative interior) of the same three edges of QQ, or one corner is fixed at a vertex of QQ, one other corner moves in (the relative interior) of an edge of QQ, and the third corner moves along a line in the interior of QQ.

Figure

Figure 2: The perfect rotation when the center lies inside Q.

Figure

Figure 3: The perfect rotation when the center lies outside Q.

When all three corners move on edges of QQ, then either all three corners move counter-clockwise along ∂Q\partial Q (Figure 2), or one moves clockwise while the other two move counter-clockwise (Figure 3). The two cases depend on the center of perfect rotation in Theorem 2 lying inside QQ or not. We will say that a corner moves forward if it moves counter-clockwise or is stationary, backward if it moves clockwise.

We can therefore classify the steps of Λ\Lambda into ten different types: let T[σ,σ′]\mathcal{T}[\sigma, \sigma'] be the type of step P[σ,σ′]\mathcal{P}[\sigma, \sigma']. Then, T[σ,σ′]\mathcal{T}[\sigma, \sigma'] is

  • type fwf_w when all three corners of P(θ)\mathcal{P}(\theta) lie on ∂Q\partial Q and move forward during the step;

  • type ara_r when corner aθa_\theta moves backward during the step;

  • type aba_b when corner aθa_\theta is at a vertex of QQ, corner bθb_\theta moves on an edge of QQ, and corner cθc_\theta lies in the interior of QQ during the step;

  • type aca_c when corner aθa_\theta is at a vertex of QQ, corner cθc_\theta moves on an edge of QQ, and corner bθb_\theta lies in the interior of QQ during the step;

  • and types br,bc,ba,cr,ca,cbb_r, b_c, b_a, c_r, c_a, c_b are defined analogously.

We will see that the type of a step depends entirely on the angles formed by the lines supporting the edges of QQ involved in the step's corner-edge incidences.

We then study in detail what happens at a pivot, that is, when we move from one step of the silhouette to the next. At a pivot, we add an additional corner-edge incidence to the three incidences from the previous step, and then go on to the next step where one of the original three incidences no longer holds. This means that at a pivot, we have four corner-edge incidences, so at least one corner must coincide with a vertex of QQ. We distinguish 2-pivots, where two corners lie at vertices of QQ (the third corner is then necessarily in the interior of QQ), and 3-pivots, where only one corner lies at a vertex, while the other two corners lie in the relative interior of edges of QQ.

In Section 4 we study in detail how the type of the step before and the step after the pivot relate.

Theorem 3. Let PP be a triangle and QQ a convex polygon in general position, and consider the pivot σ\sigma between steps P[σ0,σ]\mathcal{P}[\sigma^0, \sigma] and P[σ,σ′]\mathcal{P}[\sigma, \sigma'] of the silhouette Λ\Lambda. Figure 4 shows the pairs of types T[σ0,σ]\mathcal{T}[\sigma^0, \sigma] and T[σ,σ′]\mathcal{T}[\sigma, \sigma'] that can occur, with the color of the arrow indicating which corner of P(σ)\mathcal{P}(\sigma) changes its corner-edge incidence.

We next define a chain to be a sequence of steps such that all pivots of the chain are 3-pivots and such that on all steps of the chain the same two corners of PP lie on the same two edges of QQ. This immediately implies that these steps form a convex chain of Λ\Lambda inside a two-dimensional plane of R4\mathbb{R}^4.

Our main theorem states that there is a decomposition of the silhouette into a linear number of chains and a linear number of single steps.

Theorem 4. Let PP be a triangle and QQ a convex polygon in general position. Then the silhouette Λ\Lambda of C\mathcal{C} can be decomposed into O(n)O(n) chains and single steps. This subdivision can be computed in O(nlog⁡n)O(n \log n) time.

To prove the Theorem 4, we define a stride which consists of constant number of chains and steps, and partition the global perfect rotation into linear number of strides in Section 6. The proof relies heavily on the diagram of Figure 4.

Figure

Figure 4: Possible pairs of types, with arrows from e1e_1 to e2e_2.

Since we obtain a linear number of strides that cover the global perfect rotation sorted in counter-clockwise order with respect to the angle, the chains and steps from Theorem 4 are also sorted in counter-clockwise order. Then, for a given angle ψ\psi, we can find which chain or step contains P(ψ)\mathcal{P}(\psi) in O(log⁡n)O(\log n) time using binary search, in other words, we can find the three corner-edge incidences of P(ψ)\mathcal{P}(\psi). Based on this fact, we compute the placement of P(ψ)\mathcal{P}(\psi) in O(log⁡n)O(\log n) time.

Additionally, for each chain and step, the number of pivots contained within them can be computed in O(log⁡n)O(\log n) time. Thus, the complexity of silhouette Λ\Lambda can be computed in O(nlog⁡n)O(n \log n) time. Since we will present that each step can be computed in O(log⁡n)O(\log n) time, we obtain an O(klog⁡n)O(k \log n)-time algorithm to solve the problem (2) and (3) where k is the complexity of silhouette Λ\Lambda.