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

imporved comments

parent 63c35f91
......@@ -176,6 +176,7 @@ struct collapsedGraph : genericGraph<graph> {
[this](int deg, pos n) { return deg + is_elem(full_graph, n); });
}
// neighbors of p that belongs to full gvd (uncollapse gvd)
pos_set full_neighbors(pos p){
pos_set adj_p = all_adj(p);
pos_set f_neighbors;
......@@ -194,12 +195,13 @@ struct collapsedGraph : genericGraph<graph> {
// vertex is collapsed
bool is_collapsed(pos p) { return is_elem(full_graph, p) && !is_elem(this->positions, p); }
// TODO
bool is_collapsable(pos p) {
//check degree
if(deg(p) != 2){
return false;
}
//check neighbors
pos_set f_neighbors = full_neighbors(p);
auto it_n = f_neighbors.begin();
pos n1 = (*it_n);
......@@ -207,12 +209,14 @@ struct collapsedGraph : genericGraph<graph> {
it_n++;
pos n2 = (*it_n);
pos dir2 = n2 - p;
// check direction of neighbors and local min condition
return same_direction(dir1,dir2) && !is_local_min[p];
}
bool is_uncollapsable(pos p) { return !is_collapsable(p); }
// get
// gets uncollpased neighbor of a collapsed node p on a direction dir
pos get_uncollapsed_neighbor(pos p, pos dir) {
for (p += dir; !is_uncollapsed(p); p += dir){
//cout<<p<<endl;
......@@ -254,7 +258,7 @@ struct collapsedGraph : genericGraph<graph> {
}
}
// TODO
// precond: p is collapsable
void collapse(pos p) {
//cout<<"collapsing p "<<p<<endl;
AdjacencyIterator it, it_end;
......@@ -294,7 +298,6 @@ struct collapsedGraph : genericGraph<graph> {
}
}
// Los vecinos de los vecinos de un nodo p, que se agrega o se remueve no van a colapsarse o descolapsarse. Solo los vecinos del grafo full.
void erase_v(pos p) {
if (!is_elem(full_graph, p)) {
//cout<<"ENTRE AL ERASE CON ALGO MAL"<<endl;
......@@ -343,7 +346,6 @@ struct collapsedGraph : genericGraph<graph> {
return;
}
// TODO may not be true (adding an aleardy added)
// 0. uncolloapse collapsed neighbors of p
//cout<<"PASO 0 CON P: "<<p<<endl;
uncollapse_neighbors(p, true);
......@@ -392,10 +394,7 @@ struct collapsedGraph : genericGraph<graph> {
void add_v(pos_set to_add) {
for (auto it = to_add.begin(); it != to_add.end(); it++) {
//pos p = *it;
add_v(*it); //TODO descomentar esto y borrar lo de abajo (lo hice para probar)
//super::add_v(p);
//full_graph.insert(p);
add_v(*it);
}
}
};
......
......@@ -73,11 +73,10 @@ void GVDIC::CellDataC::clear_cell() {
// UPDATE DISTANCE MAP
///////////////////////////
//adds cell n to a set depending on value.
//this fuction builds sets of cells to add, to delete and to update the GVD
void GVDIC::set_voro(bool value, pos n) {
CellDataO& n_cd = cell_data_o[n];
//coment this if
//if (!value && !n_cd.is_voro)
//return;
// cout<<"Celda: "<<n<<" valor: "<<value<<endl;
if (value) {
if (!is_elem(gvd.full_graph, n)){
......@@ -87,14 +86,13 @@ void GVDIC::set_voro(bool value, pos n) {
distance_update.insert(n);
voro_to_false.erase(n);
}
// TODO maybe there is a more efficient way to control the changes
} else {
if (is_elem(gvd.full_graph, n)){
voro_to_false.insert(n);
}else{
distance_update.erase(n);
voro_to_true.erase(n);
} // TODO maybe there is a more efficient way to control the changes
}
}
n_cd.is_voro = value;
}
......@@ -111,8 +109,8 @@ void GVDIC::check_voro(pos s, pos n) {
}
pos obst_n = *n_cd.obsts.begin();
pos obst_s = *s_cd.obsts.begin();
// lo de adjacente no se fija que sea mayor a o la cant de obst de s
auto adj_n = adj(gt, obst_n);
if (is_occ(n_cd.obsts) && (obst_n != obst_s) && !is_elem(adj_n, obst_s)) {
if ((dist(s, obst_n) <= dist(n, obst_s)) && s_cd.dist > 0) {
set_voro(true, s);
......@@ -424,7 +422,6 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) {
to_erase.insert(p);
} else {
//if is !in full
//to_add.insert(p);
if (!is_elem(gvd.full_graph, p)){
to_add.insert(p);
}
......@@ -474,7 +471,7 @@ void GVDIC::update_gvd() {
gvd.erase_v(*it);
}
//set de cosas a agregar
// add set of v to gvd
gvd.add_v(to_add_gvd);
// update
......@@ -485,7 +482,6 @@ void GVDIC::update_gvd() {
//cout<<"updatea un vertice"<<endl;
gvd.update_v(*it);
}
//gvd.update_v(*it);
}
update_possible_crit(to_add_gvd, to_erase_gvd);
......
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