triangle_triangle_adjacency.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <test_common.h>
  2. #include <igl/triangle_triangle_adjacency.h>
  3. #include <Eigen/Geometry>
  4. TEST_CASE("triangle_triangle_adjacency: dot", "[igl]")
  5. {
  6. const auto test_case = [](const std::string &param)
  7. {
  8. Eigen::MatrixXd V;
  9. Eigen::MatrixXi F,TT,TTi;
  10. // Load example mesh: GetParam() will be name of mesh file
  11. test_common::load_mesh(param, V, F);
  12. igl::triangle_triangle_adjacency(F,TT,TTi);
  13. REQUIRE (TT.rows() == F.rows());
  14. REQUIRE (TTi.rows() == F.rows());
  15. REQUIRE (TT.cols() == F.cols());
  16. REQUIRE (TTi.cols() == F.cols());
  17. for(int f = 0;f<F.rows();f++)
  18. {
  19. for(int c = 0;c<3;c++)
  20. {
  21. if(TT(f,c) >= 0)
  22. {
  23. REQUIRE (F.rows() > TT(f,c));
  24. REQUIRE (0 <= TTi(f,c));
  25. REQUIRE (3 > TTi(f,c));
  26. REQUIRE (f == TT(TT(f,c),TTi(f,c)));
  27. }
  28. }
  29. }
  30. // REQUIRE (b == a);
  31. // REQUIRE (a==b);
  32. // REQUIRE(a == Approx(b).margin(1e-15))
  33. // REQUIRE (1e-12 > a);
  34. };
  35. test_common::run_test_cases(test_common::manifold_meshes(), test_case);
  36. }