Presentation is loading. Please wait.

Presentation is loading. Please wait.

Convex hulls Gift wrapping, d > 2 Problem definition CONVEX HULL, D > 2 INSTANCE. Set S = { p 1, p 2, … p N } of points in d-space (E d ). QUESTION. Construct.

Similar presentations


Presentation on theme: "Convex hulls Gift wrapping, d > 2 Problem definition CONVEX HULL, D > 2 INSTANCE. Set S = { p 1, p 2, … p N } of points in d-space (E d ). QUESTION. Construct."— Presentation transcript:

1 Convex hulls Gift wrapping, d > 2 Problem definition CONVEX HULL, D > 2 INSTANCE. Set S = { p 1, p 2, … p N } of points in d-space (E d ). QUESTION. Construct the convex hull H(S) of S. The coordinates of the points p i  S will be referred to as p i = (x 1, x 2, …, x d ). For d = 2, the constructed hull was given (represented) as a sequence of hull vertices. How is the hull represented for d > 2? To answer that, and describe the algorithm, more definitions are needed.

2 Convex hulls Gift wrapping, d > 2 Polyhedron In E 3 a polyhedron is defined by a finite set of planar polygons such that every edge of a polygon is shared by exactly one other polygon and no subset of the polygons has the property. Polyhedra is plural for polyhedron. The polygons that share an edge are adjacent. The vertices and edges of the polygons are the vertices and edges of the polyhedron. The polygons are the facets of the polyhedron. A polyhedron is simple if there is no pair of nonadjacent facets sharing a point. A simple polyhedron partitions 3-space into two domains, the interior (bounded) and the exterior (unbounded). The term polyhedron often means boundary  interior. A simple polyhedron is convex if its interior is a convex set. A polyhedron is the 3-dimensional equivalent of a polygon.

3 Convex hulls Gift wrapping, d > 2 Polytope A half-space is the portion of E d lying on one side of a hyperplane. A polyhedral set in E d is the intersection of a finite set of closed half-spaces. Note that a polyhedral set is convex, since a half-space is convex, and the intersection of convex sets is convex. Plane polygons (d = 2) and space polyhedra (d = 3) are 2- and 3-dimensional instances of bounded polyhedral sets. A bounded d-dimensional polyhedral set is a polytope. Note that polytopes are convex by definition. The terms “convex d-polytope”, “d-polytope”, and “polytope” are all equivalent. Theorem. The convex hull of a finite set of points in E d is a convex d-polytope. Conversely, a polytope is the convex hull of a finite set of points. For d = 3, the convex hull is a convex polyhedron. For arbitrary d, the convex hull is a d-polytope.

4 Convex hulls Gift wrapping, d > 2 Affine set Given k distinct points p 1, p 2, …, p k in E d, the set of points p =  1 p 1 +  2 p 2 +... +  k p k (  j  ,  1 +  2 +... +  k = 1) is the affine set generated by p 1, p 2, …, p k, and p is an affine combination of p 1, p 2, …, p k. We have seen this before. If k = 2, this is the parametric equation of a line, i.e., a line is an affine set. For k = 3, the affine set is a plane. In general, an affine set for given k is a “flat” object of k - 1 dimensions. Given a subset L of E d, the affine hull aff(L) is the smallest affine set containing L. If L is 2 points or a segment, aff(L) is a line. If L is 3 points or a planar polygon, aff(L) is a plane. A set of k points is affinely independent if no subset of them can generate the same affine set. The text sometimes refers to affine sets as hyperplanes.

5 Convex hulls Gift wrapping, d > 2 Faces of a polytope A d-polytope is described by its boundary, which consists of faces. For a d-polytope, there are faces in all dimensions 1 … d. Some have special names. For a d-polytope: DimensionFaceName of face dd-faced-polytope d - 1(d-1)-facefacet d - 2(d-2)-facesubfacet 11-faceedge 00-facevertex For a 3-polytope (polyhedron): DimensionFaceName of face d = 33-face3-polytope, polyhedron d - 1 = 22-facefacet, planar polygon d - 2 = 11-facesubfacet, edge 00-facevertex

6 Convex hulls Gift wrapping, d > 2 Simplex A d-polytope P is a d-simplex (or just simplex) iff it is the convex hull of (d + 1) affinely independent points. Any subset of the d vertices of the convex hull is itself a simplex and is a face (in some dimension) of P. dd-simplex 0vertex 1edge 2triangle 3tetrahedron 2-simplex convex hull of 2 + 1 points not a 2-simplex convex hull of > 2 + 1 points

7 Convex hulls Gift wrapping, d > 2 Simplicial A d-polytope is simplicial if each of its facets is a (d-1)-simplex. For example, for d = 3: The convex hull of a set of points in 3-space (the convex hull is a 3-polytope) is simplicial iff every facet is a 2-simplex (a triangular convex hull of exactly 3 points). For example, the first case below. If any facet of the hull has > 3 co-planar points, the hull is not simplicial. For example, the second and third cases below. 2-simplex convex hull of 2 + 1 points not a 2-simplex convex hull of > 2 + 1 points not a 2-simplex convex hull of > 2 + 1 points

8 Convex hulls Gift wrapping, d > 2 Beneath A point p is beneath a facet F of a polytope P if the point p lies in the open half-space determined by hyperplane aff(F) and containing P. In other words, aff(F) is a supporting hyperplane of P, and p and P are in the same half-space bounded by aff(F). Point p is beyond facet F if p lies in the open half-space determined by aff(F) and not containing P. The figure shows these relationships for d = 2. Note error in text, 2nd paragraph of 3.4, “the P” should be “p”. F aff(F) Pp 2 is beneath F p 1 is beyond F

9 Convex hulls Gift wrapping, d > 2 Gift wrapping Proposed by Chand and Kapur (1970). Analyzed by Bhattacharya (1982). Specialized for d = 2 by Jarvis (1973), Jarvis’ march. Key idea: Given one facet (a (d-1)-face) of the convex hull, find a neighboring facet of the hull by “wrapping” a (d-1)-dimensional affine set around the point set. Continue from each facet to its neighbors until all facets are found. For example, in d = 3, imagine wrapping a sheet of 2-dimensional wrapping paper around a 3-dimensional gift box. In d = 2 (Jarvis’ march), a 1-dimensional line is wrapped around a 2-dimensional point set. My presentation will often appeal to d = 3 for expository purposes, but the method is applicable for any d  2.

10 Convex hulls Gift wrapping, d > 2 Simplicial assumption As presented (here and in the text), the algorithm assumes that the resulting polytope (the convex hull) is simplicial. Recall that in a simplicial d-polytope, each facet is a (d-1)-simplex, and is determined by exactly d vertices. There will be no points in S coplanar with the d vertices that determine each facet of the convex hull. Theorem. In a simplicial d-polytope, a subfacet is shared by exactly two facets, and two facets F 1 and F 2 share a subfacet e iff e is determined by a common subset, with d - 1 vertices, of the sets determining F 1 and F 2. F 1 and F 2 are said to be adjacent on e. Restating the theorem for d = 3: In a simplicial 3-polytope, an edge is shared by exactly two triangular facets, and two facets F 1 and F 2 share an edge e iff e is determined by a common subset, with 2 vertices, of the 3 vertices determining F 1 and F 2. F 1 and F 2 are said to be adjacent on e. The theorem is the basis of the algorithm. Given an already constructed facet F 1 of the convex hull, a subfacet e of F 1 is used to construct the adjacent facet F 2 that shares e with F 1.

11 Convex hulls Gift wrapping, d > 2 Finding an adjacent facet, in general Let S = { p 1, p 2, … p N } be a finite set of points in d-space (E d ). Assume a facet F 1 of H(S) is known, with all its subfacets. The mechanism to advance from F to an adjacent facet F, which shares subfacet e with F, is to select from among all the points of S not vertices of F the point p such that all other points of S are beneath the hyperplane aff(e  p). In other words, from among all the hyperplanes determined by e and a point p  S but not in F, the one which forms the “largest angle” with aff(F). For example, for d = 2: e F F

12 Convex hulls Gift wrapping, d > 2 Finding an adjacent facet, for d = 3 Facet F is known. Consider the set of planes determined by edge e and the points of S and select the one which forms the largest angle <  (convex angle) with aff(F). Points p 1, p 2, p 3 determine F, which determines aff(F). Compare the planes determined by e and p 4, p 5, p 6, and p 7. p6p6 aff(F) F p1p1 p2p2 p3p3 p5p5 p4p4 p7p7 e

13 Convex hulls Gift wrapping, d > 2 Finding the largest angle The angle comparison is carried out by comparing cotangents for each point p k  S not part of F. The details are in the text, pp. 133-134. The time required for one advance is O(d 3 + Nd). O(d 3 ) to compute a vector needed for the angle comparisons, done once per advance (gift wrapping step). O(Nd) computing and comparing cotangents for O(N) points. p6p6 aff(F) F p1p1 p2p2 p3p3 p5p5 p4p4 p7p7 e

14 Convex hulls Gift wrapping, d > 2 Overview of the algorithm The algorithm starts from an initial facet. For each subfacet of it, construct the adjacent facets. Move to one of the new facets and continue until all facets have been constructed. A pool of subfacets which are candidates for being used is kept. A subfacet e, shared by facets F and F, is a candidate to be used iff F or F but not both have been constructed.

15 Convex hulls Gift wrapping, d > 2 Algorithm Queue Q stores facets. File  stores the “pool” of subfacets. procedure GiftWrapping(S) begin 1Q =   =  2F = find an initial convex hull facet 3insert into  all subfacets of F 4insert(F,Q) /* insert F into Q */ 5while (Q   ) do 6F = first(Q) /* remove first element from Q, put into F */ 7T = subfacets of F 8for each e  T   /* e is a gift wrapping candidate */ 9F = facet sharing e with F /* Gift wrapping advance */ 10insert into  all subfacets of F not yet present delete from  all subfacets already present in F 11insert(F,Q) endfor 12output F /* output a facet of H(S) */ endwhile end Still to be seen: 2.find an initial convex hull facet 7.generate the subfacets of facet F 8.check if subfacet e is a candidate

16 Convex hulls Gift wrapping, d > 2 Supporting lines and planes Recall that a supporting line of a convex polygon intersects the polygon at a vertex such that the entire polygon is to one side of the line. A supporting plane (or hyperplane) has a similar relationship with a polytope. polygon, d = 2 supporting line, d = 1 E3E3 intersection is vertex intersection is edge intersection is facet E2E2

17 Convex hulls Gift wrapping, d > 2 Step 2. “Find an initial convex hull facet.”, 1 The idea is to obtain a hyperplane containing a facet of the convex hull polytope H(S) by successive approximations. This is done by constructing a sequence of d (d is dimension E d ) supporting hyperplanes  1,  2, …,  d, such that  i shares one more vertex with the convex hull than  i-1 for 1  i  d (we define  0 as sharing 0 vertices with H(S)). In other words,  i for 1  i  d shares i vertices with H(S). A supporting hyperplane intersects the polytope such that the entire polytope is to one side of the hyperplane. Note that if the intersection is facet F, then the supporting hyperplane is aff(F). The supporting hyperplanes are (d-1)-dimensional.

18 Convex hulls Gift wrapping, d > 2 Step 2. “Find an initial convex hull facet.”, 2 For d = 3 (E 3 ) the successive hyperplanes intersect the convex hull as follows: supporting# verticesintersection hyperplaneof H(S) on  i object  0 0   1 10-face, vertex  2 21-face, edge, subfacet  3 32-face, polygon, facet In essence, the technique is an adaptation of the gift wrapping mechanism, where at the jth of the d iterations the hyperplane  j contains a (j-1)-face of the convex hull H(S).

19 Convex hulls Gift wrapping, d > 2 Step 2. “Find an initial convex hull facet.”, 3 Thus we begin by determining a point of least x 1 -coordinate (call it p 1 ); p 1 is certainly a vertex (a 0-face) of the convex hull. Hyperplane  1 is chosen orthogonal to vector (1, 0, …, 0) and passing by (containing) p 1. In other words,  1 passes through p 1 and is parallel to the x 2 x 3 …x d hyperplane. For example, for d = 3: This “initializes” the process of finding the initial supporting hyperplane. Once the initial hyperplane  1 has been found, each successive hyperplane  j 2  j  d is found from the hyperplane before it  j-1. x 1 = x x 2 = y x 3 = z p1p1 p3p3 p2p2 11

20 Convex hulls Gift wrapping, d > 2 Step 2. “Find an initial convex hull facet.”, 4 At the jth iteration, 2  j  d, the hyperplane  j-1 has normal vector n j-1 and contains vertices p 1, p 2, …, p j-1. We need to find p j to define  j. Through vector calculations p j can be found such that  j (defined by p 1, p 2, …, p j ) has the largest angle with  j-1 (defined by p 1, p 2, …, p j-1 ). Each iteration requires O(Nd) + O(d 2 ) time. There are d iterations, so finding the initial supporting hyperplane  d required by step 2 of the overall algorithm requires O(Nd 2 ) + O(d 3 )  O(Nd 2 ) time. x 1 = x x 2 = y x 3 = z p1p1 p3p3 p2p2 11 22 33

21 Convex hulls Gift wrapping, d > 2 Step 7. “Generate the subfacets of facet F.” Because we have assumed that the convex hull polytope H(S) is simplicial, each facet of H(S) is determined by exactly d vertices, and each subset of those vertices of size d-1 determines a subfacet. The subfacets of a facet can be generated in a straightforward fashion by considering each of the d vertices in turn and reading off the remaining d-1 vertices. This requires O(d 2 ) time. Each facet will be described by a d-component vector of the indices of its vertices, while a subfacet will be described by an analagous (d-1)-component vector. That implies that the vertices are kept in an array.

22 Convex hulls Gift wrapping, d > 2 Step 8. “Check if a subfacet e is a candidate.”, 1 A subfacet is a candidate iff it is contained in just one facet generated by the algorithm. Why just one? Recall that in a simplicial polytope, a subfacet is shared by exactly two facets. If a subfacet is generated twice, then both of its adjacent facets have been found, and the subfacet is of no further use. e F1F1 F2F2

23 Convex hulls Gift wrapping, d > 2 Step 8. “Check if a subfacet e is a candidate.”, 2 Recall that  is a file of subfacets. Given a newly generated subfacet e, searching  for e will determine if e is a candidate. If e  , delete e. If e  , add it. (This is step 10 in the algorithm). A subfacet is represented by a (d-1)-component vector of vertex indices. Store  as a height-balanced binary tree, ordered lexicographically on the vertex indices. Accessing this structure to test subfacet e for membership (step 8) or to insert or delete subfacet e (step 10) requires O((d-1) log M) time, where (d-1) is the number of indices to compare and M is the maximum number of subfacets in .

24 Convex hulls Gift wrapping, d > 2 Analysis, 1 We analyze the algorithm in steps. Let  d-1 be the actual number of facets of the polytope H(S). Let  d-2 be the actual number of subfacets of the polytope H(S). Initialization (steps 1-4) requries O(Nd 2 ) time. Steps 6, 11, 12 process each facet once each, adding it to the queue, removing it, and outputing it; they require O(d)   d-1. number of facets components of the vector representing the facet The overall complexity of step 7, generation of subfacets, is O(d-1)  2  d-2, as each subfacet has d-1 components and is generated twice. The test in step 8 as well as the file update in step 10 require O((d-1) log  d-2 ) per subfacet, number of subfacets components of the vector representing the subfacet so the overall time required is O((d-1) log  d-2 )   d-2. The overall time required for step 9 (gift wrapping) is O(d 3 + Nd)   d-1. number of gift wrapping advances time required for each

25 Convex hulls Gift wrapping, d > 2 Analysis, 2 It can be shown that both  d-1,  d-2  O(N  d/2  ). Using this the previous analysis simplifies to: Convex hull construction time in d dimensions on N points T(d,N) using the Gift wrapping algorithm, requires O(N  d/2  +1 ) + O(N  d/2  log N). Note that even though d is a constant, it remains in the final order expression where it is an exponent of the input size N.


Download ppt "Convex hulls Gift wrapping, d > 2 Problem definition CONVEX HULL, D > 2 INSTANCE. Set S = { p 1, p 2, … p N } of points in d-space (E d ). QUESTION. Construct."

Similar presentations


Ads by Google