Various operations on 2D vectors naturally generalise to 3D vectors simply by including the $z$-coordinate. The ones that come to mind are:
- Vector sum and difference
- Dot product
- Magnitude (Euclidean norm)
Various graphics programming tasks also use 4D vectors, usually(?) to represent points in 3D projective space (AKA homogeneous coordinates). Given this, it would seem that the above operations should not use the $w$-coordinate.
For example, the magnitude of a 4D vector would be calculated in exactly the same way as the equivalent 3D vector:
$\lVert \mathbf{v} \rVert = \sqrt{x^2+y^2+z^2}$
...and not with the inclusion of the $w$-coordinate:
$\lVert \mathbf{v} \rVert = \sqrt{x^2+y^2+z^2+w^2}$
(For a point at infinity, where $w=0$, there wouldn't be a difference, but for finite points, there would. I'm also assuming that a finite 4D homogeneous vector is in canonical form, with $w=1$.)
Is this always the case? Is there any situation in graphics programming where calculations on 4D vectors should not treat them as their 3D equivalents, but should actually make use of the $w$-coordinate?