Upcoming SlideShare
×

# Homotopic Frechet Distance Between Curves

1,924 views

Published on

We define a generalization to arbitrary metric spaces of the classical Frechet distance between curves and give a polynomial-time algorithm to compute this so-called homotopic Frechet distance between polygonal curves in the plane with obstacles.

Published in: Lifestyle, Technology
2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,924
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
0
0
Likes
2
Embeds 0
No embeds

No notes for slide

### Homotopic Frechet Distance Between Curves

1. 1. Walking Your Dog in the Woods in Polynomial Time Shripad Thite shripad@ Caltech.edu ´ Joint work with Erin Wolf Chambers, Eric Colin de Verdi`re, e Jeﬀ Erickson, Sylvain Lazard, Francis Lazarus at SoCG’08, invited to CGTA 1-1
2. 2. Walking your dog You and your dog walk along two given curves from beginning to end, continuously without backtracking, joined by a tight leash 2-1
3. 3. Walking your dog How long must the leash be? 3-1
4. 4. Walking your dog The Fr´chet distance between the curves is the minimum e leash length that permits such a walk 4-1
5. 5. Walking your dog 0.75 0.25 A 0.5 0 1 0.75 0.25 0 B 1 0.5 Curves A, B : [0, 1] → E2 continuous Re-parameterizations u, v : [0, 1] → [0, 1] deﬁne a walk At time t, you are at A(u(t)) and your dog is at B(v(t)) u, v are continuous, monotone 5-1
6. 6. Fr´chet distance = minimum feasible leash length e 0.75 0.25 A 0.5 0 1 0.75 0.25 0 B 1 0.5 A(u(t)) − B(v(t)) F (A, B) = inf max time t walk u, v t∈[0,1] u,v:[0,1]→[0,1] 6-1
7. 7. Fr´chet distance between curves e 0.75 0.25 A 0.5 0 1 0.75 0.25 0 B 1 0.5 A metric deﬁned by Maurice Fr´chet (1878-1973) e O(N 2 log N ) algorithm, in the plane, by Alt+Godau’95, where N = m + n + 2 = total input complexity 7-1
8. 8. Fr´chet distance vs. Hausdorﬀ distance e 0 H F 1 0 1 Fr´chet distance is a better measure of similarity since it e accounts for the ﬂow of the curves (handwriting recognition) 8-1
9. 9. Walking in the Woods 9-1
10. 10. Woods have trees . . . and other obstacles New condition: Leash must move continuously If there are obstacles, a longer leash may be required because the leash cannot jump over them Goal: Walk the dog with the shortest leash possible 10-1
11. 11. Homotopic Fr´chet distance e Dog-leash distance in a general metric space where the leash must move continuously in the metric space We give a polynomial-time algorithm to compute the ho- motopic Fr´chet distance between two polygonal curves in e the plane with obstacles (= punctured plane) 11-1
12. 12. Application: Morphing Leash motion encodes a continuous deformation between A and B, without penetrating obstacles The “cost” of the deformation is the maximum distance any point has to travel, i.e., the Fr´chet distance e 12-1
13. 13. Example 1 13-1
14. 14. Example 1 1 1 13-2
15. 15. Example 1 2 1 2 1 13-3
16. 16. Example 1 2 3 1 23 1 13-4
17. 17. Example 1 2 3 4 1 23 1 4 13-5
18. 18. Example 1 2 3 5 4 1 23 5 1 4 13-6
19. 19. Example 1 6 2 3 5 4 1 23 5 6 1 4 13-7
20. 20. Example 1 6 2 3 5 4 1 7 23 5 6 1 7 4 13-8
21. 21. Example 2 14-1
22. 22. Example 2 1 1 14-2
23. 23. Example 2 1 2 1 2, 3, 4 14-3
24. 24. Example 2 1 2 3 1 2, 3, 4 14-4
25. 25. Example 2 1 2 3 4, 5, 6 1 2, 3, 4 14-5
26. 26. Example 2 1 2 3 4, 5, 6 1 2, 3, 4 5 14-6
27. 27. Example 2 1 2 3 4, 5, 6 1 2, 3, 4 5 6 14-7
28. 28. Example 2 1 2 3 4, 5, 6 7 1 2, 3, 4 5 6 7 14-8
29. 29. Deﬁnitions SLOW TOPOLOGY AHEAD 15-1
30. 30. Leash map : [0, 1] × [0, 1] → S Continuous function arc-length time metric space s.t. u = (0, ·), v = (1, ·) are re-parameterizations of A, B 0.25 0.75 A 0.5 u=0 u=1 0.25 0.75 v=1 v=0 B 0.5 i.e. (·, t) is the leash at time t joining A(u(t)) and B(v(t)) 16-1
31. 31. Homotopic Fr´chet distance e : [0, 1] × [0, 1] → S Continuous function arc-length time metric space s.t. u = (0, ·), v = (1, ·) are re-parameterizations of A, B The cost of a leash map is the maximum length of the leash at any time during the leash motion: cost( ) := max { Length of (·, t) } t∈[0,1] 17-1
32. 32. Homotopic Fr´chet distance e : [0, 1] × [0, 1] → S Continuous function arc-length time metric space s.t. u = (0, ·), v = (1, ·) are re-parameterizations of A, B The cost of a leash map is the maximum length of the leash at any time during the leash motion: cost( ) := max { Length of (·, t) } t∈[0,1] The homotopic Fr´chet distance is the minimum cost of e any leash map: { cost( ) } F (A, B) := inf leash map 17-2
33. 33. Meanwhile, back in the woods . . . 18-1
34. 34. Punctured plane Let A, B be two given curves in E2 19-1
35. 35. Punctured plane Let A, B be two given curves in E2 Let P be a set of obstacles, with total complexity k Punctured Plane = E2 P 19-2
36. 36. Punctured plane Let A, B be two given curves in E2 Let P be a set of obstacles, with total complexity k Punctured Plane = E2 P A leash is a curve in E2 P joining A and B 19-3
37. 37. Punctured plane Let A, B be two given curves in E2 Let P be a set of obstacles, with total complexity k Punctured Plane = E2 P A leash is a curve in E2 P joining A and B Leash map : [0, 1] × [0, 1] → E2 P must be continuous; so, the leash cannot jump over obstacles 19-4
38. 38. Relative homotopy Two leashes are relatively homotopic if one can be con- tinuously transformed into the other in the punctured plane while keeping their endpoints on the respective curves 20-1
39. 39. Relative homotopy Two leashes are relatively homotopic if one can be con- tinuously transformed into the other in the punctured plane while keeping their endpoints on the respective curves Functions α, β : X → Y are (freely) homotopic if there is a continuous function h : X × [0, 1] → Y such that h(·, 0) = α(·) and h(·, 1) = β(·) 20-2
40. 40. Relative homotopy class Every leash map h describes a set of leashes belonging to some relative homotopy class h 21-1
41. 41. Homotopic Fr´chet distance redux e Let h be a relative homotopy class 22-1
42. 42. Homotopic Fr´chet distance redux e Let h be a relative homotopy class Let be a leash map in homotopy class h h 22-2
43. 43. Homotopic Fr´chet distance redux e Let h be a relative homotopy class Let be a leash map in homotopy class h h { cost( h ) } Let Fh (A, B) := inf h 22-3
44. 44. Homotopic Fr´chet distance redux e Let h be a relative homotopy class Let be a leash map in homotopy class h h { cost( h ) } Let Fh (A, B) := inf h Homotopic Fr´chet distance e F (A, B) := min{Fh (A, B)} h 22-4
45. 45. Key Insights a.k.a. ‘Aha!’ moments 23-1
46. 46. Insight 1: Geodesic leashes Lemma: There exists an optimum leash map such that the leash at every time is the shortest path in its homotopy class 24-1
47. 47. Insight 1: Geodesic leashes Lemma: There exists an optimum leash map such that the leash at every time is the shortest path in its homotopy class Hence, w.l.o.g., ∗ (·, t) is the (unique) geodesic in homotopy h class h between its endpoints 24-2
48. 48. Insight 1: Geodesic leashes Lemma: There exists an optimum leash map such that the leash at every time is the shortest path in its homotopy class Hence, w.l.o.g., ∗ (·, t) is the (unique) geodesic in homotopy h class h between its endpoints Fact: The geodesic between a ∈ A and b ∈ B moves continuously as a,b move continuously along their respective curves 24-3
49. 49. Insight 1: Geodesic leashes Lemma: There exists an optimum leash map such that the leash at every time is the shortest path in its homotopy class Hence, w.l.o.g., ∗ (·, t) is the (unique) geodesic in homotopy h class h between its endpoints Fact: The geodesic between a ∈ A and b ∈ B moves continuously as a,b move continuously along their respective curves but . . . there are inﬁnitely many geodesics with the same endpoints, one in each of inﬁnitely many homotopy classes 24-4
50. 50. Insight 2: Proper line segment Lemma: The optimum homotopy class h∗ must contain a proper line segment, i.e., a line segment joining A and B avoiding all obstacle points m edges k point obstacles n edges 25-1
51. 51. Insight 3: Minimal homotopy classes A homotopy class is minimal if it does not bend around obstacles unnecessarily Lemma: There exists an optimum homotopy class that is minimal Lemma: Every minimal homotopy class contains a proper line segment Here onwards, we speak only of minimal homotopy classes 26-1
52. 52. Insight 4: Pinned leash map The optimum leash map ∗ may be pinned at a common subpath π, i.e., a globally shortest p-q path where p,q are obstacle boundary points p π q ∗ The optimum leash map contains a direct geodesic 27-1
53. 53. The Algorithm 28-1
54. 54. Algorithm for point obstacles List all candidate homotopy classes h There are O(mnk 2 ) extremal proper line seg- ments, at least one in each homotopy class m edges k obstacles n edges Compute Fh (A, B) In O(mnk log mnk) time using parametric search 29-1
55. 55. Algorithm for polygonal obstacles The optimum leash map ∗ may be pinned at a common subpath π, i.e., a globally shortest p-q path p π q Enumerate O(mnk 4 ) pinned homotopy classes h Compute Fh (A, B) in O(mnk log mnk) time as before 30-1
56. 56. Summary 31-1
57. 57. We deﬁned the homotopic Fr´chet distance between two e curves in a general metric space the most natural generalization of Fr´chet distance e to arbitrary metric spaces We gave a polynomial-time algorithm to compute the homo- topic Fr´chet distance between two polygonal curves A,B e in the plane with point or polygonal obstacles the punctured plane is the ﬁrst metric space that we consider 32-1
58. 58. Open problem: On a convex polyhedron Leash is not always a geodesic! e.g., leash must have enough slack to cross over a vertex (a ‘mountain’) Challenge: Characterize an optimum leash map 33-1
59. 59. Thank you! 34-1
60. 60. Extra slides 35-1
61. 61. How to compute Fh (A, B) in detail 36-1
62. 62. Computing Fh Decision problem: Given a real d ≥ 0, is Fh (A, B) ≤ d? 37-1
63. 63. Computing Fh Decision problem: Given a real d ≥ 0, is Fh (A, B) ≤ d? Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . 37-2
64. 64. Computing Fh Decision problem: Given a real d ≥ 0, is Fh (A, B) ≤ d? Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . 37-3
65. 65. Computing Fh Decision problem: Given a real d ≥ 0, is Fh (A, B) ≤ d? Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . Fh (A, B) Goal: Find the smallest critical value d for which the answer above is ‘yes’ 37-4
66. 66. Is Fh ≤ d? i + 1, j + 1 |P | changes |P | changes i, j http://www.cim.mcgill.ca/∼stephane/cs507/Project.html, St´phane Pelletier, 2002 e Is there a monotone path from (0, 0) to (m, n) in free space? Key lemma: Free space within each cell Cij is convex i.e., leash length is a convex function along any monotone path through Cij (think hourglasses) 38-1
67. 67. Computing free space i + 1, j i + 1, j + 1 i, j i, j + 1 Given the shortest path between ai and bj , compute: (1) the interval b ∈ [bj , bj+1 ] such that dist(ai , b) ≤ d (2) the interval a ∈ [ai , ai+1 ] such that dist(bj , a) ≤ d (3) shortest paths (ai , bj+1 ), (ai+1 , bj ), and (ai+1 , bj+1 ) 39-1
68. 68. Funnels Shortest paths from ai to [bj , bj+1 ] deﬁne a funnel∗ ∗ in the universal cover 40-1
69. 69. Funnels Shortest paths from ai to bj+1 b [bj , bj+1 ] deﬁne a funnel∗ ∗ in the universal cover bj Leash evolves like a deque apex as its endpoints sweep tail ai 40-2
70. 70. Funnels Shortest paths from ai to bj+1 b [bj , bj+1 ] deﬁne a funnel∗ ∗ in the universal cover bj Leash evolves like a deque apex as its endpoints sweep tail ai In O(k log k) time, build a funnel data structure of size O(k), using a deque, such that each free interval can be computed in O(log k) time 40-3
71. 71. Computing Fh Decision algorithm: Given a real d ≥ 0, is Fh (A, B) ≤ d? . . . in O(mn log k) time 41-1
72. 72. Computing Fh Decision algorithm: Given a real d ≥ 0, is Fh (A, B) ≤ d? . . . in O(mn log k) time Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . 41-2
73. 73. Computing Fh Decision algorithm: Given a real d ≥ 0, is Fh (A, B) ≤ d? . . . in O(mn log k) time Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . 41-3
74. 74. Computing Fh Decision algorithm: Given a real d ≥ 0, is Fh (A, B) ≤ d? . . . in O(mn log k) time Observation: There are polynomially many critical values of d at which the answer may change from ‘no’ to ‘yes’ d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ di+1 ≤ di+2 ≤ . . . Fh (A, B) Goal: Find the smallest critical value d for which the answer above is ‘yes’ 41-4
75. 75. Parametric search [Megiddo ’83] Let As be an algorithm to decide, given a critical value di , whether Fh (A, B) ≤ di , with running time O(Ts ) d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . 42-1
76. 76. Parametric search [Megiddo ’83] Let As be an algorithm to decide, given a critical value di , whether Fh (A, B) ≤ di , with running time O(Ts ) d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate As on input d∗ , with d∗ as a symbolic variable 42-2
77. 77. Parametric search [Megiddo ’83] Let As be an algorithm to decide, given a critical value di , whether Fh (A, B) ≤ di , with running time O(Ts ) d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate As on input d∗ , with d∗ as a symbolic variable The control ﬂow of As depends on comparisons of the form d∗ ≤ dj where dj is a critical value Each dj is a distance, i.e., a quadratic function of input coordinates. 42-3
78. 78. Parametric search [Megiddo ’83] Let As be an algorithm to decide, given a critical value di , whether Fh (A, B) ≤ di , with running time O(Ts ) d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate As on input d∗ , with d∗ as a symbolic variable The control ﬂow of As depends on comparisons of the form d∗ ≤ dj where dj is a critical value Each dj is a distance, i.e., a quadratic function of input coordinates. d∗ ≤ dj ? Run As on input dj , in O(Ts ) time 42-4
79. 79. Parametric search [Megiddo ’83] Let As be an algorithm to decide, given a critical value di , whether Fh (A, B) ≤ di , with running time O(Ts ) d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate As on input d∗ , with d∗ as a symbolic variable The control ﬂow of As depends on comparisons of the form d∗ ≤ dj where dj is a critical value Each dj is a distance, i.e., a quadratic function of input coordinates. d∗ ≤ dj ? Run As on input dj , in O(Ts ) time 2 Total running time = O(Ts ) 42-5
80. 80. Parametric search on steroids [Megiddo ’83] Let Ap be a parallel algorithm to decide, given di , whether Fh (A, B) ≤ di , with parallel running time O(Tp ) on q pro- cessors d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . 43-1
81. 81. Parametric search on steroids [Megiddo ’83] Let Ap be a parallel algorithm to decide, given di , whether Fh (A, B) ≤ di , with parallel running time O(Tp ) on q pro- cessors d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable 43-2
82. 82. Parametric search on steroids [Megiddo ’83] Let Ap be a parallel algorithm to decide, given di , whether Fh (A, B) ≤ di , with parallel running time O(Tp ) on q pro- cessors d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value 43-3
83. 83. Parametric search on steroids [Megiddo ’83] Let Ap be a parallel algorithm to decide, given di , whether Fh (A, B) ≤ di , with parallel running time O(Tp ) on q pro- cessors d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value In each parallel stage, do binary search on O(q) values dj 43-4
84. 84. Parametric search on steroids [Megiddo ’83] Let Ap be a parallel algorithm to decide, given di , whether Fh (A, B) ≤ di , with parallel running time O(Tp ) on q pro- cessors d1 ≤ d2 ≤ . . . ≤ di−1 ≤ d∗ ≤ . . . ≤ dj ≤ . . . We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value In each parallel stage, do binary search on O(q) values dj Total running time = O(Ts Tp log q + qTp ) 2 better than O(Ts ) 43-5
85. 85. How we use parametric search Let Ap be a parallel sorting algorithm (e.g., Cole’s parallel merge sort) 44-1
86. 86. How we use parametric search Let Ap be a parallel sorting algorithm (e.g., Cole’s parallel merge sort) We use Ap to sort O(mn) critical distances with parallel running time O(log mn) We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable 44-2
87. 87. How we use parametric search Let Ap be a parallel sorting algorithm (e.g., Cole’s parallel merge sort) We use Ap to sort O(mn) critical distances with parallel running time O(log mn) We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value 44-3
88. 88. How we use parametric search Let Ap be a parallel sorting algorithm (e.g., Cole’s parallel merge sort) We use Ap to sort O(mn) critical distances with parallel running time O(log mn) We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value To simulate each parallel stage, we resolve all O(mn) com- parisons d∗ ≤ dj by computing O(mnk) critical intervals and locating each dj in some interval 44-4
89. 89. How we use parametric search Let Ap be a parallel sorting algorithm (e.g., Cole’s parallel merge sort) We use Ap to sort O(mn) critical distances with parallel running time O(log mn) We simulate Ap sequentially on input d∗ , with d∗ as a symbolic variable The control ﬂow of Ap depends on comparisons of the form d∗ ≤ dj where dj is a critical value To simulate each parallel stage, we resolve all O(mn) com- parisons d∗ ≤ dj by computing O(mnk) critical intervals and locating each dj in some interval Total running time = O(N 3 log N ) 44-5
90. 90. The End 45-1