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

possible crit not working and erosion fix

parents 31bac7cd 6e9968ff
...@@ -8,3 +8,4 @@ build ...@@ -8,3 +8,4 @@ build
CTestTestfile.cmake CTestTestfile.cmake
libMAIN_SOURCES.a libMAIN_SOURCES.a
test test
.clangd/
#include "GVDIC.h" #include "GVDIC.h"
#include <cmath>
#include "utils.h"
////////// //////////
// AUX // AUX
...@@ -76,6 +78,7 @@ void GVDIC::CellDataC::clear_cell() { ...@@ -76,6 +78,7 @@ void GVDIC::CellDataC::clear_cell() {
//adds cell n to a set depending on value. //adds cell n to a set depending on value.
//this fuction builds sets of cells to add, to delete and to update the GVD //this fuction builds sets of cells to add, to delete and to update the GVD
void GVDIC::set_voro(bool value, pos n) { void GVDIC::set_voro(bool value, pos n) {
//cout<<"sv "<<n<<" : "<<value<<endl;
CellDataO& n_cd = cell_data_o[n]; CellDataO& n_cd = cell_data_o[n];
// cout<<"Celda: "<<n<<" valor: "<<value<<endl; // cout<<"Celda: "<<n<<" valor: "<<value<<endl;
if (value) { if (value) {
...@@ -412,7 +415,8 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) { ...@@ -412,7 +415,8 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) {
} }
} }
} }
cout<<"erosion"<<endl;
print_property(inserted,gt);
while (!erosion_queue.empty()) { while (!erosion_queue.empty()) {
pos p = erosion_queue.top().second; pos p = erosion_queue.top().second;
erosion_queue.pop(); erosion_queue.pop();
...@@ -420,6 +424,7 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) { ...@@ -420,6 +424,7 @@ boost::tuple<pos_set, pos_set> GVDIC::erosion(pos_set voro_to_true) {
if (cell_data_o[p].obsts.size() < 2 && A(p) <= 1) { if (cell_data_o[p].obsts.size() < 2 && A(p) <= 1) {
cell_data_o[p].is_voro = false; cell_data_o[p].is_voro = false;
if(is_elem(gvd.full_graph, p)){ if(is_elem(gvd.full_graph, p)){
distance_update.erase(p);
to_erase.insert(p); to_erase.insert(p);
} }
} else { } else {
...@@ -451,9 +456,17 @@ pos_set GVDIC::get_to_update_min(pos_set to_change){ ...@@ -451,9 +456,17 @@ pos_set GVDIC::get_to_update_min(pos_set to_change){
} }
void GVDIC::update_gvd() { void GVDIC::update_gvd() {
pos_set to_add_gvd, to_erase_gvd, to_update_gvd, to_update_min; pos_set to_add_gvd, to_erase_gvd, to_update_gvd, to_update_min, erosion_input;
boost::tie(to_add_gvd, to_erase_gvd) = erosion(voro_to_true); //cout<<"voro_to_true"<<endl;
//print_property(voro_to_true,gt);
//cout<<"voro_to_false"<<endl;
//print_property(voro_to_false,gt);
//cout<<"distance_update"<<endl;
//print_property(distance_update,gt);
erosion_input.insert(voro_to_true.begin(), voro_to_true.end());
erosion_input.insert(distance_update.begin(), distance_update.end());
boost::tie(to_add_gvd, to_erase_gvd) = erosion(erosion_input);
to_erase_gvd.insert(voro_to_false.begin(), voro_to_false.end()); to_erase_gvd.insert(voro_to_false.begin(), voro_to_false.end());
pos_set aux_min; pos_set aux_min;
......
...@@ -15,6 +15,7 @@ class GVDIC { ...@@ -15,6 +15,7 @@ class GVDIC {
struct CellDataO { struct CellDataO {
float dist; float dist;
float dist_old;
pos_set parents; pos_set parents;
pos_set obsts; pos_set obsts;
......
...@@ -333,7 +333,44 @@ vector<grid> test_7 = { ...@@ -333,7 +333,44 @@ vector<grid> test_7 = {
{Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied}}, {Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied, Occupied}},
}; };
vector<vector<grid>> tests = {test_1, test_2, test_3, test_4, test_5, test_6, test_7}; vector<grid> test_8 = {
{
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Occupied, Occupied, Occupied, Free , Free , Unknown},
{Unknown, Unknown , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Occupied, Occupied, Occupied, Unknown, Unknown, Unknown},
{Occupied, Occupied, Occupied, Occupied, Unknown , Unknown , Unknown, Unknown, Unknown},
},
{
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Occupied, Occupied, Occupied, Free , Free , Unknown},
{Unknown, Unknown , Free , Free , Occupied, Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Occupied, Free , Free , Free , Unknown},
{Occupied, Free , Free , Occupied, Occupied, Occupied, Unknown, Unknown, Unknown},
{Occupied, Occupied, Occupied, Occupied, Unknown , Unknown , Unknown, Unknown, Unknown},
},
{
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Unknown , Unknown , Unknown , Unknown, Unknown, Unknown},
{Unknown, Unknown , Unknown , Occupied, Occupied, Occupied, Free , Free , Unknown},
{Unknown, Unknown , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Free , Free , Free , Free , Free , Unknown},
{Occupied, Free , Free , Occupied, Occupied, Occupied, Unknown, Unknown, Unknown},
{Occupied, Occupied, Occupied, Occupied, Unknown , Unknown , Unknown, Unknown, Unknown},
},
};
vector<vector<grid>> tests = {test_1, test_2, test_3, test_4, test_5, test_6, test_7, test_8};
#define RESET "\033[0m" #define RESET "\033[0m"
#define BLACK "\033[30m" /* Black */ #define BLACK "\033[30m" /* Black */
......
Supports Markdown
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