Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective Adrian Pearce Department of Computer Science and Software Engineering University of Melbourne The University of Melbourne Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Lecture outline Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 Most conventional 3D analytic geometry is in terms of right-handed coordinates—what we’ll use. Though left-handed systems do crop up, sometimes by accident or design. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 X Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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). Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Rotation to arbitrary orientations In constructive geometry we often want to rotate an object from a known starting point, or alignment, to an arbitrary orientation. In Foley’s example, an aeroplane aligned along the Z axis is rotated to an arbitrary orientation. y p y y p x p z p DOF P x p x z p z Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Orthogonal matrix An n × n matrix V is orthogonal if VV T = I Where V T is the transpose of V and I is the identity matrix. Special orthogonal : A matrix V is special orthogonal if it is orthogonal and det V = 1. For example: cos θ − sin θ 0 sin θ cos θ 0 1 ] 0 0 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Orthonormal matrix Orthonormal basis: A subset v 1 , . . . , v k of vector space V , where the inner product of any two vectors v i and v j is zero. That is, the vectors are mutually perpendicular and are unit vectors, inner product of v i with itself is one. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation Since the rotation matrix is orthonormal, we can construct a matrix whose rows are unit vectors in direction we want the original X , Y , and Z axes to end up pointing in (based on the direction of flight in the aeroplane example). y P 3 R y R x P 2 R z P 1 x z Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation R z = [ r 1 z , r 2 z , r 3 z ] T = P 1 P 2 | P 1 P 2 | R x = [ r 1 x , r 2 x , r 3 x ] T = P 1 P 3 × P 1 P 2 | P 1 P 3 × P 1 P 2 | R y = [ r 1 y , r 2 y , r 3 y ] T = R z × R x r 1 x r 2 x r 3 x 0 r 1 y r 2 y r 3 y 0 · T ( − x 1 , − y 1 , − z 1 ) = R · T r 1 z r 2 z r 3 z 0 0 0 0 1 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions Arbitrary camera orientation 0 | y p × DOF | | DOF × ( y p × DOF ) | | DOF | 0 R = 0 0 0 0 1 To find the rotation matrix, we just determine in what direction each of the x p , y p , and z p axes is heading and normalise as direction vectors and use these as column vectors in a rotation matrix. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Introduction Rotation about artibrary axis Homogeneous versions 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 Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionThree-dimensional transformation geometry and perspective
Recommend
More recommend