Computing the Overlay of Two Computational Geometry Subdivisions - - PowerPoint PPT Presentation

computing the overlay of two
SMART_READER_LITE
LIVE PREVIEW

Computing the Overlay of Two Computational Geometry Subdivisions - - PowerPoint PPT Presentation

Yazd Univ. Computing the Overlay of Two Computational Geometry Subdivisions Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions 1392-1 1 / 25 We have solved the easiest case of the map overlay problem, where the


slide-1
SLIDE 1

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

1392-1

1 / 25

slide-2
SLIDE 2

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

We have solved the easiest case of the map overlay problem, where the two maps are networks represented as collections of line segments. In general, maps have a more complicated structure: they are subdivisions of the plane into labeled regions.

2 / 25

slide-3
SLIDE 3

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Before we can give an algorithm for computing the

  • verlay of two subdivisions, we must develop a

suitable representation for a subdivision. Storing a subdivision as a collection of line segments is not such a good idea. Operations like reporting the boundary of a region would be rather complicated. Add topological information: which segments bound a given region, which regions are adjacent, and so

  • n.

3 / 25

slide-4
SLIDE 4

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

edge

vertex face disconnected subdivision Complexity of a subdivision

#faces+#edges+#vertices.

4 / 25

slide-5
SLIDE 5

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

incident

Complexity of a subdivision

#faces+#edges+#vertices.

4 / 25

slide-6
SLIDE 6

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

What kind of queries?

What is the face containing a given point? (TOO MUCH!) Walking around the boundary of a given face, Find the face from an adjacent one if we are given a common edge, Visit all the edges around a given vertex. The representation that we shall discuss supports these

  • perations. It is called the doubly-connected edge list

(DCEL).

5 / 25

slide-7
SLIDE 7

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each edge, a record for each vertex, a record for each face, plus attribute information.

6 / 25

slide-8
SLIDE 8

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

− → e Twin(− → e ) v w

To be able to traverse the boundary of a face, we need to keep a pointer to a half-edge of any boundary component and isolated points.

7 / 25

slide-9
SLIDE 9

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

To be able to traverse the boundary of a face, we need to keep a pointer to a half-edge of any boundary component and isolated points.

7 / 25

slide-10
SLIDE 10

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

To be able to traverse the boundary of a face, we need to keep a pointer to a half-edge of any boundary component and isolated points.

7 / 25

slide-11
SLIDE 11

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

To be able to traverse the boundary of a face, we need to keep a pointer to a half-edge of any boundary component and isolated points.

7 / 25

slide-12
SLIDE 12

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-13
SLIDE 13

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-14
SLIDE 14

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-15
SLIDE 15

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-16
SLIDE 16

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-17
SLIDE 17

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

DCEL contains:

a record for each vertex,

1

Coordinates(v): the coordinates of v,

2

IncidentEdge(v): a pointer to an arbitrary half-edge that has v as its origin.

a record for each face,

1

OuterComponent(f): to some half-edge on its outer boundary (nil if unbounded),

2

InnerComponents(f): a pointer to some half-edge

  • n the boundary of the hole, for each hole.

a record for each half-edge − → e ,

1

Origin(− → e ): a pointer to its origin,

2

Twin(− → e ) a pointer to its twin half-edge,

3

IncidentFace(− → e ): a pointer to the face that it bounds.

4

Next(− → e ) and Prev(− → e ): a pointer to the next and previous edge on the boundary of IncidentFace(− → e ).

8 / 25

slide-18
SLIDE 18

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL Origin(− → e ) Twin(− → e ) Next(− → e ) Prev(− → e ) IncidentFace(− → e ) − → e

9 / 25

slide-19
SLIDE 19

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL:Example

v1 − → e 1,1 v2 v3 v4 f1 f2 − → e 1,2 − → e 3,2 − → e 4,2 − → e 3,1 − → e 2,1 − → e 2,2 − → e 4,1

10 / 25

slide-20
SLIDE 20

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

Time complexity of queries?

Walking around the boundary of a given face, Find the face from an adjacent one if we are given a common edge, Visit all the edges around a given vertex.

11 / 25

slide-21
SLIDE 21

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

DCEL

Time complexity of queries?

Walking around the boundary of a given face, Find the face from an adjacent one if we are given a common edge, Visit all the edges around a given vertex.

11 / 25

slide-22
SLIDE 22

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

= ⇒

S1 S2 O(S1, S2)

Main Idea in computing O(S1, S2)

Copy DCEL of S1 and S2 into new DCEL (Not a Valid DCEL). Make the new DCEL valid.

12 / 25

slide-23
SLIDE 23

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

13 / 25

slide-24
SLIDE 24

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges e v the geometric situation and the two doubly-connected edge lists before handling the intersection the doubly-connected edge list after handling the inter- section

14 / 25

slide-25
SLIDE 25

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

e v

Make two new edge with origin v. Set Twin of new edges. Set Next() of the two new half-edges. Set Prev() of the half-edges to which these pointers point.

15 / 25

slide-26
SLIDE 26

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

e v

e′ e′′

Make two new edge with origin v. Set Twin of new edges. Set Next() of the two new half-edges. Set Prev() of the half-edges to which these pointers point.

15 / 25

slide-27
SLIDE 27

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

e v

e′ e′′ e′ e′′

Make two new edge with origin v. Set Twin of new edges. Set Next() of the two new half-edges. Set Prev() of the half-edges to which these pointers point.

15 / 25

slide-28
SLIDE 28

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

e v

e′ e′′ e′ e′′

Make two new edge with origin v. Set Twin of new edges. Set Next() of the two new half-edges. Set Prev() of the half-edges to which these pointers point.

15 / 25

slide-29
SLIDE 29

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

Fix the situation around v

The half-edge for e′ that has v as its destination must be linked to the first half-edge, seen clockwise from e′, with v as its origin. The half-edge for e′ with v as its origin must be linked to the first counterclockwise half-edge with v as its destination. The same for e′′. Time complexity: O(m) (m: degree of v).

e′ e′′ first clockwise half- edge from e′ with v as its origin

16 / 25

slide-30
SLIDE 30

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

Fix the situation around v

The half-edge for e′ that has v as its destination must be linked to the first half-edge, seen clockwise from e′, with v as its origin. The half-edge for e′ with v as its origin must be linked to the first counterclockwise half-edge with v as its destination. The same for e′′. Time complexity: O(m) (m: degree of v).

e′ e′′ first clockwise half- edge from e′ with v as its origin

16 / 25

slide-31
SLIDE 31

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

Fix the situation around v

The half-edge for e′ that has v as its destination must be linked to the first half-edge, seen clockwise from e′, with v as its origin. The half-edge for e′ with v as its origin must be linked to the first counterclockwise half-edge with v as its destination. The same for e′′. Time complexity: O(m) (m: degree of v).

e′ e′′ first clockwise half- edge from e′ with v as its origin

16 / 25

slide-32
SLIDE 32

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating half-edges

Fix the situation around v

The half-edge for e′ that has v as its destination must be linked to the first half-edge, seen clockwise from e′, with v as its origin. The half-edge for e′ with v as its origin must be linked to the first counterclockwise half-edge with v as its destination. The same for e′′. Time complexity: O(m) (m: degree of v).

e′ e′′ first clockwise half- edge from e′ with v as its origin

16 / 25

slide-33
SLIDE 33

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Updating Faces:

Create a face record for each f ∈ O(S1, S2). Set OuterComponent(f) and InnerComponent(f).

17 / 25

slide-34
SLIDE 34

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

# faces= # outer boundaries +1 (unbounded face). From half-edges we can construct the boundaries. To determine weather the boundary is outer boundary or boundary of a hole:

f Leftmost vertex of cycle

18 / 25

slide-35
SLIDE 35

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

# faces= # outer boundaries +1 (unbounded face). From half-edges we can construct the boundaries. To determine weather the boundary is outer boundary or boundary of a hole:

f Leftmost vertex of cycle

18 / 25

slide-36
SLIDE 36

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

# faces= # outer boundaries +1 (unbounded face). From half-edges we can construct the boundaries. To determine weather the boundary is outer boundary or boundary of a hole:

f Leftmost vertex of cycle

18 / 25

slide-37
SLIDE 37

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Which boundary cycles bound the same face?

Construct a graph G. Every boundary cycle is a node in G. One node for the imaginary outer boundary of the unbounded face. Add an arc between two cycles if and only if one of the cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle. If there is no half-edge to the left of the leftmost vertex of a cycle, then the node representing the cycle is linked to the node of the unbounded face.

19 / 25

slide-38
SLIDE 38

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Which boundary cycles bound the same face?

Construct a graph G. Every boundary cycle is a node in G. One node for the imaginary outer boundary of the unbounded face. Add an arc between two cycles if and only if one of the cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle. If there is no half-edge to the left of the leftmost vertex of a cycle, then the node representing the cycle is linked to the node of the unbounded face.

19 / 25

slide-39
SLIDE 39

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Which boundary cycles bound the same face?

Construct a graph G. Every boundary cycle is a node in G. One node for the imaginary outer boundary of the unbounded face. Add an arc between two cycles if and only if one of the cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle. If there is no half-edge to the left of the leftmost vertex of a cycle, then the node representing the cycle is linked to the node of the unbounded face.

19 / 25

slide-40
SLIDE 40

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Which boundary cycles bound the same face?

Construct a graph G. Every boundary cycle is a node in G. One node for the imaginary outer boundary of the unbounded face. Add an arc between two cycles if and only if one of the cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle. If there is no half-edge to the left of the leftmost vertex of a cycle, then the node representing the cycle is linked to the node of the unbounded face.

19 / 25

slide-41
SLIDE 41

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Which boundary cycles bound the same face?

Construct a graph G. Every boundary cycle is a node in G. One node for the imaginary outer boundary of the unbounded face. Add an arc between two cycles if and only if one of the cycles is the boundary of a hole and the other cycle has a half-edge immediately to the left of the leftmost vertex of that hole cycle. If there is no half-edge to the left of the leftmost vertex of a cycle, then the node representing the cycle is linked to the node of the unbounded face.

19 / 25

slide-42
SLIDE 42

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

C1 C∞ C2 C3 C4 C6 C5 C7 C1 C3 C6 C∞ C2 C5 C4 C7 G

20 / 25

slide-43
SLIDE 43

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Updating faces

Lemma 2.5

Each connected component of the graph G corresponds exactly to the set of cycles incident to one face.

21 / 25

slide-44
SLIDE 44

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Computing G

new arc C C′ f C′ C G

22 / 25

slide-45
SLIDE 45

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Computing the Overlay of Two Subdivisions

Theorem 2.6

Let S1 be a planar subdivision of complexity n1, let S2 be a subdivision of complexity n2, and let n := n1 + n2. The

  • verlay of S1 and S2 can be constructed in

O(n log n + k log n) time, where k is the complexity of the

  • verlay.

23 / 25

slide-46
SLIDE 46

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions

Application:Boolean Operations

P1 P2 P1 P2 P1 P2 union intersection difference

24 / 25

slide-47
SLIDE 47

Yazd Univ. Computational Geometry Doubly Connected Edge List (DCEL) Computing the Overlay of Two Subdivisions 25 / 25