Transcript Folie 1

Quadtrees and Mesh Generation
Student Lecture in course MATH/CSC 870
Philipp Richter
Thursday, April 19th, 2007
Content of Lecture
1)
2)
3)
4)
5)
Motivation
Introduction to Meshes
Introduction to Quadtrees
Generating Meshes using Quadtrees
Looking further
Motivation
We 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
Motivation
We 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
Motivation
We 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.
Motivation
We 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.
Introduction to Meshes
In 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°
Introduction to Meshes
In our application we seek a triangular mesh.
A mesh on some input data
Introduction to Meshes
In our application we seek a triangular mesh.
Now our goal is to compute a triangular mesh of the
input with the following properties:
•
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
Introduction to Meshes
In our application we seek a triangular mesh.
uniform mesh
non-uniform mesh
Introduction to Meshes
In 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
Introduction to Quadtrees
We 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
Introduction to Quadtrees
We 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.
Introduction to Quadtrees
We 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.
Introduction to Quadtrees
We 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  :
  : [ x : x' ][ y : y' ]
 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
x  x' 
 y  y ' 
x
:

y
:

quadrants of  . Let mid
and mid
, and
2
2
define
PNE : p  P : px  xmid and py  ymid ,
PNW : p  P : px  xmid and p y  ymid ,
PSW : p  P : px  xmid and py  ymid ,
PSE : p  P : px  xmid and p y  ymid .
Introduction to Quadtrees
We 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 PNE
inside the square  NE ,
 the NW-child is the root of a Quadtree for the set PNW
inside the square  NW ,
 the SW-child is the root of a Quadtree for the set PSW
inside the square  SW ,
 the SE-child is the root of a Quadtree for the set PSE
inside the square  SE .
Introduction to Quadtrees
We 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
Introduction to Quadtrees
We 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 logs c  32 , 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
Od  1 n nodes and can be constructed in Od  1 n time.
Introduction to Quadtrees
We 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 
Introduction to Quadtrees
We 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 Od  1 time.
Introduction to Quadtrees
We 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
Introduction to Quadtrees
We will see later that these are at the very heart of our Mesh generation method.
Introduction to Quadtrees
We 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 Om  nodes and it can be constructed in
Od  1 m time.
Generating Meshes using Quadtrees
Now we can apply what we learned about Quadtrees.
Algorithm GenerateMesh(S)
Input. A set S of components inside the square [0 : U ]  [0 : U ] with the properties
stated in the introduction to meshes.
Output. A triangular Mesh M that is conforming, respects the input, consists of wellshaped triangles, and is non-uniform.
1. Construct a Quadtree T on the set S inside the square [0 : U ]  [0 : U ] 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
Generating Meshes using Quadtrees
Now we can apply what we learned about Quadtrees.
Theorem: Let S be a set of disjoint polygonal components inside
the square [0 : U ]  [0 : U ] 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 O pS  logU  ,
where pS  is the sum of the perimeters of the components in S,
and the mesh can be constructed in O pS  log2 U  time.
Looking further
There 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.
Looking further
There 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?
Looking further
There 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
Looking further
There 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.
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>.
Thank you!