This repository has been archived on 2020-10-03. You can view files and clone it, but cannot push or open issues or pull requests.
pgai_tp1/src/main.cpp

52 lines
1.4 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}