Expand description
STL: a triangle soup, in ASCII or binary.
The format has no notion of a shared vertex (every triangle names its three corners in full) and no notion of topology at all. Writing to it therefore loses everything the kernel knows: which triangles belong to which face, which edges were exact, what the surfaces actually were. That is the format’s nature and not a shortcoming of this writer.
§Reading gives a mesh, not a shape
read returns a Triangulation, not a Shape, and that is deliberate.
Recovering a B-rep from a triangle soup means deciding which triangles are
coplanar enough to be one face, which chains of edges are one curve, and
what surface each face was cut from: that is surface reconstruction, a
research problem, not a file format concern. A function returning a Shape
here would have to guess, and the guess would be wrong in ways nothing
downstream could detect.
§The normals are written and ignored
Every STL triangle carries a facet normal. Most writers get it right, some
write zeros, and some write it inconsistent with the winding. read
therefore recomputes normals from the winding and discards what the file
said, which is what every robust reader does. write() emits the true
normal, because a reader that trusts it should not be punished for it.
Enums§
- Encoding
- Which encoding to write.