1.
Algorithms in
Computational Geometry
Shripad Thite
Department of Computer Science
Technische Universiteit Eindhoven
The Netherlands
sthite@win.tue.nl
1-1
2.
Computational Geometry
Computational Geometry is the study of computational
problems in a geometric setting
Algorithms are eﬃcient procedures for solving computa-
tional problems
Algorithms + Geometric data structures
= Computational Geometry
* with apologies to Niklaus Wirth
2-1
3.
Computational Geometry applications
Geometric problems need to be solved in many important
applications, e.g., Geographic Information Systems (GIS),
Mesh generation for scientiﬁc computing
Voronoi diagram Delaunay triangulation Convex hull
3-1
4.
Practical Computational Geometry
Geometric algorithms perform better or worse than pre-
dicted by analysis on the RAM model:
worst-case inputs do not occur in practice
uniform-cost memory assumption is not realistic
Complex algorithms are too hard to implement and make
little impact on applications
We need practical algorithms with theoretical performance
guarantees for inputs of realistic complexity encountered in
applications
4-1
5.
My research
I work on fundamental problems in Computational Geometry
as well as geometric problems in applied ﬁelds
I design and analyze geometric algorithms
My goal is to develop algorithms that can be fruitfully imple-
mented and are always accompanied by a theoretical analy-
sis and justiﬁcation
5-1
6.
Overview of this talk
External-Memory Computational Geometry
IO-eﬃcient algorithms for point location and map over-
lay in massive geographic databases
Mesh Generation for Scientiﬁc Computing
Spacetime meshing for discontinuous Galerkin meth-
ods in engineering applications
←− not enough time!
Computational Topology
Shortest pants decomposition
Continuous Fr´chet distance between curves
e
6-1
8.
External-Memory Algorithms
in Computational Geometry
IO-Eﬃcient Algorithms for
Point Location and Map Overlay
in Massive Geographic Databases
Joint work with
Mark de Berg, Herman Haverkort, and Laura Toma
8-1
9.
Point location
Map = polygonal subdivision of the plane
Map from Wikimedia Commons
Given a point in the plane, identiﬁed by its coordinates,
ﬁnd the region of the map that contains the point
9-1
10.
Map overlay
Combine various attributes of data from diﬀerent maps or
map layers to compute the interaction of these attributes
Given two polygonal subdivisions of the plane, red and
blue, compute all intersections between a red edge and a
blue edge
10-1
11.
Geographic Information System (GIS)
A GIS is a spatial database with algorithms for managing,
analyzing, and displaying geographic information
Applications with tremendous environmental, social, and
economic impact—infrastructure planning, social engi-
neering, facility location, agriculture
Require algorithms for fundamental problems well-studied
in Computational Geometry—adjacency, containment,
proximity . . .
. . . with a twist—geographic data is huge!
11-1
12.
Massive data
Practical inputs have gigabytes and terabytes of data
We need algorithms whose performance scales well for
increasingly large input data sets encountered in practice
Algorithms with poor memory usage thrash, spending ex-
cessive time transferring data
GIS practitioners often work with mobile devices that are
severely resource constrained
It is important to design algorithms for large-scale data
that perform reliably with memory constraints
12-1
13.
External-memory algorithms
Modern computer memory is organized in a hierarchy
where each level caches the contents of the next level
The cost of data transfer signiﬁcantly inﬂuences the real
cost of an algorithm, often dominating CPU operations
External-memory algorithms seek to minimize data trans-
fer, by utilizing locality of reference
Goal: Develop external-memory algorithms and data
structures for geometric problems, where it is often harder
to exploit locality
13-1
14.
External-memory model
Model of computation where memory is organized in two
levels—internal and external memory [Aggarwal & Vitter]
CPU operations can take place only on data in internal
memory, which is limited in size to M words
Internal External
CPU memory memory
(cache) (disk)
External memory is large enough for input, working space,
and output
14-1
15.
External-memory model
Both internal and external memory organized in blocks
of B words each
B
CPU
block IO
M
B
External memory
(disk)
Internal memory (cache)
The IO-cost of an algorithm is the number of blocks IOs;
each IO reads or writes B words stored in a block; internal
memory of size M holds M/B blocks
15-1
16.
External-memory algorithms
Designed to minimize Input/Output (IO) operations be-
tween slow but large external memory and fast but small
internal memory
Each IO operation reads or writes B words stored in a
block; internal memory of size M holds M/B blocks
Two-level memory model introduced by Aggarwal and
Vitter has become a popular design and analysis tool
Lots of IO-eﬃcient algorithms developed and proved use-
ful in practice
16-1
17.
Scanning and Sorting
n
IO-cost of scanning an n-element array is scan(n) = O( B )
analog of O(n)
n
+ 1 blocks
B
n n
IO-cost of sorting is sort(n) = O( B log M B)
B
analog of O(n log n)
M
B
n
log M
BB M M M
B B B
17-1
18.
Remember ...
Map = polygonal subdivision of the plane, with n edges
Point location: Given a point in the plane, identiﬁed by
its coordinates, ﬁnd the region of the map that contains
the point
Map overlay: Given two polygonal subdivisions of the
plane, red and blue, compute all intersections between a
red edge and a blue edge
18-1
19.
Challenges
Creating a linear size index supporting queries in loga-
rithmic cost
usual hierarchical decompositions support
O(log n) query time but using O(n log n) space
Support eﬃcient batched queries on the index
to answer k queries presented in a batch more
eﬃciently than k individual queries
Can we overlay two maps in O(scan(n)) IOs?
Existing solutions too complicated and/or not IO-optimal
19-1
20.
Quadtree
Hierarchical
decomposition
of the unit
square into
canonical
squares
20-1
21.
Z-curve
Space-ﬁlling curve visits points in order of their Z-index
(a.k.a. Morton block index)
0 00 01 0000 0001 0100 0101
00
1 01
10 11 0010 0011 0110 0111
1000 1001 1100 1101
0 1
10
bit-interleaved
order
11
1010 1011 1110 1111
00 01 10 11
Deﬁned by the order in which it visits quadtree cells
21-1
22.
Quadtree meets Z-curve
Z-curve visits every quadtree cell in a contiguous interval
The leaves of a quadtree deﬁne a subdivision of the Z-
curve
Two quadtree cells are either disjoint or nested
Z-intervals of two quadtree cells are either disjoint or
nested
22-1
25.
Fat triangulation
A δ-fat triangulation is one whose minimum angle is at
least δ > 0
δ
δ
Our input is a triangulation with fatness δ
max. degree 2π/δ
We assume B = Ω(1/δ) and M = Ω(1/δ 3 )
25-1
26.
Linear quadtree
We pre-process the input map(s) by building a quadtree
Our data structure is a linear quadtree:
a linear quadtree stores only leaves (no pointers)
internal nodes are represented implicitly and can be
computed as required
We store quadtree leaves in Z-order
26-1
27.
Small-size quadtree
Repeatedly partition a square into four quadrants
Novel stopping condition:
Stop splitting a quadtree cell when all edges inter-
secting the cell are incident on a common vertex
stop!
split!
Lemma: Quadtree contains O(n/δ 2 ) cells, each cell in-
tersected by at most 2π/δ triangles; total number of
triangle-cell intersections is O(n/δ 2 )
27-1
28.
Building local quadtrees
Top-down recursive algorithm to build quadtree not IO-
eﬃcient
Quadtree may have depth Ω(n),
hence IO-cost may be Ω(n2 /B)
Instead, for each vertex v, build a local quadtree for the
triangles incident on v
Since vertex degree is at most 2π/δ, a local quadtree can
be built entirely in internal memory
28-1
29.
Building local quadtrees
Lemma: The union of all local quadtrees is identical to
the global quadtree
We need to show that every cell in the global quadtree
appears in some local quadtree
Proof: Every triangle T intersects a cell C of the
global quadtree if and only if C belongs to the local
quadtree of at least one of the vertices of T .
29-1
32.
Building an index
Each triangle stored with every quadtree cell that it in-
tersects
The Z-index of a cell is its order along the space-ﬁlling
Z-curve
0 7 8
1
3 4 9 10
2 13
11 12
5 6
15 16
24 25
14
17 18
20 21
26 27
19
22 23
Whenever triangle T intersects cell C, the pair (T, C) is
stored with associated key equal to the Z-index of C
32-1
33.
Indexing triangles
Sort the O(n/δ 2 ) cell-triangle pairs in Z-order of cells
= O(sort(n/δ 2 )) IOs
Build a B-tree on the set of cell-triangle pairs sorted by
key (Z-index of cell)
B-tree has size O(n/δ 2 ) and depth O(logB (n/δ 2 ))
33-1
34.
How to locate a single point
Search the B-tree from root to leaf with Z-index of p for
quadtree cell containing point p
= O(logB (n/δ 2 )) IOs
Check p against all triangles intersecting the cell (at most
2π/δ) in internal memory; all these triangles have the
same key and are stored together
34-1
35.
How to locate a batch of k points
Sort the k query points by Z-index
= O(sort(k)) IOs
Merge the sorted query points and the sorted leaf cells
by scanning in parallel
= O(scan(n/δ 2 + k)) IOs
35-1
36.
How to overlay two triangulations
Quadtree leaves subdivide the Z-curve into disjoint inter-
vals
Since quadtree leaves are sorted in Z-order, the intervals
are in sorted order
Merge the two sorted sets of intervals, corresponding to
the quadtrees of the two triangulations
= O(scan(n/δ 2 )) IOs
36-1
37.
How to support updates
Each of the following operations aﬀects O(1/δ 4 ) entries
in the B-tree:
insert/delete a vertex
ﬂip an edge
Each update aﬀects a local quadtree; perform corre-
sponding changes to the global quadtree
= O( δ14 logB (n/δ 2 )) IOs per update
37-1
38.
Summary: fat triangulations
We build a linear quadtree, from local quadtrees of small
neighborhoods, using a novel stopping condition
The quadtree leaves are stored in a cache-oblivious B-
tree, indexed by their order along the Z-order space-ﬁlling
curve
The B-tree has linear size and logarithmic depth, thus
supporting eﬃcient queries and updates
Two such quadtrees can be overlaid by scanning; the two
indexes are merged in the process
38-1
40.
Low-density maps
The density of a set S of objects is the smallest number
λ such that every disk D intersects at most λ objects of
S whose diameter is at least the diameter of D
The density of a planar map is the density of its edge set
density λ = 3
40-1
41.
Low-density maps
The density of a set S of objects is the smallest number
λ such that every disk D intersects at most λ objects of
S whose diameter is at least the diameter of D
The density of a planar map is the density of its edge set
Our input is a map with density λ
We assume B = Ω(λ)
A δ-fat triangulation has density λ = O(1/δ)
41-1
42.
Compressed quadtree
A compressed quadtree is obtained from an ordinary
quadtree by repeatedly eliminating redundant cuts
compress
42-1
43.
Compressed linear quadtree
We pre-process the input map(s) by building a quadtree
We introduce compressed linear quadtrees:
a compressed quadtree has many fewer nodes than
an ordinary quadtree
a compressed quadtree has more complicated cells
(annuli); our storage scheme handles such cells
An annulus is the set-theoretic diﬀerence of two ordinary
nested cells, represented by two nested Z-intervals
43-1
44.
Quadtree of guarding points
Build a compressed quadtree of guards of edges
Guards of an edge = vertices of the axis-aligned
bounding square
Stopping condition:
Stop splitting a quadtree cell when it contains only
one guard
Lemma [de Berg et al. ’98]: A square containing
g guards intersects at most g + 4λ edges
44-1
46.
How to build a quadtree of points
Sort guarding points in Z-order
For each consecutive pair of points, output their local
quadtree: their canonical bounding square and its four
children
Sort all cells and remove duplicates
Result: Compressed quadtree of guarding points in
O(sort(n)) IOs, where leaf cells are sorted in Z-order
46-1
48.
Computing cell-edge intersections
We distribute the edges of the subdivision among the
quadtree leaf cells
For each edge e, we compute the quadtree cells that
it intersects (say how)
use cache-oblivious distribution sweeping?
A quadtree leaf cell not intersected by any edge is re-
peatedly merged with a predecessor or successor cell in
Z-order
48-1
49.
Small-size quadtree
Lemma: Compressed quadtree of guards contains O(n)
leaf cells, each leaf intersected by at most O(λ) faces;
total number of face-cell intersections is O(nλ).
Build a B-tree on the set of cell-edge pairs sorted by key
(Z-index of cell)
B-tree has O(n) leaves and depth O(logB n)
49-1
50.
How to locate a single point
Search the B-tree from root to leaf with Z-index of p for
quadtree cell containing point p
= O(logB n) IOs
Check p against all O(λ) faces intersecting the cell, in
internal memory; all these faces have the same key and
are stored together
50-1
51.
How to locate a batch of k points
Sort the k query points by Z-index
= O(sort(k)) IOs
Merge the sorted query points and the sorted leaf cells
by scanning in parallel
= O(scan(n + k)) IOs
51-1
52.
How to overlay two maps
Quadtree leaves subdivide the Z-curve into disjoint inter-
vals
Since quadtree leaves are sorted in Z-order, the intervals
are in sorted order
Merge the two sorted sets of intervals, corresponding to
the quadtrees of the two maps
= O(scan(n)) IOs
52-1
53.
Summary: low-density maps
We introduce compressed linear quadtrees
We build a compressed linear quadtree of the set of O(n)
guarding points for the edges of the subdivision
We store the quadtree leaves (only) in sorted order along
the Z-order space-ﬁlling curve
We build a B-tree of linear size, supporting eﬃcient
queries
53-1
54.
Implementation
The Z-order of a point is its bit-interleaved order
Z(x0 x1 . . . xb , y0 y1 . . . yb ) = x0 y0 x1 y1 . . . xb yb
2b-bit integer
The canonical bounding box of two points is computed
from the longest common preﬁx of the bitstring repre-
senting their coordinates
Several optimizations described in our paper
54-1
55.
Summary
We preprocess a fat triangulation or low-density subdivi-
sion in O(sort(n)) IOs so we can:
answer k batched point location queries in
O(scan(n) + sort(k )) IOs
overlay two maps in O(scan(n)) IOs
We give simple, practical, implementable, fast, scalable
algorithms!
Our algorithms for triangulations are cache-oblivious
55-1
56.
Previous work
External-Memory Algorithms for Processing Line
Segments in Geographic Information Systems
Arge, Vengroﬀ, and Vitter; ESA’95
overlay two maps in O(sort(n) + t/B) optimal IOs
where t = number of intersections
batched point location in O((n + k)/B logM/B (n/B))
IOs, where k = number of query points
using Θ(n logM/B (n/B)) blocks of storage (???)
We improve on space usage as well as query time, for
low-density maps, at the expense of O(sort(n)) pre-
processing ; our algorithms are simpler to implement
56-1
57.
To read more ...
I/O-Eﬃcient Map Overlay and Point Location in
Low-Density Subdivisions
Mark de Berg, Herman Haverkort, ST, Laura Toma
http://www.win.tue.nl/∼sthite/pubs/
Condensed version to appear at EuroCG 2007
Thanks to Sariel Har-Peled for valuable discussions
57-1
58.
Future work
Implementation (in progress)
IO-eﬃcient range searching in low-density subdivisions
IO-eﬃcient overlay of general subdivisions, not assuming
fatness or low density
58-1
60.
Algorithms in
Spacetime Meshing
Adaptive Spacetime Meshing
for Discontinuous Galerkin Methods
Joint work with colleagues at the
Center for Process Simulation and Design,
University of Illinois at Urbana-Champaign
60-1
61.
Mesh generation
A mesh is a partition of a domain into simplices (triangles,
tetrahedra, etc.)
Lake Superior
Developing algorithms for generating good-quality small-
size meshes is an active research area
61-1
62.
Engineering applications
Important applications in science and engineering involve
computer simulations of physical phenomena
A mesh is a discretization of the physical domain used to
approximate the underlying continuum physics
A good-quality eﬃciently solvable mesh is crucial for ac-
curate simulation in a tractable amount of computer time
62-1
63.
Challenges
Goal: Develop a provably correct meshing algorithm with
guarantees on the size and quality of the resulting mesh
Domains to be meshed are very complicated
How to generate a mesh at all of certain domains is not
known
What is a good-quality mesh depends on the application
63-1
64.
Spacetime meshing
Construct a tetrahedral mesh of spacetime E2 × R
time
64-1
65.
Spacetime meshing
Waves are encountered in Elastodynamics, Fluid Dynam-
ics, Acoustics, Modeling ocean waves and traﬃc ﬂow
Simulating such transient time-dependent phenomena in-
volves solving spacetime hyperbolic PDEs
Wave traveling along a taut string with wavespeed ω
utt − ω 2 uxx = 0
65-1
66.
Spacetime meshing
Waves propagating in d-dimensional space Ed describe
cones in dD×time
time
y
x
I give algorithms to mesh spacetime Ed × R
Spacetime meshing algorithms support a parallelizable,
O(N )-time solution strategy using novel Spacetime-
Discontinuous Galerkin (SDG) numerical methods
66-1
67.
Linear elastodynamics
When a rectangular plate with a crack in the center is
loaded, the shock wave scatters oﬀ the crack-tip
Shuo-Heng Chung, ST (meshing); Reza Abedi (analysis); Yuan Zhou (visualization)
67-1
69.
Contribution
Spacetime meshing algorithm is adaptive:
Adapt mesh resolution to a posteriori numerical er-
ror estimates
Adapt spacetime aspect ratio of mesh elements to
anisotropy and nonlinear physics
Adaptivity makes possible much more eﬃcient and accu-
rate simulations for a wide variety of physical phenomena
of interest to scientists and engineers
I contribute also to implementing the meshing algorithms
69-1
70.
Impact
We enable high-resolution simulations at multiple length
and time scales, with computational eﬃciency that is or-
ders of magnitude better
Both meshing algorithm and solution strategy are relatively
easy to parallelize, making it practical to solve large prob-
lems with complicated physics
This work has already made a signiﬁcant qualitative and
quantitative improvement to the simulation capability of sci-
entists and engineers
70-1
71.
Advancing front meshing
Construct a sequence of fronts τi in spacetime:
Advance a local neighborhood of τi to get τi+1
Triangulate and solve volume between τi and τi+1
pitching tents
¨o
Basic Tent Pitcher algorithm by Ung¨r, Erickson, et al., 2002
71-1
72.
Causality
A front τ is causal if its slope
time
at every point P is less than the
causal slope at P , i.e.,
||τ (P )|| < 1/ω(P )
A fast nonlocal wave may limit the tentpole height
72-1
73.
Being progressive by looking ahead
1/ω(P QR)
Being too greedy now may R
prevent progress in the fu- 1/ω(P QR)
0
ture
r 1/ωmax
p
q
3
A progressive front is causal 2
and guaranteed to advance 1
by a ﬁnite positive amount
Q P
in every tent pitching step ...
... even if the wavespeed increases sharply (no focusing)
73-1
74.
Reﬁnement and coarsening
We bisect triangles on the current front to decrease the size
of future spacetime elements; coarsening ≡ de-reﬁnement
Newest-vertex
bisection [Sewell
’72, Mitchell ’88]
Spacetime mesh is non-conforming ... SDG thrives on this!
74-1
75.
Adaptive progress constraint
Gradient vector of a progressive front must stay out of the
forbidden zones which depend on the shape of the triangle
and wavespeed
75-1
76.
Summary
Given a simplicial mesh M ∈ Ed , our algorithm builds a
simplicial mesh Ω of the spacetime domain M × [0, ∞):
For every T , the spacetime volume M ×[0, T ] is contained
in the union of a ﬁnite number of simplices of Ω
In 2D×time, the size of spacetime elements adapts to
error estimates; if the number of reﬁnements is ﬁnite,
our algorithm terminates with a ﬁnite mesh of M × [0, T ]
Wavespeed must satisfy a no-focusing condition, which al-
lows us to conservatively estimate future wavespeed from
initial conditions
76-1
77.
To read more ...
Spacetime Meshing for Discontinuous Galerkin
Methods. ST. Ph.D. thesis, Computer Science, Univer-
sity of Illinois at Urbana-Champaign, 2005. Submitted to
Computational Geometry: Theory and Applications.
Spacetime Meshing with Adaptive Reﬁnement and
Coarsening. ST + co-authors. ACM Symp. Computa-
tional Geometry (SoCG), pp. 300–309, 2004.
An h-Adaptive Spacetime-Discontinuous Galerkin
Method for Linearized Elastodynamics. Reza Abedi,
Robert Haber, ST, Jeﬀ Erickson. European Journal Com-
putational Mechanics, 15(6):619–642, 2006.
77-1
78.
Future work
An adaptive spacetime meshing algorithm for 3D×time
A meshing algorithm to track moving boundaries and shock
fronts by aligning mesh facets to corresponding singular sur-
faces in spacetime
78-1
80.
Algorithms in
Topology
Shortest Pants Decomposition
Continuous Fr´chet Distance between Curves
e
80-1
81.
c
a
Pants decomposition e
d
b
c
a
f
c c
a a
e
d
b e e
d d
b b
f f
c c
a a
f e e
d d
b b
f f
Disjoint simple cycles nested in a binary tree decom-
pose the punctured plane into a set of pants
81-1
82.
Continuous Fr´chet distance
e
Dog-leash distance where the leash cannot jump over
obstacles; longer leash required to wind around obstacles
We give polynomial-time algorithms to compute the con-
tinuous Fr´chet distance between polygonal curves in the
e
plane with point obstacles
82-1
84.
Summary of my research
Develop practical and provably eﬃcient algorithms for well-
motivated geometric problems
Develop computational geometry algorithms for realistic in-
puts motivated by applications
Derive tradeoﬀs between complexity of the input, availability
of resources, and cost of the algorithm
84-1
85.
Future work: Spacetime meshing
Boundary tracking is an important and very challenging
problem whose solution will be widely applicable
A new meshing algorithm will come from a signiﬁcant
change to the way of thinking about spacetime meshing
We already have good empirical results and a preliminary
understanding of new meshing operations
Our advancing front framework has more promise of lead-
ing to a fully dynamic meshing algorithm, an important
problem attempted by other researchers
85-1
86.
Future work: IO-eﬃcient algorithms
Extending current results to other GIS problems
In preparation: Cache-Oblivious Selection in X + Y
Matrices, with Mark de Berg.
Identify and solve IO-eﬃciency problems in mesh gener-
ation
86-1
87.
Future work: Topology, Optimization
Extend current results on computing shortest pants decom-
positions in the punctured plane
Motivates interesting clustering problems in metric
spaces and computing other optimal conﬁgurations on
surfaces
Extend current results on continuous Fr´chet distance be-
e
tween curves in the punctured plane
Compute similar Fr´chet measure in the presence of gen-
e
eral obstacles and on more general surfaces
In preparation: Weakly Covering a Point Set with Few
Disjoint Unit Disks, with Sariel Har-Peled.
87-1
89.
Teaching Computer Science
Geometry is a useful vehicle for teaching basic Computer
Science principles as well as advanced algorithms and
data structures
Geometric problems can be stated in an accessible man-
ner, often motivated by daily experience
Manipulation of shapes, visual and tactile intuition makes
problems more appealing
Computer Science is useful and fun (especially Theory)!
89-1
90.
Stimulating research
Many open problems are approachable and solvable from
ﬁrst principles; early success can be tremendously satis-
fying and encouraging
Diﬀerent approaches to a problem are more intuitive and
easier to understand for diﬀerent students
Important to teach to multiple skill sets (diﬀerent back-
ground preparation) to reach all students
90-1
91.
Stimulating research
Alternative views and switching between them is very use-
ful for problem solving
Example: Linear Programming
Is the simplex algorithm performing row and column ma-
trix operations on tableaux or steepest descent on the
1-skeleton of a convex polytope?
Answer: Both!
Computational Geometry is fun!
91-1
Be the first to comment