2D Transformations – Sample Output


1 . Translation

INPUT :

4                                  // No. of vertices of Polygon
20      20                         //(x,y) Co-ordinates of Vertices
100     20
100     100
20      100
2                                  // Selected option 2 for Translation
-50      -140                      //  Translation along X & Y

OUTPUT :

2DTrans1

2 . Rotation

INPUT :

4                                 // No. of vertices of Polygon
20      20                        // (x,y) Co-ordinates of Vertices
100     20
100     100
20      100
3                                 // Choice no. for Rotation
60                                // Angle of Rotation in Degrees
-50      -50                      // Reference point Co-ordinates

OUTPUT :

2DTrans2

3 . Scaling

INPUT :

4                                  // No. of vertices of Polygon
20      20                         // (x,y) Co-ordinates of Vertices
100     20
100     100
20      100
4                                  // Choice no. for Scaling
0.5      0.5                       // Scaling factors along X & Y

OUTPUT :

2DTrans3

4 . Reflection

About arbitrary line y=mx+c

INPUT :

4                                 // No. of vertices of Polygon
20      20                        // (x,y) Co-ordinates of Vertices
100     20
100     100
20      100
5                                 // Choice no. for Reflection
4                                 // Choice for Reflection about y=mx+c
1        -30                      //  m  &  c values

OUTPUT :

2DTrans4

5 . Shearing

X-direction Shear

INPUT :

4                                  // No. of vertices of Polygon
20      20                         // (x,y) Co-ordinates of Vertices
100     20
100     100
20      100
6                                  // Choice no. for Shearing
1                                  // Choice no. for Shear about X axis
1.5                                // Shear Coefficient

OUTPUT :

2DTrans5

6 . Composite Transformation

INPUT :

4                                   // No. of vertices of Polygon
20      20                          // (x,y) Co-ordinates of Vertices
100     20
100     100
20      100
1                                   // Choice no. for Comp. Transf.
-50     -50                         // Reference Point Co-ordinates
60                                  // Angle of Rotation in Degrees
-40      -80                        // Translation along X & Y
1.5      1.5                        // Scaling factors along X & Y

OUTPUT :

2DTrans6

Also Visit:

Leave a comment