You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Sorry for the extremely late reply, only now going through the notification pile.)
Ah well, numerical issues. There's a tradeoff between doing the simplest possible thing (and being fast), or being immune to every possible corner case and ending up with a similar monstrosity as std::lerp(). I'd need to do some research, do you know about any "usual" way how this is being done robustly? I looked at Eigen's normalized() and it suffers from the same problem:
RealScalar z = n.squaredNorm();
// NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPUif(z>RealScalar(0))
return n / numext::sqrt(z);
elsereturn n;
Normalizing a vector
vec
with a very large component does not not lead to the expected result.The expected result is
vec.normalized(): Vector(0, 0, 1)
The text was updated successfully, but these errors were encountered: