Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
13-17
TI Journals
ISSN:
xxxx-xxxx
www.tijournals.com
Habib Molaei
University Technology Gazi Tabatabaei, P.O Box 57169-33959, Urmia, Iran.
*Corresponding author: mj_msc@yahoo.com
Keywords
Abstract
Bezier curve
Quaternion
Rotation
Linear interpolation
Spherical linear interpolation1, introduced by Shoemake within the context of quaternion interpolation for
the purpose of animating 3D rotation. SLERP is a simple 3D animation technique that is handy for creating
smooth curves and rotations about the surface of a sphere. In this paper, after a brief review of some
algebraic properties of quaternions, we investigate the concepts of LERP, SLERP and Bezier curves in
Euclidean space. We consider the generalized quaternions instead of quaternions, and study the linear
interpolation on elliptical sphere in a generalized 3-space.
1.
Introduction
The quaternion was first introduced by William Rowan Hamilton as a successor to complex numbers. The quaternions have been used in various
areas of mathematics. They are hyper-complex, four-dimensional numbers used to replace rotation matrices. Shoemake [5] used the spherical
linear interpolation as a simple straightforward formula for the interpolation between two points on a sphere. It is called spherical-linear because
the two quaternion rotations are interpolated uniformly along a geodesic in the surface of the 3-sphere. The main topics of this paper are
quaternions, their mathematical properties, and how they can be used to rotate objects. Also, using the real quaternions, the linear interpolation
on a sphere is provided. The main foundation for this paper is the articles [1], [3]. Recently, the linear interpolation on Lorentzian sphere
Minkowski space using split quaternions is studied. In [4], the generalized quaternions are studied and it is demonstrated how a unit generalized
3
quaternion is used to represent a rotation of a vector in 3-dimensional space E
. Here, we present some alternative discussions like the
3
normalized linear interpolation using the generalized quaternions in E
.
2.
Preliminaries
In this section, we introduce quaternion mathematics and discuss why quaternions are a better choice for implementing rotation than the wellknown matrix implementations.
A real quaternion q is defined as
q a a1i a2 j a3k
where a , a1 , a2 and a3 are real numbers and 1, i , j , k of q may be interpreted as the four basic vectors of Cartesian set of coordinates;
and they satisfy the non-commutative multiplication rules
i 2 j 2 k 2 i j k 1,
ij k ji , jk = i = kj ,
and
A quaternion
q.
ki = j = ik .
may be defined as a pair ( S q , Vq ), where S q a R is scalar part and Vq a1i a2 j a3 k R 3 is the vector part of
and
is defined as
qp S q S p Vq , V p SqV p S pVq V p Vq
its components: N q a2 a12 a22 a32 , N q R. It can also be obtained by multiplying the quaternion by its conjugate ( q S q Vq ), in
where '' , '' and '' '' are the inner and vector products in
either order since a quaternion and of conjugated commute: N q q q q q . Every non-zero quaternion has a multiplicative inverse given by its
conjugate divided by its norm: q 1 q / N q . The quaternion algebra
1
Abbreviated SLERP
14
and
q, N pq N p N q ,
and the norm of every non-zero quaternion is non-zero (and positive) and therefore the multiplicative inverse exists
for any non-zero quaternion. Of course, as is well known, multiplication of quaternions is not commutative, so that in general for any two
quaternions
and q,
pq qp. This can have subtle ramifications, for example: ( pq ) 2 pq pq p 2q 2 . For detailed information about
3.
by an angle
2
2
2
2
M 2(a1a2 a0 a3 ) a0 a1 a2 a3
2(a2 a3 a0 a1 ) .
2(a1a3 a0 a2 )
2(a0 a1 a2 a3 ) a02 a12 a22 a32
M is a orthogonal matrix, then the map R (v ) corresponds to a rotation in E 3 . If we take the rotation axis to be S ( s1 , s2 , s3 ),
then we
have
M I 3 S sin (1 cos ) S 2 ,
where
S is a skew-symmetric matrix,
0
S s3
s2
For detailed information about rotation in
4.
s3
0
s1
s2
s1 .
0
Linear Interpolation
The easiest way to interpolate between two points is the use of linear interpolation (Lerp). Lerp is a basic geometric formula: given the startingand ending-points
p 0 and p1 and the interpolation parameter t 0,1 , Lerp ( p 0 , p1 , t ) yields for each t a point along the straight line
connecting them.
Lerp ( p 0 , p 1 , t ) (1 t ) p 0 t p 1.
So, linear interpolation generates unequal spacing of points after projecting to circle (Figure 1).
5.
Let
q , q1 be two real quaternions and h 0,1. Linear interpolation between rotation quaternions can be stated:
LERP (q 0 , q 1 , h ) (1 h )q 0 t q 1.
The interpolation curve for linear interpolation between quaternions gives a straight line in quaternion space. The curve therefore dips below the
surface of the unit sphere. Since all quaternions on a line through the origin give the same rotation, the curve can be projected on to the unit
sphere without changing the corresponding rotations. Therefore the interpolation curve is normalized (Figure 2).
15
6.
Spherical linear interpolation operation is best performed on quaternions to provide the smoothest interpolation between orientations.
SLERP is LERP, performed on the surface of a unit sphere. Let
p 0 and p1 be the first and last points of the arc, and let t be the parameter, 0
SLERP ( p 0 , p1 , t ) p 0 ( p 01 p1 )t
SLERP ( p 0 , p1 , t )
sin(1 t )
sin t
p0
p1.
sin
sin
The symmetry can be seen in the fact that SLERP(p0,p1 ;t) = SLERP(p1,p0;1t). In the limit as 0, this formula reduces to the
corresponding symmetric formula for linear interpolation,
SLERP ( p 0 , p1 , t ) (1 t ) p 0 t p1 .
7.
Geometric SLERP
The dot product between two vectors is only equivalent to the cosine of the angle if the two vectors are unit vectors. So the two vectors
where
cos v1 .v2 .
v1
and
is moving uniformly between the two vectors and its length remains one.
sin(1 t ) sin t
v (t )
v1
v2 ,
sin
sin
Unfortunately, spherical interpolation is not available on current graphics accelerators, only linear interpolation is
supported. When using linear interpolation this results in denormalized vectors (Figure 3) and wrong shading intensities [5].
8.
Bzier Curves
If there are only two points between to interpolate, we simply calculate SLERP(q0,q1 ;t). But what if we want to interpolate not two, but several
points on a sphere, i.e. three (qn-1, qn, and qn+1)?
16
We could interpolate first qn-1 and qn and afterwards qn and qn+1. We would get valid results, the algorithm would work. Unfortunately, we would
also remain with a non differentiable curve. To avoid this, Shoemaker suggests the use of the parametrized Bzier curves.
Bzier curves are parametric and always differentiable curves named after Pierre Bzier, who used them to design automobile bodies. The curves
are dependent on a number of parameters, three in a two-dimensional space and four in a three-dimensional environment.
We assume the three successive key quaternions qn-1 , qn , and qn+1 as given. To build a Bezier curve with them, we have to
1- compute two additional quaternion numbers, an, and bn,
2- draw a Bzier curve with the parameters qn, an, bn, and qn+1,
3- apply SLERP to the quaternions on this curve, computing the desired number of in between points,
4- and convert the data back into the original format.
To construct the quaternions a and b we approximate the derivative of a sampled function (with qn-1, qn, and qn+1 as samples) by averaging the
central differences between qn-1, qn, and qn+1. We do so using the formula Shoemaker:
Biscet( p , q )
pq
pq
Double( p , q ) 2( pq ) q p
an Biscet(Double( qn 1 , qn ), qn 1 )
bn Double( an , qn )
To construct the spherical Bzier curve with the quaternion parameters qn, an, bn, and qn+1, we compute
p0,0 qn ,
p1,0 an ,
p2,0 bn 1 ,
p3,0 qn 1 ,
9.
Conclusion
In computer graphics, Slerp in the context of quaternion interpolation for the purpose of animating 3D rotation. In this paper, we studied the
concepts of LERP, SLERP and Bezier curves in Euclidean space, completely. In the next work, we will study the linear interpolation on
elliptical sphere in 3-space
3
E
.
17
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
Dam E B, Koch M, Lillholm M, Quaternions, Interpolation and Animation, Technical Report DIKU-TR-98/5 Institute of computer Science University of
Copenhagen, Denmark, July 17, 1998.
Horn Berthold K.P., Some Notes on Unit Quaternions and Rotation, Copyright 2001.
Kremer V. E., Quaternions and SLERP, Embots.dfki.de/doc/seminar_ca /Kremer_Quaternions.pdf
Jafari M, Yayli Y, Generalized Quaternion and Rotation in 3-space arxiv.org/abs/1204.2476.
SLERP, http://en.wikipedia.org/wiki/Slerp
Shoemake K., Animating rotation with quaternion curves. ACM siggraph, 1985: 19(3) 245-254.
Ward, J.P., Quaternions and Cayley numbers algebra and applications, Kluwer Academic Publishers, London, 1997.