58#define NONMANIFOLDVERTEXFIXING_CC
62#include "NonManifoldVertexFixingT.hh"
82 if ( !mesh_.get_property_handle(component,
"component") )
83 mesh_.add_property(component,
"component");
85 for (
auto v_iter : mesh_.vertices())
88 for (
auto vf_iter : v_iter.faces())
89 mesh_.property(component,vf_iter) = 0;
91 size_t componentCount = 1;
96 for (
auto vf_iter : v_iter.faces())
99 std::vector<typename MeshT::FaceHandle> checkNeighbour;
100 if(mesh_.property(component,vf_iter) == 0)
102 mesh_.property(component,vf_iter) = componentCount;
103 checkNeighbour.push_back(vf_iter);
108 typename MeshT::VertexHandle v_new;
109 if (componentCount > 1 && !checkNeighbour.empty())
111 typename MeshT::Point p = mesh_.point(v_iter);
116 while(!checkNeighbour.empty())
118 typename MeshT::FaceHandle face = checkNeighbour.back();
119 checkNeighbour.pop_back();
121 std::vector<typename MeshT::VertexHandle> f_vertices;
123 for (
auto fv_iter :
make_smart(face, mesh_).vertices())
125 f_vertices.push_back(fv_iter);
126 if (fv_iter != v_iter)
129 typename MeshT::FaceHandle nf;
130 for (
auto nf_iter : v_iter.faces())
133 for (
auto nfv_iter: nf_iter.vertices())
135 if (nf.is_valid())
break;
136 if (nfv_iter == fv_iter)
142 if (nf.is_valid() && !mesh_.property(component,nf))
144 mesh_.property(component,nf) = componentCount;
145 checkNeighbour.push_back(nf);
151 if (componentCount > 1 && v_new.is_valid())
153 std::replace(f_vertices.begin(),f_vertices.end(),
typename MeshT::VertexHandle(v_iter),v_new);
155 mesh_.delete_face(face,
false);
156 mesh_.add_face(f_vertices);
167 mesh_.remove_property(component);
168 mesh_.garbage_collection();
Removed non-manifold vertices from a mesh by duplicating them.
SmartVertexHandle add_vertex(const Point _p)
SmartVertexHandle make_smart(VertexHandle _vh, const PolyConnectivity *_mesh)
Creats a SmartVertexHandle from a VertexHandle and a Mesh.