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

Similar documents
Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

CS354 Computer Graphics Rotations and Quaternions

Quaternion Rotations AUI Course Denbigh Starkey

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

Rotations in 3D Graphics and the Gimbal Lock

Transformations: 2D Transforms

CS184: Using Quaternions to Represent Rotation

CMSC 425: Lecture 6 Affine Transformations and Rotations

CS612 - Algorithms in Bioinformatics

12.1 Quaternions and Rotations

Vector Algebra Transformations. Lecture 4

3D Kinematics. Consists of two parts

Quaternions and Rotations

Quaternions and Rotations

Rotational Joint Limits in Quaternion Space. Gino van den Bergen Dtecta

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

Quaternions and Rotations

Introduction to quaternions. Mathematics. Operations

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

Orientation & Quaternions

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

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

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

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Animation. Animation

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

Rotation with Quaternions

AH Matrices.notebook November 28, 2016

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Quaternions and Dual Coupled Orthogonal Rotations in Four-Space

Quaternions and Rotations

2D and 3D Transformations AUI Course Denbigh Starkey

Visual Recognition: Image Formation

Fundamentals of Computer Animation

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

CS770/870 Spring 2017 Quaternions

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

1 Historical Notes. Kinematics 5: Quaternions

Geometric Transformations

Animation and Quaternions

Quaternions and Exponentials

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

Chapter 1: Number and Operations

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

Homework 5: Transformations in geometry

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

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

Chapter 5. Transforming Shapes

Quaternions & Rotation in 3D Space

Game Mathematics. (12 Week Lesson Plan)

Notes on Spherical Geometry

2D/3D Geometric Transformations and Scene Graphs

Chapter 2 - Basic Mathematics for 3D Computer Graphics

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

Lecture Note 3: Rotational Motion

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

Finite Math - J-term Homework. Section Inverse of a Square Matrix

An Interesting Way to Combine Numbers

QUATERNIONS AND ROTATIONS

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

Animation Curves and Splines 2

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

Polynomials. Math 4800/6080 Project Course

Quadratic Equations over Matrices over the Quaternions. By Diana Oliff Mentor: Professor Robert Wilson

Chapter 2: Transformations. Chapter 2 Transformations Page 1

Transforms. COMP 575/770 Spring 2013

Basics of Computational Geometry

Answers. Chapter 2. 1) Give the coordinates of the following points:

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

Vector Calculus: Understanding the Cross Product

Note: Definitions are always reversible (converse is true) but postulates and theorems are not necessarily reversible.

Quaternions and Euler Angles

CS 130 Final. Fall 2015

Skill 1: Multiplying Polynomials

Lagrange Multipliers and Problem Formulation

Using Algebraic Geometry to Study the Motions of a Robotic Arm

A Detailed Look into Forward and Inverse Kinematics

3D Rotation: more than just a hobby

How to Do Word Problems. Building the Foundation

2-9 Operations with Complex Numbers

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

Section 12.1 Translations and Rotations

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

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

CS4620/5620. Professor: Kavita Bala. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

Lesson Plan #001. Class: Geometry Date: Wednesday September 9 th, 2015

Engineering Mechanics Prof. Siva Kumar Department of Civil Engineering Indian Institute of Technology, Madras Statics - 4.3

Geometry. Topic 1 Transformations and Congruence

Transformations Week 9, Lecture 18

2-D Geometry for Programming Contests 1

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

XPM 2D Transformations Week 2, Lecture 3

Visualizing Quaternions

Monday, 12 November 12. Matrices

Did you say transformations or transformers?

11.2 RECTANGULAR COORDINATES IN THREE DIMENSIONS

1 Affine and Projective Coordinate Notation

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

Transcription:

MATH 245 Extra Effort ( points) My assistant read through my first draft, got half a page in, and skipped to the end. So I will save you the flipping. Here is the assignment. Do just one of them. All the rest is just my idea about putting some information together. For the extra credit, choose one of the following.. Prove Formula an and all of the Claims in the text below. Show all work. 2. Find a C++ library (or class) for quaternion multiplication or write a simple one of your own. Use it to π rotate the unit sphere about the axis 2,,2 by. In particular, find the image of points (,,), 3 (,,), and (,,) under the rotation. Turn in the source code, the rotation quaternion, and the images. 3. Use the quaternion multiplication package in Mathematica to perform the same rotation described in 2. Turn in the Mathematica notebook. It should include the rotation quaternion used, the images of the three points, and a graph of the unit sphere showing (,,), the axis of rotation, and the image of (,,) under the rotation. A Little Algebra At some point in your early mathematical history you learned how to multiply and divide real numbers. The real numbers correspond to the real line or R. There is a multiplicative identity, namely, since a =a for every real number. Every non-zero number has a multiplicative inverse, namely its reciprocal: a a= a a =a a = Division turned out to be equivalent to multiplication: a b= a b =a b. Later on, you learned the arithmetic of complex numbers, including division. What you may not have thought about was that you can think of any complex number as an ordered pair: a + bi corresponds to (a,b). Thus, complex arithmetic can be thought of as arithmetic on ordered pairs; ie, the real plane, R 2 via the operations (a,b)+ (c,d)=(a+ c,b+ d ) (a,b) (c,d )=(a c,b d) (a,b) (c, d )=(ac bd, ad + bc) (a,b) (,)=(a, b) (a,b) =, b) =(a (a,b) (a,b) where (a, b) = + The last expression is sometimes called the modulus of (a,b) and (a,-b) is the conjugate of (a,b), sometimes denoted as (a,b). In R 3, we have learned to associate points with position vectors and can add and subtract in a sensible way; ie, component-wise, a natural extension of the case in R 2. Now we come to a problem. There does not seem to be a natural way to extend multiplication via vectors. We have two vector products, the dot and cross products, which while very useful, do not extend to division; there is no multiplicative identity and so no multiplicative identity, hence no equivalence with division. Question : Is it possible to sensibly multiply and divide ordered triples? A Little Geometry Let's turn to the geometry and transformations of real spaces, especially objects in those spaces (lines, points, angles). For now, we will restrict our attention to rigid transformations, those that preserve length and angles. This omits a lot of transformations, including scaling and shearing. In R, the only rigid transformations are translation, x x+ a, and reflection about the origin, x x.

In R 2, we have both of these and we pick up rotation as well. For translation, we have (x, y) ( x+ a, y+ b). For reflection, we are no longer restricted to the origin, but have two axes we can reflect in: (x, y) ( x, y) reflects in the y-axis and (x, y) ( x, y) reflects in the x-axis. (With the help of rotation, we will be able to reflect in an arbitrary line through the origin.) To represent rotations, we are going to use matrix multiplication. Let θ be any angle and [ x be the column matrix that represents an y] arbitrary point (x,y). Then [ ] [ x y] = [ x' y '] gives the rotation in matrix form where (x', y') is the image of (x,y) under the rotation. This transformation has an inverse, namely rotation by θ. To reflect in an arbitrary line through the origin, rotate it to line up with the x-axis, perform the reflection, then rotate back. It is worth noting that x-axis reflection also has a matrix representation [ ] [ x y] [ = x y] so that the reflection can be represented as a string of matrix multiplications. It is worth noting at this point that these reflections and rotations are linear transformations, a field of intense study and application (consider putting Linear Algebra on your course list). In fact, they are the only rigid linear transformations of R 2. (If you would like to see how to program 2D transformations in Excel, click here.) Reflection in the x-axis can be represented in the complex plane as conjugation: z z. Rotation in the plane can also be expressed in complex form: r e i θ r e i (θ+ α ) where α is the angle of rotation. (Nice, isn't it?) In R 3 the situation becomes a bit more complex. For the most part, things extend nicely from R 2. Since translations are not linear transformations, we omit them here. However, we have reflection in three coordinate planes: (x, y, z) ( x, y, z), (x, y, z) (x, y, z), and (x, y, z) (x, y, z) reflect in yz-, xz-, and xy-planes, respectively. We also have rotation about 3 coordinate axes which, as in the case of R 2, have matrix representations: R x= [ ], R y= [ cos θ ], R z= [ ] Rotation about an arbitrary axis through the origin can be decomposed into three basic rotations and hence, three matrix multiplications. The angles associated with each rotation are called the Euler angles. This seems very straightforward at first but suffers from a few drawbacks: computational inefficiency, non-uniqueness of the decomposition, and in computer graphics the transition through multiple rotations may not be smooth. Question 2: Is there hope for a simple way to obtain rotations in R 3 that avoids some or all of these difficulties? Gimbal Lock? I personally became acquainted with gimbal lock while researching this assignment so I will not pretend to know much about it. It occurs in 3D computer graphics, robotics, aeronautical guidance systems, in fact, anywhere that Euler angles have been used to describe/govern 3D rotation. It is essentially the loss of a degree of freedom in the rotation. The wiki on this topic has nice pictures to understand the physical problem as it pertains to gyroscopes. Question 3: Is there a computational method to avoid gimbal lock?

Quaternions The solution to these seemingly disparate problems has its roots in Question. William Hamilton is first credited with solving the problem and coined his discovery quaternions. Apparently Gauss knew about quaternions but did not publish his discoveries. (By the way, Carl Friedrich Gauss knew everything.) Hamilton devoted much of his life teaching and disseminating quaternion mathematics which was largely abandoned with the introduction of vector analysis. Here is a very brief introduction to quaternions. It is necessary to supply a definition and then define the operations, in particular, multiplication. Both division and rotation in R 3 using quaternions requires an understanding of multiplication and its properties, so we go into some detail. Let a,b,c, and d be real numbers and i 2 = j 2 =k 2 =ijk=. It follows that i j=k, j k=i, and k i= j. Since ji= j( jk )= jjk= j 2 k= k, we also have ji= k, k j= i and i k= j. Now define a quaternion, q, as q=a+ bi+ cj+ dk We can immediately define the norm of q as q = + + +. You may have been expecting modulus or magnitude here, but norms are used to create metrics; ie, a way to measure distances and lengths. One requirement for rotation to be considered a rigid motion is that it must preserve lengths and distances between points, as well as angles. As with complex numbers, we add and subtract in the usual way. For multiplication, let q =a i+ c j+ d k and q 2 = + i+ j+ k use the distributive property. We obtain an algebraic form (or Hamilton form) for a product of two quaternions, Formula : q q 2 =(a b c d ) + (a + c d )i + (a b + c + d ) j + (a c + d )k We can also associate a quaternion with a scalar and a vector via a+ bi+ cj+ dk a+ b,c, d =a+ v. Letting q =a + v and q 2 = + v 2, we can derive a vector form of quaternion multiplication Formul: q q 2 = a v v 2 a v 2 v v v 2 using the usual dot and cross products. This form has immediate use in developing some properties of quaternion arithmetic. Additionally, we have a matrix representation for quaternions and for multiplication. [ a b c d ] a+ bi+ cj+ dk b a d c c d a b d c b a Claim : To multiply two quaternions, multiply their matrix representations. We now seek a quaternion, call it e, with the property that qe=q for any quaternion, q. I found this to be relatively easy by writing q=a+ v and e=b+ u then using the vector form of multiplication and properties of vectors to obtain Claim 2: e=+ In matrix form, e is the identity matrix of dimension 4. A multiplicative inverse for q, call it q, must

satisfy either q q =e or q q=e. It turns out that Claim 3: q = q* q 2 satisfies both equations where q * is the conjugate of q and can be written in at least two useful ways. Letting q=a+ v, q * =q+ iqi+ jqj+ kqk or q * =a v The first has the advantage that the scalar and vector parts of q can be written as 2 (q+ q* ) and 2 (q q* ), respectively. The second looks like a conjugate. It is easy to show that q q * = q 2, just as with complex numbers. We are ready to define division and must set a convention. There is not a universal rule for, but any work with quaternions must establish what is meant by p q. Since quaternion multiplication does not generally commute, one is obliged to choose either q p or p q. This answers Question. We are ready to perform rotation in R 3 using unit quaternions. A unit quaternion satisfies q 2 = and q =q *. Let u be a unit vector in R 3 that is collinear with the desired axis of rotation and let θ be the amount of rotation. Let q=cos ( θ quaternion 2) + usin ( θ 2). Associate a point P in R 3, say ( x, y,z ) with the P=+ x, y, z. The image of P under the rotation is P' where Formula 3: P ' =qpq =qpq * This is our definition then of rotation in R 3 via quaternion multiplication and answers Question 2. It remains to be shown that this is norm and angle preserving. These are non-trivial tasks. What better way to spend your free time! As for Question 3, I lack the knowledge to illustrate the application of quaternions to any specific field and mention it here because I knew someone would ask what are they good for? If you come across especially good resources for understanding gimbal lock, rotation in 3D, or other interesting applications other than those listed below, I will consider adding a couple of points. Just quote the source and write a paragraph about why you would recommend it to someone else. Sources. Mathematics for 3D Game Programming, Eric Lengyel, 22, ISBN 5845379 2. http://en.wikipedia.org/wiki/quaternion 3. http://en.wikipedia.org/wiki/gimbal_lock 4. http://en.wikipedia.org/wiki/euler_angles