Merge branch 'Fixed_modified_butterfly_crash' into 'master'

Fixed a crash in the modified butterfly subdivider with vertices with valance larger than 30.

See merge request OpenMesh/OpenMesh!300
This commit is contained in:
Jan Möbius
2021-02-16 14:34:41 +00:00
4 changed files with 39 additions and 0 deletions

View File

@@ -29,8 +29,14 @@
<li>OM Writer: Removed debug output</li>
</ul>
<b>Tools</b>
<ul>
<li>Subdivider: Fixed crash in ModifiedButterfly subdivider (When vertex with valence > 30 was present)</li>
</ul>
<b>Build System</b>
<ul>
<li>Set cmake project info correctly</li>
<li>Dropped 32-bit Windows continuous integration and artifact builds.</li>
<li>Removed the VERSION file and do it via cmakes project call)
<li>Switched to external cmake-library used by all of our projects now</li>

View File

@@ -179,6 +179,17 @@ protected:
///TODO:Implement fixed positions
// Compute the maximal vertex valence in the mesh
unsigned int maxValence = 0;
for ( auto vertex : _m.vertices() ) {
maxValence = std::max(maxValence,_m.valence(vertex));
}
// We pre initialized with 30. If it's larger, we update the weights
if (maxValence >= 30) {
init_weights( maxValence + 1 );
}
// Do _n subdivisions
for (size_t i=0; i < _n; ++i)
{

Binary file not shown.

View File

@@ -1027,6 +1027,28 @@ TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly) {
TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly_cylinder) {
mesh_.clear();
OpenMesh::IO::read_mesh(mesh_, "cylinder.om");
// Initialize subdivider
OpenMesh::Subdivider::Uniform::ModifiedButterflyT<Mesh> butter;
// Check setup
EXPECT_EQ(66u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(128u, mesh_.n_faces() ) << "Wrong number of faces";
// Execute 3 subdivision steps
butter( mesh_,3,true );
// Check setup
EXPECT_EQ(4098u, mesh_.n_vertices() ) << "Wrong number of vertices after subdivision with loop";
EXPECT_EQ(8192u, mesh_.n_faces() ) << "Wrong number of faces after subdivision with loop";
}
TEST_F(OpenMeshSubdividerUniform_Triangle, Modified_Butterfly_delete_vertex) {
for (bool collect_garbage : { false, true })