Download presentation
Presentation is loading. Please wait.
1
TU/e computational geometry introduction Mark de Berg
2
TU/e IPA Basic Course—Algorithms introduction what is CG applications randomized incremental construction easy example: sorting a general framework applications to geometric problems and more …
3
TU/e Computational Geometry Computational Geometry: Area within algorithms research dealing with spatial data (points, lines, polygons, circles, spheres, curves, … ) design of efficient algorithms and data structures for spatial data elementary operations are assumed to take O(1) time and be available focus on asymptotic running times of algorithms computing intersection point of two lines, distance between two points, etc
4
TU/e Map overlay land usage annual rainfall overlay
5
TU/e Computational Geometry example: compute all intersections in a set of line segments naïve algorithm for i = 1 to n for j =i+1 to n do if s i intersects s j then report intersection Running time: O(n 2 ) Can we do better ?
6
TU/e Computational geometry: applications (1) geographic information systems (GIS) Mississippi delta Memphis Arlington 30 cities: 4 30 = 10 18 possibilities
7
TU/e Computational geometry: applications (2) computer-aided design and manufacturing (CAD/CAM) 3D model of power plant (12.748.510 triangles) motion planning virtual walkthroughs
8
TU/e Computational geometry: applications (3) 3D copier surface reconstruction 3D scanner 3D printer 1 2 3 4 5 6 7 8 9
9
TU/e Computational geometry: applications (4) Other applications of surface reconstruction digitizing cultural heritage custom-fit products reverse engineering
10
TU/e Computational geometry: applications (5) geographic information systems computer-aided design and manufacturing robotics and motion planning computer graphics and virtual reality databases structural computational biology and more … 30 45 age salary 30.000 50.000
11
TU/e Computational Geometry: algorithmic paradigms Deterministic algorithms plane sweep geometric divide-and-conquer Randomized algorithms randomized incremental construction random sampling today’s focus
12
TU/e EXERCISES Let S be a set of n line segments in the plane. Design an algorithm that decides in O (n log n) time if there are any intersections in S. Hint: Sort the endpoints on y-coordinates, and handle them in that order in a suitable manner. Extend the algorithm so that it reports all intersections in time O ((n+k) log n), where k is the number of intersections. For the experts: Let u (n ) be the maximum number of pairs of points at distance 1 in a set of n points in the plane. Prove that u(n) = Ω (n log n). Let D be a set of n discs in the plane. Prove that the union complexity of D is O (n ).
13
TU/e Plane-sweep algorithm for line-segment intersection 1 23 4 5 6 sweep line insert segment 1 insert segment 2 insert segment 3 insert segment 4 insert segment 5 delete segment 1 When two segments intersect, then there is a horizontal line L such that the two segments both intersect L they are neighbors along L Ordering along L: 1,23,1,23,1,4,23,5,1,4,213,5,4,2
14
TU/e Plane sweep SegmentIntersect 1.Sort the endpoints by y-coordinate. Let p 1,…,p 2n be the sorted set of endpoints. 2.Initialize empty search tree T. 3. for i = 1 to 2n 4. do { if p i is the left endpoint of a segment s 5. then Insert s into the tree T 6. else Delete s from the tree T 7. Check all pairs of segments that become neighbors along the sweep line for intersection, report if there is an intersection. } Running time ? Extension to reporting all intersections ?
15
TU/e COFFEE
16
TU/e Lecture II: Randomized incremental construction ParanoidMax (A) (* A [1..n ] is an array of n numbers *) Randomly permute the elements in A max := A[1] for i := 2 to n do if A [i ] > max then { max := A[i ] for j = 1 to i -1 do if A[i ] > max then error } return max Warm-up exercise: Analyze the worst-case and expected running time of the following algorithm.
17
TU/e Worst-case running time Worst-case = O(1) + time for lines 2—7 = O(1) + ∑ 2≤i≤n (time for i-th iteration) = O(1) + ∑ 2≤i≤n ∑ 1≤j≤i-1 O(1) = O(1) + ∑ 2≤i≤n O(i) = O(n 2 )
18
TU/e Expected running time E [ looptijd ] = O(1) + E [ time for lines 2—7 ] = O(1) + E [ ∑ 2≤i≤n (time for i-th iteration) ] = O(1) + ∑ 2≤i≤n E [ time for i-th iteration ] = O(1) + ∑ 2≤i≤n { Pr [ A[i] ≤ max { A[1..i-1 ] } ] ∙ O(1) + Pr [ A[i] > max { A[1..i-1 ] } ] ∙ O(i) } = O(1) + ∑ 2≤i≤n { 1 ∙ O(1) + (1/i ) ∙ O(i) } = O(n )
19
TU/e EXERCISE 1.Give an algorithm that puts the elements of a given array A[1..n] into random order. Your algorithm should be such that every possible permutation is equally likely to be the result.
20
TU/e Sorting using Incremental Construction Input: numbers x 1,…,x n Output: partitioning of x-axis into a collection T of empty intervals defined by the input points x 3 x 1 x 5 x 4 x 2 A geometric view of sorting Incremental Construction: “Add” input points one by one, and maintain partitioning into intervals x 3 x 1 x 5 x 4 x 2
21
TU/e Sorting using Incremental Construction x 3 x 1 x 5 x 4 x 2 IC-Sort (S) 1.T := { [ -infty : +infty] } 2. for i := 1 to n 3. do { Find interval J in T that contains x i and remove it. 4. Determine new intervals and insert them into T. } for each point, maintain pointer to interval that contains it for each interval in T, maintain conflict list of all points inside list is empty list: x 4, x 5 How?
22
TU/e Sorting using Incremental Construction IC-Sort (S) 1.T := { [ -infty : +infty] } 2. for i := 1 to n 3. do { Find interval J in T that contains x i and remove it. 4. Determine new empty intervals and insert them into T. 5. Split conflict list of J to get the two new conflict lists. } for each point, maintain pointer to interval that contains it for each interval in T, maintain conflict list of all points inside TOTAL TIME: O ( total size of conflict lists of all intervals that ever appear) WORST-CASE: Time analysis: O(n 2 )
23
TU/e Sorting using Incremental Construction RIC-Sort (S) 1.Randomly permute input points 2.T := { [ -infty : +infty] } 3. for i := 1 to n 4. do { Find interval J in T that contains x i and remove it. 5. Determine new empty intervals and insert them into T. 6. Split conflict list of J to get the two new conflict lists. } for each point, maintain pointer to interval that contains it for each interval in T, maintain conflict list of all points inside TOTAL TIME: O ( total size of conflict lists of all intervals that are created) EXPECTED TIME: ?? Time analysis:
24
TU/e An abstract framework for RIC S = set of n (geometric) objects; the input C = set of configurations D: assigns a defining set D(Δ) S to every configuration Δ є C K: assigns a killing set K(Δ) S to every configuration Δ є C 4-tuple (S, C, D, K) is called a configuration space configuration Δ є C is active over a subset S’ S if: D(Δ) S’ and K(Δ) S’ = o T(S) = active configurations over S; the output ∩ ∩ ∩ ∩ ∩ /
25
TU/e Sorting using Incremental Construction RIC(S) 1.Compute random permutation x 1,…x n of input elements 2.T := { active configurations over empty set } 3. for i := 1 to n 4. do { Remove all configurations Δ with x i є K(Δ) from T. 5. Determine new active configurations; insert them into T. 6. Construct conflict lists of new active configurations. } for each x i, maintain pointers to all configurations Δ such that x i є K(Δ) for each configuration Δ in T, maintain conflict list of all x i є K(Δ) Theorem: Expected total size of conflict lists of all created configs: O( ∑ 1≤i≤n (n / i 2 ) ∙ E [ # active configurations in step i ] )
26
TU/e EXERCISE 1.Use the theorem to prove that the running time of the RIC algorithm for sorting runs in O( n log n ) time.
27
TU/e LUNCH
28
TU/e Lecture III RIC: more applications Voronoi diagrams and Delaunay triangulations
29
TU/e Principia Philosophiae (R. Descartes, 1644). Voronoi diagram The universe according to Descartes
30
TU/e............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1153 1180 1103 981 1098 1127 1098 1108 1163......................................................................................................................................................................................................................................................................................................................................... Construction of 3D height models (1)
31
TU/e 1153 1180 1103 981 1098 1127 1098 1108 1163 height? Construction of 3D height models (2)
32
TU/e Construction of 3D height models (3) Better: use interpolation to determine the height triangulation 983
33
TU/e Construction of 3D height models (4) 1153 1180 1103 981 1098 1127 1098 1108 1163 long and thin triangles are bad try to avoid small angles What is a good triangulation? 1153 1180 1103 981 1098 1127 1098 1108 1163
34
TU/e Construction of 3D height models (5) Voronoi diagram Delaunay triangulation: triangulation that maximizes the minimum angle !
35
TU/e Voronoi diagrams and Delaunay triangulations P : n points (sites) in the plane V(p i ) = Voronoi cell of site p i = { q є R 2 : dist(q,p i ) < dist(q,p j ) for all j ≠i } Vor(P ) = Voronoi diagram of P = subdivision induced by Voronoi cells DT(P) = Delaunay triangulation of P = dual graph of Vor(P)
36
TU/e EXERCISES Prove: a triangle p i p j p k is a triangle in DT(P) if and only if its circumcircle C (p i p j p k ) does not contain any other site Prove: number of triangles in DT(P) is at most 2n-5 Hint: Euler’s formula for connected planar graphs: #vertices — #edges + #faces = 2 Design and analyze a randomized incremental algorithm to construct DT(P).
37
TU/e COFFEE
38
TU/e RIC – Limitations of the framework Robot motion planning What is the region that is reachable for the robot? Lecture IV: wrap-up
39
TU/e RIC – Limitations of the framework (cont’d) The single-cell problem: Compute cell containing the origin Idea: compute vertical decomposition for the cell using RIC ?!
40
TU/e Spatial data structures store geometric data in 2-, 3- or higher dimensional space such that certain queries can be answered efficiently applications: GIS, graphics and virtual reality, … Examples: range searching nearest-neighbor searching point location more computational geometry
41
TU/e plane sweep parametric search arrangements geometric duality, inversion, Plücker coordinates, … kinetic data structures core sets Davenport-Schinzel sequences … and more …
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.