From 2cca35c8fe6507ea7c3c7cbc70929fc0407e271b Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Thu, 12 Mar 2020 06:10:44 +0100 Subject: [PATCH] AxisAngle: call q.imag().norm() for conversion This is important depending on the platform because norm() calls matrix::squrt() which dispatches correctly to the implementation for the used type. Otherwise float squrt()s can get calculated as double. --- matrix/AxisAngle.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix/AxisAngle.hpp b/matrix/AxisAngle.hpp index 98c89cd620..d72de6269a 100644 --- a/matrix/AxisAngle.hpp +++ b/matrix/AxisAngle.hpp @@ -69,7 +69,7 @@ public: AxisAngle(const Quaternion &q) { AxisAngle &v = *this; - Type mag = Type(sqrt(q(1) * q(1) + q(2) * q(2) + q(3) * q(3))); + Type mag = q.imag().norm(); if (fabs(mag) >= Type(1e-10)) { v = q.imag() * Type(Type(2) * atan2(mag, q(0)) / mag); } else {