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

Similar documents
12.1 Quaternions and Rotations

Quaternions and Rotations

Quaternions and Rotations

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

Quaternions and Rotations

Rotations in 3D Graphics and the Gimbal Lock

3D Kinematics. Consists of two parts

Quaternions and Rotations

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

CS354 Computer Graphics Rotations and Quaternions

Animation and Quaternions

Quaternions & Rotation in 3D Space

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Visual Recognition: Image Formation

Transformations Week 9, Lecture 18

Visualizing Quaternions

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

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

CS612 - Algorithms in Bioinformatics

Coordinate Transformations. Coordinate Transformation. Problem in animation. Coordinate Transformation. Rendering Pipeline $ = $! $ ! $!

Orientation & Quaternions

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

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

Animation. Traditional Animation Keyframe Animation. Interpolating Rotation Forward/Inverse Kinematics

Computer Animation II

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

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

Fundamentals of Computer Animation

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

Transformations: 2D Transforms

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

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

CS770/870 Spring 2017 Quaternions

Coordinate Frames and Transforms

Reading. Topics in Articulated Animation. Character Representation. Animation. q i. t 1 t 2. Articulated models: Character Models are rich, complex

INF3320 Computer Graphics and Discrete Geometry

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

Fundamentals of Computer Animation

Aalto CS-C3100 Computer Graphics, Fall 2016

Jorg s Graphics Lecture Notes Coordinate Spaces 1

Kinematics and Orientations

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

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

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

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Autonomous Navigation for Flying Robots

Animation Curves and Splines 2

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

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

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

Rotation with Quaternions

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

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

2D and 3D Transformations AUI Course Denbigh Starkey

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

Game Engineering CS S-05 Linear Transforms

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

Quaternion Rotations AUI Course Denbigh Starkey

CS5620 Intro to Computer Graphics

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

Visualizing Quaternions

IMAGE-BASED RENDERING AND 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

CS 130 Final. Fall 2015

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

Geometric Transformations

Hello, welcome to the video lecture series on Digital Image Processing. So in today's lecture

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

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

Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Splines & Quaternions (splines.txt) by Jochen Wilhelmy a.k.a. digisnap

Computer Vision cmput 428/615

Homogeneous Coordinates

CS230 : Computer Graphics Lecture 12: Introduction to Animation. Tamar Shinar Computer Science & Engineering UC Riverside

Animation. Animation

Transformations. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

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

Robot Inverse Kinematics Asanga Ratnaweera Department of Mechanical Engieering

Introduction to Homogeneous coordinates

MTRX4700 Experimental Robotics

Game Engineering: 2D

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

Lecture Note 3: Rotational Motion

CS184: Using Quaternions to Represent Rotation

Rotations for N-Dimensional Graphics

Computer Graphics. P04 Transformations. Aleksandra Pizurica Ghent University

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

3D Rotation: more than just a hobby

Application of Quaternion Interpolation (SLERP) to the Orientation Control of 6-Axis Articulated Robot using LabVIEW and RecurDyn

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:

Introduction to quaternions. Mathematics. Operations

CMSC 425: Lecture 6 Affine Transformations and Rotations

Inertial Measurement Units II!

EEE 187: Robotics Summary 2

Representations and Transformations. Objectives

Objectives. transformation. General Transformations. Affine Transformations. Notation. Pipeline Implementation. Introduce standard transformations

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Forward kinematics and Denavit Hartenburg convention

Transcription:

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

Parameterizing Rotations Straightforward in 2D A scalar, θ, represents rotation in plane More complicated in 3D Three scalars are required to define orientation Note that three scalars are also required to define position Objects free to translate and tumble in 3D have 6 degrees of freedom (DOF)

Representing 3 Rotational DOFs 3x3 Matrix (9 DOFs) Rows of matrix define orthogonal axes Euler Angles (3 DOFs) Rot x + Rot y + Rot z Axis-angle (4 DOFs) Axis of rotation + Rotation amount Quaternion (4 DOFs) 4 dimensional complex numbers

Rotation Matrix 9 DOFs must reduce to 3 Rows must be unit length (-3 DOFs) Rows must be orthogonal (-3 DOFs) Drifting matrices is very bad Numerical errors results when trying to gradually rotate matrix by adding derivatives Resulting matrix may scale / shear Gram-Schmidt algorithm will re-orthogonalize your matrix Difficult to interpolate between matrices How would you do it?

Euler Angles (θ x, θ y, θ z ) = R z R y R x Rotate θ x degrees about x-axis Rotate θ y degrees about y-axis Rotate θ z degrees about z-axis Axis order is not defined (y, z, x), (x, z, y), (z, y, x) are all legal Pick one

Euler Angles Rotations not uniquely defined ex: (z, x, y) = (90, 45, 45) = (45, 0, -45) takes positive x-axis to (1, 1, 1) Cartesian coordinates are independent of one another, but Euler angles are not Remember, the axes stay in the same place during rotations Gimbal Lock Term derived from mechanical problem that arises in gimbal mechanism that supports a compass or a gyro

Gimbal Lock http://www.anticz.com/eularqua.htm

Gimbal Lock Occurs when two axes are aligned Second and third rotations have effect of transforming earlier rotations ex: Rot x, Rot y, Rot z If Rot y = 90 degrees, Rot z == -Rot x

A Gimbal Hardware implementation of Euler angles (used for mounting gyroscopes and globes)

Interpolation Interpolation between two Euler angles is not unique ex: (x, y, z) rotation (0, 0, 0) to (180, 0, 0) vs. (0, 0, 0) to (0, 180, 180) Interpolation about different axes are not independent

Interpolation

Axis-angle Notation Define an axis of rotation (x, y, z) and a rotation about that axis, θ: R(θ, n) 4 degrees of freedom specify 3 rotational degrees of freedom because axis of rotation is constrained to be a unit vector

Axis-angle Notation r perp = r (n.r) n θ r Rr r par = (n.r) n n V = n x (r (n.r) n) = n x r Rr = Rr par + Rr perp = Rr par + (cos θ) r perp + (sin θ) V =(n.r) n + cos θ(r (n.r)n) + (sin θ) n x r = (cos θ)r + (1 cos θ) n (n.r) + (sin θ) n x r

Axis-angle Rotation Given r Vector in space to rotate n Unit-length axis in space about which to rotate θ The amount about n to rotate Solve r The rotated vector n r r

Axis-angle Rotation Step 1 Compute r k an extended version of the rotation axis, n r k = (n r) n r k r r

Axis-angle Rotation Compute r? r? = r (n r) n r? r r

Axis-angle Rotation Compute v, a vector perpendicular to r k and r? v = r k r? Use v and r? and θ to compute r v cos(θ) r? + sin(θ) v θ r?

Axis-angle Notation No easy way to determine how to concatenate many axis-angle rotations that result in final desired axis-angle rotation No simple way to interpolate rotations

Quaternion Remember complex numbers: a + ib Where i 2 = -1 Invented by Sir William Hamilton (1843) Remember Hamiltonian path from Discrete II? Quaternion: Q = a + bi + cj + dk Where i 2 = j 2 = k 2 = -1 and ij = k and ji = -k Represented as: q = (s, v) = s + v x i + v y j + v z k

Quaternion A quaternion is a 4-D unit vector q = [x y z w] It lies on the unit hypersphere x 2 + y 2 + z 2 + w 2 = 1 For rotation about (unit) axis v by angle θ vector part = (sin θ/2) v = [x y z] scalar part = (cos θ/2) = w (sin(θ/2) n x, sin(θ/2) n y, sin(θ/2) n z, cos (θ/2)) Only a unit quaternion encodes a rotation - normalize

Quaternion Rotation matrix corresponding to a quaternion: [x y z w] = & 1 $ $ $ % 2y 2z 2xy 2wz 2xz + 2wy 1 2x Quaternion Multiplication 2xy + 2wz 2z 2yz 2wx q 1 * q 2 = [v 1, w 1 ] * [v 2, w 2 ] = [(w 1 v 2 +w 2 v 1 + (v 1 x v 2 )), w 1 w 2 -v 1.v 2 ] quaternion * quaternion = quaternion 2 2 2xz 2wy 2yz + 2wx 1 2x 2y this satisfies requirements for mathematical group 2 Rotating object twice according to two different quaternions is equivalent to one rotation according to product of two quaternions 2 2 2 #!!! "

Quaternion Example X-roll of π (cos (π/2), sin (π/2) (1, 0, 0)) = (0, (1, 0, 0)) Y-roll 0f π (0, (0, 1, 0)) Z-roll of π (0, (0, 0, 1)) R y (π) followed by R z (π) (0, (0, 1, 0) times (0, (0, 0, 1)) = (0, (0, 1, 0) x (0, 0, 1) = (0, (1, 0, 0))

Quaternion Interpolation Biggest advantage of quaternions Interpolation Cannot linearly interpolate between two quaternions because it would speed up in middle Instead, Spherical Linear Interpolation, slerp() Used by modern video games for third-person perspective Why?

SLERP Quaternion is a point on the 4-D unit sphere interpolating rotations requires a unit quaternion at each step another point on the 4-D unit sphere move with constant angular velocity along the great circle between two points Any rotation is defined by 2 quaternions, so pick the shortest SLERP To interpolate more than two points, solve a non-linear variational constrained optimization Ken Shoemake in SIGGRAPH 85 (www.acm.org/dl)

Quaternion Interpolation Quaternion (white) vs. Euler (black) interpolation Left images are linear interpolation Right images are cubic interpolation

Quaternion Code http://www.gamasutra.com/features/programming/ 19980703/quaternions_01.htm Registration required Camera control code http://www.xmission.com/~nate/smooth.html File, gltb.c gltbmatrix and gltbmotion