Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Abstract The diameter, as well as some other variants of these problems, are
quite old, but fast algorithms for them are relatively new. Several
Given n points in the plane, we present algorithms for finding maximum authors have given algorithms for particular cases, which require that
perimeter or area convex k-gons with vertices k of the given n points. the convex hull of our given collection of points be found first. Shamos
Our algorithms work in linear space and time O(knlgn-I-nlg 2 n). [Sh] was the first to present an algorithm for the diameter problem
For the special case k : 3 we give O(nlgn) algorithms for these which works in linear time (once the convex hull is given). He also
problems. Several related issues are discussed. gave a linear algorithm for finding the maximum area quadrilateral
with vertices four of the given points. Dobkin and Snyder [DS]
gave a linear time algorithm for the maximum area triangle. Our
1. Introduction dynamic programming ideas in section 3 are similar to those discussed
by F. Yao in [YFF]. The quadrangle inequality of that paper can be
In this paper we present efficient algorithms for certain geometric used to give us an O(n z lg n) algorithm for the maximum perimeter
optimization problems in the plane. Typical of these problems is triangle problem. "Pae problem of finding the minimum area ellipse
the following. We are given n points in the plane and wish to containing a collection of points was the subject of recent work by
choose a convex k-gon with vertices k of the given points and whose Post [P]. The routing paper of Dolev and Siegel [DOS] uses a divide
perimeter is maximal. The special case k = 2 is the classical problem and conquer approach similar to ours. Finally, A. Yao [YA] gave the
of finding the diameter of a point set in the plane. An algorithm first subquadratic algorithm for finding the diameter of a set of points
presented in this paper will find the maximum perimeter /c-gon in in 3-space.
time O(knlgn -~-n l g 2 n), and linear space. The correctness of our
algorithm is based on certain interesting combinatorial properties of As is often the case in geometric arguments, there is is considerable
extremal perimeter polygons. Suprisingly, the same combinatorial subtlety in some of the correctness proofs required. We exhibit
properties hold for polygons extremal under other measures as well, examples which show that other plausible algorithms may fail to find
such as area. Thus an isomorphic algorithm can be used to find the the truly maximum k-gons. And our techniques do not obviously
largest area convex k-gon with vertices k of the n given points (within generalize to dimensions higher than 2, where even the diameter
the same time bound). For the case k = 3, a special trick allows us problem is not known to be solvable in nearly linear time. Again we
to solve these problems in time O(n lg n). give examples that show how plausible generalizations can fail. These
remarks are amplified in section 5.
We begin our presentation by studying, in section 2, some of the
combinatorial properties of extremal polygons. In section 3 we use Some of our results dualize in a natural fashion. We can find, under
these properties and a dynamic programming approach to develop certain conditions, m i n i m u m area or perimeter k-gons surrounding
an algorithm for finding a maximal rooted k-gon in time O(kn lg n). (circumscribing) our collection of points, by exactly analogous tech-
Then in section 4 we use the rooted polygon algorithm to obtain the niques. A brief description of these results appears in section 6, along
results stated above. with a mention of some applications.
282
In many situations the above theorem is a powerful tool, as the number
of points on the convex hull of a collection of points is typically much
less than the number of points in the collection. Several results are
known in this direction which are summarized in Santalo [S]. Since
t
we are interested in worst-case behavior, however, it may appear that
this theorem does not help us at all, as in the worst case each of the
points in our collection could be a vertex of the convex hull. Thus
finding the convex hull need not reduce the number of points we must
consider.
283
Lemma Z2. A (globally) maximal k-gun and a maximal rooted a simple polygon can be thought of as the integral over the plane of
k-gun interleave. a function which is 1 for points inside the polygon, and 0 for points
outside. We will use an analogous definition for arbitrary polygons:
We will say that k consecutive non-overlapping intervals/1, I2, • • •, Ik we just integrate the winding number, which counts how many times
are spanning, if whenever a maximal k-gon has a vertex in one of the polygon wraps around each point (it can be a negative quantity).
them, it has exactly one vertex in each of them. Thus for areas covered twice we multiple the ordinary area by two,
and so on.
Lemma 2.3. Let I I , I 2 , . . . , I k be k spanning intervals, and let x
be a point in /1. Consider the maximal restricted k-gon rooted at We now consider the effect of the crossing transform to a general-
z, with its remaining vertices constrained to lie one in each of the ized polygon, which in our case consists of two normal convex
intervals I s , . . . , I k respectively. The vertices of this k-gon subdivide polygons. The crossing transform applies whenever we have four
each of our intervals into two non-overlapping parts (both containing vertices A, B, C, D occuring in this order in the cyclic ordering, but
the subdividing vertex). Let these parts be called L j and R j for the such that A and D are consecutive vertices of the (a) polygon, and so
interval Ij, in the order in which they occur along the cyclic order. are B and C. The transform breaks the edges A D and B e , and adds
Then both L 1 , L 2 , . . . ,ILk, and F l l , R 2 , . . . ,Rk are spanning sets of the edges A C and BD. Note that each vertex still has degree two, so
k intervals. the outcome is a polygon. It is clear that this transform will always
increase the perimeter of the resulting polygon, for we are replacing
The basic tool in the proofs of these lemmas is is what we call the a pair of opposite sides of a convex quadrilateral with its diagonals.
crossing transform applied to two polygons, a transformation that is (It is a simple application of the triangle inequality to show that the
always measure (perimeter or area) increasing. The idea of the crossing diagonals of a convex quadrilateral always have longer total length
transform is illustrated in fig. 3. It is applicable whenever we have than either pair of opposite sides.)
two adjacent vertices of one polygon that are not separated by a vertex
of the other. The transform simply interchanges the two non-crossing When it comes to area it is not true that the crossing transform always
edges shown with the two crossing diagonal edges. Of course this helps. For this conclusion we need some additional assumptions,
now has merged our two polygons into a single (non-simple) polygon. which follow from the maximality o f the two initial polygons. First
As it turns out, however, in our context there will always be another we need an elementary geometric fact. Consider our standard convex
place where the crossing transform can be applied as well, and this quadrilateral A B C D , and let the sides A B and CD intersect at a
second application will break up this polygon into two simple polygons point X on the opposite side of side B C from A and D, and let the
again. The two resulting polygons will be shown to have a combined diagonals .intersect at the point Y, as in fig. 4. We claim that the area
measure that exceeds the measure of the two original polygons. This of B O Y is less than the area of A D Y . This is easily seen by adding
statement is in fact true even after the application of a single crossing to both triangles the triangle A B Y . We must compare now the areas
transform, if we take care to define the perimeter and area of a non- of triangles A B C and A B D . These triangles have a common base,
simple polygon appropriately. It also implies the following interesting A B , and the height of A.BC from C is certainly smaller that that of
combinatorial result.. A B D from D, as follows from the assumption that X and D lie on
opposite half-planes with respect to BC.
Lemma 2.4. If we are given 2k points forming the vertices of a
X
convex 2k-gon, then the way to break them them up into two groups
of k each so as to maximize the sum of the perimeters of the the
two convex k-gons thus formed, is to use all the odd vertices for one
k-gon and all even ones for the other.
A D
It is easy to verify that the change in the area o f our polygon when
the crossing transform is applied to the convex quadrilateral A B e D
is a(A_DY) -- a(BCY), where a denotes the area function. Thus the
cossing transform will increase the area, as long as we can guarantee
that sides A B and CD intersect on the opposite halfplane of B C
from A and D. This will be so, because of the assumption that the
Figure 3. The Crossing Transform. (simple) polygon containing edge A_D is maximal. For suppose instead
284
that A B and CD intersected on the same side of B C as A and D. Lemma 2.1 tells us that exactly one vertex of the (3" "q- 1)-gon, other
Consider E, the other neighbor of D in the polygon containing A D , than the root. must lie in each of the j intervals defined by the vertices
as in fig. 5. By assumption A B intersects C D on the opposite side of the maximal j-gon. We will use a dynamic programming method
of A D f r o m / 3 and C. Since E lies between D and A in the cyclic for finding the (3 q- 1)-gon, examining each of the j intervals in torn.
ordering, it must afortiori be the case that A E intersects CD on the Note that if li denotes the length of the i-th interval, then
other side of DE from A and C. By the same argument we gave
above, triangle A C E has larger area than triangle A D E , contradicting
the area maximality of the polygon containing A D . Eli -.~nq-j.
i=l
C
The successive examination of intervals gives rise to the formation
of partial (or incomplete) polygons and we must take a moment
to properly define our measures of area and perimeter for such
polygons. We introduce the notion of a path, which is just a
sequence of vertices. We will use greek letters to denote paths, roman
letters to denote points, and semicolon to signify concatenation. Our
D polygons correspond to closed paths, that is sequences of the form
P0; P,; P a ; . . - ; P~; P0. We define our measures of area and perimeter
for paths as follows:
£ and
P(a; Pk---1;Pk) ---- P(a; Pk--1) q- l(pk--1; p~),
B
where a(po;pk--1;pk) denotes the area of triangle POPk--aPk, and
/(Pk--l; Pk) denotes the length of the edge Pk--*Pk.
285
Since each li is bounded by n, we can bound lg li by lg n. If we now and so on, for lg n iterations. Therefore all the optimal k-gons with
sum all the contributions for the successive stages, the total sum is roots in I, can be found in time O(n lg 2 n). The maximum k-gon is
clearly bounded by O ( n l g n). (Note that the last stage is a bit funny, the best of them.
as the last interval contains exactly one vertex, namely the root.) We
conclude that once we have a maximal rooted j-gun, we can compute Theorem 4.1. The maximum area or perimeter k-gun can be
a maximal rooted (j -q- 1)-gon with the same root in linear space and computed in time O(kn lg n -5 n lg 2 n), and linear space.
time O(n lg n).
Theorem 3.1. A rooted constrained k-gon whose vertices are . Comments and counterexamples
constrained to lie in intervals of total length n can be computed in
time O(n lg n). Our perimeter algorithm for k ---- 2 is, of course, finding the diameter
of our point set. Note that our method uses time O(nlgn) to find
To get started we note that, for the perimeter case, Lemma 2.1 holds the diameter, even after the convex hull has been found. Shamos's
even for j ---- 2, so we can begin by finding the maximal chord out of method, on the other hand, requires only time O(n) for that step.
the root z, which is a linear time operation. For the maximum area His method is based on supporting lines and uses the lemma that the
case we need the following Lemma. diameter is always an edge between two points that are extremal along
two directions in the plane, 180 ° apart. One can start two pointers at,
Lemma 3.2. The maximum area rooted triangle can be found in say, the points of smallest and largest x value, and then rotate them
O(n).
time around the convex hull so as to find all these extremal pairs. Neither
pointer ever backs up, so the total cost for this method in O(n).
Proof." A method for doing this works like Shamos's diameter
algorithm. Let A be the root, and consider its neighbor vertex B Unfortunately the supporting line technique does not generalize to
in the cyclic order. We can find vertex C, so as to maximize the k > 2. For example, to find a maximum perimeter triangle, we might
area of triangle A B C by just examing further vertices along the cyclic consider all triplets of points which are extremal in three directions,
ordering as long as the area keeps increasing. The distances of points 120 ° apart. As before, all these triplets can be found in linear time
on a convex figure to a chord form a unimodal distribution, so as soon once the convex hull is given, but the example below shows that the
as we pass the maximum, we know that we have found it. It is clear maximum perimeter triangle need not be among them.
from convexity that if point B now advances along the cyclic ordering,
then the best corresponding C also has to move in the same direction. Consider the six points A, B, C, D, E , FF with coordinates respectively
Thus as B advances, C never has to back up, and this guarantees the (0,1), ( 0 , - - 1 ) , (100,0), (.3,1.2), (.3,--1.2), and (99.9,.1). See
linearity of the method. II fig. 6. It is easy to check that ..4_BC is the maximum perimeter
triangle, but D and E always shelter either A or B from touching the
This also follows, of course, from the results of [DS]. Combining the circumscribing triangle, except when A and B are on the same line.
above observations we get the following result. In this case F shelters C.
A,
4. Floating the root
286
Shamos's diameter algorithm can be adapted to find the diameter of
this continuous figure in linear time. This, coupled with the floating
the root technique of section 4 shows the following theorem.
It may be of interest to note that the supporting line idea does not
easily generalize to three dimensions, even for the diameter case, as the
supporting hyperplanes at a vertex do not have a linear ordering. We
might consider the following variant: let some face of the polyhedron
act as a base, and look at the vertex furthest away from it. Let all
edges from that vertex to some vertex of the base be candidates for the
diameter. Next we roll the polyhedron onto a new base, and repeat
this computation. After a Hamiltonian roll through all the faces, we
may think that we have found the diameter. Unfortunately we have
a simple example that shows that this method can miss.
Fig. 9. A counterexample
X
287
6. Circumscribed polygons
Such inclusion tests are especially efficient for k-gons of fixed shape,
e.g. rectangles. A supporting line idea can be used to find such
minimum (in perimeter or area) circumscribing k-gons with sides at
fixed relative angles. If we fix the orientations of all the sides, then
rl we can find the smallest enclosing k-gon in time O(kn). Once we
have the vertices at which the sides of that polygon touch, we can
let these vertices rotate around and obtain the smallest polygon for
a
b all orientations in ume O(k2n). The extra factor of k comes in
because we have to do an area or perimeter computation once we
have determined the supporting vertices of the circumscribing k-gon.
288
. References
289