Function stl_io::write_stl

source ·
pub fn write_stl<T, W, I>(writer: &mut W, mesh: I) -> Result<()>where
    W: Write,
    I: ExactSizeIterator<Item = T>,
    T: Borrow<Triangle>,
Expand description

Write to std::io::Write as documented in Wikipedia.

use stl_io::{Vertex, Normal};
let mesh = [stl_io::Triangle { normal: Normal::new([1.0, 0.0, 0.0]),
                               vertices: [Vertex::new([0.0, -1.0, 0.0]),
                                          Vertex::new([0.0, 1.0, 0.0]),
                                          Vertex::new([0.0, 0.0, 0.5])]}];
let mut binary_stl = Vec::<u8>::new();
stl_io::write_stl(&mut binary_stl, mesh.iter()).unwrap();