Commit 828aefe1 authored by Mike Kremer's avatar Mike Kremer
Browse files

Now the code in the first tutorial perfectly works

git-svn-id: http://www.openvolumemesh.org/svnrepo/OpenVolumeMesh/trunk@83 66977474-1d4b-4f09-8fe9-267525286df2
parent e48ba8b9
...@@ -39,63 +39,63 @@ by passing false as second parameter to OpenVolumeMesh::PolyhedralMesh<VecT>::ad ...@@ -39,63 +39,63 @@ by passing false as second parameter to OpenVolumeMesh::PolyhedralMesh<VecT>::ad
Note that in these cases, it is not guaranteed that a given mesh is three-manifold. Note that in these cases, it is not guaranteed that a given mesh is three-manifold.
\code \code
typedef OpenVolumeMesh::Geometry::Vec3d Vec3d typedef OpenVolumeMesh::Geometry::Vec3f Vec3f
typedef OpenVolumeMesh::PolyhedralMesh<Vec3d> PolyhedralMeshV3d; typedef OpenVolumeMesh::PolyhedralMesh<Vec3f> PolyhedralMeshV3f;
// Create mesh object // Create mesh object
PolyhedralMeshV3d myMesh; PolyhedralMeshV3f myMesh;
// Add eight vertices // Add eight vertices
PolyhedralMeshV3d::VertexHandle v0 = myMesh.add_vertex(Vec3d(-1.0, 0.0, 0.0)); PolyhedralMeshV3f::VertexHandle v0 = myMesh.add_vertex(Vec3f(-1.0, 0.0, 0.0));
PolyhedralMeshV3d::VertexHandle v1 = myMesh.add_vertex(Vec3d( 0.0, 0.0, 1.0)); PolyhedralMeshV3f::VertexHandle v1 = myMesh.add_vertex(Vec3f( 0.0, 0.0, 1.0));
PolyhedralMeshV3d::VertexHandle v2 = myMesh.add_vertex(Vec3d( 1.0, 0.0, 0.0)); PolyhedralMeshV3f::VertexHandle v2 = myMesh.add_vertex(Vec3f( 1.0, 0.0, 0.0));
PolyhedralMeshV3d::VertexHandle v3 = myMesh.add_vertex(Vec3d( 0.0, 0.0,-1.0)); PolyhedralMeshV3f::VertexHandle v3 = myMesh.add_vertex(Vec3f( 0.0, 0.0,-1.0));
PolyhedralMeshV3d::VertexHandle v4 = myMesh.add_vertex(Vec3d( 0.0, 1.0, 0.0)); PolyhedralMeshV3f::VertexHandle v4 = myMesh.add_vertex(Vec3f( 0.0, 1.0, 0.0));
std::vector<PolyhedralMeshV3d::VertexHandle> vertices; std::vector<PolyhedralMeshV3f::VertexHandle> vertices;
// Add faces // Add faces
vertices.push_back(v0); vertices.push_back(v1);vertices.push_back(v3); vertices.push_back(v0); vertices.push_back(v1);vertices.push_back(v4);
PolyhedralMeshV3d::FaceHandle f0 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f0 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v2); vertices.push_back(v0);vertices.push_back(v3); vertices.push_back(v1); vertices.push_back(v2);vertices.push_back(v4);
PolyhedralMeshV3d::FaceHandle f1 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f1 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v0); vertices.push_back(v2);vertices.push_back(v1); vertices.push_back(v0); vertices.push_back(v1);vertices.push_back(v2);
PolyhedralMeshV3d::FaceHandle f2 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f2 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v1); vertices.push_back(v4);vertices.push_back(v3); vertices.push_back(v0); vertices.push_back(v4);vertices.push_back(v2);
PolyhedralMeshV3d::FaceHandle f3 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f3 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v2); vertices.push_back(v3);vertices.push_back(v4); vertices.push_back(v0); vertices.push_back(v4);vertices.push_back(v3);
PolyhedralMeshV3d::FaceHandle f4 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f4 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v2); vertices.push_back(v4);vertices.push_back(v1); vertices.push_back(v2); vertices.push_back(v3);vertices.push_back(v4);
PolyhedralMeshV3d::FaceHandle f5 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f5 = myMesh.add_face(vertices);
vertices.clear(); vertices.clear();
vertices.push_back(v1); vertices.push_back(v2);vertices.push_back(v3); vertices.push_back(v0); vertices.push_back(v2);vertices.push_back(v3);
PolyhedralMeshV3d::FaceHandle f6 = myMesh.add_face(vertices); PolyhedralMeshV3f::FaceHandle f6 = myMesh.add_face(vertices);
std::vector<PolyhedralMeshV3d::HalfFaceHandle> halffaces; std::vector<PolyhedralMeshV3f::HalfFaceHandle> halffaces;
// Add first tetrahedron // Add first tetrahedron
halffaces.push_back(myMesh.halfface_handle(f0, 1)); halffaces.push_back(myMesh.halfface_handle(f0, 1));
halffaces.push_back(myMesh.halfface_handle(f1, 1)); halffaces.push_back(myMesh.halfface_handle(f1, 1));
halffaces.push_back(myMesh.halfface_handle(f2, 1)); halffaces.push_back(myMesh.halfface_handle(f2, 0));
halffaces.push_back(myMesh.halfface_handle(f6, 1)); halffaces.push_back(myMesh.halfface_handle(f3, 1));
myMesh.add_cell(halffaces); myMesh.add_cell(halffaces);
// Add second tetrahedron // Add second tetrahedron
halffaces.clear(); halffaces.clear();
halffaces.push_back(myMesh.halfface_handle(f3, 1));
halffaces.push_back(myMesh.halfface_handle(f4, 1)); halffaces.push_back(myMesh.halfface_handle(f4, 1));
halffaces.push_back(myMesh.halfface_handle(f5, 1)); halffaces.push_back(myMesh.halfface_handle(f5, 1));
halffaces.push_back(myMesh.halfface_handle(f3, 0));
halffaces.push_back(myMesh.halfface_handle(f6, 0)); halffaces.push_back(myMesh.halfface_handle(f6, 0));
myMesh.add_cell(halffaces); myMesh.add_cell(halffaces);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment