Commit 53616eb9 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'delete_vertex_crash_subdivider' into 'master'

Delete vertex crash subdivider

Closes #65

See merge request !219
parents fbe72562 052f5b1e
Pipeline #9631 passed with stages
in 55 minutes and 43 seconds
...@@ -8,6 +8,13 @@ ...@@ -8,6 +8,13 @@
<tr valign=top><td><b>8.1</b> (?/?/?)</td><td> <tr valign=top><td><b>8.1</b> (?/?/?)</td><td>
<b>Tools</b>
<ul>
<li>Subdivider: Fixed crash in Loop subdivider</li>
<li>Subdivider: Fixed crash in ModifiedButterfly subdivider</li>
</ul>
<b>Utils</b> <b>Utils</b>
<ul> <ul>
<li>Change PropertyManager::operator* to access the property value for mesh properties</li> <li>Change PropertyManager::operator* to access the property value for mesh properties</li>
......
...@@ -321,7 +321,7 @@ private: // topological modifiers ...@@ -321,7 +321,7 @@ private: // topological modifiers
typename mesh_t::VertexHandle vh1(_m.to_vertex_handle(heh)); typename mesh_t::VertexHandle vh1(_m.to_vertex_handle(heh));
typename mesh_t::Point midP(_m.point(_m.to_vertex_handle(heh))); typename mesh_t::Point midP(_m.point(_m.to_vertex_handle(heh)));
midP += _m.point(_m.to_vertex_handle(opp_heh)); midP += _m.point(_m.to_vertex_handle(opp_heh));
midP *= static_cast<typename mesh_t::Point::value_type>(0.5); midP *= static_cast<RealType>(0.5);
// new vertex // new vertex
vh = _m.new_vertex( midP ); vh = _m.new_vertex( midP );
...@@ -363,7 +363,11 @@ private: // topological modifiers ...@@ -363,7 +363,11 @@ private: // topological modifiers
_m.set_face_handle( new_heh, _m.face_handle(heh) ); _m.set_face_handle( new_heh, _m.face_handle(heh) );
_m.set_halfedge_handle( vh, new_heh); _m.set_halfedge_handle( vh, new_heh);
_m.set_halfedge_handle( _m.face_handle(heh), heh );
// We cant reconnect a non existing face, so we skip this here if necessary
if ( !_m.is_boundary(heh) )
_m.set_halfedge_handle( _m.face_handle(heh), heh );
_m.set_halfedge_handle( vh1, opp_new_heh ); _m.set_halfedge_handle( vh1, opp_new_heh );
// Never forget this, when playing with the topology // Never forget this, when playing with the topology
...@@ -389,7 +393,7 @@ private: // geometry helper ...@@ -389,7 +393,7 @@ private: // geometry helper
// boundary edge: just average vertex positions // boundary edge: just average vertex positions
if (_m.is_boundary(_eh) ) if (_m.is_boundary(_eh) )
{ {
pos *= static_cast<typename MeshType::Point::value_type>(0.5); pos *= static_cast<RealType>(0.5);
} }
else // inner edge: add neighbouring Vertices to sum else // inner edge: add neighbouring Vertices to sum
{ {
......
...@@ -356,7 +356,11 @@ private: // topological modifiers ...@@ -356,7 +356,11 @@ private: // topological modifiers
_m.set_face_handle( new_heh, _m.face_handle(heh) ); _m.set_face_handle( new_heh, _m.face_handle(heh) );
_m.set_halfedge_handle( vh, new_heh); _m.set_halfedge_handle( vh, new_heh);
_m.set_halfedge_handle( _m.face_handle(heh), heh );
// We cant reconnect a non existing face, so we skip this here if necessary
if ( !_m.is_boundary(heh) )
_m.set_halfedge_handle( _m.face_handle(heh), heh );
_m.set_halfedge_handle( vh1, opp_new_heh ); _m.set_halfedge_handle( vh1, opp_new_heh );
// Never forget this, when playing with the topology // Never forget this, when playing with the topology
...@@ -383,7 +387,7 @@ private: // geometry helper ...@@ -383,7 +387,7 @@ private: // geometry helper
{ {
pos = _m.point(a_0); pos = _m.point(a_0);
pos += _m.point(a_1); pos += _m.point(a_1);
pos *= static_cast<typename mesh_t::Point::value_type>(9.0/16.0); pos *= static_cast<RealType>(9.0/16.0);
typename mesh_t::Point tpos; typename mesh_t::Point tpos;
if(_m.is_boundary(heh)) if(_m.is_boundary(heh))
{ {
...@@ -396,7 +400,7 @@ private: // geometry helper ...@@ -396,7 +400,7 @@ private: // geometry helper
tpos = _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(opp_heh))); tpos = _m.point(_m.to_vertex_handle(_m.next_halfedge_handle(opp_heh)));
tpos += _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(opp_heh)))); tpos += _m.point(_m.to_vertex_handle(_m.opposite_halfedge_handle(_m.prev_halfedge_handle(opp_heh))));
} }
tpos *= static_cast<typename mesh_t::Point::value_type>(-1.0/16.0); tpos *= static_cast<RealType>(-1.0/16.0);
pos += tpos; pos += tpos;
} }
else else
...@@ -499,7 +503,7 @@ private: // geometry helper ...@@ -499,7 +503,7 @@ private: // geometry helper
} }
else //at least one endpoint is [irregular and not in boundary] else //at least one endpoint is [irregular and not in boundary]
{ {
typename mesh_t::Point::value_type normFactor = static_cast<typename mesh_t::Point::value_type>(0.0); RealType normFactor = static_cast<RealType>(0.0);
if(valence_a_0!=6 && !_m.is_boundary(a_0)) if(valence_a_0!=6 && !_m.is_boundary(a_0))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment