Commit 4489169d authored by Federico Ciuffardi's avatar Federico Ciuffardi
Browse files

possible_crit refactored

parent 009b7fdf
......@@ -109,23 +109,6 @@ void GVDIC::CellDataO::clear_cell() {
obsts.clear();
}
// CellDataC
GVDIC::CellDataC::CellDataC() {
dist = MAXFLOAT;
is_possible_crit = false;
parents.insert(NULL_POS);
is_cleared = true;
to_raise = false;
}
void GVDIC::CellDataC::clear_cell() {
dist = MAXFLOAT;
is_possible_crit = false;
is_cleared = true;
parents.clear();
obsts.clear();
}
/////////////////////////////
// UPDATE DISTANCE MAP
///////////////////////////
......@@ -628,22 +611,21 @@ 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++) {
pos p = *it;
if (cell_data_c[p].is_possible_crit) {
possible_crit_to_false.insert(p);
}
possible_crit.erase(p);
}
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 = is_elem(possible_crit,p);
bool is_possible_crit_new = deg(p) == 2 && is_local_min(p) && has_neighbour_of_deg(p, 3);
cell_data_c[p].is_possible_crit = is_possible_crit_new;
if (is_possible_crit_new) {
if (!is_possible_crit_old) {
possible_crit_to_true.insert(p);
possible_crit.insert(p);
}
} else {
if (is_possible_crit_old) {
possible_crit_to_false.insert(p);
possible_crit.erase(p);
}
}
}
......@@ -681,6 +663,14 @@ boost::tuple<criticals_info, GVD> GVDIC::get_points_of_interest(grid gt) {
update_frontiers(unk_to_notunk);
update_obstacle_distance_map(obs_to_free, any_to_obs, unk_to_free);
update_gvd();
// cout<<"possible_crit_to_true"<<endl;
// print_property(possible_crit_to_true,gt);
// cout<<"possible_crit_to_false"<<endl;
// print_property(possible_crit_to_false,gt);
// cout<<"possible_crit"<<endl;
// print_property(possible_crit,gt);
update_possible_crit_distance_map();
// post increment
......
......@@ -31,20 +31,6 @@ class GVDIC {
void clear_cell();
};
struct CellDataC {
float dist;
pos_set parents;
pos_set obsts;
bool to_raise;
bool is_cleared;
bool is_possible_crit;
CellDataC();
void clear_cell();
};
grid old_gt;
grid gt;
......@@ -98,7 +84,6 @@ class GVDIC {
collapsedGVD gvd;
boost::unordered_map<pos, CellDataO> cell_data_o;
boost::unordered_map<pos, CellDataC> cell_data_c;
boost::tuple<criticals_info, GVD> get_points_of_interest(grid gt);
pos_set voro_to_false;
......@@ -110,5 +95,7 @@ class GVDIC {
pos_set possible_crit_to_false;
pos_set possible_crit_to_true;
pos_set possible_crit;
};
#endif
......@@ -352,6 +352,15 @@ vector<grid> test_8 = {
{Free , Free , Free , Free , Occupied, Free , Free ,Free , Free },
{Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied,Occupied, Occupied},
},
{
{Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied,Occupied, Occupied},
{Free , Free , Free , Free , Occupied, Free , Free ,Free , Free },
{Free , Free , Free , Free , Occupied, Free , Free ,Free , Free },
{Free , Free , Free , Free , Free , Free , Free ,Free , Free },
{Free , Free , Free , Free , Occupied, Free , Free ,Free , Free },
{Free , Free , Free , Free , Occupied, Free , Free ,Free , Free },
{Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied,Occupied, Occupied},
},
{
{Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied,Occupied, Occupied},
{Free , Free , Free , Free , Free , Free , Free ,Free , Free },
......
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