Created
December 14, 2015 09:32
-
-
Save hb3p8/11c7d511b20e21489660 to your computer and use it in GitHub Desktop.
WriteMesh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void BRepMesh_RestoreOrientationTool::WriteMesh (const std::string& theFileName) | |
{ | |
// write obj file | |
std::ofstream myfile; | |
myfile.open (theFileName); | |
const Handle(BRepMesh_TriangulatedPatch)& aPatch = myPatches.back(); | |
for (int i = 0; i < aPatch->Vertices.size(); ++i) { | |
BVH_Vec3d aVert = aPatch->Vertices[i]; | |
myfile << "v " << aVert.x() << " " << aVert.y() << " " << aVert.z() << "\n"; | |
} | |
for (int i = 0; i < aPatch->Elements.size(); ++i) { | |
BVH_Vec4i aTriangle = aPatch->Elements[i]; | |
if (aTriangle.w() >= 0) { | |
myfile << "f " << aTriangle.x() + 1 << " " << aTriangle.y() + 1 << " " << aTriangle.z() + 1 << "\n"; | |
} | |
else { | |
myfile << "f " << aTriangle.z() + 1 << " " << aTriangle.y() + 1 << " " << aTriangle.x() + 1 << "\n"; | |
} | |
} | |
myfile.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment