Skip to main content

write_obj

Function write_obj 

Source
pub fn write_obj(
    nodes: &[[f64; 3]],
    cells: &[[usize; 3]],
    filename: Option<&str>,
) -> Result<()>
Expand description

Writes a triangle mesh to a Wavefront OBJ file.

The function first writes all vertex positions, then defines each triangle face by referencing the 1-based indices of its vertices. If the rayon feature is enabled, the face data will be formatted in parallel.

§Arguments

  • nodes - A slice of 3D vertex positions.
  • cells - A slice of triangles, each defined by 0-based indices into the nodes array.
  • filename - Optional file path. Defaults to "mesh.obj" if None.

§Returns

Returns Ok(()) on success, or an std::io::Error on failure.