40 bool triSurface::readOFF(
const fileName& OFFfileName)
42 IFstream OFFfile(OFFfileName);
47 <<
"Cannot read file " << OFFfileName
52 string hdr = getLineNoComment(OFFfile);
56 <<
"OFF file " << OFFfileName
57 <<
" does not start with 'OFF'"
64 string line = getLineNoComment(OFFfile);
66 IStringStream lineStream(line);
67 lineStream >> nPoints >> nElems >>
nEdges;
76 line = getLineNoComment(OFFfile);
78 IStringStream lineStream(line);
79 lineStream >> x >> y >> z;
85 DynamicList<labelledTri> tris(nElems);
87 for (label faceI = 0; faceI < nElems; faceI++)
89 line = getLineNoComment(OFFfile);
91 IStringStream lineStream(line);
106 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
108 else if (nVerts == 4)
110 tris.append(labelledTri(
f[0],
f[1],
f[2], 0));
111 tris.append(labelledTri(
f[2],
f[3],
f[0], 0));
119 f.triangles(
points, nTri, triFaces);
121 forAll(triFaces, triFaceI)
123 const face&
f = triFaces[triFaceI];
125 tris.append(labelledTri(f[0], f[1], f[2], 0));