Original Post
I am creating a simple software rasterizer, and now I am working on the viewport clipping part, in homogeneous space, and to clip a triangle, I have to interpolate between two vertices. So can you actually interpolate between a homogeneous coordinate like you would do with other coordinates (ie. linearily interpolate all coordinates, including the w part)? I don't think you can, and that to interpolate between them, you first have to make the w coordinates equal, and then do your calculations. Now that made me wonder, is a homogeneous 4D vector in fact a 3D version of a fraction, with the w-coordinate being the denominator? If you want to add fractions, you have to make the denominators equal, as we all learnd in elementary school. Now if it's that way, the common operators for these homogeneous vectors would just be the 3D versions, taken into account that it are all fractions. So addition then be this:
Vector4D operator + (const Vector4D &b) const
{
return Vector4D(
x * b.w + b.x * w,
y * b.w + b.y * w,
z * b.w + b.z * w,
w * b.w);
}
and multiplication would be this
Vector4D operator * (float b) const
{
return Vector4D(
x * b,
y * b,
z * b,
w);
}
All with all, it seems to work well, but I couldn't find anything on the internet about homogeneous vectors, only homogeneous coordinates, but I don't think you can do calculations on coordinates, can you? So is there actually something like a homogeneous vector, and if so, is it like this?