<p>If, like me, you did vectors in high school or even Uni, they often had to 'qualify' whether you had a '(direction) vector'  or a 'position vector'. I know my kids found it confusing. <br> <br></p>
<p><em>One way</em> to think about it is that adding the extra coordinate, w, fixes/unifies this. When w=0 it implies it's a direction vector, while w=1, a position vector.  <br><br></p>
<p>For example, if you take the difference of two position vectors (ie both w=1) you automatically get a direction vector (w=0).  If you take the average of two position vectors <span class="math-container">$\frac{A+B}{2}$</span>, you will automatically again get a position vector - (in fact, just adding two position vectors is sort of effectively computing the average since <span class="math-container">$(wX, wY, wZ, w)$</span> maps back to <span class="math-container">$(X, Y, Z)$</span>)</p>
<p>As for your questions above, with multiplication, if you scale a 'direction vector' it's the same as you'd expect. Scaling a purely position vector it's more like the first part of a weighted sum.
A cross product probably only makes sense (to me at least) for direction vectors - not given it much thought otherwise.</p>
<p>For other values of w - perhaps you should look at rational Bezier splines. These have control points with &quot;w&quot; components and you interpolate the w values much the same as the x, y &amp; zs.... but map back to xyz by the division by w. With rational quadratic Beziers, for example, you can do sections of conics, eg circles.</p>
<blockquote>
<p>As a follow-up question, how would one &quot;add vectors&quot; in the traditional sense with homogeneous coordinates? That is, if adding two position vectors gives the average, how do we obtain the vector sum representing the translation of a point to another point (e.g. (a,b,c)+(x,y,z)=(a+x,b+y,c+z))? Adding a position vector to a direction vector does the trick (we end up with w=1), but I don't see how that geometrically makes sense</p>
</blockquote>
<p>A translation is done by a 'direction' vector, i.e has w=0.  I was thinking maybe a way of viewing it is to consider the origin as <em>the</em> position vector <span class="math-container">$O_p=(0,0,0,1)$</span>. Given some direction vectors e.g.<span class="math-container">$A_d=(A_x,A_y,A_z,0)$</span> and <span class="math-container">$B_d=(B_x,...,0)$</span>, then a new position can be given by combinations <span class="math-container">$Another_p = O_p + A_d + B_d - C_d + 7 * D_d + etc$</span></p>

CC BY-SA 4.0
2024-06-01T06:39:17.740Z
Thank you! As a follow-up question, how would one "add vectors" in the traditional sense with homogeneous coordinates? That is, if adding two position vectors gives the average, how do we obtain the vector sum representing the translation of a point to another point (e.g. $(a,b,c)+(x,y,z)=(a+x,b+y,c+z)$)? Adding a position vector to a direction vector does the trick (we end up with $w=1$), but I don't see how that geometrically makes sense.
Scene
CC BY-SA 4.0
2024-06-02T15:40:46.703Z
I'll add that to the answer above
Simon F
CC BY-SA 4.0
2024-06-02T16:08:28.313Z
I appreciate your help! That does make sense.
Scene
CC BY-SA 4.0
2024-05-31T08:28:25.927Z
2024-06-02T15:40:12.893Z
2024-06-02T15:40:12.893Z
Simon F
<p>As I understand it: In graphics, 3D vectors are usually represented as homogeneous coordinates by storing an additional <span class="math-container">$w$</span> component known as the weight. The vector is divided by <span class="math-container">$w$</span> to obtain the corresponding Cartesian coordinates.</p>
<p>My confusion is rooted in my inexperience with the topic, so I have a few questions:</p>
<ul>
<li>Vectors representing points have <span class="math-container">$w = 1$</span>. During operations such as addition, scalar multiplication, and cross product, does <span class="math-container">$w$</span> ever (need to) change? I know it can in matrix-vector multiplication (for example, when applying perspective projection).</li>
<li>When would we need to initialize a vector with <span class="math-container">$w$</span> as any other value? I've heard that directions can be represented by <span class="math-container">$w=0$</span> (a point at infinity in the direction of the vector) but I am not quite clear on this.</li>
</ul>
<p>Thank you in advance!</p>

<vectors><coordinates>
What to do with the homogeneous $w$ during vector operations
Scene
# What to do with the homogeneous $w$ during vector operations

(Asked by: username_0 on 2024-05-31)

As I understand it: In graphics, 3D vectors are usually represented as homogeneous coordinates by storing an additional $w$ component known as the weight. The vector is divided by $w$ to obtain the corresponding Cartesian coordinates.

My confusion is rooted in my inexperience with the topic, so I have a few questions:

* Vectors representing points have $w = 1$. During operations such as addition, scalar multiplication, and cross product, does $w$ ever (need to) change? I know it can in matrix-vector multiplication (for example, when applying perspective projection).
* When would we need to initialize a vector with $w$ as any other value? I've heard that directions can be represented by $w=0$ (a point at infinity in the direction of the vector) but I am not quite clear on this.

Thank you in advance!

**Tags:** vectors, coordinates


---

## 1 answers

### Answer by username_1 on 2024-05-31. Score: 3 | Accepted answer

If, like me, you did vectors in high school or even Uni, they often had to 'qualify' whether you had a '(direction) vector' or a 'position vector'. I know my kids found it confusing.

*One way* to think about it is that adding the extra coordinate, w, fixes/unifies this. When w=0 it implies it's a direction vector, while w=1, a position vector.

For example, if you take the difference of two position vectors (ie both w=1) you automatically get a direction vector (w=0). If you take the average of two position vectors $\frac{A+B}{2}$, you will automatically again get a position vector - (in fact, just adding two position vectors is sort of effectively computing the average since $(wX, wY, wZ, w)$ maps back to $(X, Y, Z)$)

As for your questions above, with multiplication, if you scale a 'direction vector' it's the same as you'd expect. Scaling a purely position vector it's more like the first part of a weighted sum.
A cross product probably only makes sense (to me at least) for direction vectors - not given it much thought otherwise.

For other values of w - perhaps you should look at rational Bezier splines. These have control points with "w" components and you interpolate the w values much the same as the x, y & zs.... but map back to xyz by the division by w. With rational quadratic Beziers, for example, you can do sections of conics, eg circles.

> As a follow-up question, how would one "add vectors" in the traditional sense with homogeneous coordinates? That is, if adding two position vectors gives the average, how do we obtain the vector sum representing the translation of a point to another point (e.g. (a,b,c)+(x,y,z)=(a+x,b+y,c+z))? Adding a position vector to a direction vector does the trick (we end up with w=1), but I don't see how that geometrically makes sense

A translation is done by a 'direction' vector, i.e has w=0. I was thinking maybe a way of viewing it is to consider the origin as *the* position vector $O\_p=(0,0,0,1)$. Given some direction vectors e.g.$A\_d=(A\_x,A\_y,A\_z,0)$ and $B\_d=(B\_x,...,0)$, then a new position can be given by combinations $Another\_p = O\_p + A\_d + B\_d - C\_d + 7 \* D\_d + etc$

> **Comments:**
> **username_0**: Thank you! As a follow-up question, how would one "add vectors" in the traditional sense with homogeneous coordinates? That is, if adding two position vectors gives the average, how do we obtain the vector sum representing the translation of a point to another point (e.g. $(a,b,c)+(x,y,z)=(a+x,b+y,c+z)$)? Adding a position vector to a direction vector does the trick (we end up with $w=1$), but I don't see how that geometrically makes sense.  
> **username_1**: I'll add that to the answer above  
> **username_0**: I appreciate your help! That does make sense.  

---

