Presentation is loading. Please wait.

Presentation is loading. Please wait.

1.4 Exercises (cont.) Definiton: A set S of points is said to be affinely (convex) independent if no point of S is an affine combination of the others.

Similar presentations


Presentation on theme: "1.4 Exercises (cont.) Definiton: A set S of points is said to be affinely (convex) independent if no point of S is an affine combination of the others."— Presentation transcript:

1 1.4 Exercises (cont.) Definiton: A set S of points is said to be affinely (convex) independent if no point of S is an affine combination of the others. Affine (convex) basis B S of a set S is an affinely (convex) independent subset of S such that every point in S is an affine (convex) combination of points from B S. A set A 1, A 2,…, A k is affinely independent if and only if the set of vectors A 1 A 2,…, A 1 A k is linearly independent. Exercise 7

2 Every set in E n has an affine basis of k  n+1 points. (easy to prove). It has also a convex basis (not easy to prove), which is not necessarily finite. A number of points in an affine basis of a set S is constant and said to be the dimension of S. Therefore...

3 Theorem If S is a finite set of points, then Conv (S) is a polygon with the vertices in S. Proof: 1. There is a convex polygon P S with the vertices in S. (for example, Algorithm1) 2. P S = Conv (S).

4 Algorithm 1. (Convex Hull) - Pseudo code - Input. A set of points in the plane. Output. A list containing the vertices of Conv ( P). 1. Sort the points by (x,y)-coordinate, resulting in a sequence p 1,p 2, …,p n. 2. Put the points p 1 and p 2 in the list L upper with p 1 in the first position. 3. For i  3 to n 4. do Append p i to L upper 5. while L upper contains more than two points and the last three points in L upper do not make a right turn 6. do delete the middle of the last three points from L upper. 7-11 the same in the opposite direction: p n to p 1: Make L lower 12. Remove the first and the last point from L upper. 13. Append L upper and L lower to make L. 14. return L.

5 Algorithm 1, Step 5: pipi pipi X X X pipi X X X pipi

6 Left – Right decision Degeneracy O, O,  The complexity of Algorithm 1 is O(nlogn) Exercise 8= Implementation of Algorithm 1 XPiXPi YPiYPi X P i-2 Y P i-2 X P i-1 Y P i-1 1 1 1 > = < 0 XPiXPi X P i-2 X P i-1 = - XPiXPi - Y P i-2 - YPiYPi YPiYPi Y P i-1 - Algorithm 1 (cont.)

7 Algorithm2. (2-dim) Assumption. The points are ordered in a sequence increasingly with respect to the x coordinate. The vertices having the same x coordinate are ordered with respect to the y coordinate middle ones omitted. The algorithm is incremental (inductive), at the step k+1 the (k+1) st point A k+1, as well as the convex hull of the previous points, are used to produce the convex hull C k of the first k+1-points. (Exercise 9 = Implementation of algorithm 2)

8 Storing data. -Edges (oriented): origin and the pointer to the “next” edge. -Vertices: a point A and the edge AB originated at A. Algorithm2. (2-dim) Step k+1. 1. Find the the two vertices of C k which divide the “visible” and the “invisible” part of C k with respect to (“from”) the point A k+1.

9 B0B0 B1B1 BrBr BsBs A k+1 [A k+1 B m-1, A k+1 B m ] = B m-1x - A k+1x B m-1y - A k+1y B m x - A k+1x B m y - A k+1y Algorithm2. (2-dim), Step k+1(cont.)

10 Denote B 0 =A k. The vertices B m are obtained recursively so that B m-1 B m is the oriented edge of C k and that the 2X2 determinant [A k+1 B m-1, A k+1 B m ] is not positive. In another words, the vertices B m are in the visible part of C k. Let B r be the last one in the sequence having negative determinant, i.e. such that the determinant corresponding to B r and the next vertex of C k is not negative. Hence, the vertex B r is one of the two vertices we are looking for. Similarly, starting with B 0 we can inductively obtain a sequence of the vertices B m-1 with negative indices having the same property. Let B -s be the last vertex in this sequence. Algorithm2. (2-dim), Step k+1(cont.)

11 2. Vertices B -s + 1,…, B r - 1 are deleted together with the corresponding edges. Vertex A k+1 is added together with the edges B -s A k+1 and A k+1 B r. B r B -s B r+1 A k+1 B -s A k+1 B r+1 Algorithm2. (2-dim), Step k+1(cont.)

12 3. If there is the vertex B -s -1 i.e if the points B -s -1, B -s and A k+1 are collinear, the middle point B -s is omitted and the edges B -s -1 B -s and B -s A k+1 are substituted with B -s -1 A k+1.The same procedure is performed with the vertex B r.. Algorithm2. (2-dim), Step k+1(cont.)


Download ppt "1.4 Exercises (cont.) Definiton: A set S of points is said to be affinely (convex) independent if no point of S is an affine combination of the others."

Similar presentations


Ads by Google