Related Articles

# Computer Graphics – 3D Composite Transformation

• Last Updated : 28 Jun, 2021

3-D Transformation is the process of manipulating the view of a three-D object with respect to its original position by modifying its physical attributes through various methods of transformation like Translation, Scaling, Rotation, Shear, etc.

Types of Transformation:

1. Translation Transformation
2. Scaling Transformation
3. Rotation Transformation
4. Shearing Transformation
5. Reflection Transformation

Note: If we’re asked to perform three or more different sorts of transformations over a point(P0) simultaneously which is placed in 3D space, and let us assume that these transformations are T1, T2, and T3 respectively, then in this case what we’ll do?

So, we will see the following solutions

a) Obviously, first by applying series of Transformations one by one over the coordinates of the object sequentially.

First we performed transformation T1, then Po become transformed to P1.

Secondly, we perform transformation T2 and the point P1 become transformed to P2.

Lastly, we perform transformation T3 and we get the final result i.e; P3,and we will get our final transformed point coordinate(P3).

b) Second solution, by applying Composite transformation in a single shot. Note: Here T1, T2, T3 correspond to their transformation matrix condition.

### Composite Transformation

As its name suggests itself composite, here we compose two or more than two transformations together and calculate a resultant(R) transformation matrix by multiplying all the corresponding transformation matrix conditions with each other.

The same equivalent result that we got over Point P0 and transformed it into P3 in the above example can also be achieved by directly multiplying resultant R with the point P0 rather than performing transformations T1, T2, and T3 sequentially one after one. And we end up with the same equivalent result that we got into our above example.

Problem: Consider we are given with a cuboid “OABCDEFG” over which we want to perform

• Translation transformation(T1) if translation distances are Dx=2, Dy=3, Dz=2 ,then
• Scaling transformation(T2) if scaling factors are sx=2, sy=1, sz=3 and lastly perform,
• Shearing transformation(T3) in x-direction if shearing factors are sy=2 and sz=1.

Solution: We are given the following cuboid Fig.1

First, we perform translation transformation T1:

The Translation transformation matrix is shown as: [Tex]\hspace{4.37cm}\mathbf{T_1=\left[\begin{matrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\D_x&D_y&D_z&1\end{matrix}\right]}\\ \mathbf{Where \hspace{0.2cm}D_x=2,D_y=3\hspace{0.2cm} and\hspace{0.2cm} D_z=3\hspace{0.2cm} are\hspace{0.2cm}translation\hspace{0.2cm} distances.} [/Tex]

Now apply this translation transformation matrix condition over the coordinates:

#### For coordinate O[0 0 0], the newly translated coordinate would be O1: #### For coordinate A[0 0 4], the newly translated coordinate would be A1: #### For coordinate B[0 4 2], the newly translated coordinate would be B1: #### For coordinate C[2 4 0], the newly translated coordinate would be C1: #### For coordinate D[2 2 4], the newly translated coordinate would be D1: #### For coordinate E[2 0 0], the newly translated coordinate would be E1: #### For coordinate F[0 0 2], the newly translated coordinate would be F1: #### For coordinate G[2  0  2], the newly translated coordinate would be G1:  Fig.2

#### Secondly, we are said to perform Scaling transformation T2:

The Scaling transformation matrix is shown as: Now apply this Scaling transformation matrix condition over the coordinates:

#### For coordinate O1[2 3 2], the newly Scaled coordinate would be O2: #### For coordinate A1[2 3 6], the newly Scaled coordinate would be A2: #### For coordinate B1[2 7 4], the newly Scaled coordinate would be B2: #### For coordinate C1[4 7 2], the newly Scaled coordinate would be C2: #### For coordinate D1[4 5 6], the newly Scaled coordinate would be D2: #### For coordinate E1[4 3 2], the newly Scaled coordinate would be E2: #### For coordinate F1[2 3 4], the newly Scaled coordinate would be F2: #### For coordinate G1[4 3 4], the newly Scaled coordinate would be G2:  Fig.3

Lastly, we perform Shearing transformation T3 in x-direction:

The Shearing transformation matrix for x-direction is shown as: Now, apply this Shearing transformation matrix condition over the coordinates:

#### For coordinate O2[4 3 6], the newly Scaled coordinate would be O3: #### For coordinate A2[4  3 18], the newly Scaled coordinate would be A3: #### For coordinate B2[4  7 12], the newly Scaled coordinate would be B3: #### For coordinate C2[8  7  6], the newly Scaled coordinate would be C3: #### For coordinate D2[8   5  18], the newly Scaled coordinate would be D3: #### For coordinate E2[8  7  6], the newly Scaled coordinate would be E3: #### For coordinate F2[4  3  12], the newly Scaled coordinate would be F3: #### For coordinate G2[8  3 12], the newly Scaled coordinate would be G3: #### Finally, we get our resized slanted object in the x-direction after performing transformations T1, T2 and T3. Fig.4

#### Solution through Composite Transformation

The final result, that we got above for the cuboid “OABCDEF” through applying transformation T1, T2, and T3  one after one in sequential order the same equivalent result could also be got by using the concept of Composite Transformation. To perform composite transformation first we need to calculate the Resultant Transformation matrix(R) by combining all the distinguished transformation matrix representations together.

The resultant transformation matrix would be calculated as follows:

The resultant transformation will be calculated by multiplying the Translation transformation matrix with the Scaling transformation matrix and the resultant(R2) multiplication of both will then be multiplied with the last given, Shearing transformation matrix. Now, multiply R2 with the Shearing transformation matrix to get resultant R: \

Now, apply this resultant transformation matrix condition over the coordinates:

For coordinate O[0 0 0], the new Scaled coordinate would be O3: For coordinate A[0 0 4], the newly Scaled coordinate would be A3: For coordinate B[0 4 2], the newly Scaled coordinate would be B3: For coordinate C[2 4 0], the newly Scaled coordinate would be C3: For coordinate D[2  2  4], the newly Scaled coordinate would be D3: For coordinate E[2  0  0], the newly Scaled coordinate would be E3: For coordinate F[0  0  2], the newly Scaled coordinate would be F3: For coordinate G[2  0  2], the newly Scaled coordinate would be G3: Here, we get our final result in a single shot: Fig.5

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up