iterative_closest_point.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #include <test_common.h>
  9. #include <igl/iterative_closest_point.h>
  10. TEST_CASE("iterative_closest_point: identity","[igl]" "[slow]")
  11. {
  12. const auto test_case = [](const std::string &param)
  13. {
  14. Eigen::MatrixXd VX,VY;
  15. Eigen::MatrixXi FX,FY;
  16. // Load example mesh: GetParam() will be name of mesh file
  17. igl::read_triangle_mesh(test_common::data_path(param), VY, FY);
  18. VX = VY;
  19. FX = FY;
  20. // Single iteration should find a identity
  21. srand(0);
  22. Eigen::Matrix3d R;
  23. Eigen::RowVector3d t;
  24. igl::iterative_closest_point(VX,FX,VY,FY,1000,1,R,t);
  25. test_common::assert_near(R,Eigen::Matrix3d::Identity(),1e-12);
  26. test_common::assert_near(t,Eigen::RowVector3d::Zero(),1e-12);
  27. };
  28. test_common::run_test_cases(test_common::all_meshes(), test_case);
  29. }