Document 7331900

Download Report

Transcript Document 7331900

CPSC 335
Representation and algorithms on
spatial data.
Dr. M. Gavrilova
Presentation outline





Types of spatial data
Data representation
Spatial data processing
Algorithm design techniques
Applications in GIS, modelling,
computer graphics, compression and
visualization
Spatial data





GIS (Geographic Information Systems)
CAD (Computer Aided Design)
VLSI (Very Large Scale Integration,
IBM)
Robotics
Image Processing
Spatial objects




Stored
Displayed
Manipulated
Queried
Digital maps
Geographical object:
 spatial, or geometric attribute (shape,
location, orientation, size) in 2D or 3D
 non-spatial attribute (descriptive):
statistic, population, force, velocity, etc.
Population Map
Population, ’96
0
100Km.
Population Distribution in Alberta, 1996 census
Pollutants map
#
N
#
W
E
#
##
#
#
# #
# # #
#
#
#
#
#
#
#
# #
#
#
#
#
#
#
#
#
#
# # # #
# # # # #
#
#
#
#
# #
# # # # #
# # # # #
#
#
#
# #
#
#
# # #
# ## # #
# # # # # # #
#
## #
# # # # #
# # # # # # #
# # # # # #
#
#
#
#
# # #
# #
#
#
# # #
#
#
# #
## # # # #
#####
#
#
# # # #
##
##
#
# # #
## # # #
##
#
#
##
#
#
#
#
# #
# ##
##
#
#
#
#
# # # #
# #
#
#
#
#
#
# # ## #
##
# # # #
#
#
#
## #
#
#
###
# #
# #
# # # #
# #
# #
##
#
# #
#
#
#
#
#
#
##
#
#
#
##
#
#
#
#
##
#
#
##
#
#
#
#
#####
#
##
#
#
##
#
#
#
#
###
# ## #
##
#
#
#
##
##
#
#
#
##
#
#
##
#
#
# #
#
#
#
##
# #
#
#
#
# #
#
S
##
#
###
#
##
# #
#
#
#
# #
## #
#
#
#
#
# ##
# # #
#
#
# #
# #
# # # #
#
# #
# #
# # # #
# #
#
# # # # #
# #
# # #
# # # ##
# # #
#
#
#
#
#
#
#
#
# #
#
#
#
#
# #
#
# #
##
#
#
# #
##
#
#
#
#
#
#
# # #
#
#
##
#
#
#
#
#
#
#
#
##
## #
##
#
#
#
#
#
# # ##
#
#
##
Distribution of pollutants in soil samples
Terrain map
Data collection




from GPS (Global Positioning Systems)
– BMP, GIF, GPEG, etc…
from existing maps, geometric (vector)
representation
from experiments (physical, biological,
mechanical) - attributes
generated for experiments – data files,
text, images)
Spatial databases


Spatial simulation systems (models of
natural phenomena)
Specific object representation, query
languages, data formats.
DBMS

Any software system or DBMS
User-visible layer (interface)
Logical layer (internal language, net language)
Physical layer (files, ASCII, …)
Data representation




Euclidean Space
Other metrics
Geometric entities
Data types
Geometric space


Bounded: Embedded space within some
region
Unbounded
Euclidean d-dimensional
space
R
d
d x, y  
x1  y1 
2
 x2  y 2   ...  xd  y d 
in d dimensions.
Euclidean metric L2
2
2
Other metrics

Minkovski metric
d  x, y  

p
x1  y1 
p
L1
 x2  y2   ...  xd  yd 
p
p
Manhattan metric L1
d x, y   x1  y1   x2  y2   ...  xd  yd 

Supremum metric L
d x, y   max( x1  y1 , x2  y2 ,..., xd  yd  )
Metric spaces in 2d
L1
L2
L
Geometric objects






point
segment
line
circle
sphere
polygon




Convex, concave
Simple, Non-simple
With holes, without holes
polyhedron
Polyline

Polyline:



closed if 2 extreme points are identical
simple if no pair of edges intersect
monotone – order of projections corresponds to
the order of vertices
Polygon




Polygon is a region bounded by a closed
polyline.
Polygon is simple of its boundary is simple
Polygon P is convex if for any 2 points A and
B inside the polygon, the segment AB is fully
enclosed in P. A non-convex polygon is
concave.
Polygon is monotone if it is simple and its
bounds can be split into 2 monotone
polylines.
Planar subdivisions



A straight-line planar embedding of a planar
graph determines a partitioning of the plane
called a planar subdivision.
A planar subdivision is a triangulation if all
its bounded regions are triangles.
A triangulation of a finite set of points S is a
planar graph with maximum number of edges
and with nodes located at the points of S.
Geometric data structures
Regular grid (mesh)
Grid file
Quad tree
k-d tree
Interval tree
Voronoi diagram and Delaunay
triangulation
Commonly used data structures
Space partitioning:
 Planar subdivisions (regular and irregular)
 Tree-based data structure (segment trees, k-d trees,
hierarchical octrees…)
 Voronoi diagrams
 Triangulations
k cells
Algorithmic Strategies






Transformation
Incremental
Divide-and-conquer
Sweep-line/plane
Dimension reduction
Geometric decomposition
Common Algorithm
Techniques




Transformation
Problem A – you know a lower bound
Problem B – it is unknown.
If we transform A to B by a
transformation step that costs less than
solving A, then B has the same lower
bound as A
Convex Hull problem







Convex Hull → Sorting
Sorting is Ω(n log n)
Let {x1,x2,…,xn} be a set of numbers (any order)
Compute in linear time set of points O(xi,xi2)
Build the convex hull of these points
By scanning points from left to right obtain sorted array.
Convex hull is Ω(n log n)
16
16
9
9
4
4
1
1
1
2
3
4
1
2
3
4
Incremental – Convex Hull




Let S={p1,p2,…,pn} denote the set of points of CH.
First, construct a triangle {p1,p2, p3}
Add point pi to CHi-1 (existing)
Two cases are possible:



pi  CHi-1 – detected in linear time by scanning the points of
CHi-1 in clockwise order, pi is always on the right side
pi  CHi-1 – add pi to CH in linear time, by scanning points
of CHi-1, finding 2 tangential lines from pi to CH.
Analysis: O(n2)
Convex Hull – optimization


Algorithm can be improved to O(n lg n) by
presorting the input according to abscissas of
points.
Every time a point pi is added:




No need to check CHi-1, it is always outside
To find the upper tangent, scan the upper chain,
removing points that we scanned
Lower tangent – same
Linear time to construct CH + sorting O(nlg n)
Convex Hull – optimization
Algorithm can be improved using the property that the
list of points is sorted. If line through Pi intersects CH,
the vertex is discarded. Each vertex is discarded only
once.
P
Pi-1
i
Divide-and-conquer


The half-plane intersection example: result –
convex polygon
Recursive:



Top-down: subdivision to a smaller problem
Bottom-up: recursively merging the solution
Similar to merge-sort, quick-sort
Divide-and-conquer
1.
2.
3.
Create binary tree of half-planes
Intersect each half-plane, starting from the
leaves, with rectangle R, which contains the
resulting polygon (by assumption)  obtain
convex polygons
Compute intersection of convex polygons,
bottom up on the tree
Divide-and-conquer
Divide-and-conquer
complexity





Convex polygon intersection is O(n)
T(n) = 2 T(n/2) + cn
i is # of steps  T(n) = 2i T(n/2i)+cni
T(n) = 2lg n T(n/2lg n) + c n lg n
Assume T(n/2lg n) is O(1), when the size
of the problem is small
T(n) = O(n lg n)
Sweep-line (plane-sweep)





Decompose the input into vertical strips
Vertical line (sweep-line) allows to
compute/maintain some information
Sweep-line goes through a number of events
Event list is usually represented by the queue
The state of the sweep-line is also
maintained.
Sweep-line example



Given a set S of rectangles with sides parallel to the
axes, report all their pair-wise intersections
O(n2) – for each rectangle, test intersections with
others
This is worst-case optimal, because there can be that
many intersections. However, let’s try to design an
output-sensitive algorithm.
Sweep-line example

Observations:

Sweep-line undergoes changes in its status when it reaches
left/right side of a rectangle (along X coordinate)

If X projections intersect – does not mean that rectangles intersect.
When left endpoint reached – add rectangle.

When the sweep-line intersects the rectangles, Y projections of
rectangles should be checked for intersection. If they too intersect,
then rectangles intersect.

When right endpoint is added – remove rectangle.

All events can be scheduled in advance!
Sweep line – complexity
Initial sorting of interval endpoints O(n lg n)
# of events in the queue is 2n
Time to process one event – check for Y
intersections is O(1)
If the total # of intersections is k, then the
total complexity is O(n lg n + k)
Sweep-plane algorithm

Algorithm description
 Throw pebbles in the water
 Intersection of waves gives the lines equidistant
from the point where pebble touched the water
(i.e. a edge of the Voronoi diagram)
 Add time as 3rd dimension: waves transform to
pyramids.
 Sweep pyramids with the sweep-plane to get the
Voronoi diagram
Sweep-plane algorithm

Properties
 The complexity of the sweep-plane algorithm in
generalized Manhattan metric is O(n log n).
 Sweep-plane method is not applicable to the
power diagram construction.
Sweep-plane algorithm

An example of a sweep-plane
construction of a Voronoi diagram in L1
metric
Sweep-plane algorithm
Cones in L1
Sweep-plane algorithm
Sweeping the cones
Sweep-plane algorithm
sweep direction
Parabolas
Sweep-plane algorithm
Site event
Sweep-plane algorithm
Site event
Sweep-plane algorithm
two half-bisectors are created
one is growing
Sweep-plane algorithm
The half-bisector changes its direction
Sweep-plane algorithm
Site event
2 half-bisectors created
Sweep-plane algorithm
The half-bisector
Changes its direction
Sweep-plane algorithm
Circle event
Triangle added to DT
2 half-bisectors deleted
1 half-bisector created
Sweep-plane algorithm
Half-bisector
changes its
direction
Sweep-plane algorithm
No more
events
Sweep-plane algorithm
Resulting Voronoi diagram and Delaunay triangulation
Dimension reduction





Typical problem: build a VD for a set of points
in the plane.
Consider 3D, build a paraboloid, lift/project
points (sites) onto the paraboloid
Construct half-spaces tangent to paraboloid
at those points.
Construct intersection of these half-spaces
Projection of these intersections down on the
plane gives the VD of initial sites.
Applications






GIS – terrain modeling
Climate control – weather patterns
Environment – study of migration,
species
City planning - maps
Computer graphics – filtering, multilevel
resolution
Computer vision - CAVE
Digital Elevation Model (DEM)
Ariel photo (left), triangulated surface in 3D (right)
DEM
Terrain reconstructed using Delaunay Triangulation
ArcView and Geology
Digital Atmosphere 2000
DA2000 – Digital Satellite Photos
AutoDesk Map 2002
City planning


This focuses on visualizing man-made structures such
as roads.
Used in a variety of areas such as urban
development, residential planning, and GPS
Navigation.
Courtesy of: http://ca.maps.yahoo.com/
Multiresolution images

Traditionally stacks of images:


2n by 2n, 2n-1 by 2n-1, … , 2 by 2, 1 by 1
Does not have to be image data
Simple Pyramid Example

Lena, the typical example
Divide and Conquer


Creating a pyramid is a
variation of the
principle of divide and
conquer
Any point at a certain
level is calculated from
a small number of point
on the previous level.
?
Image Compression


Usage: Smaller images, especially
useful for satellite or airphoto’s in GIS.
Example: .ecw (enchanced compressed
wavelet)
Dimensions
Uncompressed Size
Compressed Size
3 x 8000 x 8000
192 MB
4 MB
GIS LOD (Level of Detail)


Usage: A detail-in-context technique for GIS.
Example: The TerraVisionTM System
Working Towards the Future
Terrain model – a CAVE Perspective @ the University of
Illinois – Urbana, Champagne