Skip to content

Commit 01dd9e0

Browse files
Merge pull request #1167 from Geode-solutions/fix-repair-polygon-orientations
fix(RepairPolygonsOrientation): detect cases not orientable
2 parents cc3c549 + 51f1dfe commit 01dd9e0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/geode/mesh/helpers/repair_polygon_orientations.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace
7979
{
8080
const auto adj =
8181
mesh_.polygon_adjacent_edge( { cur_polygon, e } );
82-
if( !adj || visited[adj->polygon_id] )
82+
if( !adj )
8383
{
8484
continue;
8585
}
@@ -89,6 +89,20 @@ namespace
8989
const auto same_orientation =
9090
( vertices[e] == adj_vertices[1]
9191
&& vertices[e_next] == adj_vertices[0] );
92+
if( visited[adj->polygon_id] )
93+
{
94+
const auto is_valid =
95+
same_orientation
96+
? cur_polygon_reorient
97+
== reorient_polygon_[adj->polygon_id]
98+
: cur_polygon_reorient
99+
!= reorient_polygon_[adj->polygon_id];
100+
OPENGEODE_DATA_EXCEPTION( is_valid,
101+
"[RepairPolygonOrientations] Mobius "
102+
"strip detected, polygons orientations "
103+
"can not be repaired" );
104+
continue;
105+
}
92106
const auto adj_polygon = adj->polygon_id;
93107
visited[adj_polygon] = true;
94108
reorient_polygon_[adj_polygon] =

0 commit comments

Comments
 (0)