| 161 | } |
| 162 | |
| 163 | void PeriodicExploration::update_mesh() { |
| 164 | const size_t dim = m_vertices.cols(); |
| 165 | |
| 166 | const size_t num_vertices = m_vertices.rows(); |
| 167 | const size_t num_faces = m_faces.rows(); |
| 168 | const size_t vertex_per_face = m_faces.cols(); |
| 169 | const size_t num_voxels = m_voxels.rows(); |
| 170 | const size_t vertex_per_voxel = m_voxels.cols(); |
| 171 | |
| 172 | VectorF flattened_vertices = Eigen::Map<VectorF>(m_vertices.data(), |
| 173 | num_vertices * dim); |
| 174 | VectorI flattened_faces = Eigen::Map<VectorI>(m_faces.data(), num_faces * |
| 175 | vertex_per_face); |
| 176 | VectorI flattened_voxels = Eigen::Map<VectorI>(m_voxels.data(), num_voxels * |
| 177 | vertex_per_voxel); |
| 178 | VectorF face_sources = m_face_sources.cast<Float>(); |
| 179 | |
| 180 | MeshFactory factory; |
| 181 | factory.load_data( |
| 182 | flattened_vertices, flattened_faces, flattened_voxels, |
| 183 | dim, vertex_per_face, vertex_per_voxel); |
| 184 | m_mesh = factory.create(); |
| 185 | |
| 186 | m_mesh->add_attribute("face_source"); |
| 187 | m_mesh->set_attribute("face_source", face_sources); |
| 188 | } |
| 189 | |
| 190 | void PeriodicExploration::save_mesh(const std::string& filename) const { |
| 191 | auto flattened_vertices = MatrixUtils::flatten<VectorF>(m_vertices); |
nothing calls this directly
no test coverage detected