3D Transformation
3D Transformation
3D transformations refer to the process of changing the position, orientation, and size of objects
in three-dimensional space. These transformations are fundamental in computer graphics, CAD
(Computer-Aided Design), animation, and games.
1. Translation
Translation moves an object from one location to another without rotating or resizing it. It
involves shifting an object along the X, Y, and Z axes.
2. Scaling
Scaling changes the size of an object. It can either enlarge or shrink the object along the X, Y,
and Z axes. The scaling transformation is typically represented by a scaling factor for each axis.
3. Rotation
Rotation changes the orientation of an object around one of the axes (X, Y, or Z). The rotation is
done in a counter-clockwise direction, and the amount of rotation is measured in degrees or
radians.
In general, the 3D rotation matrix for an object is defined by one or more of the following
rotation matrices depending on the axis of rotation:
Ry(θ)=(cos(θ)0sin(θ)010−sin(θ)0cos(θ))R_y(\theta) = \begin{pmatrix}
\cos(\theta) & 0 & \sin(\theta) \\ 0 & 1 & 0 \\ -\sin(\theta) & 0 & \cos(\theta)
\end{pmatrix}Ry(θ)=cos(θ)0−sin(θ)010sin(θ)0cos(θ)
4. Shearing
Shearing involves changing the shape of an object in such a way that the transformation pushes
one layer of the object in a different direction than the other. It can be done along any of the axes
and is usually represented by a shear matrix.
5. Perspective Transformation
Perspective transformation involves adjusting the depth perception of an object, making distant
objects appear smaller. This is especially important for rendering 3D objects onto a 2D screen
(e.g., in games and animations).
Where fff is the focal length and nnn is the near plane, and ddd is the distance from the
camera.
Combining Transformations
In practice, these transformations are often combined into a single matrix operation. To do this,
we multiply the matrices representing each transformation in the order they should be applied.
6. Homogeneous Coordinates
This allows for a unified approach to all transformations, making them easier to compute and
combine.
Numerical problem of transformation:-
Let's work through a numerical example involving 3D transformations. We will apply multiple
transformations — translation, rotation, and scaling — to a point in 3D space. We'll do the
following steps:
Problem:
Step 1: Translation
Translation involves moving the point along the X, Y, and Z axes. The translation vector is
T=(3,−2,1)T = (3, -2, 1)T=(3,−2,1), and the point is P=(1,2,3)P = (1, 2, 3)P=(1,2,3).
P′=P+T=(1+3,2−2,3+1)=(4,0,4)P' = P + T = (1 + 3, 2 - 2, 3 + 1) = (4, 0,
4)P′=P+T=(1+3,2−2,3+1)=(4,0,4)
Step 2: Rotation
Now we rotate the point 90 degrees around the Z-axis. The rotation matrix for a 90-degree
rotation around the Z-axis is:
Rz(90∘)=(cos(90∘)−sin(90∘)0sin(90∘)cos(90∘)0001)R_z(90^\circ) = \begin{pmatrix}
\cos(90^\circ) & -\sin(90^\circ) & 0 \\ \sin(90^\circ) & \cos(90^\circ) & 0 \\ 0 & 0 & 1
\end{pmatrix}Rz(90∘)=cos(90∘)sin(90∘)0−sin(90∘)cos(90∘)0001
So, after the rotation, the new coordinates of the point are (0,4,4)(0, 4, 4)(0,4,4).
Step 3: Scaling
Next, we apply scaling. The scaling factors are sx=2s_x = 2sx=2, sy=3s_y = 3sy=3, and sz=1s_z
= 1sz=1. The scaling matrix is:
Now, apply the scaling matrix to the rotated point (0,4,4)(0, 4, 4)(0,4,4):
So, after scaling, the final coordinates of the point are (0,12,4)(0, 12, 4)(0,12,4).
Final Result:
After applying translation, rotation, and scaling, the final position of the point P(1,2,3)P(1, 2,
3)P(1,2,3) is:
(0,12,4)\boxed{(0, 12, 4)}(0,12,4)
This process demonstrates how to apply different transformations step by step to a point in 3D
space.