SlideShare a Scribd company logo
2
Most read
4
Most read
12
Most read
3D Transformation in Computer Graphics-
In Computer graphics,
Transformation is a process of modifying and re-positioning the existing graphics.
• 3D Transformations take place in a three dimensional plane.
• 3D Transformations are important and a bit more complex than 2D Transformations.
• Transformations are helpful in changing the position, size, orientation, shape etc of the
object.
3D Translation in Computer Graphics-
In Computer graphics,
3D Translation is a process of moving an object from one position to another in a three dimensional plane.
Consider a point object O has to be moved from one position to another in a 3D plane.
Let-
• Initial coordinates of the object O = (Xold, Yold, Zold)
• New coordinates of the object O after translation = (Xnew, Ynew, Zold)
• Translation vector or Shift vector = (Tx, Ty, Tz)
Given a Translation vector (Tx, Ty, Tz)-
• Tx defines the distance the Xold coordinate has to be moved.
• Ty defines the distance the Yold coordinate has to be moved.
• Tz defines the distance the Zold coordinate has to be moved.
This translation is achieved by adding the translation coordinates to the old coordinates of the
object as-
• Xnew = Xold + Tx (This denotes translation towards X axis)
• Ynew = Yold + Ty (This denotes translation towards Y axis)
• Znew = Zold + Tz (This denotes translation towards Z axis)
In Matrix form, the above translation equations may be represented as-
Problem-
Given a 3D object with coordinate points A(-6, 22, -7), B(-19, 17, 13). Apply the translation with
the distance 2 towards X axis, 2 towards Y axis and 2 towards Z axis and obtain the new
coordinates of the object.
Solution
We know that
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 𝑇𝑥
0 1 0 𝑇𝑦
0 0 1 𝑇𝑧
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| (1)
For point A(-6, 22, -7) equation (1) becomes
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 2
0 1 0 2
0 0 1 2
0 0 0 1
| |
−6
22
−7
1
| = |
−6 + 0 − 0 + 2
−0 + 22 − 0 + 2
−0 + 0 − 7 + 2
−0 + 0 − 0 + 1
| = |
−4
24
−5
1
|
Therefore the new coordinates of A(-6, 22, -7) will be A’(-4, 24, -5)
For point B(-19, 17, 13) equation (1) becomes
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 2
0 1 0 2
0 0 1 2
0 0 0 1
| |
−19
17
13
1
| = |
−19 + 0 + 0 + 2
−0 + 17 + 0 + 2
−0 + 0 + 13 + 2
−0 + 0 + 0 + 1
| = |
−17
19
15
1
|
Therefore the new coordinates of B(-19, 17, 13) will be B’(-17, 19, 15)
3D Scaling in Computer Graphics-
In computer graphics, scaling is a process of modifying or altering the size of objects.
• Scaling may be used to increase or reduce the size of object.
• Scaling factor determines whether the object size is to be increased or reduced.
• If scaling factor > 1, then the object size is increased.
• If scaling factor < 1, then the object size is reduced.
Consider a point object O has to be scaled in a 3D plane.
Let-
• Initial coordinates of the object O = (Xold, Yold,Zold)
• Scaling factor for X-axis = Sx
• Scaling factor for Y-axis = Sy
• Scaling factor for Z-axis = Sz
• New coordinates of the object O after scaling = (Xnew, Ynew, Znew)
This scaling is achieved by using the following scaling equations-
• Xnew = Xold x Sx
• Ynew = Yold x Sy
• Znew = Zold x Sz
In Matrix form, the above scaling equations may be represented as-
Problem
Given a 3D object with coordinate points A(0, 3, 3), B(3, 3, 6). Apply the scaling parameter 2
towards X axis, 3 towards Y axis and 3 towards Z axis and obtain the new coordinates of the
object.
Solution
We know that
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
𝑆𝑥 0 0 0
0 𝑆𝑦 0 0
0 0 𝑆𝑧 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| (1)
For point A(0, 3, 3) equation (1) becomes
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
2 0 0 0
0 3 0 0
0 0 3 0
0 0 0 1
| |
0
3
3
1
| = |
0 + 0 + 0 + 0
0 + 9 + 0 + 0
0 + 0 + 9 + 0
0 + 0 + 0 + 1
| = |
0
9
9
1
|
Therefore, the new coordinates of A(0, 3, 3) will be A’(0, 9, 9)
For point B(3, 3, 6) equation (1) becomes
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
2 0 0 0
0 3 0 0
0 0 3 0
0 0 0 1
| |
3
3
6
1
| = |
6 + 0 + 0 + 0
0 + 9 + 0 + 0
0 + 0 + 18 + 0
0 + 0 + 0 + 1
| = |
6
9
18
1
|
Therefore, the new coordinates of B(3, 3, 6) will be B’(6, 9, 18)
3D Rotation in Computer Graphics-
In Computer graphics,
3D Rotation is a process of rotating an object with respect to an angle in a three-dimensional plane.
Consider a point object O has to be rotated from one angle to another in a 3D plane.
Let-
• Initial coordinates of the object O = (Xold, Yold, Zold)
• Initial angle of the object O with respect to origin = Φ
• Rotation angle = θ
• New coordinates of the object O after rotation = (Xnew, Ynew, Znew)
In 3 dimensions, there are 3 possible types of rotation-
• X-axis Rotation
• Y-axis Rotation
• Z-axis Rotation
For X-Axis Rotation-
This rotation is achieved by using the following rotation equations-
• Xnew = Xold
• Ynew = Yold x cosθ – Zold x sinθ
• Znew = Yold x sinθ + Zold x cosθ
In Matrix form, the above rotation equations may be represented as-
For Y-Axis Rotation-
This rotation is achieved by using the following rotation equations-
• Xnew = Zold x sinθ + Xold x cosθ
• Ynew = Yold
• Znew = Yold x cosθ – Xold x sinθ
In Matrix form, the above rotation equations may be represented as-
For Z-Axis Rotation-
This rotation is achieved by using the following rotation equations-
• Xnew = Xold x cosθ – Yold x sinθ
• Ynew = Xold x sinθ + Yold x cosθ
• Znew = Zold
In Matrix form, the above rotation equations may be represented as-
Problem
Given a homogeneous point (1, 2, 3). Apply rotation 90 degree towards X, Y and Z axis and find
out the new coordinate points.
Solution
Rotation along X-axis
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
0 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0
0 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
|
= |
1 0 0 0
0 𝑐𝑜𝑠900
−𝑠𝑖𝑛900
0
0 𝑠𝑖𝑛900
𝑐𝑜𝑠900
0
0 0 0 1
| |
1
2
3
1
| = |
1 0 0 0
0 0 −1 0
0 1 0 0
0 0 0 1
| |
1
2
3
1
| = |
1 + 0 + 0 + 0
0 + 0 − 3 + 0
0 + 2 + 0 + 0
0 + 0 + 0 + 1
| = |
1
−3
2
1
|
Therefore, the new coordinates for the homogenous point will be (1, -3, 2)
Rotation Y-axis
[
𝒙𝒏𝒆𝒘
𝒚𝒏𝒆𝒘
𝒛𝒏𝒆𝒘
𝟏
] = |
𝒄𝒐𝒔𝜽 𝟎 𝒔𝒊𝒏𝜽 𝟎
𝟎 𝟏 𝟎 𝟎
−𝒔𝒊𝒏𝜽 𝟎 𝒄𝒐𝒔𝜽 𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝒙𝒐𝒍𝒅
𝒚𝒐𝒍𝒅
𝒛𝒐𝒍𝒅
𝟏
|
= |
𝒄𝒐𝒔𝟗𝟎𝟎
𝟎 𝒔𝒊𝒏𝟗𝟎𝟎
𝟎
𝟎 𝟏 𝟎 𝟎
−𝒔𝒊𝒏𝟗𝟎𝟎
𝟎 𝒄𝒐𝒔𝟗𝟎𝟎
𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝟏
𝟐
𝟑
𝟏
| = |
𝟎 𝟎 𝟏 𝟎
𝟎 𝟏 𝟎 𝟎
−𝟏 𝟎 𝟎 𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝟏
𝟐
𝟑
𝟏
| = |
𝟎 + 𝟎 + 𝟑 + 𝟎
𝟎 + 𝟐 + 𝟎 + 𝟎
−𝟏 + 𝟎 + 𝟎 + 𝟎
𝟎 + 𝟎 + 𝟎 + 𝟏
| = |
𝟑
𝟐
−𝟏
𝟏
|
Therefore, the new coordinates for the homogenous point will be (3, 2, -1)
Rotation Z-axis
[
𝒙𝒏𝒆𝒘
𝒚𝒏𝒆𝒘
𝒛𝒏𝒆𝒘
𝟏
] = |
𝒄𝒐𝒔𝜽 −𝒔𝒊𝒏𝜽 𝟎 𝟎
𝒔𝒊𝒏𝜽 𝒄𝒐𝒔𝜽 𝟎 𝟎
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝒙𝒐𝒍𝒅
𝒚𝒐𝒍𝒅
𝒛𝒐𝒍𝒅
𝟏
|
= |
𝒄𝒐𝒔𝟗𝟎𝟎
−𝒔𝒊𝒏𝟗𝟎𝟎
𝟎 𝟎
𝒔𝒊𝒏𝟗𝟎𝟎
𝒄𝒐𝒔𝟗𝟎𝟎
𝟎 𝟎
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝟏
𝟐
𝟑
𝟏
| = |
𝟎 −𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏
| |
𝟏
𝟐
𝟑
𝟏
| = |
𝟎 − 𝟐 + 𝟎 + 𝟎
𝟏 + 𝟎 + 𝟎 + 𝟎
𝟎 + 𝟎 + 𝟑 + 𝟎
𝟎 + 𝟎 + 𝟎 + 𝟏
| = |
−𝟐
𝟏
𝟑
𝟏
|
Therefore, the new coordinates for the homogenous point will be (-2, 1, 3)
3D Reflection in Computer Graphics-
• Reflection is a kind of rotation where the angle of rotation is 180 degree.
• The reflected object is always formed on the other side of mirror.
• The size of reflected object is same as the size of original object.
Consider a point object O has to be reflected in a 3D plane.
Let-
• Initial coordinates of the object O = (Xold, Yold, Zold)
• New coordinates of the reflected object O after reflection = (Xnew, Ynew,Znew)
In 3 dimensions, there are 3 possible types of reflection-
• Reflection relative to XY plane
• Reflection relative to YZ plane
• Reflection relative to XZ plane
Reflection Relative to XY Plane
This reflection is achieved by using the following reflection equations-
• Xnew = Xold
• Ynew = Yold
• Znew = -Zold
In Matrix form, the above reflection equations may be represented as-
Reflection Relative to YZ Plane
This reflection is achieved by using the following reflection equations-
• Xnew = -Xold
• Ynew = Yold
• Znew = Zold
In Matrix form, the above reflection equations may be represented as-
Reflection Relative to XZ Plane
This reflection is achieved by using the following reflection equations-
• Xnew = Xold
• Ynew = -Yold
• Znew = Zold
In Matrix form, the above reflection equations may be represented as-
Problem
Given a 3D triangle with coordinate points A(3, 4, 1), B(6, 4, 2). Apply the reflection and find out
the new coordinates of the object.
Solution
Refection relative to XY Plane
For point A(3, 4, 1)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
0 1 0 0
0 0 −1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
0 1 0 0
0 0 −1 0
0 0 0 1
| |
3
4
1
1
| = |
3 + 0 + 0 + 0
0 + 4 + 0 + 0
0 + 0 − 1 + 0
0 + 0 + 0 + 1
| = |
3
4
−1
1
|
Therefore the new coordinates for point A(3, 4, 1) will be A’(3, 4, -1)
For point B(6, 4, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
0 1 0 0
0 0 −1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
0 1 0 0
0 0 −1 0
0 0 0 1
| |
6
4
2
1
| = |
6 + 0 + 0 + 0
0 + 4 + 0 + 0
0 + 0 − 2 + 0
0 + 0 + 0 + 1
| = |
6
4
−2
1
|
Therefore the new coordinates for point B(6, 4, 2) will be B’(6, 4, -2)
Refection relative to YZ Plane
For point A(3, 4, 1)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
−1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
−1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
| |
6
4
2
1
| = |
−3 + 0 + 0 + 0
0 + 4 + 0 + 0
0 + 0 + 1 + 0
0 + 0 + 0 + 1
| = |
−3
4
1
1
|
Therefore the new coordinates for point A(3, 4, 1) will be A’(-3, 4, 1)
For point B(6, 4, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
−1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
−1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
| |
3
4
1
1
| = |
−6 + 0 + 0 + 0
0 + 4 + 0 + 0
0 + 0 + 2 + 0
0 + 0 + 0 + 1
| = |
−6
4
2
1
|
Therefore the new coordinates for point B(6, 4, 2) will be B’(-6, 4, 2)
Refection relative to XZ Plane
For point A(3, 4, 1)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
0 −1 0 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
0 −1 0 0
0 0 1 0
0 0 0 1
| |
3
4
1
1
| = |
3 + 0 + 0 + 0
0 − 4 + 0 + 0
0 + 0 + 1 + 0
0 + 0 + 0 + 1
| = |
3
−4
1
1
|
Therefore the new coordinates for point A(3, 4, 1) will be A’(3, -4, 1)
For point B(6, 4, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
0 −1 0 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
0 −1 0 0
0 0 1 0
0 0 0 1
| |
6
4
2
1
| = |
6 + 0 + 0 + 0
0 − 4 + 0 + 0
0 + 0 + 2 + 0
0 + 0 + 0 + 1
| = |
6
−4
2
1
|
Therefore the new coordinates for point B(6, 4, 2) will be B’(6, -4, 2)
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-
• Shearing in X direction
• Shearing in Y direction
• 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-
Problem
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
Shearing along X-axis
For point (0, 0, 0)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
𝑆ℎ𝑦 1 0 0
𝑆ℎ𝑧 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
2 1 0 0
3 0 1 0
0 0 0 1
| |
0
0
0
1
| = |
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 1
| = |
0
0
0
1
|
Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0)
For point (1, 1, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
𝑆ℎ𝑦 1 0 0
𝑆ℎ𝑧 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
2 1 0 0
3 0 1 0
0 0 0 1
| |
1
1
2
1
| = |
1 + 0 + 0 + 0
2 + 1 + 0 + 0
3 + 0 + 2 + 0
0 + 0 + 0 + 1
| = |
1
3
5
1
|
Therefore, the new coordinates for point (1, 1, 2) will be (1, 3, 5)
For point (1, 1, 3)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 0 0
𝑆ℎ𝑦 1 0 0
𝑆ℎ𝑧 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 0 0
2 1 0 0
3 0 1 0
0 0 0 1
| |
1
1
3
1
| = |
1 + 0 + 0 + 0
2 + 1 + 0 + 0
3 + 0 + 3 + 0
0 + 0 + 0 + 1
| = |
1
3
6
1
|
Therefore, the new coordinates for point (1, 1, 3) will be (1, 3, 6)
Shearing along Y-axis
For point (0, 0, 0)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 𝑆ℎ𝑥 0 0
0 1 0 0
0 𝑆ℎ𝑧 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 2 0 0
0 1 0 0
0 3 1 0
0 0 0 1
| |
0
0
0
1
| = |
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 1
| = |
0
0
0
1
|
Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0)
For point (1, 1, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 𝑆ℎ𝑥 0 0
0 1 0 0
0 𝑆ℎ𝑧 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 2 0 0
0 1 0 0
0 3 1 0
0 0 0 1
| |
1
1
2
1
| = |
1 + 2 + 0 + 0
0 + 1 + 0 + 0
0 + 3 + 2 + 0
0 + 0 + 0 + 1
| = |
3
1
5
1
|
Therefore, the new coordinates for point (1, 1, 2) will be (3, 1, 5)
For point (1, 1, 3)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 𝑆ℎ𝑥 0 0
0 1 0 0
0 𝑆ℎ𝑧 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 2 0 0
0 1 0 0
0 3 1 0
0 0 0 1
| |
1
1
3
1
| = |
1 + 2 + 0 + 0
0 + 1 + 0 + 0
0 + 3 + 3 + 0
0 + 0 + 0 + 1
| = |
3
1
6
1
|
Therefore, the new coordinates for point (1, 1, 3) will be (3, 1, 6)
Shearing along Z-axis
For point (0, 0, 0)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 𝑆ℎ𝑥 0
0 1 𝑆ℎ𝑦 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 2 0
0 1 2 0
0 0 1 0
0 0 0 1
| |
0
0
0
1
| = |
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 0
0 + 0 + 0 + 1
| = |
0
0
0
1
|
Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0)
For point (1, 1, 2)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 𝑆ℎ𝑥 0
0 1 𝑆ℎ𝑦 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 2 0
0 1 2 0
0 0 1 0
0 0 0 1
| |
1
1
2
1
| = |
1 + 0 + 4 + 0
0 + 1 + 4 + 0
0 + 0 + 2 + 0
0 + 0 + 0 + 1
| = |
5
5
2
1
|
Therefore, the new coordinates for point (1, 1, 2) will be (5, 5, 2)
For point (1, 1, 3)
[
𝑥𝑛𝑒𝑤
𝑦𝑛𝑒𝑤
𝑧𝑛𝑒𝑤
1
] = |
1 0 𝑆ℎ𝑥 0
0 1 𝑆ℎ𝑦 0
0 0 1 0
0 0 0 1
| |
𝑥𝑜𝑙𝑑
𝑦𝑜𝑙𝑑
𝑧𝑜𝑙𝑑
1
| = |
1 0 2 0
0 1 2 0
0 0 1 0
0 0 0 1
| |
1
1
3
1
| = |
1 + 0 + 6 + 0
0 + 1 + 6 + 0
0 + 0 + 3 + 0
0 + 0 + 0 + 1
| = |
7
7
3
1
|
Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0)

More Related Content

PPTX
Windows to viewport transformation
PPTX
2d-transformation
PDF
2D Transformation in Computer Graphics
PPT
2D transformation (Computer Graphics)
PPTX
Window to Viewport Transformation in Computer Graphics with.pptx
PPTX
Projections.pptx
PPT
2d transformation
PPTX
Mid point circle algorithm
Windows to viewport transformation
2d-transformation
2D Transformation in Computer Graphics
2D transformation (Computer Graphics)
Window to Viewport Transformation in Computer Graphics with.pptx
Projections.pptx
2d transformation
Mid point circle algorithm

What's hot (20)

PPTX
3 d transformation
PPTX
Bresenham-Circle-drawing-algorithm, Midpoint Circle Drawing Algorithm
PPTX
Bresenham's line drawing algorithm
PPTX
Chapter 3 Output Primitives
PPTX
Color Models Computer Graphics
PPT
Hidden lines & surfaces
PPTX
3D Geometric Transformations
PPT
Window to viewport transformation
PPTX
2D viewing & clipping
PDF
2D Transformation
PDF
Unit-IV Windowing and Clipping.pdf
PPTX
Projection In Computer Graphics
PPTX
3d transformation computer graphics
PPT
Two dimensional geometric transformations
PPT
Composite transformations
PPTX
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
PPTX
3D Transformation in Computer Graphics
PPTX
Character Attribute in computer graphics
PDF
2D Transformations(Computer Graphics)
PPTX
Homogeneous Representation: rotating, shearing
3 d transformation
Bresenham-Circle-drawing-algorithm, Midpoint Circle Drawing Algorithm
Bresenham's line drawing algorithm
Chapter 3 Output Primitives
Color Models Computer Graphics
Hidden lines & surfaces
3D Geometric Transformations
Window to viewport transformation
2D viewing & clipping
2D Transformation
Unit-IV Windowing and Clipping.pdf
Projection In Computer Graphics
3d transformation computer graphics
Two dimensional geometric transformations
Composite transformations
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
3D Transformation in Computer Graphics
Character Attribute in computer graphics
2D Transformations(Computer Graphics)
Homogeneous Representation: rotating, shearing
Ad

Similar to 3D Transformation in Computer Graphics (20)

PDF
Chapter 5- 3D transformations of graphics.pdf
PDF
2D Transformation
PPTX
3D computer Graphic PPT.pptx in computer graphics
PPT
transformation IT.ppt
PPTX
Computer Graphics - transformations in 2d
PPTX
Computer Graphic - Transformations in 2D
PPT
2 d transformation
PPT
2D_transformatiomcomputer graphics 2d translation, rotation and scaling trans...
PDF
2-D Transformations.pdf
PPTX
Computer Graphic - Transformations in 3d
PPTX
Computer Graphics - transformations in 3d
PPT
COMPOSITE TRANSFORMATION COMPUTER GRAPHICDS.ppt
PDF
2D Rotation- Transformation in Computer Graphics
PPTX
moule 3 ppt1 basic 2D transformations.pptx
PPTX
Chapter 8.pptx
PPTX
Unit V Geodetic Computationgissssss.pptx
PPTX
Coordinate geometry
PPT
2 d transformations by amit kumar (maimt)
PDF
2D-transformation-1.pdf
PPT
Two dimentional transform
Chapter 5- 3D transformations of graphics.pdf
2D Transformation
3D computer Graphic PPT.pptx in computer graphics
transformation IT.ppt
Computer Graphics - transformations in 2d
Computer Graphic - Transformations in 2D
2 d transformation
2D_transformatiomcomputer graphics 2d translation, rotation and scaling trans...
2-D Transformations.pdf
Computer Graphic - Transformations in 3d
Computer Graphics - transformations in 3d
COMPOSITE TRANSFORMATION COMPUTER GRAPHICDS.ppt
2D Rotation- Transformation in Computer Graphics
moule 3 ppt1 basic 2D transformations.pptx
Chapter 8.pptx
Unit V Geodetic Computationgissssss.pptx
Coordinate geometry
2 d transformations by amit kumar (maimt)
2D-transformation-1.pdf
Two dimentional transform
Ad

More from A. S. M. Shafi (20)

DOCX
Data Warehouse Schema (Star, Snowflake).docx
PDF
Correlation Analysis in Machine Learning.pdf
PDF
Naive Bayes and Decision Tree Algorithm.pdf
PDF
Frequent Pattern Growth Mining Algorithm.pdf
PDF
Direct Hashing and Pruning Algorithm in Data MIning.pdf
PDF
Association Rule Mining with Apriori Algorithm.pdf
PDF
HITS Algorithm in Data and Web MIning.pdf
PDF
Page Rank Algorithm in Data Mining and Web Application.pdf
PDF
K Nearest Neighbor Classifier in Machine Learning.pdf
PDF
K Means Clustering Algorithm in Machine Learning.pdf
PDF
Projection
PDF
Line drawing algorithm
PDF
Fragmentation
PDF
File organization
PDF
Bankers algorithm
PDF
RR and priority scheduling
PDF
Fcfs and sjf
PDF
Applications of stack
PDF
1D Array
PDF
2D array
Data Warehouse Schema (Star, Snowflake).docx
Correlation Analysis in Machine Learning.pdf
Naive Bayes and Decision Tree Algorithm.pdf
Frequent Pattern Growth Mining Algorithm.pdf
Direct Hashing and Pruning Algorithm in Data MIning.pdf
Association Rule Mining with Apriori Algorithm.pdf
HITS Algorithm in Data and Web MIning.pdf
Page Rank Algorithm in Data Mining and Web Application.pdf
K Nearest Neighbor Classifier in Machine Learning.pdf
K Means Clustering Algorithm in Machine Learning.pdf
Projection
Line drawing algorithm
Fragmentation
File organization
Bankers algorithm
RR and priority scheduling
Fcfs and sjf
Applications of stack
1D Array
2D array

Recently uploaded (20)

PDF
Well-logging-methods_new................
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
PPT on Performance Review to get promotions
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Geodesy 1.pptx...............................................
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
additive manufacturing of ss316l using mig welding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Well-logging-methods_new................
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Construction Project Organization Group 2.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Arduino robotics embedded978-1-4302-3184-4.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Foundation to blockchain - A guide to Blockchain Tech
UNIT 4 Total Quality Management .pptx
Internet of Things (IOT) - A guide to understanding
PPT on Performance Review to get promotions
Mechanical Engineering MATERIALS Selection
Lecture Notes Electrical Wiring System Components
Geodesy 1.pptx...............................................
CH1 Production IntroductoryConcepts.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
additive manufacturing of ss316l using mig welding
Operating System & Kernel Study Guide-1 - converted.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx

3D Transformation in Computer Graphics

  • 1. 3D Transformation in Computer Graphics- In Computer graphics, Transformation is a process of modifying and re-positioning the existing graphics. • 3D Transformations take place in a three dimensional plane. • 3D Transformations are important and a bit more complex than 2D Transformations. • Transformations are helpful in changing the position, size, orientation, shape etc of the object. 3D Translation in Computer Graphics- In Computer graphics, 3D Translation is a process of moving an object from one position to another in a three dimensional plane. Consider a point object O has to be moved from one position to another in a 3D plane. Let- • Initial coordinates of the object O = (Xold, Yold, Zold) • New coordinates of the object O after translation = (Xnew, Ynew, Zold) • Translation vector or Shift vector = (Tx, Ty, Tz) Given a Translation vector (Tx, Ty, Tz)- • Tx defines the distance the Xold coordinate has to be moved. • Ty defines the distance the Yold coordinate has to be moved. • Tz defines the distance the Zold coordinate has to be moved.
  • 2. This translation is achieved by adding the translation coordinates to the old coordinates of the object as- • Xnew = Xold + Tx (This denotes translation towards X axis) • Ynew = Yold + Ty (This denotes translation towards Y axis) • Znew = Zold + Tz (This denotes translation towards Z axis) In Matrix form, the above translation equations may be represented as- Problem- Given a 3D object with coordinate points A(-6, 22, -7), B(-19, 17, 13). Apply the translation with the distance 2 towards X axis, 2 towards Y axis and 2 towards Z axis and obtain the new coordinates of the object. Solution We know that [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 𝑇𝑥 0 1 0 𝑇𝑦 0 0 1 𝑇𝑧 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | (1) For point A(-6, 22, -7) equation (1) becomes [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 2 0 1 0 2 0 0 1 2 0 0 0 1 | | −6 22 −7 1 | = | −6 + 0 − 0 + 2 −0 + 22 − 0 + 2 −0 + 0 − 7 + 2 −0 + 0 − 0 + 1 | = | −4 24 −5 1 | Therefore the new coordinates of A(-6, 22, -7) will be A’(-4, 24, -5)
  • 3. For point B(-19, 17, 13) equation (1) becomes [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 2 0 1 0 2 0 0 1 2 0 0 0 1 | | −19 17 13 1 | = | −19 + 0 + 0 + 2 −0 + 17 + 0 + 2 −0 + 0 + 13 + 2 −0 + 0 + 0 + 1 | = | −17 19 15 1 | Therefore the new coordinates of B(-19, 17, 13) will be B’(-17, 19, 15) 3D Scaling in Computer Graphics- In computer graphics, scaling is a process of modifying or altering the size of objects. • Scaling may be used to increase or reduce the size of object. • Scaling factor determines whether the object size is to be increased or reduced. • If scaling factor > 1, then the object size is increased. • If scaling factor < 1, then the object size is reduced. Consider a point object O has to be scaled in a 3D plane. Let- • Initial coordinates of the object O = (Xold, Yold,Zold) • Scaling factor for X-axis = Sx • Scaling factor for Y-axis = Sy • Scaling factor for Z-axis = Sz • New coordinates of the object O after scaling = (Xnew, Ynew, Znew) This scaling is achieved by using the following scaling equations- • Xnew = Xold x Sx • Ynew = Yold x Sy • Znew = Zold x Sz In Matrix form, the above scaling equations may be represented as-
  • 4. Problem Given a 3D object with coordinate points A(0, 3, 3), B(3, 3, 6). Apply the scaling parameter 2 towards X axis, 3 towards Y axis and 3 towards Z axis and obtain the new coordinates of the object. Solution We know that [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 𝑆𝑥 0 0 0 0 𝑆𝑦 0 0 0 0 𝑆𝑧 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | (1) For point A(0, 3, 3) equation (1) becomes [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 2 0 0 0 0 3 0 0 0 0 3 0 0 0 0 1 | | 0 3 3 1 | = | 0 + 0 + 0 + 0 0 + 9 + 0 + 0 0 + 0 + 9 + 0 0 + 0 + 0 + 1 | = | 0 9 9 1 | Therefore, the new coordinates of A(0, 3, 3) will be A’(0, 9, 9) For point B(3, 3, 6) equation (1) becomes [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 2 0 0 0 0 3 0 0 0 0 3 0 0 0 0 1 | | 3 3 6 1 | = | 6 + 0 + 0 + 0 0 + 9 + 0 + 0 0 + 0 + 18 + 0 0 + 0 + 0 + 1 | = | 6 9 18 1 | Therefore, the new coordinates of B(3, 3, 6) will be B’(6, 9, 18) 3D Rotation in Computer Graphics- In Computer graphics, 3D Rotation is a process of rotating an object with respect to an angle in a three-dimensional plane. Consider a point object O has to be rotated from one angle to another in a 3D plane. Let- • Initial coordinates of the object O = (Xold, Yold, Zold) • Initial angle of the object O with respect to origin = Φ • Rotation angle = θ • New coordinates of the object O after rotation = (Xnew, Ynew, Znew)
  • 5. In 3 dimensions, there are 3 possible types of rotation- • X-axis Rotation • Y-axis Rotation • Z-axis Rotation For X-Axis Rotation- This rotation is achieved by using the following rotation equations- • Xnew = Xold • Ynew = Yold x cosθ – Zold x sinθ • Znew = Yold x sinθ + Zold x cosθ In Matrix form, the above rotation equations may be represented as- For Y-Axis Rotation- This rotation is achieved by using the following rotation equations- • Xnew = Zold x sinθ + Xold x cosθ • Ynew = Yold • Znew = Yold x cosθ – Xold x sinθ In Matrix form, the above rotation equations may be represented as-
  • 6. For Z-Axis Rotation- This rotation is achieved by using the following rotation equations- • Xnew = Xold x cosθ – Yold x sinθ • Ynew = Xold x sinθ + Yold x cosθ • Znew = Zold In Matrix form, the above rotation equations may be represented as- Problem Given a homogeneous point (1, 2, 3). Apply rotation 90 degree towards X, Y and Z axis and find out the new coordinate points. Solution Rotation along X-axis [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 0 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0 0 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 0 𝑐𝑜𝑠900 −𝑠𝑖𝑛900 0 0 𝑠𝑖𝑛900 𝑐𝑜𝑠900 0 0 0 0 1 | | 1 2 3 1 | = | 1 0 0 0 0 0 −1 0 0 1 0 0 0 0 0 1 | | 1 2 3 1 | = | 1 + 0 + 0 + 0 0 + 0 − 3 + 0 0 + 2 + 0 + 0 0 + 0 + 0 + 1 | = | 1 −3 2 1 | Therefore, the new coordinates for the homogenous point will be (1, -3, 2) Rotation Y-axis [ 𝒙𝒏𝒆𝒘 𝒚𝒏𝒆𝒘 𝒛𝒏𝒆𝒘 𝟏 ] = | 𝒄𝒐𝒔𝜽 𝟎 𝒔𝒊𝒏𝜽 𝟎 𝟎 𝟏 𝟎 𝟎 −𝒔𝒊𝒏𝜽 𝟎 𝒄𝒐𝒔𝜽 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝒙𝒐𝒍𝒅 𝒚𝒐𝒍𝒅 𝒛𝒐𝒍𝒅 𝟏 |
  • 7. = | 𝒄𝒐𝒔𝟗𝟎𝟎 𝟎 𝒔𝒊𝒏𝟗𝟎𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 −𝒔𝒊𝒏𝟗𝟎𝟎 𝟎 𝒄𝒐𝒔𝟗𝟎𝟎 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝟏 𝟐 𝟑 𝟏 | = | 𝟎 𝟎 𝟏 𝟎 𝟎 𝟏 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝟏 𝟐 𝟑 𝟏 | = | 𝟎 + 𝟎 + 𝟑 + 𝟎 𝟎 + 𝟐 + 𝟎 + 𝟎 −𝟏 + 𝟎 + 𝟎 + 𝟎 𝟎 + 𝟎 + 𝟎 + 𝟏 | = | 𝟑 𝟐 −𝟏 𝟏 | Therefore, the new coordinates for the homogenous point will be (3, 2, -1) Rotation Z-axis [ 𝒙𝒏𝒆𝒘 𝒚𝒏𝒆𝒘 𝒛𝒏𝒆𝒘 𝟏 ] = | 𝒄𝒐𝒔𝜽 −𝒔𝒊𝒏𝜽 𝟎 𝟎 𝒔𝒊𝒏𝜽 𝒄𝒐𝒔𝜽 𝟎 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝒙𝒐𝒍𝒅 𝒚𝒐𝒍𝒅 𝒛𝒐𝒍𝒅 𝟏 | = | 𝒄𝒐𝒔𝟗𝟎𝟎 −𝒔𝒊𝒏𝟗𝟎𝟎 𝟎 𝟎 𝒔𝒊𝒏𝟗𝟎𝟎 𝒄𝒐𝒔𝟗𝟎𝟎 𝟎 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝟏 𝟐 𝟑 𝟏 | = | 𝟎 −𝟏 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 | | 𝟏 𝟐 𝟑 𝟏 | = | 𝟎 − 𝟐 + 𝟎 + 𝟎 𝟏 + 𝟎 + 𝟎 + 𝟎 𝟎 + 𝟎 + 𝟑 + 𝟎 𝟎 + 𝟎 + 𝟎 + 𝟏 | = | −𝟐 𝟏 𝟑 𝟏 | Therefore, the new coordinates for the homogenous point will be (-2, 1, 3) 3D Reflection in Computer Graphics- • Reflection is a kind of rotation where the angle of rotation is 180 degree. • The reflected object is always formed on the other side of mirror. • The size of reflected object is same as the size of original object. Consider a point object O has to be reflected in a 3D plane. Let- • Initial coordinates of the object O = (Xold, Yold, Zold) • New coordinates of the reflected object O after reflection = (Xnew, Ynew,Znew) In 3 dimensions, there are 3 possible types of reflection- • Reflection relative to XY plane • Reflection relative to YZ plane • Reflection relative to XZ plane Reflection Relative to XY Plane This reflection is achieved by using the following reflection equations- • Xnew = Xold • Ynew = Yold • Znew = -Zold
  • 8. In Matrix form, the above reflection equations may be represented as- Reflection Relative to YZ Plane This reflection is achieved by using the following reflection equations- • Xnew = -Xold • Ynew = Yold • Znew = Zold In Matrix form, the above reflection equations may be represented as- Reflection Relative to XZ Plane This reflection is achieved by using the following reflection equations- • Xnew = Xold • Ynew = -Yold • Znew = Zold
  • 9. In Matrix form, the above reflection equations may be represented as- Problem Given a 3D triangle with coordinate points A(3, 4, 1), B(6, 4, 2). Apply the reflection and find out the new coordinates of the object. Solution Refection relative to XY Plane For point A(3, 4, 1) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 0 1 0 0 0 0 −1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 0 1 0 0 0 0 −1 0 0 0 0 1 | | 3 4 1 1 | = | 3 + 0 + 0 + 0 0 + 4 + 0 + 0 0 + 0 − 1 + 0 0 + 0 + 0 + 1 | = | 3 4 −1 1 | Therefore the new coordinates for point A(3, 4, 1) will be A’(3, 4, -1) For point B(6, 4, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 0 1 0 0 0 0 −1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 0 1 0 0 0 0 −1 0 0 0 0 1 | | 6 4 2 1 | = | 6 + 0 + 0 + 0 0 + 4 + 0 + 0 0 + 0 − 2 + 0 0 + 0 + 0 + 1 | = | 6 4 −2 1 | Therefore the new coordinates for point B(6, 4, 2) will be B’(6, 4, -2) Refection relative to YZ Plane For point A(3, 4, 1) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | −1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | −1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 | | 6 4 2 1 | = | −3 + 0 + 0 + 0 0 + 4 + 0 + 0 0 + 0 + 1 + 0 0 + 0 + 0 + 1 | = | −3 4 1 1 | Therefore the new coordinates for point A(3, 4, 1) will be A’(-3, 4, 1)
  • 10. For point B(6, 4, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | −1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | −1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 | | 3 4 1 1 | = | −6 + 0 + 0 + 0 0 + 4 + 0 + 0 0 + 0 + 2 + 0 0 + 0 + 0 + 1 | = | −6 4 2 1 | Therefore the new coordinates for point B(6, 4, 2) will be B’(-6, 4, 2) Refection relative to XZ Plane For point A(3, 4, 1) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 0 −1 0 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 0 −1 0 0 0 0 1 0 0 0 0 1 | | 3 4 1 1 | = | 3 + 0 + 0 + 0 0 − 4 + 0 + 0 0 + 0 + 1 + 0 0 + 0 + 0 + 1 | = | 3 −4 1 1 | Therefore the new coordinates for point A(3, 4, 1) will be A’(3, -4, 1) For point B(6, 4, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 0 −1 0 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 0 −1 0 0 0 0 1 0 0 0 0 1 | | 6 4 2 1 | = | 6 + 0 + 0 + 0 0 − 4 + 0 + 0 0 + 0 + 2 + 0 0 + 0 + 0 + 1 | = | 6 −4 2 1 | Therefore the new coordinates for point B(6, 4, 2) will be B’(6, -4, 2) 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- • Shearing in X direction • Shearing in Y direction • 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
  • 11. • 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
  • 12. • Ynew = Yold + Shy x Zold • Znew = Zold In Matrix form, the above shearing equations may be represented as- Problem 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 Shearing along X-axis For point (0, 0, 0) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 𝑆ℎ𝑦 1 0 0 𝑆ℎ𝑧 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 2 1 0 0 3 0 1 0 0 0 0 1 | | 0 0 0 1 | = | 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 1 | = | 0 0 0 1 | Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0) For point (1, 1, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 𝑆ℎ𝑦 1 0 0 𝑆ℎ𝑧 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 2 1 0 0 3 0 1 0 0 0 0 1 | | 1 1 2 1 | = | 1 + 0 + 0 + 0 2 + 1 + 0 + 0 3 + 0 + 2 + 0 0 + 0 + 0 + 1 | = | 1 3 5 1 | Therefore, the new coordinates for point (1, 1, 2) will be (1, 3, 5) For point (1, 1, 3) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 0 0 𝑆ℎ𝑦 1 0 0 𝑆ℎ𝑧 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 0 0 2 1 0 0 3 0 1 0 0 0 0 1 | | 1 1 3 1 | = | 1 + 0 + 0 + 0 2 + 1 + 0 + 0 3 + 0 + 3 + 0 0 + 0 + 0 + 1 | = | 1 3 6 1 |
  • 13. Therefore, the new coordinates for point (1, 1, 3) will be (1, 3, 6) Shearing along Y-axis For point (0, 0, 0) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 𝑆ℎ𝑥 0 0 0 1 0 0 0 𝑆ℎ𝑧 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 2 0 0 0 1 0 0 0 3 1 0 0 0 0 1 | | 0 0 0 1 | = | 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 1 | = | 0 0 0 1 | Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0) For point (1, 1, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 𝑆ℎ𝑥 0 0 0 1 0 0 0 𝑆ℎ𝑧 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 2 0 0 0 1 0 0 0 3 1 0 0 0 0 1 | | 1 1 2 1 | = | 1 + 2 + 0 + 0 0 + 1 + 0 + 0 0 + 3 + 2 + 0 0 + 0 + 0 + 1 | = | 3 1 5 1 | Therefore, the new coordinates for point (1, 1, 2) will be (3, 1, 5) For point (1, 1, 3) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 𝑆ℎ𝑥 0 0 0 1 0 0 0 𝑆ℎ𝑧 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 2 0 0 0 1 0 0 0 3 1 0 0 0 0 1 | | 1 1 3 1 | = | 1 + 2 + 0 + 0 0 + 1 + 0 + 0 0 + 3 + 3 + 0 0 + 0 + 0 + 1 | = | 3 1 6 1 | Therefore, the new coordinates for point (1, 1, 3) will be (3, 1, 6) Shearing along Z-axis For point (0, 0, 0) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 𝑆ℎ𝑥 0 0 1 𝑆ℎ𝑦 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 2 0 0 1 2 0 0 0 1 0 0 0 0 1 | | 0 0 0 1 | = | 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 0 0 + 0 + 0 + 1 | = | 0 0 0 1 | Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0) For point (1, 1, 2) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 𝑆ℎ𝑥 0 0 1 𝑆ℎ𝑦 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 2 0 0 1 2 0 0 0 1 0 0 0 0 1 | | 1 1 2 1 | = | 1 + 0 + 4 + 0 0 + 1 + 4 + 0 0 + 0 + 2 + 0 0 + 0 + 0 + 1 | = | 5 5 2 1 | Therefore, the new coordinates for point (1, 1, 2) will be (5, 5, 2)
  • 14. For point (1, 1, 3) [ 𝑥𝑛𝑒𝑤 𝑦𝑛𝑒𝑤 𝑧𝑛𝑒𝑤 1 ] = | 1 0 𝑆ℎ𝑥 0 0 1 𝑆ℎ𝑦 0 0 0 1 0 0 0 0 1 | | 𝑥𝑜𝑙𝑑 𝑦𝑜𝑙𝑑 𝑧𝑜𝑙𝑑 1 | = | 1 0 2 0 0 1 2 0 0 0 1 0 0 0 0 1 | | 1 1 3 1 | = | 1 + 0 + 6 + 0 0 + 1 + 6 + 0 0 + 0 + 3 + 0 0 + 0 + 0 + 1 | = | 7 7 3 1 | Therefore, the new coordinates for point (0, 0, 0) will be (0, 0, 0)