This is not the document you are looking for? Use the search form below to find more!

Report

# A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

Document Description
In this paper, we give a beginners guide to the practicality of using dual-quaternions to represent the rotations and translations in character-based hierarchies. Quaternions have proven themselves in many fields of science and computing as providing an unambiguous, un-cumbersome, computationally efficient method of representing rotational information. We hope after reading this paper the reader will take a similar view on dual-quaternions. We explain how dual number theory can extend quaternions to dual-quaternions and how we can use them to represent rigid transforms (i.e., translations and rotations). Through a set of examples, we demonstrate exactly how dual-quaternions relate rotations and translations and compare them with traditional Euler’s angles in combination with Matrix concatenation. We give a clear-cut, step-by-step introduction to dual-quaternions, which is followed by a no-nonsense how-to approach on employing them in code. The reader, I believe, after reading this paper should be able to see how dual-quaternions can offer a straightforward solution of representing rigid transforms (e.g., in complex character hierarchies). We show how dual-quaternions propose a novel alternative to pure Euler-Matrix methods and how a hybrid system in combination with matrices results in a faster more reliable solution. We focus on demonstrating the enormous rewards of using dual-quaternions for rigid transforms and in particular their application in complex 3D character hierarchies.
File Details
Submitter
Embed Code:
Comment is disabled by submitter.
Related Documents

## 6) robotica mcgraw - hill - pic robotics a beginners guide to robotics projects using the pic micro(2)

by: csenger, 290 pages

6) robotica mcgraw - hill - pic robotics a beginners guide to robotics projects using the pic micro(2)

## SPIRIT OF BALI TOUR: BEGINNERS GUIDE TO BALINESE PRAYER, OFFERINGS, TEMPLES AND RELIGIOUS CEREMONIES

by: hanbal, 12 pages

BEGINNERS GUIDE TO BALINESE PRAYER, OFFERINGS, TEMPLES AND RELIGIOUS CEREMONIES

## A Beginners Guide To Piano & Keyboard

by: asapiano, 3 pages

A very easy to follow guide to piano and keyboard covering all the essentials for a beginner.

## A Comprehensive Guide to Farmville v0.5

by: manualzon, 5 pages

user guide of A Comprehensive Guide to Farmville v0.5.pdf a game which is available in facebook, this guide also informs how to cheat farmville

## A Basic Guide to Owning and and Financing Luxury Private Jet and Helicopter in India

by: empowerhosting, 12 pages

Finance or aviation

## A Friendly Guide To Sparse Coding

by: yesse, 22 pages

A Friendly Guide To Sparse Coding

## Speed ratings - what they are and how to use them to make profit from horse racing

by: pirkko, 2 pages

Speed ratings - what they are and how to use them to make profit from horse racing

## Just Buy My Damn Music: A Rockstar Guide To Participating in Social Media Without Actually Being Engaged.

by: alina, 22 pages

Just Buy My Damn Music: A Rockstar Guide To Participating in Social Media Without Actually Being Engaged.

## Beginners Guide To Logical Framework Approach (BOND)

by: nayu, 8 pages

Beginners Guide To Logical Framework Approach (BOND)

## Fan Laws: What they are and examples on how to use them

by: henriette, 5 pages

Fan Laws: What they are and examples on how to use them

Content Preview
A Beginners Guide to Dual-Quaternions
What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

Ben Kenwright
School of Computing Science, Newcastle University
Newcastle Upon Tyne, United Kingdom
b.kenwright@ncl.ac.uk

ABSTRACT
In this paper, we give a beginners guide to the practicality of using dual-quaternions to represent the rotations
and translations in character-based hierarchies. Quaternions have proven themselves in many fields of science
and computing as providing an unambiguous, un-cumbersome, computationally efficient method of representing
rotational information. We hope after reading this paper the reader will take a similar view on dual-quaternions.
We explain how dual number theory can extend quaternions to dual-quaternions and how we can use them to
represent rigid transforms (i.e., translations and rotations). Through a set of examples, we demonstrate exactly
how dual-quaternions relate rotations and translations and compare them with traditional Euler's angles in
combination with Matrix concatenation. We give a clear-cut, step-by-step introduction to dual-quaternions,
which is followed by a no-nonsense how-to approach on employing them in code. The reader, I believe, after
reading this paper should be able to see how dual-quaternions can offer a straightforward solution of
representing rigid transforms (e.g., in complex character hierarchies). We show how dual-quaternions propose a
novel alternative to pure Euler-Matrix methods and how a hybrid system in combination with matrices results in
a faster more reliable solution. We focus on demonstrating the enormous rewards of using dual-quaternions for
rigid transforms and in particular their application in complex 3D character hierarchies.
Keywords
Dual-Quaternion, 3D, Real-Time, Character Hierarchies, Rigid Transformation
1. INTRODUCTION
Dual-quaternions are interesting and important
Real-time dynamic 3D character systems combine
because they cut down the volume of algebra. They
key framed animations, inverse kinematics (IK) and
make the solution more straightforward and robust.
physics-based models to produce controllable,
They allow us to unify the translation and rotation
responsive, realistic motions. The majority of
into a single state; instead of having to define
character-based systems use a skeleton hierarchical
separate vectors. While matrices offer a comparable
composition of rigid transforms. Each rigid
alternative to dual-quaternions, we argue that they
transform has six degrees of freedom (DOF) that
can be inefficient and cumbersome in comparison. In
consists of three translational and three rotational
fact, dual-quaternions give us a compact, un-
components. Matrices are the most popular method
ambiguous, singularity-free, and computational
of storing and combining these transforms. While
minimalistic rigid transform. In addition, dual-
quaternions have been shown to be the most efficient
better method? In this paper, we address the
and most compact form of representing rotation and
translation. Dual-quaternions can easily take the
proposing a novel alternative based on quaternions
place of matrices in hierarchies at no additional cost.
called dual-quaternions. The purpose of this paper is
For rigid transform hierarchies that combine and
to present a beginner's guide to dual-quaternions in
compare rigid transforms on a frame-by-frame bases
sufficient detail that the reader can begin to use them
(e.g., character inverse kinematics (IK) and joint
as a practical problem-solving tool for rigid character
constraints), alternative methods such as matrices
transforms. This paper covers the basics of dual-
need to be converted to quaternions to generate
quaternions and their application to complex
reliable contrast data; this can be done without any
hierarchical systems with many DOF.
conversion using dual-quaternions.
Many students have a great deal of trouble
Permission to make digital or hard copies of all or part of
understanding essentially what quaternions are and
this work for personal or classroom use is granted without
how they can represent rotation. So when the subject
fee provided that copies are not made or distributed for
of dual-quaternions is presented, it is usually not
profit or commercial advantage and that copies bear this
welcomed with open arms. Dual-quaternions are a
notice and the full citation on the first page. To copy
break from the norm (i.e., matrices) which we hope
otherwise, or republish, to post on servers or to
redistribute to lists, requires prior specific permission
to entice the reader into embracing to represent their
and/or a fee.
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies
rigid transforms. The reader should walk away from
method for representing rigid transforms instead of
this paper with a clear understanding of what dual-
matrices, and gives evidence that the results can be
quaternions are and how they can be used.
faster with accumulated transformations of joints if
The majority of computer scientists are familiar with
the inferences per vertex are large enough.
vectors, matrices, and quaternions. They provide a
Selig [SELI11] address the key problem in computer
set of tools to help solve problems. This paper
games. Examining the problem of solving the
presents the case for adding dual-quaternions to this
equations of motion in real-time and puts forward
set of tools.
how dual-quaternion give a very neat and succinct
The contribution of this paper is the explanation and
way of represent rigid-body transformations.
demonstration of dual-quaternions in a sufficiently
Vasilakis [VAFU09] discussed skeleton-based rigid-
detailed way that the reader can begin to appreciate
skinning for character animation.
their practical problem-solving advantages. We use
Kuang [KMLX11] presented a strategy for creating
character-based hierarchies as a base method to
real-time animation of clothed body movement.
illustrate the realistic reward of dual-quaternions in
time critical systems (e.g., games).

2.2. Robotics
This paper presents dual-quaternions as a method for
Pham [PPAF10] solved linked chain inverse
representing rigid transforms in complex character
kinematic (IK) problems using Jacobian matrix in the
hierarchies with a large number of DOF. We explain
dual-quaternion space.
how to implement a basic dual-quaternion class and
Malte [SCHI11] used a mean of multiple
combine dual-quaternions through straightforward
computational (MMC) model with dual-quaternions
multiplication to work in place of matrices.
to model bodies.
The roadmap for the rest of the paper is as follows:
Ge [GVMC98] demonstrated dual-quaternions to be
we begin with a review of recent and related work
an efficient and practical method for interpolating
that emphasises the power of dual-quaternions. We
three-dimensional motions.
review familiar rigid transform methods and their
Yang-Hsing [LIWC10] calculated the relative
orientation using dual-quaternions.
primary reasons for using dual-quaternions and why
you would want to use them for rigid transforms over
Perez [PEMC04] formulated dynamic constraints for
other methods. We then give the background
articulated robotic systems using dual-quaternions.
mathematical
information
for
dual
numbers,
3. FAMILIAR PHYSICAL CONCEPTS
quaternions and dual-quaternions. The following
We review the most common methods of
sections then focus on the practical aspects of dual-
representing rigid body orientations and translations
quaternions. We discuss a variety of experiments
in our physical world (three spatial dimensions).
with computer simulations and character hierarchies
While orientation and rotation are familiar concepts,
in relation to dual-quaternion. Finally, the end
there are many ways to represent them both
section presents the conclusion and proposed future
mathematically and computationally, each with their
work.
own strengths and weaknesses. We briefly describe
2. RELATED WORK
four of the most popular methods of representing
The dual-quaternion has been around since 1882
rigid transforms in character systems. This helps
[CLIF82] but has gained less attention compared to
illustrate the mathematical and computational issues
quaternions alone. Comparable to quaternions the
that occur. The four alternate methods we compare
dual-quaternions have had a taboo associated with
mathematically
and
computationally
to
dual-
them, whereby students avoid quaternion and hence
quaternions are:
dual-quaternions. While the robotics community has
Matrices
started to adopt dual-quaternions in recent years, the
Axis-Angles
computer graphics community has not embraced
Euler-Angles + Translation
them as whole-heartedly. We review some recent
Quaternions
work which has taken hold and has demonstrated the
Each alternative method needs to represent both the
practicality of dual-quaternions, both in robotics and
orientation and translation. In some cases this is
computer graphics.
achieved by using two separate state variables and
2.1. Computer Graphics
combining them separately, while matrices and dual-
Kavan [KCZO08] demonstrated the advantages of
quaternions give us a unified state variable.
dual-quaternions in character skinning and blending.
For each case we focus on issues of interpolation,
Ivo [IVIV11] extended Kavans [KCZO08] work with
computational speed, mathematical robustness and
dual-quaternions and qtangents as an alternative
distance metrics.
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

The properties we look for to represent the rigid body
1
0
0

transform are:

X 0
cos
sin
x
x

Robustness - be continuous and not contain any
0 sin
cos

discontinuities (such as gimbal lock with Euler's
x
x
angles which we discuss later). Contain a unique
cos
0
sin
y
y
representation,
where
some
methods
contain

Y
0
1
0

redundant information, such that several or an

infinite number of elements can represent the same
sin
0
cos

y
y
transform.
cos
sin
0
z
z

Efficiency - should consume the smallest necessary
Z sin
cos
0
z
z

amount of space and be computationally fast. We
0
0
1

would like a minimum number of calculations to
combine
and
convert
between
alternative
Combining the translation is just a matter of rotating
representations (e.g., cost to convert between
the translational components (x, y and z) by the
matrices and Euler angles).
rotation.
Ease of Use - can be used without too many
To combine and calculate interpolating differences
complications.
requires us to find the equivalent axis-angle of the
two orientations and extrapolate the Euler angles.
3.1. Orientation and Translation
It might seem intuitive how objects are rotated and
Create a matrix for each Euler angle.
translated. For example, we can pick up any object
Multiply the three matrices together.
around us and spin (rotate) and translate (move) it
Extract axis-angle from resulting matrix.
without thinking. However, how do we model this
Converting, combining, and extracting Euler angles
computationally and mathematically? The following
is computationally expensive. Moreover, Euler
sub-sections are devoted to the explanation and
angles can have discontinuities around 0 and 2,
understanding of these basic principles.
since the components live on separate circles and not
For methods which are formed from separate
a single vector space.
orientation and translational information, we can
analyse their workings by considering orientation and
translation separately and combining them at the end
People prefer Euler angles as they can comprehend
of each transform.
them effortlessly and can create orientations with
them without difficulty. They are also very intuitive
3.2. Translation
and have a long history in physics and graphics and
The translation coordinates are relatively simple to
can make certain integrals over rotational space
work with. They compose of the scalar values along
easier.
each of the principle axes (x, y and z). The computed
Euler angles are minimalistic and require only three
orientations are combined with the translations by
parameters; however, we show later how four
rotating the principle axis.
parameters are better than three. Furthermore, since
3.3. Euler-Angles
the angles are used directly, there is no drifting or the
need for normalization.
A familiar way of representing the orientation and
translation in character systems is to factor it into
three sequential angles around the principle
Euler angles suffer from singularities - angles will
orthogonal axes (x, y and z).
instantaneously change by up to 2 radians as other
Euler's angles in 3D do not (in-general) commute
angles go through the singularity; Euler angles are
under composition.
virtually impossible to use for sequential rotations.
There are twelve different possible Euler angle
In practice, the angles are used by inserting them into
rotation sequences - XYZ, XYX, XZY, and so on.
matrices. The product of the three angle-matrices
There is no one "simplest" or "right" set of Euler
produces the Euler angle set. There are twelve
angles. To derive a set of Euler angles you must
possible products: XYZ, XYX, YZX, YZY, ZXY,
know which rotational sequence you are using and
ZXZ, XZY, XZX, YXZ, YXY, ZYX, and ZYZ.
stick to it.
These are the order the rotations are applied in. For
example, the factorization XYZ, would mean rotate
In practice when Euler angles are needed; the
round X then Y then Z.
underlying rotation operations are done using
quaternions and are converted to Euler angles for the
To work with Euler angles we convert them to
matrices:
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies
3.3.3. Gimbals Lock
The coordination singularity in Euler's angles is
We can renormalize the axis since it is a unit vector,
commonly referred to as gimbals lock. A gimbal is a
but numerical errors can still creep into the angle
physical device consisting of spherical concentric
portion.
hoops with pivots connecting adjacent hoops,
Infinite number of angle choices (multiples of 2), so
allowing them to rotate within each other (see Figure
two axis-angle pairs can still refer to the same
1).
rotation but be different.
Axis-angle interpolation cannot be done using linear
interpolation of the four elements. Interpolating
between the four elements naively in this way does
not give the shortest path.
Interpolating the angle alone can introduce
discontinuities as the angle crosses from 0 to 2.
These `jumps' are highly undesirable and can cause
anarchy with the interpolation and numerical
integration schemes.

Figure 1. Gimbal with points of rotation indicated.
3.5. Matrices
Representing a rigid transform using a matrix we
A gimbal is constructed by aligning three rings and
extend a 3x3 rotation matrix to include translation
attaching them orthogonally. Gimbals are often seen
information which makes it a 4x3 matrix. While a
in gyroscopes used by the aeronautical industry.
4x3 matrix is the most efficient, on most occasions a
As objects are rotated, they approach gimbal lock the
4x4 matrix is used because of availability.
singularity will cause numerical ill-conditioning,
The 3x3 part of the matrix consists of three
often evidented physically by the gimbal wiggling
orthogonal column vectors which are of unit
madly around as it operates near the singularity. This
magnitude.
is one reason why the aerospace industry, early on,
switched to quaternions to represent orientation -
A transform matrix can transform a vector coordinate
satellites, rockets and airplanes would have their
by simply matrix multiplication:
navigation gyro lock up and could cause them to
y T x
crash.
where T is a transform matrix, x a vector coordinate
3.3.4. Interpolation
and y the transformed result.
The major problem with Euler interpolation is that
If the position and basis vectors are known, the
they have problems while interpolating near gimbals
transform matrix can trivially be produced, because
lock regions. When close to a gimbal lock
each of the columns in the 3x3 part of the matrix
singularity the interpolation become jittery and noise
represent the base vectors and the bottom row the
ridden; eventually becoming random and unstable as
translation.
it converges on the singularity.
The combination of matrix elements is achieved
If Euler angles are interpolated linearly the resulting
through simple multiplication. Matrices are not
path will not take the shortest path between the
commutative
and
therefore
their
matrix
endpoints as it does in vector space [ALMA92].
representation of rigid body transforms is non-
3.4. Axis-Angle
commutative as well.
The axis-angle is represented by a unit axis and angle
( ,
n ) pair. This axis-angle representation can easily
Matrices are taught in linear algebra early on in
be converted to and from a matrix.
colleges so this makes them more familiar and
It is difficult to combine the axis-angle elements in
favourable. In addition, a great many algorithms
their native form; usually being converted to an
have been formulated and tested with matrices and so
alternate representation for concatenation (e.g.,
people choose them instinctively first.
matrices, quaternions).
While matrices might seem to be the utopia, they in-
The greatest single advantage of the axis-angle
fact can be found to have several problems.
representation is that it directly represents the action
Firstly, they take a minimum of 12 parameters to
of rotation, while being straightforward and intuitive
represent a structure with only six DOF; if memory is
to work with.
at a premium this can be undesirable.
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

Secondly, the rotational part of the matrix is
components, the dual operator is used in the same
composed of orthogonal columns which can drift and
way.
introduce unwanted scaling and sheering. We can re-
The dual number theory can be extended to other
normalize the matrix using Gram-Schmidt method
concepts, such as vectors and real numbers, but we
[GILB86] but this can be computationally expensive.
focus on their applicability in conjunction with
Thirdly, interpolating between matrices is difficult.
quaternions to represent rotation and translation
The three columns forming the orthogonal axis
transforms.
directions in the rotation part of the matrix do not
represent the vector space and cannot be interpolated.
5.1. Dual Number Arithmetic Operations
Dual numbers can perform the fundamental
Finally, it is difficult to visualize a matrix and the
arithmetic operations below:
axis-angle component about which it will rotate and
translate.

3.6. Method Summary
(r
d
) (r
d
)
(r
r ) (d
d )
A
A
B
B
A
B
A
B

We have outlined and examined current methods for
Multiplication
representing
a
robust,
practical
and
viable
2
(r d )(r d ) r r r d r d d d
hierarchical rigid body solution. We now follow on
A
A
B
B
A B
A
B
B
A
A
B

from this by introducing and explaining how and
r r (r d r d )
A B
A
B
B
A
why dual-quaternions stand-out above these methods.
Division
4. WHY DUAL-QUATERNIONS?
(r d )
(r d ) (r d )
A
A
A
A
B
B

We use dual-quaternions as a tool for expressing and
(r d )
(r d ) (r d )
analyzing the physical properties of rigid bodies.
B
B
B
B
B
B

Dual-quaternions can formulate a problem more
r r
(r d
r d )
A B
B
A
A
B

concisely, solve it more rapidly and in fewer steps,
2
(r )
B
present the result more plainly to others, be put into
r r
r d r d
practice with fewer lines of code and debugged
A B
B
A
A
B

2
2
r
r
effortlessly. Furthermore, there is no loss of
B
B
efficiency; dual-quaternions can be just as efficient if
Further reading on the subject of dual numbers is
not more efficient than using matrix methods. In all,
presented by Gino [BERG09].
there are several reasons for using dual-quaternions,
which we summarize:
5.2. Dual Number Differentiation

Dual numbers differentiate in the same way as any

Singularity-free

other vector using elementary calculus principles,

Un-ambiguous

e.g.:

Shortest path interpolation
Most efficient and compact form for
d
(x x) (x)
(x)
s
s
s
lim

representing rigid transforms [SCHI11] - (3x4
0
dx
x
x
matrix 12 floats compared to a dual-quaternion 8
The derivative of a dual number is another dual
floats)

number. Remarkably, the dual operator's condition

Unified representation of translation and rotation
2

0 enables us to take advantage of Taylor series

Can be integrated into a current system with
to find the differentiable. Where we can see below,
little coding effort

if we substituting a dual number into Taylor series,

The
individual
translation
and
rotational
we get:
information is combined to produce a single
invariant coordinate frame [GVMC98]
f '(r )
f ' (r )
f ' '(r )
A
A
2
A
3
f (r d ) f (r )
d
(d )
(d ) ...
A
A
A
1!
A
2!
A
3!
A
5. DUAL NUMBERS
f '(r )
A
2
f (r )
d 0 0 ...
(as, 0)
A
A
Clifford [CLIF82] introduced dual numbers; similar
1!
to complex numbers that consists of two parts known
f (r ) f '(r )d
A
A
A
as the real and complex component. Dual numbers

break the problem into two components and are
Surprisingly, the Taylor series result gives us an
defined as:
exceptionally tidy answer; from this we use dual
z r d

number arithmetic and substitution to find the
with 2 0 but
0
solution to any differential.
where is the dual operator, r is the real part and d
The derivative also enables us to find the tangent of
the dual part. Similar to complex number theory,
an arbitrary point p on a given parametric curve that
where i is added to distinguish the real and complex
is equal to the normalized dual part of the point p.
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies
6. QUATERNIONS
6.2. Quaternion Interpolation
Quaternions were introduced by Hamilton in 1866
An extremely important quality of quaternions that
[HAMI86] and have had a rollercoaster of a time with
make them indispensable in animation systems is
acceptance. Quaternions are an extension of
their ability to interpolate two or more quaternions
complex number-theory to formulate a four
smoothly and continuously. Shoemake [SHOE85],
dimensional manifold. A quaternion is defined as:
presents an outstanding paper on using quaternion
curves for animating rotations. Furthermore, it
q w (xi yj zk)
should be noted, the spherical linear interpolation
where w, x, y and z are the numerical values, while i,
(SLERP) properties of quaternions are inherited by
j and k are the imaginary components.
dual-quaternions.
The imaginary components properties:
7. DUAL-QUATERNIONS
2
2
2
i j k 1

When quaternions are combined with dual number
theory, we get dual-quaternions which was presented
and
by Clifford in 1882 [CLIF82]. While the unit
ij k,
ji k
quaternion only has the ability to represent rotation,
the unit dual-quaternion can represent both
jk i,
kj i

translation and rotation. Each dual-quaternion
ki j,
ik j
consists of eight elements or two quaternions. The
It is more common to represent the quaternion as two
two quaternion elements are called the real part and
components, the vector component (x, y and z) and
the dual part.
the scalar component (w).
q q q
r
d
q ( ,
w v)
where q and q are quaternions. Combining the
r
d
For further reading on the workings of quaternions
algebra operations associated with quaternions with
the additional dual number , we can form the dual-
McDonalds [MCDO10] introductory paper for
quaternion arithmetic.
students.
7.1. Dual-Quaternion Arithmetic
6.1. Quaternion Arithmetic Operations
Operations
Since we are combining quaternions with dual
The elementary arithmetic operations necessary for
number theory, we give the elementary quaternion
us to use dual-quaternions are:
arithmetic operations below:
Scalar Multiplication
Scalar Multiplication
sq sq
sq
r
d
sq (s ,
w sv)
where s is a scalar value.
q q q q
(q q )
1
2
1
r
r 2
d1
d 2
Multiplication
q q (w w , v v )
q q q q
(q q q q )
1
2
1
2
1
2
1
2
r1
r 2
r1
d 2
d1
r 2
Multiplication
Conjugate
*
*
*
q q q
q q ( w w v v , w v w v (v v ) )
r
d
1
2
1
2
1 2
1
2
2
1
1
2
Magnitude
Conjugate
*
|| q || q q
*
q ( ,
w v)
Unit Condition
Magnitude
|| q || 1
*
|| q || q q
*
*
q q q q 0
r
d
d
r

The unit dual-quaternion is our key concern as it can
For a unit quaternion, || q || 1 . The unit quaternion
represent any rigid rotational and translational
is used to represent a rotation of an angle , radians
transformations.
about a unit axis n , in three-dimensional space:
The rigid rotational and translational information for

the unit dual-quaternion is:
q ( cos( ), n sin( ) )
2
2

WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

q r
4. If necessary, for long chains, the dual-quaternion
r
should be re-normalized (to mend drift and
1

q
t r
maintain a unit dual-quaternion).
d
2
5. To get the homogeneous transformation matrix,
where r is a unit quaternion representing the rotation
convert the dual-quaternion by extracting the
and t is the quaternion describing the translation
translational and rotational components.
represented by the vector t (0, t ) .
6. The extracted rotation quaternion r and vector
translation information is extracted using:
The dual-quaternion can represent a pure rotation the

same as a quaternion by setting the dual part to zero.
r
Qr

*
t 2 Qd Qr
q [cos( ), n sin( ), n sin( ), n sin( ) ][ 0, 0, 0, 0]
r
2
x
2
y
2
z
2
Dual-quaternion multiplication is more efficient than

matrix multiplication and can effortlessly be
To represent a pure translation with no rotation, the
converted back to a matrix when needed. Dual-
real part can be set to an identity and the dual part
quaternions, unlike Euler angles, do not present
represents the translation.
issues like "gimbal lock" and hence, are ideal for
complex articulated hierarchies.
t
t

t
q
[1, 0, 0, 0][0,
, y
x
, z ]
t
2
2
2
9. COMPLEX CHARACTER
HIERARCHY FORWARD
Combining
the
rotational
and
translational
transforms into a single unit quaternion to represent
KINEMATICS
a rotation followed by a translation we get:
The focus of our attention is with rigid hierarchies
having a large number of DOF. Humans have a
q q q
t
r
tremendous amount of flexibility which we emulate
This arithmetic operation defines how we transform a
and analyze using numerical and mathematical
point p, using a unit dual-quaternion:
models. Forward kinematics is the method of
concatenating local positions and rotations together
*
p ' q p q
to give their global ones. The forward kinematic
method for concatenating transforms is the same for
where
*
q and q represent
a
dual-quaternion
dual-quaternions and matrices; which use simple
transform and its conjugate; while p and p '
multiplication to propagate transforms between the
represent our point inserted into a quaternion and its
resulting transform.
For example, the concatenation of transforms with
8. PORTING EXISTING CODE TO
matrices and dual-quaternions:
DUAL-QUATERNIONS
Matrix
A dual-quaternion consists of two quaternions, but is
M
M M M M
03
0
1
2
3
represented by a single variable Q. Systems that
Dual-Quaternion
have been constructed using separate translation and
q
q q q q
rotation (vector for translation and quaternion for
03
0
1
2
3
rotation) in combination with matrices schemes are
where the subscript represents the transform, matrix
easily modified to use dual-quaternions for spatial
transform
M corresponding to dual-quaternion
0
information.
transform q .
0
1. For each link, construct a dual-quaternion Q
from the rotation and translation information.
10. EXPERIMENTAL RESULTS
2. Real part of the quaternion is the rotation
We used traditional matrix methods during initial
quaternion r. The dual part is calculated by
character transformation experiments; e.g., inverse
multiplying the quaternion r and translation
kinematic
(IK)
and
animation
blending
to
component t, e.g.:
demonstrate their numerous problems. Matrix

methods are a popular choice and solutions to these
Qr r
problems have been developed; we used some of
Qd

0.5 (0, t) r
these engineering solutions. Of course, these
workarounds to these problems introduced an

3. Combine transformations as you would matrices
circumventions to overcome a problem often
using multiplication.
introduced errors in other areas. One such
engineering solution for reducing the impact of drift
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies
and concatenation error was to renormalize the
matrices at each level (and at each update frame).
The error reduced skewing and scaling but
manifested itself in the ideal global end-link
orientations and positions being inaccurate.
To demonstrate the problems, we constructed
numerous test cases to emphasis them. We also

demonstrate and explore how dual-quaternions can
Figure
4.

Ortho-normalizing
matrices
in
represent rigid body character based systems.
hierarchies in an attempt to reduce errors.
10.1. Rigid Body Transform Chains
Ortho-normalizing the rotational part of the
We constructed a straightforward IK solver that
transform matrix between updates removed scaling
would follow a target end-effector. To mimic how a
and skewing problems. The joints presented
character would move his arm or leg. The end-
discontinuity errors in the frames hierarchy (see
Figure 4). The ideal end-effectors position and
work with to meet its target goal.
rotation were also different from the calculated one
using the refurbish matrices.
10.2. Biped Model
For our test character, we used a 16 link biped model,
shown in Figure 5. The character has 36 degrees of
freedom (DOF). Character rigs can produce
extremely non-linear motions due to their joint limits,
flexibility and elaborate arrangement of joints.

Figure 2. Rigid body links attached in a single
hieararchy frame. (Draw ideal(red) and calculated
end-effector (green).

held a rotation and translation in the form of a matrix
or dual-quaternion. For calculations, the axis-angle
and translation could be extracted and used when
needed. Local transforms were combined from the
root to the end-effectors. Concatenation of the

transforms throughout the levels was achieved by
Figure 5. 16 link biped model used for testing.
multiplying
parent
transforms
with
current
transforms.
Figure 5, shows the biped model in its starting stance
Certain orientation and translation configurations
pose.
produced errors in the output, shown in Figure 3.
Buildup of computational inaccuracies will cause a
These errors presented themselves as skewing and
dual-quaternion to become of non-unit length; we fix
scaling manifestations.
these errors by renormalization. In contrast,
repairing a non-orthogonal matrix is much more
complicated (see [SALA79]).
11. RESULTS
The dual-quaternion unifies the translation and
rotation into a single state variable. This single state
variable
offers
a
robust,
unambiguous,

computationally efficient way of representing rigid
Figure 3. Artifact error when matrices representing
transform.
translation and orientation in linked hierarchies.
The computational cost of combining matrices and
Early workarounds to amend the problem were to
dual-quaternions:
repair the matrix at each level in the hierarchy by
Matrix4x4
ortho-normalizing the rotational component. While
Matrix4x3
ortho-normalizing the matrix reduced scaling and
skewing
artifacts,
alternative
errors
manifest

themselves in alternative forms.
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

In our tests, we found the dual-quaternion
public DualQuaternion_c( Quaternion r, Vector3 t )
{
multiplication method of transforms on average ten
m_real = Quaternion.Normalize( r );
percent faster compared matrix multiplication. We
m_dual = ( new Quaternion( t, 0 ) * m_real ) * 0.5f;
}
did not take advantage of CPU architecture using
public
static
float
Dot(
DualQuaternion_c
a,
parallel methods such as SIMD which can further
DualQuaternion_c b )
{
improve speeds as demonstrated by Pallavi
return Quaternion.Dot( a.m_real, b.m_real );
[MEHU10] (both for matrices and quaternion
}
public static DualQuaternion_c operator* (DualQuaternion_c
multiplication).
q, float scale)
{
One major advantage we found when working with
DualQuaternion_c ret = q;
ret.m_real *= scale;
ret.m_dual *= scale;
calculating angular and linear differences. When
return ret;
working with pure matrix methods we needed to
}
public static DualQuaternion_c Normalize( DualQuaternion_c q
convert the matrix to a quaternion to calculate
)
angular variations.
{
float mag = Quaternion.Dot( q.m_real, q.m_real );
Debug_c.Assert( mag > 0.000001f );
12. CONCLUSION AND FURTHER
DualQuaternion_c ret = q;
ret.m_real *= 1.0f / mag;
WORK
ret.m_dual *= 1.0f / mag;
The
dual-quaternion
model
is
an
accurate,
return ret;
}
computationally efficient, robust, and flexible
public static DualQuaternion_c operator + (DualQuaternion_c
method of representing rigid transforms and should
lhs, DualQuaternion_c rhs)
{
not be overlooked. Implementing pre-programmed
return new DualQuaternion_c(lhs.m_real + rhs.m_real,
dual-quaternion modules (e.g., multiplication and
lhs.m_dual + rhs.m_dual);
}
normalization) enables the creation of more elegant
// Multiplication order - left to right
and clearer computer programs that are easier to
public static DualQuaternion_c operator * (DualQuaternion_c
lhs, DualQuaternion_c rhs)
work with and control.
{
return new DualQuaternion_c(rhs.m_real*lhs.m_real,
While matrices are the de-facto method used for the
rhs.m_dual*lhs.m_real + rhs.m_real*lhs.m_dual);
majority of hierarchy based simulations, we have
}
public static DualQuaternion_c Conjugate( DualQuaternion_c q
shown that they can present certain problems which
)
are costly to avoid (e.g., renormalizing a matrix).
{
return
new
DualQuaternion_c(
Quaternion.Conjugate(
The problem and cost of drifting and normalizing is
q.m_real ), Quaternion.Conjugate( q.m_dual ) );
less with dual-quaternions compared to matrix
}
public static Quaternion GetRotation( DualQuaternion_c q )
methods. When dealing with rigid transforms the
{
dual-quaternion method shines through due to its
return q.m_real;
}
public static Vector3 GetTranslation( DualQuaternion_c q )
{
This paper has only provided a taste of the potential
Quaternion t = ( q.m_dual * 2.0f ) * Quaternion.Conjugate(
q.m_real );
advantages of dual-quaternions, and one can only
return new Vector3( t.X, t.Y, t.Z );
imagine the further future possibilities that they can
}
public
static
Matrix
DualQuaternionToMatrix(
offer. For example, there is a deeper investigation of
DualQuaternion_c q )
the mathematical properties of dual-quaternions (e.g.,
{

q = DualQuaternion_c.Normalize( q );
zero divisions). There is also the concept of dual-

dual-quaternions (i.e., dual numbers within dual
Matrix M = Matrix.Identity;
float w = q.m_real.W;
numbers) and calculus for multi-parametric objects
float x = q.m_real.X;
for the reader to pursue if he desires.
float y = q.m_real.Y;
float z = q.m_real.Z;

13. APPENDIX
// Extract rotational information
M.M11 = w*w + x*x - y*y - z*z;
13.1. Dual-Quaternion Implementation
M.M12 = 2*x*y + 2*w*z;
M.M13 = 2*x*z - 2*w*y;
Class.

M.M21 = 2*x*y - 2*w*z;
public class DualQuaternion_c
M.M22 = w*w + y*y - x*x - z*z;
{
M.M23 = 2*y*z + 2*w*x;
public Quaternion
m_real;

public Quaternion
m_dual;
M.M31 = 2*x*z + 2*w*y;
public DualQuaternion_c()
M.M32 = 2*y*z - 2*w*x;
{
M.M33 = w*w + z*z - x*x - y*y;
m_real = new Quaternion(0,0,0,1);

m_dual = new Quaternion(0,0,0,0);
// Extract translation information
}
Quaternion t = (q.m_dual * 2.0f) * Quaternion.Conjugate(
public DualQuaternion_c( Quaternion r, Quaternion d )
q.m_real);
{
M.M41 = t.X;
m_real = Quaternion.Normalize( r );
M.M42 = t.Y;
m_dual = d;
M.M43 = t.Z;
}
return M;

WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies
}
of robot manipulators using dual quaternion

#if false
feedback," in Intelligent Robots and Systems
public static void SimpleTest()
(IROS), 2010 IEEE/RSJ International Conference
{
DualQuaternion_c
dq0
=
new
DualQuaternion_c(
on, 2010, pp. 658-663.
Quaternion.CreateFromYawPitchRoll(1,2,3),
new
Vector3(10,30,90) );
[SCHI11] M. Schilling, "Universally manipulable
DualQuaternion_c
dq1
=
new
DualQuaternion_c(
body models -- dual quaternion representations
Quaternion.CreateFromYawPitchRoll(-1,3,2),
new
Vector3(30,40, 190 ) );
in layered and dynamic MMCs," Autonomous
DualQuaternion_c
dq2
=
new
DualQuaternion_c(
Robots, 2011.
Quaternion.CreateFromYawPitchRoll(2,3,1.5f),
new
Vector3(5,20, 66 ) );
[GVMC98] Q. Ge, A. Varshney, J. P. Menon, and C.
DualQuaternion_c dq = dq0 * dq1 * dq2;

F. Chang, "Double quaternions for motion

interpolation," in Proceedings of the ASME
Matrix
dqToMatrix
=
DualQuaternion_c.DualQuaternionToMatrix( dq );
Design Engineering Technical Conference, 1998.

Matrix
m0
=
Matrix.CreateFromYawPitchRoll(1,2,3)
*
[LIWC10] Y. Lin, H. Wang, and Y. Chiang,
Matrix.CreateTranslation( 10, 30, 90 );
"Estimation of relative orientation using dual
Matrix
m1 =
Matrix.CreateFromYawPitchRoll(-1,3,2)
*
Matrix.CreateTranslation( 30, 40, 190 );
quaternion," System Science and, no. 2, pp. 413-
Matrix m2 = Matrix.CreateFromYawPitchRoll(2,3,1.5f) *
416, 2010.
Matrix.CreateTranslation( 5, 20, 66 );
Matrix m = m0 * m1 * m2;
}
[PEMC04] A. Perez and J. M. McCarthy, "Dual
#endif
quaternion synthesis of constrained robotic
} // End DualQuaternion_c
systems," Journal of Mechanical Design, vol.

126, p. 425, 2004.
13.2. Novice Errors
[ALMA92] W. Alan and W. Mart, Advanced
There are a few things to look out for when
Animation and Rendering Techniques: Theory
implementing a dual-quaternion class. Firstly,
ensure the multiplication order is correct and
remains consistent with matrices (i.e., left to right).

[GILB86] S. Gilbert, Introduction to Applied
Secondly, always ensure that the dual-quaternions
Mathematics. Wellesley-Cambridge Press, 1986.
remain normalized (i.e., unit-length).
[BERG09] G. van den Bergen, "Dual Numbers:
Simple Math, Easy C++ Coding, and Lots of
14. REFERENCES
Tricks," GDC Europe, 2009. [Online]. Available:
[CLIF82] W.
Clifford,
Mathematical
Papers.
www.gdcvault.com/play/10103/Dual-Numbers-
London: Macmillan, 1882.
Simple-Math-Easy.
[KCZO08] L. Kavan, S. Collins, J. Zara, and C.
[HAMI86] W.
R.
Hamilton,
Elements
of
O'Sullivan,
"Geometric
skinning
with
approximate dual quaternion blending," ACM
Quaternions. London: , 1886.
Transactions on Graphics (TOG), vol. 27, no. 4,
[MCDO10] J. McDonald, "Teaching Quaternions is
p. 105, 2008.
not Complex," Computer Graphics Forum, vol.
29, no. 8, pp. 2447-2455, Dec. 2010.
[IVIV11]
F. Z. Ivo and H. Ivo, "Spherical skinning
with dual quaternions and QTangents," ACM
[SHOE85] K. Shoemake, "Animating rotation with
SIGGRAPH 2011 Talks, vol. 27, p. 4503, 2011.
quaternion curves," ACM SIGGRAPH computer
graphics, 1985.
[SELI11]
J. Selig, "Rational interpolation of rigid-
body motions," Advances in the Theory of
[SALA79] E. Salamin, "Application of quaternions
Control, Signals and Systems with Physical
to computation with rotations," Internal Report,
Modeling, pp. 213-224, 2011.
Stanford University, Stanford, CA, vol. 1, 1979.
[VAFU09] A. Vasilakis and I. Fudos, "Skeleton-
[MEHU10] P. Mehrotra and R. Hubbard, "Benefits
based rigid skinning for character animation," in
of Intel(R) Advanced Vector Extensions For
Proc. of the Fourth International Conference on
Quaternion
Spherical
Linear
Interpolation
Computer Graphics Theory and Applications,
(Slerp),"
2010.
[Online].
Available:
2009, no. February, pp. 302-308.
http://software.intel.com/en-us/articles/benefits-
[KMLX11] Y. Kuang, A. Mao, G. Li, and Y. Xiong,
"A strategy of real
quaternion-spherical-liner-interpolation-slerp/.
-time animation of clothed
body movement," in Multimedia Technology

(ICMT), 2011 International Conference on, 2011,
pp. 4793-4797.
[PPAF10] H. L. Pham, V. Perdereau, B. V. Adorno,
and P. Fraisse, "Position and orientation control
WSCG 2012 Communication Proceedings
http://www.wscg.eu/

A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies

Share A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies to:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies as:

From:

To:

Share A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

Share A Beginners Guide to Dual-Quaternions: What They Are, How They Work, and How to Use Them for 3D Character Hierarchies as:

Copy html code above and paste to your web page.