<p>To understand the <span class="math-container">$w$</span> component, it'll be easier to understand how <em>homogeneous coordinates</em> come about in the first place. The following example will be in 2D for the sake of simplicity, but the same can be extended to 3D. Let's try to &quot;invent&quot; homogeneous coordinates for the first time.</p>
<p>We start with the high school line equation, <span class="math-container">$ax + by + c = 0$</span>. This line lies on a 2D plane (or more formally, in <span class="math-container">$\mathbb R^2$</span>). We can quite easily see that a point <span class="math-container">$x$</span> in <span class="math-container">$\mathbb R^2$</span>, represented by <span class="math-container">$x = [x_1, x_2]$</span>, lies on our line if the line equation still holds (i.e., <span class="math-container">$ax_1 + bx_2 + c = 0$</span>). Notice that our &quot;line&quot; is really just defined by the values <span class="math-container">$a$</span>, <span class="math-container">$b$</span>, and <span class="math-container">$c$</span>, so lets write that in row-vector form: <span class="math-container">$l =[a\ b\ c]$</span>. Let us define this 3-component vector that represents our line in 2D as our &quot;homogeneous representation&quot; of a line in 2D space. This is the first building block of our &quot;homogeneous coordinates&quot; system.</p>
<p>To test if a point lies on this line line, we're really just doing component-wise multiplication between <span class="math-container">$l$</span> and <span class="math-container">$x$</span>, (<span class="math-container">$a \times x_1 + b \times x_2 + ... = 0$</span>), so we can now re-write our line equation as a dot product of <span class="math-container">$x$</span> and <span class="math-container">$l$</span> <em>if</em> we add a 1 as the 3rd component of our 2D points: <span class="math-container">$x' = [x_1, x_2, 1]$</span>. Now:</p>
<p><span class="math-container">$$ l.x' = [a\ b\ c] \left[
       \begin{array}{c}
       x_1\\
       x_2\\
       1
       \end{array}
\right] = ax_1 + bx_2 + c = 0 $$</span></p>
<p>That gets us back our original line equation exactly! Now we call our new 3-component point <span class="math-container">$x'$</span> as the normalized homogeneous representation of a 2D point. That &quot;1&quot; in the third component is the so called <span class="math-container">$w$</span> component. You might also have noticed that lines and points are not distinguished here. This is true in homogeneous coordinates, lines and points are <em>duals</em> of each other.</p>
<p>We can also see that it doesn't matter what are the exact values of <span class="math-container">$a$</span>, <span class="math-container">$b$</span>, and <span class="math-container">$c$</span> (or conversely, <span class="math-container">$x_1, x_2, w$</span>), but rather it is the 2 independent <em>ratios</em> (<span class="math-container">$a : b$</span> and <span class="math-container">$b : c$</span>) that really matters. In other words,</p>
<p><span class="math-container">$$w(ax_1 + bx_2 + c) = 0$$</span></p>
<p>will hold for all values of <span class="math-container">$w$</span> (except for <span class="math-container">$w = 0$</span> for reasons to be explained later). This means that in our homogeneous coordinate system, the following all represents the same point:</p>
<p><span class="math-container">$$w \left[
       \begin{array}{c}
       x_1\\
       x_2\\
       1
       \end{array}
\right] \equiv \left[
       \begin{array}{c}
       x_1\\
       x_2\\
       1
       \end{array}
\right] \equiv \left[
       \begin{array}{c}
       wx_1\\
       wx_2\\
       w
       \end{array}
\right] $$</span></p>
<p>By now, we've defined a new homogeneous coordinate system with a point <span class="math-container">$x'$</span> in this coordinate system. How do we get back <span class="math-container">$x$</span>, the original 2D point? I hope it is simple to see that we just have to divide by <span class="math-container">$w$</span> and drop the <span class="math-container">$w$</span> component to get back the original point (this is in fact, &quot;perspective division&quot;!).</p>
<p><span class="math-container">$$ x = \left[
       \begin{array}{c}
       x_1/w\\
       x_2/w\\
       \end{array}
\right] $$</span></p>
<p>Notice how we can't divide by <span class="math-container">$w$</span> if <span class="math-container">$w = 0$</span>? As a side note, this property is actually exploited in projective space, for us to represent points at infinity by having 0 in the <span class="math-container">$w$</span> component. In computer graphics, we also exploit this to represent vectors. You cannot get back a 2D point from a vector in homogeneous coordinates, which makes sense.</p>
<p>So to answer the original question of &quot;what is the <span class="math-container">$w$</span> component?&quot;, it is just a scale factor for homogeneous coordinates. It may or may not be 1, but if it isn't 1, you have to normalize it by dividing the <span class="math-container">$w$</span> component as described above.</p>

CC BY-SA 4.0
2021-03-22T10:43:32.767Z
2021-03-22T10:54:17.460Z
2021-03-22T10:54:17.460Z
eclmist
<p>The relationship between standard coordinates <span class="math-container">$(x,y)$</span> and homogeneous coordinates <span class="math-container">$(X,Y,Z)$</span> is <span class="math-container">$x = X / Z, y = Y/Z$</span>. Homogeneous coordinates are a type of <a href="https://en.wikipedia.org/wiki/Homogeneous_coordinates" rel="nofollow noreferrer">projective coordinates</a>. All points on the line <span class="math-container">$(Z x, Z y, Z)$</span> are equivalent to the point <span class="math-container">$(x,y)$</span> in 2D (the same thing can be applied for 3D). So technically 2D points are represented as 3D lines passing though the origin, and 2D lines are represented as 3D planes passing through the origin.</p>
<p>In computer graphics the above interpretation is largely irrelevant, however, since homogeneous coordinates are used mostly for convenience. A translation is of the form <span class="math-container">$x' = x+t_x, y' = y+t_y$</span>. If one uses homogeneous coordinates, then this can be achieved through <span class="math-container">$X' = 1 \cdot X + 0 \cdot Y + t_x \cdot Z$</span>, <span class="math-container">$Y' = 0 \cdot X + 1 \cdot Y + t_y \cdot Z$</span>, and <span class="math-container">$Z' = 0 \cdot X + 0\cdot Y + 1 \cdot Z$</span>.  If you set <span class="math-container">$Z=1$</span> then you get exactly the expression for translation, and you can use the matrix induced from the 3 equations above. For directions you can set <span class="math-container">$Z=0$</span> so that translation would not be applied to those.</p>
<p>In 3D the homogeneous coordinates <span class="math-container">$W$</span> also plays a role in the perspective projection, since the projection matrix modifies it to hold the relevant value by which the other coordinates must be divided, and the division is typically carried out by the hardware.</p>

CC BY-SA 4.0
2021-03-20T16:22:22.873Z
2021-03-20T16:22:22.873Z
lightxbulb
<p>I was reading the wiki article about homogeneous coordinates , I learned that it has it's advantages when it comes to performing affine transformation, since you can represent it only matrices. But I couldn't understand what is the additional third component compared to  Cartesian coordinates.   In the image below  we see additional 1(which  I am trying to understand)  added to convert it to  homogeneous coordinates.</p>
<p><a href="https://i.sstatic.net/e4gAx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/e4gAx.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-03-20T15:24:26.843Z
I don't understand your question. It seems to be saying that you read about homogeneous coordinates, but you don't actually know what they are or do or what their purpose is. Which would imply that you absorbed nothing from the article save the fact that they add an extra coordinate. Can you be more specific about what you do understand and what you do not?
Nicol Bolas
CC BY-SA 4.0
2021-03-28T20:15:37.663Z
https://computergraphics.stackexchange.com/questions/6271/what-is-the-use-of-homogenous-divide/6275#6275
gallickgunner
<affine-transformations>
What is exactly the third component in homogeneous coordinate system?
Parviz Pirizade
# What is exactly the third component in homogeneous coordinate system?

(Asked by: username_0 on 2021-03-20)

I was reading the wiki article about homogeneous coordinates , I learned that it has it's advantages when it comes to performing affine transformation, since you can represent it only matrices. But I couldn't understand what is the additional third component compared to Cartesian coordinates. In the image below we see additional 1(which I am trying to understand) added to convert it to homogeneous coordinates.

[![enter image description here](https://i.sstatic.net/e4gAx.png)](https://i.sstatic.net/e4gAx.png)

**Tags:** affine-transformations

> **Comments:**
> **username_1**: I don't understand your question. It seems to be saying that you read about homogeneous coordinates, but you don't actually know what they are or do or what their purpose is. Which would imply that you absorbed nothing from the article save the fact that they add an extra coordinate. Can you be more specific about what you do understand and what you do not?  
> **username_2**: https://computergraphics.stackexchange.com/questions/6271/what-is-the-use-of-homogenous-divide/6275#6275  

---

## 2 answers

### Answer by username_3 on 2021-03-22. Score: 4

To understand the $w$ component, it'll be easier to understand how *homogeneous coordinates* come about in the first place. The following example will be in 2D for the sake of simplicity, but the same can be extended to 3D. Let's try to "invent" homogeneous coordinates for the first time.

We start with the high school line equation, $ax + by + c = 0$. This line lies on a 2D plane (or more formally, in $\mathbb R^2$). We can quite easily see that a point $x$ in $\mathbb R^2$, represented by $x = [x\_1, x\_2]$, lies on our line if the line equation still holds (i.e., $ax\_1 + bx\_2 + c = 0$). Notice that our "line" is really just defined by the values $a$, $b$, and $c$, so lets write that in row-vector form: $l =[a\ b\ c]$. Let us define this 3-component vector that represents our line in 2D as our "homogeneous representation" of a line in 2D space. This is the first building block of our "homogeneous coordinates" system.

To test if a point lies on this line line, we're really just doing component-wise multiplication between $l$ and $x$, ($a \times x\_1 + b \times x\_2 + ... = 0$), so we can now re-write our line equation as a dot product of $x$ and $l$ *if* we add a 1 as the 3rd component of our 2D points: $x' = [x\_1, x\_2, 1]$. Now:

$$ l.x' = [a\ b\ c] \left[
\begin{array}{c}
x\_1\\
x\_2\\
1
\end{array}
\right] = ax\_1 + bx\_2 + c = 0 $$

That gets us back our original line equation exactly! Now we call our new 3-component point $x'$ as the normalized homogeneous representation of a 2D point. That "1" in the third component is the so called $w$ component. You might also have noticed that lines and points are not distinguished here. This is true in homogeneous coordinates, lines and points are *duals* of each other.

We can also see that it doesn't matter what are the exact values of $a$, $b$, and $c$ (or conversely, $x\_1, x\_2, w$), but rather it is the 2 independent *ratios* ($a : b$ and $b : c$) that really matters. In other words,

$$w(ax\_1 + bx\_2 + c) = 0$$

will hold for all values of $w$ (except for $w = 0$ for reasons to be explained later). This means that in our homogeneous coordinate system, the following all represents the same point:

$$w \left[
\begin{array}{c}
x\_1\\
x\_2\\
1
\end{array}
\right] \equiv \left[
\begin{array}{c}
x\_1\\
x\_2\\
1
\end{array}
\right] \equiv \left[
\begin{array}{c}
wx\_1\\
wx\_2\\
w
\end{array}
\right] $$

By now, we've defined a new homogeneous coordinate system with a point $x'$ in this coordinate system. How do we get back $x$, the original 2D point? I hope it is simple to see that we just have to divide by $w$ and drop the $w$ component to get back the original point (this is in fact, "perspective division"!).

$$ x = \left[
\begin{array}{c}
x\_1/w\\
x\_2/w\\
\end{array}
\right] $$

Notice how we can't divide by $w$ if $w = 0$? As a side note, this property is actually exploited in projective space, for us to represent points at infinity by having 0 in the $w$ component. In computer graphics, we also exploit this to represent vectors. You cannot get back a 2D point from a vector in homogeneous coordinates, which makes sense.

So to answer the original question of "what is the $w$ component?", it is just a scale factor for homogeneous coordinates. It may or may not be 1, but if it isn't 1, you have to normalize it by dividing the $w$ component as described above.


---

### Answer by username_4 on 2021-03-20. Score: 3

The relationship between standard coordinates $(x,y)$ and homogeneous coordinates $(X,Y,Z)$ is $x = X / Z, y = Y/Z$. Homogeneous coordinates are a type of [projective coordinates](https://en.wikipedia.org/wiki/Homogeneous_coordinates). All points on the line $(Z x, Z y, Z)$ are equivalent to the point $(x,y)$ in 2D (the same thing can be applied for 3D). So technically 2D points are represented as 3D lines passing though the origin, and 2D lines are represented as 3D planes passing through the origin.

In computer graphics the above interpretation is largely irrelevant, however, since homogeneous coordinates are used mostly for convenience. A translation is of the form $x' = x+t\_x, y' = y+t\_y$. If one uses homogeneous coordinates, then this can be achieved through $X' = 1 \cdot X + 0 \cdot Y + t\_x \cdot Z$, $Y' = 0 \cdot X + 1 \cdot Y + t\_y \cdot Z$, and $Z' = 0 \cdot X + 0\cdot Y + 1 \cdot Z$. If you set $Z=1$ then you get exactly the expression for translation, and you can use the matrix induced from the 3 equations above. For directions you can set $Z=0$ so that translation would not be applied to those.

In 3D the homogeneous coordinates $W$ also plays a role in the perspective projection, since the projection matrix modifies it to hold the relevant value by which the other coordinates must be divided, and the division is typically carried out by the hardware.


---

