340 likes | 391 Views
CSCE441: Computer Graphics 3D Transformations. Jinxiang Chai. 3D Transformation. A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent points. Homogeneous coordinates of a 3D point (x,y,z,1) Transformation will be performed using 4x4 matrix.
E N D
CSCE441: Computer Graphics3D Transformations Jinxiang Chai
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent points. Homogeneous coordinates of a 3D point (x,y,z,1) Transformation will be performed using 4x4 matrix
Right-handed Coordinate System Left hand coordinate system Not used in this class and Not in OpenGL
3D Transformation Homogenous coordinates Very similar to 2D transformation Translation transformation
3D Transformation Homogenous coordinates Very similar to 2D transformation Scaling transformation
3D Transformation y + x z 3D rotation is done around a rotation axis Fundamental rotations – rotate about x, y, or z axes Counter-clockwise rotation is referred to as positive rotation (when you look down negative axis)
3D Transformation Keep z constant! y + x z Rotation about z – similar to 2D rotation
y x z 3D Transformation z y x Rotation about y: z -> y, y -> x, x->z
3D Transformation x z y y x z Rotation about x (z -> x, y -> z, x->y)
Inverse of 3D Transformations Invert the transformation In general, X= AX’-->X’=A-1X T(-tx,-ty,-tz) T(tx,ty,tz)
3D Rotation about Arbitrary Axes Rotate p about the by the angle 10
3-D Rotation • General rotations in 3-D require rotating about an arbitrary axis of rotation • Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra • The general rotation matrix is a combination of coordinate-axis rotations and translations!
3D Rotation about Arbitrary Axes Rotate p about the by the angle
3-D Rotation • General rotations in 3-D require rotating about an arbitrary axis of rotation • Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra • Standard approach: express general rotation as composition of canonical rotations • Rotations about x, y, z
Composing Canonical Rotations • Goal: rotate about arbitrary vector r by θ • Idea: we know how to rotate about x,y,z • Set up a transformation that superimposes rotation axis onto one coordinate axis • Rotate about the coordinate axis • Translate and rotate object back via inverse of the transformation matrix
Composing Canonical Rotations Goal: rotate about arbitrary vector r by θ Idea: we know how to rotate about x,y,z So, rotate about z by - until r lies in the xz plane Then rotate about y by -βuntil r coincides with +z Then rotate about z by θ Then reverse the rotation about y(byβ ) Then reverse the rotation about z(by ) 15
3D Rotation about Arbitrary Axes Rotate p about the by the angle
3D Rotation about Arbitrary Axes Translate so that rotation axis passes through the origin
3D Rotation about Arbitrary Axes Rotation by about z-axis to place the rotation vector on xoz plane
3D Rotation about Arbitrary Axes Rotation by about y-axis to align the rotation vector with z axis
3D Rotation about Arbitrary Axes Rotation by about z-axis (rotation vector)
3D Rotation about Arbitrary Axes Rotation by about y-axis
3D Rotation about Arbitrary Axes Rotation by about z-axis
3D Rotation about Arbitrary Axes Translate the object back to original point
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis 25
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis
3D Rotation about Arbitrary Axes A 3 by 3 Rotation matrix—orthogonal matrix Final transformation matrix for rotating about an arbitrary axis
Rotation Matrices • Orthonormal matrix: • orthogonal (columns/rows linearly independent) • normalized (columns/rows length of 1)
Rotation Matrices • Orthonormal matrix: • orthogonal (columns/rows linearly independent) • normalized (columns/rows length of 1) • The inverse of an orthogonal matrix is just its transpose:
Rotation Matrices • Orthonormal matrix: • orthogonal (columns/rows linearly independent) • normalized (columns/rows length of 1) • The inverse of an orthogonal matrix is just its transpose:
Rotation Matrices • Orthonormal matrix: • orthogonal (columns/rows linearly independent) • normalized (columns/rows length of 1) • The inverse of an orthogonal matrix is just its transpose: e.g.,
Next Lecture 2D coordinate transformations 3D coordinate transformations Lots of vector and matrix operations! 37