Skip to main content

write_stl_binary

Function write_stl_binary 

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

Writes a triangle mesh to a binary STL file.

Binary STL is a compact format used for 3D geometry exchange. Each triangle includes a normal and three vertices stored as 32-bit floats. An 80-byte header and a 4-byte triangle count are written before the triangle data.

§Arguments

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

§Returns

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