Page 139 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 139

Unit 8: Implementing of Scaling in 2D Transformation



                     150                                                                          Notes
                     150
                     Enter your choice: 2
                     Enter the fixed point
                     150
                     150
                     Enter your choice: 3
                     Enter the fixed point
                     150
                     150
                     ******2DTransformations******* 1.Translation
                     2. Rotation
                     3. Scaling
                     4. Reflection
                     5. Shearing
                     6. Exit
                     Enter your choice: 5
                     *******Shearing*********
                     1. x-direction shear
                     2. y-direction shear
                     Enter your choice: 1
                     Enter the value of shear: 2
                     Enter your choice: 2
                     Enter the value of shear: 2
            RESULT:  Thus  the  c  program  to  implement  2D  transformations  was  coded  and  executed
            successfully.

                          2×SaI, short for 2× Scale and Interpolation engine, was inspired by Eagle.


            8.2.6 Homogeneous Coordinates
            In general, when you want to execute a complex transformation, you usually compose it by
            combining a number of essential transformations. The above equation for q, however, is awkward
            to read because scaling is done by matrix multiplication and translation is done by vector addition.
            In order to represent all transformations in the same form, computer scientists have devised what
            are called homogeneous coordinates. Do not try to apply any exotic interpretation to them. They
            are merely a mathematical hoax to create the representation be more steady and easier to apply.
                                           S È  0  0˘
                                          Í  x     ˙
                       [x  y  1] = [x  y  1] 0  S y  0 ˙
                                          Í
                                          Í  0  0  1 ˙
            Homogeneous Form of Scale:    Î        ˚
            Recall the (x, y) form of Scale:
                                   s È  0 ˘
                          S(s x , s y ) =   Í  x  ˙
                                   Î 0  s y ˚



                                             LOVELY PROFESSIONAL UNIVERSITY                                   133
   134   135   136   137   138   139   140   141   142   143   144