Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry...

25
Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms

description

Roadmap Closest pair Geometry sweeping Geometric preliminaries Some basics geometry algorithms Convex hull problem Diameter of a set of points Intersection of line segments

Transcript of Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry...

Page 1: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Lecture 15 Computational Geometry

• Geometry sweeping

• Geometric preliminaries

• Some basics geometry algorithms

Page 2: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Computational geometry• Computational geometry is devoted to the study of

algorithms which can be stated in terms of geometry.

Page 3: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Roadmap• Closest pair• Geometry sweeping• Geometric preliminaries• Some basics geometry algorithms

• Convex hull problem• Diameter of a set of points• Intersection of line segments

Page 4: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Closest pair problemProblem: ClosestPairInput: A set S of n points in the planeOutput: The pair p1 = (x1, y1) and p2 = (x2, y2) such that the Euclidean distance between p1 and p2 is minimal.

Divide

Conquer

Combineδl δr

2δr

δr

Page 5: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Closest pair problem

Page 6: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Closest pair problem

Page 7: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.
Page 8: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Closest pair problem

Page 9: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Where are we?• Closest pair• Geometry sweeping• Geometric preliminaries• Some basics geometry algorithms

• Convex hull problem• Diameter of a set of points• Intersection of line segments

Page 10: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

The point p2 = (x2, y2) dominates the point p1 = (x1, y1), denoted by p1 ≺ p2, if x1 ≤ x2 and y1 ≤y2.

p2

p1

A point p is maximal point if there does NOT exist a point q such that p ≠ q and p ≺ q.

p3

p4

Maximal points problem

Page 11: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Maximal points problem

Sweeping line

Θ(nlogn)

Problem: MaximalPointsInput: a set of points with their coordinates (xi,yi). Output: All the maximal points in the set.

Event

Page 12: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Geometric sweeping

• Determine the sweeping line and Events• Handle events• Solve the problem

Page 13: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

City Skyline8

(1, 1)(2, 2)(3, 3)(4, 2)(5, 3)(6, 2)(7, 0)(8, 1)

11 2 3 4 5 6 7 8

Page 14: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Where are we?• Closest pair• Geometry sweeping• Geometric preliminaries• Some basics geometry algorithms

• Convex hull problem• Diameter of a set of points• Intersection of line segments

Page 15: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Geometry preliminaries• Point: p(x,y)• Line segment: ((x1,y1),(x2,y2))• Convex polygon: A polygon P is convex if the line segment connecting any two points in P lies ENTIRELY in P.

concaveconvex

Page 16: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Left turn and right turn

p1(x1,y1) Area = ?p2(x2,y2)

p3(x3,y3)

p1(x1,y1)

p2(x2,y2)

p3(x3,y3)

D > 0 p1(x1,y1)

p2(x2,y2)

p3(x3,y3)

D < 0

Page 17: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Left turn and right turn• To determine whether a point is under or

above a line segment.• To determine if two line segments

intersect.

Page 18: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Where are we?• Closest pair• Geometry sweeping• Geometric preliminaries• Some basics geometry algorithms

• Convex hull problem• Diameter of a set of points• Intersection of line segments

Page 19: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Convex hullProblem: ConvexHullInput: a set S={p1, p2,..., pn} of n points in the plane,Output: CH(S)

•Graham scan•Jarvis’ march (gift-wrapping algorithm)•Quick-hull

Page 20: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Graham Scan

Ronald Graham(source from Wikipedia)

p0p1

p2

p3

p4p5

p6

p7

p8

p9

p10

Page 21: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Graham scan

p0p1

p2

p3

p4p5

p6

p7

p8

p9

p10

Page 22: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Geometric sweeping

• Sweeping line and Events• How to handle

events• Solve the problem

p0p1

p2

p3

p4p5

p6

p7

p8

p9

p10

Θ(nlogn)+ O(n)

Page 23: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.
Page 24: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

Conclusion• Computational geometry is devoted to the study

of algorithms which can be stated in terms of geometry.• Computational complexity: the difference

between O(n2) and O(n log n) may be the difference between days and seconds of computation.• Applications include: CAD/CAM, GIS, Integrated

Circuit design, Computer vision, ……

Page 25: Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.

References

[1] Franco P. Preparata and Michael Ian Shamos. Computational Geometry - An Introduction. Springer-Verlag. [2] Mark de Berg, Otfried Cheong,Marc van Kreveld, Mark Overmars. Computational Geometry: Algorithms and ApplicationsThird Edition (March 2008) Springer-Verlag.