quaternions in practice - xbdev.net...quaternions in practice converting, validating, and...

7
xbdev.net manuscript No. ’quaternions in practice’ ([email protected]) Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview of the advantages and disadvantages of quaternions for creating computationally fast, straightforward, and algorithmically robust solutions. While quaternions have proven themselves as providing an unambiguous, un-cumbersome, and computa- tionally efficient tool for representing rotations, we attempt to address a number of workable considerations (e.g., convert- ing between different forms, numerical errors, and common pitfalls). Whereby, this paper focuses on providing a clear- cut step-by-step explanation of quaternions with real-world examples and practical considerations. Keywords Quaternions · Simulation · Converting · Euler Angles · Axis-Angle · Quaternion Exponential 1 Introduction Overview: Quaternions are a memory efficient, straightfor- ward, and computationally robust way of representing orien- tations. The algebraic properties of quaternions allows them to perform important operations (e.g., interpolation and in- version) that would be difficult and imprecise by other means (e.g., compared with axis-angle and matrix methods). Quater- nion have been around for over a century and have become the de-facto method of representing, comparing, and storing orientations. Possessing a solid understanding of quaternions, which include their practical workings, limitations, and pit- falls is fundamental. Motivation (Interest and Importance): Representing an orientation efficiently and without ambiguity is important in many disciplines (e.g., robotics, computer-animation, and B. Kenwright [email protected] bio-mechanics). While quaternion libraries are freely avail- able which provide a broad range of optimized API, the user can use the quaternion tool with a blind eyes to the mechanical workings within. However, when problems oc- cur or customization is needed (e.g., how to identify if the quaternion is valid, porting the quaternion solution to another platform), the user is left struggling and guessing. Challenges: Ideally, we want to represent orientations in an unambiguous and memory efficient way. Furthermore, performing a number of operations, such as interpolation, inversion, and concatenation of orientations should be pos- sible without to much difficulty. While quaternions solve the majority of the problems there is a voodoo surrounding them. For example, why do people fear quaternions? While the name quaternion is a daunting name to begin with some students struggled with complex number at school, so the thought of understanding a 4D space with multiple variable complex numbers can leave the majority of students staying clear of the subject. Nevertheless, while quaternions solve a number of problems and provide us with a powerful tool, the human brain just cannot visualize 4D and it can make visualizing and comprehending quaternions difficult. Quaternion Approach: While quaternions may, initially, appear to be the holy-grail solution for fast, compact, unam- biguous orientations, it does, however, have some disadvan- tages and heartfelt traps for those unaccustomed to working with them. Whereby, this paper aims to help the reader appre- ciate, understanding, and identifying the many advantages while demonstrating and explaining to the reader how to comprehend and circumventing the few disadvantages. Key Components and Results: This paper explores a num- ber of practical real-world implementation situations involv-

Upload: others

Post on 26-Jun-2020

11 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

xbdev.net manuscript No. ’quaternions in practice’([email protected])

Quaternions in PracticeConverting, Validating, and Understanding

Ben Kenwright

January 2013

Abstract In this paper, we present a practical overview ofthe advantages and disadvantages of quaternions for creatingcomputationally fast, straightforward, and algorithmicallyrobust solutions. While quaternions have proven themselvesas providing an unambiguous, un-cumbersome, and computa-tionally efficient tool for representing rotations, we attempt toaddress a number of workable considerations (e.g., convert-ing between different forms, numerical errors, and commonpitfalls). Whereby, this paper focuses on providing a clear-cut step-by-step explanation of quaternions with real-worldexamples and practical considerations.

Keywords Quaternions · Simulation · Converting · EulerAngles · Axis-Angle · Quaternion Exponential

1 Introduction

Overview: Quaternions are a memory efficient, straightfor-ward, and computationally robust way of representing orien-tations. The algebraic properties of quaternions allows themto perform important operations (e.g., interpolation and in-version) that would be difficult and imprecise by other means(e.g., compared with axis-angle and matrix methods). Quater-nion have been around for over a century and have becomethe de-facto method of representing, comparing, and storingorientations. Possessing a solid understanding of quaternions,which include their practical workings, limitations, and pit-falls is fundamental.

Motivation (Interest and Importance): Representing anorientation efficiently and without ambiguity is importantin many disciplines (e.g., robotics, computer-animation, and

B. [email protected]

bio-mechanics). While quaternion libraries are freely avail-able which provide a broad range of optimized API, theuser can use the quaternion tool with a blind eyes to themechanical workings within. However, when problems oc-cur or customization is needed (e.g., how to identify if thequaternion is valid, porting the quaternion solution to anotherplatform), the user is left struggling and guessing.

Challenges: Ideally, we want to represent orientations inan unambiguous and memory efficient way. Furthermore,performing a number of operations, such as interpolation,inversion, and concatenation of orientations should be pos-sible without to much difficulty. While quaternions solvethe majority of the problems there is a voodoo surroundingthem. For example, why do people fear quaternions? Whilethe name quaternion is a daunting name to begin with somestudents struggled with complex number at school, so thethought of understanding a 4D space with multiple variablecomplex numbers can leave the majority of students stayingclear of the subject. Nevertheless, while quaternions solvea number of problems and provide us with a powerful tool,the human brain just cannot visualize 4D and it can makevisualizing and comprehending quaternions difficult.

Quaternion Approach: While quaternions may, initially,appear to be the holy-grail solution for fast, compact, unam-biguous orientations, it does, however, have some disadvan-tages and heartfelt traps for those unaccustomed to workingwith them. Whereby, this paper aims to help the reader appre-ciate, understanding, and identifying the many advantageswhile demonstrating and explaining to the reader how tocomprehend and circumventing the few disadvantages.

Key Components and Results: This paper explores a num-ber of practical real-world implementation situations involv-

Page 2: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

2 Ben Kenwright

ing quaternions. For example, converting to and from alterna-tive formats, such as Euler angles, matrices, and axis-angles.We present experimental results and simplified step-by-stepexamples to help solidify and prove certain theoretical as-pects.

Contribution: The contributions of this paper is a practicalnon-nonsense explanation and examination of quaternions ina real-world context. We present numerous step-by-step ex-planations of the mathematical intricacies of quaternions andtheir conversion to and from other rotational representations(e.g., matrices, axis-angle, Euler angles).

2 Related Work

The subject of quaternions is not a new topic and numer-ous interesting and comprehensive texts on the subject areavailable[xxxx]. However, realistic pedestrians in crowd situ-ations is an interesting subject which has been studied acrossnumerous disciplines (e.g., movie industry, computer games,safety and evacuation). Whereby, we briefly review some ofthe most recent and relevant research in the field that has con-tributed to making characters and crowds more interactiveand responsive.

Beyond quaternions - to dual-quaternions!

3 Fundementals

We review the quaternions fundamental representation andits algorithmic operations.

Quaternion Form:q = [w + xi+ yj + zk] w, x, y, z ∈ R= [w,v] v = (x, y, z),v ∈ R3

(1)

Complex Algabraic Rules:i2 = j2 = k2 = −1

ij = k ik = i ki = j

ji = −k kj = −i ik = j

(2)

Hint, they follow the same rules as the cross-product, i.e.:x× y = z y × z = x z × x = y

y × x = −z z × y = −x x× z = −y(3)

Addition and Subtraction:q0 = [w0,v0]

q1 = [w1,v1]

q0 + q1 = [w0 + w1,v0 + v1]

q0 − q1 = [w0 − w1,v0 − v1]

(4)

Product of Two Quaternions:q0q1 = [w0,v0][w1,v1]

= [w0w1 − v0 · v1,

w0v1 + w1v0 + v0 × v1]

(5)

Real Quaternions:q = [w, 0] (6)

Product of ’two’ real quaternions:[w0, 0][w1, 0] = [w0w1, 0] (7)

Multiplying by a Scalar:q = [w,v]

βq = β[w,v]

= [βw, βv]

(8)

which can be conformed by multiplying by a ’real’ quaternionwith the scalar component as the value (i.e., [a, 0][w,v] =[aw, av]).

Pure Quaternions:q = [0,v] (9)

Product of ’two’ pure quaternions:[0,v0][0,v1] = [−v0 · v1, v0 × v1] (10)

Sum of Pure and Real Quaternions:q = [w,v]

= [w, 0] + [0,v](11)

Conjugate:q = [w,v]

q∗ = [w,−v] * indicates the conjugate(12)

whereby, a quaternion multiplied with its conjugate is:qq∗ = [w,v][w,−v]

= [w2 − v · −v,−sv + sv + v ×−v]

= [w2 + v · v, 0]= [w2 + v2, 0]

(13)

Magnitude (or Norm):q = [w,v]

||q|| =√w2 + v2 Magnitude (or Norm)

qq∗ = ||q||2(14)

Normalizing:q′ =

q

||q||

=[w,v]√w2 + v2

(15)

Page 3: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

Quaternions in Practice 3

Inverse:q−1 =

q∗||q||2

qq−1 = [1, 0] = 1(16)

For a unit-quaternion whose norm is 1, the conjugate is thesame as the inverse, i.e., q−1 = q∗.

Dot-Product: The quaternion dot-product is analogous tothe vector dot-product. The two quaternion have their cor-responding scalar components multiplied together and thesummed result is the answer:

q0 · q1 = [w0w1 + x0x1 + y0y1 + z0z1]

cosθ =q0 · q1

||q0||||q1||(17)

where θ is the angle between the two quaternions and for aunit quaternion cosθ = q0 · q1.

4 Practical Algorithms

5 Gimals Lock

Euler angles possess singularity problems.

6 Quaternion from two points (i.e. a direction to quater-nion)

Taken to points in 3D space we can calculate a direction (oraim) vector that we can use to formulate an orientation quater-nion. However, a direction vector does not posses any twistinformation. Furthermore, the quaternion orientation fromthe direction vector is in world space but can be re-orientatedrelative to a local space through quaternion multiplication(e.g., to joint space). The orientation aims the object along thez-axis based on a direction vector (d) shown in Equation 18.

q = (qw, qx, qy, qz)

= (1− dz, dy,−dx, 0)(18)

where d is a direction vector. However, there is a singu-larity when the direction vector (d) is aligned with the z-axisthat must include a special case check (shown in Listing 1).

We can visualize the resulting quaternion orientation in-formation by drawing the generated primary rotation axis onthe surface of a sphere, see Figure 1Q u a t e r n i o n Q u a t e r n i o n F r o m D i r e c t i o n ( Vec to r3 p0 , ←↩

Vec to r3 p1 ){

Vec to r3 v = Vec to r3 . Normal i ze ( p1 − p0 ) ;i f ( v . Z > 0 .999 f ){ / / xyzw

r e t u r n new Q u a t e r n i o n ( 0 , 1 , 0 , 0 ) ;}Q u a t e r n i o n qr =new Q u a t e r n i o n ( v . Y,−v . X, 0 , 1 − v . Z ) ;q r = Q u a t e r n i o n . Normal i ze ( q r ) ;

Debug c . V a l i d ( q r ) ;r e t u r n q r ;

}

Listing 1 Orientation from Directoin - Function source code forcalculating an orientation quaternion from a direction composed oftwo points.

7 Quaternion to Euler

While quaternions are mathematically great, they can bedifficult to visualize and understand with the minds eye. Ifneeded, however, we can quickly convert a quaternion to itsEuler angle components to aid in debugging or visualizingthe orientations (as shown below in Listing 3).Vec to r3 QuatToEule r ( Q u a t e r n i o n q ){

do ub l e sqw = q .W ∗ q .W;do ub l e sqx = q .X ∗ q .X;do ub l e sqy = q .Y ∗ q .Y;do ub l e sqz = q . Z ∗ q . Z ;

do ub l e tmp =Clamp ( −2.0 ∗ ( q .X ∗ q . Z − q .Y ∗ q .W ) , −1, 1 ) ;

do ub l e r o t x r a d =Math . Atan2 ( 2 . 0 ∗ ( q .Y ∗ q . Z + q .X ∗ q .W ) , ( −sqx ←↩− sqy + sqz + sqw ) ) ;

do ub l e r o t y r a d =Math . Asin ( tmp ) ;

do ub l e r o t z r a d =Math . Atan2 ( 2 . 0 ∗ ( q .X ∗ q .Y + q . Z ∗ q .W ) , ( sqx ←↩− sqy − sqz + sqw ) ) ;

Vec to r3 e u l e r = new Vec to r3 ( ( f l o a t ) r o t x r a d ,( f l o a t ) r o t y r a d ,( f l o a t ) r o t z r a d ) ;

Debug c . V a l i d ( e u l e r ) ;r e t u r n e u l e r ;

}

Listing 2 Quaternion to Euler Angles - Function source code forcalculating XYZ Euler angles from a unit-quaternion orientation.

7.1 Verification

When converting to or from the quaternion format always dothe reverse operation and check that its what you began with(i.e., in debug).

8 Angular Limits

9 Component Decomposition

9.1 Axis-Angle

Quaternion from Axis-Angle: Given a axis of rotationand an angle, we can construct a quaternion:

q =

[cos

2

),n sin

2

)](19)

Page 4: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

4 Ben Kenwright

Fig. 1 Orientation Visualization - Orientation information drawn on a sphere’s surface using Equation 18.

Quaternion to Axis-Angle:θ = 2 cos−1(qw)

nx =qx

sin(θ)

ny =qy

sin(θ)

nz =qz

sin(θ)

(20)

Warning - make sure the value for acos is between -1 to 1,since numerical errors, such as -1.00001 will cause acos totrigger a nan (not a number).

9.2 Matrices

Quaternion to Matrix:1− 2q2y − 2q2z 2qxqy − 2qzqw 2qxqz + 2qyqw2qxqy + 2qzqw 1− 2q2x − 2q2z 2qyqz − 2qxqw2qxqz − 2qyqw 2qyqz + 2qxqw 1− 2q2x − 2q2y

(21)

Quaternion from Matrix: A rotation may be convertedback to a quaternion. First, calculate the trace of the matrix Tfrom the equation: m0 m1 m2

m3 m4 m5

m6 m7 m8

(22)

Trace T = 4− 4x2 − 4y2 − 4z2

= 1 +m0 +m4 +m8(23)

If the trace of the matrix is greater than zero, then performan ”instant” calculation. Important note wrt. rounding errors:

Test if ( T ≥ 0.00000001 ) to avoid large distortions!

S = sqrt(T ) ∗ 2;W = 0.25 ∗ S;

X = (m7−m5)/S;

Y = (m2−m6)/S;

Z = (m3−m1)/S;

(24)

If the trace of the matrix is equal to zero then identifywhich major diagonal element has the greatest value. De-pending on this, calculate the following:

Page 5: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

Quaternions in Practice 5

i f ( m0 > m4 && m0 > m8 ) { / / Column 0 :S = s q r t ( 1 . 0 + m0 − m4 − m8 ) ∗ 2 ;X = 0 . 2 5 ∗ S ;Y = (m4 + m1 ) / S ;Z = (m2 + m6 ) / S ;W = ( mat [ 9 ] − m5 ) / S ;

} e l s e i f ( m4 > m8 ) { / / Column 1 :S = s q r t ( 1 . 0 + m4 − m0 − m8 ) ∗ 2 ;X = (m3 + m1 ) / S ;Y = 0 . 2 5 ∗ S ;Z = (m7 + m5 ) / S ;W = (m2 − m6 ) / S ;

} e l s e { / / Column 2 :S = s q r t ( 1 . 0 + m8 − m0 − m4 ) ∗ 2 ;X = (m2 + m6 ) / S ;Y = (m7 + m5 ) / S ;Z = 0 . 2 5 ∗ S ;W = (m3 − m1 ) / S ;

}

Listing 3 Quaternion to Euler Angles - Function source code forcalculating XYZ Euler angles from a unit-quaternion orientation.

9.3 Logs and Exp

A truly beautiful and interesting feature of quaternions iswhat happens when we take the log of a unit-quaternion. Thelogarithm (i.e., log) of a unit-quaternion is another quater-nion; however, the quaternion vector component is the axis-angle combination and the scalar component is zero [Ebe05].

log(q) = log([qw, qx, qy, qz])

= log([cosθ, u sinθ])

= [0, uθ]

(25)

Similary, the exponential (i.e., exp) of a quaternion is themirror opposite of the logarithm.

exp([0, u θ]) = q

= [qw, qx, qy, qz]

= [cosθ, u sinθ]

(26)

exp(log(q)) = q

log(exp([0, u θ])) = [0, u θ](27)

This remarkably simple and useful feature is proven bymeans the Taylor power series for the exponential, and al-lows us to take a quaternion to a scalar power (i.e., it makesoperations such as interpolation very straightforward andalgorithmically elegant).

10 Interpolation

Interpolation is the process of finding a value between twoknown points. These points maybe be a line or they may bethe surface of a sphere. The interpolation value is typicallybetween 0 and 1, where 0 is the start point, 1 is the end point,and 0.5 would be half way inbetween.

10.1 [L]inear Int[erp]olation (LERP)

q′ = q0 + (q1 − q0)t (t ∈ R) (28)

10.2 [S]pherical [L]inear Int[erp]olation (SLERP)

Slerp(t; q0, q1) =q0sin((1− t)θ) + q1sin(tθ)

sinθ

where 0 ≤ t ≤ 1(29)

10.2.1 Pitfalls - Not always the shortest path

Naively spherically interpolating between two quaternionsusing Equation 29 will not necessarily take you along theshortest path. Since, we might not always want it to take theshortest path, we must identify the shortest and longest. First,a quaternion can be negated and maintain the same uniqueorientation:

q = −q

[w, x, y, z] = [−w,−x,−y,−z](30)

Negating a quaternion enables makes a quaternion take eitherthe longest or shortest path. We can determine which routeby means of the quaternion dot product.

q0 · q1 = q0.w ∗ q1.w+q0.x ∗ q1.x+q0.y ∗ q1.y+q0.z ∗ q1.z

(31)

where the dot product of two quaternions gives us thecosine of the angle between the two rotations. Hence, for the’shortest’ path, we choose dot product result that is greateror equal to zero. Remember between q0 · q1 and q0 · −q1the one that is greater or equal to zero (i.e. ≥ 0) is theshortest route between the two quaternions.Q u a t e r n i o n ShortSLERP ( Q u a t e r n i o n q0 , Q u a t e r n i o n q1 , ←↩

f l o a t 1 ){

/ / Assume u n i t−q u a t e r n i o n s o f l e n g t h onef l o a t d o t = Dot ( q1 , q2 ) ;f l o a t omega = ArcCos ( d o t ) ;f l o a t s i g n = d o t ? −1 : 1 ;Q u a t e r n i o n r e s= ( q0∗Sin ((1− t )∗omega ) + s i g n∗q1∗Sin ( t∗omega ) ) / S in (←↩

omega ) ;r e t u r n r e s ;

}

Listing 4 Quaternion Shortest Route SLERP - Function tocalculating and always return the shortest SLERP between two unit-quaternions.

Page 6: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

6 Ben Kenwright

10.2.2 Divide-by-Zero

A problem with SLERP that people ignore or forget is that forextremely small angles or an angle of zero you can get numer-ical problems (e.g., a divide by zero error). Did you noticethe “divide by sinθ”? Hence, for small angles less than somespecific amount you would use a normalized LERP method(i.e., just interpolate each of the quaternion components andre-normalize the results so it is a unit-quaternion).

11 Calculus

Integration and differentiation might seem daunting and com-plex but, in fact, both are relatively straightforward and canbe deduced from first principles. For example, we show howto derive the well-known differential form for a quaternion,i.e., q = 0.5 ω q, which is often used to represent angularvelocity (Section 11.1).

11.1 Quaternion Differentiation

A sweet and short explanation for differentiation of a quater-nion. First the definition of what we mean by ‘differentiate’(i.e., from first principles):

q =dq

dt= lim

h→0

q(t+ h)− q(t)

h(32)

which is the same for any real or complex function.We are only concerned with unit-quaternions. The unit-

quaternion represents the orientation. When we differentiatethe unit-quaternion we are describing how the orientationchanges with time (i.e., the angular velocity). Multiplyingtwo unit-quaternions results in a unit-quaternion (e.g., q =

q0q1). Hence, we can describe the orientation now and atthe next moment in time as (assuming a constant angularvelocity ω ):

q(0) = q0

q(1) = qωq0(33)

where qω rotate in one time-step.Recall, we have a constant angular velocity, so we can

say:q(2) = qωqωq0

q(3) = qωqωqωq0

...

q(k) = (qω)kq0

(34)

Remember, we are dealing with ‘unit-quaternions’, so qωin polar form is:

qω = cos

2

)+ sin

2

)(nxi+ nyj + nzk) (35)

where ω is the angle, and n is the unit-vector axis of rotation.Important information is we are dealing with a polar formof the equation - essentially, a quaternion version of Euler’sformula. A unit complex number z can be written as:

z = exp(it) = cos(t) + i sin(t) (36)

similarly for a unit-quaternion:

qω = exp

2n

)(37)

hence, we deduce:

(qω)t = exp

(tθ

2n

)(38)

we use the invaluable and popular differential chain-ruleand product-rule formula:

q(t) =d

dt

(qtωq0

)=

θ

2n exp

(tθ

2n

)q0

2n q(t)

(39)

where θn is the angular velocity ω and yields the neat andpopular equation:

q(t) =dq

dt

=1

2(θn) q

=1

2ω q

(40)

12 Experimental Results

Theoretically, quaternions are able to perform simple rota-tional operations faster than pure rotation matrices. However,in practice, quaternions are regularly converted to matricessince transforms usually require translation and scaling inaddition to rotation and for visual rendering the graphicalprocessing unit (GPU) is highly optimized for matrix opera-tions.

Performance: Nevertheless, in reality quaternions are fast.We can perform operations such as concatenation, inversion,interpolation, and re-normalization extremely quickly.

Robustness: Quaternions are not infallible and can sufferfrom numerical drifting. Furthermore, they only representorientations and cannot represent full rigid transforms thatinclude translation. (see Section 14 on dual-quaternions fortranslation and rotation beyond quaternions for more details).

Page 7: Quaternions in Practice - xbdev.net...Quaternions in Practice Converting, Validating, and Understanding Ben Kenwright January 2013 Abstract In this paper, we present a practical overview

Quaternions in Practice 7

Scalability and Sensitivity: Numerical errors can drift inover time and so we must constantly check if our quaternionis a unit-quaternion (i.e., a unit-length). In practice, floats areused to represent the four scalar values (32 bit accuracy).

13 Limitations and Assumptions

Quaternions can be difficult for a beginner to understand,however, they provide numerous advantages over Euler an-gles and matrices for representing rotations.

✓ Rotation concatenation (i.e., it’s faster than matrix rota-tion concatenation)

✓ Quaternion to Matrix (slightly faster than Euler angles tomatrix conversion)

✓ Inverse of a unit-quaternion is the conjugate (extremelyfast and simple)

✓ Quaternion only requires four scalar numbers, while arotation matrix requires nine

✓ Interpolation is fast, smooth, and constant using quater-nion SLERP

✓ Correcting for numerical errors, i.e., by re-normalizingthe quaternion is less error prone and compuationally sim-pler compared to the similar process of orthonormalizinga rotation matrix

✗ Quaternions can drift and become invalid; hence, we needto be aware of this and re-normalize them

✗ The greatest drawback of quaternions is people find themdifficult to understand.

14 Dual-Quaternions

While quaternions have proven themselves as an unabigous,computationally efficient, and straightforward tool for repre-senting rotationals, they provide no translational information.However, one approach has combined quaternions with dual-number theory to create dual-quaternions. Dual-quaternionsexploit the elegant mathematical properties of quaternionsand combine them with dual-number theory to create a uni-fied mathematical tool for representing both orientation andtranslation in a single variable; see Kenwright [Ken12] forfurther details.

15 Conclusions

There are numerous free and commercial quaternion libraries.It is also relatively straightforward to write your own basicclass. However, writing a robust, computationally lighteningfast implementation, takes time and experience. I would rec-ommend to the reader to always look under the hood of otherimplementations to pick up tricks and ideas.

16 Acknowledgments

The author would like to thank the anonymous reviewers fortaking time out of their busy schedules to provide helpfulcriticism and comments to make this a better paper.

References

Ebe05. EBERLY D.: Quaternions algebra and calculus. GeometricTools, LLC (Nov. 2005). 5

Ken12. KENWRIGHT B.: A beginners guide to dual-quaternions:What they are, how they work, and how to use them for 3dcharacter hierarchies. The 20th International Conferenceon Computer Graphics, Visualization and Computer VisionWSCG 2012 Communication Proceedings (2012), 1–13. 7