MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / writeSTLBINARY

Function writeSTLBINARY

src/triSurface/triSurface/interfaces/STL/writeSTL.C:143–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143void Foam::triSurface::writeSTLBINARY(std::ostream& os) const
144{
145 // Write the STL header
146 string header("Foam binary STL", STLheaderSize);
147 os.write(header.c_str(), STLheaderSize);
148
149 label nTris = size();
150 os.write(reinterpret_cast<char*>(&nTris), sizeof(unsigned int));
151
152 const vectorField& normals = faceNormals();
153
154 forAll(*this, facei)
155 {
156 const labelledTri& f = (*this)[facei];
157
158 // Convert vector into STL single precision
159 STLpoint n(normals[facei]);
160 STLpoint pa(points()[f[0]]);
161 STLpoint pb(points()[f[1]]);
162 STLpoint pc(points()[f[2]]);
163
164 STLtriangle stlTri(n, pa, pb, pc, f.region());
165
166 stlTri.write(os);
167 }
168}
169
170
171// ************************************************************************* //

Callers 1

writeFunction · 0.85

Calls 3

sizeFunction · 0.85
forAllFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected