Lecture 16 Computational Geometry - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

Lecture 16 Computational Geometry

Description:

Title: Lecture 18 Computational Geometry Last modified by: Xiaojuan CAI Document presentation format: Custom Other titles: Optima Heiti SC Light Arial Segoe UI ... – PowerPoint PPT presentation

Number of Views:128
Avg rating:3.0/5.0
Slides: 33
Provided by: basicsSj
Category:

less

Transcript and Presenter's Notes

Title: Lecture 16 Computational Geometry


1
Lecture 16 Computational Geometry
  • Geometry sweeping
  • Geometric preliminaries
  • Some basics geometry algorithms

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

3
Computational geometry
  • Computational geometry is devoted to the study of
    algorithms which can be stated in terms of
    geometry.

4
Closest pair problem
Problem ClosestPair Input A set S of n points
in the plane Output The pair p1 (x1, y1) and
p2 (x2, y2) such that the Euclidean distance
between p1 and p2 is minimal.
2dr
Divide
dr
Conquer
dl
dr
Combine
5
Closest pair problem
6
Closest pair problem
7
(No Transcript)
8
Closest pair problem
9
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

10
Maximal points problem
The point p2 (x2, y2) dominates the point p1
(x1, y1), denoted by p1 ? p2, if x1 x2 and y1
y2.
p4
p2
p3
p1
A point p is maximal point if there does NOT
exist a point q such that p ? q and p ? q.
11
Maximal points problem
Problem MaximalPoints Input a set of points
with their coordinates (xi,yi). Output All the
maximal points in the set.
Event
Sweeping line
12
Geometric sweeping
  • Determine the sweeping line and Events
  • Handle events
  • Solve the problem

13
City Skyline
8 (1, 1) (2, 2) (3, 3) (4, 2) (5, 3) (6, 2) (7,
0) (8, 1)
14
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

15
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.

concave
convex
16
Left turn and right turn
p3(x3,y3)
p2(x2,y2)
p1(x1,y1)
p3(x3,y3)
p3(x3,y3)
p2(x2,y2)
p2(x2,y2)
D gt 0
D lt 0
p1(x1,y1)
p1(x1,y1)
17
Left turn and right turn
  • To determine whether a point is under or above a
    line segment.
  • To determine if two line segments intersect.

18
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

19
Convex hull
Problem ConvexHull Input a set Sp1, p2,...,
pn of n points in the plane, Output CH(S)
  • Graham scan
  • Jarvis march (gift-wrapping algorithm)
  • Quick-hull

20
Jarvis march
  • Start at some extreme point, which is guaranteed
    to be on the hull.
  • At each step, test each of the points, and find
    the one which makes the largest right-hand turn.
    That point has to be the next one on the hull.

p6
p8
p4
p5
p9
p7
p3
p10
p2
p1
p0
21
Graham Scan
p6
p8
p4
p5
p9
p7
p3
p10
p2
p1
p0
Ronald Graham (source from Wikipedia)
22
Graham scan









p6
p8
p4
p5
p9
p7
p3
p10
p2
p1
p0
23
Geometric sweeping
  • Sweeping line and Events
  • How to handle events
  • Solve the problem

p6
p8
p4
p5
p9
p7
p3
p10
p2
p1
p0
24
(No Transcript)
25
Quick hull
  • Given a chord pipj of the convex hull
  • Find the farthest one pk from the chord
  • The points inside the triangle pipjpk cannot be
    on the hull. Put the points which lie outside
    edge pipk in set s1, and points outside edge pjpk
    in set s2.
  • Recursively solve the problem of s1 and s2.

p6
p8
p4
p5
p9
p7
p3
p10
p2
p1
p0
http//www.cs.princeton.edu/courses/archive/fall10
/cos226/demo/ah/ConvexHull.html
26
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

27
The diameter of a set of points
p6
p8
p4
p9
The diameter of a set P of points equals to the
diameter of CH(P).
p10
Any two points that admit two parallel supporting
lines are called antipodal pair.
p11
p2
p12
p1
Any pair of vertices realizing the diameter in a
convex polygon is an antipodal pair.
How to find antipodal pairs?
28
The diameter of a set of points
p6
p8
p4
p9
p10
p2
p12
p1
How many antipodal pairs?
29
Rotating caliper
p6
p8
p4
p9
p10
p2
p12
p1
m m/2 antipodal pairs, m n
30
(No Transcript)
31
Union of 2 convex polygons
32
Intersection of orthogonal line segments
  • Sweep vertical line from left to right.
  • x-coordinates define events.
  • h-segment (left endpoint) insert y-coordinate
    into BST.
  • h-segment (right endpoint) remove y-coordinate
    from BST.
  • v-segment range search for interval of
    y-endpoints.

3
3
4
2
2
1
1
0
0
33
Intersection of orthogonal line segments
  • Sweep vertical line from left to right.
  • x-coordinates define events.
  • h-segment (left endpoint) insert y-coordinate
    into BST.
  • h-segment (right endpoint) remove y-coordinate
    from BST.
  • v-segment range search for interval of
    y-endpoints.

3
3
4
2
1
1
0
0
34
Intersection of orthogonal line segments
Review Binary Search Tree
  • 1d range search. Find all keys between lo and
    hi.

Proposition. Running time is proportional to R
log N (assuming BST is balanced). Pf. Nodes
examined search path to lo search path to hi
matching keys.
35
Intersection of orthogonal line segments
36
Intersections of line segments
Problem Intersections Input a set Ll1,
l2,..., ln of n line segments in the
plane, Output the set of points in which they
intersect.
Assume that NO three line segments intersect at
the same point.
37
Intersections of line segments
1. If a and b intersects, then at some time
(before the intersection point), a and b are
adjacent on the sweeping line . 2. When the
sweeping line passes the intersection point of
a,b, then the order of a, b will be reversed.
38
Intersections of line segments
  • Sweep endpoints and intersect points from left to
    right
  • left endpoints of l, insert l, and see whether l
    intersects with above(l) and below(l) if so, add
    the intersect points.
  • right endpoints of l, remove l, and see whether
    above(l) and below(l) intersect if so, add the
    intersect point
  • intersect point of (l,l) see whether l and
    below(l) I and above(l) intersect if so, add
    the intersect point swap (l,l).

e d b f
e b d f
b e d f
e d b
http//www.cs.princeton.edu/courses/archive/fall10
/cos226/demo/gishur/
39
Intersections of line segments
40
Intersections of line segments
41
Where are we?
  • Diameter of a set of points
  • Intersection of line segments
  • Intersection of rectangles
  • Nearest neighbor search

42
Intersection of rectangles
3
2
0
1
  • Microprocessor design became a geometric problem.
  • Certain wires cannot intersect.
  • Certain spacing needed between different types of
    wires.
  • Debugging orthogonal rectangle intersection
    search.

43
Intersection of rectangles
  • Sweep vertical line from left to right.
  • x-coordinates of left and right endpoints define
    events.
  • Maintain set of rectangles that intersect the
    sweep line in an interval search tree (using
    y-intervals of rectangle).
  • Left endpoint interval search for y-interval of
    rectangle insert y-interval.
  • Right endpoint remove y-interval.

3
3
2
2
0
0
1
1
y-coordinates
44
Interval search tree
Insertion BST insertion
45
Interval search tree
  • Search (lo, hi )
  • If interval in node intersects query interval,
    return it.
  • If left subtree is null, go right.
  • If max endpoint in left subtree is less than lo,
    go right.
  • Else go left.

(17, 19)
24
interval intersection search for (23, 25) (12,
14) (21, 23)
(5, 8)
(21, 24)
24
22
(4, 8)
(15, 18)
22
8
(16, 22)
(7, 10)
22
10
46
Flocking birds
http//www.youtube.com/watch?vXH-groCeKbE
47
Simulation of Flocking birds
48
2d-tree
  • Recursively partition plane into two halfplanes.

8
1
3
6
2
9
3
8
4
7
6
1
9
10
5
5
2
7
10
4
49
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,

50
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.
Write a Comment
User Comments (0)
About PowerShow.com