Skip to main content

Module stl

Module stl 

Source
Expand description

STL export: a RasterizedModel’s faces as a triangle mesh file.

STL is a bag of triangles, each with a normal and its three corners listed counter-clockwise seen from outside. The triangles here are the ones the viewer draws (see crate::rasterize), so an exported mesh is exactly what is on screen. Their winding comes from the (u, v) triangulation, which says nothing about outside; the surface normals do — every face’s surface normal points out of its solid (see geop_core_topology::validation::face_orientation) — so each triangle is wound to agree with them.

Faces meet along their edges’ shared samples, and at each other’s points along them (see crate::rasterize): a solid’s mesh is closed, every side of a triangle the side of one other, the other way round.

Structs§

StlTriangle
One STL facet: its outward normal, and its corners counter-clockwise seen from outside.

Enums§

StlFormat
Which of STL’s two encodings to write.

Functions§

enclosed_volume
The volume triangles, wound outward, enclose: the sum of the signed tetrahedra they span with a corner of the mesh, negative if they are wound in. Exact for a closed mesh, up to its f32 corners.
outward
t as an STL facet, wound to face the way its surface does: outward. A triangle without surface normals (at a pole) keeps its winding.
stl_triangles
The triangles of faces of raster, in the order given, wound outward.
write_stl
Write triangles as an STL file named name (the solid name an ASCII file carries, and the header of a binary one).