Tuesday 10 May 2016

Computer Graphics Problem Solution of 2D Transformation

Computer Graphics Problem Solution of 2D Transformation

Translation


2D Geometrical transformation is defined as, Let (A, B) be a straight line segment between the points A and B. Let T be a general 2D transformation. Then a T transforms can be applied on (A, B) into another straight line segment  to achieve (A’, B’), where:
   A’=TA and 

B’=TB
Problem: Consider an Object shown in figure below, what will be its new  Shape and Location after  Shearing of (4, 6) on vertex-1 and (8,12) on Vertex-3. The location is translated (5, -5) and Rotated (350). Draw the Graph also. 

2D Transformation

 
Shear (x+ay, y+bx)
V1= (4,8), shear on V1 is (4,6)
  => (4+4x8,  8+6x4) 
  =  (36, 32)=V1`

V3= (2,2), shear on V3 is (8,12)
  => (2+8x2,  2+12x2)  
  = (18, 26)=V3`
Graph of 2D Shear
Graph of 2D Shear

Translation of (5,-5) will be done on all three vertex. Here we will use New Vertex coordinates, V1`, V2, V3`.  
V1` = (36, 32) => (36+5, 32-5) 
      = (41, 27) = V1T
V2 = (6, 2) => (6+5, 2-5
      = (11, -3) = V2T
V3` = (18, 26) => (18+5, 26-5
      = (23, 21) = v3T

Graph of 2D Translation
Graph of 2D Translation

Finally Rotation of 350 is performed again on three vertices, with their new location.

(x, y) => (x cos(q)+ysin(q), -x sin(q)+y cos(q) )

V1T = (41, 27) => (41 cos(35) +27sin(35) , -41sin(35) + 27cos(35) )
    => (( 41 x 0.819) + (27 x 0.573) , (-41 x 0.573) + (27 x 0.819) )
    =>  ( 33.579 + 15.471 , -23.493 + 22.113)
    V1R  => (49.05 , -1.38)  => 
     V1R = Roundoff( 49, -1)

V2T = (11, -3) => (11 cos(35) +-3sin(35) , -11sin(35) + -3cos(35) )
  => (( 11 x 0.819) + (-3 x 0.573) , (-11 x 0.573) + (-3 x 0.819) )
  =>  ( 9.009 + (-1.719) , -6.303 + (-2.457))
  V2R  => (7.29 , -8.76)  
 V2R = Roundoff( 7, -9)

V3T = (23, 21) => (23 cos(35) +21sin(35) , -23sin(35) + 21cos(35) )
  => (( 23 x 0.819) + (21 x 0.573) , (-23 x 0.573) + (21 x 0.819) )
  =>  ( 18.837 + 12.033 , -13.179 + 17.199)
  V3R  => (30.87 , 4.02)  
V3R = Roundoff( 31, 4)
  
Graph of 2D Rotation
Graph of 2D Rotation

1 comment:

  1. Wow. You are a life saver. This is an easy solution and interpretation of this problem. This is a very helpful resource by you indeed!

    ReplyDelete

Featured post

Addmision are open

  Offering Professional Courses in the field of  Multimedia, Animation and Graphics