Computational Geometry - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Computational Geometry

Description:

Think of a wooden board with some nails hammered into it. Then stretch a rubber band around all of the nails, and let go of it. ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 11
Provided by: elizabet170
Category:

less

Transcript and Presenter's Notes

Title: Computational Geometry


1
Computational Geometry
Basic Concepts
Segments Intersect
Convex Hull
Graham's Scan and Jarvis's March
2
Basic Concepts
Cross Product
Given two rays L1 (p0 to p1) and L2 (p0 to p2)?
x1 x2
)?
(
L1xL2 det
p1p2
y1 y2
(6,5)?
p2
(2,4)?
This is the signed area inside the parallelogram.
x1y2 - x2y1
(4,1)?
p1
(0,0) p0
3
Basic Concepts
Given two line segments, is line 1 to the left or
to the right of line 2 with respect to their
common endpoint?
L1 is clockwise from L2 with respect to the origin
If the cross product is
Positive line 1 is clockwise from line 2
p1p2
p2
(6,5)?
(2,4)?
Negative line 1 is counterclockwise from line 2
0 Collinear
(4,1)?
x1y2 x2y1 44 21 16 2 14
(positive)?
p1
(0,0)?
4
Basic Concepts
Right and Left Turns
p2
Cross Product is positive
p1
p0p1p2 is a right turn
p0
p2
Cross Product is negative
p1
p0p1p2 is a left turn
p0
5
Test if 2 Segments Intersect
True if either 1) Each segment must straddle the
line containing the other segment 2) Boundary
case one endpoint of a segment is on the other
segment
p3
p2
p2
p3
p4
p4
p1
p1
6
Test if 2 Segments Intersect
p3
p2
Segment p3p4 straddles the line containing
segment p1p2 if ray p1p3 and ray p1p4 have
opposite orientations relative to ray p1p2.
p4
p1
p3
p2
Segment p1p2 straddles the line containing
segment p3p4 if ray p3p1 and ray p3p2 have
opposite orientations relative to ray p3p4.
p4
p1
7
Convex Hulls
Q is a set of points. CH(Q) is the convex hull of
Q. A convex hull is the smallest convex polygon
P for which each point in Q is either on the
boundary of P or in its interior.
What does THAT mean?
Think of a wooden board with some nails hammered
into it. Then stretch a rubber band around all
of the nails, and let go of it. The shape that
the rubber band makes is the convex hull of the
board of nails.
8
An Overview of Graham's Scan
1) Start with the point at the lowest
y-coordinate (leftmost if tie) as p0. 2) Sort
points by polar angle in relation to p0. 3) Push
the first 3 points onto a stack. 4) Go in order
of polar angle and check if the next point is on
the CH. a) If it makes a left turn with the
previous two points, push it onto the
stack. b) If it makes a non-left turn, pop
the top of the stack and check again until
it makes a left turn. Then push it onto the
stack.
O(n)?
O(n lg(n))?
O(1)?
O(n)?
(Total run time O(n lg(n))?
9
An Overview of Jarvis's March
aka Giftwrapping
1) Choose the lowest point as p0 and add it to
the convex hull. 2) Choose the points with the
smallest polar angle with respect to the most
recently added point and add them to the convex
hull until you reach the highest point. This
completes the right chain. 3) Construct the left
chain by starting at the highest point and doing
the same thing until you get down to the lowest
point (p0). 4) Combine the chains to form the
complete convex hull.
O(n)?
O(n(h/2))?
h of points in CH
O(n(h/2))?
O(1)?
(Total running time O(nh)?
10
Find out more...
In my report, I cover these additional topics
Given a group of line segments, do any of them
intersect?
Graham's Scan correctness proof
Farthest Points application of Convex Hulls
Write a Comment
User Comments (0)
About PowerShow.com