quadtrees and mesh generation student lecture in course math/csc 870 philipp richter thursday, april...

31
Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th , 2007

Post on 22-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Quadtrees and Mesh Generation

Student Lecture in course MATH/CSC 870

Philipp Richter

Thursday, April 19th, 2007

Page 2: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Content of Lecture

1) Motivation

2) Introduction to Meshes

3) Introduction to Quadtrees

4) Generating Meshes using Quadtrees

5) Looking further

Page 3: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

MotivationWe will start in the context of VLSI layouts

Definition: Very-large-scale integration (VLSI) is the process of creating integrated circuits by combining thousands of transistor-based circuits into a single chip.

A VLSI layout of a chip

Page 4: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

MotivationWe will start in the context of VLSI layouts

Common Problem in VLSI layout design:

Because components are very close together and emit heat, there is the possibility that they influence each other. This can be very hazardous to the function of the chip and can even result in its destruction.

Infrared thermal image of a chip

Page 5: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

MotivationWe will start in the context of VLSI layouts

There are different ways to solve the problem:

Earlier, engineers built a prototype of the chip and then measured the heat emission. Of course, this takes time and money.

Today, given modern computing power and knowledge, we can simulate the heat process using finite-element-methods.

Page 6: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

MotivationWe will start in the context of VLSI layouts

Finite-element-methods involve subdividing the chip surface in small elements and then assigning a heat emission value to each. It is assumed to be known how neighboring elements influence each other.

It is a numerical process that requires the elements to have a triangular shape with angles not below 45° to provide a fast convergence.

Page 7: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to MeshesIn our application we seek a triangular mesh.

We limit our discussion to the following input:• It is a square with disjoint polygonal components inside

(called the domain)• The square has vertices at (0,0), (0,U), (U,0), (U,U),

where U is a power of 2• Coordinates of the components are integers between 0

and U• Orientation of component edges is limited to 0°, 45°,

90° and 135°

Page 8: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to MeshesIn our application we seek a triangular mesh.

A mesh on some input data

Page 9: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to MeshesIn our application we seek a triangular mesh.

• Mesh must be conforming: a triangle must not have vertices of other triangles in the interior of one of its edges

• Mesh must respect the input: edges of the components must be contained in the mesh

• Mesh triangles must be well-shaped: angles of the triangles must be between 45° and 90°

• Mesh must be non-uniform: it must be fine near the edges of the components and coarse far away

Now our goal is to compute a triangular mesh of the input with the following properties:

Page 10: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to MeshesIn our application we seek a triangular mesh.

uniform mesh non-uniform mesh

Page 11: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to MeshesIn our application we seek a triangular mesh.

Why not use a Delaunay Triangulation? It could yield triangles that are not well shaped because in a triangulation we are only allowed to use the input vertices. In a mesh, we can add so called Steiner Points that help us getting a mesh with our desired properties.

delaunay triangulation

Page 12: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Definition: A Quadtree is a tree data structure in which each internal node has up to four children. Every node in the Quadtree corresponds to a square. If a node v has children, then their corresponding squares are the four quadrants of the square of v.

Quadtree

Page 13: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Definition: The leaves of a Quadtree form a Quadtree Subdivision of the square of the root.

Definition: The children of a node are labelled NE, NW, SW, and SE to indicate to which quadrant they correspond; NE stands for the north-east quadrant, NW for the north-west quadrant, and so on.

Definition: The four vertices at the corners of each square are called corner vertices or corners.

Page 14: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Definition: Line segments connecting corners are called sides of the square

Definition: Line segments contained in the boundary of a square are called edges of the square.

Therefore each side contains at least one edge.

Page 15: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Definition: Quadtree for a set P of points inside a square : ]':[]':[: yyxx If card(P) <= 1 then the Quadtree consists of a single leaf

where the set P and the square are stored. Otherwise, let NE , NW , SW , and SE denote the four

quadrants of . Let

2

': xx

xmid

and

2

': yy

ymid

, and

define midymidxNE ypandxpPpP :: , midymidxNW ypandxpPpP :: , midymidxSW ypandxpPpP :: , midymidxSE ypandxpPpP :: .

Page 16: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

The Quadtree now consists of a root node v where the square is stored. Below we shall denote the square stored at v by v . Furthermore, v has four Children:

the NE-child is the root of a Quadtree for the set NEP inside the square NE ,

the NW-child is the root of a Quadtree for the set NWP inside the square NW ,

the SW-child is the root of a Quadtree for the set SWP inside the square SW ,

the SE-child is the root of a Quadtree for the set SEP inside the square SE .

Page 17: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

A recursive algorithm is immediately given by the definition: split the current square into four quadrants, partition the point set accordingly, and recursively construct Quadtrees for each quadrant with its associated point set.

http://www.cs.wustl.edu/~suri/cs506/projects/quad.html

Page 18: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Lemma: The depth of a Quadtree for a set P of points in the plane is at most 2

3log cs , where c is the smallest distance between any two points in P and s is the side length of the initial square that contains P. Theorem: A Quadtree of depth d storing a set of n points has

ndO 1 nodes and can be constructed in ndO 1 time.

Page 19: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Algorithm NorthNeighbor(v, T) Input. A node v in a Quadtree T. Output. The deepest node v’ whose depth is at most the depth of v such that 'v is a north-neighbor of v n and nil if there is no such node. 1. if v = root(T) then return nil 2. if v = SW-child of parent(v) then return NW-child of parent(v) 3. if v = SE-child of parent(v) then return NE-child of parent(v) 4. NorthNeighbor(parent(v), T) 5. if = nil or is leaf 6. then return 7. else if v = NW-child of parent(v) 8. then return SW-child of 9. else return SE-child of

Page 20: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

The algorithms WestNeighbor(v, T), SouthNeighbor(v, T) and EastNeighbor(v, T) are similar. Theorem: Let T be a Quadtree of depth d. The neighbour of a given node v in T in a given direction, as defined above, can be found in 1dO time.

Page 21: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Algorithm BalanceQuadTree(T) Input. A Quadtree T. Output. A balanced version of T. 1. Insert all the leaves of T into a linear list L. 2. while L is not empty 3. do Remove a leaf from L 4. if has to be split 5. then Make into an internal node with four children,

which are leaves that correspond to the four quadrants of . If stores a point, then store the point in the correct new leaf instead.

6. Insert the four new leaves into L. 7. Check if had neighbors that now need to be

split and, if so, insert them into L. 8. return T

Page 22: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Page 23: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Introduction to QuadtreesWe will see later that these are at the very heart of our Mesh generation method.

Theorem: Let T be a Quadtree with m nodes. Then the balanced version of T has mO nodes and it can be constructed in

mdO 1 time.

Page 24: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Generating Meshes using QuadtreesNow we can apply what we learned about Quadtrees.

Algorithm GenerateMesh(S) Input. A set S of components inside the square ]:0[]:0[ UU with the properties stated in the introduction to meshes. Output. A triangular Mesh M that is conforming, respects the input, consists of well-shaped triangles, and is non-uniform. 1. Construct a Quadtree T on the set S inside the square ]:0[]:0[ UU with the

following stopping criterion: a square is split as long as it is larger than unit size and its closure intersects the boundary of some component.

2. T BalanceQuadTree(T) 3. Construct the doubly-connected edge list for the Quadtree subdivision M

corresponding to T. 4. for each face of M 5. do if the interior of is intersected by an edge of a component 6. then Add the intersection (which is a diagonal) as an edge to M. 7. else if has only vertices at its corners. 8. then Add a diagonal of as an edge to M. 9. else Add a Steiner point in the center of , connect it to all vertices on the

boundary of , and change M accordingly. 10. return M

Page 25: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Generating Meshes using QuadtreesNow we can apply what we learned about Quadtrees.

Theorem: Let S be a set of disjoint polygonal components inside the square ]:0[]:0[ UU with the properties stated in the beginning of this section. Then there exists a non-uniform triangular mesh for this input that is conforming, respects the input, and has only well-shaped triangles. The number of triangles is USpO log , where Sp is the sum of the perimeters of the components in S, and the mesh can be constructed in USpO 2log time.

Page 26: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Looking furtherThere is more than Mesh generation for Quadtrees

Mesh generation is but one application of Quadtrees. They are also used in computer graphics, image analysis, geographic information systems, and many other areas. Typically they are used to answer range queries, but they can be used for other operations as well. Quadtrees have also been applied to hidden surface removal, ray tracing, medial axis transforms, map overlay of raster maps, and nearest neighbour finding.

Page 27: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Looking furtherThere is more than Mesh generation for Quadtrees

What is a Range Query?

Input description: A set S of n points and a query region Q.

Problem description: Which points from S lie within Q?

Page 28: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Looking furtherThere is more than Mesh generation for Quadtrees

There is a distinction between unstructured and structured Meshes. From a mathematical perspective, Meshes are called grids. An unstructured grid is a tessellation of a part of the Euclidean plane or Euclidean space by simple shapes, such as triangles or tetrahedra, in an irregular pattern. A structured grid is a tessellation of the Euclidean plane by congruent quadrilaterals or a space-filling tessellation of rectilinear cuboids.

unstructured grid structured grid

Page 29: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Looking furtherThere is more than Mesh generation for Quadtrees

The generalization of the Quadtree to 3 dimensions is the so called Octree, where each node has 8 children.

Minimizing the number of triangles in the mesh under certain conditions is relevant and was subject to recent research.

There has been work done on the control of the density of triangles in the mesh.

Page 30: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Bibliography

- de Berg, M., M. van Kreveld, M. Overmars, and O.Schwarzkopf.Computational Geometry. 2nd ed. Eindhoven (NL), Utrecht (NL): Springer-Verlag, 2000.- "Quadtree." Wikipedia. 17 Apr 2007 <http://en.wikipedia.org/wiki/Quadtree>.- "Very-large-scale integration." Wikipedia. 17 Apr 2007 <http://en.wikipedia.org/wiki/Very-large-scale_integration>.- "Unstructured grid." Wikipedia. 17 Apr 2007 <http://en.wikipedia.org/wiki/Unstructured_grid>.- "Regular grid." Wikipedia. 17 Apr 2007 <http://en.wikipedia.org/wiki/Regular_grid>.

Page 31: Quadtrees and Mesh Generation Student Lecture in course MATH/CSC 870 Philipp Richter Thursday, April 19 th, 2007

Thank you!