Computing the Hausdorff Distance between Two B ... - Semantic Scholar

Report 14 Downloads 236 Views
Computing the Hausdorff Distance between Two B-Spline Curves

Zachi Shtain Based on the work of: Chen et al. 2010

Definition • Given two curves C1, C2, their Hausdorff distance is defined as:



DH  C1 , C2   max max min p  q , max min p  q

• Where:

pC1 qC2

qC2

pC1



min p  q , max min p  q are the one-sided – max pC qC qC pC 1

2

2

1

Hausdorff distance – p & q are known as the Hausdorff pair 2

Example

3

Point-Curve Projection • Given a point p and a curve C(u), the point projection problem can be described:





p  C  u *  min p  C  u  , u   a, b

• If u*   a, b , we have the following necessary

condition:

4

p  C  u * , C '  u *  0

Point-Curve Projection – cont. • Using the condition the problem turns into a root-finding problem of a polynomial equation

• Two steps for solving: – Removing intervals which contain no solution

– Compute local extrema in each remaining intervals

5

p  C  u * , C '  u *  0

Point-Curve Projection – Example • Given a Bezier curve defined by the control polygon {(-1, 0) , (0, 2) , (1, 0)}

• Find the location(s) on curve which have the minimum distance between the curve and the

point (0, 0)

6

Point-Curve Projection – Example – cont. • The inner product yields a Bezier curve defined by the control polygon: {-2 , 4.667, -4.667, 2}

7

p  C  u * , C '  u *  0

Point-Curve Projection – Example – cont. • Using a subdivision method, we isolate the roots of the polynomial and get:

t 0.1563 0.5000 0.8438

8

X -0.6875 0.0000 0.6875

Y 0.5273 1.0000 0.5273

Point-Curve Projection Additional Examples

9

Locations of Hausdorff Distance • The Hausdorff distance can occur at C1discontinuity points (end points)

• The Hausdorff distance can occur at antipodal points of the two curves

• The Hausdorff distance can occur when one curve intersects the bisector of the second curve 10

Case 1 • The Hausdorff distance can occur at two end points (one end point of each of the curves)

11

Case 2 • The Hausdorff distance can occur at the end point of one the curves and at an inner point of the

other curve C1  0   C2  v  , C2 '  v   0

C1 1  C2  v  , C2 '  v   0

C2  0   C1  v  , C1 '  v   0

C2 1  C1  v  , C1 '  v   0

v   0,1

12

Case 3 • The Hausdorff distance can occur at the two closest inner points C1  u   C2  v  , C 1 '  u   0 C1  u   C2  v  , C 2 '  v   0

13

u, v  0,1

Case 4 • The Hausdorff distance can occur at two inner points Ci  r   C j  t   Ci  r   C j  s   0 r , s, t   0,1 2

Ci  r   C j  s  , C i '  s   0 Ci  r   C j  t  , C j '  t   0

14

2

i, j  1, 2 i j

Computing the Hausdorff Distance: The Algebraic Root-Finding Method • Computing all of the roots of the non-linear equations of cases 2-4

• Finding the resulting solution from these roots and the end points as well C1  0   C2  v  , C2 '  v   0

C1 1  C2  v  , C2 '  v   0

C2  0   C1  v  , C1 '  v   0

C2 1  C1  v  , C1 '  v   0

v   0,1

C1  u   C2  v  , C 1 '  u   0 C1  u   C2  v  , C 2 '  v   0

Ci  r   C j  t   Ci  r   C j  s   0 r , s, t   0,1 2

Ci  r   C j  s  , C i '  s   0

15

Ci  r   C j  t  , C j '  t   0

2

i, j  1, 2 i j

u, v  0,1

Avoiding Solving Case 4 • Case 4 occurs only when the minimum distance occurs at one than more place

• Subdividing the given curves ensures only one place that the minimum distance will occur at

• Thus, the trivariate equation system of case 4 can be avoided 16

Improving the Computation • It can be seen that the Hausdorff distance can be computed by solving the one-sided problem

twice • The problem turns into a min/max point to curve

distance computation problem

17



DH  C1 , C2   max max min p  q , max min p  q pC1 qC2

qC2

pC1



Outline of Algorithm • First, utilize the elimination criteria in the geometric pruning method to prune the sub-intervals • Second, subdivide the given curves in the remaining sub-intervals • Termination conditions are also provided to speed up the process 18

General Geometric Pruning Method for Computing One-Sided Hausdorff Distnace • Given two curves C1(u) and C2(v), we want to compute the squared one-sided Hausdorff

distance from C1(u) to C2(v): H1  C1  u  , C2  v    max min S  u, v  u0,1 v0,1

• where S  u , v   C1  u   C2  v  , C1  u   C2  v  19

Properties used for Geometric Pruning • Property #1: S  u0 , v0   min S  u0 , v   v0,1    H1  C1  u  , C2  v    S  u0 , v0  S  u0 , v0   max S  u, v0   u 0,1 

• The case where the Hausdorff distance occurs at two end points is detected using this property

20

Properties used for Geometric Pruning – cont. • Property #2: u  0,1 : S  u, v0   min S  u, v   H1  C1  u  , C2  v    max S  u, v0  v0,1

u0,1

• Property #3: v  0,1 : S  u0 , v   max S  u, v   H1  C1  u  , C2  v    min S u0 , v  u0,1

v0,1

• The above properties detect the case where the Hausdorff distance occurs at one end point 21

Bounding for the Geometric Pruning • The geometric method need upper and lower bounds for elimination

• The bounds can be set as the minimum distances between the end points min S  u0 , v   H1  C1  u  , C2  v    max S  u, v0 

v0,1

22

u0,1

Bounding for the Geometric Pruning – Remark • We have

min S  u  v  , v   H1  C1  u  , C2  v    max S u, v u  

v0,1

u0,1

– Where u(v) and v(u) are functions in v and u – For the case of two Bezier Curves

u  v   v v u   u – In B-Spline Cases, u(v) and v(u) can be set as piecewise linear functions 23

min S  u0 , v   H1  C1  u  , C2  v    max S  u, v0 

v0,1

u0,1

Geometric Pruning – Subdivision • When all of the properties are not satisfied, the curve C1(u) should be divided to obtain:

 





H1  C1  u  , C2  v    max H1 C1L  u  , C2 , H1 C1R  u  , C2



• For each v, if the Hausdorff distance cannot occur

in the interval Li, then it can be eliminated

24

Elimination Criteria for the Case of Two B-Splines Curves • Given two B-Spline curves i j C1  u    PB u C v  Q B      j m  v  u, v  0,1 i n 2 i

j

– Bni  u  , Bmj  v  – m-th and n-th degree B-spline basis functions over the knot vectors: U  {0,...,0 , a2 , a3 ,..., an ,1,...,1} V  {0,...,0 , b2 , b3 ,..., bm ,1,...,1} n+1

n+1

• We obtain:

n1

m2

m+1

S  u, v    Dr ,k B2rn  u  B2km  v  25

r 0 k 0

m+1

Elimination Criteria for the Case of Two B-Splines Curves – cont. • Suppose the different knots in the knot vector U i u are m , i  0...l

• The interval [0,1] can be partitioned into l subintervals Li  umi , umi 1  , i  0...l  1

• The function S(u,v) can be represented in Bezier form as: 2n m S  u, v    Fri,k Bˆ2rn  ti  u   B2km  v  2

26

r 0 k 0

u  umi ti  u   i 1 um  umi

Elimination Criteria for the Case of Two B-Splines Curves – cont. • When the function S(u,v) is in the Bezier form in the sub-interval Li, we subdivide at the middle to  i i 1     u u , , u u obtain two new intervals:  m m   m m 

• Theorem: If Fri,k  F2inr ,k , r : 0,..., n  1| k  0,..., m2   i 1  u , u the Hausdorff distance occurs in  m m  and i   u , u the interval  m m  can be eliminated

27

Termination Conditions for the Subdivision Process • Let

d  u   min S  u, v  , u  0,1 v0,1

• Given a value of u, there exist a value of v such

that

d  u   S  u, v  u  

• When C1(u) & C2(v) are C1-continuous B-Spline

curves d(u) is also C1-continuous except for a finite number of locations 28

d  u   S  u, v  u  

C1  u   C2  v  u   , C2 '  v u    0

Termination Conditions for the Subdivision Process – cont. • If the derivative of v(u) exists, then d '  u   2 C1  u   C2  v  u   , C1 '  u   C2 '  v  u  ·v '  u   2 C1  u   C2  v  u   , C1 '  u 

• Otherwise: d '  u0   2 d '  u0   2 • Finally, we set:

C1  u0   C2  v1  , C1 '  u0  C1  u0   C2  v2  , C1 '  u0 



d '  u0   max d '_  u0  , d '+  u0  29

v1  v2



Termination Conditions for the Subdivision Process – cont. • From the following approximation formula: d  u   u   d  u   d '  u · u

• A trivial termination condition for a sub interval ut1 , ut2   0,1 could be simply set as: u u  2 t

30

1 t

2  ut2  ut1  d '   2 

Termination Conditions for the Subdivision Process – cont. • When the termination condition is satisfied, the Hausdorff distance can be approximated by the  ut1  ut2  minimum distance between the point C1   2  

and the curve C2(v)

ut2  ut1  31

2  ut2  ut1  d '   2 

Algorithm Steps 1.

Compute S(u,v) in B-Spline Form: n1

7.

m2

Subdivide the interval w1 into two subintervals and put the new pairs (S11, w11,

S  u, v    Dr ,k B2rn  u  B2km  v  r 0 k 0

2.

Put (S(u,v), L1, L2) into W

w21) & (S12, w12, w22) into set W ; return to

3.

If the set W is empty go to step 8

step 3

4.

Pop one element w = (S1, w1, w2) from set W

5.

8.

corresponding solution of case 3 in the

If S1 satisfies the elimination criteria, then go

region w1xw2 using the Newton-Raphson

back to step 3; otherwise go to step 6 If the length of w1 is small enough to satisfy

6.

the termination condition, put (S1, w1, w2) into y and rerun to step 3. Otherwise go to step 7

For each element w of set y, compute the

method

9.

Put the solution with the maximum distance and the place where the Hausdorff distance occurs as the resulting output C1  u   C2  v  , C 1 '  u   0

32

C1  u   C2  v  , C 2 '  v   0

u, v  0,1

Algorithm Results • For two cubic Bezier curves defined by the control polygons: – {(193, 226), (227, 230), (297, 134), (421, 135)} – {(258, 481), (294, 438), (302, 268), (435, 213)}

• The Hausdorff distance is 261.9 • The Hausdorff pair (0.0685, 0) 33