2D transformation
Transformation means that changing some graphics into different we've various kinds of transformation like translation, scaling, up or down, rotation, shearing. when a transformation text place on a 2D plane is called 2D transformation.Homogeneous coordinates:
To perform a sequence of transformation like translation followed by rotation and scaling we'd like to follow a sequential process.
1) translate the coordinate.
2) rotate the translated coordinate.
3) scale the rotated co-ordinate to complete composite transformation.
For this process we have to use 3*3 transformation Matrix Institute of 2*2 transformation matrix. To convert a 2*2 Matrix into 3*3 we add an extra co-ordinate 'w'.
In this way beacon represent the point by 3 e number instead of two number which is called homogeneous co-ordinate system.
Translation:
Translation moves ad object to a different position on the screen. You can translate a point in 2 dimensional by adding translation coordinate. (tx,ty) to the original co-ordinate (x, y) to get the new coordinate (x',y').From the above figure we can write
x' = x + tx
y' = y + ty
The pear TX, TY is called the translation vector or Swift vector the above equation can also be represented by using the column vector
P=[x][y]P'
That is P' = P+T
Rotation:
Invitation process be rotate the object at particular ∠ θ from its origin from the figure we can see that the point P(x,y) is the located at ∠ φ from the from the horizontal x co-ordinate with distance ‘ r ’.from the origin let us suppose you want to rotate it at ∠ θ and after rotating it to a new location you will get new point 'P'(x',y')
Using the standard of Krishna Matric rules the original coordinates of point P(x,y) can be represent as
X = r cosφ (1)
Y = r sinφ (2)
Same way we are able to represent the point P'(x',y') as
x' = rcos(φ+θ)
y' = rsin(φ+θ)
x' = r cos(φ + θ)= r cosφ cosθ - r sinφ sinθ (3)
y' = r sin(φ + θ)= r cosφ sinθ + r sinφ cosθ (4)
Substitute the value of equation (1) and (2) in equation (3) and (4)
x' = x cosθ – y sinθ (5)
y' = x sinθ + y cosθ (6)
Representing the above equation in matrix form [x' y'] = [x y][cosθsinθ-sinθcosθ]
Or P' = P.R
Where R is the rotation matrix.
Scaling:
Scaling transformation is used to change the size of an object in the scaling process either we can expand of compress the dimension of the object. Scaling can be achieved by multiplying the original coordinates of the object with the spelling factor to get the desired result. Let us assume that the original co-ordinate are (x, y) and the scaling factor are (Sx,Sy) and the produce coordinate are (x',y') this can be mathematically represented asx'= x.Sx. and y'=y.Sy.
Sx and Sy is the scaling factor with the respect to x & y co-ordinate.
The above equation can also be represented in matrix from as [x' y'] = [x y][Sx Sy]
No comments:
Post a Comment