Skip to main content

write

Function write 

Source
pub fn write(mesh: &Triangulation, encoding: Encoding) -> OgeomResult<Vec<u8>>
Expand description

Write a triangulation as STL.

§Precision

STL stores coordinates as f32 in binary and as printed decimals in ASCII. The kernel works in f64. A round trip therefore loses precision (about seven significant digits in binary), and a model far from the origin loses it where it matters most: a part at 1e6 units has a binary STL resolution of about 0.06 units. This writes what the format can hold; it does not pretend the result round-trips exactly, and read will not return what was written.

§Errors

OgeomError::Construction if the mesh has no triangles, or holds a triangle index that is not a vertex.