Visualizing Quaternions

Similar documents
Visualizing Quaternions

Part II: OUTLINE. Visualizing Quaternions. Part II: Visualizing Quaternion Geometry. The Spherical Projection Trick: Visualizing unit vectors.

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

Orientation & Quaternions

Revision Problems for Examination 2 in Algebra 1

CS354 Computer Graphics Rotations and Quaternions

Quaternions and Exponentials

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

2D/3D Geometric Transformations and Scene Graphs

VISUALIZING QUATERNIONS

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

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

Quaternions and Rotations

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

Jorg s Graphics Lecture Notes Coordinate Spaces 1

Visualizing Quaternions Course Notes for SIGGRAPH 99

Linear algebra deals with matrixes: two-dimensional arrays of values. Here s a matrix: [ x + 5y + 7z 9x + 3y + 11z

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

Geometric Transformations

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Lecture Note 3: Rotational Motion

AH Matrices.notebook November 28, 2016

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

Kinematic Synthesis. October 6, 2015 Mark Plecnik

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

Vector Algebra Transformations. Lecture 4

Tentti/Exam Midterm 2/Välikoe 2, December

DD2429 Computational Photography :00-19:00

Visual Recognition: Image Formation

, etc. Let s work with the last one. We can graph a few points determined by this equation.

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

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Quaternions and Rotations

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

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

An idea which can be used once is a trick. If it can be used more than once it becomes a method

Space Curves of Constant Curvature *

AQA GCSE Further Maths Topic Areas

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

3.7. Vertex and tangent

First of all, we need to know what it means for a parameterize curve to be differentiable. FACT:

Quaternion Frenet Frames: Making Optimal Tubes and Ribbons from Curves

Computer Animation. Rick Parent

Jacobian: Velocities and Static Forces 1/4

Shape Modeling and Geometry Processing

Geometric Modeling Mortenson Chapter 11. Complex Model Construction

Analysis of Euler Angles in a Simple Two-Axis Gimbals Set

Autonomous Navigation for Flying Robots

Inverse Kinematics Programming Assignment

Background for Surface Integration

Rotations for N-Dimensional Graphics

1. The Pythagorean Theorem

Reminder: Lecture 20: The Eight-Point Algorithm. Essential/Fundamental Matrix. E/F Matrix Summary. Computing F. Computing F from Point Matches

Tangent & normal vectors The arc-length parameterization of a 2D curve The curvature of a 2D curve

Linear Transformations

CS612 - Algorithms in Bioinformatics

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving

Properties of Bertrand curves in dual space

MOTION OF A LINE SEGMENT WHOSE ENDPOINT PATHS HAVE EQUAL ARC LENGTH. Anton GFRERRER 1 1 University of Technology, Graz, Austria

Lecture 9: Transformations. CITS3003 Graphics & Animation

Chapter 6. Curves and Surfaces. 6.1 Graphs as Surfaces

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

FOUNDATION HIGHER. F Autumn 1, Yr 9 Autumn 2, Yr 9 Spring 1, Yr 9 Spring 2, Yr 9 Summer 1, Yr 9 Summer 2, Yr 9

Accurate Computation of Quaternions from Rotation Matrices

(Discrete) Differential Geometry

Know it. Control points. B Spline surfaces. Implicit surfaces

Geometric Algebra. 8. Conformal Geometric Algebra. Dr Chris Doran ARM Research

Jacobian: Velocities and Static Forces 1/4

Matrix Inverse 2 ( 2) 1 = 2 1 2

Animation Curves and Splines 2

3D Geometry and Camera Calibration

x = 12 x = 12 1x = 16

Sung-Eui Yoon ( 윤성의 )

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

CS770/870 Spring 2017 Quaternions

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

Honors Precalculus: Solving equations and inequalities graphically and algebraically. Page 1

CS184: Using Quaternions to Represent Rotation

Coordinate Transformations in Advanced Calculus

COMP 558 lecture 19 Nov. 17, 2010

Quaternions and Euler Angles

Unit Circle. Project Response Sheet

A Short Introduction to Projective Geometry

CS 130 Final. Fall 2015

Linear transformations Affine transformations Transformations in 3D. Graphics 2009/2010, period 1. Lecture 5: linear and affine transformations

FURTHER MATHS. WELCOME TO A Level FURTHER MATHEMATICS AT CARDINAL NEWMAN CATHOLIC SCHOOL

Quaternions and Dual Coupled Orthogonal Rotations in Four-Space

Aalto CS-C3100 Computer Graphics, Fall 2016

Vectors and the Geometry of Space

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

10-2 Circles. Warm Up Lesson Presentation Lesson Quiz. Holt Algebra2 2

More Ways to Solve & Graph Quadratics The Square Root Property If x 2 = a and a R, then x = ± a

MEI Desmos Tasks for AS Pure

Fundamentals of Computer Animation

Transcription:

Visualizing Quaternions Andrew J. Hanson Computer Science Department Indiana University Siggraph 1 Tutorial 1

GRAND PLAN I: Fundamentals of Quaternions II: Visualizing Quaternion Geometry III: Quaternion Frames IV: Clifford Algebras

I: Fundamentals of Quaternions Motivation D Frames: Simple example, complex numbers. 3D Frames: Rotations and quaternions. 3

II: Visualizing Quaternion Geometry The Spherical Projection Trick: unit vectors. Visualizing Quaternion Frames Quaternion Curves Quaternion Splines 4

III: Quaternion Frames Quaternion Curves: generalize the Frenet Frame Quaternion Frame Evolution Quaternion Curve and Surface Optimization 5

IV: Clifford Algebras Clifford Algebras: Generalize quaternion structure to N-dimensions Reflections and Rotations: New ways of looking at rotations Pin(N), Spin(N), O(N), and SO(N)

Visualizing Quaternions Part I: Fundamentals of Quaternions Andrew J. Hanson Indiana University

Part I: OUTLINE Motivation D Frames: Simple example, complex numbers. 3D Frames: Rotations and quaternions. 8

Motivation Quaternion methods are now commonplace in graphics. Quaternions are very geometric, but we seldom attempt to visualize their properties geometrically. That s going to be our job today! 9

Basic Issues Basic fact number 1: Rotation matrices are Coordinate Frame Axes. Basic fact number : Rotation matrices form groups, which have geometric properties. 1

Task vs Strategy Our task: Understand Rotations. Rotations don t just act on geometry, rotations are geometry. Our strategy: the geometry should help us to visualize the properties of rotations. 11

Simple Example: D Rotations D rotations ) geometric origin for complex numbers. Complex numbers are a special subspace of quaternions. Thus D rotations introduce us to quaternions and their geometric meaning. 1

Frames in D The tangent and normal to D curve move continuously along the curve: N^ T^ θ 13

Frames in D The tangent and normal to D curve move continuously along the curve: N^ T^ θ 14

Frames in D The tangent and normal to D curve move continuously along the curve: N^ T^ θ 15

5 : Frame Matrix in D This motion is described at each point (or time) by the matrix: R () = h ^T ^N i 3 4, sin cos cos sin = 1

A,B 4 A B 5 : Another D Frame If we did not know about cos + sin = 1, we might represent the frame differently, e.g., as: 3 R (A; B) = with the constraint A + B = 1. 1

The Belt Trick: Is There a Problem? Demonstration: Rotations want to be doubled to get back where you started. See: Hart, Francis, and Kauffman. 18

4 cos, sin, cos sin cos sin cos, sin 5 Half-Angle Transform: A Fix for the Problem? 3 R () = 19

a, b,ab 4 a, b ab 5 : Half-Angle Transform: A Fix for the Problem? Or, with a = cos(=), b = sin(=), (i.e., A = a, b, B = ab), we could parameterize as: 3 R (a; b) = where orthonormality implies + b ) = 1 (a which reduces back a to + b = 1.

a, b,ab 4 a, b ab 5 : Half-Angle Transform: So the pair (a; b) provides an odd double-valued parameterization of the frame: 3 h ^T ^N i = where (a; b) is precisely the same frame as (,a;,b). 1

_^T(t) = + ^N 5 : Frame Evolution in D Examine time-evolution of D frame (on our way to 3D): First in (t) coordinates: 3 h ^T ^N i = 4, sin cos cos sin Differentiate to find frame equations: =,^T ; _^N(t) (t) = d=dt where is the curvature.

4 _^T(t) _^N(t) = 5 +(t) 4,(t) ^T(t) ^N(t) Frame Evolution in D Rearrange to make a vector matrix: 3 3 3 5 5 4 3

_^T = a_a, b _b 4 + b_a a_b a,b 4 a b 4 _a _b Frame Evolution in (a; b): Using the basis (^T; ^N) we have Four equations with Three constraints from orthonormality, for One true degree of freedom. Major Simplification occurs in (a; b) coordinates!! 3 3 3 = 5 5 5 4

,ab 4, b a a,b 4 a b a,b 4 a b,1 4 1 4 a b,b 4 a Frame Evolution in (a; b): But this formula for _^T is just ^N, where 3 3 ^N = 3 = 5 5 5 or 3 3 3 5 5 5 ^N = 5

4 _a _b, 4 + 4 a b D Quaternion Frames! Rearranging terms, both _^T and _^N eqns reduce to 3 3 3 5 5 = 1 5 This is the square root of frame equations.

_^T = + ^N D Quaternions... So one equation in the two quaternion variables (a; b) with the constraint a +b = 1 contains both the frame equations _^N =,^T ) this is much better for computer implementation, etc.

Rotation as Complex Multiplication If we let (a + ib) = exp (i =) we see that rotation is complex multiplication! Quaternion Frames in D are just complex numbers, with Evolution Eqns = derivative of exp (i =)! 8

(a a + ib = e i= ib i( )(a + ib) = e +)= A + ib = + )R()=R( R( A, B,AB 4 A, B AB Rotation with no matrices! This is the miracle: represents rotations more nicely than the matrices R(). where if we want the matrix, we write: 3 5 + )= 9

; b ) (a; b) = (a (a ib )(a + ib) + a a, b b + i(a b + ab ) = = (aa, bb; ab + ab) The Algebra of D Rotations The algebra corresponding to D rotations is easy: just complex multiplication!! = (A; B) 3

The Geometry of D Rotations (a; b) with a + b = 1 is a point on the unit circle, also written S 1. Rotations are just complex multiplication, and take you around the unit circle like this: (a a-b b, a b+ab ) (a, b ) θ + θ θ / θ/ (a,b) (1,) 31

The Geometry of D Rotations (a; b) with a + b = 1 is a point on the unit circle, also written S 1. Rotations are just complex multiplication, and take you around the unit circle like this: (a a-b b, a b+ab ) (a, b ) θ + θ θ / θ/ (a,b) (1,) 3

The Geometry of D Rotations (a; b) with a + b = 1 is a point on the unit circle, also written S 1. Rotations are just complex multiplication, and take you around the unit circle like this: (a a-b b, a b+ab ) (a, b ) θ + θ θ / θ/ (a,b) (1,) 33

Quaternion Frames In 3D, repeat our trick: take square root of the frame, but now use quaternions: Write down the 3D frame. Write as double-valued quadratic form. Rewrite linearly in the new variables. 34

The Geometry of 3D Rotations We begin with a basic fact: Euler theorem: every 3D frame can be written as a spinning by about a fixed axis ^n, the eigenvector of the rotation matrix: n ^ θ 35

The Geometry of 3D Rotations We begin with a basic fact: Euler theorem: every 3D frame can be written as a spinning by about a fixed axis ^n, the eigenvector of the rotation matrix: n ^ θ 3

The Geometry of 3D Rotations We begin with a basic fact: Euler theorem: every 3D frame can be written as a spinning by about a fixed axis ^n, the eigenvector of the rotation matrix: n ^ θ 3

c + (n 1 ) (1, c) n 1 n (1, c), sn 3 n 3 n 1 (1, c) + sn Quaternion Frames... Matrix giving 3D rotation by about axis ^n: R 3 (; ^n) = 3 1 n (1, c) + sn 3 c + (n ) (1, c) n 3 n (1, c), sn 1 n 1 n 3 (1, c), sn n n 3 (1, c) + sn 1 c + (n 3 ) (1, c) n 4 5 where c = cos, s = sin, and ^n ^n = 1. 38

Quaternion Frame Parameters To find and axis ^n, givenany rotation matrix or frame M, we need two steps: ) solve for. TrM = 1 + cos M, M t = 3,n 3 sin +n sin 3 sin,n 1 sin +n 4 5,n sin +n 1 sin ) solve for ^n as long as =. 39

Quaternions and Rotations Some set of axes can be chosen as the identity matrix: y 1 = 1 z 11 1111 x 1 4

Quaternions and Rotations Any arbitrary set of axes forms the columns of an orthogonal rotation matrix: b 1 11 11 11 1 1 11 1 1 1 c 11 11 a a a x y z b b x = a b c y z c c x y z 41

Quaternions and Rotations Any arbitrary set of axes forms the columns of an orthogonal rotation matrix: c b 11 11 11 11 111 11 1 11 1 1 111 a a a x y z b b x = a b c y z c c x y z 4

Quaternions and Rotations Any arbitrary set of axes forms the columns of an orthogonal rotation matrix: c b 1 1 1 1 11 1 1111 11 11 11 a 11 a a x y z b b x = a b c y z c c x y z 43

Quaternions and Rotations Any arbitrary set of axes forms the columns of an orthogonal rotation matrix: c 1 b 1 1 1 1 1 111 11 a a a x y z b b x = a b c y z c c x y z 44

Quaternions and Rotations By Euler s theorem, that matrix has an eigenvector ^n, and so is representable as a single rotation about ^n applied to the identity: b 11 11 11 11 1 11 1 1 11 c 11 11 a = y a a a x y z b b b x y z c c c x y z = ^ n θ z 11 11 11 1 111111111111 x = 1 1 1 45

4 a, b,ab 4 a, b ab q + q 1, q, q 3 q 1 q, q q 3 q 1 q 3 + q q 1 q + q q 3 q, q 1 + q, q 3 q q 3, q q 1 q 1 q 3, q q q q 3 + q q 1 q, q 1, q + q 3 q 5 Rotations and Quadratic Polynomials Remember R () = 5? 3 What if we try a 3 3 matrix R 3 instead of? 3 Hint: set q 1 = q = or any other (i = j) pair to see a familiar sight! 4

Quaternions and Rotations Why does this matrix parameterize a rotation? Because Columns R of (q ; q 1 ; q ; q 3 ) 3 are orthogonal: col i col = j i = j for What is LENGTH of 3-vector column? col i col = (q i q 1 + q + q 3 ) + 4

Quaternions and Rotations... So if we q require + q 1 + q + q 3 = 1, orthonormality is assured and 3 (q ; q 1 ; q ; q 3 ) is a rotation. R This q implies is a point on 3-sphere in 4D. NOTE: q ),q gives same R 3 (). 48

Quaternions and Rotations... HOW does q = (q ; q) represent rotations? LOOK at R 3 (; ^n)? = R 3(q ; q 1 ; q ; q 3 ) NOTICE: Choosing q(; ^n) = (cos ; ^n sin ) makes the R 3 equation an IDENTITY. 49

)R(q) = R(Q) R(q Quaternions and Rotations... WHAT happens if you do TWO rotations? EXAMINE the action of two rotations EXPRESS in quadratic forms in q and LOOK FOR an analog of complex multiplication: 5

4 Q = h q q i Q 1 = h q q i 1 Q = h q q i Q 3 = h q q i 3 5 4 q q, q 1 q 1, q q, q 3 q 3 q q 1 + q 1 q + q q 3, q 3 q q q + q q + q 3 q 1, q 1 q 3 q q 3 + q 3 q + q 1 q, q q 1 5 Quaternions and Rotations... RESULT: the following multiplication rule q = Q yields exactly the correct 3 3 rotation q matrix R(Q): 3 3 = This is Quaternion Multiplication. 51

Algebra of Quaternions = 3D Rotations! D rotation matrices are represented by complex multiplication 3D rotation matrices are represented by quaternion multiplication 5

; b ) (a; b) = (a a, b b; a b + ab ) (a q q = (q q q, q1q 1, qq, q3q 3 ; q + qq + q3q 1, q1q 3 ; q q Algebraic D/3D Rotations Therefore in 3D, the D complex multiplication is replaced by 4D quaternion multiplication: q 3, q q 1 + q 1 q + q 3 q ; 1 q, q q 3 + q 3 q + q q 1) 53

Algebra of Quaternions... The is easier to remember by dividing it into the scalar piece q and the vector piece ~q: q q = (q q, ~ q ~q; q ~q + q ~ q + ~ q ~q) 54

a + ib = e i= = q + iq 1 + jq + kq 3 = e (I^n=) Quaternions and Rotations Another miracle: let us generalize the D equation How? We set q = (q ; q 1 ; q ; q 3 ) with q = cos(=) and ~q = ^n sin(=) and I = (i; j; k). 55

Quaternions and Rotations... Then if we take i = j = k =,1, and i j = k (cyclic), quaternion multiplication rule is automatic! ) q = q + iq 1 + jq + kq 3 is the standard representation for a quaternion, and we can also use Pauli matrices in place of (i; j; k) if we want. 5

Key to Quaternion Intuition Fundamental Intuition: We know q = cos(=); ~q = ^n sin(=) We also know that any coordinate frame M canbewritten as M = R(; ^n). Therefore ~q points exactly along the axis we have to rotate around to go from identity I to M, and the length of ~q tells us how much to rotate. 5

4 p] [q p] 1 [q p] [q p] 3 [q 5 4 p, q 1 p 1, q p, q 3 p 3 q p 1 + q 1 p + q p 3, q 3 p q p + q p + q 3 p 1, q 1 p 3 q p 3 + q 3 p + q 1 p, q p 1 q 5 Summarize Quaternion Properties Unit four-vector. Take q = (q ; q 1 ; q ; q 3 ) = (q ; ~q) to obey q q = constraint 1. Multiplication rule. The quaternion product q and p is q p = (q p, ~q ~p; q ~p + p ~q + ~q ~p), or, alternatively, 3 3 = 58

4 q + q 1, q, q 3 q 1 q, q q 3 q 1 q 3 + q q 1 q + q q 3 q, q 1 + q, q 3 q q 3, q q 1 q 1 q 3, q q q q 3 + q q 1 q, q 1, q + q 3 q 5 Quaternion Summary... Rotation Correspondence. The unit quaternions q and,q correspond to a single 3D rotation R 3 : 3 59

Quaternion Summary... Rotation Correspondence. Let q = (cos ; ^n sin ) ; with ^n a unit 3-vector, ^n ^n = 1. Then R(; ^n) is usual 3D rotation by in the plane? to ^n. Inversion. Any 3 3 matrix R can be inverted for q up to a sign. Carefully treat singularities! Can choose sign, e.g., by local consistency, to get continuous frames.

SUMMARY Complex numbers represent D frames. Complex multiplication represents D rotation. Quaternions represent 3D frames. Quaternion multiplication represents 3D rotation. 1