1 #include <test_common.h>
2 #include <igl/grid.h>
3 #include <igl/matlab_format.h>
4 
5 TEST_CASE("grid: 3d", "[igl]")
6 {
7   Eigen::Vector3i res(3,3,3);
8   Eigen::MatrixXd GV;
9   igl::grid(res,GV);
10   const Eigen::MatrixXd GVgt =
11     (Eigen::MatrixXd(27,3)<<
12       0,  0,  0,
13     0.5,  0,  0,
14       1,  0,  0,
15       0,0.5,  0,
16     0.5,0.5,  0,
17       1,0.5,  0,
18       0,  1,  0,
19     0.5,  1,  0,
20       1,  1,  0,
21       0,  0,0.5,
22     0.5,  0,0.5,
23       1,  0,0.5,
24       0,0.5,0.5,
25     0.5,0.5,0.5,
26       1,0.5,0.5,
27       0,  1,0.5,
28     0.5,  1,0.5,
29       1,  1,0.5,
30       0,  0,  1,
31     0.5,  0,  1,
32       1,  0,  1,
33       0,0.5,  1,
34     0.5,0.5,  1,
35       1,0.5,  1,
36       0,  1,  1,
37     0.5,  1,  1,
38       1,  1,  1).finished();
39   test_common::assert_eq(GV,GVgt);
40 }
41 
42 TEST_CASE("grid: 2d", "[igl]")
43 {
44   Eigen::Vector2i res(3,3);
45   Eigen::MatrixXd GV;
46   igl::grid(res,GV);
47   const Eigen::MatrixXd GVgt =
48     (Eigen::MatrixXd(9,2)<<
49       0,  0,
50     0.5,  0,
51       1,  0,
52       0,0.5,
53     0.5,0.5,
54       1,0.5,
55       0,  1,
56     0.5,  1,
57       1,  1).finished();
58   test_common::assert_eq(GV,GVgt);
59 }
60