diff --git a/Lab/demo/Lab/Scene_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_surface_mesh_item.cpp index 30e0d59ab83d..a3e317451c39 100644 --- a/Lab/demo/Lab/Scene_surface_mesh_item.cpp +++ b/Lab/demo/Lab/Scene_surface_mesh_item.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include "triangulate_primitive.h" #include @@ -1636,6 +1637,15 @@ QString Scene_surface_mesh_item::computeStats(int type) case MEAN_ANGLE: angles(d->smesh_, mini, maxi, ave); } + + double minda(0), maxda(0); + switch (type) + { + case MIN_DIHEDRAL_ANGLE: + case MAX_DIHEDRAL_ANGLE: + dihedral_angles(d->smesh_, minda, maxda); + } + double min_area, max_area, med_area, mean_area; switch (type) { @@ -1798,6 +1808,12 @@ QString Scene_surface_mesh_item::computeStats(int type) return QString::number(maxi); case MEAN_ANGLE: return QString::number(ave); + + case MIN_DIHEDRAL_ANGLE: + return QString::number(minda); + case MAX_DIHEDRAL_ANGLE: + return QString::number(maxda); + case NB_HOLES: return QString::number(nb_holes(d->smesh_)); @@ -1840,7 +1856,7 @@ CGAL::Three::Scene_item::Header_data Scene_surface_mesh_item::header() const data.categories.append(std::pair(QString("Vertices"),2)); data.categories.append(std::pair(QString("Faces"),10)); data.categories.append(std::pair(QString("Edges"),7)); - data.categories.append(std::pair(QString("Angles"),3)); + data.categories.append(std::pair(QString("Angles"),5)); //titles @@ -1879,6 +1895,8 @@ CGAL::Three::Scene_item::Header_data Scene_surface_mesh_item::header() const data.titles.append(QString("Minimum")); data.titles.append(QString("Maximum")); data.titles.append(QString("Average")); + data.titles.append(QString("Dihedral Minimum")); + data.titles.append(QString("Dihedral Maximum")); return data; } diff --git a/Lab/demo/Lab/Scene_surface_mesh_item.h b/Lab/demo/Lab/Scene_surface_mesh_item.h index 31e0f1951eb2..d39d1d84ba5f 100644 --- a/Lab/demo/Lab/Scene_surface_mesh_item.h +++ b/Lab/demo/Lab/Scene_surface_mesh_item.h @@ -149,7 +149,9 @@ class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item // Angles MIN_ANGLE, MAX_ANGLE, - MEAN_ANGLE + MEAN_ANGLE, + MIN_DIHEDRAL_ANGLE, + MAX_DIHEDRAL_ANGLE }; bool has_stats()const override{return true;} diff --git a/Lab/demo/Lab/include/CGAL/statistics_helpers.h b/Lab/demo/Lab/include/CGAL/statistics_helpers.h index fb4785f30214..6ea808ff4084 100644 --- a/Lab/demo/Lab/include/CGAL/statistics_helpers.h +++ b/Lab/demo/Lab/include/CGAL/statistics_helpers.h @@ -81,6 +81,14 @@ void angles(Mesh* poly, double& mini, double& maxi, double& ave) compute_angles(poly, Angles_test(), mini, maxi, ave); } +template +void dihedral_angles(Mesh* poly, double& minda, double& maxda) +{ + auto da = CGAL::Polygon_mesh_processing::detect_sharp_edges(*poly); + minda = da.first.second; + maxda = da.second.second; +} + template void angles(Mesh* poly, const Face_set& faces, double& mini, double& maxi, double& ave) {