Transformations of Objects – 3D CS430 Computer Graphics Transformations of Objects – 3D Chi-Cheng Lin, Winona State University
Topics 3D Affine Transformations Composition of 3D Affine Transformations Properties of Affine Transformations Changing Coordinate Systems
3D Affine Transformations Translation T(dx, dy, dz) =
3D Affine Transformations Scaling S(Sx, Sy, Sz) =
3D Affine Transformations Rotations: Three elementary rotations Rotation about the x-axis (x-roll) Rotation about the y-axis (y-roll) Rotation about the z-axis (z-roll) Positive values of rotation angel cause a counterclockwise (CCW) rotation about an axis as one looks inward from a point on the positive axis toward the origin
3D Rotations Let c = cos() and s = sin() x-roll z-roll y-roll
Composition of 3D Affine Transformations Similar to 2D If a sequence of transformations, represented by M1, M2, …, Mn, is applied to a 3D point P, then P is transformed to MP, where M = Mn M2 M1 Important distinction between 2D and 3D rotations 3D rotation matrices do not commute 3D rotation can be about different axis
Combining 3D Rotations Euler’s Theorem Calculation is complex Any rotation (or sequence of rotations) about a point is equivalent to a single rotation about some axis through that point Calculation is complex Good news: OpenGL can do it for you glRotated(angle, ux, uy, uz), rotates angle degrees about an axis with unit vector (ux, uy, uz)
Properties of Affine Transformations Affine transformation preserve affine combinations of points Affine transformation preserve lines and planes Parallelism of lines and planes is preserved Relative ratios are preserved Every affine transformation is composed of fundamental transformations
Properties of Affine Transformations If M is the 2D transformation matrix, then Rotation, translation, and shearing do not change the area (why?) For scaling, new area = (old area)|SxSy| If M is the 3D transformation matrix, then
Properties of Affine Transformations The columns of the matrix M reveal the transformed coordinate frame In 2D, The axes of the new coordinate frame are m1 and m2, and the origin is m3 The axes of new coordinates frame are not necessarily perpendicular nor must they be of unit length
Changing Coordinate Systems Suppose coordinate system #2 is formed from coordinate system #1 by affine transformation M , then for a point P in system #2, its coordinates are MP. System #2 P b System #1 d c j’ i j i’ a
Changing Coordinate Systems Successive changes in coordinate system System #3 P b f System #2 e System #1 d c System #1 System #2 System #3 M1 a M2
Changing Coordinate Systems Transforming points If a sequence of transformations, represented by M1, M2, …, Mn, is applied to a point P, then P is transformed to MP, where M = Mn M2 M1 Transforming coordinate system If a sequence of transformations represented by M1, M1, …, Mn, is applied to the coordinate system, then a point P expressed in the transformed system has coordinates MP in the original system, where M = M1 M2 Mn