Avoid double next_halfedge_handle call in collapse_ok

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@723 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2012-10-01 07:11:05 +00:00
parent a1315c1dd9
commit 073cfd74d3

View File

@@ -113,18 +113,18 @@ bool TriConnectivity::is_collapse_ok(HalfedgeHandle v0v1)
if (status(v0).deleted() || status(v1).deleted()) if (status(v0).deleted() || status(v1).deleted())
return false; return false;
VertexHandle vl, vr; VertexHandle vl, vr;
HalfedgeHandle h1, h2; HalfedgeHandle h1, h2;
// the edges v1-vl and vl-v0 must not be both boundary edges // the edges v1-vl and vl-v0 must not be both boundary edges
if (!is_boundary(v0v1)) if (!is_boundary(v0v1))
{ {
vl = to_vertex_handle(next_halfedge_handle(v0v1));
h1 = next_halfedge_handle(v0v1); h1 = next_halfedge_handle(v0v1);
h2 = next_halfedge_handle(h1); h2 = next_halfedge_handle(h1);
vl = to_vertex_handle(h1);
if (is_boundary(opposite_halfedge_handle(h1)) && if (is_boundary(opposite_halfedge_handle(h1)) &&
is_boundary(opposite_halfedge_handle(h2))) is_boundary(opposite_halfedge_handle(h2)))
{ {
@@ -136,23 +136,22 @@ bool TriConnectivity::is_collapse_ok(HalfedgeHandle v0v1)
// the edges v0-vr and vr-v1 must not be both boundary edges // the edges v0-vr and vr-v1 must not be both boundary edges
if (!is_boundary(v1v0)) if (!is_boundary(v1v0))
{ {
vr = to_vertex_handle(next_halfedge_handle(v1v0));
h1 = next_halfedge_handle(v1v0); h1 = next_halfedge_handle(v1v0);
h2 = next_halfedge_handle(h1); h2 = next_halfedge_handle(h1);
vr = to_vertex_handle(h1);
if (is_boundary(opposite_halfedge_handle(h1)) && if (is_boundary(opposite_halfedge_handle(h1)) &&
is_boundary(opposite_halfedge_handle(h2))) is_boundary(opposite_halfedge_handle(h2)))
return false; return false;
} }
// if vl and vr are equal or both invalid -> fail // if vl and vr are equal or both invalid -> fail
if (vl == vr) return false; if (vl == vr) return false;
VertexVertexIter vv_it; VertexVertexIter vv_it;
// test intersection of the one-rings of v0 and v1 // test intersection of the one-rings of v0 and v1
for (vv_it = vv_iter(v0); vv_it; ++vv_it) for (vv_it = vv_iter(v0); vv_it; ++vv_it)
status(vv_it).set_tagged(false); status(vv_it).set_tagged(false);
@@ -165,7 +164,6 @@ bool TriConnectivity::is_collapse_ok(HalfedgeHandle v0v1)
return false; return false;
// edge between two boundary vertices should be a boundary edge // edge between two boundary vertices should be a boundary edge
if ( is_boundary(v0) && is_boundary(v1) && if ( is_boundary(v0) && is_boundary(v1) &&
!is_boundary(v0v1) && !is_boundary(v1v0)) !is_boundary(v0v1) && !is_boundary(v1v0))