by VikingCoder · 7y ago · 0 comments
A 2D vector, we generally store as [x, y, 0]. What's the extra 0? The homogeneous coordinate.
A 2D point, we generally store as [x, y, 1]. That extra 1 is the homogeneous coordinate, and since it's there, it means "and apply translations!"
If I have a 2D transform, I put the translation component in the last row or column, depending on if you pre-multiply or post-multiply (I can never remember which).
When I transform a vector by that matrix, the 0 in the homogeneous coordinate means translation doesn't apply.
Perfect!
But what if I have a 3D vector? Well... I end up with [x, y, z, 0], right?
Ugh.
If instead, we stored the homogeneous coordinate in the FIRST position, [0, x, y] for 2D, and [0, x, y, z] for 3D, etc. then it's just a sparse vector! Set the values you want to! [0] is the 0-vector in any number of dimensions!
[1] is the origin point in any number of dimensions!
Why did we put the homogeneous coordinate last in all our internal representations? It was so dumb!
I don't understand this:
> then it's just a sparse vector! Set the variables you want to!
Or this:
> [1] is the origin point in any number of dimensions.
Could you clarify?
Also, I don't think this book even discusses homogeneous coordinates. It would be sort of unusual for this type of general text and the only mention of "homogeneous" in the index is "homogeneous equation."
The vector is sparse in the sense that you can regard a point as being an infinitely long list of numbers of which we are sparsely giving only that prefix that is non-zero (like how you can regard a decimal numeral as being an infinitely long list of digits, all the ones that are missing being 0).
[1] is the origin point in any dimension because it is [1] in P^0, [1 0] in P^1, [1 0 0] in P^2, etc.
One of the use cases for homogeneous coordinates is certainly to be able to achieve translation.
"we" is computer programmers who deal with vectors and points. Mostly graphics, physics, games, etc.