rigid_alignment.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2019 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 RIGID_ALIGNMENT_H
  9. #define RIGID_ALIGNMENT_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Find the rigid transformation that best aligns the 3D points X to their
  15. /// corresponding points P with associated normals N.
  16. ///
  17. /// min ‖(X*R+t-P)'N‖²
  18. /// R∈SO(3)
  19. /// t∈R³
  20. ///
  21. /// @param[in] X #X by 3 list of query points
  22. /// @param[in] P #X by 3 list of corresponding (e.g., closest) points
  23. /// @param[in] N #X by 3 list of unit normals for each row in P
  24. /// @param[out] R 3 by 3 rotation matrix
  25. /// @param[out] t 1 by 3 translation vector
  26. ///
  27. /// \see icp
  28. template <
  29. typename DerivedX,
  30. typename DerivedP,
  31. typename DerivedN,
  32. typename DerivedR,
  33. typename Derivedt
  34. >
  35. IGL_INLINE void rigid_alignment(
  36. const Eigen::MatrixBase<DerivedX> & X,
  37. const Eigen::MatrixBase<DerivedP> & P,
  38. const Eigen::MatrixBase<DerivedN> & N,
  39. Eigen::PlainObjectBase<DerivedR> & R,
  40. Eigen::PlainObjectBase<Derivedt> & t);
  41. }
  42. #ifndef IGL_STATIC_LIBRARY
  43. # include "rigid_alignment.cpp"
  44. #endif
  45. #endif