3 ms·
While we're at it, can we please move the homogeneous coordinate to be the first value in memory? That way, a vector or a point, if they're represented sparsel
by VikingCoder 7y ago
While we're at it, can we please move the homogeneous coordinate to be the first value in memory? That way, a vector or a point, if they're represented sparsely in the data structure, just work.
[1], a point at the origin, is the same as [1 0] - a point at the origin in 1 dimension, or as [1 0 0], a point at the origin in 2 dimensions, or [1 0 0 0], a point at the origin in 3 dimensions.
Similarly, [0] is a zero vector. [0 0 0 0] is a zero vector in 3 dimensions.
Having to know [0 0 1] is a point at the origin in 2 dimensions (with a homogeneous coordinate), while [0 0 1] is a z vector in 3 dimensions (without the homogeneous coordinate), is just silly.
Why did we do this to ourselves?
- joppy 7y agoIt’s puzzling - even in most of the mathematical literature, x_0 is used for the homogeneous coordinate.
- orbots 7y agoMemory layout. You can do a hacky "cast" from a homegeneous 4-vector to a ideal 3-vector for free. Same pointer.
- joppy 7y agoThis would mean that you have to make sure elsewhere in your code that the last coordinate is always normalised to 1, so do you win overall using this strategy? Plus, the same cast in the other method is ptr+1, which is assumedly just as fast.