From 4558b25a55d54b72e838fd5dfbfd74fe423e0924 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 22 Sep 2015 19:09:48 +0200 Subject: [PATCH] fix polar decomposition issue pointed out by Francesc Juhe --- src/libcore/track.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libcore/track.cpp b/src/libcore/track.cpp index dc4ac3ac..2ba9a658 100644 --- a/src/libcore/track.cpp +++ b/src/libcore/track.cpp @@ -1,6 +1,7 @@ #include #include #include +#include MTS_NAMESPACE_BEGIN @@ -354,13 +355,13 @@ void AnimatedTransform::appendTransform(Float time, const Transform &trafo) { Eigen::JacobiSVD svd(A, Eigen::ComputeFullU | Eigen::ComputeFullV); EMatrix U = svd.matrixU(), V = svd.matrixV(), S = svd.singularValues().asDiagonal(); - if (svd.singularValues().prod() < 0) { - S = -S; U = -U; - } - EMatrix Q = U*V.transpose(); EMatrix P = V*S*V.transpose(); + if (Q.determinant() < 0) { + Q = -Q; P = -P; + } + VectorTrack *translation = (VectorTrack *) m_tracks[0]; QuatTrack *rotation = (QuatTrack *) m_tracks[1]; VectorTrack *scaling = (VectorTrack *) m_tracks[2];