tu emdberg/onderwijs/advalg_material/course notes/aa-geom-lecture4.pdftu e gps data, rfid tags,...
TRANSCRIPT
Computational Geometry
Mark de BergTU Eindhoven
TU e
(Two) Selected Topics
TU e
Reconstructing Terrainsfrom Elevantion Data
TU e Reconstructing terrains from elevation data
931
942
927
899
912
922
=⇒
given: terrain elevation at sample points
goal: construct terrain surface
TU e reconstructing terrains from elevation data
931
942
927
899
912
922elevation?
TU e reconstructing terrains from elevation data
931
942
927
899
912
922elevation?
Idea: use elevation ofnearest sample point
Voronoi diagram
TU e reconstructing terrains from elevation data
931
942
927
899
912
922elevation?
Idea: use elevation ofnearest sample point
Voronoi diagram
Does not give good result:surface not continuous
TU e
Better: determine elevation using interpolation
reconstruction using triangulation
TU e
triangulation
Better: determine elevation using interpolation
reconstruction using triangulation
TU e
triangulation
Better: determine elevation using interpolation
reconstruction using triangulation
TU e
triangulation
Better: determine elevation using interpolation
gives continuous surface
reconstruction using triangulation
TU e
What is a good triangulation?
or or . . .
reconstruction using triangulation
TU e
What is a good triangulation?
or or . . .
long and thin triangles are bad =⇒ try to avoid small angles
reconstruction using triangulation
TU e
What is a good triangulation?
or or . . .
long and thin triangles are bad =⇒ try to avoid small angles
Algorithmic problem: how can we quickly computea triangulation that maximizes the angles?
reconstruction using triangulation
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Voronoi diagrams and Delaunay triangulations
TU e
Voronoi diagram
connect points whoseVoronoi cells are neighbors
Delaunay triangulation:
triangulation that maximizesthe minimum angle!
Voronoi diagrams and Delaunay triangulations
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
Algorithm for computing Delaunay triangulations:
1. for every triple of points2. do if all other points lie outside Circle(p, q, r)3. then Add triangle ∆(p, q, r) to DT
TU e computing the Delaunay triangulation
∆(p, q, r) is triangle in Delaunay triangulation
Circle(p, q, r) does not contain any other point
⇐⇒
Algorithm for computing Delaunay triangulations:
1. for every triple of points2. do if all other points lie outside Circle(p, q, r)3. then Add triangle ∆(p, q, r) to DT
• running time O(n4): very slow!
• can we do better? yes: there are algorithms running in O(n log n) time
TU e
Analyzing Trajectoriesof Moving Objects
TU e
• GPS data, RFID tags, surveillance cameras, simulations
Moving objects (spatio-temporal data): now widely available
Movement data can be considered in two ways:
TU e
• GPS data, RFID tags, surveillance cameras, simulations
Moving objects (spatio-temporal data): now widely available
Movement data can be considered in two ways:
=⇒
• Individual locations, which change over time, are relevant
TU e
• GPS data, RFID tags, surveillance cameras, simulations
Moving objects (spatio-temporal data): now widely available
Movement data can be considered in two ways:
=⇒
• Individual locations, which change over time, are relevant
• Trajectories are relevant
TU e Trajectory analysis
• given two trajectories, how similar are they?
• given a collection of trajectories, report all subtrajectories similar toa query trajectory
• is there a certain motion pattern? (leader following, flocking, . . . )
Analyzing trajectories: examples of interesting questions
• behavorial studies on animals
• analysis of sports games
• analyzing traffic
Analyzing trajectories: applications
TU e Measuring the similarity of trajectories
Basic question: how to measure similarity of two trajectories
A
B
We need a distance function dist(·, ·) on the trajectories:the smaller dist(A,B), the more similar A and B are
TU e Measuring the similarity of trajectories
Basic question: how to measure similarity of two trajectories
A
B
We need a distance function dist(·, ·) on the trajectories:the smaller dist(A,B), the more similar A and B are
First attempt: Hausdorff distance
dist(A,B) = max ( , )maxa∈A
minb∈B
d(a, b) maxb∈B
mina∈a
d(b, a)
TU e Measuring the similarity of trajectories
Basic question: how to measure similarity of two trajectories
A
B
We need a distance function dist(·, ·) on the trajectories:the smaller dist(A,B), the more similar A and B are
First attempt: Hausdorff distance
dist(A,B) = max ( , )maxa∈A
minb∈B
d(a, b) maxb∈B
mina∈a
d(b, a)
TU e Measuring the similarity of trajectories
Basic question: how to measure similarity of two trajectories
A
B
We need a distance function dist(·, ·) on the trajectories:the smaller dist(A,B), the more similar A and B are
First attempt: Hausdorff distance
dist(A,B) = max ( , )maxa∈A
minb∈B
d(a, b) maxb∈B
mina∈a
d(b, a)
TU e Measuring the similarity of trajectories
Is the Hausdorff distance a good measure for trajectory similarity?
Hausdorff distance:
TU e Measuring the similarity of trajectories
Is the Hausdorff distance a good measure for trajectory similarity?
Hausdorff distance:Hausdorff distance:
TU e Measuring the similarity of trajectories
Is the Hausdorff distance a good measure for trajectory similarity?
Hausdorff distance does not takecontinuity of trajectories into account
Hausdorff distance:Hausdorff distance:
Hausdorff distance can be small, evenwhen trajectories are very different
TU e Measuring the similarity of trajectories
A better measure: Frechet distance
A
B
• take continuous mapping µ : A→ B
• take as distance maxa∈A d(a, µ(a))
a
µ(a)
TU e Measuring the similarity of trajectories
A better measure: Frechet distance
A
B
• take continuous mapping µ : A→ B
• take as distance maxa∈A d(a, µ(a))
a
µ(a)
TU e Measuring the similarity of trajectories
A better measure: Frechet distance
A
B
• take continuous mapping µ : A→ B
• take as distance maxa∈A d(a, µ(a))
a
µ(a)
Which mapping? Take the best one:
Frechet-dist(A,B) = minµ
maxa∈A
d(a, µ(a)),
where min is taken over all continuous 1-to-1 mappings
TU e
TU e
Hausdorff distance:
TU e
Hausdorff distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e
Frechet distance:
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
what does continuous 1-to-1 mappingcorrespond to in diagram?
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
what does continuous 1-to-1 mappingcorrespond to in diagram?
xy-monotone path from lower left to upper right
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
what does continuous 1-to-1 mappingcorrespond to in diagram?
xy-monotone path from lower left to upper right
must decide if monotone path existssuch that distance is always ≤ ε
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
forbidden region in diagram:(a, b) such that d(a, b) > ε
ε
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
forbidden region in diagram:(a, b) such that d(a, b) > ε
ε
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
forbidden region in diagram:(a, b) such that d(a, b) > ε
ε
ε
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
forbidden region in diagram:(a, b) such that d(a, b) > ε
ε
Algorithm:Compute decomposition into free andforbidden regions, and check if mono-tone path exists in free region.
TU e Measuring the similarity of trajectories
Computing similarity: deciding if Frechet-dist(A,B) ≤ ε
A
B b1b2
b3
b4
a1 a2a3 a4
free-space diagram (for given ε)
b1 b2 b3 b4a1
a2
a3
a4
forbidden region in diagram:(a, b) such that d(a, b) > ε
ε
Algorithm:Compute decomposition into free andforbidden regions, and check if mono-tone path exists in free region.
Can be done in O(nm) time
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is aconnected of B similar to A?
A
B
subcurve
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is aconnected of B similar to A?
A
B B′
A
B
subcurve
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is aconnected of B similar to A?
A
B B′
A
B
subcurve
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is aconnected of B similar to A?
A
B B′
A
B
B′
subcurve
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is aconnected of B similar to A?
A
B B′
A
B
mapping from B′ ⊆ B to A
path from bottom to top in diagram
B′
subcurve
TU e Measuring the similarity of trajectories
ε
Partial matching: what if we want to decide if there is a con-nected subcurve of B that is similar to A?
A
B B′
mapping from B′ ⊆ B to A
path from bottom to top in diagram
B′
TU e
what if exact locations are not important?
Recall definition of Frechet distance:
Frechet-dist(A,B) = minµ
maxa∈A
d(a, µ(a)),
where min is taken over all continuous 1-to-1 mappings
TU e
what if exact locations are not important?
Recall definition of Frechet distance:
Frechet-dist(A,B) = minµ
maxa∈A
d(a, µ(a)),
where min is taken over all continuous 1-to-1 mappings
Euclidean distance
TU e
what if exact locations are not important?
Recall definition of Frechet distance:
Frechet-dist(A,B) = minµ
maxa∈A
d(a, µ(a)),
where min is taken over all continuous 1-to-1 mappings
Euclidean distancedifference in direction of movement
TU e
Fr’echet distance: summary
• good measuring similarity of curves (e.g. trajectories)
• can be computed fairly efficiently for polygonal curves
• many variations (partial matching, directional Frechet distance, . . . )