Skip to main content

read

Function read 

Source
pub fn read(bytes: &[u8], tol: Tolerances) -> OgeomResult<Triangulation>
Expand description

Read STL, in either encoding.

The encoding is detected rather than asked for: a file that starts with solid is usually ASCII, but binary files written by several well-known programs start with it too, because their 80-byte header happens to. The reliable test is whether the file’s length matches what its triangle count claims, so that is the test used.

§Errors

OgeomError::Construction if the bytes are not STL of either kind, or are truncated part-way through a triangle.