CS133
Computational Geometry
Intersection Problems
1
CS133 Computational Geometry Intersection Problems 1 Riddle: Fair - - PowerPoint PPT Presentation
CS133 Computational Geometry Intersection Problems 1 Riddle: Fair Cake-cutting Using only one straight-line cut, how to split the cake into two equal pieces (by area)? Cake 2 Riddle: Fair cake-cutting Mixed cake! Still one cut Cake Cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(4,10) (1,7) (2,5) (3,5) (5,6) (3,3) π ππ Start/End 10 π1 Start 7 π2 Start 6 π3 Start 5 π1 End 5 π2 End 3 π3 End
Compare ππ to each π‘ β π Insert ππ to S
Remove ππ from S
28
29
30
31
Sweep line state (in sorted order)
32
33
34
35
36
37
38
39
l1 l2 l3 If two points have the same y-coordinate, sort them by the x-coordinate Starting point
40
l1 l2 l3 Allow the event point to store a list of all intersecting line segments When processed, reverse the
1 β© π 2: π 1, π 2 β π
41
42
r1 r2 r3 r4
43
r1 r2 r3 r4
44
45
46
r1 r2 r3 r4
47
48
50
51
Credit: https://en.wikipedia.org/wiki/Interval_tree
52
53
p1 p2 p3 p4 p5 p6 p7 p8 Corners Edge or Segment
54
1.
2.
3.
55
56
P Q No intersection points Neither π β π nor π β π The intersection is empty
57
P Q No intersection points If π β π , then any corner
If π β π, then any corner
The intersection is the contained polygon
58
59
P Q
60
P Q
61
P Q
62
P Q
63
P Q
64
P Q
65
P Q
66
P Q
67
P Q
68
P Q
69
P Q
70
P Q
71
P Q
72
P Q
73
P Q
74
Right-left Right-right left-left Left-right
75
76
R L
77
R L
78
R L
79
R L
80
R L
81
R L
82
83
84
85
86
87
88