CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2...

6

Click here to load reader

Transcript of CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2...

Page 1: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION

Vasily Volkov and Ling Li Curtin University of Technology, Perth, Australia <vasily><ling>@cs.curtin.edu.au

Abstract: We present a simple closed form solution for C2 smooth quaternion interpolation problem. In contrast to other methods, our approach does not rely on cubic B-spline blending functions which require solution of nonlinear tridiagonal system. Instead, we propose using C2 interpolatory (cardinal) basis. Our method outperforms all alternatives and, being explicit, is absolutely stable.

Key words: orientation, quaternions, interpolation, splines, blending functions.

1. INTRODUCTION

Orientation interpolation is an important problem in computer graphics, robotics and airspace craft navigation. In computer graphics it is used, for example, for camera control and key-frame animation.

Common representations of orientation1 are 3 × 3 orthogonal matrices � group SO(3) = {R: RTR = I, det(R) = 1} and unit quaternions � group S3 = {q: q ∈ R4, ||q|| = 1}. Quaternions are generally faster, intuitively easier and became a standard tool in computer graphics2. We use them throughout this paper.

Interpolation is the reconstruction of continuous function from discrete samples. Given n sample values qi ∈ S3 and knots ti ∈ R the function q: R → S3 such that q(ti) = qi is to be built. We are especially interested in the functions of class C2[t1,tn], i.e. functions having continuous second derivative. Second derivative in our case has meaning of angular acceleration for the motion along path q(t). In this paper we limit our attention to the uniform grid ti = i. Extension to non-uniform grid is straightforward.

Page 2: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

2 Vasily Volkov and Ling Li

Many interpolation methods can be written in the form of convolution:

∑=i

i itKctq );()( , (1)

where K (�;i): R → R is the spatially varying reconstruction kernel, often taken piecewise-polynomial in practice for the sake of simplicity and efficiency. When performing weighted averaging (1) in S3, we must take into account that this subset of R4 is not closed under linear superposition of its elements. In this case, equation (1) should be understood in different terms than sum of scaled vectors. A few appropriate methods were proposed3,4,5. They all are nonlinear and some are even iterative5.

Kernel K(t;i) determines the nature of solution q(t). If weighted averaging method is C∞, which is usually the case, then the solution completely inherits smoothness of the kernel. If K(t;i) is interpolating (often called cardinal), i.e. it satisfies Kronecker-delta property

⎩⎨⎧ =

==otherwise 0

for 1);(

jiijK ijδ , (2)

then it is enough to put ci = qi in (1) to ensure interpolation q(i) = qi. Otherwise, system of equations for ci should be solved. This is the case when smooth B-spline basis functions are used as reconstruction kernel4,5,6. Though for interpolation in Euclidean space the resulting system is linear and easily solved6, in S3 this system becomes non-linear and has to be solved iteratively5,7,8. These iterations do not necessary converge7.

In this paper we propose C2 smooth interpolating kernel for use in quaternion interpolation instead of B-spline basis. This kernel is introduced in the following chapter. Chapter 3 describes all relevant details on Kim-Kim-Shin method of weighted averaging in S3. Results and performance are presented in Chapter 4. Chapter 5 concludes this paper.

2. C2 INTERPOLATING KERNEL

Our goal is to find C2 continuous piecewise-polynomial functions K(t;i), which satisfy K(j;i) = δij for i,j =1..n. C2 piecewise-polynomial defined on knots 1, 2, �, n is the function equivalent to m-degree polynomial on every interval [j, j+1], j = 1..n�1:

∑=

−=≡m

k

kjikj jtaitKitK

0

, )();();( for t ∈ [j, j+1],

while the polynomials join in C2 continuous manner, i.e. the following relations must hold for j = 2..n�2:

);();(1 ijKijK jj =− , (3)

Page 3: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

Closed form solution for C2 orientation interpolation 3

Figure 1. Interpolating kernel K(t;i) built for 12 knots. Note the shift-invariance of the functions in the middle and their warp near the boundaries.

jtj

jtj itK

dtditK

dtd

==− = );();(1 , (4)

jt

jjt

j itKdtditK

dtd

==

− = );();( 2

2

12

2

. (5)

Equations (4) and (5) produce linear algebraic system for coefficients ak

i,j. Such system has to be solved when interpolating with C2 cubic splines6. It can be avoided introducing additional constraints onto kernel functions9. The first and second derivatives of K(t;i) are required to agree with its numerical estimations based on finite differences (which are, in turn, based on Taylor expansion):

2);1();1();( ijKijKitK

dtd

jt

−−+=

=

, (6)

);1();(2);1();(2

2

ijKijKijKitKdtd

jt

++−−==

, (7)

where the central difference in (6) is preferred to the one-sided in the favor of symmetry. Since the values of K(t;i) at knots are given in (2), equations (3), (6), (7) define six constraints on every Kj(t;i) for j = 2..n�2 and four on K1(t;i) and Kn-1(t;i). Hence, Kj(t;i) can be found as a quintic polynomial for j = 2..n�2 and as a cubic for j = 1 and j = n�1. Derivations are straightforward and can be easily done with pencil and paper. Resulting functions K(t;i) for i = 4..n�3 are shift-invariant and can be compactly represented as

⎪⎪⎩

⎪⎪⎨

≤<−+−+−

≤+−−+−

=+elsewhere. 0

21for ,418295.215.7 1for ,15.45.73

);( 2345

2345

sssssssssss

isiK

The resulting function set is illustrated on Fig. 1. These functions have two important hereinafter properties. First, the support of K(t;i), i.e. the closure of the set where it is nonzero, is finite and short � it is [i�2,i+2] ∩ [1,n]. Also, these functions form a partition of unity on [1,n], i.e.

Page 4: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

4 Vasily Volkov and Ling Li

∑=

≡n

i

itK1

1);( for every t ∈ [1,n].

3. WEIGHTED AVERAGING IN S3

Given unit quaternions qi ∈ S3 and weights K(t;i) ∈ R for i=1..n, the following closed form for C∞ weighted averaging of quaternions is proposed by Kim et al.4:

∏=

−−=

n

i

tBii

tB iqqqtq2

)(11

)(1 )()( 1 , (8)

∑=

=n

iji jtKtB );()( . (9)

Bi(t) is called by the authors as cumulative basis. Quaternion is raised to power as qt = exp (t log q), where the logarithm and exponent are:

),0()sin,log(coslog θθθ vv ==q and )sin,(cos),0exp( θθθ vv = .

Here the representation of quaternions in the form q = (cos θ, v sin θ), θ ∈ R, v ∈ R3, ||v|| = 1 was used. To make the logarithm function unambiguous, multi-valued θ is restricted to the interval of [0,π], where it is unique.

As was mentioned in the previous chapter, K(t;i) is a partition of unity and has support not wider than [i�2; i+2], hence

For ⎡ ⎤ 2+≥ ti : 0);()( ==∑=

n

iji jtKtB and

For ⎣ ⎦ 1−≤ ti : 1);()( ==∑=

n

iji jtKtB .

Therefore, for t ∈ [i, i+1], 2 ≤ i ≤ n�2, equations (8) and (9) shrink to )(

211

)(1

1)(111

21 )()()()( tBii

tBii

tBiii

iii qqqqqqqtq +++

−++

−−−−= ,

∑+

+=+ =

2

);()(i

kijki jtKtB . (10)

For these values of i, formula (10) results in (here t = i + s, s ∈ [0, 1]): 15.05.05.15.2)( 2345 ++−−+−= ssssstBi ,

ssssstBi 5.05.0352)( 23451 +++−=+ ,

3452 5.15.2)( ssstBi −+−=+ .

Page 5: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

Closed form solution for C2 orientation interpolation 5

Figure 2. The cumulative basis for our C2 interpolating kernel.

Explicit expressions of Bi(t) for i = 1 and i = n � 1 are even shorter. Fig.2 illustrates the resulting cumulative basis.

4. RESULTS

Our implementation generates N = 1,000,000 interpolated points for n = 10,000 random input samples in 1.57 sec on 2.8 GHz Pentium 4. It is equivalent to ~1.6µs per interpolated point. Same implementation has shown performance of 3.1µs/point on 900MHz Pentium III. Fig. 3 demonstrates an example of the generated quaternion curves. Our method outperforms all known to us alternatives where performance is reported. Buss and Fillmore5 report of at least 80µ on Pentium II 400MHz per interpolated point. Alexa10 report of 3µ on 1GHz Athlon PC for calculating matrix exponent only, which is required for the generation of a single interpolated point. Moreover, his method generates poor curves, since it is based on global linearization. We expect that methods of Kang, Park and Ravani11,12 have performance of the same order as our method, but their approaches have preprocessing steps and, unlike our method, are not local, i.e. adjustment of a single input sample affects entire curve.

Among the drawbacks of our approach is that it fails to be bi-invariant � reversing the input sample sequence results in different interpolating curve. Another drawback is that the derivatives at the terminals of the generated curve cannot be controlled, e.g. if one desires to make a �natural� spline.

5. CONCLUSION

We described an explicit method for C2 quaternion interpolation. It has no restrictions on input samples, does not require solving nonlinear system and has high performance. The method is based on the interpolatory piecewise polynomial basis, whose analytic derivation has been explained in

Page 6: CLOSED FORM SOLUTION FOR C2 ORIENTATION INTERPOLATION · PDF fileClosed form solution for C2 orientation interpolation 3 ... C. de Boor, A Practical Guide to Splines, ... ν-Quaternion

6 Vasily Volkov and Ling Li

detail. Drawbacks of our method are uncontrolled derivatives at the curve terminals and the lack of bi-invariance.

REFERENCES

1. M. L. Curtis, Matrix Groups (Springer-Verlag, 1984). 2. K. Schoemake, Animating rotation with quaternion curves, Proc. SIGGRAPH 85, pp.

245�254 (1985). 3. W. D. Curtis, A. L. Janin and K. Zikan, A Note on Averaging Quaternions. Proc. Virtual

Reality Annual International Symposium ’93, pp. 377�385 (1993). 4. M. J. Kim, M. S. Kim and S. Y. Shin, A general construction scheme for unit quaternion

curves with simple high order derivatives, Proc. SIGGRAPH 95, pp. 369�376 (1995). 5. S. R. Buss and J. P. Fillmore, Spherical averages and applications to spherical splines and

interpolation, ACM Trans. Graph., 20(2):95�126 (2001). 6. C. de Boor, A Practical Guide to Splines, Springer-Verlag (1978). 7. M. J. Kim, M. S. Kim and S. Y. Shin, A C2 continuous B-spline quaternion curve

intepolating a given sequence of solid orientations, Proc. Computer Animation ’95, pp. 72�81 (1995).

8. G. M. Nielson, ν-Quaternion splines for the smooth interpolation of orientations, IEEE Trans. Visualization and Computer Graphics, 10(2):224�229 (March/April 2004).

9. V. S. Ryabenkii, Introduction to Computational Mathematics, §3 (Fizmatlit, Moscow, 2000).

10. M. Alexa, Linear Combination of Transformations. Proc. SIGGRAPH 2002, pp. 380�387 (2002).

11. F. C. Park and B. Ravani, Smooth invariant interpolation of rotations, ACM Trans. on Graph., 16(3):277�295 (July 1997).

12. G. Kang and F. C. Park, Cubic spline algorithms for orientation interpolation, Int. J. Numer. Meth. Engng, 46(1): 45�64 (September 1999).

Figure 3. User edited orientation interpolation (right) and interpolation of 100 random orientations (projections on S2 are shown).