Geometric Algorithms Quadtrees and Meshing Motivation: VLSI Design - - PowerPoint PPT Presentation

geometric algorithms
SMART_READER_LITE
LIVE PREVIEW

Geometric Algorithms Quadtrees and Meshing Motivation: VLSI Design - - PowerPoint PPT Presentation

Geometric Algorithms Quadtrees and Meshing Motivation: VLSI Design simulation of heat emission on printed circuit boards Motivation: VLSI Design To simulate heat emission: finite element method: partition board into small homogeneous


slide-1
SLIDE 1

Geometric Algorithms

Quadtrees and Meshing

slide-2
SLIDE 2

Motivation: VLSI Design

simulation of heat emission on printed circuit boards

slide-3
SLIDE 3

Motivation: VLSI Design

To simulate heat emission: finite element method:

  • partition board into small

homogeneous elements (e.g. triangles) → mesh

  • based on heat emission of each

element and influence of neighbors

  • numerically approximate of overall

heat emission

slide-4
SLIDE 4

Motivation: VLSI Design

To simulate heat emission: finite element method:

  • partition board into small

homogeneous elements (e.g. triangles) → mesh

  • based on heat emission of each

element and influence of neighbors

  • numerically approximate of overall

heat emission

http://www.antics1.demon.co.uk/finelms.html

slide-5
SLIDE 5

Motivation: VLSI Design

To simulate heat emission: finite element method:

  • partition board into small

homogeneous elements (e.g. triangles) → mesh

  • based on heat emission of each

element and influence of neighbors

  • numerically approximate of overall

heat emission

slide-6
SLIDE 6

Motivation: VLSI Design

To simulate heat emission: finite element method:

  • partition board into small

homogeneous elements (e.g. triangles) → mesh

  • based on heat emission of each

element and influence of neighbors

  • numerically approximate of overall

heat emission quality criteria:

  • finer mesh → better approximation
  • coarser mesh → faster computation
  • compact elements → faster convergence
slide-7
SLIDE 7

Motivation: VLSI Design

To simulate heat emission: finite element method:

  • partition board into small

homogeneous elements (e.g. triangles) → mesh

  • based on heat emission of each

element and influence of neighbors

  • numerically approximate of overall

heat emission quality criteria:

  • finer mesh → better approximation
  • coarser mesh → faster computation
  • compact elements → faster convergence

goal:

  • non-uniform mesh – small at boundaries, larger otherwise
  • well-shaped triangles – not too thin
slide-8
SLIDE 8

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

slide-9
SLIDE 9

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

non-conforming

slide-10
SLIDE 10

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

not part of mesh

slide-11
SLIDE 11

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦

angles too small

slide-12
SLIDE 12

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise

uniform mesh

slide-13
SLIDE 13

Non-Uniform Meshes

given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise

uniform mesh

Do we need Steiner points (i.e. non-input vertices)?

slide-14
SLIDE 14

Triangulation of Subdivision?

  • maximize smallest angle?
slide-15
SLIDE 15

Triangulation of Subdivision?

  • maximize smallest angle?
  • without Steiner points: might have very small angles
slide-16
SLIDE 16

Triangulation of Subdivision?

  • maximize smallest angle?
  • without Steiner points: might have very small angles
  • with Steiner points:
slide-17
SLIDE 17

Triangulation of Subdivision?

  • maximize smallest angle?
  • without Steiner points: might have very small angles

52 triangles well-shaped, non-uniform well-shaped, but uniform 512 triangles

  • with Steiner points:
slide-18
SLIDE 18

Quadtrees

http://donar.umiacs.umd.edu/quadtree/, in particular http://donar.umiacs.umd.edu/quadtree/points/prquad.html http://www.maptiler.org/ google-maps-coordinates-tile-bounds-projection

slide-19
SLIDE 19

Quadtrees

NE NW SW SE

Def.: A quadtree is a rooted tree, in which every interior node has 4 children. Every node corresponds to a square, and the squares of children are the quadrants of the parent’s square.

slide-20
SLIDE 20

Quadtrees

NE NW SW SE

Def.: A quadtree is a rooted tree, in which every interior node has 4 children. Every node corresponds to a square, and the squares of children are the quadrants of the parent’s square.

vertices edges sides neighbors

slide-21
SLIDE 21

Quadtrees

Def.: A quadtree is a rooted tree, in which every interior node has 4 children. Every node corresponds to a square, and the squares of children are the quadrants of the parent’s square. Def.: For a point set P in a square Q = [xQ, x′

Q] × [yQ, y′ Q] it

holds for the quadtree T (P)

  • if |P| ≤ 1, then T (P) is a leaf, storing P and Q
  • otherwise let xmid =

xQ+x′

Q

2

and ymid =

yQ+y′

Q

2

and PNE := {p ∈ P | px > xmid and py > ymid} PNW := {p ∈ P | px ≤ xmid and py > ymid} PSW := {p ∈ P | px ≤ xmid and py ≤ ymid} PSE := {p ∈ P | px > xmid and py ≤ ymid} T (P) consists of a root v storing Q with for children for Pi and Qi (i ∈ {NE, NW, SW, SE}).

NE NW SW SE PNW PNE PSW PSE

slide-22
SLIDE 22

Example

slide-23
SLIDE 23

Example

slide-24
SLIDE 24

Example

slide-25
SLIDE 25

Example

slide-26
SLIDE 26

Example

slide-27
SLIDE 27

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm

slide-28
SLIDE 28

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm What is the depth on a quadtree on n nodes?

slide-29
SLIDE 29

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm What is the depth on a quadtree on n nodes? Lemma 1: Let c be the smallest distance between any two points in a point set P, and let s be the side length

  • f the initial (biggest) square. Then the depth of a

quadtree for P is at most log(s/c) + 3/2.

slide-30
SLIDE 30

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm What is the depth on a quadtree on n nodes? Lemma 1: Let c be the smallest distance between any two points in a point set P, and let s be the side length

  • f the initial (biggest) square. Then the depth of a

quadtree for P is at most log(s/c) + 3/2. proof:

consider square σ of depth i side length of σ is s/2i maximum distance between two points in σ: √ 2s/2i ⇒ if depth is i: √ 2s/2i ≥ c transformed: i ≤ log( √ 2s/c) = log(s/c) + 1/2

slide-31
SLIDE 31

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm What is the depth on a quadtree on n nodes? Lemma 1: Let c be the smallest distance between any two points in a point set P, and let s be the side length

  • f the initial (biggest) square. Then the depth of a

quadtree for P is at most log(s/c) + 3/2. Thm 1: A quadtree of depth d storing n points has O((d + 1)n) nodes and can be constructed in O((d + 1)n) time.

slide-32
SLIDE 32

Quadtree Properties

The recursive definition of a quadtrees immediately results in an algorithm What is the depth on a quadtree on n nodes? Lemma 1: Let c be the smallest distance between any two points in a point set P, and let s be the side length

  • f the initial (biggest) square. Then the depth of a

quadtree for P is at most log(s/c) + 3/2. Thm 1: A quadtree of depth d storing n points has O((d + 1)n) nodes and can be constructed in O((d + 1)n) time. proof:

Every inner node has exactly 4 children ⇒ #leaves = 1 + 3#inner nodes. inner nodes correspond to disjoint squares with ≥2 points ⇒ ≤ n squares per layer corresponding to inner nodes. ⇒ for depth d overall O((d + 1)n) nodes.

slide-33
SLIDE 33

Finding Neighbors

NorthNeighbor(v, T ) Input: node v in Quadtree T Output: deepest v′ not deeper than v with v′.Q north neighbor of v.Q if v = root(T ) then return nil π ← parent(v) if v = SW-/SE-child of π then return NW-/NE-child of π µ ← NorthNeighbor(π, T ) if µ = nil or µ leaf then return µ else if v = NW-/NE-child of π then return SW-/SE-child of µ

v

NN(v

slide-34
SLIDE 34

Finding Neighbors

NorthNeighbor(v, T ) Input: node v in Quadtree T Output: deepest v′ not deeper than v with v′.Q north neighbor of v.Q if v = root(T ) then return nil π ← parent(v) if v = SW-/SE-child of π then return NW-/NE-child of π µ ← NorthNeighbor(π, T ) if µ = nil or µ leaf then return µ else if v = NW-/NE-child of π then return SW-/SE-child of µ

Thm 2: Let T be a quadtree of depth d. The neighbors of a node v in any direction can be found in O(d + 1) time. v

NN(v

slide-35
SLIDE 35

Finding Neighbors

NorthNeighbor(v, T ) Input: node v in Quadtree T Output: deepest v′ not deeper than v with v′.Q north neighbor of v.Q if v = root(T ) then return nil π ← parent(v) if v = SW-/SE-child of π then return NW-/NE-child of π µ ← NorthNeighbor(π, T ) if µ = nil or µ leaf then return µ else if v = NW-/NE-child of π then return SW-/SE-child of µ

Thm 2: Let T be a quadtree of depth d. The neighbors of a node v in any direction can be found in O(d + 1) time. proof:

depth of recursion O(d + 1), cost per recursive step O(1)

v

NN(v

slide-36
SLIDE 36

Balanced Quadtrees

Def.: a quadtree is balanced if any two neighboring nodes differ at most 1 in depth

slide-37
SLIDE 37

Balanced Quadtrees

Def.: a quadtree is balanced if any two neighboring nodes differ at most 1 in depth

slide-38
SLIDE 38

Balanced Quadtrees

Def.: a quadtree is balanced if any two neighboring nodes differ at most 1 in depth

slide-39
SLIDE 39

Balancing Quadtrees

BalanceQuadtree(T ) Input: Quadtree T Output: balanced Quadtree T L ← List of all leafs of T while L not empty do µ ← extract a leaf from L if µ.Q too large then partition µ.Q into 4 quadrants and add 4 leaves to T insert new leaves into L if any neighbors of µ.Q are too large then insert them into L return T

slide-40
SLIDE 40

Balancing Quadtrees

BalanceQuadtree(T ) Input: Quadtree T Output: balanced Quadtree T L ← List of all leafs of T while L not empty do µ ← extract a leaf from L if µ.Q too large then partition µ.Q into 4 quadrants and add 4 leaves to T insert new leaves into L if any neighbors of µ.Q are too large then insert them into L return T

How? How?

slide-41
SLIDE 41

Balancing Quadtrees

BalanceQuadtree(T ) Input: Quadtree T Output: balanced Quadtree T L ← List of all leafs of T while L not empty do µ ← extract a leaf from L if µ.Q too large then partition µ.Q into 4 quadrants and add 4 leaves to T insert new leaves into L if any neighbors of µ.Q are too large then insert them into L return T

How? How? How large can a balanced quadtree get?

slide-42
SLIDE 42

Balancing Quadtrees

Thm 3: Let T be a quadtree with m nodes. Then the balanced version of T has O(m) nodes and can be constructed in O((d + 1)m) time.

slide-43
SLIDE 43

Balancing Quadtrees

Thm 3: Let T be a quadtree with m nodes. Then the balanced version of T has O(m) nodes and can be constructed in O((d + 1)m) time. proof:

claim.: max. 8m splits proof.: “old” vs, “new" squares. Assume square σ is split. claim.: σ has an “old" neighbor. (here: 8 neighbors including diagonal) proof: suppose not. Suppose σ is minimal such square. Let σ′ be the reason for splitting σ. Then σ′ contradicts the minimality of σ. We can charge the split to the “old” neighbor. Every split needs O(1) searches for neighbors.

σ σ′

slide-44
SLIDE 44

Compressed Quadtrees

paths of nodes with only one non-empty child can be compressed to an edge

slide-45
SLIDE 45

Compressed Quadtrees

paths of nodes with only one non-empty child can be compressed to an edge → size O(n)

slide-46
SLIDE 46

Quadtrees and Non-uniform Meshes

reminder: given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise
slide-47
SLIDE 47

Quadtrees and Non-uniform Meshes

use quadtree as a base! reminder: idea: given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise
slide-48
SLIDE 48

Quadtrees and Non-uniform Meshes

use quadtree as a base! reminder: idea: given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise

What do we need to adapt?

slide-49
SLIDE 49

Quadtrees and Non-uniform Meshes

partition squares until they no longer intersect a polygon or size is 1 use quadtree as a base! reminder: idea: adaption: given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise
slide-50
SLIDE 50

Quadtrees and Non-uniform Meshes

partition squares until they no longer intersect a polygon or size is 1 use quadtree as a base! reminder: idea: adaption: given: octilinear polygons with integer coordinates within a square Q = [0, U] × [0, U] with U = 2j a power of two. wanted: triangular mesh of Q with the following properties

  • conforming: exactly one triangle on each side of interior

edges

  • respect input: input: edges of input must be part of

union of mesh edges

  • well-shaped: angles between 45◦ and 90◦
  • non-uniform: fine near boundaries, coarse otherwise

intersections also include:

  • polygon in square
  • common edge, or even just

common point

slide-51
SLIDE 51

From Quadtrees to Meshes

slide-52
SLIDE 52

From Quadtrees to Meshes

slide-53
SLIDE 53

From Quadtrees to Meshes

slide-54
SLIDE 54

From Quadtrees to Meshes

slide-55
SLIDE 55

From Quadtrees to Meshes

slide-56
SLIDE 56

From Quadtrees to Meshes

slide-57
SLIDE 57

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal.

slide-58
SLIDE 58

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal. How can we get a valid mesh?

slide-59
SLIDE 59

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal. How can we get a valid mesh?

  • Add diagonalen for remaining squares?

non-conforming

slide-60
SLIDE 60

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal. How can we get a valid mesh?

  • Add diagonalen for remaining squares?

angles too small

  • Add a steiner point per cell?

no!

slide-61
SLIDE 61

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal. How can we get a valid mesh?

  • Add diagonalen for remaining squares?
  • Add a steiner point per cell?
  • balanced quadtree and add Steiner points if necessary!

no! no!

slide-62
SLIDE 62

From Quadtrees to Meshes

Obs.: in the interior of a square in the quadtree is intersected then by a diagonal. How can we get a valid mesh?

  • Add diagonalen for remaining squares?
  • Add a steiner point per cell?
  • balanced quadtree and add Steiner points if necessary!

no! no!

slide-63
SLIDE 63

Triangulating Quadtrees

TriangulateQuadtree(T ) Input: quadtree T Output: triangulation von T D ← DCEL for partition of Q by T foreach facet f in D do if int(f) is intersected by a polygon then add corresponding diagonal in f to D else if vertices only add corners of f then add a diagonal in f to D else create Steiner point in the middle of f and connect in D to all vertices on ∂f return D

slide-64
SLIDE 64

Algorithm

CreateMesh(S) Input: set S of octilinear polygons with integer coordinates in Q = [0, 2j] × [0, 2j] Output: valid, non-uniform triangular mesh S T ← CreateQuadtree T ← BalanceQuadtree(T ) D ← TriangulateQuadtree(T ) return D

slide-65
SLIDE 65

Summary

Thm 4: Let S be a set of disjoint polygonal objects with vertices on a (integer) grid [0, U] × [0, U]. Then

  • there exists a non-uniform triangular mesh for S that is

conforming, well-shaped and respects the input

  • the number of triangles is O(p(S) log U), where p(S) is

the sum of (lengths of) perimeters of the objects

  • the mesh can be constructed in O(p(S) log2 U) time
slide-66
SLIDE 66

Summary

Thm 4: Let S be a set of disjoint polygonal objects with vertices on a (integer) grid [0, U] × [0, U]. Then

  • there exists a non-uniform triangular mesh for S that is

conforming, well-shaped and respects the input

  • the number of triangles is O(p(S) log U), where p(S) is

the sum of (lengths of) perimeters of the objects

  • the mesh can be constructed in O(p(S) log2 U) time

proof:

size of mesh: # squares intersected in a layers is O(p(S)), depth is O(log U) construction time:

  • 1. quadtree: linear in size
  • 2. balancing: extra log-factor
  • 3. triangulating: linear in size
slide-67
SLIDE 67

Summary

Thm 4: Let S be a set of disjoint polygonal objects with vertices on a (integer) grid [0, U] × [0, U]. Then

  • there exists a non-uniform triangular mesh for S that is

conforming, well-shaped and respects the input

  • the number of triangles is O(p(S) log U), where p(S) is

the sum of (lengths of) perimeters of the objects

  • the mesh can be constructed in O(p(S) log2 U) time

proof:

size of mesh: # squares intersected in a layers is O(p(S)), depth is O(log U) construction time:

  • 1. quadtree: linear in size
  • 2. balancing: extra log-factor
  • 3. triangulating: linear in size
slide-68
SLIDE 68

Discussion

Can we compute/update compressed quadtrees efficiently?

slide-69
SLIDE 69

Discussion

Can we compute/update compressed quadtrees efficiently? Yes, skip quadtrees have complexity O(n) and we can insert, delete and search in O(log n) time in a suitable model of computation [Eppstein et al., ’05]

slide-70
SLIDE 70

Discussion

Can we compute/update compressed quadtrees efficiently? Yes, skip quadtrees have complexity O(n) and we can insert, delete and search in O(log n) time in a suitable model of computation [Eppstein et al., ’05] Other applications?

slide-71
SLIDE 71

Discussion

Can we compute/update compressed quadtrees efficiently? Yes, skip quadtrees have complexity O(n) and we can insert, delete and search in O(log n) time in a suitable model of computation [Eppstein et al., ’05] Other applications? quadtrees are used in many applications including computer graphics, image processing, GIS etc., In geometry used for approximation algorithms, but also connections to Delaunay triangulations etc.

slide-72
SLIDE 72

Discussion

Can we compute/update compressed quadtrees efficiently? Yes, skip quadtrees have complexity O(n) and we can insert, delete and search in O(log n) time in a suitable model of computation [Eppstein et al., ’05] Other applications? quadtrees are used in many applications including computer graphics, image processing, GIS etc., In geometry used for approximation algorithms, but also connections to Delaunay triangulations etc. as always: higher dimensions?

slide-73
SLIDE 73

Discussion

Can we compute/update compressed quadtrees efficiently? Yes, skip quadtrees have complexity O(n) and we can insert, delete and search in O(log n) time in a suitable model of computation [Eppstein et al., ’05] Other applications? quadtrees are used in many applications including computer graphics, image processing, GIS etc., In geometry used for approximation algorithms, but also connections to Delaunay triangulations etc. as always: higher dimensions? directly generalize. 3d quadtrees: octtrees