computational geometry lecture point location · 2018-06-18 · 2 dr. tamara mchedlidze · dr....

91
Dr. Tamara Mchedlidze · Dr. Chih-Hung Liu · Computational Geometry Lecture Point Location Chih-Hung Liu · Tamara Mchledidze Computational Geometry Lecture INSTITUT F ¨ UR THEORETISCHE INFORMATIK · FAKULT ¨ AT F ¨ UR INFORMATIK Point Location 20.06.2018

Upload: others

Post on 17-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Dr. Tamara Mchedlidze · Dr. Chih-Hung Liu · Computational Geometry Lecture Point Location

Chih-Hung Liu · Tamara Mchledidze

Computational Geometry Lecture

INSTITUT FUR THEORETISCHE INFORMATIK · FAKULTAT FUR INFORMATIK

Point Location

20.06.2018

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location2

Motivation

Given a position p = (px, py)in a map, determine in which

country p lies.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location2

Motivation

Given a position p = (px, py)in a map, determine in which

country p lies.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location2

Motivation

Given a position p = (px, py)in a map, determine in which

country p lies.

more precisely:

Find a data structure for

e�ciently answering such

point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location2

Motivation

Given a position p = (px, py)in a map, determine in which

country p lies.

more precisely:

Find a data structure for

e�ciently answering such

point location queries.

The map is modeled as a

subdivision of the plane into

disjoint polygons.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Think for 2 minutes!

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query: find correct slab

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query: find correct slab

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�O(log n)time

2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�O(log n)time

But:

2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�O(log n)time

But: Space?

2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�O(log n)time

But: Space? ⇥(n2)

2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location3

Problem Setting

Goal: Given subdivision S of the plane with n segments,

construct data structure for fast point location queries.

Solution: Partition S at points into vertical slabs.

Query:

search this slab

find correct slab

�O(log n)time

But: Space? ⇥(n2) Question: lower bound example?

2 binary

searches

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-1

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-2

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-3

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-4

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-5

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-6

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-7

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-8

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-9

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-10

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-11

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

edge from each

endpoint vertically

up and down to

neighboring

segment

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-12

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-13

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

R

Compare to slab

partition

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location4-14

Reducing the Complexity

Observation: Slab partition is a refinement S 0of S into

(possibly degenerate) trapezoids.

Goal: Find a suitable refinement of S with lower

complexity!

Solution: Trapezoidal map T (S)

Assumption: S is in general position, i.e., no two segment

endpoints have the same x-coordinate

R

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side: �

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side: � �

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side: � � �

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side: � � � �

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side:

R

� � � � �

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side:

R

� � � � �

leftp(�)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location5

Notation

Definition: A side of a face of T (S) is a segment of maximal

length contained in face boundary.

Observation: S in general position ) each face � of T (S) has:one or two vertical sides

two non-vertical sides

top(�)

bot(�)

Left side:

R

� � � � �

leftp(�)analogous: rightp(�)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location6

Complexity of the Trapezoidal Map

Obs.: A trapezoid � is uniquely defined by bot(�), top(�),

leftp(�) and rightp(�).

leftp(�) rightp(�)

top(�)

bot(�)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location6

Complexity of the Trapezoidal Map

Obs.: A trapezoid � is uniquely defined by bot(�), top(�),

leftp(�) and rightp(�).

leftp(�) rightp(�)

top(�)

bot(�)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location6

Complexity of the Trapezoidal Map

Obs.: A trapezoid � is uniquely defined by bot(�), top(�),

leftp(�) and rightp(�).

leftp(�) rightp(�)

top(�)

bot(�)

Lemma 1: The trapezoidal map T (S) of a set S of n segments

in general position contains at most 6n+ 4 vertices

and at most 3n+ 1 trapezoids.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location6

Complexity of the Trapezoidal Map

Obs.: A trapezoid � is uniquely defined by bot(�), top(�),

leftp(�) and rightp(�).

leftp(�) rightp(�)

top(�)

bot(�)

Lemma 1: The trapezoidal map T (S) of a set S of n segments

in general position contains at most 6n+ 4 vertices

and at most 3n+ 1 trapezoids.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location7

Search Structure

Goal: Compute the trapzoidal map T (S) and simultaneously a

data structure D(S) for point location in T (S).

A

B

C

D E

F

G

p1 q1

p2

q2

s1

s2

T (S)

A

B

C

D

E

F

G

p1

q1

p2

q2s1

s2

s2

D(S)

D(S) is a DAG with:

x-node for point p tests left/right of p

y-node for segment s tests above/below s

leaf node for trapezoid �

p

s

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location8

Incremental Algorithm

TrapezoidalMap(S)Input: set S = {s1, . . . , sn} of crossing-free segments

Output: trapezoidal map T (S) and search structure D(S)initialize T and D for R = BBox(S)S RandomPermutation(S)for i 1 to n do

H {� 2 T | � \ si 6= ;}T T \HT T [ newly created trapezoids of siD replace leaves for H by nodes and leaves for new trapezoids

return (T ,D)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location8

Incremental Algorithm

TrapezoidalMap(S)Input: set S = {s1, . . . , sn} of crossing-free segments

Output: trapezoidal map T (S) and search structure D(S)initialize T and D for R = BBox(S)S RandomPermutation(S)for i 1 to n do

H {� 2 T | � \ si 6= ;}T T \HT T [ newly created trapezoids of siD replace leaves for H by nodes and leaves for new trapezoids

return (T ,D)

Problem: Size of D and query time depend on insertion order

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location8

Incremental Algorithm

TrapezoidalMap(S)Input: set S = {s1, . . . , sn} of crossing-free segments

Output: trapezoidal map T (S) and search structure D(S)initialize T and D for R = BBox(S)S RandomPermutation(S)for i 1 to n do

H {� 2 T | � \ si 6= ;}T T \HT T [ newly created trapezoids of siD replace leaves for H by nodes and leaves for new trapezoids

return (T ,D)

Problem: Size of D and query time depend on insertion order

Solution: Randomization!

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)Step 1: H {� 2 T | � \ si 6= ;}

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)Step 1: H {� 2 T | � \ si 6= ;}

pi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)Step 1: H {� 2 T | � \ si 6= ;}

pi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)Step 1: H {� 2 T | � \ si 6= ;}

Task: How do you find the set H of

trapezoids from left to right?

pi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location9

Randomized Incremental Algorithm

Invariant: T is trapezoidal map for Si = {s1, . . . , si} and

D is corresponding search structure

Initialization: T = T (;) = R and D = (R, ;)Step 1: H {� 2 T | � \ si 6= ;}

Task: How do you find the set H of

trapezoids from left to right?

�0 FindTrapezoid(pi,D); j 0while right endpoint qi right of rightp(�j) do

if rightp(�j) above si then�j+1 lower right neighbor of �j

else

�j+1 upper right neighbor of �j

j j + 1

return �0, . . . ,�j

pi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location10-1

Updating T (S) and D(S)Step 2: Update T and D

Case 1: si ⇢ �0

�0 A

B

C D

T (Si�1) T (Si)

pi si

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location10-2

Updating T (S) and D(S)Step 2: Update T and D

Case 1: si ⇢ �0

D(Si�1)

�0

D(Si)

pi

qisi

A

B CD

�0 A

B

C D

T (Si�1) T (Si)

pi si

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location10-3

Updating T (S) and D(S)Step 2: Update T and D

Case 1: si ⇢ �0

Case 2: |T \ si| � 2

�0 �1�2

�3 AB C

D E F

T (Si�1) T (Si)

pisi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location10-4

Updating T (S) and D(S)Step 2: Update T and D

Case 1: si ⇢ �0

Case 2: |T \ si| � 2

�0 �1�2

�3 AB C

D E F

T (Si�1) T (Si)

D(Si�1)

�2�0 �1 �3

D(Si)

?

pisi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location10-5

Updating T (S) and D(S)Step 2: Update T and D

Case 1: si ⇢ �0

Case 2: |T \ si| � 2

�0 �1�2

�3 AB C

D E F

T (Si�1) T (Si)

D(Si�1)

�2�0 �1 �3

D(Si)

si si si

si

qi

A

B

C

D

E

F

pisi

qi

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location11

Analysis

Thm 1:The algorithm computes the trapezoidal map T (S)and the search structure D for a set S of n segments

in expected O(n log n) time. The expected size of Dis O(n) and the expected query time is O(log n).

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location11

Analysis

Thm 1:The algorithm computes the trapezoidal map T (S)and the search structure D for a set S of n segments

in expected O(n log n) time. The expected size of Dis O(n) and the expected query time is O(log n).

Observations:

worst case: size of D is quadratic and query time is linear

hope: that happens rarely!

consider expected time and size over all n! permutations of Sthe theorem holds independently of the input set S

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location11

Analysis

Thm 1:The algorithm computes the trapezoidal map T (S)and the search structure D for a set S of n segments

in expected O(n log n) time. The expected size of Dis O(n) and the expected query time is O(log n).

Observations:

worst case: size of D is quadratic and query time is linear

hope: that happens rarely!

consider expected time and size over all n! permutations of Sthe theorem holds independently of the input set S

Proof:

define random variables and consider their expected values

perform backward analysis! details on blackboard

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location12

Worst-Case Consideration

So far: expected query time for arbitrary point is O(log n)

But: each permutation could have a very bad (worst

case) query point

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location12

Worst-Case Consideration

So far: expected query time for arbitrary point is O(log n)

But: each permutation could have a very bad (worst

case) query point

Lemma 2: Let S be a set of n crossing-free segments, let q be

a query point and let � > 0. ThenPr[search path for q longer than 3� ln(n+ 1)] 1/(n+ 1)� ln 1.25�1

.

No proof. (or see Chapter 6.4)

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location12

Worst-Case Consideration

So far: expected query time for arbitrary point is O(log n)

But: each permutation could have a very bad (worst

case) query point

Lemma 2: Let S be a set of n crossing-free segments, let q be

a query point and let � > 0. ThenPr[search path for q longer than 3� ln(n+ 1)] 1/(n+ 1)� ln 1.25�1

.

Lemma 3: Let S be a set of n crossing-free segments and

� > 0. ThenPr[max. search path in D longer than 3� ln(n+ 1)] 2/(n+ 1)� ln 1.25�3

.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location12

Worst-Case Consideration

So far: expected query time for arbitrary point is O(log n)

But: each permutation could have a very bad (worst

case) query point

Lemma 2: Let S be a set of n crossing-free segments, let q be

a query point and let � > 0. ThenPr[search path for q longer than 3� ln(n+ 1)] 1/(n+ 1)� ln 1.25�1

.

Lemma 3: Let S be a set of n crossing-free segments and

� > 0. ThenPr[max. search path in D longer than 3� ln(n+ 1)] 2/(n+ 1)� ln 1.25�3

.

Thm 2: Let S be a subdivision of the plane with n edges.

There is a search structure for point location within

S that has O(n) space and O(log n) query time.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location13

Degenerate Inputs

Two assumptions:

no two segment endpoints have the same x-coordinatesalways unique answers (left/right) on the search path

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location13

Degenerate Inputs

Two assumptions:

no two segment endpoints have the same x-coordinatesalways unique answers (left/right) on the search path

solution: symbolic shear transformation

' : (x, y) 7! (x+ "y, y)

'

x

y

x

y

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location13

Degenerate Inputs

Two assumptions:

no two segment endpoints have the same x-coordinatesalways unique answers (left/right) on the search path

solution: symbolic shear transformation

' : (x, y) 7! (x+ "y, y)

'

x

y

x

y

Here " > 0 is chosen such that the x-order < of the points

does not change.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location14

Degenerate Inputs

E↵ect 1: lexicographic order

E↵ect 2: a�ne map ' maintains point–line relations

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location14

Degenerate Inputs

Run algorithm for 'S = {'s | s 2 S} and 'p.

E↵ect 1: lexicographic order

E↵ect 2: a�ne map ' maintains point–line relations

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location14

Degenerate Inputs

Run algorithm for 'S = {'s | s 2 S} and 'p.

Two basic operations for constructing T and D:

1. is q left or right of the vertical line through p?2. is q above or below the segment s?

E↵ect 1: lexicographic order

E↵ect 2: a�ne map ' maintains point–line relations

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location14

Degenerate Inputs

Run algorithm for 'S = {'s | s 2 S} and 'p.

Two basic operations for constructing T and D:

1. is q left or right of the vertical line through p?2. is q above or below the segment s?

Locating a point q in T (S) works by locating 'q in T ('S).

E↵ect 1: lexicographic order

E↵ect 2: a�ne map ' maintains point–line relations

! see Chapter 6.3 in [De Berg et al. 2008]

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location15

Discussion

Are there similar methods for higher dimensions?

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location15

Discussion

Are there similar methods for higher dimensions?

The currently best three-dimensional data structure uses O(n log n)space and O(log2 n) query time [Snoeyink ’04]. Whether linear space

and O(log n) query time is possible is an open question. In even higher

dimensions e�cient methods are known only for special hyper plane

subdivisions.

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location15

Discussion

Are there similar methods for higher dimensions?

The currently best three-dimensional data structure uses O(n log n)space and O(log2 n) query time [Snoeyink ’04]. Whether linear space

and O(log n) query time is possible is an open question. In even higher

dimensions e�cient methods are known only for special hyper plane

subdivisions.

Are there dynamic data structures that allow insertions and

deletions?

Dr. Tamara Mchedlidze · Dr. Darren Strash · Computational Geometry Lecture Point Location15

Discussion

Are there similar methods for higher dimensions?

The currently best three-dimensional data structure uses O(n log n)space and O(log2 n) query time [Snoeyink ’04]. Whether linear space

and O(log n) query time is possible is an open question. In even higher

dimensions e�cient methods are known only for special hyper plane

subdivisions.

Are there dynamic data structures that allow insertions and

deletions?

Dynamic data structures for point location are well known, see the survey

by [Chiang, Tamassia ’92]. A more recent example by [Arge et al. ’06]

needs O(n) space, O(log n) query time and O(log n) update time

(insertions).