Adv Comput Math (2013) 38:63–82 DOI 10.1007/s10444-011-9226-z
An interpolation scheme for designing rational rotation-minimizing camera motions Rida T. Farouki · Carlotta Giannelli · Alessandra Sestini
Received: 28 October 2010 / Accepted: 15 March 2011 / Published online: 23 September 2011 © Springer Science+Business Media, LLC 2011
Abstract When a moving (real or virtual) camera images a stationary object, the use of a rotation-minimizing directed frame (RMDF) to specify the camera orientation along its path yields the least apparent rotation of the image. The construction of such motions, using curves that possess rational RMDFs, is considered herein. In particular, the construction entails interpolation of initial/final camera positions and orientations, together with an initial motion direction. To achieve this, the camera path is described by a rational space curve that has a rational RMDF and interpolates the prescribed data. Numerical experiments are used to illustrate implementation of the method, and sufficient conditions on the two end frame orientations are derived, to ensure the existence of exactly one interpolant. By specifiying a sequence of discrete camera positions/orientations and an initial motion direction, the method can be used to construct general rotation-minimizing camera motions.
Communicated by Helmut Pottmann. R. T. Farouki (B) Department of Mechanical and Aerospace Engineering, University of California, Davis, CA 95616, USA e-mail:
[email protected] C. Giannelli Dipartimento di Sistemi e Informatica, Università degli Studi di Firenze, Viale Morgagni 65, 50134 Firenze, Italy e-mail:
[email protected] A. Sestini Dipartimento di Matematica “Ulisse Dini”, Università degli Studi di Firenze, Viale Morgagni 67a, 50134 Firenze, Italy e-mail:
[email protected] 64
R.T. Farouki et al.
Keywords Camera orientation · Directed frames · Rotation-minimizing frames · Angular velocity · Pythagorean curves · Quaternions · Interpolation
1 Introduction A directed frame (o(t), u(t), v(t)) along a space curve r(t) is an orthonormal basis for R3 such that o(t) = r(t)/|r(t)| is the unit polar vector, defining the direction from the origin to each curve point, while u(t), v(t) span the plane orthogonal to o(t)—the image plane in camera orientation control. Such a frame is said to be rotation-minimizing if its angular velocity ω(t) maintains a zero component along the polar vector o(t), i.e., o(t) · ω(t) ≡ 0. Rotationminimizing directed frames (RMDFs) were introduced in [7], motivated by the problem of controlling the orientation of a (real or virtual) camera about its optical axis, as it traverses a curved path, so as to incur the least apparent rotation of the object (fixed at the origin) being imaged.1 Rotation-minimizing adapted frames (RMAFs) have received much more attention than directed frames. For an adapted frame on a space curve, one frame vector coincides with the curve tangent, while the other two span the curve normal plane—the frame is rotation-minimizing if its angular velocity maintains a zero component along the curve tangent. RMAFs are useful in robotics, animation, spatial motion control, geometrical sweeping operations, etc. In particular, the possibility of constructing exact rational RMAFs on polynomial space curves [1, 6, 9, 11] is a promising new development. The focus of this paper is on the construction of rational space curves that have rational RMDFs, by interpolation of initial/final positions pi = di oi and p f = d f o f (where di , d f > 0) and directed frames (oi , ui , vi ) and (o f , u f , v f ). Now the theory of directed frames coincides [7] with that of adapted frames, applied to the anti-hodograph—i.e., indefinite integral—of the given curve. Correspondingly, polynomial curves with rational directed frames must be Pythagorean (P) curves [7], just as polynomial curves with rational adapted frames must be Pythagorean-hodograph (PH) curves [6, 9, 13]—since only P curves have rational unit polar vectors, and only PH curves have rational unit tangent vectors. These observations allow many results, established in the context of PH curves, to be carried over to P curves. In particular, the present study relies extensively on methods developed [10] in the context of motion interpolation using PH curves with rational RMAFs. The Hermite interpolation algorithm for polynomial PH curves that have rational RMAFs [10] is adapted herein to formulate an analogous Lagrange interpolation algorithm for polynomial P curves that have rational RMDFs. The algorithm in [10] constructs spatial rigid-body motions, specified as G1 PH quintic space curves with rational RMAFs. Its adaptation to the present context, however, yields spatial P quartics with rational RMDFs that are only
1 This
issue has not been addressed in prior camera motion studies—e.g., [4, 14].
Rational rotation-minimizing camera motions
65
G0 continuous. To achieve a G1 continuous scheme for rotation-minimizing camera motion, one might consider the full Hermite interpolation problem— i.e., interpolation of initial/final unit tangents ti , t f for the path, as well as initial/final positions and directed frames. To obtain sufficient degrees of freedom, however, this requires P curves of degree > 4. Now the condition for rational RMAFs on PH curves of degree n is equivalent to that for rational RMDFs on P curves of degree n − 1. Although sufficient-and-necessary conditions for rational RMAFs are now available [11] for PH curves of arbitrary degree, only degree 5 PH curves (analogous to degree 4 P curves) have thus far been characterized [6, 9] by simple coefficient constraints, amenable to constructive algorithms. As an alternative to constructing G1 spatial motions, we consider “semi1 G motions,” in which one of the two end-tangent interpolation constraints is relaxed, and we employ a rational (rather than polynomial) interpolant curve. The proposed scheme constructs a rational curve ρ(t) with a rational RMDF (o(t), u(t), v(t)) for t ∈ [ 0, 1 ], where o(t) = ρ(t)/|ρ(t)| is the unit polar vector, that satisfies the end-point interpolation conditions ρ(0) = di oi ,
(o(0), u(0), v(0)) = (oi , ui , vi ) ,
ρ(1) = d f o f ,
(o(1), u(1), v(1)) = (o f , u f , v f ) ,
ρ (0) = ti , |ρ (0)|
(1) (2)
where we assume that o f = oi . It is convenient to decompose ti in the form ti = ci fi + si oi ,
(3)
where fi · oi = 0, |fi | = 1, ci2 + si2 = 1, and ci > 0. The plan for this paper is as follows. After presenting an overall outline of the scheme in Section 2, the basic definitions and properties of polynomial Pythagorean curves that possess rational RMDFs are reviewed in Section 3. Section 4 then discusses construction of a quartic P curve r(t) with rational RMDF that interpolates the given end frames, in terms of which the rational polar indicatrix o(t) = r(t)/|r(t)| is determined in Section 5. The interpolant ρ(t) = ρ(t) o(t) is defined in Section 6 by scaling o(t) with a polynomial ρ(t) so as to interpolate the given end points and initial motion direction. Finally, Section 7 outlines the algorithm for constructing camera motion interpolants, Section 8 presents some computed examples, and Section 9 summarizes the key results of this paper and suggests topics for further study. The Appendix contains some rather technical results that are used in the body of the paper.
2 General procedure For a space curve satisfying r(t) = 0 for t ∈ [ 0, 1 ] the polar vector o(t) = r(t)/|r(t)| defines a curve on the unit sphere—the polar indicatrix of r(t). Now the variation of the RMDF along r(t) depends only on o(t), not on the polar
66
R.T. Farouki et al.
distance |r(t)| from the origin. Hence, for a given polar indicatrix o(t) and any polynomial ρ(t) that is positive on [ 0, 1 ], the curves defined by ρ(t) = ρ(t) o(t)
(4)
have identical RMDFs. The polynomial ρ(t) can be used to specify the polar distance of ρ(t) from the origin, without altering its RMDF. In view of this, we employ the following procedure to construct the desired interpolant ρ(t). 1. Compute a P curve r(t) of degree ≤ 4 (see Section 4) with a rational RMDF satisfying r(t) = 0 for t ∈ [ 0, 1 ] such that r(0) = oi ,
r(1) = λ o f ,
(5)
(o(0), u(0), v(0)) = (oi , ui , vi ) , (o(1), u(1), v(1)) = (o f , u f , v f ) ,
(6)
r (0) = μ fi ,
(7)
where λ and μ are positive free parameters, and (o(t), u(t), v(t)) is the rational RMDF associated with r(t); 2. define the associated rational polar indicatrix o(t) = r(t)/|r(t)| on the unit sphere—see Section 5; 3. define the interpolant to conditions (1)–(2) by (4) with rational RMDF (o(t), u(t), v(t)) by computing a suitable polynomial ρ(t), positive for t ∈ [ 0, 1 ]—see Section 6.
3 Polynomial curves with rational RMDF The distinctive property of a polynomial Pythagorean (P) curve r(t) is that its polar distance |r(t)| is a polynomial in the curve parameter t. Since this is equivalent to the requirement that its anti-hodograph is a PH curve, a P curve can be generated [7] by a quaternion product of the form r(t) = A(t) i A∗ (t) ,
(8)
where A(t) = u(t) + v(t) i + p(t) j + q(t) k is a quaternion polynomial of degree m for a P curve of degree n = 2m, and A∗ (t) = u(t) − v(t) i − p(t) j − q(t) k is its conjugate.2 To obtain sufficient degrees of freedom, we focus on the case deg(A(t)) = 2—i.e., quartic P curves defined by substituting a quadratic quaternion polynomial A(t) = A0 (1 − t)2 + A1 2 (1 − t) t + A2 t2
(9)
scalar and vector parts of a quaternion A = (a, a) are denoted by a = scal(A) and a = vect(A)—see Chapter 5 of [5] for an appropriate review of the quaternion algebra.
2 The
Rational rotation-minimizing camera motions
into (8). The control points pi = xi i + yi j + zi k of the Bézier form 4 4 (1 − t)4−i ti r(t) = pi i i=0
67
(10)
are then given by p0 = A0 i A∗0 , 1 A0 i A∗1 + A1 i A∗0 , 2 1 A0 i A∗2 + 4 A1 i A∗1 + A2 i A∗0 , p2 = 6 1 A1 i A∗2 + A2 i A∗1 , p3 = 2 p4 = A2 i A∗2 . p1 =
(11)
Remark 1 Rational curves on the unit sphere (or rational spherical curves) play an important role in geometric design, animation, motion planning, and related problems. By interpreting such a curve as a tangent indicatrix and augmenting it with a rational support function, for example, one can define rational PH space curves [12]. The P curves specified by (8) may be regarded as the numerators of such rational spherical curves. Now the set of P quartics that have rational RMDFs can be identified by analogy with the set of PH quintics that have rational RMAFs [7]. Namely, the curve (10) has a rational RMDF if and only if the quaternion coefficients of (9) satisfy [6] the vector constraint A1 i A∗1 = vect A2 i A∗0 . (12) By analogy with the analysis of rational RMAFs on PH quintics in [10], the rational RMDF on a P quartic satisfying this constraint can be defined as (o(t), u(t), v(t)) =
(B (t) i B ∗ (t), B (t) j B ∗ (t), B (t) k B ∗ (t)) , |B (t)|2
(13)
where B (t) = A(t)W ∗ (t), and the coefficients of W (t) = W0 (1 − t)2 + W1 2(1 − t)t + W2 t2
(14)
must be expressed in terms of A0 , A1 , A2 to capture the RMDF. One may, without loss of generality, set W0 = 1, and the initial RMDF at t = 0 is then coincident with the Euler–Rodrigues frame [2]. The remaining coefficients W1 , W2 have known expressions in terms of the Hopf map form of PH curves [9], which can be translated to the quaternion form as ∗ ∗ ∗ A0 A1 1,i A0 A1 1,i A1 A2 1,i W1 = and W2 = , 2 |A 0 | | A∗0 A1 1,i |2
68
R.T. Farouki et al.
where 1 (A − i A i) 2 denotes the quaternion obtained from A by deleting its j, k components—i.e., (A)1,i = u + v i if A = u + v i + p j + q k (note that the coefficients of (14) are just complex numbers if we identify i with the imaginary unit i). (A)1,i =
4 Quartic P curve with rational RMDF We begin by constructing a quartic P curve r(t) that interpolates the given data (5)–(7) and satisfies the condition (12) for existence of a rational RMDF. The rational polar indicatrix o(t) = r(t)/|r(t)| corresponding to r(t) then has the same rational RMDF as r(t)—see Section 5. Without loss of generality, we take (oi , ui , vi ) = (i, − j, − k) as the initial frame, and for brevity we set gi = i×fi .
(15)
Note that (i, fi , gi ) define a right-handed orthonormal basis. Conditions (5) and (7) then yield the quaternion equations A0 i A∗0 = i ,
A2 i A∗2 = λ o f ,
and 2(A1 − A0 ) i A∗0 + A0 i 2(A∗1 − A∗0 ) = μ fi , which reduces to 2 A0 i A∗1 + A1 i A∗0 = μ fi + 4 i .
(16)
(17)
The solutions of equations (16) can be expressed [8] in terms of free angular parameters φ0 and φ2 as √ A0 = i (cos φ0 + i sin φ0 ) , A2 = λ n2 (cos φ2 + i sin φ2 ) , (18) where n2 is the unit bisector of i and o f , defined by n2 =
of + i | of + i |
if o f = − i ,
n2 = j if o f = − i .
(19)
Note that n2 ×i = 0 if o f = i. For later use, we also observe that the unit bisector of i and oi = i is just n0 = i. Invoking the analogy between rational RMDFs on P curves and rational RMAFs on PH curves, the angles φ0 , φ2 can be determined as described in [10] to satisfy interpolation of the given end-frames (oi , ui , vi ) and (o f , u f , v f ). As noted in [10], this problem admits solutions for arbitrary end-frames when o f = i. In particular, there are four pairs of admissible (φ0 , φ2 ) values which— for the choice (oi , ui , vi ) = (i, − j, − k)—are of the form (0, β A ) ,
(π, π + β A ) ,
(0, β B ) ,
(π, π + β B ) .
The two possible differences φ2 − φ0 = β A and φ2 − φ0 = β B (corresponding to the first and last two cases above) are analyzed below, writing β to denote
Rational rotation-minimizing camera motions
69
β A or β B (see the Appendix for details of their computation). Furthermore, the analysis below shows that one can take φ0 = 0 without loss of generality, so there are only two alternatives for the P quartic interpolant. First, we note that A0 = ± i if φ0 = 0 or φ0 = π , and hence A0 i A∗1 + A1 i A∗0 = ± A1 − A∗1 = ± 2 vect(A1 ) , A0 i A∗2 + A2 i A∗0 = ± A2 − A∗2 = ± 2 vect(A2 ) . (20) We now impose the rational RMDF condition (12). Substituting the second relation above into (12) and using (18), we obtain √ A1 i A∗1 = ± vect(A2 ) = λ w , (21) with w = cos β n2 + sin β n2 ×i ,
(22)
where we use the fact that φ2 = β if φ0 = 0 and φ2 = β + π if φ0 = π . The solution of (21) may be expressed in terms of a free angular parameter φ1 as √ 4 A1 = λ |w| n1 (cos φ1 + i sin φ1 ) , (23) where n1 =
w + |w| i | w + |w| i |
is the unit bisector of i and w/|w|. Consequently, we have √ 4 vect(A1 ) = λ (cos φ1 w1 + sin φ1 w2 ) , where w1 =
|w| n1 ,
w2 =
|w| n1 ×i .
(24)
(25)
(26)
The following lemma shows that when o f = i, we have w = 0 and w×i = 0, so n1 and A1 are well-defined, and certain degenerate cases are avoided. Lemma 1 When o f = i, the vectors w, w×i, w1 , w2 , and gi ×(w1 ×w2 ) are all non-vanishing. Proof From (19) we observe that n2 and n2 × i are non-zero and linearly independent when o f = i, and expression (22) then implies that w = 0 for all β. Now if w × i = 0 with w = 0, we must have w = ζ i with ζ = 0. Setting w = ζ i in (22) and taking dot products with i and n2 gives cos β (i · n2 ) = ζ and cos β = ζ (i · n2 ), which together imply that (i · n2 )2 = 1. From (19) this is possible only if n2 = i, i.e., o f = i. Hence, w × i = 0 when o f = i. Now w1 = 0 implies that n1 = 0—i.e., w = − |w| i, since |w| = 0. This amounts to the case ζ = − |w| of the preceding argument, and is impossible when o f = i. Similarly, w2 = 0 implies that n1 × i = 0, and thus w × i = 0, which has been ruled out when o f = i. Finally, gi ×(w1 ×w2 ) = 0 implies that gi ×(n1 ×(n1 ×i)) = gi ×[ (i · n1 )n1 − i ] = 0. Since gi is orthogonal to i, this is
70
R.T. Farouki et al.
equivalent to i · [ (i · n1 )n1 − i ] = 0, i.e., (i · n1 )2 = 1. From (24), this corresponds to w = |w| i, contradicting w × i = 0 when o f = i.
Having solved (16), we turn to condition (17). Invoking the first relation in (20), this becomes μ ± vect(A1 ) = fi + i . (27) 4 From (15) we see that, since μ is a positive parameter, this is equivalent to vect(A1 ) · gi = 0 ,
± vect(A1 ) · i = 1 ,
(28)
and
μ = ± vect(A1 ) · fi > 0 . 4 Using (25), conditions (28) can be written as a pair of linear equations
0√ w1 · gi w2 · gi cos φ1 = 4 w1 · i w2 · i sin φ1 ±1/ λ
(29)
(30)
in cos φ1 , sin φ1 . Now from (26) we have w2 · i = 0. Also, from (24) and (26) we obtain w1 · i > 0 (since w1 · i = 0 implies that w = − |w| i which in turn implies w×i = 0, and this was ruled out in Lemma 1). Now Lemma 1 implies that the first of equations (30) is non-trivial, since w1 · gi = w2 · gi = 0 ⇒ gi = ζ w1 ×w2 for some ζ , contradicting the fact that gi ×(w1 ×w2 ) = 0. Thus, a solution of the system (30) exists if and only if w2 · gi = 0. Concerning this, we note from (26) that w2 · gi = 0 if and only if n1 · fi = 0, and from (24) this is possible if and only if w · fi = 0. Hence, the condition for the existence of a solution to (30) can be written as w · fi = 0 . Recalling that (i, fi , gi ) define a right-handed orthonormal basis, and using (19) and (22), this can be re-written when o f = − i as3 o f · fi cos β + o f · gi sin β = 0 ,
(31)
which always admits a solution β under the assumption that o f = ±i, since o f · gi = o f · fi = 0 is impossible because (i, fi , gi ) are orthonormal vectors. When (31) is satisfied, the unique solution to (30) can be written as 1 1 w1 · gi 1 cos φ1 = ± √ , sin φ1 = ∓ √ . (32) 4 4 w · i (w · λ 2 gi )(w1 · i) λ 1 The value of the positive parameter λ is then determined by requiring that cos2 φ1 + sin2 φ1 = 1, which gives
2 (w1 · gi )2 + (w2 · gi )2 λ = . (33) (w1 · i)2 (w2 · gi )2 3 In
the special case o f = − i, it becomes j · fi cos β + j · gi sin β = 0.
Rational rotation-minimizing camera motions
71
Now since the solutions (32) differ only in sign, if φ1 is the angle associated with (φ0 , φ2 ) = (0, β), the angle associated with (φ0 , φ2 ) = (π, π + β) is just π + φ1 . Also, since the values (φ0 , φ1 , φ2 ) = (π, π + φ1 , π + β) generate exactly the same curve as (0, φ1 , β) we may √ set φ0 = 0 without loss of generality. Finally, condition (29) becomes ± 4 λ (w1 · fi cos φ1 + w2 · fi sin φ1 ) > 0, and using (32) this is equivalent to μ (w1 · fi )(w2 · gi ) − (w2 · fi )(w1 · gi ) = > 0, 4 (w1 · i)(w2 · gi ) or (since i, fi , gi are mutually orthogonal unit vectors) (w1 ×w2 ) · i μ = > 0. 4 (w1 · i) (w2 · gi )
(34)
From (26) one can verify that the numerator of the above expression has the negative value − |w| |n1 ×i|2 (which can not vanish). Hence, since w1 · i > 0, this inequality becomes simply w2 · gi < 0, and from (15), (24), and (26) one can deduce that this is equivalent to w · fi > 0 , which, when o f = − i, can be re-written as4 o f · fi cos β + o f · gi sin β > 0 ,
(35)
which evidently reinforces (31). This can be regarded as a restriction on the final frame orientation (o f , u f , v f ), relative to the initial frame (oi , ui , vi ) = (i, − j, − k). In terms of the angle β∗ ∈ [0 , 2π ) uniquely defined by (o f · fi , o f · gi ) (sin β∗ , cos β∗ ) = , (36) (o f · fi )2 + (o f · gi )2 the inequality (35) can be written as (o f · fi )2 + (o f · gi )2 sin(β∗ + β) > 0, and hence it is satisfied when β ∈ (−β∗ , π − β∗ ) .
(37)
We now give sufficient conditions on the end frame orientations ensuring that (35) holds for exactly one of the values β A or β B . To state these conditions, we introduce [10] the vectors j0 , j2 and k0 , k2 defined by jr = 2(j · nr )nr − j ,
kr = 2(k · nr )nr − k
(38)
for r = 0, 2. These are simply the reflections of j and k in n0 , n2 . We also define [10] the parameter
and we set
4 In
δ = n0 · n2 ,
(39)
ηˆ = arg(δ + i 1 − δ 2 ) .
(40)
the special case o f = − i, it becomes j · fi cos β + j · gi sin β > 0.
72
R.T. Farouki et al.
Since it is rather technical, the proof of the following result is deferred to the Appendix (which also treats the special cases o f · fi = 0 and o f · gi = 0). Proposition 1 Suppose that o f · fi = 0 and o f · gi = 0, and let ηˆ be def ined by (40). Then if the inequalities (o f · fi )(o f · gi )(j2 · v f ) ≤ 0 ,
k2 · v f ≥ cos 2ηˆ
(41)
hold, exactly one of the two values β A , β B satisf ies (35). Conditions (41) on the final frame orientation in Proposition 1 correspond geometrically to requiring that the frame vector v f should lie in one of two half-spaces, defined by the intersection of the volumes bounded by the plane orthogonal to j2 , and the cone with axis k2 and half-angle 2η. ˆ Note also that the conditions of Proposition 1 become more stringent when δ ≈ 1, i.e., when o f approaches oi = i, since then ηˆ ≈ 0. Finally, a significant case in which the assumptions of this proposition hold is when o f · fi = 0 and u f = j2 , v f = k2 since we then have5 k2 · v f = 1 and j2 · v f = 0. Finally, to ensure a well-defined polar indicatrix o(t) = r(t)/|r(t)| on the unit sphere from r(t), we verify that |r(t)| = 0 for t ∈ [ 0, 1 ] as follows. Proposition 2 r(t) = 0 for t ∈ [ 0, 1 ] when i = o f . Proof Since r(0) = i and r(1) = λ o f with λ > 0, we need only consider t ∈ (0, 1). Now |r(t)| = |A(t)|2 , so r(t) = 0 for t ∈ (0, 1) if and only if A(t) is nonvanishing on (0, 1). For (9) to vanish at some point t ∈ (0, 1) a positive value τ = (1 − t)/t must exist, such that 2A 1 = τ A 0 +
A2 . τ
Substituting into the rational RMDF constraint (12) and using A0 i A∗0 = i, A2 i A∗2 = λ o f , and (21) then gives √ 1 τ2 λ w = (42) √ i + 2 of . 2 τ λ Now from (19) n2 ×i = 0 when o f = i, and (22) then implies that w depends linearly on i and o f only when β = 0 or π . Thus (42) cannot be satisfied in the general case. In the special√ cases √ β = 0 or π , we have w = ±n2 from (22), and it is also necessary that τ 2 / λ = λ/τ 2 —i.e., λ = τ 4 —for (42) to be satisfied. However, this implies that w = 12 (i + o f ), which is incompatible with the case
this case, since ui = j0 = − j and vi = k0 = − k, the initial and final frames are obtained by reflecting i, j, k in n0 = i and n2 , respectively.
5 In
Rational rotation-minimizing camera motions
73
β = π . In the case β = 0, we must have | i + o f | = 2, and this is impossible if i = of .
5 Interpolation on the unit sphere Based on the analysis of the previous section, the polar indicatrix of r(t) on the unit sphere can be defined as o(t) = r(t)/|r(t)|. As noted in Section 2, the previously defined RMDF (o(t), u(t), v(t)) for r(t) is also an RMF for o(t), and it is such that conditions (6) hold. In addition, since o (t) =
r (t) − (o(t) · r (t)) o(t) , |r(t)|
we see that o (0) = r (0) = μ fi ,
(43)
μ being the positive constant defined in (34), and fi the unit vector orthogonal to oi defined by (3). The following summarizes the procedure for computing at most 2 curves o(t) on the unit sphere, satisfying the prescribed interpolation conditions. input: (oi , ui , vi ) = (i, − j, − k), (o f , u f , v f ), fi 1. set gi = i×fi and define n2 through (19); 2. end-frame interpolation: determine the two admissible values β A , β B for β = φ2 − φ0 as outlined in the Appendix—see also [10]; 3. for each β value, set φ0 = 0 and φ2 = β and proceed as follows: (a) define the vectors w and n1 by expressions (22) and (24); (b) define the vectors w1 and w2 through expressions (26); (c) if the inequality (35) is not satisfied, return to step 3 and choose the other β value; (d) determine the quaternion coefficients A0 , A2 from (18); (e) determine the parameter λ from (33); (f) determine the angle φ1 from (32); (g) compute the quaternion coefficient A1 from (23); (h) compute the Bézier control points p0 , . . . , p4 from (11); (i) determine the quartic P curve r(t) from (10) and its associated rational RMDF (o(t), u(t), v(t)) from (13); (j) define the polar indicatrix o(t) = r(t)/|r(t)|. output: at most 2 curves o(t) on the unit sphere with associated rational RMDFs (o(t), u(t), v(t)) that satisfy (6) and (43). When two curves o(t) exist, a suitable shape measure may be invoked to select a preferred solution among them—for example, one might prefer the
74
R.T. Farouki et al.
solution with the least (maximum or root-mean-square) deviation from the great-circle arc connecting the end-points oi and o f . 6 End-point/tangent interpolation As noted in Section 2, any curve defined as ρ(t) = ρ(t) o(t) with ρ(t) = 0 has the same RMDF as o(t). If the curve o(t) on the unit sphere is computed as described above, ρ(t) will interpolate the prescribed initial/final frames. In general ρ(t) will be a rational curve whenever ρ(t) is a rational function. For simplicity, we consider here the case where ρ(t) is a polynomial of degree k ≥ 2, expressed in Bernstein form as k k ρ(t) = ρi (1 − t)k−i ti . (44) i i=0 The end-point conditions ρ(0) = di oi , ρ(1) = d f o f are then satisfied with ρ0 = di ,
ρk = d f ,
(45)
while the coefficient ρ1 is used to satisfy interpolation of the initial tangent ρ (0)/|ρ (0)| = ti , decomposed as in (3). Since ρ (t) = ρ (t)o(t) + ρ(t)o (t), and o (0) = μfi where μ is positive and specified by (34), we obtain ρ (0) = k(ρ1 − ρ0 )oi + ρ0 μfi , and one can then verify that the choice μsi ρ1 = ρ0 1 + (46) kci yields ρ (0)/|ρ (0)| = ti . We observe that it is always possible to choose k sufficiently large to ensure that ρ1 > 0. For k > 2, the remaining coefficients ρ2 , . . . , ρk−1 must be chosen to guarantee that ρ(t) = 0 for t ∈ [ 0, 1 ]. This can be acheieved, for example, through the simple default choice ρ2 = · · · = ρk−1 = d f .
(47)
7 Summary of algorithm We may summarize the entire procedure as follows. Algorithm input: pi = di oi , p f = d f o f , ti , and (oi , ui , vi ), (o f , u f , v f ) with oi = o f 1. transform the initial data by a spatial rotation that maps (oi , ui , vi ) to (i, − j, − k); 2. perform the decomposition (3) of ti , where ci > 0 and the unit vector fi is orthogonal to oi ; 3. end-frame interpolation: compute interpolants o(t) on the unit sphere (at most 2) and their associated rational RMDFs (o(t), u(t), v(t)) as described in Section 5;
Rational rotation-minimizing camera motions
75
4. compute the positive constant μ defined by expression (34); 5. end-point & tangent interpolation: assign ρ0 , . . . , ρk through (45)–(47), k ≥ 2 being the least integer such that ρ1 > 0, and define ρ(t) by (44); 6. define the interpolant ρ(t) = ρ(t) o(t) and its associated rational RMDF (o(t), u(t), v(t)) by (13); 7. transform back to original coordinates by inverting step 1. output: at most 2 rational curves that satisfy ρ(t) = 0 for t ∈ [ 0, 1 ] with rational RMDFs (o(t), u(t), v(t)) that interpolate the given data.
8 Numerical experiments The initial frame (oi , ui , vi ) = (i, − j, − k) is used in Examples 1–3 below, in keeping with the conventions stated in Section 4. A cubic is required for the polynomial (44) in Example 1, but a quadratic suffices for the other cases. Example 4 illustrates the construction of a G1 “spline” motion. Example 1 The data to be interpolated in this case are specified as ti =
(−1, −2, 3) , √ 14
(o f , u f , v f ) = (j, − k, − i) ,
(di , d f ) = (3, 2) .
√ The unit bisectors of i with oi and o f are then n0 = i and n2 = (i + j)/ 2, and √ the quantity δ defined by (39) has the value 1/ 2. Hence, the parameter (40) is ηˆ = 14 π , and cos 2ηˆ = 0. Since, for the given data, we have o f · fi = − 0.554700 ,
o f · gi = − 0.832050 ,
j2 · v f = − 1 ,
k2 · v f = 0 ,
where j2 , k2 are defined by (38), the conditions of Proposition 1 are satisfied. The admissible values for the angular variables (φ0 , φ1 , φ2 ) are then (0.000000, 0.519146, 3.605240) or (π, 0.519146 + π, 3.605240 + π ) , while the parameter μ defined by (29) has the positive value μ = 10.301575. Figure 1 illustrates the steps involved in constructing the motion interpolant.
Example 2 In the second example we consider the data ti =
(1, −2, −3) , √ 14
of =
(−1, −2, −4) , √ 21
u f = j2 ,
v f = k2 ,
where j2 , k2 are defined by (38), and (di , d f ) = (1.5, 2.0). In this case o f · fi = 0.968364 ,
o f · gi = 0.121046 ,
j2 · v f = 0 ,
k2 · v f = 1 ,
76
R.T. Farouki et al. 1.5
1 2 0.5
1.5
0
0.5
z
y
1
0 −0.5
−0.5
−1 −1
−1
1 0 0 1 −1
−0.5
0 x
0.5
1
1.5
2
2
1.5
1.5
1
1
0.5
0.5
0
0
−0.5
−0.5
−1 −1
−1 2
y
z
z
−1.5 −1.5
x
−1 −1 1 0
1 0
0 1 y
0 1
−1 2
y
x
−1 2 x
Fig. 1 Construction of the interpolant in Example 1. Top left The polar indicatrix o(t) = r(t)/|r(t)| on the unit sphere, obtained from a P quartic r(t) with a rational RMDF that interpolates the data (5)–(7). Top right The rational space curve ρ(t) = ρ(t)o(t) with a rational RMDF interpolating the data (1)–(2), obtained by scaling o(t) by the polynomial (44). Bottom left The camera path together with the initial and final camera orientations. Bottom right Sampling of the camera motion along the constructed path, with orientation specified by the rational RMDF along ρ(t)
so Proposition 1 is again satisfied. The admissible (φ0 , φ1 , φ2 ) values are (0.000000, 0.124355, 0.000000) or (π, 0.124355 + π, π ) , and (29) is satisfied with μ = 1.935815. The interpolant is shown in Fig. 2.
Example 3 For this example, we use the initial tangent vector ti =
(1, −2, −3) , √ 14
Rational rotation-minimizing camera motions
77
1.5 2
1 0.5
1
z
z
0 −0.5 −1
0 −1
−1.5
1
0
0 1
−1
0 −1
0
−2 x
x
2
2
1
1
0
0
z
z
y
1
−2 −2
−1
−1
2
−3
y
−1 1
−2 −2
0 −1
0
−2 x
2
−3
1
−2 −2
0 −1
0
−2
y x
2
−3
y
Fig. 2 The interpolant in Example 2. Top left The polar indicatrix o(t) on the unit sphere. Top right The rational space curve ρ(t) = ρ(t)o(t) with a rational RMDF that interpolates the data (1)–(2). Bottom left The camera path, with initial and final camera orientations. Bottom right Sampling of the camera motion, with orientation specified by the rational RMDF on ρ(t)
the final frame specified by o f = (−0.963624, −0.148250, −0.222375) , u f = (−0.152057, 0.988372, 0.000000) , v f = (0.219789, 0.033814, −0.974961) , and the polar distances (di , d f ) = (1.5, 2.0). In this case o f · gi = 0, and one can verify that δ = 0.134863 and ηˆ = 1.435521 radians. Hence, the conditions of Proposition 3 (see the Appendix) are satisfied, and the admissible values for (φ0 , φ1 , φ2 ) are (0.000000, 5.188873, 1.094313) or
(π, 5.188873 + π, 1.094313 + π ) .
Correspondingly (29) is satisfied with μ = 8.193661. Figure 3 illustrates the resulting camera motion. Note that, in this case, the polar indicatrix o(t) is not a great circle arc on the unit sphere, even though the end points oi , o f and
78
R.T. Farouki et al. 1.5
1.5 1
1
0.5
z
z
0.5
0 − 0.5
0
−1 − 0.5
−1.5 1
−1 −1.5 −1.5
−1
−0.5
y 0 x
0.5
1
0 −1
−1
x
1.5
1.5
z
1
0
1.5
1
1
0.5
0.5
0
0
−0.5
−0.5
−1
−1
−1.5
−1.5 1
1 1
0 y
0 −1
−1
x
1
0
0 −1
−1
Fig. 3 Construction of camera motion in Example 3. Top left The polar indicatrix o(t) on the unit sphere. Top right Corresponding rational curve ρ(t) = ρ(t)o(t) with a rational RMDF, that interpolates the data (1)–(2). Bottom left The curve ρ(t) shown with initial and final camera orientations. Bottom right Sampling of the camera motion along the constructed path, with orientation specified by the rational RMDF along ρ(t)
initial tangent fi are coplanar, because the great circle arc does not admit a rational RMDF interpolating the prescribed end frames. Compared with Examples 1 and 2, the camera path in this example seems rather more convoluted, although its orientation is rotation-minimizing. In order to secure the rotation-minimizing property with residual freedoms that can be used to optimize the path geometry, it is necessary to use interpolants of higher order than the minimal-degree solutions adopted herein. Example 4 The final example is concerned with construction of a “spline” motion by interpolating discrete data sampled from the circular helix r(t) = (r cos θ, r sin θ, kθ) with r = 2, k = 1. Four equidistant points on the intervals θ ∈ [ 0, 12 π ], θ ∈ [ 0, π ], and θ ∈ [ 0, 2π ] were used. The segment end points are defined by the sample points on the helix, and the initial tangent for the first segment coincides with that of the helix. To obtain a G1 motion, the initial
z
Rational rotation-minimizing camera motions 2
2
1.5
1.5
1
1
0.5
0.5
0 2
z
79
1
0
−1
−1
0
1
2
0 2
3
3
2.5
2.5
2
2
1.5
1.5
1
1
0.5
0.5
0 2
1
0
−1
−1
0
1
2
0 2
1
1
0
−1
0
1
2
−1
0
−1
0
1
2
−1
−1 0
1
6 6 5 5 4
z
4 3
3
2
2
1
1 0 2 1 0 −1 y
1 −1 0 x
2
0 2
1
0 −1
2
Fig. 4 G1 rational RMDF motion interpolants to data sampled at θ = 0, π/6, π/3, π/2 (top), θ = 0, π/3, 2π/3, π (middle), and θ = 0, 2π/3, 4π/3, 2π (bottom) from the circular helix in Example 4. The discrete data defining the motion interpolants is shown on the left, and the corresponding variation of camera orientation is indicated by a rectangular parallelepiped on the right
tangent for each subsequent segment coincides with the final tangent of the preceding segment. The frame orientations at the sample points are defined by the known (exact) variation of the RMDF on a circular helix: see Example 2 in [7]. Figure 4 illustrates the resulting G1 motion interpolants.
9 Closure A scheme for the design of rational rotation-minimizing camera motions, that guarantees the least apparent rotation of the object being imaged, has been developed. The method is based on translating the known characterization of rational rotation-minimizing adapted frames on space curves to the context of
80
R.T. Farouki et al.
directed frames (incorporating the unit polar vector, rather than the tangent, as a reference for the frame angular velocity). A motion segment is defined by initial/final camera positions, orientations, and an initial motion direction. In principle, such segments may be splined together to yield G1 motions interpolating a sequence of camera positions/orientations. However, as with the lowest-order “ordinary” splines (namely, C1 quadratics) that interpolate position data only, the resulting motion interpolants may not be sufficiently smooth for some applications. The interpolation of position/orientation data by higher-order curves with rational RMDFs, that provide a greater degree of shape flexibility, is therefore of considerable interest. The procedure described herein is based on using the lowest-degree curves with sufficient freedoms to interpolate the prescribed data, and conditions for the existence of solutions have been determined. Using curves of higher order should help to ensure existence of interpolants to arbitrary data, and provide residual freedoms for optimization purposes. This requires characterizations for rational RMDFs on higher-order curves than the P quartics. Acknowledgements The second author was partially supported through the Young Researchers Program in the Gruppo Nazionale per il Calcolo Scientifico (GNCS) of the Istituto Nazionale di Alta Matematica Francesco Severi (INdAM).
Appendix We now prove Proposition 1 in Section 4, which states sufficient conditions on the end frame orientations to ensure that one of the two admissible values β A , β B for the difference φ2 − φ0 satisfies the inequality (35). To clarify how these conditions arise, we recall the two-step procedure used in [10] to compute β so as to ensure interpolation of the end frames (see [10] for complete details). In the first step, the angle φ0 and another angle η are determined from the relations (sin 2φ0 , cos 2φ0 ) = (− j0 · vi , k0 · vi ) ,
(48)
(sin 2η, cos 2η) = (− j2 · v f , k2 · v f ) ,
(49)
the vectors j0 , j2 and k0 , k2 being defined by (38). Note that for (oi , ui , vi ) = (i, − j, − k) we have n0 = i, and hence (j0 , k0 ) = (− j, − k), (ui , vi ) = (j0 , k0 ) and φ0 = 0 or π . For the other angle η there are also two possibilities— η A ∈ [ 0, π ) and η B ∈ [ −π, 0), with η B = η A − π . In the second step β = φ2 − φ0 is determined by requiring [10] that
1 − (γ cos β + δ sin β)2 ζ 0 − cos β ζ 1 − sin β ζ 2 = φ0 − η , (50) arg where γ = i · (n2 × n0 ), δ is defined by (39), and we set ζ0 = δ + iγ ,
ζ1 = γ2 − 1 − iγδ ,
ζ 2 = γ δ + i (1 − δ 2 ) .
Rational rotation-minimizing camera motions
81
In the present context, n0 = i implies that γ = 0, and we can assume φ0 = 0 without loss of generality (as noted in Section 4), so (50) becomes
arg δ 1 − δ 2 sin2 β + cos β + i (1 − δ 2 ) sin β = η , (51) where η = η A or η B . Now as β varies from −π to +π , the complex value whose argument appears on the left in (51) executes a closed path in the complex plane that encircles the origin when |δ| < 1—which holds here since n0 = i, (19), and (39) imply that 0 ≤ δ < 1 when o f = oi . Consequently, (51) admits a unique solution for each value of the angle η on the right, and we shall henceforth denote by β A ∈ [ 0, π ) and β B ∈ [−π, 0) the solutions associated with η A and η B , respectively. We now prove Proposition 1, stating sufficient conditions on the data to guarantee the existence of exactly one rational curve with a rational RMDF interpolating the end-points, end-frames, and the initial tangent (1)–(2). In particular we show that, for the given data, exactly one of β A , β B satisfies (35). Proposition 1 addresses the generic case with o f · fi = 0 and o f · gi = 0, while the special cases o f · gi = 0 and o f · fi = 0 are treated in Propositions 3 and 4 below. It is convenient to express these results in terms of the angle ηˆ ∈ (0, 12 π ] defined by (40), equal to the right-hand side of (51) when β = 12 π . Note that, when β = − 12 π , the angle on the right in (51) is equal to −η. ˆ Proof of Proposition 1 Consider first the case o f · fi > 0 and o f · gi > 0. Then the angle (36) satisfies β ∗ ∈ 0, 12 π , and the inequality (35) holds if and only if β lies in the interval (−β∗ , π − β∗ ) specified in (37). Hence 0, 12 π ⊂ (−β∗ , π − β∗ ) and − π, − 21 π ∩ (−β∗ , π − β∗ ) = ∅. So it suffices to show that the conditions (41) imply that β A ∈ 0, 12 π and β B ∈ [ −π, − 21 π ]. Now from the definition (49) of η, the conditions (41) allow us to conclude that η A ∈ [ 0, ηˆ ] and η B ∈ [ −π, −π + ηˆ ] ⊆ [ −π, −ηˆ ]. Thus, it follows also that β A ∈ [ 0, 12 π ] and β B ∈ − π, − 21 π . The proofs for the other three possibilities, depending on the signs of o f · fi and o f · gi , are analogous.
Proposition 3 If o f · gi = 0 and ηˆ is def ined by (40), exactly one of the two values β A , β B satisf ies (35) when k2 · v f > cos 2ηˆ .
(52)
Proof Consider the case o f · fi > 0. Then the angle (36) is β ∗ = 12 π , and (−β ∗ , π − β ∗ ) = − 12 π, 12 π . Now from (49) and (52) we must have η A ∈ [ 0, η) ˆ or η A ∈ (π − η, ˆ π ]. If η A ∈ [ 0, η) ˆ then η B ∈ − π, −π + ηˆ ⊆ [ −π, −η), ˆ so β A ∈ [ 0, 12 π ) and β B ∈ − π, − 21 π . Then β A is admissible and β B is not. ˆ π ], then β B is By analogous arguments one can verify that, if η A ∈ (π − η, admissible and β A is not. The proof for the case o f · fi < 0 is similar.
The last result addresses the case o f · fi = 0, and shows that the method always produces one interpolant—except when v f = k2 (the inequality (31)
82
R.T. Farouki et al.
cannot hold in this case, since v f = k2 implies that η A = 0 and η B = −π , and consequently β A = 0 and β B = −π ). Proposition 4 If o f · fi = 0 and v f = k2 , exactly one of the two values β A , β B satisf ies (35). Proof In this case, the angle (36) is β ∗ = 0 when o f · gi > 0, and β∗ = π when o f · gi < 0. Now in general, β A ∈ [ 0, π ) and β B ∈ [ −π, 0). However, since v f = k2 , we have η A = 0 and η B = −π , which imply that β A ∈ (0, π ) and β B ∈ (−π, 0). Thus, exactly one of them belongs to the interval (37) identifying the angles β that satisfy (35).
References 1. Barton, M., Jüttler, B., Wang, W.: Construction of rational curves with rational rotationminimizing frames via Möbius transformations. In: Dæhlen, M., et al. (eds.) MMCS 2008. Lecture Notes in Computer Science 5862, pp. 15–25. Springer, Berlin (2010) 2. Choi, H.I., Han, C.Y.: Euler–Rodrigues frames on spatial Pythagorean–hodograph curves. Comput. Aided Geom. Des. 19, 603–620 (2002) 3. Choi, H.I., Lee, D.S., Moon, H.P.: Clifford algebra, spin representation, and rational parameterization of curves and surfaces. Adv. Comput. Math. 17, 5–48 (2002) 4. Christie, M., Machap, R., Normad, J.-M., Oliver, P., Pickering, J.: Virtual camera planning: a survey. In: Butz, A., et al. (eds.) Proceedings of Smart Graphics 2005. Lecture Notes in Computer Science 3638, pp. 40–52. Springer, Berlin (2005) 5. Farouki, R.T.: Pythagorean-Hodograph Curves: Algebra and Geometry Inseparable. Springer, Berlin (2008) 6. Farouki, R.T.: Quaternion and Hopf map characterizations for the existence of rational rotation-minimizing frames on quintic space curves. Adv. Comput. Math. 33, 331–348 (2010) 7. Farouki, R.T., Giannelli, C.: Spatial camera orientation control by rotation-minimizing directed frames. Comput. Anim. Virtual World 20, 457–472 (2009) 8. Farouki, R.T., Giannelli, C., Manni, C., Sestini, A.: Identification of spatial PH quintic Hermite interpolants with near-optimal shape measures. Comput. Aided Geom. Des. 25, 274–297 (2008) 9. Farouki, R.T., Giannelli, C., Manni, C., Sestini, A.: Quintic space curves with rational rotationminimizing frames. Comput. Aided Geom. Des. 26, 580–592 (2009) 10. Farouki, R.T., Giannelli, C., Manni, C., Sestini, A.: Design of rational rotation-minimizing rigid body motions by Hermite interpolation. Math. Comput. (2011). doi:10.1090/S00255718-2011-02519-6 11. Farouki, R.T., Sakkalis, T.: Rational rotation-minimizing frames on polynomial space curves of arbitrary degree. J. Symb. Comput. 45, 844–856 (2010) 12. Farouki, R.T., Sir, Z.: Rational Pythagorean–hodograph space curves. Comput. Aided Geom. Des. 28, 75–88 (2011) 13. Han, C.Y.: Nonexistence of rational rotation-minimizing frames on cubic curves. Comput. Aided Geom. Des. 25, 298–304 (2008) 14. Nieuwenhuisen, D., Overmars, M.H.: Motion planning for camera movements. In: Proceedings, IEEE International Conference on Robotics & Automation, New Orleans, LA, pp. 3870–3876 (2004)