From 07db041c21693804f1fdbb725556d31f6301bfda Mon Sep 17 00:00:00 2001 From: ccolin Date: Fri, 2 Oct 2020 13:19:47 +0200 Subject: [PATCH] implements statistics computation on dihedral angles --- src/main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c668feb..2153fac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,11 +120,21 @@ void stats_normal_deviation(MyMesh &mesh) { } +void stats_dihedral_angles(MyMesh &mesh) { + mesh.update_normals(); + for (size_t i = 0; i < mesh.n_halfedges(); i++) { + MyMesh::HalfedgeHandle heh = mesh.halfedge_handle(i); + std::cout << mesh.calc_dihedral_angle_fast(heh) * 180.0 / PI << " "; + } + std::cout << std::endl; +} + + int main(int argc, char *argv[]) { using namespace std; if (argc != 2 && argc != 3) { - cerr << "Utilisation : " << argv[0] << " fichier.obj [surface|valence|deviation]" << endl; + cerr << "Utilisation : " << argv[0] << " fichier.obj [surface|valence|deviation|dièdre]" << endl; return 1; } MyMesh mesh; @@ -152,6 +162,8 @@ int main(int argc, char *argv[]) { stats_n_neighbors(mesh); else if (cmd == "deviation") stats_normal_deviation(mesh); + else if (cmd == "dièdre") + stats_dihedral_angles(mesh); else { cerr << "Commande inconnue : " << cmd << endl; return 1;