Quaternion Rotations AUI Course Denbigh Starkey

Similar documents
Quaternions & Rotation in 3D Space

Transformations: 2D Transforms

1 Historical Notes. Kinematics 5: Quaternions

3D Game Engine Programming. Understanding Quaternions. Helping you build your dream game engine. Posted on June 25, 2012 by Jeremiah van Oosten

CS612 - Algorithms in Bioinformatics

2D and 3D Transformations AUI Course Denbigh Starkey

Quaternions and Exponentials

CMSC 425: Lecture 6 Affine Transformations and Rotations

CS354 Computer Graphics Rotations and Quaternions

Visual Recognition: Image Formation

a a= a a =a a 1 =1 Division turned out to be equivalent to multiplication: a b= a b =a 1 b

Quaternion properties: addition. Introduction to quaternions. Quaternion properties: multiplication. Derivation of multiplication

Quaternions and Rotations

3D Rotations and Complex Representations. Computer Graphics CMU /15-662, Fall 2017

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

Quaternions. Mike Bailey. A Useful Concept: Spherical Linear Interpolation. sin(1 t) sin t

Quaternions and Euler Angles

Lecture Note 3: Rotational Motion

Quaternions and Dual Coupled Orthogonal Rotations in Four-Space

Anatomical Descriptions That Compute Functional Attributes

CS770/870 Spring 2017 Quaternions

Rotation with Quaternions

Orientation & Quaternions

Quaternion to Euler Angle Conversion for Arbitrary Rotation Sequence Using Geometric Methods

3D Transformations and Complex Representations. Computer Graphics CMU /15-662, Fall 2016

ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 COORDINATE TRANSFORMS. Prof. Steven Waslander

Quaternions and Rotations

3D Kinematics. Consists of two parts

Introduction to quaternions. Mathematics. Operations

Basics of Computational Geometry

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

Rotations in 3D Graphics and the Gimbal Lock

Animation and Quaternions

12.1 Quaternions and Rotations

Inertial Measurement Units II!

Animating orientation. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Quaternions and Rotations

Quaternions and Rotations

CS184: Using Quaternions to Represent Rotation

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

AH Matrices.notebook November 28, 2016

Rotation and Orientation: Fundamentals. Perelyaev Sergei VARNA, 2011

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

+ i a y )( cosφ + isinφ) ( ) + i( a x. cosφ a y. = a x

Mathematics (

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

Parallel and perspective projections such as used in representing 3d images.

QUATERNIONS AND ROTATIONS

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Lecture 9: Transformations. CITS3003 Graphics & Animation

Lecture «Robot Dynamics»: Kinematics 2

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

JUST THE MATHS SLIDES NUMBER 5.2. GEOMETRY 2 (The straight line) A.J.Hobson

Vector Calculus: Understanding the Cross Product

Structure in Quaternions Corresponding to the 4-Dimensional Tetrahedron

Fundamentals of Computer Animation

SPECIAL TECHNIQUES-II

Section 13.5: Equations of Lines and Planes. 1 Objectives. 2 Assignments. 3 Lecture Notes

Fundamentals of Structural Geology Exercise: concepts from chapter 2

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Computer Graphics with OpenGL ES (J. Han) Chapter IV Spaces and Transforms

Math (Spring 2009): Lecture 5 Planes. Parametric equations of curves and lines

Monday, 12 November 12. Matrices

The Three Dimensional Coordinate System

Chapter 3 : Computer Animation

SOME CONCEPTS IN DISCRETE COSINE TRANSFORMS ~ Jennie G. Abraham Fall 2009, EE5355

Position and Orientation Control of Robot Manipulators Using Dual Quaternion Feedback

Functions and Transformations

Rotation parameters for model building and stable parameter inversion in orthorhombic media Cintia Lapilli* and Paul J. Fowler, WesternGeco.

Computer Science 336 Fall 2017 Homework 2

Linear Algebra Part I - Linear Spaces

To graph the point (r, θ), simply go out r units along the initial ray, then rotate through the angle θ. The point (1, 5π 6. ) is graphed below:

Lesson 20: Exploiting the Connection to Cartesian Coordinates

Animation. The Alpha and Interpolator of Java 3D

Transformations (Rotations with Quaternions) October 24, 2005

Fall 2016 Semester METR 3113 Atmospheric Dynamics I: Introduction to Atmospheric Kinematics and Dynamics

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Chapter 18 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M. Cargal.

The Rectangular Coordinate System and Equations of Lines. College Algebra

Polar Coordinates. Chapter 10: Parametric Equations and Polar coordinates, Section 10.3: Polar coordinates 27 / 45

Coordinate Frames and Transforms

Proof of Constant Width of Spheroform with Tetrahedral Symmetry

Visualizing Quaternion Multiplication

Polar Coordinates. 2, π and ( )

CS5620 Intro to Computer Graphics

CS 475 / CS 675 Computer Graphics. Lecture 16 : Interpolation for Animation

To graph the point (r, θ), simply go out r units along the initial ray, then rotate through the angle θ. The point (1, 5π 6

PSE Game Physics. Session (3) Springs, Ropes, Linear Momentum and Rotations. Oliver Meister, Roland Wittmann

1.5 Equations of Lines and Planes in 3-D

Position Analysis

Vector Algebra Transformations. Lecture 4

Abstract. Introduction

BASIC ELEMENTS. Geometry is the study of the relationships among objects in an n-dimensional space

Straight Line motion with rigid sets

Animation. Animation

Planar Robot Kinematics

NURBS: Non-Uniform Rational B-Splines AUI Course Denbigh Starkey

Transcription:

Major points of these notes: Quaternion Rotations AUI Course Denbigh Starkey. What I will and won t be doing. Definition of a quaternion and notation 3 3. Using quaternions to rotate any point around an arbitrary axis 5 4. Quaternion rotation example 6 5. Another rotation example 8 6. Multiple rotations 9

. What I will and won t be doing In these notes I ll be defining quaternions, and I ll be showing how they can be used to rotate a point (and hence an object) around an axis. I won t, however, be covering any of the underlying mathematics of quaternions, except as is necessary to perform the calculations. So, for example, I ll state that the inverse of a unit quaternion (s, v) is (s, -v), but won t prove that this is correct, and I won t discuss the inverse of a general (non-unit) quaternion. I ll cover these in the next set of notes, along with the rest of the underlying mathematics.

. Quaternion definition and quaternion notation Quaternions, which were first defined by Hamilton in three papers (or at least these are the first three that I can find) in 844 and 845, are essentially multi-dimensional complex numbers. Whereas a standard complex number has a scalar component and an imaginary component, with quaternions the imaginary part is an imaginary vector based on three imaginary orthogonal axes. All of that sounds weird, but it turns out that quaternions are both relatively simple and very effective for rotations. A quaternion is defined using a scalar component, s, and an imaginary vector component v = (iv, jv, kv 3 ). I ll write this in three equivalent ways: q = (s, v) q = (s, v, v, v 3 ) q = (s + iv + jv + kv 3 ) and I ll switch between these three forms without warning, as I need. If the scalar component, s, is zero, then the quaternion is called a pure quaternion. First I need to define i, j, and k. They are imaginary orthogonal unit vectors which satisfy the following equations. i = j = k = - ij = k = -ji jk = i = -kj ki = j = -ik We ll also need a couple of quaternion properties, the magnitude of a quaternion and how to multiply two quaternions. The size, or magnitude, of q = (s, v) is given by q = s + v. Quaternion multiplication is defined in the obvious way. I.e., q q = (s + v i + v j + v 3 k) (s + v i + v j + v 3 k) = (s s + s v i + s v j + s v 3 k + v s i + + v 3 v kj + v 3 v 3 k ). 3

Then we just have to substitute k for ij, - for i, etc., in these 6 terms and we are done. We can also, by rearranging the terms, define quaternion multiplication using dot product and cross product to simplify the result. For example, the scalar terms in the product above will come from s = s s + v v i + v v j + v 3 v 3 k = s s (v v + v v + v 3 v 3 ) = s s v. v from first replacing the square terms with - and then using the definition of dot product. Similarly, we can collect other terms, and get: q q = (s s v. v, s v + s v + v! v ) 4

3. Using quaternions for rotations around an arbitrary axis To rotate a point (x, y, z) by an angle θ counterclockwise around an arbitrary avis through the origin which is defined by a unit vector u, we compute where P = q P q - P = (0, x, y, z) is a pure quaternion whose imaginary part is the point, q = (cos(! ), sin(! )u), and q - = (cos(! ), -sin(! )u). The three quaternions on the right hand side of the equation for P are multiplied using quaternion multiplication. The new quaternion P will, like P, be pure (i.e., its real component will be zero), and its imaginary components will contain the transformed point. In the next section I ll give an example of this. 5

4. Quaternion Rotation Example Assume that we want to rotate the Cartesian point (,, -) 90 around the Z axis, which is defined by the unit vector (0, 0, ). Since Z will be fixed, this is a simple D rotation, and we can easily see that the new point should be (-,, -). Since sin(45 ) = cos(45 ) =, we have and so q = (, (0, 0, )) = (, 0, 0, ) P = (0,,, -) q - = (, - (0, 0, )) = (, 0, 0, - qp = ( + k) (i + j k) ( + k) (i +j k) = = = = (i + j k + ki + kj k ) (i + j k + j i + ) ( i + 3j k) ) qpq - = ( i + 3j k) ( k) = ( k i + ik + 3j 3jk k + k ) = ( k i j + 3j 3i k ) = (0 4i + j k) = (0, -,, -) P, the transformed point, is the imaginary part of this pure quaternion, which is (-,, -), as expected. As an alternative to the individual multiplications, I could have (twice) used the definition on quaternion multiplication that uses dot and cross products given above, q q = (s s v. v, s v + s v + v! v ) Using that approach I would have had 6

qpq - = (, (0, 0, )) (0, (,, -)) (, (0, 0, -)) = (0 (-), (,, -) + (-,, 0)) (, (0, 0, -)) = (, (-, 3, -)) (, (0, 0, -)) = (, (0, 0, -) + (-, 3, -) + (-3, -, 0)) = (0, (-4,, -)) which is once again the point (-,, -). 7

5. Another rotation example Now I ll try rotating the point ( 3,, 0) counterclockwise 60 around the Z axis. Since cos(30 ) = 3 and sin(30 ) =, we have: P = ( 3, 0, 0, ) (0, 3,, 0) ( 3, 0, 0, - ) = 4 ( 3 + k) ( 3 i + j) ( 3 k) = 4 (3i + 3 j + 3 ki + kj) ( 3 k) = 4 (3i + 3 j + 3 j i) ( 3 k) = (i + 3 j) ( 3 k) = ( 3 i ik + 3j 3 jk) = ( 3 i + j + 3j 3 i) = j = (0, 0,, 0) So the transformed point is (0,, 0). A simple diagram should persuade you that this is correct: ( 3,, 0) 60 30 8

6. Multiple rotations Usually we won t be doing a single rotation, but will be doing a series of rotations in an animation. E.g., say that we have a sequence of rotations defined, in time order, by the quaternions q, q,, q n, We ll need to compute P = q n q q Pq - q - q n - Fortunately quaternion multiplication is associative, and also q - q - q n - = (q n q q ) -. So we just use repeated multiplications to compute a single combined unit quaternion q = q n q q = (s, v) and the inverse will then be (s, -v). 9