Computer Graphics – 3D Shearing Transformation
Shearing transformation is the same as we see in 2D space, but here we have to deal with the x, y, and z axes whereas in 2D we deal with the only x and y axes. Shearing is the process of slanting an object in 3D space either in x, y, or in the z-direction. Shearing changes(or deformed) the shape of the object. AS we are discussing 3D space so shearing can also be done in any of the three directions as follows. Given below are the types of shearing transformation.
- Shearing in X-direction.
- Shearing in y-direction
- Shearing in z-direction.
Shearing in X-Direction: Here the coordinate of X remains unchanged while the coordinate of Y and Z is changed. Shearing is done through the Shearing Transformation matrix, which is represented as follows.
![Rendered by QuickLaTeX.com \hspace{6.08cm} \mathbf{S_x=\left [\begin{matrix}1&s_y&s_z&0\\0&1&0&0 \\0&0&1&0\\0&0&0&1\end{matrix}\right] }](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-626af0d5f27374431d22ee69361b15b8_l3.png)
Consider a point P[x, y, z] in 3D space over which we perform the shearing transformation in the X-direction and it becomes P'[x, y, z].
![Rendered by QuickLaTeX.com \mathbf{P'[x\hspace{0.2cm}y \hspace{0.2cm}z\hspace{0.2cm}1]= P[x_o\hspace{0.2cm}y_o\hspace{0.2cm}z_o\hspace {0.2cm}1].S_x}\\ \newline \hspace {6.08cm}\mathbf{P'[x, \hspace{0.2cm}y, \hspace{0.2cm}z]=[x_o, \hspace{0.2cm}y_n, \hspace{0.2cm}z_n]} \\](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-c0f80e62175809365075de2377d26322_l3.png)
![Rendered by QuickLaTeX.com \textbf{The coordinate}\, \, \mathbf{P'[x_n, y_n, z_n]}\, \, \textbf{can also be calculated using below equations:} \newline \hspace{6.8cm}\mathbf{x_n = x_o \hspace{0.4cm}Remains\hspace{0.2cm}unchanged} \\ \hspace{6.8cm}\mathbf{y_n=y_o+s_y.x_o} \\ \hspace{6.8cm}\mathbf{z_n=z_o+s_z.x_0}\\](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-d6f6ea977cd36373b226c44e68516fc6_l3.png)
Shearing in Y-Direction: Here the coordinate of Y remains unchanged while the coordinate of X and Z are changed. Shearing is done through the Shearing Transformation matrix, which is represented as follows.
![Rendered by QuickLaTeX.com \mathbf{S_y= \left [\begin{matrix}1&0&0&0\\s_x&1&s_z&0 \\0&0&1&0\\0&0&0&1\end{matrix}\right] }](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-2d953c8ca112a61e517ba9e957ee12a3_l3.png)
Consider a point P[x, y, z] in 3D space over which we perform the shearing transformation in the Y-direction and it becomes P'[x, y, z].
![Rendered by QuickLaTeX.com \mathbf{P'[x\hspace{0.2cm}y \hspace{0.2cm}z\hspace{0.2cm}1]=P[x_o\hspace {0.2cm}y_o\hspace{0.2cm}z_o\hspace{0.2cm}1].S_y} \\ \newline \hspace{6.08cm}\mathbf{P'[x, \hspace{0.2cm}y, \hspace{0.2cm}z]=[x_n, \hspace{0.2cm}y_o, \hspace{0.2cm}z_n]} \\ \newline](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-8982df46a8cbd2ffa74de35140f2606e_l3.png)
![Rendered by QuickLaTeX.com \textbf{The coordinate}\, \, \mathbf{P'[x_n, y_n, z_n]}\, \, \textbf{can also be calculated using below equations:} \newline \hspace{6.8cm}\mathbf{x_n = x_o+s_x.y_o } \\ \hspace{6.8cm}\mathbf{y_n=y_o \hspace{0.4cm}Remains \hspace{0.2cm}unchanged}\\ \hspace{6.8cm} \mathbf{z_n=z_o+s_z.y_o }\\](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-191458f9c94859dd759c8594b2fcd0d2_l3.png)
Shearing in Z-Direction: Here the coordinate of Z remains unchanged while the coordinate of X and Y are changed. Shearing is done through the Shearing Transformation matrix, which is represented as follows for the shearing in Z-direction.
![Rendered by QuickLaTeX.com \mathbf{S_z =\left [\begin{matrix}1&0&0&0 \\0&1&0&0\\s_x&s_y&1&0 \\0&0&0&1\end{matrix}\right] }](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-7c426851db8acb45b7a1e74be5fce626_l3.png)
Consider a point P[x, y, z] in 3D space over which we perform the shearing transformation in the Z-direction and its become P'[x, y, z].
![Rendered by QuickLaTeX.com \mathbf{P'[x\hspace{0.2cm} y\hspace{0.2cm}z\hspace{0.2cm}1]=P[x_o \hspace{0.2cm}y_o\hspace{0.2cm}z_o\hspace {0.2cm}1].S_z}\\ \newline \hspace{6.08cm} \mathbf{P'[x, \hspace{0.2cm}y, \hspace{0.2cm}z]=[x_n, \hspace{0.2cm}y_n, \hspace{0.2cm}z_o]}\\](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-db037bcab62e14fb278b0bc1882af3a8_l3.png)
![Rendered by QuickLaTeX.com \textbf{The coordinate}\, \, \mathbf{P'[x_n, y_n, z_n]}\, \, \textbf{can also be calculated using below equations:} \newline \hspace{6.8cm}\mathbf{x_n = x_o+s_x.z_o } \\ \hspace{6.8cm}\mathbf{y_n=y_o+s_y.z_o} \\ \hspace{6.8cm}\mathbf{z_n=z_o \hspace{0.4cm}Remains \hspace{0.2cm}unchanged}\\](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-bc4f1c4db239217cceddcf6d55e60cb7_l3.png)
Note: Here, xn, yn, zn Are showing=new values and xo, yo, zo Are showing=old values.
Perform Shearing Transformation in the given cuboid(OABCDEFG) along Z-direction if a shearing parameter is as follows Sx=2, Sy=3.
The Shearing transformation matrix for z-direction is as follows.
![Rendered by QuickLaTeX.com \mathbf{S_z=\left [\begin{matrix}1&0&0&0\\0&1&0&0\\s_x&s_y&1&0 \\0&0&0&1\end{matrix}\right]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-88cbc433b46c0e763034295ac47a8b7d_l3.png)
And the given cuboid is as below:

Fig.1
Now, we’ll apply the shearing transformation condition over all the coordinates and calculate the new corresponding coordinates:
Point O[0, 0, 0] becomes O’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf {O'[x\hspace{0.2cm}y\hspace {0.2cm}z\hspace{0.2cm}1]= [0\hspace{0.2cm}0\hspace{0.2cm}0 \hspace{0.2cm}1]\left [\begin{matrix}1&0&0&0 \\0&1&0&0\\2&3&1&0\\0&0&0&1 \end{matrix}\right]} \\ \newline \hspace{7.09cm}\mathbf{= [\hspace{0.2cm}0\hspace{0.2cm}0\hspace {0.2cm}0\hspace{0.2cm}1]}\\ \newline \hspace{4.37cm}\mathbf {O'[x\hspace{0.2cm}y\hspace {0.2cm}z\hspace{0.2cm}1]= [\hspace{0.2cm}0\hspace{0.2cm}0 \hspace{0.2cm}0\hspace{0.2cm}1]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-bf4b85f2ec0552f4ca16b2467e3288a7_l3.png)
Point A'[0, 0, 4] becomes A’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{A'[x \hspace {0.2cm}y\hspace{0.2cm}z \hspace{0.2cm}1] = [0\hspace{0.2cm}0\hspace{0.2cm}4 \hspace {0.2cm}1]\left [\begin{matrix} 1&0&0&0 \\0&1&0&0\\2&3&1&0\\0&0&0&1\end {matrix}\right]} \\ \newline \hspace {7.09cm}\mathbf{= [8\hspace{0.2cm}12\hspace {0.2cm}4\hspace{0.2cm}1]} \\ \newline \hspace {4.37cm}\mathbf{A'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]= [8\hspace{0.2cm}12 \hspace{0.2cm}4]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-046a2abae560ec1f22f0104242df6cb1_l3.png)
Point B'[0, 0, 4] becomes B’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{B' [x\hspace{0.2cm}y\hspace {0.2cm}z\hspace{0.2cm}1]= [0\hspace{0.2cm}4\hspace{0.2cm}2\hspace{0.2cm}1] \left [\begin{matrix}1&0&0&0\\0&1&0&0 \\2&3&1&0\\0&0&0&1\end{matrix}\right]} \\ \newline \hspace{7.09cm}\mathbf{= [8\hspace{0.2cm}10\hspace{0.2cm}2\hspace{0.2cm}1]} \\ \newline \hspace{4.37cm}\mathbf{B'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]=[8\hspace{0.2cm}10\hspace{0.2cm}2]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-f8bcb23487c1db6922b895dbe993e6cc_l3.png)
Point C'[2, 4, 0] becomes C’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{C'[x\hspace{0.2cm}y \hspace{0.2cm}z\hspace{0.2cm}1]= [2\hspace{0.2cm}4\hspace{0.2cm}0 \hspace{0.2cm}1]\left [\begin{matrix}1&0&0&0 \\0&1&0&0\\2&3&1&0 \\0&0&0&1\end{matrix}\right]} \\ \newline \hspace {7.09cm}\mathbf{= [2\hspace{0.2cm}4\hspace {0.2cm}0\hspace{0.2cm}1]}\\ \newline \mathbf{C'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]= [2\hspace{0.2cm}4\hspace {0.2cm}0]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-fc03f4317bf41d4cb4f36966636cd9d7_l3.png)
Point D'[2, 2, 4] becomes D’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{D'[x\hspace{0.2cm}y \hspace{0.2cm}z\hspace{0.2cm}1]= [2\hspace{0.2cm}2\hspace{0.2cm}4\hspace {0.2cm}1]\left [\begin{matrix}1&0&0&0 \\0&1&0&0\\2&3&1&0\\0&0&0&1\end{matrix}\right] } \\ \newline \hspace{7.09cm}\mathbf{= [10\hspace{0.2cm}14\hspace{0.2cm}4\hspace{0.2cm}1] }\\ \newline \hspace{4.37cm}\mathbf{D'[x\hspace{0.2cm} , y\hspace{0.2cm}, z]=[10\hspace{0.2cm}14 \hspace{0.2cm}4]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-89ef74c9391e0293c4041a06ed77c35a_l3.png)
Point E'[2, 0, 0] becomes E’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{E' [x\hspace{0.2cm}y\hspace {0.2cm}z\hspace{0.2cm}1]= [2\hspace{0.2cm}0\hspace {0.2cm}0\hspace{0.2cm}1] \left [\begin{matrix}1&0&0&0 \\0&1&0&0\\2&3&1&0 \\0&0&0&1\end{matrix}\right]} \\ \newline \hspace{7.09cm}\mathbf{= [2\hspace{0.2cm}0\hspace{0.2cm}0\hspace{0.2cm}1]} \\ \newline \hspace{4.37cm}\mathbf{E'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]=[2\hspace{0.2cm}0\hspace{0.2cm}0]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-470a9eab660f85eb3c9fe44123e70da9_l3.png)
Point F'[ 0, 0, 2] becomes F’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf {F'[x\hspace{0.2cm}y\hspace{0.2cm}z \hspace{0.2cm}1]=[0\hspace{0.2cm}0\hspace {0.2cm}2\hspace{0.2cm}1]\left [\begin{matrix}1&0&0&0\\0&1&0&0\\2&3&1&0 \\0&0&0&1\end{matrix}\right]} \\ \newline \hspace{7.09cm}\mathbf{= [4\hspace{0.2cm}6\hspace{0.2cm}2\hspace{0.2cm}1]} \\ \newline \hspace{4.37cm}\mathbf{F'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]=[4\hspace{0.2cm}6\hspace{0.2cm}2]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-999775f6074b9f0e54f57cf08b825cb5_l3.png)
Point G'[2, 0, 2] becomes G’ after performing Reflection transformation:
![Rendered by QuickLaTeX.com \mathbf{G'[x\hspace{0.2cm}y \hspace{0.2cm}z\hspace{0.2cm}1]=[2\hspace{0.2cm}0 \hspace{0.2cm}2\hspace{0.2cm}1]\left [\begin{matrix}1&0&0&0\\0&1&0&0\\2&3&1&0 \\0&0&0&1\end{matrix}\right]} \\ \newline \hspace{7.09cm}\mathbf{= [6\hspace{0.2cm}6\hspace{0.2cm}2\hspace{0.2cm}1]} \\ \newline \hspace{4.37cm}\mathbf {G'[x\hspace{0.2cm}, y\hspace{0.2cm}, z]= [6\hspace{0.2cm}6\hspace{0.2cm}2]}](https://web.archive.org/web/20221116223711im_/https://www.geeksforgeeks.org/wp-content/ql-cache/quicklatex.com-ed40b63d91357e747a155d5a1ace4b3f_l3.png)
Finally, after performing the Shearing transformation on the given cuboid your Fig.1 will look like as below:

Fig.2



Please Login to comment...