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

erase still not working

parent 5a9a7e74
......@@ -304,13 +304,37 @@ struct collapsedGraph : genericGraph<graph> {
// 1. erase from collapsed
if (is_uncollapsed(p)) {
super::erase_v(p);
}else{
pos_set adj_p = full_neighbors(p);
bool to_erased = true;
//for each neighbors of p
for(auto it_n = adj_p.begin(); it_n != adj_p.end(); it_n++){
pos n = (*it_n);
//if is uncollapsed, i have to delete edge in the direction of p
if(is_uncollapsed(n)){
AdjacencyIterator it, it_end;
// search neighbor of n in the direction of p
for (boost::tie(it, it_end) = super::neighbors(n); it != it_end; it++) {
pos nn = this->g[*it].p;
// if p and the "neighbor of the neighbor of p" have the same dir and sense
if (angle(p - n) == angle(nn - n)) {
super::erase_e(n, nn);
// if is not adj of p, i have to delete nn->n
if(adj_p.find(nn) == adj_p.end()){
super::erase_e(nn, n);
}
break;
}
}
}
}
}
// 2. collapse neighbors of p if possible
collapse_neighbors(p);
// 3. uncolloapse collapsed neighbors of p
// 2. uncolloapse collapsed neighbors of p
uncollapse_neighbors(p);
// 3. collapse neighbors of p if possible
collapse_neighbors(p);
}
void add_v(pos p) {
......
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