So I have my STL code and I have been putting the normal as 0 0 0 for each triangle, as you can imagine this means that only certain software can utilise the code.
What is the method for working out the normal
i.e. the vector maths
To compute the face normal of a face in a mesh you simply take the cross product of two edge vectors of the face.
An STL file represents a surface geometry using facets. The facets define the surface of a 3D object and is uniquely identified by a unit normal, which is a line perpendicular to the triangle with length of 1.0, and by three vertices.
STL is a file format commonly used for 3D printing and computer-aided design (CAD). The name STL is an acronym that stands for stereolithography — a popular 3D printing technology. You might also hear it referred to as Standard Triangle Language or Standard Tessellation Language.
The normal to the plane is given by the cross product n=(r−b)×(s−b).
You should take vertices of the outer loop and calculate surface normal as described here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With