fit_rotations.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_FIT_ROTATIONS_H
  9. #define IGL_FIT_ROTATIONS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Known issues: This seems to be implemented in Eigen/Geometry:
  15. // Eigen::umeyama
  16. //
  17. // FIT_ROTATIONS Given an input mesh and new positions find rotations for
  18. // every covariance matrix in a stack of covariance matrices
  19. //
  20. // Inputs:
  21. // S nr*dim by dim stack of covariance matrices
  22. // single_precision whether to use single precision (faster)
  23. // Outputs:
  24. // R dim by dim * nr list of rotations
  25. //
  26. template <typename DerivedS, typename DerivedD>
  27. IGL_INLINE void fit_rotations(
  28. const Eigen::PlainObjectBase<DerivedS> & S,
  29. const bool single_precision,
  30. Eigen::PlainObjectBase<DerivedD> & R);
  31. // FIT_ROTATIONS Given an input mesh and new positions find 2D rotations for
  32. // every vertex that best maps its one ring to the new one ring
  33. //
  34. // Inputs:
  35. // S nr*dim by dim stack of covariance matrices, third column and every
  36. // third row will be ignored
  37. // Outputs:
  38. // R dim by dim * nr list of rotations, third row and third column of each
  39. // rotation will just be identity
  40. //
  41. template <typename DerivedS, typename DerivedD>
  42. IGL_INLINE void fit_rotations_planar(
  43. const Eigen::PlainObjectBase<DerivedS> & S,
  44. Eigen::PlainObjectBase<DerivedD> & R);
  45. #ifdef __SSE__
  46. IGL_INLINE void fit_rotations_SSE( const Eigen::MatrixXf & S, Eigen::MatrixXf & R);
  47. IGL_INLINE void fit_rotations_SSE( const Eigen::MatrixXd & S, Eigen::MatrixXd & R);
  48. #endif
  49. #ifdef __AVX__
  50. IGL_INLINE void fit_rotations_AVX( const Eigen::MatrixXf & S, Eigen::MatrixXf & R);
  51. #endif
  52. }
  53. #ifndef IGL_STATIC_LIBRARY
  54. # include "fit_rotations.cpp"
  55. #endif
  56. #endif