This commit is contained in:
Hanno Braun 2024-10-30 01:30:36 +01:00
parent c2eb84c84b
commit 0c46ec8d3b
2 changed files with 8 additions and 7 deletions

View File

@ -1,15 +1,16 @@
use std::fs::File;
pub fn export(
vertices: impl IntoIterator<Item = [f64; 3]>,
triangles: impl IntoIterator<Item = [usize; 3]>,
) -> anyhow::Result<()> {
let vertices = vertices
use crate::mesh::Mesh;
pub fn export(mesh: Mesh) -> anyhow::Result<()> {
let vertices = mesh
.vertices
.into_iter()
.map(|[x, y, z]| threemf::model::Vertex { x, y, z })
.collect();
let triangles = triangles
let triangles = mesh
.triangles
.into_iter()
.map(|[v1, v2, v3]| threemf::model::Triangle { v1, v2, v3 })
.collect();

View File

@ -4,6 +4,6 @@ mod model;
fn main() -> anyhow::Result<()> {
let mesh = model::model()?;
export::export(mesh.vertices, mesh.triangles)?;
export::export(mesh)?;
Ok(())
}