Merge pull request #1143 from janetournois/PMP-isotropic_remeshing_speedup-jtournois

PMP isotropic_remeshing speedup. Don't use the MESH Halfedge_status
This commit is contained in:
Sebastien Loriot 2016-06-09 16:21:09 +02:00
commit aeab78c74b
1 changed files with 25 additions and 29 deletions

View File

@ -514,7 +514,6 @@ namespace internal {
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG
CGAL_expensive_assertion(is_triangle_mesh(mesh_)); CGAL_expensive_assertion(is_triangle_mesh(mesh_));
CGAL_assertion(halfedge_status_map_.size() == nb_valid_halfedges());
debug_status_map(); debug_status_map();
debug_self_intersections(); debug_self_intersections();
#endif #endif
@ -679,8 +678,6 @@ namespace internal {
fix_degenerate_faces(vkept, short_edges, sq_low); fix_degenerate_faces(vkept, short_edges, sq_low);
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG
CGAL_assertion_code(std::size_t nbb = nb_valid_halfedges());
CGAL_assertion(nbb == halfedge_status_map_.size());
debug_status_map(); debug_status_map();
CGAL_assertion(!incident_to_degenerate(halfedge(vkept, mesh_))); CGAL_assertion(!incident_to_degenerate(halfedge(vkept, mesh_)));
#endif #endif
@ -706,7 +703,6 @@ namespace internal {
#endif #endif
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG
CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
CGAL_expensive_assertion(is_triangle_mesh(mesh_)); CGAL_expensive_assertion(is_triangle_mesh(mesh_));
debug_status_map(); debug_status_map();
debug_self_intersections(); debug_self_intersections();
@ -759,7 +755,6 @@ namespace internal {
CGAL_assertion_code(Halfedge_status s2o = status(opposite(he, mesh_))); CGAL_assertion_code(Halfedge_status s2o = status(opposite(he, mesh_)));
CGAL_assertion(s1 == s2 && s1 == PATCH); CGAL_assertion(s1 == s2 && s1 == PATCH);
CGAL_assertion(s1o == s2o && s1o == PATCH); CGAL_assertion(s1o == s2o && s1o == PATCH);
CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
CGAL_assertion(!is_border(he, mesh_)); CGAL_assertion(!is_border(he, mesh_));
CGAL_assertion( CGAL_assertion(
@ -802,7 +797,6 @@ namespace internal {
#endif #endif
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG
CGAL_assertion(nb_valid_halfedges() == halfedge_status_map_.size());
debug_status_map(); debug_status_map();
CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_ CGAL_assertion(0 == PMP::remove_degenerate_faces(mesh_
, PMP::parameters::vertex_point_map(vpmap_) , PMP::parameters::vertex_point_map(vpmap_)
@ -1319,9 +1313,7 @@ private:
{ {
//being part of the border of the mesh is predominant //being part of the border of the mesh is predominant
if (is_border(h, mesh_)) if (is_border(h, mesh_))
halfedge_status_map_[h] = MESH_BORDER; //erase previous value if exists set_status(h, MESH_BORDER); //erase previous value if exists
else
halfedge_status_map_[h] = MESH;
} }
//tag PATCH, //h and hopp belong to the patch to be remeshed //tag PATCH, //h and hopp belong to the patch to be remeshed
@ -1330,7 +1322,7 @@ private:
BOOST_FOREACH(halfedge_descriptor h, BOOST_FOREACH(halfedge_descriptor h,
halfedges_around_face(halfedge(f, mesh_), mesh_)) halfedges_around_face(halfedge(f, mesh_), mesh_))
{ {
halfedge_status_map_[h] = PATCH; set_status(h, PATCH);
} }
} }
@ -1346,16 +1338,14 @@ private:
{ {
//deal with h and hopp for borders that are sharp edges to be preserved //deal with h and hopp for borders that are sharp edges to be preserved
halfedge_descriptor h = halfedge(e, mesh_); halfedge_descriptor h = halfedge(e, mesh_);
if (halfedge_status_map_[h] == PATCH) if (status(h) == PATCH)
halfedge_status_map_[h] = PATCH_BORDER; set_status(h, PATCH_BORDER);
halfedge_descriptor hopp = opposite(h, mesh_); halfedge_descriptor hopp = opposite(h, mesh_);
if (halfedge_status_map_[hopp] == PATCH) if (status(hopp) == PATCH)
halfedge_status_map_[hopp] = PATCH_BORDER; set_status(hopp, PATCH_BORDER);
} }
} }
CGAL_assertion(halfedge_status_map_.size() == nb_valid_halfedges());
} }
Halfedge_status status(const halfedge_descriptor& h) const Halfedge_status status(const halfedge_descriptor& h) const
@ -1364,17 +1354,23 @@ private:
halfedge_descriptor, Halfedge_status >::const_iterator halfedge_descriptor, Halfedge_status >::const_iterator
it = halfedge_status_map_.find(h); it = halfedge_status_map_.find(h);
if (it == halfedge_status_map_.end()) if (it == halfedge_status_map_.end())
std::cout << "Something goes wrong with status function" << std::endl; return MESH;
CGAL_assertion(it != halfedge_status_map_.end());
return it->second; return it->second;
} }
void set_status(const halfedge_descriptor& h,
const Halfedge_status& s)
{
if (s == MESH)
halfedge_status_map_.erase(h);
else
halfedge_status_map_[h] = s;
}
void merge_status(const halfedge_descriptor& en, void merge_status(const halfedge_descriptor& en,
const Halfedge_status& s_epo, const Halfedge_status& s_epo,
const Halfedge_status& s_ep) const Halfedge_status& s_ep)
{ {
CGAL_assertion(halfedge_status_map_.find(en) != halfedge_status_map_.end());
//get missing data //get missing data
halfedge_descriptor eno = opposite(en, mesh_); halfedge_descriptor eno = opposite(en, mesh_);
Halfedge_status s_eno = status(eno); Halfedge_status s_eno = status(eno);
@ -1387,8 +1383,8 @@ private:
|| s_epo == PATCH_BORDER || s_epo == PATCH_BORDER
|| s_ep == PATCH_BORDER) || s_ep == PATCH_BORDER)
{ {
halfedge_status_map_[en] = s_epo; set_status(en, s_epo);
halfedge_status_map_[eno] = s_ep; set_status(eno, s_ep);
} }
// else keep current status for en and eno // else keep current status for en and eno
} }
@ -1445,13 +1441,13 @@ private:
CGAL_assertion_code(++nb_done); CGAL_assertion_code(++nb_done);
//update halfedge_status_map_ //update halfedge_status_map_
halfedge_status_map_[h_ab] = merge_status(h_ab, hf, hfo); set_status(h_ab, merge_status(h_ab, hf, hfo));
halfedge_status_map_[h_ca] = merge_status(h_ca, hf, hfo); set_status(h_ca, merge_status(h_ca, hf, hfo));
halfedge_status_map_[hf] = if (is_on_patch(h_ca) || is_on_patch_border(h_ca))
(is_on_patch(h_ca) || is_on_patch_border(h_ca)) {
? PATCH set_status(hf, PATCH);
: MESH; set_status(hfo, PATCH);
halfedge_status_map_[hfo] = status(hf); }
#ifdef CGAL_PMP_REMESHING_DEBUG #ifdef CGAL_PMP_REMESHING_DEBUG
debug_status_map(); debug_status_map();
#endif #endif