1 kipa game engine seminars jonathan blow ajou university december 13, 2002 day 16

16
1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

Upload: charla-kennedy

Post on 30-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

1

KIPA Game Engine Seminars

Jonathan Blow

Ajou University

December 13, 2002

Day 16

Page 2: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

2

Rotation in 2D

• Multiplication of complex numbers

• Complex number representation in polar coordinates (magnitude, angle)

Page 3: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

3

Euler’s Formula

• eiθ = cosθ + i sinθ

• Looking at the derivative of each side

Page 4: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

4

All rotations in 3D can be expressed as rotation by an angle

around an axis• Definition of the axis as an eigenvector of the

rotation

• Proof that in 3D all transforms have 1 or 3 (real) eigenvalues

• So we have 1 or 3 axes of rotation• 3 axes means it’s the identity rotation (maybe with

scaling)

Page 5: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

5

Quaternion

• As an axis/angle representation

• Re-derivation of qvq*

Page 6: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

6

Mathematical demonstrationthat the expression qvq* rotates

the vector v

• Work out the terms, breaking v into components parallel and orthogonal to the axis

• Show what qvq* does to each of these components

Page 7: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

7

Multiplying by a Non-Unit Quaternion

• Scales the vector

• (demonstration of this)

• (analogy to 2D case)

Page 8: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

8

Quaternion Powers

• What is q2?

• What is qt?

Page 9: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

9

SLERP

• As q0(1-t)q1

t

• Rewrite this as q0(q0-1q1)t

Page 10: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

10

Exponential Formof a Quaternion

• cosθ + y sinθ ; y is axis of rotation

• eyθ

Page 11: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

11

The Log of a Quaternion

• log eyθ = yθ

• But be careful, the additive log identity doesn’t work here!– It requires commutative multiplication– Demonstration of this on whiteboard– The identity does work if the axes are colinear

Page 12: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

12

The Exponential Map

• Is the log of a quaternion– Actually it can also mean the log of an arbitrary

transformation matrix, but here we are restricted to quaternions

• We can interpolate in this space• What are the properties of this

interpolation?

Page 13: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

13

The Exponential Map

• It interpolates at constant speed, but it is not the same function as slerp

• Therefore it cannot possibly follow the shortest path of interpolation– (otherwise they’d be the same function!)

• Indeed the further away the source orientations, the wider the path used by the exponential map

Page 14: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

14

The Exponential Map• But sometimes you care most about

constant speed, so the exponential map works well for that

• Provides a method of linearization that’s different from the linear interpolation in quaternion space discussed last week

• Also apparently there’s lots of other math you can do with these, which I don’t know, read some advanced robotics papers to find out

Page 15: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

15

Simple Cases For Quaternions

• qxq*

• qxq* dot x

• Convert quaternion to rotation matrix

Page 16: 1 KIPA Game Engine Seminars Jonathan Blow Ajou University December 13, 2002 Day 16

16

Discussion of my quaternion IK work

• (demo of app)

• People generally use Euler angles for IK but they are slow and unintuitive

• We can use quaternions instead to build a fast system