Game Engine Architecture

(Ben Green) #1
175

Notice that the resultant interpolated quaternion had to be renormalized. This
is necessary because the LERP operation does not preserve a vector’s length
in general.
Geometrically, qLERP = LERP(qA , qB , β) is the quaternion whose orientation
lies β percent of the way from orientation A to orientation B, as shown (in two
dimensions for clarity) in Figure 4.22. Mathematically, the LERP operation re-
sults in a weighed average of the two quaternions, with weights (1 – β) and β
(notice that (1 – β) + β = 1).


4.4.5.1. Spherical Linear Interpolation


The problem with the LERP operation is that it does not take account of the
fact that quaternions are really points on a four-dimensional hypersphere. A
LERP eff ectively interpolates along a chord of the hypersphere, rather than
along the surface of the hypersphere itself. This leads to rotation animations
that do not have a constant angular speed when the parameter β is changing
at a constant rate. The rotation will appear slower at the end points and faster
in the middle of the animation.


LERP

(1 ) q q
q LERP(q ,q , )
(1 ) q q

(1 )
(1 )
normalize.
(1 )
(1 )

AB
AB
AB

Ax Bx T
Ay By
Az Bz
Aw Bw

qq
qq
qq
qq

−β +β
=β=
−β +β

⎛⎞⎡⎤−β +β
⎜⎟⎢⎥
⎜⎟⎢⎥−β +β
= ⎜⎟⎢⎥
⎜⎟⎢⎥−β +β
⎜⎟⎢⎥
⎜⎟⎜⎟⎢⎥−β +β
⎝⎠⎣⎦

qA ( β = 0)

qLER P= LERP(qA, qB, 0.4)

qB ( β = 1)

Figure 4.22. Linear interpolation (LERP) between quaternions qA and qB.


4.4. Quaternions

Free download pdf