3D Transformation
3D Transformation
This translation is achieved by adding the translation coordinates to the old coordinates of the
object as-
Question: Given a 3D object with coordinate points A(0, 3, 1), B(3, 3, 2), C(3, 0, 0), D(0, 0,
0). Apply the translation with the distance 1 towards X axis, 1 towards Y axis and 2 towards Z
axis and obtain the new coordinates of the object.
Solution:
Given-
Old coordinates of the object = A (0, 3, 1), B(3, 3, 2), C(3, 0, 0), D(0, 0, 0)
Translation vector = (Tx, Ty, Tz) = (1, 1, 2)
For Coordinates A(0, 3, 1)
Let the new coordinates of A = (Xnew, Ynew, Znew).
3D Rotation
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-
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-
Problem-01:
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-
Given-
Xnew = Xold = 1
Ynew = Yold x cosθ – Zold x sinθ = 2 x cos90° – 3 x sin90° = 2 x 0 – 3 x 1 = -3
Znew = Yold x sinθ + Zold x cosθ = 2 x sin90° + 3 x cos90° = 2 x 1 + 3 x 0 = 2
Thus, New coordinates after rotation = (1, -3, 2).
3D Scaling
scaling is a process of modifying or altering the size of objects.
Let-
Xnew = Xold x Sx
Ynew = Yold x Sy
Znew = Zold x Sz
In Matrix form, the above scaling equations may be represented as-
Problem-01:
Given a 3D object with coordinate points A(0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0, 0, 0). 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-
Given-
Old coordinates of the object = A (0, 3, 3), B(3, 3, 6), C(3, 0, 1), D(0, 0, 0)
Scaling factor along X axis = 2
Scaling factor along Y axis = 3
Scaling factor along Z axis = 3
For Coordinates A(0, 3, 3)
Let the new coordinates of A after scaling = (X new, Ynew, Znew).
Let-
Xnew = Xold
Ynew = Yold
Znew = -Zold
In Matrix form, the above reflection equations may be represented as-
Xnew = -Xold
Ynew = Yold
Znew = Zold
In Matrix form, the above reflection equations may be represented as-
Xnew = Xold
Ynew = -Yold
Znew = Zold
In Matrix form, the above reflection equations may be represented as-
Problem-01:
Given a 3D triangle with coordinate points A(3, 4, 1), B(6, 4, 2), C(5, 6, 3). Apply the reflection
on the XY plane and find out the new coordinates of the object.
Solution-
Given-
Old corner coordinates of the triangle = A (3, 4, 1), B(6, 4, 2), C(5, 6, 3)
Reflection has to be taken on the XY plane
For Coordinates A(3, 4, 1)
Let the new coordinates of corner A after reflection = (X new, Ynew, Znew).
Xnew = Xold = 3
Ynew = Yold = 4
Znew = -Zold = -1
Thus, New coordinates of corner A after reflection = (3, 4, -1).
Xnew = Xold = 6
Ynew = Yold = 4
Znew = -Zold = -2
Thus, New coordinates of corner B after reflection = (6, 4, -2).
Xnew = Xold = 5
Ynew = Yold = 6
Znew = -Zold = -3
Thus, New coordinates of corner C after reflection = (5, 6, -3).
Thus, New coordinates of the triangle after reflection = A (3, 4, -1), B(6, 4, -2), C(5, 6, -3).
Problem-02:
Given a 3D triangle with coordinate points A(3, 4, 1), B(6, 4, 2), C(5, 6, 3). Apply the reflection
on the XZ plane and find out the new coordinates of the object.
Solution-
Given-
Old corner coordinates of the triangle = A (3, 4, 1), B(6, 4, 2), C(5, 6, 3)
Reflection has to be taken on the XZ plane
Xnew = Xold = 3
Ynew = -Yold = -4
Znew = Zold = 1
Thus, New coordinates of corner A after reflection = (3, -4, 1).
Xnew = Xold = 6
Ynew = -Yold = -4
Znew = Zold = 2
Thus, New coordinates of corner B after reflection = (6, -4, 2).
Xnew = Xold = 5
Ynew = -Yold = -6
Znew = Zold = 3
Thus, New coordinates of corner C after reflection = (5, -6, 3).
3D Shearing
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.
Let-
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-
Shearing in Z Axis-
Shearing in Z axis is achieved by using the following shearing equations-
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-
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).
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).
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 = (X new, Ynew, Znew).
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 = (X new, Ynew, Znew).