Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective Adrian Pearce Department of Computing and Information Systems University of Melbourne The University of Melbourne MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Lecture outline Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Three-dimensional transformations and perspective How do three-dimensional transformations differ from two-dimensional transformations? Aim: understand how to transform arbitrary perspectives in three-dimensions (3D). Reading: ◮ Foley Sections 5.7 matrix representation of 3D transformations and 5.8 composition of 3D transformations. MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Three-dimensional coordinate systems 3D (Cartesian) coordinates ( X , Y , Z ) can be considered in terms of left-handed and right-handed coordinate systems. The “right-hand rule”: thumb X axis index finger Y axis big finger Z axis MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Rotation about axis in the right-handed coordinate system y Axis of rotation Direction of positive rotation x z x y to z (out of page) y z to x z x to y MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Three-dimensional rotation Need to specify axis of rotation, and by how much such as a 3D unit vector, plus rotation angle. Convention: rotation angle is clockwise looking along axis of rotation Note, this is consistent with ordinary 2D anti-clockwise convention: Really a rotation around a positive Z axis coming up out of the page in a right-handed coordinate frame. Z Y MINSilvr X Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Example: rotation of a simple object y y P 3 P 1 P 3 P 2 P 1 x x P 2 z z (a) Initial position (b) Final position Example from Section 5.8 of Foley. MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation y y P ′ 3 y 2 ′′ ′′ P 2 D 2 P ′ 1 ′′ P 1 P ′ 2 ( x ′ 2 , y ′ 2 , z ′ 2 ) φ θ D 1 x x z ′′ z 2 ( x ′ 2 , 0, z ′ 2 ) z Rotation about the y axis (left) by − ( 90 − θ ) followed by rotation around the x axis (right) by φ (shown for P 1 P 3 only). MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation y y 3 ′′′ α ′′′ P 3 D 3 ′′′ P 1 x 3 ′′′ x ′′′ P 2 z Final rotation about the z axis is by α . The composite matrix R for the overall transformation is calculated by multiplying the individual rotation matrices and translation matrix R z ( α ) · R x ( φ ) · R y ( θ − 90 ) · T ( − x 1 , − y 1 , − z 1 ) = R · T MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Rotations about an arbitrary axis Two rotations about coordinate axes to line up axis of rotation with one of the coordinate axes. One rotation around this last axis, two rotations to undo the first two, and put the axis of rotation back where it was. If axis doesn’t pass through the origin, you’ll need to wrap an appropriate translation and its inverse around all this. MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Homogeneous versions In 3D the point in homogeneous coordinates ( X , Y , Z , W ) corresponds to the Cartesian point ( X / W , Y / W , Z / W ) for W � = 0 Completely analogous to the 2D case, where W = 1. Translation: x ′ 1 0 0 x t x y ′ 0 1 0 y t y = z ′ 0 0 1 z t z 1 0 0 0 1 1 MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation x ′ x s 0 0 0 x y ′ 0 y s 0 0 y Scaling: = z ′ 0 0 z s 0 z 1 0 0 0 1 1 Rotation counterclockwise using right-handed coordinate system about Z axis: x ′ cos θ − sin θ 0 0 x y ′ sin θ cos θ 0 0 y = z ′ 0 0 1 0 z 1 0 0 0 1 1 MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Rotation around the y axis: x ′ cos θ 0 sin θ 0 x y ′ 0 1 0 0 y = z ′ − sin θ 0 cos θ 0 z 1 0 0 0 1 1 Rotation around the x axis: x ′ 1 0 0 0 x y ′ 0 cos θ − sin θ 0 y = z ′ 0 sin θ cos θ 0 z 1 0 0 0 1 1 MINSilvr Note cyclic wrap-around of factors for each axis. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Gimbal Lock MINSilvr Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Quaternion Rotations Arbitrary camera orientation Gimbal Lock ◮ If we combine rotation matrices as R = R x ( φ ) · R y ( θ ) · R z ( α ) we have cos ( θ ) cos ( α ) cos ( θ ) sin ( γ ) sin ( θ ) 0 � � sin ( φ ) sin ( θ ) cos ( α ) + cos ( φ ) sin ( α ) − sin ( φ ) sin ( θ ) sin ( α ) + cos ( φ ) cos ( α ) − sin ( φ ) cos ( θ ) 0 − cos ( φ ) sin ( θ ) cos ( α ) + sin ( φ ) sin ( α ) cos ( φ ) sin ( θ ) sin ( α ) + sin ( φ ) cos ( α ) cos ( θ ) cos ( φ ) 0 0 0 0 1 ◮ Now consider θ = π 2 : 0 0 1 0 � � sin α cos γ + cos α sin γ − sin α sin γ + cos α cos γ 0 0 R = − cos α cos γ + sin α sin γ cos α sin γ + sin α cos γ 0 0 0 0 0 1 � 0 0 1 0 � sin ( α + γ ) cos ( α + γ ) 0 0 R = − cos ( α + γ ) sin ( α + γ ) 0 0 0 0 0 1 ◮ Lost a degree of freedom. ◮ Changing the rotation order affects the axis on which MINSilvr gimbal lock occurs, but does not prevent it from occurring Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Recommend
More recommend