580 likes | 820 Views
Geodesic Fréchet Distance inside a Simple Polygon. by Atlas F. Cook IV and Carola Wenk. Overview. Fréchet Distance d F Calculating d F : Decision Problem Optimization Problem Geodesic Fréchet Distance d G Decision Problem Funnels and Hourglasses Optimization Problem
E N D
Geodesic Fréchet Distance inside a Simple Polygon by Atlas F. Cook IV and Carola Wenk
Overview • Fréchet Distance dF • Calculating dF: • Decision Problem • Optimization Problem • Geodesic Fréchet Distance dG • Decision Problem • Funnels and Hourglasses • Optimization Problem • Randomized Red-Blue Intersections • Conclusion • References
Fréchet Distance dF • Fréchet Distance measures the similarity of two curves. • Computing the Fréchet distance: • Walk the dog…Woof!
Fréchet Distance dF • Fréchet Idea: • Both the person and dog walk forward on their own curves from beginning to end • A leash is maintained
Fréchet Distance dF • Fréchet Idea: • A different walk
Fréchet Distance dF • Fréchet Idea: • Each walk has its own maximum leash length.
Fréchet Distance dF • Fréchet Idea: • Examine all possible walks. • Yields a set M of maximum leash lengths. • dF= shortest leash lengthinM.
Fréchet Distance dF • Mathematical dF: [Alt1995] • Find all maximum leash lengths. • Return the smallest of theseleash lengths. dF(a,b) = inf f,g:[0,1] [0,1] where f and g range over continuous non-decreasing reparametrizations. max ||a(f(t))-b(g(t))|| t [0,1]
Calculating Fréchet Distance • Representing all walks: Free Space Diagram Position on blue curve X-axis position “ “ red curve Y-axis position
Calculating Fréchet Distance • Free Space Diagram: • Classifies distances using a parameter ε: • White “Free Space” Leash length ≤ ε • Green “Constrained Space” Leash length > ε • EX: ε = 10 All leash lengths ≤ 10 are white. Leash Length=15 Leash Length=5
Calculating Fréchet Distance • Free Space Diagram as ε is varied:
Calculating Fréchet Distance • ComputingdF: • Decision Problem • Optimization Problem
Calculating Fréchet Distance • Decision Problem • Given a leash length ε • Is there a monotone path through the whitespace from the lower left corner of the free space diagram to the upper right corner? • Answer: YES or NO YES YES NO
Calculating Fréchet Distance • Optimization Problem • Find the smallestε that still yields a path. • This value is the Fréchet distance. ε is as small as possible ε is too small ε is too big
Geodesic Fréchet Distance dG • Geodesic Fréchet distance dG • Geodesic = shortest path that avoids obstacles. • The leash must stay inside a simple polygon.
Geodesic Fréchet Distance dG • How do we calculate dG? • Decision Problem • Calculate Geodesic Free Space Diagram • Optimization Problem • Return the smallest ε with a monotone path through the free space diagram. ε is as small as possible ε is too big ε is too small
Geodesic Fréchet Distance dG • Geodesics inside a simple polygon: • Funnel [Guibas1989] • Describes any horizontal/vertical line segment in a free space cell. Free Space Cells C12 C22 C32 C11 C21 C31
Geodesic Fréchet Distance dG • Geodesics inside a simple polygon: • Hourglass [Guibas1989] • Describes an entire free space cell Open Hourglass Closed Hourglass Intersecting Hourglass
Geodesic Fréchet Distance dG • Free Space in a Cell: • (x,y)-monotone • Why? • Pick a point q cd. • As q varies from c to d, d(p,q) is bitone. • Interpretation: • Any horizontal/vertical line segment in a cell has at most one free interval • This is the definition of (x,y)-monotone. q q q
Geodesic Fréchet Distance dG • Free Space in a Cell: • Connected • Why? • Any two points in a cell’s free space are connected by a bitone path through an hourglass. • Holds for all three types of hourglasses.
Geodesic Fréchet Distance dG • Algorithm: Geodesic Decision Problem • Compute each cell boundary in O(log k) time • A funnel [Guibas1989]represents a cell boundary. • Intersect a funnel’s distance function with y = ε. • The (at most two) intersections define the free space.
Geodesic Fréchet Distance dG • Algorithm: Geodesic Decision Problem • Compute each cell boundary in O(log k) time • Propagate reachability data through a cell • Cell Free Space • (x,y)-monotone & connected • Only cell boundaries are required for propagation • Given boundaries O(1) time propagation
Geodesic Fréchet Distance dG • Big-Oh Geodesic Decision Problem • Let N = complexity of Person & Dog curves • Let k = complexity of simple polygon • Time: O(N2 log k) • Compute cell boundaries O(N2 log k) time • Propagate reachability O(N2) time
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Return the smallest ε with a monotone path through the geodesic free space diagram. ε is as small as possible ε is too small ε is too big
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Traditional non-geodesic approach: • Parametric Search • Sort O(N2) constant-complexity cell boundary functions • Geodesic Parametric Search • Each cell boundary has O(k) complexity • Straightforward parametric search sorts O(kN2) values • Too slow
Geodesic Fréchet Distance dG • Alternative to parametric search • Randomized algorithm • Applies to both non-geodesic & geodesic Fréchet optimization problems in the plane • Resolves “critical values” using red-blue intersections
Geodesic Fréchet Distance dG • Critical Values • Values that must be examined to find dF • Free space in cell Cij is a function of e • Let aij(e) be the bottom free space boundary • Let bij(e) be the top free space boundary
Geodesic Fréchet Distance dG • Critical Values • As e increases: • aij(e) decreases monotonically • bij(e) increases monotonically
Geodesic Fréchet Distance dG • Every critical value is a “red-blue” intersection between some aij(e) and bkl(e).
Geodesic Fréchet Distance dG • Red-Blue Intersections • Red curves: R = { r1(x), r2(x),…, rm(x) } • Blue curves: B = { b1(x), b2(x),…, bn(x) } • Goal: • Given a search domain x[a,b] • Count the number of red-blue intersections in [a,b]
Geodesic Fréchet Distance dG • Red-Blue Intersections • ri(x) properties for 1 ≤ i ≤ m: • O(k) complexity • monotone decreasing & continuous • min( ri(x) ) = ymin • bi(x) properties for 1 ≤ j ≤ n : • O(k) complexity • monotone increasing & continuous • max( bj(x) ) = ymax // ymin ≤ ymax • No new curve begins in the interior of [a,b]
Geodesic Fréchet Distance dG • Why Red-Blue Intersections Apply to Type (c) critical values • aij(e) properties as e→∞: • O(k) complexity • decreasing & continuous • min( aij(e) ) = 0.0 • bij(e) properties as e→∞: • O(k) complexity • increasing & continuous • max( bij(e) ) = 1.0 // top of cell boundary
Geodesic Fréchet Distance dG • Why Red-Blue Intersections Apply to Type (c) critical values • Precomputing type (a) and (b) critical values shrinks search domain [a,b] until no new curve begins inside [a,b]. [a,b]
Geodesic Fréchet Distance dG • Red-Blue Intersections • Compute & sort all curve values at x = a • Suppose ri(a) ≥ bj(a) • ri(x) ∩ bj(x) for x ≥a because ri(∞)=ymin≤ bj(∞)=ymax
Geodesic Fréchet Distance dG • Red-Blue Intersections • Sort the curve values at x = a and x = b • Count the number of blue curves below each red curve
Geodesic Fréchet Distance dG • Red-Blue Intersections • r3(x) intersects two blue curves for x ≥a. • r3(x) intersects one blue curve for x ≥b. • Subtracting and accounting for x=b intersections reveals that r3(x) must have (2-1)=1 intersection in [a,b].
Geodesic Fréchet Distance dG • Algorithm: Geodesic Optimization Problem • Precompute all type (a) and (b) critical values • Yields search domain: [a,b] • Count intersections in [a,b] for each row j. • Let Cj be the counting data structure. • Pick a random intersection in [a,b] for each row using Cj. • Goal: O(log N) expected iterations
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Pick the curve aMjinvolved in the most intersections in [a,b] for each row using Cj. • Goal: At most O(N) iterations • Calculate intersections involving aMj • Discard aMj. • Store all intersections in a global pool P. • P is similar to Cole’s [Cole1987] parametric search. • Why not pick O(N) intersections at random? • Cj does not support fast random access.
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Medians • Find the median Ξ of pool P. • Find the median Ψ of the O(N) randomly selected intersections. • Decision Problem • Run decision problem on the two medians Ξ, Ψ. • Shrink the search domain [a,b]. • Discard the resolved half of pool P. • Go back to step 2 (intersection counting) until all row-based type (c) critical values are resolved.
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Column-based type (c) critical values • Resolve in the same spirit as the row-based values. • Return the smallest critical value e* that satisfied the decision problem.
Geodesic Fréchet Distance dG • Number of Steps: • O(log N) expected • A random intersection is resolved each step • Shrinks the search domain [a,b] • O(N) worst-case • Each step discards one aMj for every row. • There are O(N) aMjper row.
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Step Time: • Intersection counting dominates • O(N2 log kN) • Expected runtime: O(k+(N2 log kN)log N) • Worst-case runtime: O(k+N3 log kN) • Space: O(k+N2) • Parametric Search time: O(k+kN2 log kN)
Geodesic Fréchet Distance dG • Parametric Search vs. Randomization: • Parametric Search • Large constant factors [Cole1987] • Randomization • Alternative to parametric search [Agarwal1998] • Not previously applied to Fréchet distance • Better expected runtime • Straightforward implementation • Applies to the non-geodesic Fréchet distance in the plane in O(N2 log2 N) time
Conclusion • First algorithm for the geodesic Fréchet distance inside a simple polygon. • Decision Problem • Compute cell boundaries • Propagate reachability • Optimization Problem • Randomized alternative to parametric search: • Red-blue intersections • Applies to both the non-geodesic and geodesic Fréchet distances in the plane.
References: • [Agarwal1998] • Agarwal, P. K. & Sharir, M.Efficient algorithms for geometric optimizationACM Comput. Surv., ACM Press, 1998, 30, 412-458 • [Alt1995] • Alt, H. & Godau, M.Computing the Frechet Distance Between Two Polygonal CurvesInternational Journal of Computational Geometry and Applications, 1995, 5, 75-91
References: • [Cole1987] • Cole, R.Slowing down sorting networks to obtain faster sorting algorithmsJ. ACM, ACM Press, 1987, 34, 200-208 • [Guibas1989] • Guibas, L. J. & Hershberger, J.Optimal shortest path queries in a simple polygonJ. Comput. Syst. Sci., Academic Press, Inc., 1989, 39, 126-152
Calculating Fréchet Distance • Representing all walks: End of all walks Start of all walks
Geodesic Fréchet Distance dG • Geodesic Optimization Problem • Type (b) critical value • Involves a single cell • aij = bij