Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Geometry Capter:1-2.1

Similar presentations


Presentation on theme: "Computational Geometry Capter:1-2.1"— Presentation transcript:

1 Computational Geometry Capter:1-2.1
M1 Shohei Nishida

2 Chapter1:Convex hull What is “Convex”?
The subset S of the plane is convex iff for any pair of point ,the line segment is completely in S The convex hull CH(S) of subset S is the smallest convex that contains S After this page, S is the set of points on plane

3 Convex hull

4 How to get the convex hull?
What is “compute the convex hull”? Compute a list that are the vertices of CH(S),and listed in clockwise order

5 How to get the convex full?
Let’s see what the edges of CH(S) are. If all points except p,q lie to the right of ,then is the edge of CH(S) Check the all pairs {p,q} whether this can be the edge of CH(S)

6 Three difficult point of calculate
First , how to get right? Use cross product on plane

7 Three difficult point of calculate
Second ,three points lie on a straight line In this book middle points are ignored Check right turn strictly

8 Three difficult point of calculate
Last , rounding error Computer cannot calculate irrational number correctly We don’t think this situation Let the numbers can calculate correctly

9 The algorithm1

10 Is this clever? No. The computation time is very slow.
Is there more clever way? Yes, we can compute the convex full more rapidly.

11 The sketch of faster algorithm.
Let no pair of points has same x-coordinate Sort all points by x-coordinat First, compute ”upper hull”. The upper hull is the set of segments that bounding convex hull from above Second, compute “lower hull”. Merge two segments

12 The sketch of faster algorithm.

13 How to get upper hull? Basic idea is right turn. Any three points on upper hull must be “right turn”. Let’s define are sorted points Add point one by one this order. If the point that makes turn left comes, delete previous points to save “turn right”

14 How to get upper hull

15 The algorihtm2

16 The correctness of this algorithm
Can this algorithm compute “upper hull” correctly? The proof is by induction. The points is calculated by x-coordinate order. Think the situation that the algorithm can compute upper hull correctly for and add the new point

17 The correctness of this algorithm
If the algorithm is wrong ,there are some points over the segments. But by induction, the points in range cannot be such points. So such points must be in range But it cannot be.(The order made by x-coordinate)

18 The computation time of this algorihtm
The sort can be done time. How long is for-loop and while-loop? The answer is Adding point and deleting point is at most once for each points. The total computation time is

19 When some points has same x-coordinate
When we calculate upper hull - we think only highest y- coordinate point. So we can use same proof for correctness. When marge two line – If end point is not same , the algorithm don’t delete lower hull end point.

20 Chapter 2:Line Segment Intersection
We want to count the number of Line Segment Intersection How large the computation time is?

21 Computation time of Line Segment Intersection
In general case,the computational complexity is But in real world, the number of Intersection is small Can we reduce the complexity of the algorithm? Output-sensitive algorithm

22 The sketch of the algorithm
This algorithm called plane sweep algorithm Imagine the sweeping line L L scan downwards over the plane and find “event point”

23 The sketch of the algorithm
Event point is “state” change point on L “state” is list of segments sorted by x-coordinate of intersection point the segment and L

24 The sketch of the algorithm
If two lines intersect , this point is a event point. At intersection, two segment’s positions are swapped So this is event point. If we can check all event point. We can know all intersection

25 The sketch of the algorithm
The event point has two type – intersection and end of segments We already know end of segments but don’t know intersection We can calculate intersection at event point above this intersection Why?

26 The sketch of the algorithm
If the segments intersect , then two lines are “neighbors” on L There must be event point above p that two segments become neighbors. So We can “add event point” at this time.

27 The sketch of the algorithm
All we have to do is following Check the event point that has most highest y- coordinate(if same smaller x-coordinate) If this point is intersection , check this point as intersection If new event point occur , then add this point to event point queue

28 Event point – what to do The state change in three situations.
First is L touch the upper endpoint of some segment - new cross point occurs on L Second is L touch the crossing point of two segments. - swap the relation between two points on L Last is L touch the lower endpoint of some segment -delete point on L

29 L touch the upper endpoint of some segment
New points occur , so we have to check whether the new segment intersects it’s neighbor

30 L touch the crossing point of two segments
Output here is Intersection Swap the points on L and check whether the new neighbor intersects

31 L touch the lower endpoint of some segment
Delete segment on L Check whether the new neighbor intersects

32 The important data The state data - intersect point between L and segments -The place data have to sorted by x-coordinate order The event point data - The event have to sorted by y-coordinate order if same x-coordinate And these data change dynamic with sweep by L We have to get good data structure

33 Balanced binary search tree
The data structure using tree. Two data must be able to compare - event points are compared by y-coordinate if same ,x- coordinate - place data are compared by x-coordinate Insert , delete ,find can do It is convenient to treat “same point” as one point. So we cannot use heap structure

34 How to make status binary tree
Binary search tree’s nodes must have compare data In event point structure, the compare data is y-coordinate But in status structure, x-coordinates are change by y- coordinate of L. So each node has the most right leaf’s segment number under this node

35 How to make status binary tree
At each event point we can calculate x-coordinate from y-coordinate of L and segment number.

36 The algorithm1-1

37 The algorithm1-2

38 The algorithm1-3

39 The correctness of this algorithm
Let p be an intersection point and assume that all intersecion points q with higher priority have been computed correctly. If the p is end point ,U(p) , L(p) and C(p)are stored in J. So we can calculate p correctly If the p is not an end point , C(p) have to be inserted in J. And there are event points and that are neighbor. Then p is stored.

40 The computation time of the algorithm
Sort can be done All operation to J can be done Find new event can be done in constant time Let the number of operation to J , The computation time is

41 How large m is? At each event point , the number of operation is linear in connected edge with the point. The total number of operation can be bounded by number of edge*2 Let all event points as vertex

42 The computation time of algorithm
From Euler’s formula So total computation time is


Download ppt "Computational Geometry Capter:1-2.1"

Similar presentations


Ads by Google