3D orientation Rotation matrix Fixed angle and Euler angle Axis - - PowerPoint PPT Presentation

3d orientation
SMART_READER_LITE
LIVE PREVIEW

3D orientation Rotation matrix Fixed angle and Euler angle Axis - - PowerPoint PPT Presentation

3D orientation Rotation matrix Fixed angle and Euler angle Axis angle Quaternion Exponential map Joints and rotations Rotational DOFs are widely used in character animation 3 translational DOFs 48 rotational DOFs Each


slide-1
SLIDE 1

3D orientation

slide-2
SLIDE 2
  • Rotation matrix
  • Fixed angle and Euler angle
  • Axis angle
  • Quaternion
  • Exponential map
slide-3
SLIDE 3

Joints and rotations

Rotational DOFs are widely used in character animation 3 translational DOFs 48 rotational DOFs Each joint can have up to 3 DOFs

1 DOF: knee 2 DOF: wrist 3 DOF: arm

slide-4
SLIDE 4

Representation of orientation

  • Homogeneous coordinates (review)
  • 4X4 matrix used to represent translation,

scaling, and rotation

  • a point in the space is represented as
  • Treat all transformations the same so that they

can be easily combined

p =     x y z 1    

slide-5
SLIDE 5

Translation

    x + tx y + ty z + tz 1     =     1 tx 1 ty 1 tz 1         x y z 1    

translation matrix new point

  • ld point
slide-6
SLIDE 6

Scaling

    sxx syy szz 1     =     sx sy sz 1         x y z 1    

scaling matrix new point

  • ld point
slide-7
SLIDE 7

Rotation

    x y z 1     =     cos θ − sin θ sin θ cos θ 1 1         x y z 1         x y z 1     =     1 cos θ − sin θ sin θ cos θ 1         x y z 1         x y z 1     =     cos θ sin θ 1 − sin θ cos θ 1         x y z 1    

X axis Y axis Z axis

slide-8
SLIDE 8

Composite transformations

A series of transformations on an

  • bject can be applied as a series of

matrix multiplications

p = T(x0, y0, z0)R(θ0)R(φ0)R(σ0)T(0, h0, 0)R(θ1)R(φ1)R(σ1)T(0, h1, 0)R(θ2)T(0, h2, 0)R(θ3)R(φ3)x

p θ3φ3 φ1 φ0 θ0 θ1 θ2

σ1 σ0 x0 y0 z0

p : position in the global coordinate

x : position in the local coordinate

h1 h2 h0 h3

(h3, 0, 0)

slide-9
SLIDE 9

Interpolation

  • In order to “move things”, we need both

translation and rotation

  • Interpolation the translation is easy, but what

about rotations?

slide-10
SLIDE 10

Interpolation of orientation

  • How about interpolating each entry of the

rotation matrix?

  • The interpolated matrix might no longer be
  • rthonormal, leading to nonsense for the in-

between rotations

slide-11
SLIDE 11

Interpolation of orientation

Example: interpolate linearly from a positive 90 degree rotation about y axis to a negative 90 degree rotation about y

    1 1 −1 1         −1 1 1 1         1 1    

Linearly interpolate each component and halfway between, you get this...

slide-12
SLIDE 12

Properties of rotation matrix

  • Easily composed? Yes
  • Interpolate? No
slide-13
SLIDE 13
  • Rotation matrix
  • Fixed angle and Euler angle
  • Axis angle
  • Quaternion
  • Exponential map
slide-14
SLIDE 14

Fixed angle

  • Angles used to rotate about fixed axes
  • Orientations are specified by a set of 3 ordered

parameters that represent 3 ordered rotations about fixed axes

  • Many possible orderings
slide-15
SLIDE 15

Euler angle

  • Same as fixed angles, except now the axes move

with the object

  • An Euler angle is a rotation about a single

Cartesian axis

  • Create multi-DOF rotations by concatenating

Euler angles

  • evaluate each axis independently in a set order
slide-16
SLIDE 16

Euler angle vs. fixed angle

  • Rz(90)Ry(60)Rx(30) = Ex(30)Ey(60)Ez(90)
  • Euler angle rotations about moving axes written

in reverse order are the same as the fixed axis rotations

Z Y X

http://www.arielnet.com/adi2001/demos/007/gimballock.asp

slide-17
SLIDE 17

Properties of Euler angle

  • Easily composed? No
  • Interpolate? Sometimes
  • How about joint limit? Easy
  • What seems to be the problem? Gimbal lock
slide-18
SLIDE 18

Gimbal Lock

A Gimbal is a hardware implementation

  • f Euler angles used for mounting

gyroscopes or expensive globes Gimbal lock is a basic problem with representing 3D rotation using Euler angles or fixed angles

slide-19
SLIDE 19

Gimbal lock

When two rotational axis of an object pointing in the same direction, the rotation ends up losing one degree

  • f freedom
slide-20
SLIDE 20
  • Rotation matrix
  • Fixed angle and Euler angle
  • Axis angle
  • Quaternion
  • Exponential map
slide-21
SLIDE 21

Axis angle

  • Represent orientation as a vector and a scalar
  • vector is the axis to rotate about
  • scalar is the angle to rotate by

x y z

slide-22
SLIDE 22

Properties of axis angle

  • Can avoid Gimbal lock. Why?
  • It does 3D orientation in one step
  • Can interpolate the vector and the scalar
  • separately. How?
slide-23
SLIDE 23

Axis angle interpolation

B = A1 × A2 φ = cos−1 A1 · A2 |A1||A2|

  • Ak = RB(kφ)A1

θk = (1 − k)θ1 + kθ2 x y z

A2 θ2 A1 θ1

slide-24
SLIDE 24

Properties of axis angle

  • Easily composed? No, must convert back to

matrix form

  • Interpolate? Yes
  • Joint limit? Yes
  • Avoid Gimbal lock? Yes
slide-25
SLIDE 25
  • Rotation matrix
  • Fixed angle and Euler angle
  • Axis angle
  • Quaternion
  • Exponential map
slide-26
SLIDE 26

Quaternion

θ2 θ1

1-angle rotation can be represented by a unit circle

(θ1, φ1) (θ2, φ2)

2-angle rotation can be represented by a unit sphere

What about 3-angle rotation?

slide-27
SLIDE 27

Quaternion

4 tuple of real numbers:

w, x, y, z q =     w x y z     = w v

  • scalar

vector

r

θ

q =

  • cos (θ/2)

sin (θ/2)r

  • Same information as axis angles but in a different form
slide-28
SLIDE 28

Quaternion math

Unit quaternion

|q| = 1

x2 + y2 + z2 + w2 = 1

  • w1

v1 w2 v2

  • =
  • w1w2 − v1 · v2

w1v2 + w2v1 + v1 × v2

  • Multiplication

q1q2 = q2q1 q1(q2q3) = (q1q2)q3

slide-29
SLIDE 29

Quaternion math

Conjugate

q∗ = w v ∗ =

  • w

−v

  • (q∗)∗ = q

(q1q2)∗ = q∗

2q∗ 1

Inverse

q−1 = q∗ |q| qq−1 =     1    

identity quaternion

slide-30
SLIDE 30

Quaternion Rotation

qp = p

  • q =
  • cos (θ/2)

sin (θ/2)r

  • If is a unit quaternion and

q

then results in rotating about by

qqpq−1

r

θ p

proof: see Quaternions by Shoemaker

p

x y z

θ

r

slide-31
SLIDE 31

Quaternion Rotation

qqpq−1 =

  • w

v p w −v

  • =
  • w

v p · v wp − p × v

  • = 0

=

  • wp · v − v · wp + v · p × v

w(wp − p × v) + (p · v)v + v × (wp − p × v)

  • w1

v1 w2 v2

  • =
  • w1w2 − v1 · v2

w1v2 + w2v1 + v1 × v2

slide-32
SLIDE 32

Quaternion composition

If and are unit quaternion

q2 q1 q3 = q2 · q1

the combined rotation of first rotating by and then by is equivalent to

q1 q2

slide-33
SLIDE 33

Matrix form

q =     w x y z     R(q) =     1 − 2y2 − 2z2 2xy + 2wz 2xz − 2wy 2xy − 2wz 1 − 2x2 − 2z2 2yz + 2wx 2xz + 2wy 2yz − 2wx 1 − 2x2 − 2y2 1    

slide-34
SLIDE 34

Quaternion interpolation

  • Interpolation means moving on n-D sphere

θ2 θ1

1-angle rotation can be represented by a unit circle

(θ1, φ1) (θ2, φ2)

2-angle rotation can be represented by a unit sphere

slide-35
SLIDE 35

Quaternion interpolation

  • Moving between two points on the 4D unit

sphere

  • a unit quaternion at each step - another point
  • n the 4D unit sphere
  • move with constant angular velocity along

the great circle between the two points on the 4D unit sphere

slide-36
SLIDE 36

Quaternion interpolation

Direct linear interpolation does not work Spherical linear interpolation (SLERP)

slerp(q1, q2, u) = q1 sin((1 − u)θ) sin θ + q2 sin(uθ) sin θ

Normalize to regain unit quaternion Linearly interpolated intermediate points are not uniformly spaced when projected onto the circle

θ

slide-37
SLIDE 37

Quaternion constraints

Cone constraint

θ 1 − cos θ 2 = y2 + z2 q =     w x y z     tan (θ/2) = qaxis w θ

Twist constraint

slide-38
SLIDE 38

Properties of quaternion

  • Easily composed?
  • Interpolate?
  • Joint limit?
  • Avoid Gimbal lock?
  • So what’s bad about Quaternion?
slide-39
SLIDE 39
  • Rotation matrix
  • Fixed angle and Euler angle
  • Axis angle
  • Quaternion
  • Exponential map
slide-40
SLIDE 40

Exponential map

  • Represent orientation as a vector
  • direction of the vector is the axis to rotate about
  • magnitude of the vector is the angle to rotate by
  • Zero vector represents the identity rotation
slide-41
SLIDE 41

Properties of exponential map

  • No need to re-normalize the parameters
  • Fewer DOFs
  • Good interpolation behavior
  • Singularities exist but can be avoided
slide-42
SLIDE 42

Choose a representation

  • Choose the best representation for the task
  • input:
  • joint limits:
  • interpolation:
  • compositing:
  • rendering:

axis angle, quaternion or exponential map Euler angles

  • rientation matrix ( quaternion can be

represented as matrix as well) quaternions or orientation matrix Euler angles, quaternion (harder)

slide-43
SLIDE 43

Summary

  • What is a Gimbal lock?
  • What representations are subject to Gimbal

lock?

  • How does the interpolation work in each type
  • f rotations?
slide-44
SLIDE 44

What’s next?

slide-45
SLIDE 45
  • Physics!
  • Ordinary differential equations
  • Numeric solutions
  • Read: Quaternions by Ken Shoemake