fit_rotations.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[email protected]>
  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_FIT_ROTATIONS_H
  9. #define IGL_FIT_ROTATIONS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Given an input mesh and new positions find rotations for every covariance
  15. /// matrix in a stack of covariance matrices
  16. ///
  17. /// @param[in] S nr*dim by dim stack of covariance matrices
  18. /// @param[in] single_precision whether to use single precision (faster)
  19. /// @param[out] R dim by dim * nr list of rotations
  20. ///
  21. /// \note This seems to be implemented in Eigen/Geometry: Eigen::umeyama
  22. template <typename DerivedS, typename DerivedD>
  23. IGL_INLINE void fit_rotations(
  24. const Eigen::MatrixBase<DerivedS> & S,
  25. const bool single_precision,
  26. Eigen::PlainObjectBase<DerivedD> & R);
  27. #ifdef __SSE__
  28. /// \overload
  29. /// \brief SSE single float version of fit_rotations
  30. /// \fileinfo
  31. IGL_INLINE void fit_rotations_SSE( const Eigen::MatrixXf & S, Eigen::MatrixXf & R);
  32. /// \overload
  33. /// \brief SSE double float version of fit_rotations
  34. /// \fileinfo
  35. IGL_INLINE void fit_rotations_SSE( const Eigen::MatrixXd & S, Eigen::MatrixXd & R);
  36. #endif
  37. #ifdef __AVX__
  38. /// \overload
  39. /// \brief AVX single float version of fit_rotations
  40. /// \fileinfo
  41. IGL_INLINE void fit_rotations_AVX( const Eigen::MatrixXf & S, Eigen::MatrixXf & R);
  42. #endif
  43. /// Given an input mesh and new positions find 2D rotations for every vertex
  44. /// that best maps its one ring to the new one ring
  45. ///
  46. /// \fileinfo
  47. ///
  48. /// @param[in] S nr*dim by dim stack of covariance matrices, third column and every
  49. /// third row will be ignored
  50. /// @param[out] R dim by dim * nr list of rotations, third row and third column of each
  51. /// rotation will just be identity
  52. ///
  53. template <typename DerivedS, typename DerivedD>
  54. IGL_INLINE void fit_rotations_planar(
  55. const Eigen::MatrixBase<DerivedS> & S,
  56. Eigen::PlainObjectBase<DerivedD> & R);
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. # include "fit_rotations.cpp"
  60. #endif
  61. #endif