Commit 74942b5e authored by Matthias Möller's avatar Matthias Möller

fix "relink failed" condition

closes #1244

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1220 fdac6126-5c0c-442c-9429-916003d36597
parent 81a7ee73
......@@ -176,17 +176,19 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
do
boundary_prev =
opposite_halfedge_handle(next_halfedge_handle(boundary_prev));
while (!is_boundary(boundary_prev) || boundary_prev==inner_prev);
while (!is_boundary(boundary_prev));
boundary_next = next_halfedge_handle(boundary_prev);
assert(is_boundary(boundary_prev));
assert(is_boundary(boundary_next));
// ok ?
if (boundary_next == inner_next)
if (boundary_prev == inner_prev)
{
omerr() << "PolyMeshT::add_face: patch re-linking failed\n";
return InvalidFaceHandle;
}
assert(is_boundary(boundary_prev));
assert(is_boundary(boundary_next));
// other halfedges' handles
patch_start = next_halfedge_handle(inner_prev);
patch_end = prev_halfedge_handle(inner_next);
......
......@@ -296,11 +296,12 @@ TEST_F(OpenMeshAddFaceTriangleMesh, CreateStrangeConfig) {
mesh_.add_face( vh[0], vh[5], vh[6] );
// non-manifold!
mesh_.add_face( vh[3], vh[0], vh[4] );
Mesh::FaceHandle invalidFH = mesh_.add_face( vh[3], vh[0], vh[4] );
// Check setup
EXPECT_EQ(7u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(4u, mesh_.n_faces() ) << "Wrong number of faces";
EXPECT_EQ(3u, mesh_.n_faces() ) << "Wrong number of faces";
EXPECT_EQ(invalidFH, Mesh::InvalidFaceHandle ) << "non manifold face is valid";
}
......
Markdown is supported
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