| 120 | } |
| 121 | |
| 122 | int main(int argc, char *argv[]) |
| 123 | { |
| 124 | if (argc < 4) |
| 125 | { |
| 126 | std::cerr << "Usage: " << argv[0] << " <mesh_file_partA.obj> <mesh_file_partB.obj> <save_root_directory>\n"; |
| 127 | return 1; |
| 128 | } |
| 129 | |
| 130 | std::string mesh_file_left = argv[1]; |
| 131 | std::string mesh_file_right = argv[2]; |
| 132 | std::string save_root_directory = argv[3]; |
| 133 | Eigen::MatrixXd L_mesh_v, R_mesh_v; |
| 134 | Eigen::MatrixXi L_mesh_f, R_mesh_f; |
| 135 | |
| 136 | if (!igl::read_triangle_mesh(mesh_file_left, L_mesh_v, L_mesh_f)) |
| 137 | { |
| 138 | std::cerr << "Failed to load mesh from " << mesh_file_left << std::endl; |
| 139 | return 1; |
| 140 | } |
| 141 | |
| 142 | if (!igl::read_triangle_mesh(mesh_file_right, R_mesh_v, R_mesh_f)) |
| 143 | { |
| 144 | std::cerr << "Failed to load mesh from " << mesh_file_right << std::endl; |
| 145 | return 1; |
| 146 | } |
| 147 | |
| 148 | std::cout << "Sampling point clouds...\n"; |
| 149 | int num_points = 1024; |
| 150 | Eigen::MatrixXd L_pc, R_pc; |
| 151 | Eigen::MatrixXd L_normal, R_normal; |
| 152 | sample_pc_with_blue_noise(num_points, L_mesh_v, L_mesh_f, L_pc, L_normal); |
| 153 | sample_pc_with_blue_noise(num_points, R_mesh_v, R_mesh_f, R_pc, R_normal); |
| 154 | |
| 155 | std::cout << "The target root file is " << save_root_directory << std::endl; |
| 156 | |
| 157 | std::cout << "Saving point clouds...\n"; |
| 158 | std::string L_pc_file = save_root_directory + '/' + "partA-pc.csv"; |
| 159 | std::string R_pc_file = save_root_directory + '/' + "partB-pc.csv"; |
| 160 | write_matrix_to_csv(L_pc_file, L_pc); |
| 161 | write_matrix_to_csv(R_pc_file, R_pc); |
| 162 | |
| 163 | std::cout << "Saving normals...\n"; |
| 164 | std::string L_normal_file = save_root_directory + '/' + "partA-normal.csv"; |
| 165 | std::string R_normal_file = save_root_directory + '/' + "partB-normal.csv"; |
| 166 | write_matrix_to_csv(L_normal_file, L_normal); |
| 167 | write_matrix_to_csv(R_normal_file, R_normal); |
| 168 | |
| 169 | std::cout << "Saved point clouds and normals to " << save_root_directory << std::endl; |
| 170 | |
| 171 | return 0; |
| 172 | } |
nothing calls this directly
no test coverage detected