Title: CPSC 335
1CPSC 335
- Representation and algorithms on spatial data.
- Dr. M. Gavrilova
2Presentation outline
- Types of spatial data
- Data representation
- Spatial data processing
- Algorithm design techniques
- Applications in GIS, modelling, computer
graphics, compression and visualization
3Spatial data
- GIS (Geographic Information Systems)
- CAD (Computer Aided Design)
- VLSI (Very Large Scale Integration, IBM)
- Robotics
- Image Processing
4Spatial objects
- Stored
- Displayed
- Manipulated
- Queried
5Digital maps
- Geographical object
- spatial, or geometric attribute (shape, location,
orientation, size) in 2D or 3D - non-spatial attribute (descriptive) statistic,
population, force, velocity, etc.
6Population Map
7Pollutants map
8Terrain map
9Data 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)
10Spatial databases
- Spatial simulation systems (models of natural
phenomena) - Specific object representation, query languages,
data formats.
11DBMS
- Any software system or DBMS
User-visible layer (interface)
Logical layer (internal language, net language)
Physical layer (files, ASCII, )
12Data representation
- Euclidean Space
- Other metrics
- Geometric entities
- Data types
13Geometric space
- Bounded Embedded space within some region
- Unbounded
14 Euclidean d-dimensional space
- in d dimensions.
- Euclidean metric L2
15Other metrics
- Minkovski metric
- Manhattan metric
- Supremum metric
L1
L1
L?
16Metric spaces in 2d
L1
L2
L?
17Geometric objects
- point
- segment
- line
- circle
- sphere
- polygon
- Convex, concave
- Simple, Non-simple
- With holes, without holes
- polyhedron
18Polyline
- 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
19Polygon
- 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.
20Planar 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.
21Geometric data structures
- Regular grid (mesh)
- Grid file
- Quad tree
- k-d tree
- Interval tree
- Voronoi diagram and Delaunay triangulation
22Commonly used data structures
- Space partitioning
- Planar subdivisions (regular and irregular)
- Tree-based data structure (segment trees, k-d
trees, hierarchical octrees) - Voronoi diagrams
- Triangulations
23Algorithmic Strategies
- Transformation
- Incremental
- Divide-and-conquer
- Sweep-line/plane
- Dimension reduction
- Geometric decomposition
24Common 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
25Convex Hull problem
- Convex Hull ? Sorting
- Sorting is O(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 O(n log n)
26Incremental Convex Hull
- Let Sp1,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)
27Convex 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)
28Convex 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.
Pi
29Divide-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
30Divide-and-conquer
- 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
31Divide-and-conquer
32Divide-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)cniT(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)
33Sweep-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.
34Sweep-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, lets try to
design an output-sensitive algorithm.
35Sweep-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!
36Sweep 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)
37Sweep-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
38Sweep-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.
39Sweep-plane algorithm
- An example of a sweep-plane construction of a
Voronoi diagram in L1 metric
40Sweep-plane algorithm
Cones in L1
41Sweep-plane algorithm
Sweeping the cones
42Sweep-plane algorithm
sweep direction
Parabolas
43Sweep-plane algorithm
Site event
44Sweep-plane algorithm
Site event
45Sweep-plane algorithm
two half-bisectors are created one is growing
46Sweep-plane algorithm
The half-bisector changes its direction
47Sweep-plane algorithm
Site event 2 half-bisectors created
48Sweep-plane algorithm
The half-bisector Changes its direction
49Sweep-plane algorithm
Circle event Triangle added to DT 2
half-bisectors deleted 1 half-bisector created
50Sweep-plane algorithm
Half-bisector changes its direction
51Sweep-plane algorithm
No more events
52Sweep-plane algorithm
Resulting Voronoi diagram and Delaunay
triangulation
53Dimension 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.
54Applications
- GIS terrain modeling
- Climate control weather patterns
- Environment study of migration, species
- City planning - maps
- Computer graphics filtering, multilevel
resolution - Computer vision - CAVE
55Digital Elevation Model (DEM)
Ariel photo (left), triangulated surface in 3D
(right)
56DEM
Terrain reconstructed using Delaunay Triangulation
57ArcView and Geology
58Digital Atmosphere 2000
59DA2000 Digital Satellite Photos
60AutoDesk Map 2002
61City 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/
62Multiresolution 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
63Simple Pyramid Example
- Lena, the typical example
64Divide 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.
65Image Compression
- Usage Smaller images, especially useful for
satellite or airphotos in GIS. - Example .ecw (enchanced compressed wavelet)
66GIS LOD (Level of Detail)
- Usage A detail-in-context technique for GIS.
- Example The TerraVisionTM System
67Working Towards the Future
- Terrain model a CAVE Perspective _at_ the
University of Illinois Urbana, Champagne