Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.7
-
None
Description
QVector3D::normalized tests length-squared; if it's "too short" it returns the zero vector. The problem is, "too short" isn't anywhere near where we'd have precision loss. For example, the vector
{1e-10, 0.5e-10, 0}has a well-defined direction, but normalized will return zero.
I can see having a cutoff when length-squared approaches float32's minimum positive value (~1e-38) so when components have a length on the order of 1e-19, but the threshold now is closer to float epsilon (the smallest number you can add to 1.0f and get a result that's not 1.0f).
The same is true of the other QVectorND classes and QQuaternion.