# The Largest Quadrilateral in a Convex Polygon

We present a simple linear-time algorithm for finding the quadrilateral of largest area contained in a convex polygon.

## Authors

• 10 publications
05/27/2019

### The Largest Contained Quadrilateral and the Smallest Enclosing Parallelogram of a Convex Polygon

We present a linear-time algorithm for finding the quadrilateral of larg...
12/07/2019

### Covering Polygons by Min-Area Convex Polygons

Given a set of disjoint simple polygons σ_1, ..., σ_n, of total complexi...
12/13/2020

### Largest similar copies of convex polygons amidst polygonal obstacles

Given a convex polygon P with k vertices and a polygonal domain Q consis...
04/23/2021

### Finding a Largest-Area Triangle in a Terrain in Near-Linear Time

A terrain is an x-monotone polygon whose lower boundary is a single line...
10/19/2019

### Maximum-Area Rectangles in a Simple Polygon

We study the problem of finding maximum-area rectangles contained in a p...
11/26/2020

### Disjoint Stable Matchings in Linear Time

We show that given a SM instance G as input we can find a largest collec...
04/16/2018

### k-Maximum Subarrays for Small k: Divide-and-Conquer made simpler

Given an array A of n real numbers, the maximum subarray problem is to f...
##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

A linear-time algorithm for the largest quadrilateral contained in a convex polygon was proposed in 1979 by Dobkin and Snyder [3]. This algorithm stood until 2017, when Keikha, Löffler, Mohades, Urhausen, and van der Hoog [4] constructed a counterexample for which it fails.

A simple linear-time algorithm for the smallest parallelogram enclosing a convex polygon was published in a technical report by Schwarz, Teich, Welzl, and Evans [8] in 1994, see also [7].

We will show that the two problems are closely related, in particular when they are constrained by anchoring them to some specified direction. The solution of one problem provides an optimality certificate for the other problem. We present a conceptually simple algorithm that treats both problems in a symmetric way and solves them simultaneously in linear time. The algorithm is based on the “rotating calipers” technique from the early days of computational geometry. Proofs are included, so that there can be no doubts about its correctness.

The algorithm becomes very simple when specialized for solving only one of the two problems, see Appendices C and B. Linear-time algorithms for the largest quadrilateral were independently found in 2018 by Vahideh Keikha (personal communication, manuscript in preparation) and by Kai Jin (personal communication, manuscript previously submitted to a conference), and they are essentially the same as the algorithm given here. According to [1], a linear-time solution is given in unpublished notes of Michael Shamos from 1974 [9]. Given that the solution is so simple, this is plausible, but I have not been able to confirm it.

While the algorithms that we develop were known, the observation that the two problems are so closely connected (Lemma 2) appears to be new. A similar dual connection between the anchored versions of two problems exists between the largest contained and the smallest enclosing triangle. This connection was first noted and exploited in the linear-time algorithm of Chandran and Mount [2] for these problems, see also [6, Lemmas 4.i and 14] for a slightly more stringent treatment in the style of Lemma 2.

## 2 Conjugate Pairs

A direction

is given by a nonzero vector

. Parallel vectors represent the same direction, and opposite directions are considered equal. Directions are conveniently parameterized by the polar angle : .

We denote the quadrilateral contained in conventionally by its four corners . For the parallelogram that surrounds , it will be better to denote it by the four sides , leaving the corners anonymous, see Figure 1.

###### Definition 1.
1. A quadrilateral is D-anchored to if the diagonal is parallel to .

2. A parallelogram is S-anchored to if the two sides and are parallel to .

The letter D stands for “diagonal”, and S stands for “side”. We will sometimes just say “anchored” if it is clear from the context which version we mean.

###### Definition 2.

Let be a quadrilateral, and let be a parallelogram. We say that and are conjugate, or form a conjugate pair, if

1. the diagonal is parallel to the sides and , and

2. each corner of lies on the corresponding side of .

Because of the first condition, the two elements and of a conjugate pair are anchored to the same direction. Because of the second condition, is a convex quadrilateral contained in . It is possible that degenerates to a triangle because it is not necessarily strictly convex, and it may even happen that some corners coincide.

The following basic geometric lemma considers a conjugate pair in isolation and proves some optimality properties of and with respect to each other.

###### Lemma 1.
1. Let be a parallelogram, S-anchored to some direction . Then a quadrilateral  that is contained in and is D-anchored to is a largest quadrilateral with these properties if and only if is a conjugate pair.

2. Let be a quadrilateral, D-anchored to some direction . Then a parallelogram  that contains and is S-anchored to is a smallest parallelogram with these properties if and only if is a conjugate pair.

3. If is a conjugate pair, the area of is twice the area of .

###### Proof.

See Figure 1. Since and are required to be anchored to the same direction, the first condition for a conjugate pair is always satisfied. The question is whether the four sides of are incident to the four corresponding corners of .

Let denote the length of the two sides of that are parallel to . Then, given that the diagonal should be parallel to and contained in , it is clear that

 |AC|≤|b|=|d|,

with equality if and only if the sides and touch and .

Moreover, if is contained in , the distance between and , when projected to the direction perpendicular to , is at most the distance between the lines through and :

 ∣∣u⊥⋅(D−B)∣∣≤w,

with equality if and only if the sides and touch and .

(a) The quadrilateral  is composed of the triangles and , which share the common base . Therefore, the area of is expressed in terms of the heights and of these triangles as

 12|AC|×(hABC+hACD)=12|AC|×∣∣u⊥⋅(D−B)∣∣≤12|b|w, (1)

and we have just seen that equality holds if and only if the four sides of touch the corresponding corners of . This proves (a). The area of the parallelogram is

 |b|w=|d|w, (2)

which equals twice the area of in (1), and this proves (c).

To prove (b), we use (1) in the other direction, giving a lower bound on the area (2) of any anchored parallelogram containing . Again, since equality in (1) holds if and only if and are conjugate, (b) has been proved. ∎

The following crucial lemma gives the optimality condition for the anchored versions of the two problems.

###### Lemma 2 (Characterization of Optimality by Conjugate Pairs).

Let be a convex polygon in the plane, and let be a direction.

1. A quadrilateral that is D-anchored to and contained in is a largest quadrilateral with these properties if and only if there is a parallelogram containing that is conjugate to .

2. A parallelogram enclosing and S-anchored to is a smallest parallelogram with these properties if and only if there is a quadrilateral contained in that is conjugate to .

###### Proof of sufficiency..

In both cases, there is a conjugate pair such that the convex region is sandwiched between them: .

a) By Lemma 1a, is even the largest D-anchored quadrilateral inside the larger region . Thus, there cannot be a larger anchored quadrilateral in .

b) By Lemma 1b, is even the smallest S-anchored parallelogram that encloses the smaller region . Thus, there cannot be a smaller anchored parallelogram enclosing . ∎

Necessity of the conditionsis not needed for the correctness of our algorithm, and it will only be proved later as an easy consequence of Lemma 4, see page 5. Alternatively, there are easy direct proofs (cf. [8, Lemma 2]), even for arbitrary convex regions.

The lemma is also a manifestation of linear programming duality, since the problem of finding the longest chord

with a given direction can be formulated as a linear program.

## 3 Constructing all Conjugate Pairs in Linear Time

The idea is to construct conjugate pairs with for all directions in the range . By the sufficient criterion of Lemma 2, these are largest anchored contained quadrilaterals and smallest anchored enclosing parallelograms. Hence, the overall largest contained quadrilaterals and smallest enclosing parallelograms will be among them.

The following straightforward observation separates the task of finding an anchored conjugate pair into two subtasks. The first involves , , , and , and it is concerned with the direction of the diagonal . The other task involves , , , and , and it is concerned with the direction of the sides and . A pair of points on the boundary of a convex region that admits parallel supporting lines is called antipodal.

###### Lemma 3.

Let be a convex region in the plane and be a direction. A conjugate pair with and anchored to is found as follows, see Figure 2. Here, the parallelogram  is defined by two pairs of parallel lines and :

1. is an antipodal pair of parallel to , with supporting lines and ,

2. and are the two opposite lines of support parallel to , and and are points where these lines touch . (Thus, is also an antipodal pair.)

As stated in the following lemma, whose proof will be given in Section 5, both tasks can easily be carried out with the classical rotating-calipers technique. We assume that is a convex polygon, given by the ordered list of its vertices.

###### Lemma 4.
1. In time, one can find a sequence of direction angles , and a corresponding sequence of vertex-edge pairs , such that for any  in each closed interval , an antipodal segment parallel to can be found by intersecting the line through parallel to with the edge . The lines parallel to through and are the corresponding supporting lines.

2. In time, one can find a sequence of direction angles , and a corresponding sequence of antipodal pairs of vertices , with , such that for any in each closed interval , the lines through and parallel to the direction are supporting lines.

We remark that the sequence does not necessarily include every pair of antipodal vertices: For each pair of opposite parallel edges of , there are two pairs of antipodal vertices which admit parallel supporting lines of only one direction. These pairs don’t appear in the list.

It is now clear how to proceed with the help of Lemma 4. Since the areas of a conjugate pair are related by Lemma 1c, let us ignore the enclosing parallelograms and concentrate on the inner quadrilaterals . We merge the lists of breakpoints and and obtain a list of intervals such that in each interval, there are largest anchored quadrilaterals with a fixed structure: The points and are fixed vertices. On the diagonal , one point, say , is fixed to a vertex , while the other point moves on a fixed edge .

In a quadrilateral with one moving point , the area is a linear function of . As increases, the corner moves monotonically on some edge , and therefore, the extremes are attained at the endpoints of the interval. We thus just need to evaluate the area at all interval endpoints and of the merged sequence and pick the largest or smallest one. Since each endpoint belongs to two intervals, the quadrilateral  prescribed by Lemma 4 may be ambiguous, but this does not matter. All these quadrilaterals have the same area.

###### Theorem 5.
1. The quadrilateral of largest area contained in a convex polygon can be found in linear time.

2. The parallelogram of smallest area enclosing a convex polygon can be found in linear time. ∎

Pseudocode for the algorithm is given in Appendix A, and prototype implementations of the algorithms in Appendices C, B and A in Python are contained in the source files of this preprint.

## 4 Discussion

It is perhaps instructive to reflect on some features of this algorithm and compare it to other approaches. An easy property of largest quadrilaterals (in fact, largest -gons for any ) contained in a polygon  is the vertex property: Their corners must be vertices of . Our algorithm does not use this property at all. It considers an infinite family of quadrilaterals. Even after reducing them to a discrete set of directions (the interval endpoints and ), many of these candidates don’t fulfill the vertex property. Most previous algorithms for largest contained -gons, and in particular, the algorithms of Dobkin and Snyder [3], consider only -gons with the vertex property. By concentrating on the vertex property too early, one may miss useful avenues to finding good and simple algorithms.

We may of course still use the vertex property as an “afterthought” to introduce shortcuts and simplify the algorithm. For example, once the point lies in the middle of an edge, one can skip the area computations and fast-forward until arrives at a vertex. (For the problem of the largest contained triangle, the analogous step is described in [6, Section 8].)

There are other possible simplifications. The two lists of breakpoints and need not be computed separately in advance. They can be generated on the fly as they are processed, after an appropriate initialization. We have described the algorithm in terms of angles for convenience. When implementing the algorithm on a computer, it is better to avoid angle calculations and use direct comparisons of vector directions or signed areas, see Section A.1. (Anyway, since the problem is invariant under affine transformations, angular quantities are not really suited to the problem.)

In Appendix B, we show the whole simplified algorithm for the largest contained quadrilateral. This algorithm is actually so simple that one can as well derive it directly from the property that must form an antipodal vertex pair, without going through the continuous family . The same remark holds for the smallest enclosing parallelogram. Appendix C shows a variation of the algorithm following [8] that is just as simple.

## 5 Rotating Calipers

###### Proof of Lemma 4.

For part (a), we need antipodal points for all directions. An algorithm for listing all antipodal pairs of vertices of a convex polygon is given in [5, Section 4.2.3]. We just need to “fill the gaps” in order to get antipodal pairs for a continuous range of directions

Let and be two opposite lines of support in direction , see Figure 3. We will increase from to and maintain the points and where they touch . Since we want these points to move continuously, we parameterize the process by a new parameter , where it the combined distance moved by and along the boundary of since the beginning. We start with and as the lowest and highest points of . In case of ties, we take the leftmost lowest and the rightmost highest point. Figure 3a shows and the distances and moved by and , from which is computed as .

Now we start to increase . Whenever is parallel to an edge of , we continuously advance or to the other endpoint of this edge, increasing while leaving constant. If has two sides parallel to , we arbitrarily use the convention that we first advance and then . Now, and are ready to tilt around the vertices and , increasing while remains constant, until or hits the next edge.

We continue this process in a loop until . At this point, and have swapped places, and equals the perimeter of . The segment has completed a rotation by .

The points and move continuously in counterclockwise direction as a function of , and for every , the points and are antipodal, as witnessed by supporting lines and . Thus we have achieved our primary goal of finding an antipodal pair for every direction.

The parameter range of is decomposed into intervals where remains stationary, remains stationary, or both points remain stationary. We cut out those intervals where none of the points move. For the remaining intervals, we choose yet another parameterization, namely by the direction pointing from to .

Each of the remaining intervals is characterized by one stationary point, , while the other point moves on a fixed edge, . If is the direction pointing from to , The breakpoints and are the directions at the end of the intervals, when both and are at vertices. It only remains to rearrange the interval breakpoints cyclically modulo in order to start with . Since each interval advances either or by one vertex and and together make a full tour around , the number of interval breakpoints is .

Part (b) of the lemma is straightforward. In fact, it can be obtained by the same circular sweep as above, with the straightforward parameterization by the angle , concentrating only on the points and where the supporting lines in direction touch . (These points will take the roles of and in the lemma.)

The breakpoint directions are therefore the directions where or jumps. These are the directions for which is parallel to some edge of . There are at most such angles. The sequence is obtained by merging the two lists of edge directions obtained from traversing the left boundary of and the right boundary of counterclockwise, between the extreme points in vertical direction. ∎

###### Proof of necessity in Lemma 2..

a) Assume that is a largest quadrilateral that is D-anchored to and contained in . Lemma 4 together with Lemma 3 implies that, for this direction , there exists an anchored conjugate pair with . By the sufficiency part of Lemma 2, which has already been proved, is a largest anchored quadrilateral contained in , and therefore of the same area as . By Lemma 1a, is even a largest anchored quadrilateral contained in the larger area . By the necessity statement in the same lemma, since is also contained in , can only have the same area as if it forms a conjugate pair with . This proves the necessity for Part (a). The proof of Part (b) is completely analogous. ∎

## References

• [1] James E. Boyce, David P. Dobkin, Robert L. (Scot) Drysdale III, and Leo J. Guibas. Finding extremal polygons. SIAM J. Computing, 14(1):134–147, 1985.
• [2] Sharat Chandran and David M. Mount. A parallel algorithm for enclosed and enclosing triangles. International Journal of Computational Geometry & Applications, 2(2):191–214, 1992.
• [3] David P. Dobkin and Lawrence Snyder. On a general method for maximizing and minimizing among certain geometric problems. In 20th Annual Symposium on Foundations of Computer Science, pages 9–17. IEEE, 1979.
• [4] Vahideh Keikha, Maarten Löffler, Ali Mohades, Jérôme Urhausen, and Ivor van der Hoog. Maximum-area triangle in a convex polygon, revisited. Preprint, 2017. arXiv:1705.11035v2.
• [5] Franco P. Preparata and Michael Ian Shamos. Computational Geometry. An Introduction. Springer, 1985.
• [6] Günter Rote. The largest inscribed triangle and the smallest circumscribed triangle of a convex polygon: An overview of linear-time algorithms. Class notes, June 2019.
• [7] Christian Schwarz, Jürgen Teich, Alek Vainshtein, Emo Welzl, and Brian L. Evans. Minimal enclosing parallelogram with application. In Proceedings of the Eleventh Annual Symposium on Computational Geometry, SoCG’95, pages 434–435, New York, NY, USA, 1995. ACM.
• [8] Christian Schwarz, Jürgen Teich, Emo Welzl, and Brian L. Evans. On finding a minimal enclosing parallelogram. Technical Report TR-94-036, International Computer Science Institute (ICSI), August 1994.
• [9] Michael Ian Shamos. Problems in computational geometry. Manuscript, 1974–1977.

## Appendix A The Algorithm in Pseudocode

For completeness, we give the pseudocode for our algorithm. We assume that the convex polygon is given by the ordered list of its vertices in counterclockwise order. We assume that , and we look for a largest contained quadrilateral  in counterclockwise order, and a smallest enclosing parallelogram, also in counterclockwise order. Indices of polygon vertices are considered modulo .

In contrast to the algorithm that is sketched in Section 3, we don’t start with , but we start more conveniently with the antipodal pair defined by and the point opposite to the edge .

### a.1 Primitive Operations

The basic predicate of this algorithm is a comparison between two directions and , which can be calculated with only two multiplications as the sign of a determinant that expresses the signed area of the parallelogram spanned by and :

 det(u,v):=∣∣∣x1x2y1y2∣∣∣=x1y2−x2y1=−det(v,u)

This is positive if lies counterclockwise from . The area of a quadrilateral is .

Frequently, the algorithm makes comparisons between triangle areas over a common basis. This should also be calculated as a determinant. For example, if the two triangles are oriented counterclockwise. Since we find the formulation involving triangle areas geometrically more appealing, we have not replaced it in our pseudocode.

### a.2 Largest and smallest anchored quadrilaterals

###### Lemma 6 ([8, Lemma 1]).

There is a smallest enclosing parallelogram  such that

1. at least one of the sides and touches an edge of , and

2. at least one of the sides and touches an edge of .

###### Proof.

A smallest enclosing parallelogram  must be a smallest enclosing parallelogram anchored to the direction of and , and hence there must be a conjugate pair , see Figure 2. If the side or doesn’t already touch an edge of , these sides can be tilted around and without changing the area, until one of the sides hits an edge of .

Afterwards, we can apply the same argument to the direction of and and ensure that or touches an edge of . ∎

As a consequence of part 2, when looking for the smallest enclosing parallelogram, it is sufficient to look at parallelograms that are S-anchored to the directions of the edges of . We have already mentioned that a largest contained quadrilateral can be found among those quadrilaterals that use only vertices of . Thus it is sufficient to look at anchored quadrilaterals for which and lie at vertices. This explains the places where areas are compared against the current minimum or maximum in the following program.

### a.3 Pseudocode

 a0:=a:=1 c:=2 while areapapa+1pc+1>areapapa+1pc: c0:=c:=c+1 (find the point pc with supporting line parallel to papa+1.) next\_AC:=A'' (The corner A slides on the edge papa+1.) uAC:=pc−pa+1 (the direction u where A hits the next vertex) b:=a while areapcpapb+1>areapcpapb: b:=b+1 (find the point pb with supporting line parallel to papc.) d:=c while areapapcpd+1>areapapcpd: d:=d+1 (find the other point pd with supporting line parallel to papc.) if areapbpb+1pd+1≤areapbpb+1pd: next\_BD:=B'' (The parallelogram side b hits an edge of P before d does.) uBD:=pb+1−pb else: next\_BD:=D'' (The parallelogram side d hits an edge of P before b does.) uBD:=pd−pd+1 maxarea:=0 (the area of the largest contained quadrilateral) minarea:=∞ (the area of the smallest enclosing parallelogram) repeat if det(uBD,uAC)≥0: (The parallelogram side b or d touches an edge of P.) if next\_AC=A'': construct the point A on the line papa+1 such that pcA is parallel to uBD (∗) minarea:=min{minarea,2⋅areaApbpcpd} else: construct the point C on the line pcpc+1 such that paC is parallel to uBD (∗∗) minarea:=min{minarea,2⋅areapapbCpd} if next\_BD=B'': b:=b+1 else: d:=d+1 if areapbpb+1pd+1≤areapbpb+1pd: next\_BD:=B'' (The parallelogram side b hits an edge of P before d does.) uBD:=pb+1−pb else: next\_BD:=D'' (The parallelogram side d hits an edge of P before b does.) uBD:=pd−pd+1 else: (The sliding corner A or C reaches a vertex of P.) if next\_AC=A'': a:=a+1 else: c:=c+1 maxarea:=max{maxarea,areapapbpcpd} if areapapa+1pc+1≤areapapa+1pc: (Which of A and C slides on an edge of P?) next\_AC:=A'' (The corner A slides on the edge papa+1.) uAC:=pc−pa+1 (the direction u where A hits the next vertex) else: next\_AC:=C'' (The corner C slides on the edge pcpc+1.) uAC:=pc+1−pa (the direction u where C hits the next vertex) until (a,c)=(c0,a0)

The area of in line () can be computed by the formula

 ±12⋅det(pa+1−pa,pc−pa)⋅det(uBD,pd−pb)det(pa+1−pa,uBD),

and for the area of in (), we replace by in two places.

## Appendix B The Largest Contained 4-Gon

We give here the specialized algorithm for computing the area of the largest 4-gon contained in a convex polygon .

In contrast to the algorithm that is sketched in Section 3, and also differently from Section A.3, we start as in Section 5 with the points and that have horizontal supporting lines, see Figure 3. Let be the leftmost vertex among the lowest vertices of Let be the rightmost vertex among the highest vertices of repeat while : (find the point with supporting line parallel to .) while : (find the other point with supporting line parallel to .) } if : (advance to the next antipodal pair) else: until The main loop is driven by the antipodal pair . In each iteration, either or is advanced to the next vertex. This is essentially the program for reporting all antipodal pairs of vertices from [5, Section 4.2.3], except that we need not be careful about getting all such pairs if has parallel edges. In the two inner loops, the points and that are farthest from the line are updated.

## Appendix C The Smallest Enclosing Parallelogram According to Schwarz, Teich, Welzl, and Evans [8]

The algorithm of Schwarz et al. [8] is similar in spirit to our algorithm in constructing a sequence of parallelograms by advancing the direction to which and are parallel, following the rotating-calipers technique. They also sketch an application of smallest enclosing parallelograms to signal compression [8, Section 4], and the appendix gives details about a C++ implementation.

There is one difference in the setup. We explain it with our notation: By Lemma 6 ([8, Lemma 1]), it suffices to look for parallelograms where at least one of the sides and touches a whole edge of , and at least one of the sides and touches a whole edge of . This means that two adjacent parallelogram sides must touch edges of . Now, the algorithm of [8] only considers those anchored parallelograms where these two sides are and , like in Figure 4a. This restriction is compensated by sweeping over an angular range of instead of .

Figure 4 illustrates a few steps of the algorithm. After finding the parallelogram of Figure 4a and computing its area, the algorithm of Section A.3, when specialized for the smallest containing parallelogram, would next look at the parallelogram of Figure 4b. This parallelogram is skipped in Schwarz et al. [8] at this point, but this omission is no mistake: This parallelogram was already considered before with rotated labels, when touched and touched . The next parallelogram is not shown: touches the edge and touches . This parallelogram is also skipped by Schwarz et al. [8] at this point, but it is considered later when touches and touches . Figure 4b shows the next parallelogram. It is a largest S-anchored parallelogram when the side is anchored, but it is not a largest S-anchored parallelogram when the side is anchored, because the dashed antipodal pair is not parallel to and . Hence it cannot be a largest enclosing parallelogram. The algorithm of Schwarz et al. [8] skips this parallelogram and does not consider it at all.

This setup makes the algorithm simple and elegant: Most case distinctions of Section A.3 can be eliminated, together with the flags next_AC and next_BD. Like in Section B, the algorithm can be structured into two nested loops. The outer loop iterates over the edges of through which goes, and the inner loop updates the antipodal pair parallel to the direction of .

 b:=1; c:=2; d:=2; a:=3 while areapcpc+1pa+1>areapcpc+1pa: (initialization) a:=a+1 (find the opposite point pa with supporting line parallel to pcpc+1) minarea:=∞ for b:=1..n: while areapbpb+1pd+1>areapbpb+1pd: d:=d+1 (update the point pd opposite to pbpb+1) while areapbpb+1pa>areapbpb+1pc+1: c:=c+1 (search for antipodal pair AC parallel to u=pbpb+1, with C on an edge) while areapcpc+1pa+1>areapcpc+1pa or (areapcpc+1pa+1=areapcpc+1pa and areapbpb+1pa+1≥areapbpb+1pc): a:=a+1 (update the point pa opposite to pcpc+1) if areapbpb+1pa≥areapbpb+1pc: construct the point C on the line pcpc+1 such that paC is parallel to u=pbpb+1 minarea:=min{minarea,2⋅areapapbCpd}

The algorithm of [8] actually uses a precomputed list that stores for each edge of an antipodal vertex that is farthest away from the line through . By contrast, the algorithm above updates the vertex opposite to and the vertex opposite to on the fly. The treatment of degenerate cases is also different.