45 #include "MeshRepairPlugin.hh" 53 unsigned int count(0);
62 MeshSelection::clearVertexSelection(mesh);
64 TriMesh::VertexIter v_it, v_end(mesh->vertices_end());
65 TriMesh::VVIter vv_it;
66 TriMesh::VFIter vf_it;
67 TriMesh::FaceHandle fh;
68 std::vector<TriMesh::VertexHandle> vh(3);
71 for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it)
73 if (!mesh->status(*v_it).deleted() && !mesh->is_boundary(*v_it) && mesh->valence(*v_it) == 3)
75 vf_it = mesh->vf_iter(*v_it);
80 if ( (n0|n1) > cosangle &&
85 mesh->status(*v_it).set_selected(
true);
92 emit log(
LOGERR,
"Cannot detect flat triangles on non-trimesh " + QString::number(_objectId) +
".");
100 emit log (
LOGINFO,
"Selected " + QString::number(count) +
" vertices on object " + QString::number(_objectId) +
" with face angle difference smaller than " + QString::number(_angle) +
".");
101 emit scriptInfo(
"detectFlatValence3Vertices(" + QString::number(_objectId) +
", " + QString::number(_angle) +
")" );
109 unsigned int count = 0;
117 TriMesh::VertexIter v_it, v_end(mesh->vertices_end());
118 TriMesh::VVIter vv_it;
119 TriMesh::VFIter vf_it;
121 std::vector<TriMesh::VertexHandle> vh(3);
123 for (v_it = mesh->vertices_begin(); v_it != v_end; ++v_it) {
124 vf_it = mesh->vf_iter(*v_it);
125 if ((mesh->status(*v_it).selected()) && !mesh->status(*v_it).feature() && mesh->valence(*v_it) == 3) {
126 for (i = 0, vv_it = mesh->vv_iter(*v_it); vv_it.is_valid(); ++vv_it, ++i)
129 mesh->delete_vertex(*v_it,
false);
136 mesh->garbage_collection();
141 emit createBackup(_objectId,
"Delete/merge selected vertices",
UPDATE_ALL);
143 emit log(
"Deleted " + QString::number(count) +
" vertices on object " + QString::number(_objectId) +
".");
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
Kernel::Normal Normal
Normal type.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
Functions for selection on a mesh.
Kernel::Scalar Scalar
Scalar type.
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.
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.