The reason I'm asking this is because I saw an implementation which did it that way but I don't quiet understand it. I mean, usually I want to get the distance between two points in 3d space and if W is something other than 0 the result is not correct. The same when calculating lighting using the dot product.
float Vector::Length() const{
return sqrtf(X * X + Y * Y + Z * Z + W * W); //W necessary?
}
float Vector::Dot(const Vector& other) const{
return X * other.X + Y * other.Y + Z * other.Z + W * other.W;
}
Edit: There are suggestions that my question is a duplicate of already existing ones. But the questions referred to are about whether you need the W component at all and for what. I know what I need it for, I'm just not sure about it's role in the operations I specified.