Skip to content

Commit ebb64d3

Browse files
committed
wip
1 parent 09131c0 commit ebb64d3

File tree

8 files changed

+43
-48
lines changed

8 files changed

+43
-48
lines changed

bindings/python/src/inspector/criterion/degeneration/edgedcurve_degeneration.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@ namespace geode
4040
.def( "is_mesh_degenerated",
4141
&EdgedCurveDegeneration::is_mesh_degenerated )
4242
.def( "degenerated_edges",
43-
[]( EdgedCurveDegeneration& self ) {
44-
return self.degenerated_edges();
45-
} )
46-
.def( "degenerated_edges",
47-
[]( EdgedCurveDegeneration& self, double tolerance ) {
48-
return self.degenerated_edges( tolerance );
49-
} );
43+
&EdgedCurveDegeneration::degenerated_edges );
5044
}
5145
void define_edged_curve_degeneration( pybind11::module& module )
5246
{

bindings/python/src/inspector/criterion/degeneration/surface_degeneration.hpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,9 @@ namespace geode
4040
.def( "is_mesh_degenerated",
4141
&SurfaceMeshDegeneration::is_mesh_degenerated )
4242
.def( "degenerated_edges",
43-
[]( SurfaceMeshDegeneration& self ) {
44-
return self.degenerated_edges();
45-
} )
46-
.def( "degenerated_edges",
47-
[]( SurfaceMeshDegeneration& self, double tolerance ) {
48-
return self.degenerated_edges( tolerance );
49-
} )
50-
.def( "degenerated_polygons",
51-
[]( SurfaceMeshDegeneration& self ) {
52-
return self.degenerated_polygons();
53-
} )
43+
&SurfaceMeshDegeneration::degenerated_edges )
5444
.def( "degenerated_polygons",
55-
[]( SurfaceMeshDegeneration& self, double tolerance ) {
56-
return self.degenerated_polygons( tolerance );
57-
} );
45+
&SurfaceMeshDegeneration::degenerated_polygons );
5846
}
5947
void define_surface_degeneration( pybind11::module& module )
6048
{

include/geode/inspector/criterion/degeneration/edgedcurve_degeneration.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ namespace geode
5252

5353
[[nodiscard]] InspectionIssues< index_t > degenerated_edges() const;
5454

55-
[[nodiscard]] InspectionIssues< index_t > degenerated_edges(
56-
double tolerance ) const;
55+
[[nodiscard]] InspectionIssues< index_t > small_edges(
56+
double threshold ) const;
5757

5858
private:
5959
IMPLEMENTATION_MEMBER( impl_ );

include/geode/inspector/criterion/degeneration/surface_degeneration.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ namespace geode
5151

5252
[[nodiscard]] bool is_mesh_degenerated() const;
5353

54-
[[nodiscard]] InspectionIssues< index_t > degenerated_edges(
55-
double tolerance ) const;
54+
[[nodiscard]] InspectionIssues< index_t > small_edges(
55+
double threshold ) const;
5656

5757
[[nodiscard]] InspectionIssues< index_t > degenerated_edges() const;
5858

59-
[[nodiscard]] InspectionIssues< index_t > degenerated_polygons(
60-
double tolerance ) const;
59+
[[nodiscard]] InspectionIssues< index_t > small_height_polygons(
60+
double threshold ) const;
6161

6262
[[nodiscard]] InspectionIssues< index_t > degenerated_polygons() const;
6363

include/geode/inspector/criterion/internal/component_meshes_degeneration.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ namespace geode
5151
void add_degenerated_edges(
5252
InspectionIssuesMap< index_t >& issues_map ) const;
5353

54-
void add_degenerated_edges(
55-
InspectionIssuesMap< index_t >& issues_map,
54+
void add_small_edges( InspectionIssuesMap< index_t >& issues_map,
5655
double tolerance ) const;
5756

5857
void add_degenerated_polygons(
5958
InspectionIssuesMap< index_t >& issues_map ) const;
6059

61-
void add_degenerated_polygons(
60+
void add_small_height_polygons(
6261
InspectionIssuesMap< index_t >& issues_map,
6362
double tolerance ) const;
6463

include/geode/inspector/criterion/internal/degeneration_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ namespace geode
4141

4242
[[nodiscard]] virtual bool is_mesh_degenerated() const;
4343

44-
[[nodiscard]] InspectionIssues< index_t > degenerated_edges(
45-
double tolerance ) const;
44+
[[nodiscard]] InspectionIssues< index_t > small_edges(
45+
double threshold ) const;
4646

4747
[[nodiscard]] InspectionIssues< index_t > degenerated_edges() const;
4848

4949
private:
50-
[[nodiscard]] bool edge_is_degenerated(
50+
[[nodiscard]] bool edge_is_smaller_than_threshold(
5151
index_t edge_index, double tolerance ) const;
5252

5353
[[nodiscard]] bool edge_is_degenerated( index_t edge_index ) const;

src/geode/inspector/criterion/degeneration/surface_degeneration.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <geode/geometry/mensuration.hpp>
3232

3333
#include <geode/mesh/core/surface_mesh.hpp>
34+
#include <geode/mesh/helpers/mesh_quality.hpp>
3435

3536
#include <geode/inspector/criterion/internal/degeneration_impl.hpp>
3637

@@ -63,16 +64,16 @@ namespace geode
6364
return false;
6465
}
6566

66-
InspectionIssues< index_t > degenerated_polygons(
67+
InspectionIssues< index_t > small_height_polygons(
6768
double tolerance ) const
6869
{
6970
InspectionIssues< index_t > wrong_polygons{
7071
"Degenerated Polygons."
7172
};
7273
for( const auto polygon_id : Range{ this->mesh().nb_polygons() } )
7374
{
74-
if( this->mesh().is_polygon_degenerated(
75-
polygon_id, tolerance ) )
75+
if( is_polygon_minimum_height_too_small(
76+
this->mesh(), polygon_id, tolerance ) )
7677
{
7778
wrong_polygons.add_issue( polygon_id,
7879
absl::StrCat( "Polygon ", polygon_id, " of Surface ",
@@ -84,7 +85,20 @@ namespace geode
8485

8586
InspectionIssues< index_t > degenerated_polygons() const
8687
{
87-
return degenerated_polygons( GLOBAL_EPSILON );
88+
InspectionIssues< index_t > wrong_polygons{
89+
"Degenerated Polygons."
90+
};
91+
for( const auto polygon_id : Range{ this->mesh().nb_polygons() } )
92+
{
93+
if( this->mesh().is_polygon_degenerated(
94+
polygon_id, GLOBAL_EPSILON ) )
95+
{
96+
wrong_polygons.add_issue( polygon_id,
97+
absl::StrCat( "Polygon ", polygon_id, " of Surface ",
98+
this->mesh().id().string(), " is degenerated." ) );
99+
}
100+
}
101+
return wrong_polygons;
88102
}
89103
};
90104

@@ -106,10 +120,10 @@ namespace geode
106120

107121
template < index_t dimension >
108122
InspectionIssues< index_t >
109-
SurfaceMeshDegeneration< dimension >::degenerated_edges(
110-
double tolerance ) const
123+
SurfaceMeshDegeneration< dimension >::small_edges(
124+
double threshold ) const
111125
{
112-
return impl_->degenerated_edges( tolerance );
126+
return impl_->small_edges( threshold );
113127
}
114128

115129
template < index_t dimension >
@@ -128,10 +142,10 @@ namespace geode
128142

129143
template < index_t dimension >
130144
InspectionIssues< index_t >
131-
SurfaceMeshDegeneration< dimension >::degenerated_polygons(
132-
double tolerance ) const
145+
SurfaceMeshDegeneration< dimension >::small_height_polygons(
146+
double threshold ) const
133147
{
134-
return impl_->degenerated_polygons( tolerance );
148+
return impl_->small_height_polygons( threshold );
135149
}
136150

137151
template class opengeode_inspector_inspector_api

src/geode/inspector/criterion/internal/degeneration_impl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <geode/mesh/core/solid_mesh.hpp>
3030
#include <geode/mesh/core/surface_edges.hpp>
3131
#include <geode/mesh/core/surface_mesh.hpp>
32+
#include <geode/mesh/helpers/mesh_quality.hpp>
3233

3334
#include <geode/geometry/distance.hpp>
3435
#include <geode/geometry/point.hpp>
@@ -71,9 +72,8 @@ namespace geode
7172
}
7273

7374
template < class MeshType >
74-
InspectionIssues< index_t >
75-
DegenerationImpl< MeshType >::degenerated_edges(
76-
double tolerance ) const
75+
InspectionIssues< index_t > DegenerationImpl< MeshType >::small_edges(
76+
double threshold ) const
7777
{
7878
InspectionIssues< index_t > degenerated_edges_index{
7979
"Degenerated Edges."
@@ -103,7 +103,7 @@ namespace geode
103103
}
104104

105105
template < class MeshType >
106-
bool DegenerationImpl< MeshType >::edge_is_degenerated(
106+
bool DegenerationImpl< MeshType >::edge_is_smaller_than_threshold(
107107
index_t edge_index, double tolerance ) const
108108
{
109109
const auto edge_vertices =
@@ -117,7 +117,7 @@ namespace geode
117117
bool DegenerationImpl< MeshType >::edge_is_degenerated(
118118
index_t edge_index ) const
119119
{
120-
return edge_is_degenerated( edge_index, GLOBAL_EPSILON );
120+
return edge_is_smaller_than_threshold( edge_index, GLOBAL_EPSILON );
121121
}
122122

123123
template < class MeshType >

0 commit comments

Comments
 (0)