Professional Documents
Culture Documents
Interpolating Three-Dimensional Kinematic Data Using Quaternion Splines and Hermite Curves
Interpolating Three-Dimensional Kinematic Data Using Quaternion Splines and Hermite Curves
Journal of Biomechanical Engineering Copyright © 2005 by ASME APRIL 2005, Vol. 127 / 311
i2 = j2 = k2 = ijk = − 1 共1兲
bi = 共1 + b兲共1 − c兲Double共ai,qi兲 共5兲
Each quaternion is written as a unit vector and can be directly
where
calculated from HAM variables or 3 ⫻ 3 Euler rotation matrix.
The first component is a scaled rotation about the HAM, and the Double共qi,q j兲 = 2共qi•q j兲q j − qi
second is a three-dimensional combination of HAM angle and 共6兲
orientation qi + q j
Bisect共qi,q j兲 =
q = 关cos ,n sin 兴 共2兲 储qi + q j储
bias b controls on which side of the control point curvature be-
where n is the helical axis and is twice the angle of rotation
gins, and it can have a value from −1 to 1. Tension t, shown
about that axis. The algebraic properties of quaternions are well
below, controls how sharp the curve is and can have a value from
described by Eberly 关13兴.
−1 to 1. At a tension value of 1, the curve would be discontinuous
C1-Continuous Piecewise Quaternion Spline. In 1985, Shoe- because the changes in direction become abrupt. Continuity c con-
make 关14兴 proposed a method of interpolating quaternions based trols the continuity of the curve and, in this case, will always be 0
on 3D Bézier splines. His paper details a piecewise cubic spline to to preserve C1 continuity. Intuitively, it can be seen that the ten-
connect quaternion data points 共key frames兲, based on an iterative sion acts on the length of the tangent, reducing or lengthening
spherical linear interpolation 共slerp兲 technique 关14兴. Simple linear curves, while the bias tunes the orientation of the tangent. One
interpolation does not connect quaternions on a unit length arc. primary way in which this formulation differs from that used by
Spherical linear interpolation ensures the resulting quaternions are Eberly 关13兴 is that the placement of the tension allows for com-
unit length. Trigonometrically, the slerp equation is defined as pensation of nonconstant intervals.
关13兴 Larger than ideal key frame spacings tend to create undulating
curves in the interpolation. In a biological context, for example,
qisin关共1 − t兲兴 + qi+1sin共t兲 the interpolation algorithm must minimize the size of curves in a
q共t兲 = slerp共qi,qi+1 ;t兲 = 共3兲
sin motion to prevent bones from overlapping. We create a simple
correction factor for these undulations
or in vector notation
itotal
for 0 艋 t 艋 1 where q共0兲 = qi and q共1兲 = qi+1. The parameter t is
the fractional advance from qi to qi+1, and the path of q共t兲 traces Sactual
Cs = 共7兲
a route along the surface of the hypersphere. The function Sideal
slerp共qi , qi+1 ; t兲 is abbreviated by 共qn : qn+1兲t.
where S is arc length calculated from the magnitude of rotation
Using slerp still creates discontinuities at each key frame. To
each quaternion describes, i is the HAM rotation angle of the
create a smooth curve, control lines described by the outgoing
current key frame, and Cs is the correction ratio used to scale
tangent an and the incoming tangent bn−1 must be prescribed and
incoming and outgoing tangents, appropriately. Following from
a higher-order calculated curve 共Fig. 1兲.
Bézier curves, the magnitudes of these tangents are three times
Shoemake 关14兴 outlines a simple method to calculate each tan-
that of the segment itself. Unlike standard Bézier curves, this fac-
gent, ai and bi, then incorporate them into a cubic-order interpo-
tor corrects for interval length
冋 册
lation that assumes equally spaced key frames. Variable spacing
can be accommodated with changes to the calculations of each 共1 − t兲Cs
tangent. Building on his framework and extending the definition xi = slerp qi,xi, 共8兲
3
of Hermite curves, specifically so called TCB-splines 共see 关15兴 for
Cartesian derivation兲, into quaternion space, we are able to further where xi represents either the incoming 共bi兲 or outgoing 共ai兲 tan-
constrain the control tangents to accommodate nonconstant inter- gent, t is the tension described above, and Cs is the correction
vals as follows: factor from Eq. 共7兲.
Cyclic motions have tangents for all key frames, but tangents
ai = Bisect关共1 + b兲共1 − c兲Double共qi−1,共1 − b兲共1 + c兲qi兲,qi+1兴 cannot be calculated at the endpoints of unidirectional motions
冨 冨 冨 冨 冨冨
2 −2 1 1 x共0兲 t3 the gold standard, respectively. Four sets of randomly distributed
samples were selected containing between 4% and 20% of the
−3 3 −2 −1 x共1兲 t2 original samples 共Table 1兲. Simple linear and cubic interpolation,
H= C= T= 共13兲
0 0 1 0 x⬘共0兲 t applied componentwise, was performed on the 5s and 7s data sets.
1 0 0 0 x⬘共1兲 1 Accuracy Data Comparison. Test and gold standard data sets
The cubic equation to describe any point between xa and xb is were compared to assess the accuracy of the interpolation tech-
simply nique. Interpolated and gold standard values were time matched to
the original data set automatically by the interpolation scheme. An
x共t兲 = T · H · C 共14兲 rms error, the distance between each sensor’s original and inter-
Results Discussion
Accuracy Tests. Rms error magnitudes of less than 3% were The purpose of this work was to describe and test a new method
achieved using only one-tenth of the original number of samples. for interpolating 3D kinematic data and to compare it to simple
First, a comparison of data sets Constant 3 and Constant 6 showed interpolation methods. Linear interpolation and simple cubic
high accuracy with less than 1% error for all the cubic quaternion quaternion interpolation have been used in analysis of wrist kine-
splines and less than 2% for all methods. Variable sampling rate matic data 关19兴 for the same purposes as the cubic method pro-
data sets show a slight decrease in accuracy from the constant rate posed here. Generally, cubic interpolation is more computation-
sets at similar sampling rates. The 5s test data set 共4% of the total ally costly than linear interpolation and may be unnecessary for
number of samples兲 is not as accurate as the others yielding 1.8% certain applications, but linear interpolation can introduce unac-
displacement error when using the cubic quaternion spline. The ceptable error when applied to kinematic data. Simple cubic inter-
accuracy of angular HAM variables, rotation, and axis orientation, polation also discounts the dependencies of the rotational vari-
ables on each other and, as is shown, does not give as accurate
results as cubic quaternion interpolation. Although some portions
of the cubic quaternion curve have greater error than the simple
cubic spline, the overall accuracy of the curve is distinctly greater.
There are several current methods of interpolating 3D rigid
body kinematics employed in computer graphics research, such as
using Lie groups and Riemannian manifolds 关20兴, homogeneous
transforms 关21兴, or other methods 关10,11,22兴. These methods are
highly accurate and computationally intensive, however, because
of their design, the input requirements are rather strict. Key
frames must be evenly spaced throughout the motion, and some-
times the equation of motion or boundary conditions must be
specified 关10,23兴. The described combination of Hermite and cu-
bic quaternion splines provides an intuitive and computationally
easy approach to interpolation of unconstrained data, such as that
collected in vivo, without requiring any additional conditions. The
use of TCB-type splines enables the easy addition of an optimiz-
ing algorithm to further customize each curve.
When choosing an algorithm for kinematic interpolation, a few
factors can define how rigorous a method is needed. These factors,
in order of importance, are: 共i兲 How much and what type of data
is available? With decreasing numbers of data points, higher-order
Fig. 4 Components of and n over the test motion. The left
vertical axis shows the HAM orientation n broken into its com- and complexity algorithms may be required to create an accurate
ponents. The right vertical axis shows the HAM rotation . The interpolation. With information on the velocity and acceleration at
rotation tracks a steady pattern through the motion while the each data point, it may be possible to use a more complex method;
orientation changes dramatically at the beginning and end of however, with only rotation and translation data at each point, the
the samples. cubic quaternion method could be implemented. 共ii兲 What re-
Fig. 5 Displacement error in data set 7s. Distance between calculated sensor location and original sensor
location for three interpolation methods. The cubic quaternion spline mitigates the errors of the cubic spline
while maintaining continuity, unlike the linear interpolation. Key frames are located where the rms error is zero.
Sensor with the largest error is displayed.
vious segments. The error at these points in the interpolated mo- of the difference in HAM variables occurs in QL. The test QL
tion is similar to the extraneous curves seen when ⌬QL is not moved a maximum of 35 mm from its starting point with a total
minimized. Further analysis using varied magnitudes of QL dis- path of 247.8 mm traveled over the entire motion. In vivo mea-
placement and differences in tham may help identify the most im- surements of the wrist show that QL only travels a total of a few
portant factors in reducing error. millimeters over the entire motion 关19兴. The reduction in travel
This arbitrary test motion simulated flexion and extension mo- distance could greatly increase the accuracy of the interpolation
tion in form, but the kinematic transforms possessed very different technique. Future work will incorporate several test motions made
characteristics than those seen in kinematic data collected in vivo to more accurately simulate natural movements 共Fig. 7兲.
关18,19兴. Smaller changes in HAM location, seen in joints in vivo,
may increase the accuracy of the interpolation method simply by Conclusions
decreasing the distance between each QL. Predictions of accuracy
We have developed a method to spline unconstrained 3D rigid
based on the test data set are conservative compared to kinematics
body motion using smooth curves that can process both constant
showing tightly grouped HAMs. As seen in the error tables, much
sample rate and variable sample rate data without the need to
increase the complexity of the calculations. Comparison of the
cubic quaternion interpolation method to a known data set shows
that it can accurately calculate an object’s position and orientation
over a sequence of positions with only a minimum of information.
This may make trends in large subject populations easier to cor-
relate by using data at consistent locations, and scatter caused by
scanning misalignment can be drastically reduced. This method
can be applied to any research requiring reconstruction of a rigid
body motion path from a finite number of still motion samples
that does not need to or cannot collect the data necessary to con-
struct a more constrained interpolation, thereby expanding our
ability to study the complex motions so easily achieved by hu-
mans everyday.
Acknowledgment
Support from the National Institutes of Health Grant No.
Fig. 7 Example showing interpolated capitate. Scanned capi- AR44005 is gratefully acknowledged.
tate positions or key frames „colors… and interpolated positions
„gray… moving from extension „left… to flexion „right…. This
space is the motion envelope of this wrist bone and shows a References
full range of flexion extension using only these five frames. 关1兴 Andriacchi, T. P., Alexander, E. J., Toney, M. K., Dyrby, C., and Sum, J.,