# Computer Graphics – 3D Composite Transformation

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:**

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.

- Translation Transformation
- Scaling Transformation
- Rotation Transformation
- Shearing Transformation
- Reflection Transformation

**Note:** If we’re asked to perform three or more different sorts of transformations over a point(P_{0}) simultaneously which is placed in 3D space, and let us assume that these transformations are T_{1}, T_{2}, and T_{3} 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 T

_{1, }then P_{o}become transformed to P_{1.}Secondly, we perform transformation T

_{2}and the point P_{ }_{1}become transformed to P_{2.}Lastly, we perform transformation T

_{3 }and we get the final result i.e; P_{3,}and we will get our final transformed point coordinate(P_{3}).

**b)** Second solution, by applying Composite transformation in a single shot.

**Note: **Here T_{1}, T_{2}, T_{3} 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** P _{0}** and transformed it into

**P**in the above example can also be achieved by directly multiplying resultant

_{3}**R**with the point

**P**rather than performing transformations

_{0}**T**sequentially one after one.

_{1}, T_{2}, and T_{3}

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(T___{1}__)__if translation distances are D_{x}=2, D_{y}=3, D_{z}=2 ,then__Scaling transformation(T___{2}__)__if scaling factors are s_{x}=2, s_{y}=1, s_{z}=3 and lastly perform,__Shearing transformation(T___{3}__)__in x-direction if shearing factors are s_{y}=2 and s_{z}=1.

**Solution: **We are given the following cuboid

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 O___{1}__:__

__For coordinate O[0 0 0], the newly translated coordinate would be O__

_{1}

__:__

__For coordinate A[0 0 4], the newly translated coordinate would be A___{1}__:__

__For coordinate A[0 0 4], the newly translated coordinate would be A__

_{1}

__:__

__For coordinate B[0 4 2], the newly translated coordinate would be B___{1}__:__

__For coordinate B[0 4 2], the newly translated coordinate would be B__

_{1}

__:__

__For coordinate C[2 4 0], the newly translated coordinate would be C___{1}__:__

__For coordinate C[2 4 0], the newly translated coordinate would be C__

_{1}

__:__

__For coordinate D[2 2 4], the newly translated coordinate would be D___{1}__:__

__For coordinate D[2 2 4], the newly translated coordinate would be D__

_{1}

__:__

__For coordinate E[2 0 0], the newly translated coordinate would be E___{1}__:__

__For coordinate E[2 0 0], the newly translated coordinate would be E__

_{1}

__:__

__For coordinate F[0 0 2], the newly translated coordinate would be F___{1}__:__

__For coordinate F[0 0 2], the newly translated coordinate would be F__

_{1}

__:__

__For coordinate G[2 0 2], the newly translated coordinate would be G___{1}__:__

__For coordinate G[2 0 2], the newly translated coordinate would be G__

_{1}

__:__

__Secondly, we are said to perform Scaling transformation T___{2}__:__

The Scaling transformation matrix is shown as:

Now apply this Scaling transformation matrix condition over the coordinates:

__For coordinate O___{1}__[2 3 2], the newly Scaled coordinate would be O___{2}__:__

__For coordinate O__

_{1}

__[2 3 2], the newly Scaled coordinate would be O__

_{2}

__:__

__For coordinate A___{1}__[2 3 6], the newly Scaled coordinate would be A___{2}__:__

__For coordinate A__

_{1}

__[2 3 6], the newly Scaled coordinate would be A__

_{2}

__:__

__For coordinate B___{1}__[2 7 4], the newly Scaled coordinate would be B___{2}__:__

__For coordinate B__

_{1}

__[2 7 4], the newly Scaled coordinate would be B__

_{2}

__:__

__For coordinate C___{1}__[4 7 2], the newly Scaled coordinate would be C___{2}__:__

__For coordinate C__

_{1}

__[4 7 2], the newly Scaled coordinate would be C__

_{2}

__:__

__For coordinate D___{1}__[4 5 6], the newly Scaled coordinate would be D___{2}__:__

__For coordinate D__

_{1}

__[4 5 6], the newly Scaled coordinate would be D__

_{2}

__:__

__For coordinate E___{1}__[4 3 2], the newly Scaled coordinate would be E___{2}__:__

__For coordinate E__

_{1}

__[4 3 2], the newly Scaled coordinate would be E__

_{2}

__:__

__For coordinate F___{1}__[2 3 4], the newly Scaled coordinate would be F___{2}__:__

__For coordinate F__

_{1}

__[2 3 4], the newly Scaled coordinate would be F__

_{2}

__:__

__For coordinate G___{1}__[4 3 4], the newly Scaled coordinate would be G___{2}__:__

__For coordinate G__

_{1}

__[4 3 4], the newly Scaled coordinate would be G__

_{2}

__:__

Lastly, we perform Shearing transformation T_{3 }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 O___{2}__[4 3 6], the newly Scaled coordinate would be O___{3}__:__

__For coordinate O__

_{2}

__[4 3 6], the newly Scaled coordinate would be O__

_{3}

__:__

__For coordinate A___{2}__[4 3 18], the newly Scaled coordinate would be A___{3}__:__

__For coordinate A__

_{2}

__[4 3 18], the newly Scaled coordinate would be A__

_{3}

__:__

__For coordinate B___{2}__[4 7 12], the newly Scaled coordinate would be B___{3}__:__

__For coordinate B__

_{2}

__[4 7 12], the newly Scaled coordinate would be B__

_{3}

__:__

__For coordinate C___{2}__[8 7 6], the newly Scaled coordinate would be C___{3}__:__

__For coordinate C__

_{2}

__[8 7 6], the newly Scaled coordinate would be C__

_{3}

__:__

__For coordinate D___{2}__[8 5 18], the newly Scaled coordinate would be D___{3}__:__

__For coordinate D__

_{2}

__[8 5 18], the newly Scaled coordinate would be D__

_{3}

__:__

__For coordinate E___{2}__[8 7 6], the newly Scaled coordinate would be E___{3}__:__

__For coordinate E__

_{2}

__[8 7 6], the newly Scaled coordinate would be E__

_{3}

__:__

__For coordinate F___{2}__[4 3 12], the newly Scaled coordinate would be F___{3}__:__

__For coordinate F__

_{2}

__[4 3 12], the newly Scaled coordinate would be F__

_{3}

__:__

__For coordinate G___{2}__[8 3 12], the newly Scaled coordinate would be G___{3}__:__

__For coordinate G__

_{2}

__[8 3 12], the newly Scaled coordinate would be G__

_{3}

__:__

#### Finally, we get our resized slanted object in the x-direction after performing transformations T_{1}, T_{2 }and T_{3}.

__Solution through Composite Transformation__

The final result, that we got above for the cuboid “OABCDEF” through applying transformation T_{1}, T_{2}, and T_{3 }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(R_{2}) 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 O _{3}:**

**For coordinate A[0 0 4], the newly Scaled coordinate would be A _{3}:**

**For coordinate B[0 4 2], the newly Scaled coordinate would be B _{3}:**

**For coordinate C[2 4 0], the newly Scaled coordinate would be C _{3}:**

**For coordinate D[2 2 4], the newly Scaled coordinate would be D _{3}:**

**For coordinate E[2 0 0], the newly Scaled coordinate would be E _{3}:**

**For coordinate F[0 0 2], the newly Scaled coordinate would be F _{3}:**

**For coordinate G[2 0 2], the newly Scaled coordinate would be G _{3}:**

Here, we get our final result in a single shot: