mirror of https://github.com/CGAL/cgal
Continue isotopy test.
This commit is contained in:
parent
ed81c8491c
commit
f52676769f
|
|
@ -152,6 +152,10 @@ namespace CGAL {
|
|||
m_map.free_mark(marktemp);
|
||||
m_map.display_darts(std::cout);
|
||||
#endif
|
||||
|
||||
m_map.display_darts(std::cout);
|
||||
|
||||
assert(are_paths_valid());
|
||||
}
|
||||
|
||||
~Combinatorial_map_tools()
|
||||
|
|
@ -168,10 +172,12 @@ namespace CGAL {
|
|||
{
|
||||
if (!m_original_map.is_marked(path[i], m_mark_T))
|
||||
{
|
||||
res.push_back(get_first_dart_of_the_path(path[i]));
|
||||
res.push_back(get_second_dart_of_the_path(path[i]));
|
||||
res.push_back(get_first_dart_of_the_path(path[i]), false);
|
||||
res.push_back(get_second_dart_of_the_path(path[i]), false);
|
||||
}
|
||||
}
|
||||
res.update_is_closed();
|
||||
assert(res.is_closed());
|
||||
assert(res.is_valid());
|
||||
return res;
|
||||
}
|
||||
|
|
@ -402,20 +408,20 @@ namespace CGAL {
|
|||
// <<m_map.darts().index(p.second)<<": "<<std::flush;
|
||||
|
||||
//std::cout<<m_map.darts().index(p.first)<<"; "<<std::flush;
|
||||
p.first=m_map.template beta<0>(p.first);
|
||||
// p.first=m_map.template beta<0>(p.first);
|
||||
Dart_const_handle initdart=p.first;
|
||||
while (m_map.is_marked(p.first, toremove))
|
||||
{
|
||||
p.first=m_map.template beta<2, 0>(p.first);
|
||||
p.first=m_map.template beta<2, 1>(p.first);
|
||||
//std::cout<<m_map.darts().index(p.first)<<"; "<<std::flush;
|
||||
assert(p.first!=initdart);
|
||||
}
|
||||
//std::cout<<std::endl;
|
||||
p.second=m_map.template beta<0>(p.second);
|
||||
// p.second=m_map.template beta<0>(p.second);
|
||||
initdart=p.second;
|
||||
while (m_map.is_marked(p.second, toremove))
|
||||
{
|
||||
p.second=m_map.template beta<2, 0>(p.second);
|
||||
p.second=m_map.template beta<2, 1>(p.second);
|
||||
//std::cout<<m_map.darts().index(p.second)<<"; "<<std::flush;
|
||||
assert(p.second!=initdart);
|
||||
}
|
||||
|
|
@ -465,8 +471,8 @@ namespace CGAL {
|
|||
std::pair<Dart_const_handle, Dart_const_handle>& p=itp->second;
|
||||
//std::cout<<"Pair: "<<m_map.darts().index(p.first)<<", "
|
||||
// <<m_map.darts().index(p.second)<<std::flush;
|
||||
p.first=m_map.template beta<1>(p.first);
|
||||
p.second=m_map.template beta<1,2>(p.second);
|
||||
p.first=m_map.template beta<0, 2>(p.first);
|
||||
p.second=m_map.template beta<0>(p.second);
|
||||
//std::cout<<" -> "<<m_map.darts().index(p.first)<<", "
|
||||
// <<m_map.darts().index(p.second)<<std::endl;
|
||||
// WRONG ASSERTS assert(p.first!=p.second);
|
||||
|
|
|
|||
|
|
@ -475,6 +475,9 @@ void generate_random_closed_path(Path& p, std::size_t nb,
|
|||
{ CGAL::unmark_cell<typename Path::Map, 2>(p.get_map(), *it, amark); }
|
||||
|
||||
p.get_map().free_mark(amark);
|
||||
|
||||
p.update_is_closed(); // TODO we can avoid that because we know that we generated a closed path (to do so, we need a method that put p.is_closed to true)
|
||||
assert(p.is_closed());
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -439,6 +439,10 @@ public:
|
|||
{
|
||||
if (is_empty()) return false;
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool is_even=length()%2;
|
||||
#endif // NDEBUG
|
||||
|
||||
Self new_path(m_map);
|
||||
bool positive=false;
|
||||
std::size_t begin, end;
|
||||
|
|
@ -471,6 +475,9 @@ public:
|
|||
{ copy_rest_of_path(end+1, length(), new_path); }
|
||||
|
||||
swap(new_path);
|
||||
|
||||
assert(length()%2==is_even); // bracket flattening is supposed to preserve length parity
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -495,25 +502,43 @@ public:
|
|||
bool res=false;
|
||||
std::size_t i;
|
||||
std::size_t lastturn=m_path.size()-(is_closed()?0:1);
|
||||
Self new_path(m_map);
|
||||
for (i=0; i<lastturn; )
|
||||
for (i=0; !res && i<lastturn; ++i)
|
||||
{
|
||||
if (m_path[i]==m_map.template beta<2>(m_path[next_index(i)]))
|
||||
{
|
||||
i+=2;
|
||||
res=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_path.push_back(m_path[i]); // We copy this dart
|
||||
++i;
|
||||
}
|
||||
{ res=true; }
|
||||
}
|
||||
|
||||
if (!res)
|
||||
{ return false; }
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool is_even=length()%2;
|
||||
#endif // NDEBUG
|
||||
|
||||
--i; // Because we did a ++ before to leave the loop
|
||||
// Here there is a spur at position i in the path
|
||||
Self new_path(m_map);
|
||||
|
||||
// Special case, the spur is between last dart of the path and the first dart
|
||||
if (is_closed() && i==m_path.size()-1)
|
||||
{
|
||||
copy_rest_of_path(1, m_path.size()-1, new_path); // copy path between 1 and m_path.size()-2
|
||||
}
|
||||
else
|
||||
{ // Otherwise copy darts before the spur
|
||||
if (i>0)
|
||||
{ copy_rest_of_path(0, i, new_path); } // copy path between 0 and i-1
|
||||
|
||||
// and the darts after
|
||||
if (i+2<m_path.size())
|
||||
{ copy_rest_of_path(i+2, m_path.size(), new_path); } // copy path between 0 and m_path.size()-1
|
||||
}
|
||||
if (i==m_path.size()-1)
|
||||
{ new_path.push_back(m_path[m_path.size()-1]); } // we copy the last dart
|
||||
|
||||
swap(new_path);
|
||||
return res;
|
||||
|
||||
assert(length()%2==is_even); // spur rremoval is supposed to preserve length parity
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Simplify the path by removing all spurs
|
||||
|
|
@ -615,6 +640,7 @@ public:
|
|||
/* else
|
||||
{ assert(false); } // We think (?) that this case is not possible */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void push_l_shape_cycle_2()
|
||||
|
|
@ -651,6 +677,10 @@ public:
|
|||
if (length()==2)
|
||||
{ return push_l_shape_2darts(); }
|
||||
|
||||
#ifndef NDEBUG
|
||||
bool is_even=length()%2;
|
||||
#endif // NDEBUG
|
||||
|
||||
std::size_t begin, middle, end;
|
||||
std::size_t lastturn=m_path.size()-(is_closed()?0:1);
|
||||
std::size_t next_turn;
|
||||
|
|
@ -728,6 +758,9 @@ public:
|
|||
{ copy_rest_of_path(end+1, length(), new_path); }
|
||||
|
||||
swap(new_path);
|
||||
|
||||
assert(length()%2==is_even); // push lshape is supposed to preserve length parity (maybe preserve length ?? TODO check)
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
@ -743,7 +776,7 @@ public:
|
|||
while(right_push_one_step())
|
||||
{ res=true;
|
||||
|
||||
std::cout<<"RP "; display(); display_pos_and_neg_turns();
|
||||
std::cout<<"PUSH "; display(); display_pos_and_neg_turns();
|
||||
std::cout<<std::endl;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3> LCC_3_cmap;
|
|||
typedef CGAL::Linear_cell_complex_for_generalized_map<2,3> LCC_3_gmap;
|
||||
|
||||
#define NB_TESTS 25 // 0 ... 24
|
||||
int nbtests=0;
|
||||
static int nbtests=0;
|
||||
|
||||
enum Transformation // enum for the type of transformations
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ enum Transformation // enum for the type of transformations
|
|||
FULL_SIMPLIFICATION
|
||||
};
|
||||
|
||||
unsigned int starting_seed;
|
||||
static unsigned int starting_seed;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void transform_path(CGAL::Path_on_surface<LCC_3_cmap>& path, Transformation t,
|
||||
|
|
@ -164,7 +164,7 @@ bool unit_test_canonize(std::vector<CGAL::Path_on_surface<LCC_3_cmap> >& paths,
|
|||
std::cout<<"."<<std::flush;
|
||||
#endif
|
||||
|
||||
for (int i=0; i<paths.size(); ++i)
|
||||
for (unsigned int i=0; i<paths.size(); ++i)
|
||||
{
|
||||
if (draw)
|
||||
{
|
||||
|
|
@ -524,7 +524,7 @@ bool test_double_torus_quad(bool draw, int testtorun)
|
|||
std::vector<CGAL::Path_on_surface<LCC_3_cmap> > transformed_paths;
|
||||
|
||||
// Test 23 (3 g1 cycles)
|
||||
for (int i=0; i<3; ++i)
|
||||
for (unsigned int i=0; i<3; ++i)
|
||||
{
|
||||
paths.push_back(CGAL::Path_on_surface<LCC_3_cmap>(lcc));
|
||||
CGAL::generate_g1_double_torus(paths[i], i);
|
||||
|
|
@ -559,11 +559,11 @@ bool test_double_torus_quad(bool draw, int testtorun)
|
|||
generate_random_closed_path(p, random.get_int(5, 20), random); // random path, length between 30 and 500
|
||||
// p.close();
|
||||
paths.push_back(p);
|
||||
/* update_path_randomly(p, random);
|
||||
paths.push_back(p);
|
||||
update_path_randomly(p, random);
|
||||
paths.push_back(p);
|
||||
/* update_path_randomly(p, random);
|
||||
paths.push_back(p); */
|
||||
for (int i=0; i<paths.size(); ++i)
|
||||
for (unsigned int i=0; i<paths.size(); ++i)
|
||||
{
|
||||
transformed_paths.push_back
|
||||
(cmt2.transform_original_path_into_quad_surface(paths[i]));
|
||||
|
|
@ -672,7 +672,7 @@ int main(int argc, char** argv)
|
|||
CGAL::Random r; // Used when user do not provide its own seed.
|
||||
starting_seed=r.get_int(0,INT_MAX);
|
||||
|
||||
for (int i=1; i<argc; ++i)
|
||||
for (unsigned int i=1; i<(unsigned int)argc; ++i)
|
||||
{
|
||||
arg=argv[i];
|
||||
if (arg=="-draw")
|
||||
|
|
|
|||
Loading…
Reference in New Issue