tailieunhanh - Lecture Computer graphics - Chapter 4: Using Transformations in OpenGL
This chapter presents the following content: What is a transformation? How are transforms represented? Affine transformations, composing transforms, 3D rotations, geometric interpretation 3D rotations, homogeneous coordinates,. | Transformations 1 10/14/2013 An Interactive Introduction to OpenGL Programming 1 What is a Transformation? Maps points (x, y) in one coordinate system to points (x', y') in another coordinate system x' = ax+ by + c y' = dx+ ey+ f Simple Transformations can be combined 10/14/2013 2 Transformations are used Position objects in a scene (modeling) Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations 10/14/2013 3 How are Transforms Represented? Biểu diễn dưới dạng ma trận p' = M p + t 4 10/14/2013 2D transformations 10/14/2013 5 Affine Transformations Want transformations which preserve geometry lines, polygons, quadrics Affine = line preserving Rotation, translation, scaling Projection Concatenation (composition) 6 10/14/2013 An Interactive Introduction to OpenGL Programming 6 The transformations supported by OpenGL are a special class that is important for graphical applications and for problems in science and engineering. In particular, | Transformations 1 10/14/2013 An Interactive Introduction to OpenGL Programming 1 What is a Transformation? Maps points (x, y) in one coordinate system to points (x', y') in another coordinate system x' = ax+ by + c y' = dx+ ey+ f Simple Transformations can be combined 10/14/2013 2 Transformations are used Position objects in a scene (modeling) Change the shape of objects Create multiple copies of objects Projection for virtual cameras Animations 10/14/2013 3 How are Transforms Represented? Biểu diễn dưới dạng ma trận p' = M p + t 4 10/14/2013 2D transformations 10/14/2013 5 Affine Transformations Want transformations which preserve geometry lines, polygons, quadrics Affine = line preserving Rotation, translation, scaling Projection Concatenation (composition) 6 10/14/2013 An Interactive Introduction to OpenGL Programming 6 The transformations supported by OpenGL are a special class that is important for graphical applications and for problems in science and engineering. In particular, affine transformations will not alter the type of object. A transformed line (polygon, quadric) is still a line (polygon, quadric). Any composition of affine transformations is still affine. For example, a rotation followed by a translation followed by a projection preserves lines and polygons. (Nonuniform) Scale 10/14/2013 7 (Nonuniform) Scale Scale S = S-1 = 10/14/2013 8 Shear Shear = S-1 = 10/14/2013 9 Rotations 2D simple, 3D complicated. [Derivation? Examples?] 2D? Linear Commutative R(X+Y) = R(X)+R(Y) 10/14/2013 10 Composing Transforms Often want to combine transforms . first scale by 2, then rotate by 45 degrees Advantage of matrix formulation: All still a matrix Not commutative!! Order matters X2 = SX1 X3 = RX2 X3 = R(SX1) = (RS)X1 X3 (SR)X1 10/14/2013 11 Inverting Composite Transforms Say I want to invert a combination of 3 transforms Option 1: Find composite matrix, invert Option 2: Invert each transform and swap order Obvious from properties of matrices 10/14/2013 12 3D
đang nạp các trang xem trước