Ejemplo n.º 1
0
void PeriodicExploration::save_mesh(const std::string& filename) const {
    auto flattened_vertices = MatrixUtils::flatten<VectorF>(m_vertices);
    auto flattened_faces = MatrixUtils::flatten<VectorI>(m_faces);
    auto flattened_voxels = MatrixUtils::flatten<VectorI>(m_voxels);

    MeshWriter::Ptr writer = MeshWriter::create(filename);
    writer->write(flattened_vertices, flattened_faces, flattened_voxels,
            m_vertices.cols(), m_faces.cols(), m_voxels.cols());
}
Ejemplo n.º 2
0
    void save_mesh(const std::string& filename,
            const MatrixFr& vertices, const MatrixIr& faces) {
        auto flattened_vertices = MatrixUtils::flatten<VectorF>(vertices);
        auto flattened_faces = MatrixUtils::flatten<VectorI>(faces);
        VectorI voxels = VectorI::Zero(0);

        MeshWriter::Ptr writer = MeshWriter::create(filename);
        writer->write(flattened_vertices, flattened_faces, voxels,
                vertices.cols(), faces.cols(), 0);
    }
Ejemplo n.º 3
0
void InflatorEngine::save_mesh(const std::string& filename,
        const MatrixFr& vertices, const MatrixIr& faces, VectorF debug) {
    VectorF flattened_vertices(vertices.rows() * vertices.cols());
    std::copy(vertices.data(), vertices.data() + vertices.rows() *
            vertices.cols(), flattened_vertices.data());
    VectorI flattened_faces(faces.rows() * faces.cols());
    std::copy(faces.data(), faces.data() + faces.rows() * faces.cols(),
            flattened_faces.data());
    VectorI voxels = VectorI::Zero(0);

    Mesh::Ptr mesh = MeshFactory().load_data(
            flattened_vertices, flattened_faces, voxels,
            vertices.cols(), faces.cols(), 0).create_shared();
    mesh->add_attribute("debug");
    mesh->set_attribute("debug", debug);

    MeshWriter::Ptr writer = MeshWriter::create(filename);
    writer->with_attribute("debug");
    writer->write_mesh(*mesh);
}