l-push cases 5 & 6 ok.

This commit is contained in:
Guillaume Damiand 2018-03-28 17:42:34 +02:00
parent c8cdf75b8b
commit e4afaf5ea5
3 changed files with 53 additions and 2 deletions

View File

@ -173,6 +173,24 @@ void generate_l_shape_case4(Path& p)
extend_straight_negative(p, 2);
}
template<typename Path>
void generate_l_shape_case5(Path& p)
{ // (x -1 -2^t): here (-4 -1 -2^12)
p.clear();
p.push_back(p.get_map().darts().iterator_to(p.get_map().darts()[27]));
extend_uturn_negative(p, 1);
extend_straight_negative(p, 12);
}
template<typename Path>
void generate_l_shape_case6(Path& p)
{ // (x -2^t -1): here (-4 -2^12 -1)
p.clear();
p.push_back(p.get_map().darts().iterator_to(p.get_map().darts()[13]));
extend_straight_negative(p, 12);
extend_uturn_negative(p, 1);
}
template<typename Path>
void generate_l_shape_case7(Path& p)
{ // (-3 -2^s -1 -2^t): here (-2^7 -1 -2^3 -3)

View File

@ -509,6 +509,7 @@ public:
}
}
while(next_turn==2);
begin=next_index(begin); // because we stopped on a dart s.t. next_turn!=2
}
// Here begin is the first dart of the path s.t. next_turn==-2
// i.e. the previous turn != -2

View File

@ -298,6 +298,7 @@ bool test_all_cases_spurs_and_bracket()
res=false;
}
// TODO Update spiral-squared.off to have only square
lcc.clear();
if (!CGAL::load_off(lcc, "./data/spiral-squared.off"))
{
@ -327,6 +328,7 @@ bool test_all_cases_spurs_and_bracket()
res=false;
}
// TODO Update loop-squared.off to have only square
lcc.clear();
if (!CGAL::load_off(lcc, "./data/loop-squared.off"))
{
@ -413,8 +415,7 @@ bool test_all_cases_l_shape()
generate_l_shape_case4(path);
// std::cout<<"Case 4: L-shape (-4 -2^7 -1 -2^3): "<<std::flush;
path.display_pos_and_neg_turns();std::cout<<std::endl;
push_l_shape(path, true, 1);
push_l_shape(path, false, 1);
if (!path.same_turns("4 1 2 2 2 2 2 2 3 2 2 1"))
{
std::cout<<"[test_all_cases_l_shape case 4] ERROR: ";
@ -423,6 +424,37 @@ bool test_all_cases_l_shape()
res=false;
}
lcc.clear();
if (!CGAL::load_off(lcc, "./data/cases5-6-right-shift-squared.off"))
{
std::cout<<"PROBLEM reading file ./data/cases5-6-right-shift-squared.off"<<std::endl;
exit(EXIT_FAILURE);
}
lcc.reverse_orientation();
generate_l_shape_case5(path);
// std::cout<<"Case 5: L-shape (-4 -1 -2^12): "<<std::flush;
path.display_pos_and_neg_turns();std::cout<<std::endl;
push_l_shape(path, true, 1);
if (!path.same_turns("4 2 2 2 2 2 2 2 2 2 2 2 2 1"))
{
std::cout<<"[test_all_cases_l_shape case 5] ERROR: ";
std::cout<<"we obtained "; path.display_pos_and_neg_turns();
std::cout<<" instead of (4 2 2 2 2 2 2 2 2 2 2 2 2 1)"<<std::endl;
res=false;
}
generate_l_shape_case6(path);
// std::cout<<"Case 6: L-shape (-4 -2^12 -1): "<<std::flush;
push_l_shape(path, false, 1);
if (!path.same_turns("4 1 2 2 2 2 2 2 2 2 2 2 2 2"))
{
std::cout<<"[test_all_cases_l_shape case 6] ERROR: ";
std::cout<<"we obtained "; path.display_pos_and_neg_turns();
std::cout<<" instead of (4 1 2 2 2 2 2 2 2 2 2 2 2 2)"<<std::endl;
res=false;
}
// path.display_pos_and_neg_turns();std::cout<<std::endl;
return res;
}