54 #include "MeshRepairPlugin.hh"
69 unsigned int count(0);
72 MeshSelection::clearFaceSelection(mesh);
74 TriMesh::FaceIter f_it, f_end(mesh->faces_end());
75 TriMesh::FVIter fv_it;
76 TriMesh::FEIter fe_it;
78 for (f_it = mesh->faces_begin(); f_it != f_end; ++f_it) {
79 fv_it = mesh->fv_iter(*f_it);
81 const TriMesh::Point& p0 = mesh->point(*fv_it);
82 const TriMesh::Point& p1 = mesh->point(*(++fv_it));
83 const TriMesh::Point& p2 = mesh->point(*(++fv_it));
86 mesh->status(*f_it).set_selected(
true);
93 emit scriptInfo(
"detectTriangleAspect(" + QString::number(_objectId) +
", " + QString::number(_aspect) +
")" );
96 "Selected " + QString::number(count) +
" triangles on object " + QString::number(_objectId)
97 +
" with aspect ratio greater than " + QString::number(_aspect) +
".");
99 emit log(
"Cannot detect skinny triangles on non-trimesh " + QString::number(_objectId) +
".");
109 TriMesh* triMesh = 0;
120 emit log(
LOGERR,tr(
"Unsupported Object Type for normal flipping!") );
124 emit createBackup( _objectId,
"Flipped Normals",
UPDATE_ALL);
125 emit scriptInfo(
"flipOrientation(" + QString::number(_objectId) +
")" );
void flipOrientation(int _objectId)
Flips the normals of all selected faces by changing the vertex order.
bool getMesh(int _identifier, PolyMesh *&_mesh)
Get the Poly Mesh which has the given identifier.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void detectTriangleAspect(int _objectId, float _aspect)
Detect triangles with aspect ratio greater than _aspect and select them.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
Scalar aspectRatio(const VectorT< Scalar, N > &_v0, const VectorT< Scalar, N > &_v1, const VectorT< Scalar, N > &_v2)
return aspect ratio (length/height) of triangle
Functions for selection on a mesh.