From a79eab05280ca9fc87612120d506652174d8b6a1 Mon Sep 17 00:00:00 2001 From: Isaak Lim Date: Tue, 8 May 2012 10:48:07 +0000 Subject: [PATCH] added a check to is_collapse_ok in TriConnectivity if the edge is already deleted or not. moved the equivalent check in PolyConnectivity to the top of the is_collapse_ok function. closes #681 git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@582 fdac6126-5c0c-442c-9429-916003d36597 --- src/OpenMesh/Core/Mesh/PolyConnectivity.cc | 12 ++++++------ src/OpenMesh/Core/Mesh/TriConnectivity.cc | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/OpenMesh/Core/Mesh/PolyConnectivity.cc b/src/OpenMesh/Core/Mesh/PolyConnectivity.cc index 1302a20d..30a6b64e 100644 --- a/src/OpenMesh/Core/Mesh/PolyConnectivity.cc +++ b/src/OpenMesh/Core/Mesh/PolyConnectivity.cc @@ -284,6 +284,12 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size //----------------------------------------------------------------------------- bool PolyConnectivity::is_collapse_ok(HalfedgeHandle v0v1) { + //is edge already deleteed? + if (status(edge_handle(v0v1)).deleted()) + { + return false; + } + HalfedgeHandle v1v0(opposite_halfedge_handle(v0v1)); VertexHandle v0(to_vertex_handle(v1v0)); VertexHandle v1(to_vertex_handle(v0v1)); @@ -304,12 +310,6 @@ bool PolyConnectivity::is_collapse_ok(HalfedgeHandle v0v1) VertexHandle v_10_p = from_vertex_handle(prev_halfedge_handle(v1v0)); VertexHandle v_10_n = to_vertex_handle(next_halfedge_handle(v1v0)); - //is edge already deleteed? - if (status(edge_handle(v0v1)).deleted()) - { - return false; - } - //are the vertices already deleted ? if (status(v0).deleted() || status(v1).deleted()) { diff --git a/src/OpenMesh/Core/Mesh/TriConnectivity.cc b/src/OpenMesh/Core/Mesh/TriConnectivity.cc index c786caa9..c8b24906 100644 --- a/src/OpenMesh/Core/Mesh/TriConnectivity.cc +++ b/src/OpenMesh/Core/Mesh/TriConnectivity.cc @@ -84,6 +84,10 @@ TriConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size) //----------------------------------------------------------------------------- bool TriConnectivity::is_collapse_ok(HalfedgeHandle v0v1) { + // is the edge already deleted? + if ( status(edge_handle(v0v1)).deleted() ) + return false; + HalfedgeHandle v1v0(opposite_halfedge_handle(v0v1)); VertexHandle v0(to_vertex_handle(v1v0)); VertexHandle v1(to_vertex_handle(v0v1));