| 64 | } |
| 65 | |
| 66 | void save_mesh(const std::string& filename, |
| 67 | const MatrixFr& vertices, const MatrixIr& faces, VectorF debug) { |
| 68 | VectorF flattened_vertices(vertices.rows() * vertices.cols()); |
| 69 | std::copy(vertices.data(), vertices.data() + vertices.rows() * |
| 70 | vertices.cols(), flattened_vertices.data()); |
| 71 | VectorI flattened_faces(faces.rows() * faces.cols()); |
| 72 | std::copy(faces.data(), faces.data() + faces.rows() * faces.cols(), |
| 73 | flattened_faces.data()); |
| 74 | VectorI voxels = VectorI::Zero(0); |
| 75 | |
| 76 | Mesh::Ptr mesh = MeshFactory().load_data( |
| 77 | flattened_vertices, flattened_faces, voxels, |
| 78 | vertices.cols(), faces.cols(), 0).create(); |
| 79 | mesh->add_attribute("debug"); |
| 80 | mesh->set_attribute("debug", debug); |
| 81 | |
| 82 | MeshWriter::Ptr writer = MeshWriter::create(filename); |
| 83 | writer->with_attribute("debug"); |
| 84 | writer->write_mesh(*mesh); |
| 85 | } |
| 86 | |
| 87 | void update_indices(MatrixIr& indices, const VectorI& vertex_map) { |
| 88 | const size_t num_rows = indices.rows(); |
no test coverage detected