47 norm /=
mag(norm) + VSMALL;
51 const point& p0 = pointLst[f[0]];
52 for (label fp1 = 1; fp1 < f.size() - 1; ++fp1)
54 label fp2 = f.fcIndex(fp1);
56 const point& p1 = pointLst[f[fp1]];
57 const point& p2 = pointLst[f[fp2]];
60 os <<
" facet normal "
61 << norm.
x() <<
' ' << norm.y() <<
' ' << norm.z() <<
nl
63 <<
" vertex " << p0.x() <<
' ' << p0.y() <<
' ' << p0.z() <<
nl
64 <<
" vertex " << p1.x() <<
' ' << p1.y() <<
' ' << p1.z() <<
nl
65 <<
" vertex " << p2.x() <<
' ' << p2.y() <<
' ' << p2.z() <<
nl
67 <<
" endfacet" <<
endl;
88 norm /=
mag(norm) + VSMALL;
92 const point& p0 = pointLst[f[0]];
93 for (label fp1 = 1; fp1 < f.size() - 1; ++fp1)
95 label fp2 = f.fcIndex(fp1);
137 this->storedPoints().transfer(reader.
points());
152 const label startPt = 3*faceI;
153 faceLst[faceI] =
triFace(startPt, startPt+1, startPt+2);
166 const label startPt = 3*faceMap[faceI];
167 faceLst[faceI] =
triFace(startPt, startPt+1, startPt+2);
173 this->storedFaces().transfer(faceLst);
177 this->addZones(sizes, names);
181 this->addZones(sizes);
184 this->stitchFaces(SMALL);
202 "fileFormats::STLsurfaceFormat::writeAscii"
203 "(const fileName&, const MeshedSurfaceProxy<Face>&)"
205 <<
"Cannot open file for writing " << filename
226 const surfZone& zone = zones[zoneI];
228 os <<
"solid " << zone.
name() <<
nl;
234 const label faceI = faceMap[faceIndex++];
235 writeShell(os, pointLst, faceLst[faceI]);
242 writeShell(os, pointLst, faceLst[faceIndex++]);
245 os <<
"endsolid " << zone.
name() <<
endl;
257 std::ofstream os(filename.c_str(), std::ios::binary);
262 "fileFormats::STLsurfaceFormat::writeBinary"
263 "(const fileName&, const MeshedSurfaceProxy<Face>&)"
265 <<
"Cannot open file for writing " << filename
284 unsigned int nTris = 0;
287 nTris = faceLst.
size();
294 nTris += faceLst[faceI].
size() - 2;
299 STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
304 const surfZone& zone = zones[zoneI];
314 faceLst[faceMap[faceIndex++]],
327 faceLst[faceIndex++],
348 "fileFormats::STLsurfaceFormat::writeAscii"
349 "(const fileName&, const UnsortedMeshedSurface<Face>&)"
351 <<
"Cannot open file for writing " << filename
356 if (surf.
zoneToc().size() == 1)
361 os <<
"solid " << surf.
zoneToc()[0].name() <<
endl;
364 writeShell(os, pointLst, faceLst[faceI]);
366 os <<
"endsolid " << surf.
zoneToc()[0].name() <<
endl;
395 std::ofstream os(filename.c_str(), std::ios::binary);
400 "fileFormats::STLsurfaceFormat::writeBinary"
401 "(const fileName&, const UnsortedMeshedSurface<Face>&)"
403 <<
"Cannot open file for writing " << filename
411 unsigned int nTris = 0;
414 nTris = faceLst.
size();
421 nTris += faceLst[faceI].
size() - 2;
426 STLsurfaceFormatCore::writeHeaderBINARY(os, nTris);
449 const word ext = filename.
ext();
454 writeBinary(filename, surf);
458 writeAscii(filename, surf);
475 writeBinary(filename, surf);
479 writeAscii(filename, surf);