is_delaunay.cpp 678 B

1234567891011121314151617181920212223242526272829303132
  1. #include <test_common.h>
  2. #include <igl/is_delaunay.h>
  3. TEST_CASE("is_delaunay: two_triangles", "[igl]")
  4. {
  5. const Eigen::MatrixXd V =
  6. (Eigen::MatrixXd(4,2)<<
  7. 0,10,
  8. 1,0,
  9. 1,20,
  10. 2,10).finished();
  11. const Eigen::MatrixXi FD =
  12. (Eigen::MatrixXi(2,3)<<
  13. 0,1,3,
  14. 0,3,2).finished();
  15. Eigen::Matrix<bool,Eigen::Dynamic,Eigen::Dynamic> DD,DN;
  16. igl::is_delaunay(V,FD,DD);
  17. for(int f=0;f<DD.rows();f++)
  18. {
  19. for(int c=0;c<DD.cols();c++)
  20. {
  21. REQUIRE (DD(f,c));
  22. }
  23. }
  24. const Eigen::MatrixXi FN =
  25. (Eigen::MatrixXi(2,3)<<
  26. 0,1,2,
  27. 2,1,3).finished();
  28. igl::is_delaunay(V,FN,DN);
  29. REQUIRE (!DN(0,0));
  30. REQUIRE (!DN(1,2));
  31. }