#### Problem Statement :

Write C++/Java program to implement translation, shear, rotation and scaling transformations on equilateral triangle and rhombus.

#### Transformation:

Change in image is called image transformation.
##### 1. Translation:

Translation is a process of changing the position of an object in a straight line path from one
coordinate location to another
Consider a point P(x1, y1) to be translated to another point Q(x2, y2). If we know the point
value (x2, y2) we can directly shift to Q by displaying the pixel (x2, y2). On the other hand,
suppose we only know that we want to shift by a distance of Tx along x axis and Ty along Y
axis. Then obviously the coordinates can be derived by x2 =x1 +Tx and Y2 = y1+ Ty.
Suppose we want to shift a triangle with coordinates at A(20,10), B(30,100) and C(40,70). The
shifting to be done by 20 units along x axis and 10 units along y axis. Then the new triangle
will be at A1(20+20, 10+10) B1 (30+20, 10+10) C1(40+20, 70+10) In the matrix form
[x’ y’] = [x1 y1] + T where T is translational matrix
##### 2. Scaling :

A scaling transformation changes the size of an object.
Suppose we want the point (x1 y1) to be scaled by a factor sx and by a factor sy along y
direction.
Then the new coordinates become : x2 = x1 * sx and y2 = y1 * sy
##### 3. Rotation:

A 2D rotation is applied to an object by repositioning it along a circular path in the xy plane.
To generate a rotation, we specify a rotation angle θ and the position of the rotation point about
which the object is to be rotated.
Suppose we want to rotate a point (x1 y1) clockwise through an angle? about the origin of the
coordinate system. Then mathematically we can show that
x2 = x1cos θ + y1sin θ and
y2 = x1sin θ – y1cos θ
These equations become applicable only if the rotation is about the origin.
##### Shearing:

A transformation that slants the shape of an object is called the shear transformation. Two common transformations are used. One shifts X coordinate values and other shifts y co-
ordinate values. However, in both the cases only one co-ordinate (x or y) changes its co-
ordinates and other preserves its values.

X shear :
The X shear preserves the y coordinates, but changes the x values which causes vertical lines to tilt right or left.
Y -shear :
The Y shear preserves the x- coordinates, but changes the y values which causes horizontal
lines to transform into lines which slope up or down .