implements triangle face check (poorly)
This commit is contained in:
parent
54f87ce8d7
commit
6f60dc6173
23
src/main.cpp
23
src/main.cpp
@ -3,6 +3,20 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
bool check_faces_are_triangles(MyMesh &mesh) {
|
||||
for (auto f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
||||
size_t n_edges = 0;
|
||||
for (auto fe_it = mesh.fe_iter(*f_it); fe_it.is_valid(); ++fe_it) {
|
||||
n_edges++;
|
||||
}
|
||||
if (n_edges != 3) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
using namespace std;
|
||||
|
||||
@ -12,6 +26,13 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
MyMesh mesh;
|
||||
OpenMesh::IO::read_mesh(mesh, argv[1]);
|
||||
|
||||
cout << "Les faces sont des triangles : ";
|
||||
if (check_faces_are_triangles(mesh)) {
|
||||
cout << "oui";
|
||||
}
|
||||
else {
|
||||
cout << "non";
|
||||
}
|
||||
cout << endl;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define MY_MESH_H
|
||||
|
||||
#include <OpenMesh/Core/IO/MeshIO.hh>
|
||||
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
||||
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ struct MyTraits : public OpenMesh::DefaultTraits {
|
||||
// edge thickness
|
||||
EdgeTraits{float thickness;};
|
||||
};
|
||||
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
|
||||
typedef OpenMesh::PolyMesh_ArrayKernelT<MyTraits> MyMesh;
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user