18. 3D Transformations - 2
Dated: 13-05-2025
Normalization
The process of moving your points so that your POV is at the origin
looking down the \(z^+\) axis is called normalization
.
Rotation
- Around \(x\) axis in \(yz\)
plane
(pitch). - Around \(y\) axis in \(xz\)
plane
(yaw). - Around \(z\) axis in \(xy\)
plane
(roll).
Pitch
\[x^\prime = x\]
\[y^\prime = y \cos (\theta) - z \sin (\theta)\]
\[z^\prime = y \sin (\theta) + z \cos (\theta)\]
Yaw
\[x^\prime = z \sin (\theta) + x \cos (\theta)\]
\[y^\prime = y\]
\[z^\prime = z \cos (\theta) - x \sin (\theta)\]
Roll
\[x^\prime = x \cos (\theta) - y \sin (\theta)\]
\[y^\prime = x \sin (\theta) + y \cos (\theta)\]
\[z^\prime = z\]
Using Matrices to Create 3D
\[
\begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
\cdot
\begin{bmatrix}
x \\
y \\
z
\end{bmatrix}
=
x
\begin{bmatrix}
1 \\
0 \\
0
\end{bmatrix}
+ y
\begin{bmatrix}
0 \\
1 \\
0
\end{bmatrix}
+ z
\begin{bmatrix}
0 \\
0 \\
1
\end{bmatrix}
=
\begin{bmatrix}
x \\
0 \\
0
\end{bmatrix}
+
\begin{bmatrix}
0 \\
y \\
0
\end{bmatrix}
+
\begin{bmatrix}
0 \\
0 \\
z
\end{bmatrix}
\]
Using Matrices for Rotation
Roll
\[
\begin{bmatrix}
x^\prime \\
y^\prime \\
z^\prime \\
1
\end{bmatrix}
=
\begin{bmatrix}
\cos(\theta) & -\sin(\theta) & 0 & 0 \\
\sin(\theta) & \cos(\theta) & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
z \\
1
\end{bmatrix}
\]
Pitch
\[
\begin{bmatrix}
x^\prime \\
y^\prime \\
z^\prime \\
1
\end{bmatrix}
=
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & \cos(\theta) & -\sin(\theta) & 0 \\
0 & \sin(\theta) & \cos(\theta) & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
z \\
1
\end{bmatrix}
\]
Yaw
\[
\begin{bmatrix}
x^\prime \\
y^\prime \\
z^\prime \\
1
\end{bmatrix}
=
\begin{bmatrix}
\cos(\theta) & 0 & \sin(\theta) & 0 \\
0 & 1 & 0 & 0 \\
-\sin(\theta) & 0 & \cos(\theta) & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
x \\
y \\
z \\
1
\end{bmatrix}
\]
Scaling
Uniform
In this type, we preserve the original shape of the object
.
If the scaling factors are \(S_x, S_y\) and \(S_z\) then
\[S_x = S_y = S_z\]
Differential
In this type, we do not preserve the original shape of the object
.
If the scaling factors are \(S_x, S_y\) and \(S_z\) then
\[S_x \ne S_y \ne S_z\]