Maybe something like this?
I'm not sure how much of a performance impact an if statement and 3 divides will make.
I guess this also applies to Vector3::NormalizeCopy().
I'm not sure how much of a performance impact an if statement and 3 divides will make.
inline void Normalize(void) { double Len = Length(); // If the length is zero, the vector cannot possibly have a direction. if (Len == 0.0d) { x = static_case<T>(0); y = static_case<T>(0); z = static_case<T>(0); return; } x = static_cast<T>(x / Len); y = static_cast<T>(y / Len); z = static_cast<T>(z / Len); }
I guess this also applies to Vector3::NormalizeCopy().