box_cubic.cpp 527 B

1234567891011121314151617181920
  1. #include <test_common.h>
  2. #include <igl/cycodebase/box_cubic.h>
  3. TEST_CASE("box_cubic: simple", "[igl/cycodebase]" )
  4. {
  5. Eigen::MatrixXd C(4,2);
  6. C<<0,0,
  7. 1,2,
  8. 2,-2,
  9. 3,0;
  10. Eigen::RowVectorXd B1,B2;
  11. igl::cycodebase::box_cubic(C,B1,B2);
  12. REQUIRE(B1.size() == 2);
  13. REQUIRE(B2.size() == 2);
  14. REQUIRE(B1[0] == Approx(0.0).margin(1e-12));
  15. REQUIRE(B1[1] == Approx(-0.57735026918962584).margin(1e-12));
  16. REQUIRE(B2[0] == Approx(3.0).margin(1e-12));
  17. REQUIRE(B2[1] == Approx(0.57735026918962584).margin(1e-12));
  18. }