Sunteți pe pagina 1din 15

1/23/2014

Digital Elevation Models

On TINs and Voronoi daigrams

Originally developed as part of the process used to create


ortho photos, but now widely used in other calculations
(slope, aspect, line of sight, viewsheds, watersheds, etc.)
and visualisation.

(for class room discussion only)


(compiled from web resources)

Methods Of Representation
Three main methods:
Altitude matrices (grid/raster)
Isolines - e.g. contours (vector)
Triangulated Irregular Networks TINs (vector)
Isolines were the main method in traditional cartography, but
are not very flexible for GIS.

TINs
TINs represent a surface using contiguous, non-overlapping
irregular triangles.
The areas inside each triangle have approximately the same
slope and elevation.
The corners of each triangle are generally at different
altitudes.
Edges form breaks of slope.
Complex terrain can be accommodated using smaller
triangles.
Known features can be recorded accurately (not interpolated
as in a raster).
triangles work best in areas with sharp breaks in slope,
where TIN edges can be aligned with breaks, e.g. along
ridges or channels

Altitude Matrices

Very flexible for calculating contours, slope, aspects, etc.


Disadvantages:
Data redundancy if terrain is flat.
Do not adjust to relief complexity.
Exaggerated emphasis along lines of the grid.

Conversion Methods
TINs to altitude matrices. Grid superimposed. Height in
each cell is a distance weighted average of the three corner
points of the triangle within which the centre of the grid falls.
Altitude matrix to TIN. Three stages:
1. Identify minimum number of corner points for the
triangles;
2. Decide which points should be joined to form the
triangles;
3. Convert to a data structure.

1/23/2014

TIN Conversion Algorithms


At least four methods can be used to decide on the corner
points:
Skeleton method
Very important point method
Hierarchy transform method
Drop heuristic method
At least two methods can be used to determine joins:
Minimum distance

Delauney triangles
A triangulation for given set of points P is called Delauney if every
triangle has empty circumcircle, ie., circle passing through 3 vertices
of a triangle does not contain any other point
For 4 points, we have 2 possible traingulations, of which at least one
is Delauney (unless all 4 are on the circle). See fig below.

If one of them not Delauney, we can select the other diagonal (called Lawson
Flip)

Unique Delauney triangulation exists for P (when no 4 points are on


a common circle)

Delauney triangles
See for details
http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u39.html

Steps in creating TIN

1. how to pick sample points (from some


existing, dense DEM or digitized contours)
try to select points at significant breaks of the
surface
Examine using 3x3 windows
Select all points and then use some hueristic for
dropping points

how to connect points into triangles


how to model the surface within each triangle
this is almost always resolved by using a plane
surface

TIN Data Structure


The data stucture used to record this information includes:
A node list i.e. list of the corner points
A pointer list for each node a list of the other nodes to
which that node is connected (in clockwise direction)
A trilist lists the triangle on either side of each link.

Creating Triangles from selected points


Prefer fat traingles
Distance Ordering method
compute the distance between all pairs of points, and sort
from lowest to highest
connect the closest pair of points
connect the next closest pair if the resulting line does not
cross earlier lines
repeat until no further lines can be selected

Delauney triangulation
Make initial set and then examine groups of 4 at a time and
apply definition and flip
Use Vornonoi based method

Representation in ArcInfo
Field-based and TIN for representing surfaces

1/23/2014

Voronoi Diagrams

Post Office: What is the area of service?

pi : site points
q : free point
e : Voronoi edge
v : Voronoi
vertex
v
q
pi

Definition of Voronoi Diagram


Let P be a set of n distinct points (sites) in the plane.

Non-collinear sites form Voronoi half lines that


meet at a vertex

The Voronoi diagram of P is the subdivision of the plane


into n cells, one for each site.
A point q lies in the cell corresponding to a site pi P iff
Euclidean_Distance( q, pi ) < Euclidean_distance( q, pj ), for
each pi P, j i.
We denote the Voronoi diagram of P by Vor(P).
The cell that corresponds to a site pi is denotd by V(pi ),
called the voronoi cell of pi.

Voronoi Cells and Segments

A vertex has
degree 3

A Voronoi vertex is
the center of an empty
circle touching 3 or
more sites.

Half lines

Voronoi Cells and Segments


Four or more non-collinear sites are
necessary to create a bounded cell

Segment

Bounded Cell

Unbounded Cell

1/23/2014

Degenerate Case: no bounded cells!

Characteristics of Voronoi Diagrams


1. Voronoi regions (cells) are bounded by line segments.
Special case :
Collinear points

If all the sites are collinear, then Vor(P) consist of n-1 parallel
lines and n cells. Otherwise, Vor(P) is a connected graph and
its edges are either line segments or half-lines.

Other Characteristics
(Assumption: No 4 points are on the circle)
2. Vor(P) is connected

5. Each nearest neighbor of one point defines an edge of


the Voronoi region of the point.
6. The Voronoi region of a point is unbounded iff the point lies
exactly on the convex hull of the point set.

3. Each vertex (corner) of VD(P)


has degree 3
4. The circle through the three points
defining a Vertex of the Voronoi
diagram does not contain any further point

Voronoi Diagram/Convex Hull Duality

Dual: Delaunay Triangulation

Sites sharing a half-infinite edge are convex hull vertices

v
pi

24

1/23/2014

Size and Storage


Size of the Voronoi Diagram:

Size of the Voronoi Diagram


The number of vertices in the Voronoi diagram of a set of n points
in the plane is at most 2n-5 and the number of edges is at most
3n-6.
Example :

V(p) can have O(n) vertices

Application : Facility Location

Facility Location (cont)

Seek location for new grocery store, whose distance to


nearest store is as large as possible center of largest empty
circle
One restriction: center in convex hull of the sites

Center in hull: p must be


coincident with a voronoi vertex

Largest Empty Circle

Center on hull: p must lie on a


voronoi edge

Other useful analyses

Nearest neighbor search


Cluster analysis : dense sites give Voronoi
regions of small area
Closest pairs (each pair shares an edge)

1/23/2014

Constructing Voronoi Diagrams

Algo 1 : using half plane intersections

Constructing Voronoi Diagrams

Given a half plane intersection algorithm

Constructing Voronoi Diagrams

Given a half plane intersection algorithm

Constructing Voronoi Diagrams

Algo 2 : Fortunes Algorithm


Sweep line algorithm
Voronoi diagram constructed as horizontal line sweeps
the set of sites from top to bottom
Incremental construction  maintains portion of
diagram which cannot change due to sites below
sweep line, keeping track of incremental changes for
each site (and Voronoi vertex) it sweeps

Repeat for each site


Running Time:
O( n2 log n )

Constructing Voronoi Diagrams


Constructing Voronoi Diagrams

What is the invariant we are looking for?

Which points are closer to a site above the sweep line


than to the sweep line itself?
q

q
pi

pi

Sweep Line

Equidistance
Sweep Line
v
e

Maintain a representation of the locus of points q that


are closer to some site pi above the sweep line than to
the line itself (and thus to any site below the line).

The set of parabolic arcs form a beach-line that bounds


the locus of all such points

1/23/2014

Constructing Voronoi Diagrams

Constructing Voronoi Diagrams

Break points trace out Voronoi edges.

Arcs flatten out as sweep line moves down.

pi

pi

Sweep Line
Sweep Line
Equidistance

Algo 3 : Divide and Conquer(Divide)


Input: A set of points (sites)
Output: A partitioning of the plane into regions of equal
nearest neighbors.

Divide and Conquer (Conquer)


Conquer: Recursively compute the Voronoi diagrams for the smaller
point sets
Abort condition: Voronoi diagram of a single point is the entire plane.

Divide: Divide the point set into two halves

Divide and Conquer (Merge)

The Result
The finished Voronoi Diagram

Merge the diagrams by a (monoton) sequence of edges)

Running time: With n given points : O(n log n)

1/23/2014

Geometrical Divide and Conquer


Problem: Determine all intersecting pairs of segments
A
D

Merge:
Compute the edge sequence K separating P1 and P2
Cut VD(P1) and VD(P2 ) by means of K starting from
VD(P1 ) and VD(P2 ) and K

S
A

A
B
C

DAC - Construction of the Voronoi diagram


Divide:
Divide P by a vertical dividing line T into 2 equal size subsets
say P1 and P2. If |P| = 1 completed.
Conquer:
Compute VD(P1 ) and VD(P2 ) recursively.

C
S1

P2
S2

P1

Computation of K

Example
First edge in K

4 tangential points P1 P2
Observation: K is y - monotonous

P1

P2
Last edge in K

Incremental (sweep line) construction


(p1 in P1 and p2 in P2 perpendicular with m, Sweep l)
Determines intersection s1 of m with Vor(p1) below l
Determines intersection s2 of m with Vor(p2) below l
Extend K by line segment l si
Set l = si
Compute new K defining pair p1, p2
Running time O(n)
Vor(pi) are convex, therefore each ones
forward - edge are only visited once.

Algo 2 : Fortunes Algorithm


Algo 2 : Fortunes Algorithm
(details)

Sweep line algorithm


Voronoi diagram constructed as horizontal line sweeps
the set of sites from top to bottom
Incremental construction  maintains portion of
diagram which cannot change due to sites below
sweep line, keeping track of incremental changes for
each site (and Voronoi vertex) it sweeps

47

1/23/2014

Constructing Voronoi Diagrams


Constructing Voronoi Diagrams

What is the invariant we are looking for?

Which points are closer to a site above the sweep line


than to the sweep line itself?
q

q
pi

pi

Sweep Line

Equidistance
Sweep Line
v
e

Maintain a representation of the locus of points q that


are closer to some site pi above the sweep line than to
the line itself (and thus to any site below the line).

The set of parabolic arcs form a beach-line that bounds


the locus of all such points

Constructing Voronoi Diagrams

Constructing Voronoi Diagrams

Break points trace out Voronoi edges.

Arcs flatten out as sweep line moves down.

pi

pi

Sweep Line
Sweep Line
Equidistance

Constructing Voronoi Diagrams

Constructing Voronoi Diagrams

Eventually, the middle arc disappears.

We have detected a circle that is empty (contains no


sites) and touches 3 or more sites.

pi

Sweep Line

pi

Sweep Line

Voronoi vertex!

1/23/2014

Beach Line properties

Voronoi edges are traced by the break points


as the sweep line moves down.
Emergence of a new break point(s) (from
formation of a new arc or a fusion of two
existing break points) identifies a new edge

Voronoi vertices are identified when two


break points meet (fuse).

Data Structures

Current state of the Voronoi diagram


Doubly linked list of half-edge, vertex, cell records

Current state of the beach line


Keep track of break points
Keep track of arcs currently on beach line

Current state of the sweep line

Decimation of an old arc identifies new vertex

Priority event queue sorted on decreasing y-coordinate

Doubly Linked List (D)


Doubly Linked List (D)

Goal: a simple data structure that allows an


algorithm to traverse a Voronoi diagrams
segments, cells and vertices

Divide segments into uni-directional half-edges


A chain of counter-clockwise half-edges forms a cell
Define a half-edges twin to be its opposite half-edge of the
same segment

Cell(pi)

Cell(pi)

Doubly Linked List (D)


Cell Table
Cell(pi) : pointer to any incident half-edge

Vertex Table
vi : list of pointers to all incident half-edges

Doubly Linked-List of half-edges; each has:

Balanced Binary Tree (T)


Internal nodes represent break points between two arcs
Also contains a pointer to the D record of the edge being traced

Leaf nodes represent arcs, each arc is in turn represented


by the site that generated it
Also contains a pointer to a potential circle event

Pointer to Cell Table entry


Pointers to start/end vertices of half-edge
Pointers to previous/next half-edges in the CCW chain
Pointer to twin half-edge

< pj, pk>


pi

pi

< pi, pj>

< pk, pl>

pj

pl

pk

pj

pk

pl
l

10

1/23/2014

Event Queue (Q)

Balanced Binary Tree (T)


Internal nodes represent break points between two arcs

An event is an interesting point encountered by the


sweep line as it sweeps from top to bottom

Also contains a pointer to the D record of the edge being traced

Leaf nodes represent arcs, each arc is in turn represented


by the site that generated it

Sweep line makes discrete stops, rather than a continuous


sweep

Also contains a pointer to a potential circle event


< pj, pk>
pi

pi

< pi, pj>

< pk, pl>

pj

pl

pk

pj

pk

pl
l

Consists of Site Events (when the sweep line


encounters a new site point) and Circle Events
(when the sweep line encounters the bottom of an
empty circle touching 3 or more sites).
Events are prioritized based on y-coordinate

Site Event

Site Event

A new arc appears when a new site appears.

A new arc appears when a new site appears.

Site Event

Circle Event

Original arc above the new site is broken into two


 Number of arcs on beach line is O(n)

An arc disappears whenever an empty circle touches


three or more sites and is tangent to the sweep line.
q
pi

Circle Event!
Sweep Line
l

Voronoi vertex!

Sweep line helps determine that the circle is indeed empty.

11

1/23/2014

Event Queue Summary

Summarizing Data Structures

Site Events are


Current state of the Voronoi diagram

given as input
represented by the xy-coordinate of the site point

Doubly linked list of half-edge, vertex, cell records

Circle Events are

Current state of the beach line

computed on the fly (intersection of the two bisectors in


between the three sites)
represented by the xy-coordinate of the lowest point of an
empty circle touching three or more sites
anticipated, these newly generated events may be false
and need to be removed later

Keep track of break points


Inner nodes of binary search tree; represented by a tuple

Keep track of arcs currently on beach line


Leaf nodes of binary search tree; represented by a site that
generated the arc

Current state of the sweep line

Event Queue prioritizes events based on their ycoordinates

Priority event queue sorted on decreasing y-coordinate

Algorithm

Handling Site Events

1. Initialize

Event queue Q  all site events


Binary search tree T 
Doubly linked list D 

1. Locate the existing arc (if any) that is above the


new site
2. Break the arc by replacing the leaf node with a sub
tree representing the new arc and its break points
3. Add two half-edge records in the doubly linked list
4. Check for potential circle event(s), add them to
event queue if they exist

2. While Q not ,

Remove event (e) from Q with largest ycoordinate

HandleEvent(e, T, D)

Locate the existing arc that is


above the new site

Break the Arc

Corresponding leaf replaced by a new sub-tree

The x coordinate of the new site is used for the binary search
The x coordinate of each breakpoint along the root to leaf path
is computed on the fly

< pj, pk>

< pj, pk>

< pi, pj>


pi

< pi, pj>

pj

pk

pj

pk

pi

pj

pk

pi

< pk, pl>


pm

pi

< pk, pl>


< pl, pm>

pl

pj

pk

pl

< pm, pl>

pm

pl
pl

pm

pl

Different arcs can be identified


by the same site!

12

1/23/2014

Add a new edge record in the doubly linked list

Checking for Potential Circle Events

Scan for triple of consecutive arcs and


determine if breakpoints converge

New Half Edge Record


Endpoints 

< pj, pk>


< pi, pj>

< pl, pm>


pi

pj

pk

Triples with new arc in the middle do not have


break points that converge

Pointers to two half-edge


records

< pk, pl>


pi

pj

pk

pl

< pm, pl>


pm

pl

pm

pl

Checking for Potential Circle Events

Checking for Potential Circle Events

Scan for triple of consecutive arcs and


determine if breakpoints converge

Scan for triple of consecutive arcs and


determine if breakpoints converge

Triples with new arc in the middle do not have


break points that converge

Triples with new arc in the middle do not have


break points that converge

Handling Site Events

Converging break points may not always yield


a circle event

Appearance of a new site before the circle


event makes the potential circle non-empty

1. Locate the leaf representing the existing arc that is


above the new site

Delete the potential circle event in the event queue

2. Break the arc by replacing the leaf node with a sub


tree representing the new arc and break points
3. Add a new edge record in the doubly linked list
4. Check for potential circle event(s), add them to
queue if they exist

Store in the corresponding leaf of T a pointer to the new


circle event in the queue

(The original circle event becomes a false alarm)

13

1/23/2014

Handling Circle Events


A Circle Event
1. Add vertex to corresponding edge record in doubly
linked list
2. Delete from T the leaf node of the disappearing arc
and its associated circle events in the event queue
3. Create new edge record in doubly linked list
4. Check the new triplets formed by the former
neighboring arcs for potential circle events

< pj, pk>


< pi, pj>

< pk, pl>


< pl, pm>

pi

pj

pk

pi

pk

pl

pj
< pm, pl>
pm

pl

pm

pl

Add vertex to corresponding edge record

Deleting disappearing arc

Link!

< pj, pk>


< pi, pj>
pj

Half Edge Record

Endpoints.add(x, y)

Endpoints.add(x, y)

< pj, pk>


< pi, pj>

< pk, pl>


< pl, pm>

pi

Half Edge Record

pk

pi

pk

pi

pl

pj

pi

pk

pj
< pm, pl>

pm

pl

pm

pl

< pm, pl>


pm

pl

pk
pj

pl

pm

Deleting disappearing arc

Create new edge record

< pj, pk>

< pj, pk>

New Half Edge Record


Endpoints.add(x, y)

< pi, pj>


pi

pj

< pi, pj>

< pk, pm>


< pm, pl>

pk

pi

pk

pi

pl

pj

< pk, pm>


< pm, pl>

pk

pj
pm

pl

pi

pk

pl

pj
pm

pm

pl

pm

A new edge is traced out by the new


break point < pk, pm>

14

1/23/2014

Minor Detail

Check the new triplets for potential circle events

Algorithm terminates when Q = , but the


beach line and its break points continue to
trace the Voronoi edges

< pj, pk>


< pi, pj>
pi

pj

< pk, pm>


< pm, pl>

pk

pi

pk

Terminate these half-infinite edges via a


bounding box

pl

pj

pm

pl

pm

y
new circle event

Algorithm Termination

Algorithm Termination

< pj, pk>

< pj, pm>


< pm, pl>

< pi, pj>


pi

pj

< pi, pj>

< pk, pm>


< pm, pl>

pk

pi

pk

pi

pl

pj

pm
pm

pl

pm

pi

pj
pl

pk

pl

pj
pm

Q
l

Algorithm Termination
< pj, pm>
< pm, pl>
< pi, pj>
pi

pi

pj
pm

pl

Terminate half-lines
with a bounding box!

pk

pl

pj
pm

15

S-ar putea să vă placă și