#include #include #include #include #include #include #include TEST_CASE("writePLY: bunny.ply", "[igl]") { std::ifstream f(test_common::data_path("bunny.ply")); REQUIRE (f.good()); f.close(); Eigen::MatrixXd V1,N1,UV1,VD1,FD1,ED1; std::vector Vheader1,Fheader1,Eheader1,comments1; Eigen::MatrixXi F1,E1; // load test data first REQUIRE (igl::readPLY(test_common::data_path("bunny.ply"), V1, F1, E1, N1, UV1, VD1,Vheader1, FD1,Fheader1, ED1,Eheader1,comments1)); // add more data Vheader1.push_back("dummy_data"); Eigen::VectorXd dummy_data(V1.rows()); for(size_t i=0;i Eheader2; //generate edges igl::edges(F1,E2); //generate edge data Eheader2.push_back("edge_data"); Eigen::VectorXd edge_data(E2.rows()); for(size_t i=0;i Vheader,Fheader,Eheader,comments; // test that saving preserves all the data REQUIRE (igl::readPLY("writePLY_test_bunny.ply", V, F, E, N, UV, VD,Vheader, FD,Fheader, ED,Eheader, comments)); REQUIRE (V.rows() == 35947); REQUIRE (V.cols() == 3); REQUIRE (F.rows() == 69451); REQUIRE (F.cols() == 3); // generated edges REQUIRE (E.rows() == E2.rows()); REQUIRE (E.cols() == E2.cols()); // no normals or texture coordinates REQUIRE (N.rows() == 0); REQUIRE (N.cols() == 0); REQUIRE (UV.rows() == 0); REQUIRE (UV.cols() == 0); // this bunny have additional data REQUIRE (VD.rows() == 35947); REQUIRE (VD.cols() == 3); // the dummy column contents check for(size_t i=0;i Vheader1,Fheader1,Eheader1,comments1; Eigen::MatrixXi F1,E1; // load test data first REQUIRE (igl::readPLY(test_common::data_path("bunny.ply"), V1, F1, E1, N1, UV1, VD1,Vheader1, FD1,Fheader1, ED1,Eheader1,comments1)); // add more data Vheader1.push_back("dummy_data"); Eigen::VectorXf dummy_data(V1.rows()); for(size_t i=0;i Vheader,Fheader,Eheader,comments; // test that saving preserves all the data REQUIRE (igl::readPLY("writePLY_test_bunny_float.ply", V, F, E, N, UV, VD,Vheader, FD,Fheader, ED,Eheader, comments)); REQUIRE (V.rows() == 35947); REQUIRE (V.cols() == 3); REQUIRE (F.rows() == 69451); REQUIRE (F.cols() == 3); // no edge data REQUIRE (E.rows() == 0); REQUIRE (E.cols() == 0); // no normals or texture coordinates REQUIRE (N.rows() == 0); REQUIRE (N.cols() == 0); REQUIRE (UV.rows() == 0); REQUIRE (UV.cols() == 0); // this bunny have additonal data REQUIRE (VD.rows() == 35947); REQUIRE (VD.cols() == 3); // the dummy column contents check for(size_t i=0;i