GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

Adds Clamp to QuatF::dot() #2275

Closed OTHGMars closed 6 years ago

OTHGMars commented 6 years ago

As shown in the image below, the QuatF::dot() function can return values outside the [-1, 1] range due to floating point precision. This causes the QuatF::angleBetween() function to reurn NAN when it should be returning Zero or Pi (and explains why there are no references to either function in the codebase). This PR clamps the output of QuatF::dot() to the [-1, 1] range so both functions become usable. quaterror Edited to fix image link.