Skip to content

Commit 51f1dfe

Browse files
committed
change condition
1 parent cadf73a commit 51f1dfe

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/geode/mesh/helpers/repair_polygon_orientations.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,26 @@ namespace
8383
{
8484
continue;
8585
}
86-
if( visited[adj->polygon_id] )
87-
{
88-
OPENGEODE_DATA_EXCEPTION(
89-
cur_polygon_reorient
90-
== reorient_polygon_[adj->polygon_id],
91-
"[RepairPolygonOrientations] Mobius strip "
92-
"detected, polygons orientations can not be "
93-
"repaired" );
94-
continue;
95-
}
9686
const auto e_next = e == vertices.size() - 1 ? 0 : e + 1;
9787
const auto adj_vertices =
9888
mesh_.polygon_edge_vertices( adj.value() );
9989
const auto same_orientation =
10090
( vertices[e] == adj_vertices[1]
10191
&& 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+
}
102106
const auto adj_polygon = adj->polygon_id;
103107
visited[adj_polygon] = true;
104108
reorient_polygon_[adj_polygon] =

0 commit comments

Comments
 (0)