54 #include "MeshRepairPlugin.hh" 62 unsigned int count(0);
71 MeshSelection::clearVertexSelection(mesh);
73 TriMesh::VertexIter v_it, v_end(mesh->vertices_end());
74 TriMesh::VVIter vv_it;
75 TriMesh::VFIter vf_it;
76 TriMesh::FaceHandle fh;
77 std::vector<TriMesh::VertexHandle> vh(3);
80 for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it)
82 if (!mesh->status(*v_it).deleted() && !mesh->is_boundary(*v_it) && mesh->valence(*v_it) == 3)
84 vf_it = mesh->vf_iter(*v_it);
89 if ( (n0|n1) > cosangle &&
94 mesh->status(*v_it).set_selected(
true);
101 emit log(
LOGERR,
"Cannot detect flat triangles on non-trimesh " + QString::number(_objectId) +
".");
109 emit log (
LOGINFO,
"Selected " + QString::number(count) +
" vertices on object " + QString::number(_objectId) +
" with face angle difference smaller than " + QString::number(_angle) +
".");
110 emit scriptInfo(
"detectFlatValence3Vertices(" + QString::number(_objectId) +
", " + QString::number(_angle) +
")" );
118 unsigned int count = 0;
126 TriMesh::VertexIter v_it, v_end(mesh->vertices_end());
127 TriMesh::VVIter vv_it;
128 TriMesh::VFIter vf_it;
130 std::vector<TriMesh::VertexHandle> vh(3);
132 for (v_it = mesh->vertices_begin(); v_it != v_end; ++v_it) {
133 vf_it = mesh->vf_iter(*v_it);
134 if ((mesh->status(*v_it).selected()) && !mesh->status(*v_it).feature() && mesh->valence(*v_it) == 3) {
135 for (i = 0, vv_it = mesh->vv_iter(*v_it); vv_it.is_valid(); ++vv_it, ++i)
138 mesh->delete_vertex(*v_it,
false);
145 mesh->garbage_collection();
150 emit createBackup(_objectId,
"Delete/merge selected vertices",
UPDATE_ALL);
152 emit log(
"Deleted " + QString::number(count) +
" vertices on object " + QString::number(_objectId) +
".");
bool getMesh(int _identifier, PolyMesh *&_mesh)
Get the Poly Mesh which has the given identifier.
void detectFlatValence3Vertices(int _objectId, double _angle)
Detect valence 3 vertices with faces that lie in the plane of their adjacent triangles.
Kernel::Normal Normal
Normal type.
Functions for selection on a mesh.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
Kernel::Scalar Scalar
Scalar type.