fix polar decomposition issue pointed out by Francesc Juhe
parent
a2dc699cf2
commit
4558b25a55
|
@ -1,6 +1,7 @@
|
||||||
#include <mitsuba/core/track.h>
|
#include <mitsuba/core/track.h>
|
||||||
#include <mitsuba/core/aabb.h>
|
#include <mitsuba/core/aabb.h>
|
||||||
#include <Eigen/SVD>
|
#include <Eigen/SVD>
|
||||||
|
#include <Eigen/Geometry>
|
||||||
|
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
@ -354,13 +355,13 @@ void AnimatedTransform::appendTransform(Float time, const Transform &trafo) {
|
||||||
Eigen::JacobiSVD<EMatrix> svd(A, Eigen::ComputeFullU | Eigen::ComputeFullV);
|
Eigen::JacobiSVD<EMatrix> svd(A, Eigen::ComputeFullU | Eigen::ComputeFullV);
|
||||||
EMatrix U = svd.matrixU(), V = svd.matrixV(), S = svd.singularValues().asDiagonal();
|
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 Q = U*V.transpose();
|
||||||
EMatrix P = V*S*V.transpose();
|
EMatrix P = V*S*V.transpose();
|
||||||
|
|
||||||
|
if (Q.determinant() < 0) {
|
||||||
|
Q = -Q; P = -P;
|
||||||
|
}
|
||||||
|
|
||||||
VectorTrack *translation = (VectorTrack *) m_tracks[0];
|
VectorTrack *translation = (VectorTrack *) m_tracks[0];
|
||||||
QuatTrack *rotation = (QuatTrack *) m_tracks[1];
|
QuatTrack *rotation = (QuatTrack *) m_tracks[1];
|
||||||
VectorTrack *scaling = (VectorTrack *) m_tracks[2];
|
VectorTrack *scaling = (VectorTrack *) m_tracks[2];
|
||||||
|
|
Loading…
Reference in New Issue