|
In Euclidean geometry, scaling is an affine, linear transformation that can enlarge or diminish an object by certain factors. See also homothety.
A scaling can be represented by a scaling matrix. To scale an object by a vector v = (vx, vy, vz), each point p = (px, py, pz) would need to be multiplied with this scaling matrix:
- <math> S_v =
\begin{bmatrix}
v_x & 0 & 0 \\
0 & v_y & 0 \\
0 & 0 & v_z \\
\end{bmatrix}
<math>
As shown below, the multiplication will give the expected result:
- <math>
S_vp =
\begin{bmatrix}
v_x & 0 & 0 \\
0 & v_y & 0 \\
0 & 0 & v_z \\
\end{bmatrix}
\begin{bmatrix}
p_x \\ p_y \\ p_z
\end{bmatrix}
=
\begin{bmatrix}
v_xp_x \\ v_yp_y \\ v_zp_z
\end{bmatrix}
<math>
Often, it is more useful to use homogeneous coordinates, since translation cannot be accomplished with a 3-by-3 matrix. To scale an object by a vector v = (vx, vy, vz), each homogeneous vector p = (px, py, pz, 1) would need to be multiplied with this scaling matrix:
- <math> S_v =
\begin{bmatrix}
v_x & 0 & 0 & 0 \\
0 & v_y & 0 & 0 \\
0 & 0 & v_z & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
<math>
As shown below, the multiplication will give the expected result:
- <math>
S_vp =
\begin{bmatrix}
v_x & 0 & 0 & 0 \\
0 & v_y & 0 & 0 \\
0 & 0 & v_z & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\begin{bmatrix}
p_x \\ p_y \\ p_z \\ 1
\end{bmatrix}
=
\begin{bmatrix}
v_xp_x \\ v_yp_y \\ v_zp_z \\ 1
\end{bmatrix}
<math>
Since the last component of a homogeneous coordinate can be viewed as the denominator of the other three components, a scaling by a common factor s can be accomplished by using this scaling matrix:
- <math> S_v =
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & \frac{1}{s}
\end{bmatrix}
<math>
For each homogeneous vector p = (px, py, pz, 1) we would have
- <math>
S_vp =
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & \frac{1}{s}
\end{bmatrix}
\begin{bmatrix}
p_x \\ p_y \\ p_z \\ 1
\end{bmatrix}
=
\begin{bmatrix}
p_x \\ p_y \\ p_z \\ \frac{1}{s}
\end{bmatrix}
<math>
which would be homogenized to
- <math>
\begin{bmatrix}
sp_x \\ sp_y \\ sp_z \\ 1
\end{bmatrix}
<math>
|