From bf4b92f1c01a0a4ee7f057a9ee709c9439465cab Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 28 Feb 2006 16:14:58 +0000 Subject: [PATCH] cover the case normV==0 [[Imported from SVN: r741]] --- src/quaternion.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/quaternion.hh b/src/quaternion.hh index 00a0f214..0e97c3ab 100644 --- a/src/quaternion.hh +++ b/src/quaternion.hh @@ -17,6 +17,10 @@ public: T normV = std::sqrt(v0*v0 + v1*v1 + v2*v2); T sin = std::sin(normV/2)/normV; + // if normV == 0 then q = (0,0,0,1) + if (isnan(sin)) + sin = 0; + q[0] = sin * v0; q[1] = sin * v1; q[2] = sin * v2; -- GitLab