Added status flag for isolated geometry that results from vertex duplication (due to non-manifold configurations).

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@314 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Mike Kremer
2010-04-01 13:52:49 +00:00
parent 12a74113a3
commit bc0da8e58c
2 changed files with 42 additions and 25 deletions

View File

@@ -103,7 +103,7 @@ public:
{ {
VHandles::const_iterator it, it2, end(_indices.end()); VHandles::const_iterator it, it2, end(_indices.end());
// test for valid vertex indices // test for valid vertex indices
for (it=_indices.begin(); it!=end; ++it) for (it=_indices.begin(); it!=end; ++it)
if (! mesh_.is_valid_handle(*it)) if (! mesh_.is_valid_handle(*it))
@@ -267,19 +267,36 @@ public:
for (unsigned int i=0; i<failed_faces_.size(); ++i) for (unsigned int i=0; i<failed_faces_.size(); ++i)
{ {
VHandles& vhandles = failed_faces_[i]; VHandles& vhandles = failed_faces_[i];
// double vertices // double vertices
for (unsigned int j=0; j<vhandles.size(); ++j) for (unsigned int j=0; j<vhandles.size(); ++j)
{ {
Point p = mesh_.point(vhandles[j]); Point p = mesh_.point(vhandles[j]);
vhandles[j] = mesh_.add_vertex(p); vhandles[j] = mesh_.add_vertex(p);
// DO STORE p, reference may not work since vertex array // DO STORE p, reference may not work since vertex array
// may be relocated after adding a new vertex ! // may be relocated after adding a new vertex !
}
// Mark vertices of failed face as non-manifold
if (mesh_.has_vertex_status()) {
mesh_.status(vhandles[j]).set_fixed_nonmanifold(true);
}
}
// add face // add face
mesh_.add_face(vhandles); FaceHandle fh = mesh_.add_face(vhandles);
// Mark failed face as non-manifold
if (mesh_.has_face_status())
mesh_.status(fh).set_fixed_nonmanifold(true);
// Mark edges of failed face as non-two-manifold
if (mesh_.has_edge_status()) {
typename Mesh::FaceEdgeIter fe_it = mesh_.fe_iter(fh);
for(; fe_it; ++fe_it) {
mesh_.status(fe_it).set_fixed_nonmanifold(true);
}
}
} }
failed_faces_.clear(); failed_faces_.clear();

View File

@@ -71,15 +71,15 @@ namespace Attributes {
*/ */
enum StatusBits { enum StatusBits {
DELETED = 1, ///< Item has been deleted DELETED = 1, ///< Item has been deleted
LOCKED = 2, ///< Item is locked. LOCKED = 2, ///< Item is locked.
SELECTED = 4, ///< Item is selected. SELECTED = 4, ///< Item is selected.
HIDDEN = 8, ///< Item is hidden. HIDDEN = 8, ///< Item is hidden.
FEATURE = 16, ///< Item is a feature or belongs to a feature. FEATURE = 16, ///< Item is a feature or belongs to a feature.
TAGGED = 32, ///< Item is tagged. TAGGED = 32, ///< Item is tagged.
TAGGED2 = 64, ///< Alternate bit for tagging an item. TAGGED2 = 64, ///< Alternate bit for tagging an item.
NONMANIFOLD = 128, ///< Item is non-two-manifold FIXEDNONMANIFOLD = 128, ///< Item was non-two-manifold and had to be fixed
UNUSED = 256 ///< Unused UNUSED = 256 ///< Unused
}; };
@@ -139,10 +139,10 @@ public:
void set_tagged2(bool _b) { change_bit(TAGGED2, _b); } void set_tagged2(bool _b) { change_bit(TAGGED2, _b); }
/// is non-manifold ? /// is fixed non-manifold ?
bool nonmanifold() const { return is_bit_set(NONMANIFOLD); } bool fixed_nonmanifold() const { return is_bit_set(FIXEDNONMANIFOLD); }
/// set non-manifold /// set fixed non-manifold
void set_nonmanifold(bool _b) { change_bit(NONMANIFOLD, _b); } void set_fixed_nonmanifold(bool _b) { change_bit(FIXEDNONMANIFOLD, _b); }
/// return whole status /// return whole status