Page 86 - DCAP504_Computer Graphics
P. 86

Unit 6: 2-D Transformation



                                          4 
                                  P’ = 8
                                        
                                        
                                       1 
                                  Therefore the value of P’ in homogeneous representation is [4 8 1]. The point
                                  coordinate (2, 4) after scaling by a factor=2 is (4, 8).



                           We have learnt in the beginning of the unit that translation transformation is performed
                           by adding translation matrix and point coordinate matrix. However, in homogeneous
                           coordinate system, the translation transformation is performed by multiplying the
                           transformation matrix and homogeneous representation of the object’s point coordinate
                           values.
               6.3   Composite and Inverse Transformations

               The linear transformations that are represented using matrices can be easily composed, i.e., combined. It
               can also be inverted or reversed, i.e., to get the original object from  the transformation. The use of
               matrix and homogeneous representation helps to perform transformations such as translation, scaling,
               rotation, reflection, and searing using a single matrix.
               Composite Transformation
               Now let us learn how to compose or combine two transformations? This can be achieved by simple
               matrix multiplication. Consider A and B as the matrices of any two linear transformations which you
               want to apply to a 2-D object. The effect of applying ‘A’ transformation first and then ‘B’ transformation
               to the object can be achieved by multiplying A and B transformation, and then applying the resultant
               transformation to the object.

                                  Consider that the  rectangle object with coordinate values represented in
                                  homogeneous coordinate system representation are [0 0 1], [2 0 1], [2 2 1] and [0
                                  2 1]. The rectangle has to be scaled by a scaling factor 0.5 in X and Y directions.
                                  After scaling the matrix it has to be rotated by  an angle  90 degree
                                  counterclockwise about the origin.
                                  The scaling matrix is given by,

                                                 50.  0   0 
                                                
                                  Scaling matrix=   0  0. 5   0
                                                        
                                                  0  0  1 
                                  The coordinates of the rectangle after applying scaling transformation are [0 0
                                  1], [1 0 1], [1 1 1], and [0 1 1].
                                  Rotation matrix to obtain the rotation of 90 degree counterclockwise,

                                    cos 90  − sin 90   0   0  −1   0 
                                                      
                                    
                                   =   sin 90  cos 90   0  = 1  0   0
                                                           
                                      0      0    1    0  0  1 
                                  The rotation transformation is applied to the scaled matrix. The coordinates of
                                  the scaled rectangle after applying rotation transformation are [0 0 1], [0 1 1], [-1
                                  1 1] and [-1 0 1].
                                  Figure 6.9 shows  all the three rectangle objects, i.e., original object, original
                                  object after scaling transformation, and rotation of the scaled object.
                                  The same result can be obtained by multiplying the scaling matrix and rotation
                                  matrix and then multiplying the point coordinate matrix values of the rectangle



                                        LOVELY PROFESSIONAL UNIVERSITY                           79
   81   82   83   84   85   86   87   88   89   90   91