We said geometry is about relationships among geometric objects. Points in Euclidean space are the simplest of geometric objects. What relationships hold in a finite set S of point? We begin by exploring one of the first non-trivial geometric object that might be defined on S, namely its convex hull. How does one compute it? Even when restricted to points in plane, this will introduce us to a wealth of recurrent ideas in geometric computation. In some sense, all the relationships in a finite set of points is captured by the notion of geometric sorting, introduced by Goodman and Pollack.
Convexity Concepts. We first introduce some concepts of convexity in the Euclidean space Rd (of any dimension d ³ 1). If p,q Î Rd are two points, then the closed line segment joining them is the set of points of the form
|
A convex polyhedron in Rd can be partitioned into a collection of cells. Each cell is a connected open set in a affine subspace of some dimension i (i = 0, 1 ,¼, d). A i-dimensional cell is called a i-cell. The 0-cells are called vertices; the 1-cells and (d-1)-cells are called edges and facets, respectively. We will require the cell to interrelate in nice ways. if c, c¢ are two cells, then the closure of c must be disjoint from c¢ or contains c¢. There may be other restrictions on cells. We can restric such cells to be convex or even simplicial.
For the present, we will concentrate on the case d = 2. In this case, polytopes are call polygons. These shapes are ubiguitous in daily life, in the form of triangles, rectangles, etc. The subdivision of polygon into cells is intuitively clear: there is only one facet, which is the interior of the polygon. The boundary of the polygon is homeomorphic to a circle, and is naturally partitioned into an alternative sequence of vertices and edges. The number m of vertices is the same as the number of edges, and we call the polygon an m-gon.
The convex hull of a set S of points can be defined to be the smallest closed convex set that contains S - this is a convex polytope. Let CHull(S) denote this set. We often identify CHull(S) with the boundary of the convex polytope. In two dimensions, the boundary of a convex polygon with m vertices may be identified with a circular ordering1(v1, v2 ,¼, vm) of its vertices.
The convex hull problem is this: given a set S of points in the plane, we want to compute CHull(S). See figure 1 for the convex hull of 8 points. The form of the output needs to be specified with some care: we not only want to determine the points in S which are in extremal position, we also want to list them in the correct circular order. Here, a possible ambiguity arises. Are points on the relative interior of a convex hull edge considered ``extremal''? According to our definition of extremal below, such points are not extremal. But we may still want to list these points as convex hull points. As we will see, our solutions can handle both versions.
We reduce our problem to a subproblem: how to decide if an point p Î S is an extremal point of CHull(S)? This problem is in turn reduced to an interesting angular sorting problem: given S and any p Î S, determine the circular ordering of all the other points in S with respect to their angular order seen from p. Then p is extremal iff one of the angles spanned at p by two consecutive points is more than 180deg.
This would give an O(n2 logn) time algorithm for computing convex hull: for each points p Î S, we can decide if p is extremal in O(nlogn) time, by circular sorting about p. Once we have the set of extremal points, we can put them in circular order in another O(n2) time (How). Actually, we can do this in linear time if we just retain a little information from the circular sorting phase above. Namely, when we determined a point p to be extremal, we have also found two unique consecutive points p¢, p¢¢ such that the angle Ð(p¢,p,p¢¢) is > p. This information yields the circular ordering of the convex hull points in a straightforward way.
Angular sorting illustrates the idea of ``generic sorting'' in which the objects to be sorted can be arbitray, provided a linear ordering can be defined on them. This linear ordering is implicitly given by the ``comparison'' operator. Such ideas are well-supported in a modern computer language such as Java.
Let us attend to the details of doing angular sorting. The obvious way to do this is to compute the angles that each point q Î S\{p} makes with the positive x-axis. Then we sort these angles as numbers between 0 and 2p. But we prefer to avoid the computation of angles as this requires non-algebraic (transcendental) functions, which is inherently approximate. To do this, we need to define the signed area of an oriented triangle.
Let A,B,C be three points in the plane. The area a(A,B,C) of the triangle ABC is half of the determinant
| (1) |
|
The LeftTurn Predicate is defined as follows: LeftTurn(A,B,C) = TRUE if the point C is strictly to the left of the line directed from A to B. Thus
|
We can improve the O(n2lgn) algorithm for convex hulls to O(nh) where h is the number of points on the convex hull of S. The idea is that we begin with any point p1 on the convex hull of S. For instance, p1 can be chosen to the the point with the smallest y-coordinate (if there are several choices, the smallest x-coordinate will do). We perform the circular sorting at p1. This will lead us to the point p2 which is next on the convex hull, and we again perform a circular sorting about p2, etc. Thus we perform only h circular sorts.
But actually we need not perform sorting to find pi+1 from pi. We only need to find the point with minimim angle in the direction pi-1 to pi. This can be performed in O(n) time. Thus the algorithm is O(nh).
How can we effect this physical action of rotating until we find the next point pi+1? Using the direction from pi-1 to pi as the initial direction, we need to find the point p such that the direction from pi to p is smallest. Using the ideas above, this is easy to do in linear time. Hence the complexity of this algorithm is O(nH) where H £ n is the size of the hull. If H = o(logn), this can be faster than an O(nlogn) algorithm.
Graham Scan Graham gave one of the first O(nlogn) algorithm for this problem.
|
Correctness of Graham Scan: we leave this as an exercise.
Divide and Conquer This is quite intuitive: we choose a vertical line L such that at most half of the points lies strictly to the left, and at most half of the points lies strictly to the right. Recursively, we construct the convex hull of the left and right subsets. We then construct the convex hull of the whole set by constructing the two ``bridges'' (these are the lines that are the common tangents of both convex hulls, and that has the 2 convex hulls on one side of the line). Once we have these lines, we can easily construct the final convex hull. This gives rise to the classic recurrence
|
Lower Bounds It can be shown that within a reasonable model of computation, every convex hull algorithm requires W(nlogn) steps in the worst case. In this sense, we usually call an algorithm with running time O(nlogn) an ``optimal algorithm''. But witness the next result.
Ultimate Convex Hull ALgorithm A remarkable algorithm was discovered by Kirkpatrick and Seidel: their algorithm takes time O(nlogH). Thus, it is simultaneously better than gift-wrapping and O(nlogn). Notice that we manage to beat other ``optimal algorithms''. Of course, this is no contradiction because we have changed the rules of the analysis: we took advantage of another complexity parameter, h. This parameter h is a function of some output size parameter. Algorithms that can take advantage of the output size parameters are said to be output-sensitive. This is a very important idea of computational geometry. In terms of this h parameter, a lower bound of W(nlogh) can be shown.
Incremental Algorithms and Randomization There is another very general approach called incremental convex hull. In 2-D, this is quite easy to understand. We will illustrate this using the Beneath-Beyond algorithm for convex hulls in every dimension.
REF: Edelsbrunner pa.ge 147.
The idea is to
We will return to this later, to introduce two other important themes in computational geometry: randomization and incremental algorithms. Moreover, in dimension 3 or more, we need more sophisticated data structures which we will return to.
Another direction is to generalize the problem to the ``dynamic setting''. Here the point set S is considered a dynamic point set which can change over time. We can insert or delete from S. Incremental algorithms can be regarded as the solution for the ``semi-dynamic'' case in which we can only insert, but not delete points. Yet another direction is to consider the convex hull computation in higher (or arbitrary) dimensions.
The problem of geometric sorting amounts to asking for the complete set of orientation relations among a set of points. For a planar point set S, this amounts to knowing the value of LeftTurn(p, q, r) for all triple p, q, r of points in S. Clearly, this problem can be solved in O(n3) time. But we can reduce this to O(n2logn) time as follows:
If S is a set of n points in Rd, we can similarly ask for the signs of the determinants formed by any sequence of d+1 points in S. More precisely, if the points pi of S are indexed by 1 ,¼, n, define the function cS which assigns to each d+1 indices (i0, i1 ,¼, id) the sign of the determinant det(pi0 ,¼, pid). Note that this is a determinant of the matrix whose jth row is (pij,1). This function is called the chirotope of S, and there are several other equivalent formulations. When the properties of chirotopes are axiomatized, we obtain the theory of oriented matroids. We refer to the the book of Björner et al [1].
Verify the area formula for all possible disposition of the vectors (b,b¢) and (c,c¢). ¨
Give a formula for the signed area of a simple polygon whose vertices are A1, A2 ,¼, An (for n ³ 3). Let Ai::(xi,yi) for each i. ¨
Can you derive the signed area of a tetrahedron in 3 dimensions? What is the volume formula for a d-dimensional simplex for d > 3? (In d dimensions, there is a constant cd analogous to c2 = 1/2 in 2 dimensions.) ¨
(End of Exercise)
1
The qualification ``circular'' means that
we can choose any vertex of the
If (v1, v2 ,¼, vn) is the circular ordering of a set
of n ³ 2 points, then for any i = 2 ,¼, n,
(vi, vi+1 ,¼, vn, v1, v2 ,¼, vi-1)
denotes the same circular ordering.