|
|
@@ -17,6 +17,7 @@ template <
|
|
|
typename DerivedT>
|
|
|
IGL_INLINE void igl::polar_svd(
|
|
|
const Eigen::MatrixBase<DerivedA> & A,
|
|
|
+ const bool includeReflections,
|
|
|
Eigen::PlainObjectBase<DerivedR> & R,
|
|
|
Eigen::PlainObjectBase<DerivedT> & T)
|
|
|
{
|
|
|
@@ -28,7 +29,7 @@ IGL_INLINE void igl::polar_svd(
|
|
|
MatA U;
|
|
|
MatA V;
|
|
|
Eigen::Matrix<typename DerivedA::Scalar,DerivedA::RowsAtCompileTime,1> S;
|
|
|
- return igl::polar_svd(A,R,T,U,S,V);
|
|
|
+ return igl::polar_svd(A,includeReflections,R,T,U,S,V);
|
|
|
}
|
|
|
|
|
|
template <
|
|
|
@@ -40,6 +41,7 @@ template <
|
|
|
typename DerivedV>
|
|
|
IGL_INLINE void igl::polar_svd(
|
|
|
const Eigen::MatrixBase<DerivedA> & A,
|
|
|
+ const bool includeReflections,
|
|
|
Eigen::PlainObjectBase<DerivedR> & R,
|
|
|
Eigen::PlainObjectBase<DerivedT> & T,
|
|
|
Eigen::PlainObjectBase<DerivedU> & U,
|
|
|
@@ -60,7 +62,7 @@ IGL_INLINE void igl::polar_svd(
|
|
|
R = U*V.transpose();
|
|
|
const auto & SVT = S.asDiagonal() * V.adjoint();
|
|
|
// Check for reflection
|
|
|
- if(R.determinant() < 0)
|
|
|
+ if(!includeReflections && R.determinant() < 0)
|
|
|
{
|
|
|
// Annoyingly the .eval() is necessary
|
|
|
auto W = V.eval();
|
|
|
@@ -73,9 +75,38 @@ IGL_INLINE void igl::polar_svd(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+template <
|
|
|
+ typename DerivedA,
|
|
|
+ typename DerivedR,
|
|
|
+ typename DerivedT,
|
|
|
+ typename DerivedU,
|
|
|
+ typename DerivedS,
|
|
|
+ typename DerivedV>
|
|
|
+IGL_INLINE void igl::polar_svd(
|
|
|
+ const Eigen::MatrixBase<DerivedA> & A,
|
|
|
+ Eigen::PlainObjectBase<DerivedR> & R,
|
|
|
+ Eigen::PlainObjectBase<DerivedT> & T,
|
|
|
+ Eigen::PlainObjectBase<DerivedU> & U,
|
|
|
+ Eigen::PlainObjectBase<DerivedS> & S,
|
|
|
+ Eigen::PlainObjectBase<DerivedV> & V)
|
|
|
+{
|
|
|
+ return igl::polar_svd(A,false,R,T,U,S,V);
|
|
|
+}
|
|
|
+/// \overload
|
|
|
+template <
|
|
|
+ typename DerivedA,
|
|
|
+ typename DerivedR,
|
|
|
+ typename DerivedT>
|
|
|
+IGL_INLINE void igl::polar_svd(
|
|
|
+ const Eigen::MatrixBase<DerivedA> & A,
|
|
|
+ Eigen::PlainObjectBase<DerivedR> & R,
|
|
|
+ Eigen::PlainObjectBase<DerivedT> & T)
|
|
|
+{
|
|
|
+ return igl::polar_svd(A,false,R,T);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef IGL_STATIC_LIBRARY
|
|
|
// Explicit template instantiation
|
|
|
-// generated by autoexplicit.sh
|
|
|
template void igl::polar_svd<Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> >, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Transpose<Eigen::Matrix<double, 3, 3, 0, 3, 3> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
|
|
template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
|
|
template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
|
|
|
@@ -89,4 +120,5 @@ template void igl::polar_svd<Eigen::Matrix<float, 2, 2, 0, 2, 2>, Eigen::Matrix<
|
|
|
template void igl::polar_svd<Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 2, 0, 2, 2>, Eigen::Matrix<double, 2, 1, 0, 2, 1>, Eigen::Matrix<double, 2, 2, 0, 2, 2> >(Eigen::MatrixBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 1, 0, 2, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, 2, 2, 0, 2, 2> >&);
|
|
|
template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
|
|
template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
|
|
+template void igl::polar_svd<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 3, 0, 3, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 3, 0, 3, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
|
|
|
#endif
|