A Symbolic-Numeric Silhouette Algorithm

4 downloads 0 Views 217KB Size Report
We have revisited the silhouette algorithm developed by Canny, and ... ing the intersection points between the silhouette ... segment with the signs of all CS 0.
A Symbolic-Numeric Silhouette Algorithm Hirohisa Hirukawa

Bernard Mourrain and Yves Papegay

Electrotechnical Laboratory

INRIA Sophia-Antipolis

1-1-4 Umezono, Tsukuba

2004 route des Lucioles, B.P.93

305-8568 Japan

06902 Sophia Antipolis, Cedex, France

Abstract

We have revisited the silhouette algorithm developed by Canny, and designed its new symbolic-numeric version. The symbolic-numeric silhouette algorithm do not require the symbolic computation of the determinants of resultant matrices, and can work on oating point arithmetic. Though its combinatorial complexity remains the same, but its algebraic complexity has been improved signi cantly which is very important towards its implementation. Several numerical examples are also presented. 1

Introduction

The silhouette algorithm developed by Canny[1, 2, 4] is a general motion planning algorithm whose complexity is known to be the best within the general and complete algorithms. But no signi cant implementation of the algorithm has reported so far within our knowledge. We have revisited the silhouette algorithm to improve its algebraic complexity. A main bottleneck of the algorithm is the symbolic computation to nd the determinants of the resultant matrices which is necessary for the cylindrical decompositions of the silhouette curves[1]. In more details, the symbolic computation appears when the critical points of the silhouette curves are found. We have developed a bypass for the bottleneck. That is, the critical points of the silhouette curves can be found not by the symbolic computation of the resultants but by a numeric computation to nd zero dimensional solutions of equations. The key idea is nding the critical points from the tangent vector of the silhouette curve, instead of nding the explicit equation of the curve itself. We will discuss how much the bypass can improve the complexity with a support by experimental results. However, the employment of oating point arithmetic imposes a new diculty for nding the topology of the silhouette

curves because of numerical error. We also present a robust algorithm for the error to nd the topology. Another bottleneck of the algorithm exists in nding the intersection points between the silhouette curves and the C-surfaces[1]. Though the individual computation for nding the intersection points has smaller complexity, but the number of its iteration is larger. So it is important to reduce the individual complexity, and we propose to apply a symbolic-numeric algorithm developed by one of the authors[9] to nd the points. The proposed algorithm works on oating point arithmetic rather than exact arithmetic, and can nd the solutions of non-generic equations[5] by exploiting the properties of the pencil associated with the degenerate resultant matrices, instead of considering a perturbation of the equations[3] which often leads to larger matrices. The employment of the symbolic-numeric algorithm imposes another diculty as well as the topology issue. That is, it is not straightforward to nd the ordinal number of the curve segment robustly on which an intersection point lies when oating point arithmetic is employed, because the coordinates of the point now include numerical errors. We have developed a new algorithm to nd the ordinal number robustly based on a bidirectional cylindrical decomposition of the curves. This paper is organized as follows. In Section 2, we review the top level of the silhouette algorithm. In Section 3, the new algorithm for nding the critical points of the silhouette curves is presented with the algorithm to nd the topology of the curves, and the issue of the intersection points is described in detail with the new algorithm for nding the ordinal numbers of the curves. We conclude the paper in Section 4. 2

Silhouette algorithm

We review the top level of the silhouette algorithm [1, 2, 4] before breaking it down and re-design each

step of the algorithm.

3

Symbolic-numeric silhouette algorithm

Algorithm 2.1

1. for

i

= 1 0 1 do

3.1

;d

for each subset

R

silhouette curves

CF

of

s

s.t.

j j= R

i

We examine Step 1.(c)i of Algorithm 2.1. We rewrite = 0 to ( 1 2 1 1 1 ) = 0, where is the kth coordinate in the con guration space of the robot. With a slight abuse of notation, is also used to represent a polynomial which becomes zero on the critical curve of a hypersurface in the con guration space. Let ^ (^1 ^2 1 11 ^ ) = 0 be the image of ( 1 2 1 1 1 ) = 0 of a generic linear map 0 , where ^ is the i-th coordinate in the mapped space. Then the equations de ning a silhouette curve can be given by ^1(^1 ^2 1 1 1 ^ ) = 0 ^2(^1 ^2 1 1 1 ^ ) = 0 .. . (1) ^( 01)(^1 ^2 11 1 ^ ) = 0 In the original silhouette algorithm[1], the critical points of a silhouette curve is found by the following algorithm.

do

j

(a) M \r2R (j C S = 0 in r) (b) Check if the silhouette curve C = 6(a0 jM ) of the manifold M under a generic linear map a0 is empty. (c) If C is not an empty set i. Find the set P of the critical points a1 j6(a0 jM ) of the silhouette curve C . ii. Count the cardinal number of the curve segments in the intervals between all pairs of two consecutive critical points. iii. Find the topology of the curve segments. iv. Find all the intersection points of this curve with every surface C S = 0. v. Determine the curve segments on which the intersection points lie. vi. Label each intersection point and curve segment with the signs of all C S  0 and evaluate predicate CF s at the point. vii. Let the obtained curve be GM . viii. for each critical point p of P do A. Recursively call the procedure from (a) to (c) on the slice including p. B. Connect the graph on the slice to graph GM . 2. Construct the uni ed adjacency graph GM s obtained above. 3. Connect the initial con guration con guration F to graph G. 4. Search a path between

S

and

F

S

G

f

x ;x ;

; xd

;

f

x ;x ;

; xd

;

x ;x ;

; xd

:

1. Compute a resultant h(^x1 ; x^2 ) of Eqs.(1) after eliminating x^3 ; 11 1 ; x^d . 2. Compute the partial derivative @ h@(^xx^12; x^2 ) . 3. Compute the resultant S (^x1 ) of equations h(^ x1 ; x ^2 ) = 0 and @ h@(^xx^12;x^2 ) = 0. 4. Solve

.

(^1) = 0.

S x

5. Output the solutions.

As mentioned above, the bottleneck of Algorithm 3.1 is Step 1 which needs the symbolic computation to nd the determinants of the resultant matrices. The number of binary operations of the computation is ( 2 (12 2 )3 log ), where is the maximum degree of ^ and the maximum absolute value of any coecient of any ^ [1]. For examples, the number is (1019 log 3 ) for = 3 and = 3, and (1025 log 3 ) for = 4 and = 3. Consequently, it is unrealistic to execute Step 1 of Algorithm 3.1 when the d.o.f. of the robot, , is large. To bypass the bottleneck, we O d

d

r

fj

dw

r

w

fj

M

O

M

w

d

a

M

a

Algorithm 3.1

CS

a

; xd

; xd

f d

d

CS

xk

xi

Here, is the d.o.f. of the robot we consider, CF a predicate partly de ning a face in the con guration space of the robot, = 0 an equation de ning a hypersurface on which a boundary face of obstacles in the con guration space lies, the manifold de ned by the common roots of = 0s, 6( 0 j ) the critical set of a generic linear map 0 with its domain restricted to , and 1 a generic linear map to some axis. j

; xd

fj x ; x ;

and the nal

on graph

fj x ; x ;

fj x ; x ;

from

G

CS

fj

5. If a path is found then output the path else report NO PATH EXISTS.

j

Finding the critical points of the

a

d

2

d

r

r

O

w

algorithm to reduce the amount of the symbolic computation. In fact, ^(^1 ^2 11 1 ^ ) can be computed easily when is no less than 6. Then turning points are the real solutions of equations ^1 (^1 ^2 1 1 1 ^ ) = 0 ^2 (^1 ^2 1 1 1 ^ ) = 0 .. . (2) ^( 01) (^1 ^2 1 1 1 ^ ) = 0 ^(^1 ^2 1 1 1 ^ ) = 0 If we solve Eqs.(2) after nding an exact rational expression of a resultant polynomial, say Macaulay's, the number of the arithmetic operations can not be reduced. Instead, we propose to employ an algorithm developed by one of the authors[9] from the matrix methods[5], which can result in an eigenvector problem. The algorithm works on oating point arithmetic and can nd the solutions of non-generic equations[5] by exploiting the properties of the pencil associated with the degenerate resultant matrices, instead of considering a perturbation of the equations[3] which often leads to larger matrices. The complexity of the matrix method is (( )3 ) for nding the turning points and (( 2 )3 ) for the self-crossing points respectively[9], so (( 2 )3 ) in total, which has been improved from the original ( 2 (12 2)3 log ). For examples, the complexity is (1012 ) instead of (1019 ) for = 3 = 3, and (1016 ) instead of (1025 ) for = 4 = 3.

have developed a symbolic-numeric algorithm to nd the critical points. The key point of the bypass is how we can avoid to compute (^1 ^2 ) explicitly. There are two types of the critical points for a silhouette curve (^1 ^2) = 0. ^1 component of the tangent vector of the curve is zero at the points of the rst type, and the projected curve crosses with itself at those of the second type. We call the points of the rst type turning points, and those of the second self-crossing points. See Fig.1 for an example of the silhouette curve. There are four turning points and

g x ;x ;

h x ;x

; xd

d

h x ;x

x

f

x ;x ;

; xd

;

f

x ;x ;

; xd

;

f d

x ;x ;

g x ;x ;

Figure 1: Example of the silhouette curve

; xd

; xd

;

:

O

O

one self-crossing point on the curve. Turning points are easier to nd, because they are also turning points in the same sense on the curve in -space before the projection. On the other hand, self-crossing points of the projected curve are not self-crossing points of the curve in -space in general. So it is not necessary to project the curve for nding turning points, but some trick is required for nding self-crossing points without the projection. Turning points can be found by the condition that ^1 component of the tangent vector of the curve in -space is zero, which can be written by

e

r

O

O d

d

d

r

d

d

e r

d

dw

O

O

O

e r

d

O

d

;r

;r

Let us consider the intersection curve between two surfaces corresponding to a point contact between E1A and V1B and that between E2A and V4B , which appear in the motion planning problem of polygons in contact shown in Fig.2. See [8] to nd the de nition of the problem in more details. In the case,

Example 1

d

x

y

d

^(^1 ^2 1 1 1 ^ ) =

g x ;x ;

; xd



^ x ^1 ^ f2 x ^1

^ x ^2 f^2 x ^2

@ f1

@ f1

@

@

@ @

^ d01) ^

@ f(

@ @

.. .

^ d01) ^

@ f(

@ x1

@ x2

1

0

111 111 111 11 1

^ x ^d f^2 x ^d

@ f1 @ @ @

^ d01) ^d

@ f(

@ x

0

=

; xd d

4

V3A

V4A

0

A

:

VA 1

3

E2A A V2

1

B B VB 7 V4 V3

VB 8

x

VB 6 VB 1

B

B VB 5 V2

x

3

Figure 2: Example of two polygons

Note that ^(^1 ^2 1 1 1 ^ ) can be found by computing the determinant of a ( 0 1) 2 ( 0 1) matrix symbolically, which is much smaller than the resultant matrices to nd (^1 ^2 ). This is a key point of our new g x ;x ;

y

the silhouette curve is the intersection curve itself, and its projection onto x1 x2 -plane is shown in Fig.1. Let f^1 and f^2 be the images of the surfaces corresponding

d

h x ;x

3

to the point contacts by a generic linear map respectively, then

d

060000 ^21 0 24000 ^1 ^2 0 61750 ^1 ^3 + 57600 ^22 078600 ^2 ^3 + 2400 ^23 0 37500 ^1 + 33125 ^2 + 60000 ^3 2 2 2 3 +13500 ^1 0 33525 ^ 1 ^2 + 7200 ^1 ^3 + 27720 ^1 ^2 2 3 2 013920 ^1 ^2 ^3 0 30720 ^1 ^3 0 7632 ^2 + 6528 ^2 ^3 3 +23296 ^2 ^2 3 0 24576 ^ 3 ) = 0 1 ^2 = 1 + (231250 ^ 1 0 285000 ^2 + 301875 ^3 0 39375 ^2 1 78125 3 2 2 2 +59250 ^1 ^2 0 22200 ^ 2 0 7200 ^1 ^2 0 23040 ^1 ^2 + 18000 ^1 2 3 +13824 ^2 0 37296 ^ 2 ^3 0 204000 ^1 ^3 + 159200 ^2 ^3 2 0172800 ^3 + 37725 ^21 ^3 + 19040 ^1 ^23 + 25728 ^2 ^23 0 768 ^33 ^1 f

=

1

78125 x

(

x

x

x

x

x

x

x

x

x

x

x

x

x

f

x

x

x

x

x x

x

x x

x x

x

x

x

x

x

x

;

x

x

x

x

x x

x x

x

x

x x

x

x

x

x

x

x

x

x

x

x

x

x

x

which are 2( 0 1) equations in 2( 0 1) variables. Intuitively, the condition is easier to understand in the original space before a generic linear map. That is, the condition can be written by 1( 1 2 3 1 1 1 ) = 0 .. . ( 01)( 1 2 3 1 1 1 ) = 0 0 0 0 0 (5) 1( 1 2 3 1 1 1 ) = 0 .. . 0 0 0 0 ( 01)( 1 2 3 1 1 1 ) = 0

x

+16440 x ^1 x ^2 x ^3 ) = 0;

d

f

x ;x ;x ;

f d f

; xd

x ;x ;x ;

x ;x ;x ;

f d

;

; xd

;

; xd

x ;x ;x ;

;

; xd

;

d X

0 011250000 ^1 + 6500000 ^2 0 13875000 ^3 a 1 (x 0 x ) = 0 1953125 =1 0345600 ^21 ^2 ^3 + 1620000 ^31 0 1405440 ^32 + 693750 ^21 X 02985000 ^1 ^2 + 1944000 ^22 0 4788000 ^21 ^2 + 4550400 ^1 ^22 0 a 2 (x 0 x ) = 0 3 2 2 4 4 0388125 ^1 + 186624 ^2 + 129600 ^1 ^2 0 501120 ^1 ^2 =1 2 2 3 +567000 ^1 ^2 + 8671875 + 2004480 ^1 ^2 ^3 0 2672640 ^1 ^2 ^3 where a is the ij -element of the linear mapping ma09134400 ^1 ^2 ^3 + 3980000 ^1 ^3 0 5184000 ^2 ^3 g ^

1

=

(

x x x

x

x

x

x x

x

x

x

x x

x

x

k

k

k

k

k

k

k

x

x

x

x

x

d

x

x

k

x x x

x

x

x

x

x x

x

x

x

x

x

ij

x

2^ 2 2 ^ + 4089600 x 2 ^2 x ^1 x ^3 + 4421760 x ^1 x +3456000 x ^3 + 4509000 x 3 3 2 3 2 2 3 4295680 x ^2 x ^3 756000 x ^1 x ^3 + 230400 x ^1 x ^3 + 1187840 x ^1 x ^3 3 2 2 3 4 995328 x ^2 x ^3 + 1990656 x ^2 x ^3 1769472 x ^2 x ^3 + 589824 x ^3 +1198080 x ^3 ) = 0 ; 3

0 0

0

0

where the generic linear map is chosen to be 1 0 16 0 012 3 1 0 1 1 ^1 25 25 53 0512 A @ 2 A @ ^ 2 A = @ 96 125 125 03 96 25 16 ^3 3 125 125 25 Rounded solutions of the equations are x

x

x

x

x

x

:

(3)

(

02 6094 1 4227 2 2040) (0 81392 5 2790 0 033346) 0 36715 51582 2 2151) ( 93904 1 5540 55514) :

;

:

:

;:

;

:

;

;

:

;

:

;

:

;

:

;

:

:

;:

;

xk k

xk k

;

f

f d f

f d

; xd

x ;x ;x ;

x ;x ;x ;

; xd

x ;x ;x ;

d

xd

;

x

x

x

;d

0

x

96 125

x1

x

x

x

x

x

x

x

0

x

0

96 0 125

x

0

0

+

53 125

= 0;

;

0

0

0

x

x2

0

53 0 125

0

= 0;

x3 x 2

x

x

x1

x3 x2

x

x

0

0

0

;

=5 x3

0

x2

03

0 12 25

0

= 0;

=5 x3

x3

+

12 25

0

x3

= 0:

The isolated point of the variety after the generic linear map is given by (^1 ^2 ^3 ^01 ^02 ^03) = (0 264059 0 0247793 0 058732 0 264059 0 0247793 2 02797) Con rm that (^1 ^2 ^3 ) and (^01 ^02 ^03 ) have the identical (^1 ^2) but di erent ^3, which will be the self-crossing point of the silhouette curve in Fig.1. 2 x ;x ;x ;x ;x ;x

;

:

;

:

;

; xd

d

x x x

x x

;

; xd

xd

d

02 3 1 0 01 + 3 2 = 0 1 0 2 2 103 3 +6 3 0 10 3 1 02 0 21 02 3 1 0 01 + 3 2 = 0 0 2 21 103 3 +6 3 0 10 3 1 02 12 16 12 16 10 2+ 10 2+3 25 25 25 25

;d

x ;x ;x ;

;x

Let us consider the same curve in Example 1. In x1 x2 x3 space, Eqs.(5) can be given by 0 1 2

d

x

x ;

Example 2

;

which correspond to four turning points of the curve in Fig.1 respectively. 2 Let us examine how to nd self-crossing points of a silhouette curve. The curve in -space has the identical 1 and 2 coordinates and di erent , = 3 1 1 1 coordinates at a self-crossing point. Introducing extra variables ^0 = 3 1 1 1 , this geometric condition can be written algebraically by ^1 (^1 ^2 ^3 11 1 ^ ) = 0 .. . ^( 01) (^1 ^2 ^3 1 1 1 ^ ) = 0 ^1 (^1 ^2 ^03 11 1 ^0 ) = 0 (4) .. . ^( 01) (^1 ^2 ^03 1 1 1 ^0 ) = 0 x

x

x x

(^ x1 ; x ^2 ; x ^3 ) = (

trix, and the last two equations are the inner products of vector ( 01 0 1 1 1 1 0 0 ) and the direction vectors of the rst and second coordinates of the mapping respectively. Though these are 2 equations in 2 variables in 1 2 3 1 1 1 space, but the last two equations are linear and do not increase the Bezout number of the equations. The solutions of Eqs.(4) and Eqs.(5) are the curve itself and the isolated self-crossing points when the curve is projected onto 1 2-plane. The matrix method[9] can nd the isolated point of algebraic varieties, not necessarily of dimension zero, so it can nd the self-crossing points.

;

x ;x ;x

x ;x

;

4

:

;

:

x ;x ;x

x

:

;

;

:

:

3.2

2. else if

Finding the topology of the curve segments

3. else

Step 1(c)ii. and iii. of Algorithm 2.1 can be implemented robustly by the following algorithm.

(i01) 6= N i then R

N

R

i P

N

N

2

01

i R

N

R(i01) + Ri

N

i P

N

The last case occurs when curve has a real selfcrossing point before the projection. must be trusted since s have been found at regular points of curve . We will use to implement Step 9(a) robustly as follows. Step 9(a) is not straightforward when is a turning point, because 1 may include a numerical error and then can be missed from the set of the intersection points or can be two distinct points. When is a turning point, Step 9(a) can be implemented robustly by the following algorithm. C

i P

N

Algorithm 3.2

i N R

i P

C

1. 2.

(^1 ^2 ) of the curve ( ) Self crossing points (^1 ^2 ) of the curve Turning points

T T S

4.

P

T

5.

P

Sorted

7. 8.

C

P

p

U nif yI denticalP oints T

3.

6.

x ;x

P

S P

S

in the x1 order

Middle points i tive points in P

R

S

NR

i

S

NP

^1 =

x

p

1 i

i

V

Algorithm 3.4

1 2 ) between consecu-

r ;r

1. Find the roots V i of f^1 = 0; f^2 = 0; x^1 = pi1

;f

;x

r

i

2.

P

=(

V

1 2 ) 2 P do i

p ;p

Intersection points between

C

and

i

V

T

P V

i

i

i

P

i

=

i

NP

0 1 then

i

i

x

V

i

x ;x ;x

x ;x

T

Return V V

S

x ;x

Algorithm 3.5

x ;x

x ;x

x

R

x

Algorithm 3.3

i

+

i

( ) At Step 3, is sorted according to the distance in ^2 coordinate though is the list of the roots in (^1 ^2 ^3 ) found at Step 1. This can be done robustly, because no heuristic threshold is necessary to specify which points are double roots thanks to the sorting. Note that we keep two distinct points corresponding to a self crossing point when the curve is projected. At Step 9(c), we must nd how two curve segments cross at a self crossing point, which can be done by the following algorithm. 4.

In Step 1, are the real roots of Eqs.(2) and (^1 ^2 ) coordinates are necessary at this point. In Step 2, the double roots of Eqs.(2) are uni ed, so only distinct points are set to . In Step 3, are the set of distinct (^1 ^2) of the real roots of Eqs.(5). That is, each (^1 ^2) is taken from every pair of real solutions of Eqs.(5) that have an identical (^1 ^2 ) and di erent ^3 . In Step 6, should include an arbitrary point smaller than the smallest critical point in 1 coordinate and an arbitrary point larger than the largest critical point to count the curve segments in the left and right open intervals. Step 8 can be implemented by the following algorithm.

P

= NPi + 1 then 0 two closest points to pi2

i

# of +

V

by the distance to pi2

p

10. for each V i do Connect V i to adjacent curve segments

1. If

i

V

i

V

i

V

V

else if

1 (b) V i Sorted V i by the x2 order (c) If P i is a self crossing point then Determine how two curve segments cross x

# of

i i

V

i

Sorted

i

V

3. If

C

i

i

i

f

i

^1 =

(

i

# of the roots of ^1 = 0 ^2 = 0 ^1 = 1 # of intersection points between and

9. for each critical point (a)

C

i

i

i

P

x ;x

[

N

is a self-crossing point then

i

NP

(^x1 ; x^2 ; x^3) coordinates of the lower point on the curve projected to a self crossing point.

1.

S

2.

S

3.

T

4.

T

L

(^x1 ; x^2 ; x^3) coordinates of the upper point on the curve projected to the same point. U

5. If

i

NR

5

L

U

r ^1 ( ) 2 r ^2 ( ) r ^1 ( ) 2 r ^2 ( ) ^1 1 0 then 0

X

T

L

f

S

f

S

L