2D Computer Graphics - Using Homogeneous Coordinates

Using Homogeneous Coordinates

In projective geometry, often used in computer graphics, points are represented using homogeneous coordinates. To scale an object by a vector v = (vx, vy, vz), each homogeneous coordinate vector p = (px, py, pz, 1) would need to be multiplied with this projective transformation matrix:

 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}.

As shown below, the multiplication will give the expected result:


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}.

Since the last component of a homogeneous coordinate can be viewed as the denominator of the other three components, a uniform scaling by a common factor s (uniform scaling) can be accomplished by using this scaling matrix:

 S_v =
\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & \frac{1}{s}
\end{bmatrix}.

For each vector p = (px, py, pz, 1) we would have


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}

which would be homogenized to


\begin{bmatrix}
sp_x \\ sp_y \\ sp_z \\ 1
\end{bmatrix}.

Read more about this topic:  2D Computer Graphics

Famous quotes containing the word homogeneous:

    O my Brothers! love your Country. Our Country is our home, the home which God has given us, placing therein a numerous family which we love and are loved by, and with which we have a more intimate and quicker communion of feeling and thought than with others; a family which by its concentration upon a given spot, and by the homogeneous nature of its elements, is destined for a special kind of activity.
    Giuseppe Mazzini (1805–1872)