Commit ac9072f0 authored by Romina Julieta Parada Venossa's avatar Romina Julieta Parada Venossa
Browse files

fix erosion insertion to_erase

parent bf1f8a3c
......@@ -300,7 +300,7 @@ struct collapsedGraph : genericGraph<graph> {
void erase_v(pos p) {
if (!is_elem(full_graph, p)) {
//cout<<"ENTRE AL ERASE CON ALGO MAL"<<endl;
//cout<<"ENTRE AL ERASE CON ALGO MAL: "<<p<<endl;
return;
}
//cout<<"ENTRO AL ERASE V CON P: "<<p<<endl;
......
......@@ -419,7 +419,9 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) {
// cout<<p<<" obsts "<<cell_data_o[p].obsts.size() <<"| A " <<A(p) <<endl;
if (cell_data_o[p].obsts.size() < 2 && A(p) <= 1) {
cell_data_o[p].is_voro = false;
to_erase.insert(p);
if(is_elem(gvd.full_graph, p)){
to_erase.insert(p);
}
} else {
//if is !in full
if (!is_elem(gvd.full_graph, p)){
......@@ -484,7 +486,7 @@ void GVDIC::update_gvd() {
}
}
update_possible_crit(to_add_gvd, to_erase_gvd);
update_possible_crit(to_update_min, to_erase_gvd);
}
/////////////////////////////
......@@ -523,6 +525,10 @@ bool GVDIC::has_neighbour_of_deg(pos p, int deg) {
return ret;
}
// builds two collections, possible_crit_to_true and possible_crit_to_false
// in possible_crit_to_true are cells that are now possible crits to conssider
// in possible_crit_to_true are cells that are no longer possible crits and
// have to be removed from the distance map
void GVDIC::update_possible_crit(pos_set to_add_gvd, pos_set to_erase_gvd) {
pos_set to_add_pc, to_erase_pc;
for (auto it = to_erase_gvd.begin(); it != to_erase_gvd.end(); it++) {
......@@ -533,7 +539,7 @@ void GVDIC::update_possible_crit(pos_set to_add_gvd, pos_set to_erase_gvd) {
}
for (auto it = to_add_gvd.begin(); it != to_add_gvd.end(); it++) {
pos p = *it;
bool is_possible_crit_old = !cell_data_c[p].is_possible_crit;
bool is_possible_crit_old = cell_data_c[p].is_possible_crit;
bool is_possible_crit_new = deg(p) == 2 && is_local_min(p) && has_neighbour_of_deg(p, 3);
if (is_possible_crit_new) {
if (!is_possible_crit_old) {
......@@ -555,6 +561,7 @@ boost::tuple<criticals_info, GVD> GVDIC::get_points_of_interest(grid gt) {
// pre increment
voro_to_true.clear();
voro_to_false.clear();
distance_update.clear();
frontier_to_true.clear();
frontier_to_false.clear();
......
No preview for this file type
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