Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5 1
CS4620/5620: Lecture 5
3D Transforms (Rotations)
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Announcements
2
• HW 1 out on weekend
• PA 1 out next Monday
• No recitation today
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Rotation about z axis
3
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Rotation about x axis
4
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Rotation about y axis
5
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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
6
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Properties of Rotation Matrices
• Columns of R are mutually orthonormal: RRT=RTR=I
• Right-handed coordinate systems: det(R)=1
7
© 2011 Kavita Bala •Cornell CS4620/5620 Fall 2011 • Lecture 9
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
8
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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
9
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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
10
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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)11
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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)
12
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Derivation of General Rotation Matrix
• General 3x3 3D rotation matrix• General 4x4 rotation about an arbitrary point
13
© 2011 Kavita Bala •Cornell CS4620/5620 Fall 2011 • Lecture 9
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
14
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
What are the 3 angles?
15
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Roll, yaw, Pitch
16
• NASA standard• Euler angles: stack up three coord axis rotations
• ZYX case: Rz(thetaz)*Ry(thetay)*Rx(thetax)
© 2011 Kavita Bala •Cornell CS4620/5620 Fall 2011 • Lecture 9
3D rotations
17
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Specifying rotations: Euler rotations
• Euler angles
18
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Gimbal Lock
19
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Euler angles
• Gimbal lock removes one degree of freedom
20
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
• http://www.youtube.com/watch?v=zc8b2Jo7mno• http://www.youtube.com/watch?v=rrUCBOlJdt4
21
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
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
22
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Derivation of General Rotation Matrix
23
• Axis angle rotation
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Axis-angle ONB
24
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Axis-angle rotation
25
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5 26
© 2012 Kavita Bala •(with previous instructors James/Marschner)
Cornell CS4620/5620 Fall 2012 • Lecture 5
Rotation Matrix for Axis-Angle
27