polar_dec.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_POLAR_DEC
  9. #define IGL_POLAR_DEC
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Computes the polar decomposition (R,T) of a matrix A
  15. // Inputs:
  16. // A 3 by 3 matrix to be decomposed
  17. // Outputs:
  18. // R 3 by 3 orthonormal matrix part of decomposition
  19. // T 3 by 3 stretch matrix part of decomposition
  20. // U 3 by 3 left-singular vectors
  21. // S 3 by 1 singular values
  22. // V 3 by 3 right-singular vectors
  23. //
  24. //
  25. template <
  26. typename DerivedA,
  27. typename DerivedR,
  28. typename DerivedT,
  29. typename DerivedU,
  30. typename DerivedS,
  31. typename DerivedV>
  32. IGL_INLINE void polar_dec(
  33. const Eigen::PlainObjectBase<DerivedA> & A,
  34. Eigen::PlainObjectBase<DerivedR> & R,
  35. Eigen::PlainObjectBase<DerivedT> & T,
  36. Eigen::PlainObjectBase<DerivedU> & U,
  37. Eigen::PlainObjectBase<DerivedS> & S,
  38. Eigen::PlainObjectBase<DerivedV> & V);
  39. template <
  40. typename DerivedA,
  41. typename DerivedR,
  42. typename DerivedT>
  43. IGL_INLINE void polar_dec(
  44. const Eigen::PlainObjectBase<DerivedA> & A,
  45. Eigen::PlainObjectBase<DerivedR> & R,
  46. Eigen::PlainObjectBase<DerivedT> & T);
  47. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. # include "polar_dec.cpp"
  50. #endif
  51. #endif