You are on page 1of 14

CS4620/5620: Lecture 5

3D Transforms (Rotations)

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 1


(with previous instructors James/Marschner)

Announcements

• HW 1 out on weekend

• PA 1 out next Monday

• No recitation today

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 2


(with previous instructors James/Marschner)
Rotation about z axis

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 3


(with previous instructors James/Marschner)

Rotation about x axis

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 4


(with previous instructors James/Marschner)
Rotation about y axis

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 5


(with previous instructors James/Marschner)

General Rotation Matrices

• A rotation in 2D is around a point


• A rotation in 3D is around an axis
– so 3D rotation is w.r.t a line, not just a point
– there are many more 3D rotations than 2D
• a 3D space around a given point, not just 1D

2D 3D
Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 6
(with previous instructors James/Marschner)
Properties of Rotation Matrices

• Columns of R are mutually orthonormal: RRT=RTR=I

• Right-handed coordinate systems: det(R)=1

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 7


(with previous instructors James/Marschner)

Specifying rotations
• In 3D, specifying a rotation is more complex
– basic rotation about origin: unit vector (axis) and angle
• convention: positive rotation is CCW when vector is pointing
at you

• Many ways to specify rotation


– Indirectly through frame transformations
– Directly through
• Euler angles: 3 angles about 3 axes
• (Axis, angle) rotation
• Quaternions

Cornell CS4620/5620 Fall 2011 • Lecture 9 © 2011 Kavita Bala • 8


Coming up with the matrix

• Showed matrices for coordinate axis rotations


– but we want rotation about some random axis

• Can compute by composing elementary transforms


– transform rotation axis to align with x axis
– apply rotation
– inverse transform back into position

• Just as in 2D this can be interpreted as a similarity


transform

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 9


(with previous instructors James/Marschner)

Building general rotations

• Using elementary transforms you need three


– translate axis to pass through origin
– rotate about y to get into x-y plane
– rotate about z to align with x axis

• Alternative: construct frame and change coordinates


– choose p, u, v, w to be orthonormal frame with p and u
matching the rotation axis
– apply similarity transform T = F Rx(θ ) F–1

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 10


(with previous instructors James/Marschner)
Building general rotations

• Alternative: construct frame and change coordinates


– choose p, u, v, w to be orthonormal frame with p and u
matching the rotation axis
– apply similarity transform T = F Rx(θ ) F–1
– interpretation: move to x axis, rotate, move back
– interpretation: rewrite u-axis rotation in new coordinates
– (each is equally valid)

– (note above is linear transform; add affine coordinate)


Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 11
(with previous instructors James/Marschner)

Building general rotations

• Alternative: construct frame and change coordinates


– choose p, u, v, w to be orthonormal frame with p and u
matching the rotation axis
– apply similarity transform T = F Rx(θ ) F–1
– interpretation: move to x axis, rotate, move back
– interpretation: rewrite u-axis rotation in new coordinates
– (each is equally valid)

• Or just derive the formula once, and reuse it (more later)

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 12


(with previous instructors James/Marschner)
Derivation of General Rotation Matrix

• General 3x3 3D rotation matrix


• General 4x4 rotation about an arbitrary point

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 13


(with previous instructors James/Marschner)

3D rotations
• An object can be oriented arbitrarily
• Euler angles: stack up three coord axis rotations
• ZYX case: Rz(thetaz)*Ry(thetay)*Rx(thetax)
• heading, attitude, bank (NASA standard airplane coordinates)
• pitch, yaw, roll

Cornell CS4620/5620 Fall 2011 • Lecture 9 © 2011 Kavita Bala • 14


What are the 3 angles?

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 15


(with previous instructors James/Marschner)

Roll, yaw, Pitch

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 16


(with previous instructors James/Marschner)
• NASA standard
• Euler angles: stack up three coord axis rotations
• ZYX case: Rz(thetaz)*Ry(thetay)*Rx(thetax)
Gimbal Lock

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 19


(with previous instructors James/Marschner)

Euler angles
• Gimbal lock removes one degree of freedom

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 20


(with previous instructors James/Marschner)
• http://www.youtube.com/watch?v=zc8b2Jo7mno
• http://www.youtube.com/watch?v=rrUCBOlJdt4

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 21


(with previous instructors James/Marschner)

Specifying Rotations

• Many ways to specify rotation


– Indirectly through frame transformations
– Directly through
• Euler angles: 3 angles about 3 axes
• (Axis, angle) rotation: based on Euler’s theorem
• Quaternions

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 22


(with previous instructors James/Marschner)
Derivation of General Rotation Matrix

• Axis angle rotation

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 23


(with previous instructors James/Marschner)

Axis-angle ONB

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 24


(with previous instructors James/Marschner)
Axis-angle rotation

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 25


(with previous instructors James/Marschner)
Rotation Matrix for Axis-Angle

Cornell CS4620/5620 Fall 2012 • Lecture 5 © 2012 Kavita Bala • 27


(with previous instructors James/Marschner)

You might also like