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
For equal or almost equal vectors (when cosTheta is ~= 1.0f) glm::rotation() can produce slightly incorrect quaternions. You can easily test it with this code:
glm::vec3 testVec = glm::normalize(glm::vec3(5.0f, 5.0f, 5.0f));
glm::quat rotQuat = glm::rotation(testVec, testVec); // Result will be (0.0f, 0.0f, 0.0f, 0.99999994f)
It is OK in most cases, but there are specific exceptions. I think it would be better to add check to glm::rotation() for such cases, something like that:
if (cosTheta >= static_cast<T>(1) - epsilon<T>())
return quat();
This would also prevent unnecessary extra calculations like glm::cross() (which returns zero vector for that case).
The text was updated successfully, but these errors were encountered:
For equal or almost equal vectors (when
cosTheta
is ~= 1.0f)glm::rotation()
can produce slightly incorrect quaternions. You can easily test it with this code:It is OK in most cases, but there are specific exceptions. I think it would be better to add check to
glm::rotation()
for such cases, something like that:This would also prevent unnecessary extra calculations like
glm::cross()
(which returns zero vector for that case).The text was updated successfully, but these errors were encountered: