Point Location Geometry Motivation Point Location and Trapezoidal - - PowerPoint PPT Presentation

point location
SMART_READER_LITE
LIVE PREVIEW

Point Location Geometry Motivation Point Location and Trapezoidal - - PowerPoint PPT Presentation

Yazd Univ. Computational Point Location Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental 1397-2 Algorithm Search Structure 1 / 38 Motivation: Point location in a map Point location query: Given a map and


slide-1
SLIDE 1

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Point Location

1397-2

1 / 38

slide-2
SLIDE 2

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Motivation:

Point location in a map

Point location query: Given a map and a query point q specified by its coordinates, find the region of the map containing q.

5◦6′ 52◦3′

2 / 38

slide-3
SLIDE 3

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Motivation:

Point location in a map

Store the map electronically, and let the computer do the point location for you. Preprocess the maps, and to store them in a data structure that makes it possible to answer point location queries fast.

5◦6′ 52◦3′

3 / 38

slide-4
SLIDE 4

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Motivation:

Point location in a map

Store the map electronically, and let the computer do the point location for you. Preprocess the maps, and to store them in a data structure that makes it possible to answer point location queries fast.

5◦6′ 52◦3′

3 / 38

slide-5
SLIDE 5

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Store the map electronically, and let the computer do the point location for you. Preprocess the maps, and to store them in a data structure that makes it possible to answer point location queries fast.

5◦6′ 52◦3′

4 / 38

slide-6
SLIDE 6

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Store the map electronically, and let the computer do the point location for you. Preprocess the maps, and to store them in a data structure that makes it possible to answer point location queries fast.

5◦6′ 52◦3′

4 / 38

slide-7
SLIDE 7

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Given a planar subdivision S with n edges, store S in such a way that we can answer queries of the following type: Given a query point q, report the face f of S that contains q.

5 / 38

slide-8
SLIDE 8

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Find the slab containing the query point: O(log n) time. Query the slab: O(log n) time.

6 / 38

slide-9
SLIDE 9

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Find the slab containing the query point: O(log n) time. Query the slab: O(log n) time.

6 / 38

slide-10
SLIDE 10

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

What about the storage requirements?

7 / 38

slide-11
SLIDE 11

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

What about the storage requirements?

slabs

n 4 n 4

7 / 38

slide-12
SLIDE 12

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

What about the storage requirements? O(n2)

slabs

n 4 n 4

7 / 38

slide-13
SLIDE 13

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Two Simplifications:

Bounding Box. No two distinct points on a vertical line (general position).

8 / 38

slide-14
SLIDE 14

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Two Simplifications:

Bounding Box. No two distinct points on a vertical line (general position).

8 / 38

slide-15
SLIDE 15

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Trapezoidal Map:

drawing two vertical extensions from every endpoint Sides of a face

R 9 / 38

slide-16
SLIDE 16

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Trapezoidal Map:

drawing two vertical extensions from every endpoint Sides of a face

R

sides

9 / 38

slide-17
SLIDE 17

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.1 Each face in a trapezoidal map of a set S of line segments in general position has one or two vertical sides and exactly two non-vertical sides.

Proof.

Each face is convex: all angles are at most 180◦ Because of the convexity, each face has at most 2 vertical sides. If there is more than two non-vertical sides, then at least two of them must meet at a vertex which contradict the definition of a face. Since a face is bounded, it cannot have less than two non-vertical sides and that it must have at least one vertical side.

10 / 38

slide-18
SLIDE 18

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.1 Each face in a trapezoidal map of a set S of line segments in general position has one or two vertical sides and exactly two non-vertical sides.

Proof.

Each face is convex: all angles are at most 180◦ Because of the convexity, each face has at most 2 vertical sides. If there is more than two non-vertical sides, then at least two of them must meet at a vertex which contradict the definition of a face. Since a face is bounded, it cannot have less than two non-vertical sides and that it must have at least one vertical side.

10 / 38

slide-19
SLIDE 19

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.1 Each face in a trapezoidal map of a set S of line segments in general position has one or two vertical sides and exactly two non-vertical sides.

Proof.

Each face is convex: all angles are at most 180◦ Because of the convexity, each face has at most 2 vertical sides. If there is more than two non-vertical sides, then at least two of them must meet at a vertex which contradict the definition of a face. Since a face is bounded, it cannot have less than two non-vertical sides and that it must have at least one vertical side.

10 / 38

slide-20
SLIDE 20

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.1 Each face in a trapezoidal map of a set S of line segments in general position has one or two vertical sides and exactly two non-vertical sides.

Proof.

Each face is convex: all angles are at most 180◦ Because of the convexity, each face has at most 2 vertical sides. If there is more than two non-vertical sides, then at least two of them must meet at a vertex which contradict the definition of a face. Since a face is bounded, it cannot have less than two non-vertical sides and that it must have at least one vertical side.

10 / 38

slide-21
SLIDE 21

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.1 Each face in a trapezoidal map of a set S of line segments in general position has one or two vertical sides and exactly two non-vertical sides.

∆ bottom(∆) top(∆)

11 / 38

slide-22
SLIDE 22

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps: Cases for the left side:

(a) It degenerates to a point, which is the common left endpoint of top(∆) and bottom(∆). (b) It is the lower vertical extension of the left endpoint of top(∆) that abuts

  • n bottom(∆).

(c) It is the upper vertical extension of the left endpoint of bottom(∆) that abuts on top(∆). (d) It consists of the upper and lower extension of the right endpoint p of a third segment s. These extensions abut on top(∆) and bottom(∆), respectively. (e) It is the left edge of R. This case occurs for a single trapezoid of T(S) only, namely the unique leftmost trapezoid of T(S). The first four cases are illustrated in Figure 6.4. The five cases for the right

(a) (b) (c)

top(∆) bottom(∆) leftp(∆)

(d)

s leftp(∆) leftp(∆) leftp(∆) top(∆) top(∆) top(∆) bottom(∆) bottom(∆) bottom(∆)

12 / 38

slide-23
SLIDE 23

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.2 The trapezoidal map T(S) of a set S of n line segments in general position contains at most 6n+4 vertices and at most 3n+1 trapezoids.

Proof. #vertices: Bounding box+endpoints of line segments+new vertices generated by extensions= 4 + 2n + 2(2n) = 6n + 4. Left endpoint of a segment can be leftp(∆) of two

  • trapezoids. (Note coincide endpoints) .

Right endpoint of a segment can be leftp(∆) of one trapezoid. #trapezoids= 3n + 1.

R

13 / 38

slide-24
SLIDE 24

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.2 The trapezoidal map T(S) of a set S of n line segments in general position contains at most 6n+4 vertices and at most 3n+1 trapezoids.

Proof. #vertices: Bounding box+endpoints of line segments+new vertices generated by extensions= 4 + 2n + 2(2n) = 6n + 4. Left endpoint of a segment can be leftp(∆) of two

  • trapezoids. (Note coincide endpoints) .

Right endpoint of a segment can be leftp(∆) of one trapezoid. #trapezoids= 3n + 1.

(a) (b) (c)

top(∆) bottom(∆) leftp(∆)

(d)

s leftp(∆) leftp(∆) leftp(∆) top(∆) top(∆) top(∆) bottom(∆) bottom(∆) bottom(∆) 13 / 38

slide-25
SLIDE 25

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.2 The trapezoidal map T(S) of a set S of n line segments in general position contains at most 6n+4 vertices and at most 3n+1 trapezoids.

Proof. #vertices: Bounding box+endpoints of line segments+new vertices generated by extensions= 4 + 2n + 2(2n) = 6n + 4. Left endpoint of a segment can be leftp(∆) of two

  • trapezoids. (Note coincide endpoints) .

Right endpoint of a segment can be leftp(∆) of one trapezoid. #trapezoids= 3n + 1.

(a) (b) (c)

top(∆) bottom(∆) leftp(∆)

(d)

s leftp(∆) leftp(∆) leftp(∆) top(∆) top(∆) top(∆) bottom(∆) bottom(∆) bottom(∆) 13 / 38

slide-26
SLIDE 26

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Lemma 6.2 The trapezoidal map T(S) of a set S of n line segments in general position contains at most 6n+4 vertices and at most 3n+1 trapezoids.

Proof. #vertices: Bounding box+endpoints of line segments+new vertices generated by extensions= 4 + 2n + 2(2n) = 6n + 4. Left endpoint of a segment can be leftp(∆) of two

  • trapezoids. (Note coincide endpoints) .

Right endpoint of a segment can be leftp(∆) of one trapezoid. #trapezoids= 3n + 1.

(a) (b) (c)

top(∆) bottom(∆) leftp(∆)

(d)

s leftp(∆) leftp(∆) leftp(∆) top(∆) top(∆) top(∆) bottom(∆) bottom(∆) bottom(∆) 13 / 38

slide-27
SLIDE 27

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Definition: Adjacent

Two trapezoids are adjacent if they meet along a vertical edge. Since line segments are in general position, a trapezoid has at most 4 adjacent trapezoids.

(i) (ii)

∆1 ∆2 ∆3 ∆4 ∆5 ∆6

∆1 ∆2 ∆3 ∆4 ∆5

14 / 38

slide-28
SLIDE 28

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Definition: Adjacent

Two trapezoids are adjacent if they meet along a vertical edge. Since line segments are in general position, a trapezoid has at most 4 adjacent trapezoids.

(i) (ii)

∆1 ∆2 ∆3 ∆4 ∆5 ∆6

∆1 ∆2 ∆3 ∆4 ∆5

14 / 38

slide-29
SLIDE 29

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Definition: Upper and Lower left neighbor

If ∆′ is adjacent to ∆ along the left vertical of ∆:

∆1 ∆2 ∆3 ∆4 ∆5

Upper left neighbor of ∆ top(∆) = top(∆1) Lower left neighbor of ∆ bottom(∆) = bottom(∆2)

15 / 38

slide-30
SLIDE 30

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

Definition: Upper and Lower right neighbor

If ∆′ is adjacent to ∆ along the right vertical of ∆:

∆1 ∆2 ∆3 ∆4 ∆5

Upper right neighbor of ∆ top(∆) = top(∆2) Lower right neighbor of ∆ bottom(∆) = bottom(∆4)

16 / 38

slide-31
SLIDE 31

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

How to store a trapezoidal map:

In a DCEL Specialize structure: Records for line segments and their endpoints For each trapezoid: store pointer to top, bottom, leftp and rightp and neighbors of the trapezoid.

17 / 38

slide-32
SLIDE 32

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

Trapezoidal Maps:

How to store a trapezoidal map:

In a DCEL Specialize structure: Records for line segments and their endpoints For each trapezoid: store pointer to top, bottom, leftp and rightp and neighbors of the trapezoid.

17 / 38

slide-33
SLIDE 33

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Randomized Incremental Algorithm

Randomized: See it later. Incremental: We add segments one by one.

18 / 38

slide-34
SLIDE 34

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Randomized Incremental Algorithm

Randomized: See it later. Incremental: We add segments one by one.

18 / 38

slide-35
SLIDE 35

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

19 / 38

slide-36
SLIDE 36

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

s1 s2 A B C D E F G p1 p2 q1 q2 s1 p1 q1 p2 s2 s2 q2 E A B C D F G

19 / 38

slide-37
SLIDE 37

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

s1 s2 A B C D E F G p1 p2 q1 q2 s1 p1 q1 p2 s2 s2 q2 E A B C D F G

19 / 38

slide-38
SLIDE 38

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

s1 s2 A B C D E F G p1 p2 q1 q2 s1 p1 q1 p2 s2 s2 q2 E A B C D F G

19 / 38

slide-39
SLIDE 39

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

s1 s2 A B C D E F G p1 p2 q1 q2 s1 p1 q1 p2 s2 s2 q2 E A B C D F G

19 / 38

slide-40
SLIDE 40

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Point Location Data Structure (search structure)

Directed Acyclic Graph Exactly one leaf for each trapezoid Inner nodes have out-degree 2. Inner nodes: x-nodes: labeled with an endpoint. Inner nodes: y-nodes: labeled with a segment. A query point starts at the root and traverse the structure until it reaches a leaf that contains q.

s1 s2 A B C D E F G p1 p2 q1 q2 s1 p1 q1 p2 s2 s2 q2 E A B C D F G

19 / 38

slide-41
SLIDE 41

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

The Trapezoid Construction Algorithm:

Incremental: Add segments one-by-one and update the structure. Randomized: Add segments in Random orderings.

20 / 38

slide-42
SLIDE 42

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

The Trapezoid Construction Algorithm:

Incremental: Add segments one-by-one and update the structure. Randomized: Add segments in Random orderings.

Algorithm TRAPEZOIDALMAP(S)

  • Input. A set S of n non-crossing line segments.
  • Output. The trapezoidal map T(S) and a search structure D for T(S) in a bounding box.

1. Determine a bounding box R that contains all segments of S, and initialize the trapezoidal map structure T and search structure D for it. 2. Compute a random permutation s1,s2,...,sn of the elements of S. 3. for i ← 1 to n 4. do Find the set ∆0,∆1,...,∆k of trapezoids in T properly intersected by si. 5. Remove ∆0,∆1,...,∆k from T and replace them by the new trapezoids that appear because of the insertion of si. 6. Remove the leaves for ∆0,∆1,...,∆k from D, and create leaves for the new trape-

  • zoids. Link the new leaves to the existing inner nodes by adding some new inner

nodes, as explained below.

20 / 38

slide-43
SLIDE 43

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Algorithm TRAPEZOIDALMAP(S)

  • Input. A set S of n non-crossing line segments.
  • Output. The trapezoidal map T(S) and a search structure D for T(S) in a bounding box.

1. Determine a bounding box R that contains all segments of S, and initialize the trapezoidal map structure T and search structure D for it. 2. Compute a random permutation s1,s2,...,sn of the elements of S. 3. for i ← 1 to n 4. do Find the set ∆0,∆1,...,∆k of trapezoids in T properly intersected by si. 5. Remove ∆0,∆1,...,∆k from T and replace them by the new trapezoids that appear because of the insertion of si. 6. Remove the leaves for ∆0,∆1,...,∆k from D, and create leaves for the new trape-

  • zoids. Link the new leaves to the existing inner nodes by adding some new inner

nodes, as explained below.

21 / 38

slide-44
SLIDE 44

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Algorithm TRAPEZOIDALMAP(S)

  • Input. A set S of n non-crossing line segments.
  • Output. The trapezoidal map T(S) and a search structure D for T(S) in a bounding box.

1. Determine a bounding box R that contains all segments of S, and initialize the trapezoidal map structure T and search structure D for it. 2. Compute a random permutation s1,s2,...,sn of the elements of S. 3. for i ← 1 to n 4. do Find the set ∆0,∆1,...,∆k of trapezoids in T properly intersected by si. 5. Remove ∆0,∆1,...,∆k from T and replace them by the new trapezoids that appear because of the insertion of si. 6. Remove the leaves for ∆0,∆1,...,∆k from D, and create leaves for the new trape-

  • zoids. Link the new leaves to the existing inner nodes by adding some new inner

nodes, as explained below.

∆0 ∆1 ∆2 ∆3

si

p q

21 / 38

slide-45
SLIDE 45

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

The Trapezoid Construction Algorithm:

∆0 is the trapezoid that contains the left endpoint of si, say p. ∆j+1 is one of right neighbors of ∆j. In searching p in the structure: If p lie on a vertical line: go to the right. If p lies on a segment s of a y-node: If slope(si) > slope(s) then p is above s.

∆0 ∆1 ∆2 ∆3

si

p q

22 / 38

slide-46
SLIDE 46

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

The Trapezoid Construction Algorithm:

∆0 is the trapezoid that contains the left endpoint of si, say p. ∆j+1 is one of right neighbors of ∆j. In searching p in the structure: If p lie on a vertical line: go to the right. If p lies on a segment s of a y-node: If slope(si) > slope(s) then p is above s.

∆0 ∆1 ∆2 ∆3

si

p q

22 / 38

slide-47
SLIDE 47

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

The Trapezoid Construction Algorithm:

∆0 is the trapezoid that contains the left endpoint of si, say p. ∆j+1 is one of right neighbors of ∆j. In searching p in the structure: If p lie on a vertical line: go to the right. If p lies on a segment s of a y-node: If slope(si) > slope(s) then p is above s.

∆0 ∆1 ∆2 ∆3

si

p q

22 / 38

slide-48
SLIDE 48

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Algorithm FOLLOWSEGMENT(T,D,si)

  • Input. A trapezoidal map T, a search structure D for T, and a new segment si.
  • Output. The sequence ∆0,...,∆k of trapezoids intersected by si.

1. Let p and q be the left and right endpoint of si. 2. Search with p in the search structure D to find ∆0. 3. j ← 0; 4. while q lies to the right of rightp(∆ j) 5. do if rightp(∆ j) lies above si 6. then Let ∆j+1 be the lower right neighbor of ∆j. 7. else Let ∆j+1 be the upper right neighbor of ∆j. 8. j ← j +1 9. return ∆0,∆1,...,∆ j

∆0 ∆1 ∆2 ∆3

si

p q

23 / 38

slide-49
SLIDE 49

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm si pi qi A C D B T(Si−1) si pi qi A B C D T(Si)

D(Si−1) D(Si) D(Si−1)

24 / 38

slide-50
SLIDE 50

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

∆0 ∆1 ∆2 ∆3

si pi qi qi si B A C D E F A B D C E F si

∆0 ∆1 ∆2 ∆3

T(Si−1) T(Si) D(Si−1) D(Si−1) D(Si)

si si si

25 / 38

slide-51
SLIDE 51

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Is the ordering important? Yes!

Figure 9: (Left) A set of segments in T which, if inserted bottom to top, leads to a worst-case query time. (Right) The resulting query structure.

Here the Random ordering helps!

26 / 38

slide-52
SLIDE 52

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm

Is the ordering important? Yes!

Figure 9: (Left) A set of segments in T which, if inserted bottom to top, leads to a worst-case query time. (Right) The resulting query structure.

Here the Random ordering helps!

26 / 38

slide-53
SLIDE 53

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

Proof. The query Complexity: Worst case: Depends on the depth of the DAG (O(n)). Expected case: Average on all orders of inserting segments! P: the search path. Xi: # vertices on P that created in step i of the algorithm. Xi is a random variable (its value depends on the

  • rder that the algorithm adds segments).

|P| =

n

  • i=1

Xi

27 / 38

slide-54
SLIDE 54

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

Proof. The query Complexity: Worst case: Depends on the depth of the DAG (O(n)). Expected case: Average on all orders of inserting segments! P: the search path. Xi: # vertices on P that created in step i of the algorithm. Xi is a random variable (its value depends on the

  • rder that the algorithm adds segments).

|P| =

n

  • i=1

Xi

27 / 38

slide-55
SLIDE 55

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

Proof. The query Complexity: Worst case: Depends on the depth of the DAG (O(n)). Expected case: Average on all orders of inserting segments! P: the search path. Xi: # vertices on P that created in step i of the algorithm. Xi is a random variable (its value depends on the

  • rder that the algorithm adds segments).

|P| =

n

  • i=1

Xi

27 / 38

slide-56
SLIDE 56

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

Proof. The query Complexity: Worst case: Depends on the depth of the DAG (O(n)). Expected case: Average on all orders of inserting segments! P: the search path. Xi: # vertices on P that created in step i of the algorithm. Xi is a random variable (its value depends on the

  • rder that the algorithm adds segments).

|P| =

n

  • i=1

Xi

27 / 38

slide-57
SLIDE 57

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

Proof. The query Complexity: Worst case: Depends on the depth of the DAG (O(n)). Expected case: Average on all orders of inserting segments! P: the search path. Xi: # vertices on P that created in step i of the algorithm. Xi is a random variable (its value depends on the

  • rder that the algorithm adds segments).

|P| =

n

  • i=1

Xi

27 / 38

slide-58
SLIDE 58

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Exp(|P|) = Exp n

  • i=1

Xi

  • =

n

  • i=1

Exp(Xi) (Pi = Possibility of having a node in iteration i) ≤

n

  • i=1

3Pi (Since Xi ≤ 3)

28 / 38

slide-59
SLIDE 59

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Notation: ∆q(Si): the trapezoid containing q in T(Si) Pi = Pr[∆q(Si) = ∆q(Si−1)]. If ∆q(Si) = ∆q(Si−1), then ∆q(Si) is one of the trapezoids that generated in step i. all trapezoids ∆ created in iteration i are adjacent to si. the segment that is inserted in iteration i: either top(∆) or bottom(∆) is si, or leftp(∆) or rightp(∆) is an endpoint of si.

29 / 38

slide-60
SLIDE 60

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Notation: ∆q(Si): the trapezoid containing q in T(Si) Pi = Pr[∆q(Si) = ∆q(Si−1)]. If ∆q(Si) = ∆q(Si−1), then ∆q(Si) is one of the trapezoids that generated in step i. all trapezoids ∆ created in iteration i are adjacent to si. the segment that is inserted in iteration i: either top(∆) or bottom(∆) is si, or leftp(∆) or rightp(∆) is an endpoint of si.

29 / 38

slide-61
SLIDE 61

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Notation: ∆q(Si): the trapezoid containing q in T(Si) Pi = Pr[∆q(Si) = ∆q(Si−1)]. If ∆q(Si) = ∆q(Si−1), then ∆q(Si) is one of the trapezoids that generated in step i. all trapezoids ∆ created in iteration i are adjacent to si. the segment that is inserted in iteration i: either top(∆) or bottom(∆) is si, or leftp(∆) or rightp(∆) is an endpoint of si.

29 / 38

slide-62
SLIDE 62

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Notation: ∆q(Si): the trapezoid containing q in T(Si) Pi = Pr[∆q(Si) = ∆q(Si−1)]. If ∆q(Si) = ∆q(Si−1), then ∆q(Si) is one of the trapezoids that generated in step i. all trapezoids ∆ created in iteration i are adjacent to si. the segment that is inserted in iteration i: either top(∆) or bottom(∆) is si, or leftp(∆) or rightp(∆) is an endpoint of si.

29 / 38

slide-63
SLIDE 63

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Notation: ∆q(Si): the trapezoid containing q in T(Si) Pi = Pr[∆q(Si) = ∆q(Si−1)]. If ∆q(Si) = ∆q(Si−1), then ∆q(Si) is one of the trapezoids that generated in step i. all trapezoids ∆ created in iteration i are adjacent to si. the segment that is inserted in iteration i: either top(∆) or bottom(∆) is si, or leftp(∆) or rightp(∆) is an endpoint of si.

29 / 38

slide-64
SLIDE 64

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

For a fixed set Si ⊂ S, T(Si), and therefore ∆q(Si), are uniquely defined (does not depend on the order). To bound the probability that the trapezoid containing q has changed due to the insertion of si, we use backward analysis. Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si.

30 / 38

slide-65
SLIDE 65

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

For a fixed set Si ⊂ S, T(Si), and therefore ∆q(Si), are uniquely defined (does not depend on the order). To bound the probability that the trapezoid containing q has changed due to the insertion of si, we use backward analysis. Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si.

30 / 38

slide-66
SLIDE 66

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

For a fixed set Si ⊂ S, T(Si), and therefore ∆q(Si), are uniquely defined (does not depend on the order). To bound the probability that the trapezoid containing q has changed due to the insertion of si, we use backward analysis. Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si.

30 / 38

slide-67
SLIDE 67

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si. ∆q(Si) disappears ⇐ ⇒ one of top(∆q(Si)), bottom(∆q(Si)), leftp(∆q(Si)), or rightp(∆q(Si)) disappears with the removal of si. What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

31 / 38

slide-68
SLIDE 68

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si. ∆q(Si) disappears ⇐ ⇒ one of top(∆q(Si)), bottom(∆q(Si)), leftp(∆q(Si)), or rightp(∆q(Si)) disappears with the removal of si. What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

31 / 38

slide-69
SLIDE 69

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

Backward Analysis: Consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si. ∆q(Si) disappears ⇐ ⇒ one of top(∆q(Si)), bottom(∆q(Si)), leftp(∆q(Si)), or rightp(∆q(Si)) disappears with the removal of si. What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

31 / 38

slide-70
SLIDE 70

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

Same argument works for bottom, rightp, leftp. Pi = Pr[∆q(Si) = ∆q(Si−1)] = Pr[∆q(Si) ∈ T(Si−1)] ≤ 4 i .

32 / 38

slide-71
SLIDE 71

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

Same argument works for bottom, rightp, leftp. Pi = Pr[∆q(Si) = ∆q(Si−1)] = Pr[∆q(Si) ∈ T(Si−1)] ≤ 4 i .

32 / 38

slide-72
SLIDE 72

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

What is the bound for Pi?

What is the probability that top(∆q(Si)) disappears? Si inserted in random order, so every segment in Si is equally likely to be si. So, the probability that si happens to be top(∆q(Si)) is 1

i .

Same argument works for bottom, rightp, leftp. Pi = Pr[∆q(Si) = ∆q(Si−1)] = Pr[∆q(Si) ∈ T(Si−1)] ≤ 4 i .

32 / 38

slide-73
SLIDE 73

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Exp(|P|) = Exp n

  • i=1

Xi

  • =

n

  • i=1

Exp(Xi) ≤

n

  • i=1

3Pi ≤

n

  • i=1

12 i (Since Pi ≤ 4/i) ≤ 12(ln n + 1). Done!

33 / 38

slide-74
SLIDE 74

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity:

Size of D: # leaves + # internal nodes. # leaves= # trapezoids= O(n). # internal nodes: ki − 1 (ki is # leaves generated in step i). Worst case: ki = O(i) ⇒ Size of D = O(n) + n

i=1 i = O(n2).

Expected Size: O(n) + E [n

i=1(ki − 1)] = O(n) + E [n i=1(ki)].

34 / 38

slide-75
SLIDE 75

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity:

Size of D: # leaves + # internal nodes. # leaves= # trapezoids= O(n). # internal nodes: ki − 1 (ki is # leaves generated in step i). Worst case: ki = O(i) ⇒ Size of D = O(n) + n

i=1 i = O(n2).

Expected Size: O(n) + E [n

i=1(ki − 1)] = O(n) + E [n i=1(ki)].

34 / 38

slide-76
SLIDE 76

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity:

Size of D: # leaves + # internal nodes. # leaves= # trapezoids= O(n). # internal nodes: ki − 1 (ki is # leaves generated in step i). Worst case: ki = O(i) ⇒ Size of D = O(n) + n

i=1 i = O(n2).

Expected Size: O(n) + E [n

i=1(ki − 1)] = O(n) + E [n i=1(ki)].

34 / 38

slide-77
SLIDE 77

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity:

Size of D: # leaves + # internal nodes. # leaves= # trapezoids= O(n). # internal nodes: ki − 1 (ki is # leaves generated in step i). Worst case: ki = O(i) ⇒ Size of D = O(n) + n

i=1 i = O(n2).

Expected Size: O(n) + E [n

i=1(ki − 1)] = O(n) + E [n i=1(ki)].

34 / 38

slide-78
SLIDE 78

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity:

Size of D: # leaves + # internal nodes. # leaves= # trapezoids= O(n). # internal nodes: ki − 1 (ki is # leaves generated in step i). Worst case: ki = O(i) ⇒ Size of D = O(n) + n

i=1 i = O(n2).

Expected Size: O(n) + E [n

i=1(ki − 1)] = O(n) + E [n i=1(ki)].

34 / 38

slide-79
SLIDE 79

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

Upper bound for E(ki)? For ∆ ∈ T(Si) and s ∈ Si, δ(∆, s) = 1 if ∆ disappears when s is removed.

  • therwise.

Since at most 4 segments can cause disappearance

  • f a trapezoid
  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ 4|T(Si)| = O(i).

35 / 38

slide-80
SLIDE 80

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

Upper bound for E(ki)? For ∆ ∈ T(Si) and s ∈ Si, δ(∆, s) = 1 if ∆ disappears when s is removed.

  • therwise.

Since at most 4 segments can cause disappearance

  • f a trapezoid
  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ 4|T(Si)| = O(i).

35 / 38

slide-81
SLIDE 81

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

Upper bound for E(ki)? For ∆ ∈ T(Si) and s ∈ Si, δ(∆, s) = 1 if ∆ disappears when s is removed.

  • therwise.

Since at most 4 segments can cause disappearance

  • f a trapezoid
  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ 4|T(Si)| = O(i).

35 / 38

slide-82
SLIDE 82

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

ki is # leaves generated in step i Upper bound for E(ki)? For E(ki) we take average on all cases: E(ki) = 1 i

  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ O(i) i = O(1). Size= O(n) + n

i=1 E(ki) = O(n).

36 / 38

slide-83
SLIDE 83

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

ki is # leaves generated in step i Upper bound for E(ki)? For E(ki) we take average on all cases: E(ki) = 1 i

  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ O(i) i = O(1). Size= O(n) + n

i=1 E(ki) = O(n).

36 / 38

slide-84
SLIDE 84

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

ki is # leaves generated in step i Upper bound for E(ki)? For E(ki) we take average on all cases: E(ki) = 1 i

  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ O(i) i = O(1). Size= O(n) + n

i=1 E(ki) = O(n).

36 / 38

slide-85
SLIDE 85

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Space Complexity: (Cont.)

ki is # leaves generated in step i Upper bound for E(ki)? For E(ki) we take average on all cases: E(ki) = 1 i

  • s∈Si
  • ∆∈T(Si)

δ(∆, s) ≤ O(i) i = O(1). Size= O(n) + n

i=1 E(ki) = O(n).

36 / 38

slide-86
SLIDE 86

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Construction Time:

Construction time: Time to insert si+Time to locate endpoint of si = O(ki) + O(log i). Construction time: O(1) + n

i=1 (O(log i) + O(E(ki))) = O(n log n).

37 / 38

slide-87
SLIDE 87

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

How to construct a Trapezoidal Map?

A Randomized Incremental Algorithm Theorem 6.3 Algorithm TRAPEZOIDALMAP computes the trapezoidal map T(S) of a set S of n line segments in general position and a search structure D for T(S) in O(nlogn) expected time. The expected size of the search structure is O(n) and for any query point q the expected query time is O(logn).

  • Proof. (Cont.)

Construction Time:

Construction time: Time to insert si+Time to locate endpoint of si = O(ki) + O(log i). Construction time: O(1) + n

i=1 (O(log i) + O(E(ki))) = O(n log n).

37 / 38

slide-88
SLIDE 88

Yazd Univ. Computational Geometry Motivation Point Location and Trapezoidal Maps A Randomized Incremental Algorithm

Search Structure

END.

38 / 38