Continue case with boundary.

This commit is contained in:
Guillaume Damiand 2019-11-21 11:12:48 +01:00
parent 15186ce2e4
commit d4c2b13da6
2 changed files with 59 additions and 61 deletions

View File

@ -129,7 +129,7 @@ int main(int argc, char** argv)
{
random=CGAL::Random(random.get_int(0, std::numeric_limits<int>::max()));
}
std::cout<<"Random seed: "<<random.get_seed()<<std::endl;
std::cout<<"Random seed: "<<random.get_seed()<<": ";
length=static_cast<unsigned int>(random.get_int(l1, l2+1));
defo=static_cast<unsigned int>(random.get_int(d1, d2+1));
@ -145,9 +145,9 @@ int main(int argc, char** argv)
Path_on_surface<LCC_3_cmap> path2(path1);
path2.update_path_randomly(defo, random);
std::cout<<"Path2 size: "<<path2.length()<<" (from "<<defo<<" deformations): ";
std::cout<<"Path2 size: "<<path2.length()<<" (from "<<defo<<" deformations).";
paths.push_back(path2);
std::cout<<std::flush;
std::cout<<std::endl;
if (cst.is_contractible(path1, time))
{ ++nbcontractible; }

View File

@ -609,9 +609,7 @@ protected:
{
res.push_back(get_first_dart_of_the_path
(path[i], path.get_ith_flip(i)), true);
if (!get_map().is_marked(res.back(), m_mark_perforated) ||
!get_map().is_marked(get_map().template beta<2>(res.back()),
m_mark_perforated))
if (!edge_path_has_only_one_dart(path[i]))
{ res.push_back(get_second_dart_of_the_path
(path[i], path.get_ith_flip(i)), true); }
}
@ -872,11 +870,11 @@ protected:
{
initdart=it;
if (!get_map().is_marked(initdart, toremove) &&
!get_map().is_marked(initdart, m_mark_perforated) &&
!get_map().is_marked(initdart, m_mark_perforated) /*&&
!get_map().is_marked(get_map().template beta<2>(initdart),
m_mark_perforated))
m_mark_perforated)*/)
{ // Here we are on a border edge of a "real" face (i.e. non perforated)
// and adjacent to a "real" face
//TODO REMOVE THIS LINE OF COMMENT and adjacent to a "real" face
curdart=get_map().template beta<0, 2>(initdart);
while(get_map().is_marked(curdart, toremove))
{ // Here, all edges marked to remove are between two real faces.
@ -897,10 +895,7 @@ protected:
{
CGAL_assertion(!m_original_map.is_marked(it->first, m_mark_T));
CGAL_assertion(!get_map().is_marked(it->second.first, toremove));
if (m_original_map.is_perforated(it->first) &&
(m_original_map.template is_free<2>(it->first) ||
m_original_map.is_perforated
(m_original_map.template beta<2>(it->first))))
if (edge_path_has_only_one_dart(it->first))
{ CGAL_assertion(it->second.second==nullptr); }
else
{ CGAL_assertion(!get_map().is_marked(it->second.second, toremove)); }
@ -1034,46 +1029,31 @@ protected:
std::pair<Dart_handle, Dart_handle>& p=itp->second;
/* std::cout<<"Pair: "<<get_map().darts().index(p.first)<<", "
<<get_map().darts().index(p.second)<<std::flush; */
if (!get_map().is_marked(p.first, m_mark_perforated) &&
!get_map().is_marked(p.second, m_mark_perforated))
{ // Edge between two real faces, removed during the quadrangulation
p.first=get_map().template beta<0, 2>(p.first);
p.second=get_map().template beta<0>(p.second);
}
else if (!get_map().is_marked(p.first, m_mark_perforated))
{ // Edge between a real face and a perforated one
CGAL_assertion(get_map().template beta<2>(p.first)==p.second); // The edge was not updated in update_length_two_paths_before_edge_removals
p.second=get_map().template beta<1>(p.first);
p.first=get_map().template beta<0, 2>(p.first);
}
else if (!get_map().is_marked(p.second, m_mark_perforated))
if (p.second!=nullptr) // if ==nullptr, case of an edge between two perforated faces
{
CGAL_assertion(get_map().template beta<2>(p.first)==p.second); // The edge was not updated in update_length_two_paths_before_edge_removals
p.second=get_map().template beta<0, 2>(p.first);
p.first=get_map().template beta<1>(p.first);
if (!get_map().is_marked(p.first, m_mark_perforated) &&
!get_map().is_marked(p.second, m_mark_perforated))
{ // Edge between two real faces, removed during the quadrangulation
p.first=get_map().template beta<0, 2>(p.first);
p.second=get_map().template beta<0>(p.second);
}
else if (!get_map().is_marked(p.first, m_mark_perforated))
{ // Edge between a real face and a perforated one
CGAL_assertion(get_map().template beta<2>(p.first)==p.second); // The edge was not updated in update_length_two_paths_before_edge_removals
p.second=get_map().template beta<1>(p.first);
p.first=get_map().template beta<0, 2>(p.first);
}
else if (!get_map().is_marked(p.second, m_mark_perforated))
{
CGAL_assertion(get_map().template beta<2>(p.first)==p.second); // The edge was not updated in update_length_two_paths_before_edge_removals
p.second=get_map().template beta<0, 2>(p.first);
p.first=get_map().template beta<1>(p.first);
}
}
/* std::cout<<" -> "<<get_map().darts().index(p.first)<<", "
<<get_map().darts().index(p.second)<<std::endl; */
}
/*for (typename TPaths::iterator itp=m_paths.begin(), itpend=m_paths.end();
itp!=itpend; ++itp)
{
std::pair<Dart_handle, Dart_handle>& p=itp->second;
CGAL_assertion(get_map().is_marked(p.first, oldedges));
CGAL_assertion(get_map().is_marked(p.second, oldedges));
} */
/* FOR DEBUG for (typename CMap_for_minimal_quadrangulation::Dart_range::iterator
it=get_map().darts().begin(); it!=get_map().darts().end();
++it)
{
if (get_map().is_marked(it, m_mark_hole))
{ assert(get_map().template is_whole_cell_marked<2>(it, m_mark_hole)); }
else
{ assert(get_map().template is_whole_cell_unmarked<2>(it, m_mark_hole)); }
} */
// 3) We remove all the old edges, and extend the perforated faces.
for (typename CMap_for_minimal_quadrangulation::Dart_range::iterator
it=get_map().darts().begin(), itend=get_map().darts().end();
@ -1086,8 +1066,6 @@ protected:
if (get_map().is_marked(get_map().template beta<2>(it), m_mark_perforated))
{ get_map().template mark_cell<2>(it, m_mark_perforated); }
get_map().template remove_cell<1>(it);
// get_map().mark(it, toremove);
// get_map().mark(get_map().template beta<2>(it), toremove);
}
}
@ -1285,6 +1263,16 @@ protected:
return m_paths.find(m_original_map.template beta<2>(adart))!=m_paths.end();
}
/// @return true iff the edge containing adart is associated with a path
/// of only 1 dart (case of an edge bewteen two perforated faces)
bool edge_path_has_only_one_dart(typename Map::Dart_const_handle adart) const
{
return
(m_original_map.is_perforated(adart) &&
(m_original_map.template is_free<2>(adart) ||
m_original_map.is_perforated(m_original_map.template beta<2>(adart))));
}
/// @return the pair of darts associated with the edge containing adart
/// in m_original_map.
/// @pre the edge containing adart must not belong to T.
@ -1398,7 +1386,8 @@ protected:
if (m_original_map.template is_free<2>(adart) ||
adart<m_original_map.template beta<2>(adart))
{ m_paths.find(adart)->second.first=d; }
else { m_paths.find(adart)->second.second=d; }
else
{ m_paths.find(m_original_map.template beta<2>(adart))->second.second=d; }
}
void set_second_dart_of_the_path(typename Map::Dart_const_handle adart,
@ -1517,24 +1506,33 @@ protected:
if (!is_contracted(it))
{
Dart_const_handle d1=get_first_dart_of_the_path(it);
Dart_const_handle d2=get_second_dart_of_the_path(it);
if (d1==NULL || d2==NULL)
if (d1==NULL)
{
std::cout<<"ERROR: an edge is associated with a null dart in m_paths."
<<std::endl;
std::cout<<"ERROR: an edge is associated with a null dart in m_paths"
<<" for its first dart."<<std::endl;
res=false;
}
else
else if (!edge_path_has_only_one_dart(it))
{
Dart_const_handle dd1=get_map().other_extremity(d1);
CGAL_assertion(dd1!=NULL);
if (!CGAL::belong_to_same_cell<CMap_for_minimal_quadrangulation,0>
(get_map(), dd1, d2))
Dart_const_handle d2=get_second_dart_of_the_path(it);
if (d2==NULL)
{
std::cout<<"ERROR: the two darts in a path are not consecutive."
<<std::endl;
std::cout<<"ERROR: an edge is associated with a null dart in m_paths"
<<" for its second dart."<<std::endl;
res=false;
}
else
{
Dart_const_handle dd1=get_map().other_extremity(d1);
CGAL_assertion(dd1!=NULL);
if (!CGAL::belong_to_same_cell<CMap_for_minimal_quadrangulation,0>
(get_map(), dd1, d2))
{
std::cout<<"ERROR: the two darts in a path are not consecutive."
<<std::endl;
res=false;
}
}
}
}
}