pub struct StlData {
pub triangles: Vec<Triangle>,
pub normals: Vec<[f32; 3]>,
pub name: String,
pub header: Option<[u8; 80]>,
pub encoding: Option<Encoding>,
pub force_normals: bool,
pub disable_normals: bool,
pub nullify_normals: bool,
}Expand description
The container for all STL data.
Fields§
§triangles: Vec<Triangle>§normals: Vec<[f32; 3]>§name: String§header: Option<[u8; 80]>§encoding: Option<Encoding>§force_normals: boolSet to true to force recalculatian normals using vertex data. By default, recalculation is only done for zero normal vectors or normal vectors with invalid length.
disable_normals: boolSet to true to disable all reculation of normal vectors. By default, recalculation is only done for zero normal vectors or normal vectors with invalid length.
nullify_normals: boolSet to true to write zero normals in the output.
Implementations§
Source§impl StlData
impl StlData
Sourcepub fn read_from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn read_from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Creates and populates a StlData from a file path.
Sourcepub fn read_buffer(reader: impl BufRead) -> Result<Self>
pub fn read_buffer(reader: impl BufRead) -> Result<Self>
Creates and populates a StlData from a buffer.
Sourcepub fn set_from_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn set_from_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Sets contents of a StlData from a file path.
If the method returns an Err then the state of the reader
will be empty.
Sourcepub fn set_from_buffer(&mut self, reader: impl BufRead) -> Result<()>
pub fn set_from_buffer(&mut self, reader: impl BufRead) -> Result<()>
Sets the contents of a StlData from a buffer.
If the method returns an Err then the state of the reader
will be empty.
Sourcepub fn write_binary_buffer(&self, writer: impl Write) -> Result<()>
pub fn write_binary_buffer(&self, writer: impl Write) -> Result<()>
Write the contents of a StlData to a buffer using the binary specification.
Sourcepub fn write_ascii_buffer(&self, writer: impl Write) -> Result<()>
pub fn write_ascii_buffer(&self, writer: impl Write) -> Result<()>
Write the contents of a StlData to a buffer using the ASCII specification.