Page 1 of 1

[solved] getRotationTo return nan quaternion for ZERO vector

Posted: Thu Jan 10, 2019 10:36 pm
by altren
I understand, that it makes sense to check input before calling VectorBase<3, Real>::getRotationTo, but wouldn't it be better to return some safe value, like Identity, instead of nan?

Ogre stable branch

Re: getRotationTo return nan quaternion for ZERO vector

Posted: Thu Jan 10, 2019 11:01 pm
by altren
Before this commit

Code: Select all

SHA-1: fe247d2d3c06f8d3c6817e592a0274fcad0d97d1

* Improve Vector3::perpendicular() and Vector3::getRotationTo()

and add unit tests for these functions.
code was less broken, but still had few edge cases with nan output for zero vectors.

Suggested fix: https://github.com/OGRECave/ogre/pull/1045