Tag: Shearing in 3D

3D Shearing in Computer Graphics | Definition | Examples

3D Transformations in Computer Graphics-

 

We have discussed-

  • Transformation is a process of modifying and re-positioning the existing graphics.
  • 3D Transformations take place in a three dimensional plane.

 

In computer graphics, various transformation techniques are-

 

 

  1. Translation
  2. Rotation
  3. Scaling
  4. Reflection
  5. Shear

 

In this article, we will discuss about 3D Shearing in Computer Graphics.

 

3D Shearing in Computer Graphics-

 

In Computer graphics,

3D Shearing is an ideal technique to change the shape of an existing object in a three dimensional plane.

 

In a three dimensional plane, the object size can be changed along X direction, Y direction as well as Z direction.

So, there are three versions of shearing-

 

 

  1. Shearing in X direction
  2. Shearing in Y direction
  3. Shearing in Z direction

 

Consider a point object O has to be sheared in a 3D plane.

 

Let-

  • Initial coordinates of the object O = (Xold, Yold, Zold)
  • Shearing parameter towards X direction = Shx
  • Shearing parameter towards Y direction = Shy
  • Shearing parameter towards Z direction = Shz
  • New coordinates of the object O after shearing = (Xnew, Ynew, Znew)

 

Shearing in X Axis-

 

Shearing in X axis is achieved by using the following shearing equations-

  • Xnew = Xold
  • Ynew = Yold + Shy x Xold
  • Znew = Zold + Shz x Xold

 

In Matrix form, the above shearing equations may be represented as-

 

 

Shearing in Y Axis-

 

Shearing in Y axis is achieved by using the following shearing equations-

  • Xnew = Xold + Shx x Yold
  • Ynew = Yold
  • Znew = Zold + Shz x Yold

 

In Matrix form, the above shearing equations may be represented as-

 

 

Shearing in Z Axis-

 

Shearing in Z axis is achieved by using the following shearing equations-

  • Xnew = Xold + Shx x Zold
  • Ynew = Yold + Shy x Zold
  • Znew = Zold

 

In Matrix form, the above shearing equations may be represented as-

 

 

PRACTICE PROBLEMS BASED ON 3D SHEARING IN COMPUTER GRAPHICS-

 

Problem-01:

 

Given a 3D triangle with points (0, 0, 0), (1, 1, 2) and (1, 1, 3). Apply shear parameter 2 on X axis, 2 on Y axis and 3 on Z axis and find out the new coordinates of the object.

 

Solution-

 

Given-

  • Old corner coordinates of the triangle = A (0, 0, 0), B(1, 1, 2), C(1, 1, 3)
  • Shearing parameter towards X direction (Shx) = 2
  • Shearing parameter towards Y direction (Shy) = 2
  • Shearing parameter towards Y direction (Shz) = 3

 

Shearing in X Axis-

 

For Coordinates A(0, 0, 0)

 

Let the new coordinates of corner A after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold = 0
  • Ynew = Yold + Shy x Xold = 0 + 2 x 0 = 0
  • Znew = Zold + Shz x Xold = 0 + 3 x 0 = 0

 

Thus, New coordinates of corner A after shearing = (0, 0, 0).

 

For Coordinates B(1, 1, 2)

 

Let the new coordinates of corner B after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold = 1
  • Ynew = Yold + Shy x Xold = 1 + 2 x 1 = 3
  • Znew = Zold + Shz x Xold = 2 + 3 x 1 = 5

 

Thus, New coordinates of corner B after shearing = (1, 3, 5).

 

For Coordinates C(1, 1, 3)

 

Let the new coordinates of corner C after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold = 1
  • Ynew = Yold + Shy x Xold = 1 + 2 x 1 = 3
  • Znew = Zold + Shz x Xold = 3 + 3 x 1 = 6

 

Thus, New coordinates of corner C after shearing = (1, 3, 6).

Thus, New coordinates of the triangle after shearing in X axis = A (0, 0, 0), B(1, 3, 5), C(1, 3, 6).

 

Shearing in Y Axis-

 

For Coordinates A(0, 0, 0)

 

Let the new coordinates of corner A after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Yold = 0 + 2 x 0 = 0
  • Ynew = Yold = 0
  • Znew = Zold + Shz x Yold = 0 + 3 x 0 = 0

 

Thus, New coordinates of corner A after shearing = (0, 0, 0).

 

For Coordinates B(1, 1, 2)

 

Let the new coordinates of corner B after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Yold = 1 + 2 x 1 = 3
  • Ynew = Yold = 1
  • Znew = Zold + Shz x Yold = 2 + 3 x 1 = 5

 

Thus, New coordinates of corner B after shearing = (3, 1, 5).

 

For Coordinates C(1, 1, 3)

 

Let the new coordinates of corner C after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Yold = 1 + 2 x 1 = 3
  • Ynew = Yold = 1
  • Znew = Zold + Shz x Yold = 3 + 3 x 1 = 6

 

Thus, New coordinates of corner C after shearing = (3, 1, 6).

Thus, New coordinates of the triangle after shearing in Y axis = A (0, 0, 0), B(3, 1, 5), C(3, 1, 6).

 

Shearing in Z Axis-

 

For Coordinates A(0, 0, 0)

 

Let the new coordinates of corner A after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Zold = 0 + 2 x 0 = 0
  • Ynew = Yold + Shy x Zold = 0 + 2 x 0 = 0
  • Znew = Zold = 0

 

Thus, New coordinates of corner A after shearing = (0, 0, 0).

 

For Coordinates B(1, 1, 2)

 

Let the new coordinates of corner B after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Zold = 1 + 2 x 2 = 5
  • Ynew = Yold + Shy x Zold = 1 + 2 x 2 = 5
  • Znew = Zold = 2

 

Thus, New coordinates of corner B after shearing = (5, 5, 2).

 

For Coordinates C(1, 1, 3)

 

Let the new coordinates of corner C after shearing = (Xnew, Ynew, Znew).

 

Applying the shearing equations, we have-

  • Xnew = Xold + Shx x Zold = 1 + 2 x 3 = 7
  • Ynew = Yold + Shy x Zold = 1 + 2 x 3 = 7
  • Znew = Zold = 3

 

Thus, New coordinates of corner C after shearing = (7, 7, 3).

Thus, New coordinates of the triangle after shearing in Z axis = A (0, 0, 0), B(5, 5, 2), C(7, 7, 3).

 

To gain better understanding about 3D Shearing in Computer Graphics,

Watch this Video Lecture

 

Next Article- Bezier Curves

 

Get more notes and other study material of Computer Graphics.

Watch video lectures by visiting our YouTube channel LearnVidFun.