39 void triSurface::writeSTLASCII(Ostream& os)
const
49 const surfacePatch& patch = myPatches[patchI];
51 os <<
"solid " << patch.name() <<
endl;
56 patchFaceI < patch.size();
60 const label faceI = faceMap[faceIndex++];
64 os <<
" facet normal "
65 << n.x() <<
' ' << n.y() <<
' ' << n.z() <<
endl;
66 os <<
" outer loop" <<
endl;
68 const labelledTri&
f = (*this)[faceI];
74 << pa.x() <<
' ' << pa.y() <<
' ' << pa.z() <<
endl;
76 << pb.x() <<
' ' << pb.y() <<
' ' << pb.z() <<
endl;
78 << pc.x() <<
' ' << pc.y() <<
' ' << pc.z() <<
endl;
80 <<
" endloop" <<
endl;
82 <<
" endfacet" <<
endl;
85 os <<
"endsolid " << patch.
name() <<
endl;
90 void triSurface::writeSTLBINARY(std::ostream& os)
const
93 string header(
"Foam binary STL", STLheaderSize);
94 os.write(header.c_str(), STLheaderSize);
97 os.write(reinterpret_cast<char*>(&nTris),
sizeof(
unsigned int));
103 const labelledTri& f = (*this)[faceI];
106 STLpoint n(normals[faceI]);
107 STLpoint pa(
points()[f[0]]);
108 STLpoint pb(
points()[f[1]]);
111 STLtriangle stlTri(n, pa, pb, pc, f.region());