Use SHalfedge handle instead of repeated vector lookup

This commit is contained in:
Giles Bathgate 2021-02-27 11:58:01 +00:00
parent 1a040c8552
commit fed29a6b85
2 changed files with 17 additions and 18 deletions

View File

@ -116,7 +116,8 @@ class SNC_indexed_items {
init_ifacet = sl.init_ifacet;
return *this;
}
int new_index()
{ index = Index_generator::get_unique_index(); return index; }
void set_index(int idx = Index_generator::get_unique_index())
{ index = idx; }
int get_index() const { return index; }
@ -151,7 +152,8 @@ class SNC_indexed_items {
init_ifacet = se.init_ifacet;
return *this;
}
int new_index()
{ index = index2 = Index_generator::get_unique_index(); return index; }
void set_index(int idx = Index_generator::get_unique_index())
{ index = index2 = idx; }
int get_index() const {
@ -186,7 +188,8 @@ class SNC_indexed_items {
index = sv.index;
return *this;
}
int new_index()
{ index = Index_generator::get_unique_index(); return index; }
void set_index(int idx = Index_generator::get_unique_index())
{ index = idx; }
int get_index() const { return index; }

View File

@ -148,26 +148,22 @@ public:
for(face_descriptor fi : faces(P)) {
Halfedge_around_facet_const_circulator
fc(halfedge(fi,P),P), end(fc);
typename boost::property_traits<HalfedgeIndexMap>::value_type
index = get(him,*fc);
hash[index]->set_index();
hash[index]->twin()->set_index();
hash[index]->twin()->source()->set_index();
int se = hash[index]->get_index();
int set = hash[index]->twin()->get_index();
int sv = hash[index]->twin()->source()->get_index();
SHalfedge_handle s = hash[get(him,*fc)];
int se = s->new_index();
int set = s->twin()->new_index();
int sv = s->twin()->source()->new_index();
++fc;
CGAL_For_all(fc, end) {
index = get(him,*fc);
hash[index]->set_index(se);
hash[index]->twin()->set_index(set);
hash[index]->source()->set_index(sv);
hash[index]->twin()->source()->set_index();
sv = hash[index]->twin()->source()->get_index();
SHalfedge_handle n = hash[get(him,*fc)];
n->set_index(se);
n->twin()->set_index(set);
n->source()->set_index(sv);
sv = n->twin()->source()->new_index();
}
hash[get(him,*fc)]->source()->set_index(sv);
s->source()->set_index(sv);
}
}
};