Skip to content

Commit e3e7bf7

Browse files
committed
Fix triwild + add integration test.
1 parent 2ce67a9 commit e3e7bf7

8 files changed

Lines changed: 337 additions & 388 deletions

File tree

cmake/wmtk_data.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ExternalProject_Add(
1616
SOURCE_DIR ${WMTK_DATA_ROOT}
1717

1818
GIT_REPOSITORY https://github.com/wildmeshing/data2.git
19-
GIT_TAG 36bb3968aa1e685d3da2e38b87bc6fa5ab328a13
19+
GIT_TAG fc5576bb4d6444776911f16b8b4bdde94c5c9b1a
2020

2121
CONFIGURE_COMMAND ""
2222
BUILD_COMMAND ""

components/triwild/wmtk/components/triwild/EdgeCollapsing.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,24 @@ bool TriWildMesh::collapse_edge_before(const Tuple& loc) // input is an edge
112112
return false; // do not collapse away from surface
113113
}
114114

115-
if (m_params.preserve_topology && get_order_of_vertex(v1_id) > 1) {
116-
return false; // do not move singular/boundary vertices
115+
if (VA[v1_id].m_is_rounded && get_order_of_vertex(v1_id) > 1 &&
116+
get_order_of_vertex(v2_id) <= 1) {
117+
/**
118+
* In general, we don't want to collapse away from feature vertices. It is always fine
119+
* to collapse into a feature vertex, though. However, we allow to feature vertices to
120+
* be collapsed.
121+
*/
122+
return false;
123+
}
124+
125+
// if both vertices are on the surface, the collapsing edge should be inside the envelope
126+
const size_t eid = loc.eid(*this);
127+
if (VA[v2_id].m_is_on_surface && !m_edge_attribute.at(eid).m_is_surface_fs) {
128+
const Vector2d& p1 = VA[v1_id].m_posf;
129+
const Vector2d& p2 = VA[v2_id].m_posf;
130+
if (m_envelope->is_outside(std::array<Vector2d, 2>{p1, p2})) {
131+
return false;
132+
}
117133
}
118134
}
119135

0 commit comments

Comments
 (0)