[solved] getRotationTo return nan quaternion for ZERO vector

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
altren
Gnome
Posts: 329
Joined: Tue Oct 24, 2006 9:02 am
Location: Moscow, Russa
x 24
Contact:

[solved] getRotationTo return nan quaternion for ZERO vector

Post 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
Last edited by altren on Sat Jan 12, 2019 10:58 pm, edited 1 time in total.
Image
User avatar
altren
Gnome
Posts: 329
Joined: Tue Oct 24, 2006 9:02 am
Location: Moscow, Russa
x 24
Contact:

Re: getRotationTo return nan quaternion for ZERO vector

Post 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
Image
Post Reply