CSE 4101/5101
Prof. Andy Mirzaian
2
Overview
3
Computational Geometry:Study of algorithms, data structures, and computational complexity of computational problems in geometry.
Dimension: 1 2 3 … d …
Objects: Finitely specifiable• points• lines ( line segments, rays, oriented, …)• circles ( conics )• polygons• …
Computational Model & Primitive operations: • real-RAM (Random Access Machine with exact real arithmetic)• Arithmetic: + - • Comparison: = < > • Logic: not and or• other: sin cos … ( as little as possible)
4
Landscape of Computational Geometry
Applications:• Graphics• Robotics• Vision • GIS• CAD• VLSI• Pattern Recognition• Optimization• Transportation• Statistics • . . .
Geometric Tools:• Convex Hull• Space subdivision• Arrangements• Voronoi / Delaunay Diagram• Triangulations• Geometric Transforms• Duality • . . .
Algorithmic Tools:• general • incremental• divide-&-conquer• space sweep• topological sweep• prune and search• random sampling• locus approach• multidimensional search• dynamization• . . .
Data Structures: • general• interval trees • range trees • segment trees• priority search trees• K-d trees• fractional cascading• persistent D.S. • . . .
Analysis Tools:• general• amortization• Davenport-Schinzel• . . .
Implementation Issues:• Degeneracy (symbolic
perturbation) • Robustness (inexact arithmetic) • . . .
5
Example 1: Convex Hull
6
Example 1: Convex Hull
7
Example 2: Point set triangulation
8
Example 2: Point set triangulation
9
Non-simple Simple Convex
Example 3: Simple PolygonPolygon: A closed curve in the plane consisting of finitely many straight segments.
Simple Polygon: A connected non-self-crossing polygon.
Convex Polygon: A simple polygon with no interior angle exceeding 180°.
10
Example 3: Simple Polygon Triangulation
11
Example 4: Planar Line Arrangement
12
Example 4: Planar Line Arrangement
13
Example 5: Voronoi Diagram & Delaunay Triangulation
14Nearest site proximity partitioning of the plane
Example 5: Voronoi Diagram & Delaunay Triangulation
15
Delaunay Triangulation = Dual of the Voronoi Diagram.
Example 5: Voronoi Diagram & Delaunay Triangulation
16
Delaunay triangles have the “empty circle” property.
Example 5: Voronoi Diagram & Delaunay Triangulation
17
Example 5: Voronoi Diagram & Delaunay Triangulation
18
x
z
y
z=x2+y2
Example 6: 2D Delaunay Triangulation via 3D Convex Hull
19
D
A
B
C
D
A
B
C
Applications:• Graphics• Multi-window user systems• …
E E
Example 7: Hidden Surface Removal
20
Koebe-Andreev-Thurston’s Circle Packing Theorem: [1]
Any planar graph can be drawn in the plane withvertices as centers of non-overlapping circles, such that edge between two vertices the two circles touch.
Applications: CAD, VLSI, Graphics, …
Example 8: Planar Graph Drawing
21
Geometric Preliminaries
22
Metric Space (S,d)
S = a set of objects called “points” of the space, d: S2 called the distance metric
Metric Axioms: (x,y,z S)
1. d(x,y) 0 (non-negativity) 2. d(x,y) = 0 x=y (positive definiteness) 3. d(x,y) = d(y,x) (symmetry) 4. d(x,y) + d(y,z) d(x,z) (triangle inequality)
23
d = d-dimensional real space
is the set of d-vectors x=(x1,x2, … ,xd)d, xi (for i=1..d).
d forms a vector space, i.e., it is closed under:
• scaling: x = (x1, x2, … ,xd) d , .
• addition: x+y = (x1+y1, x2+y2, … , xd+yd) d.
x1 x2
x3
3
24
Normed space Inner product of two vectors x and y: x , y .
x , x 0 (with equality x=0)
x , y = y , x x , y = x , y
Norm of a vector x: ||x|| = x , x ½ .
Distance between vectors x,y: d(x,y) = || x – y ||
||.|| is a metric norm if d(x,y) = || x – y || forms a metric.
Example: dot-product x , y = xTy = x1y1+ x2y2+ … + xdyd defines
Euclidean norm ||x|| = (|x1|2 + |x2|2 + … + |xd|2)1/2
25
Unit Ball of Norm: Unit Ball of the norm ||.|| is B = { xd | ||x|| 1} & satisfies:
B is symmetric about the origin, i.e., xB -xB. B is convex B is closed, bounded, and has nonempty interior.
Conversely, norm can be defined in terms of the unit ball:||x|| = min { 0 | x B } B = { y | yB }
x
-1xO
B ||x||=
B
26
Minkowski Metric Lp (1 p )
|| x ||p = (|x1|p + |x2|p + … + |xd|p)1/p
dp(x,y) = || x-y ||p = (|x1 –y1|p + … + |xd –yd|p)1/p
Example:L2 : (Ed : Euclidean) ||x||2 = (|x1|2 + |x2|2 + … + |xd|2)1/2
L1 : (Manhattan) ||x||1 = (|x1| + |x2| + … + |xd|)
L : ||x|| = max { |x1| , |x2| , … , |xd| }
27
Unit Ball of Minkowski Metric Lp
2
p=1p=2
p=3
p=
Minkowski metric is indeed a metric:
The triangle inequality is known as the Minkowski inequality [1]It is obtained from the Holder inequality [2]
28
points q1 , q2 , … , qk d
coefficients 1 , 2 , … , k
Linear combination:
p = i iqi = 1q1+2q2+ … +kqk (this is a vector sum)
Affine combination:
p = i iqi = 1q1+2q2+ … +kqk s. t. i i =1
Convex combination:
p = i iqi = 1q1+2q2+ … +kqk s. t. i i =1 & i0
Linear, affine & convex combinations
29
Example: d=3, k=2
x1x2
x3
3
q1
q2
OLinear combinations:span(q1,q2) = {1q1+2q2 | 1 ,2 }
= plane(O,q1,q2)
Affine combinations:aff(q1,q2) = { q1+(1-)q2 | }
= line q1q2
Convex combinations:conv(q1,q2) = { q1+(1-)q2 | 0 1 }
= line segment q1q2
conv(q1,q2,q3) = triangle q1q2q3
q1
q2
=1
0 1 =0
<0
>1
q2
q1
q3r
p
30
x
y
p1
p2
p3
> 0 (p1 p2 p3 ) counter-clockwise (CCW), i.e., left turn
< 0 (p1 p2 p3 ) clockwise (CW), i.e., right turn
= 0 (p1 p2 p3 ) collinear
½ | | = area of triangle (p1 p2 p3)
-test: consider 3 points pi = (xi,yi)2, i=1,2,3
1yx
1yx
1yx
det )pp(p
33
22
11
321
31
Consider d+1 points pi = (xi1,…,xid) d, i=1..d+1.
|| /d! = volume of d-simplex (p1 ,p2 …,pd+1).
sign() = orientation of d-simplex (p1 ,p2 …,pd+1).
-test in higher dimensions:
1..
.
...
.
.11
det)pp(p
d1,d21,d1,1d
d22221
d11211
1d21
xxx
xxxxxx
32
1. Polar angle comparison: (0i<) 1 2 (O,p1,p2) 0 [no need to compute trigonometric functions]
p1
p2
O1 2
Cont’d
Some applications of -test
p1
q1
p2
q2
3. Open line-segment crossing:
p1p2 q1q2 (p1,p2,q1) (p1,p2,q2) < 0 and
(q1,q2,p1) (q1,q2,p2) < 0
pr1
r2
q
2. In-sector test: q sector(p,r1,r2) q is left of r1 and right of r2. (assume r2 is CCW from r1 about p.)
33
(y1 - y2) x – (x1- x2) y + x1 y2 - x2 y1 = 0
a b c
(x1,y1)
(x2,y2)
(x,y)
collinear points
Some special cases:• non-vertical (b0; divide by b): y = x + • vertical (a0, b=0; divide by a): x =
0
1yx
1yx
1yx
det )pp(p 22
11
321
4. Line equation in 2D (ax+by+c=0)
34
Simple Polygons
35
Area of a simple polygon P=(p1,p2, …, pn)
FACT: 2A(P) = (O, pi ,pi+1) = (xi yi+1 – xi+1 yi ) = xi(yi+1 – yi-1)
O
pi
pi+1
P
x
y
i=1 i=1 i=1
n n n
(where O = origin, pn+1 = p1 , p0 = pn )
Algebraic area A(P) A(P) > 0 if P is CCW, A(P) < 0 if P is CW
Geometric area Area(P) = |A(P)|
36
A Jordan Curve is any closed non-self-crossing curve in the plane.
Jordan Curve
Jordan Curve Theorem: Any Jordan curve J partitions the plane into two regions,and J is their common boundary. The bounded region is called the interior of J.The unbounded region is called the exterior of J.
37
Input: Simple n-gon P & query point q.Query: Is q inside P?
q
P
Point in Polygon Inclusion Problem
38
q
P
In O(n) time shoot a ray out of q and count “proper” boundary crossings with P.
Point in Polygon Inclusion Problem
39
q
P
In O(n) time shoot a ray out of q and count “proper” boundary crossings with P.
Point in Polygon Inclusion Problem
40
q
Degenerate cases:How to count if ray passes through a vertex of the polygon?
q
Answer: implicit and slight ray perturbation:
Point in Polygon Inclusion Problem
41
Can we solve the problem in sub-linear time if P is convex?
p1
p2
pn
pn-1
Step 1: Is q in sector p1 pn pn-1?If not, then return “outside”
pnp1
pn-1
(O(1) time. Use -test.)
Step 3: j=i+1. q is inside P qpn does not cross pip i+1 . (O(1) time.)
pi
pi+1
pn
q
Step 2: Binary search. q is in sector pi pn pj, 0<i<j<n.
Let m = (i+j)/2. Is q to the left of pnpm? Update i or j to m accordingly. Repeat until j=i+1. (O(log n) time.)
pi
pj
pm
pn
Point in Polygon Inclusion Problem
Answer: Yes, in O(log n) time by “binary Search”.
42
Exercises
43
1. Show the following relationships hold for Minkowski norms in the plane:
In general, how do these Minkowski norms compare in d ?[See the CSE6118: Lecture Slide 6 for a more general result.]
2. We are given a triangle T = t1, t2, t3 by its 3 vertices in counter-clockwise order and a query point q, all in the plane. Give a simple O(1) time test to determine whether T contains q (inside or on its boundary). [Simplify your test “formula” as much as you can.]
3. We are given a sequence P = p1, p2, … , pn of n points in the plane purported to be the vertices of a convex polygon in counter-clockwise order around its boundary. Give an efficient verification algorithm that P indeed represents such a polygon.
4. We are given a convex polygon P with n vertices. Devise efficient algorithms to find(a) the largest circle inside P,(b) the largest axis-parallel square inside P,(c) the largest arbitrarily oriented square inside P.[Revisit this after we study Voronoi Diagrams and Delaunay Triangulations.]
.||||||||||||||||||||
21222
22
xxxxx
x
44
5. Let P be a given simple polygon with n vertices and q a given point inside P. For an arbitrary ray r that emanates from q, let CN(r, q, P) denote the crossing number of r, i.e., the number of edges of P crossed by ray r. Define Depth(q, P) to be the minimum CN(r, q, P) over all rays r emanating from q.
Devise an efficient algorithm to compute Depth(q,P).
6. Let P be an arbitrary simple polygon.(a) Show that there exists a square S that contains P and all 4 sides of S touch P. (A corner of S belongs to its both incident sides.) [Hint: the smallest bounding box of P at an arbitrary rotational orientation is a rectangle. We want a square. Continuously rotate the bounding box.](b) Prove or disprove: there exists a square with all 4 corners on P. [This is hard.]
45
7. We are given a set S of n pairwise disjoint line-segments in the plane. A J-walk of S is a Jordan curve that passes through the 2n endpoints of the segments in S, and contains each (open) segment of S either completely on its boundary, or completely in its interior, or completely in its exterior. A J-walk that is a polygon with exactly 2n vertices is called a P-walk of S. (See the figure below.) If a J-walk contains all segments of S on its boundary, then it is called a J-traversal. A P-walk whose (open) exterior is void of any segment of S is called a circumscribing P-walk.
(a) Show that S has a J-traversal. [Hint: use induction.](b) Show that S has a J-traversal that is a polygon with O(n) vertices?
[Hint: Extend each segment of S (in some arbitrary order) from both sides until it hits (the extension of) another segment. Now the plane is divided into O(n) convex regions. Navigate through these regions.]
(c) Show that S has a P-walk. [Harder. Use the above hint.](d) Devise an efficient algorithm to construct a P-walk of S. (e) Show that the instance below-left has no circumscribing P-walk.
46
END
Top Related