52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#include "analysis.h"
|
||
#include <iostream>
|
||
|
||
|
||
int main(int argc, char *argv[]) {
|
||
using namespace std;
|
||
|
||
if (argc != 2 && argc != 3) {
|
||
cerr << "Utilisation : " << argv[0] << " fichier.obj [surface|valence|deviation|dièdre]" << endl;
|
||
return 1;
|
||
}
|
||
MyMesh mesh;
|
||
OpenMesh::IO::read_mesh(mesh, argv[1]);
|
||
cerr << "Les faces sont des triangles : "
|
||
<< (check_faces_are_triangles(mesh) ? "oui" : "non")
|
||
<< endl;
|
||
cerr << "Les faces ont des voisines : "
|
||
<< (check_faces_arent_lonely(mesh) ? "oui" : "non")
|
||
<< endl;
|
||
cerr << "Les sommets sont sur une arête : "
|
||
<< (check_vertices_arent_lonely(mesh) ? "oui" : "non")
|
||
<< endl;
|
||
cerr << "Les arêtes sont sur une face : "
|
||
<< (check_edges_arent_lonely(argv[1]) ? "oui" : "non")
|
||
<< endl;
|
||
float area = total_area(mesh);
|
||
cerr << "Aire totale : " << area << endl;
|
||
cerr << "Aire moyenne : " << area / mesh.n_faces() << endl;
|
||
if (argc == 3) {
|
||
string cmd = argv[2];
|
||
if (cmd == "surface") {
|
||
stats_surface_area(mesh);
|
||
}
|
||
else if (cmd == "valence") {
|
||
stats_n_neighbors(mesh);
|
||
}
|
||
else if (cmd == "deviation") {
|
||
stats_normal_deviation(mesh);
|
||
OpenMesh::IO::write_mesh(mesh, "out.ply",
|
||
OpenMesh::IO::Options(OpenMesh::IO::Options::VertexColor));
|
||
}
|
||
else if (cmd == "dièdre") {
|
||
stats_dihedral_angles(mesh);
|
||
}
|
||
else {
|
||
cerr << "Commande inconnue : " << cmd << endl;
|
||
return 1;
|
||
}
|
||
}
|
||
return 0;
|
||
}
|