mirror of https://github.com/CGAL/cgal
Small cleanup; NULL->nullptr.
This commit is contained in:
parent
e7d75acbaf
commit
dda46d4ce3
|
|
@ -135,20 +135,20 @@ public:
|
||||||
{ return get_ith_dart(i); }
|
{ return get_ith_dart(i); }
|
||||||
|
|
||||||
/// @return the dart before the ith dart of the path,
|
/// @return the dart before the ith dart of the path,
|
||||||
/// NULL if such a dart does not exist.
|
/// nullptr if such a dart does not exist.
|
||||||
Dart_const_handle get_prev_dart(std::size_t i) const
|
Dart_const_handle get_prev_dart(std::size_t i) const
|
||||||
{
|
{
|
||||||
CGAL_assertion(i<m_path.size());
|
CGAL_assertion(i<m_path.size());
|
||||||
if (i==0 && !is_closed()) return NULL;
|
if (i==0 && !is_closed()) return nullptr;
|
||||||
return m_path[prev_index(i)];
|
return m_path[prev_index(i)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return the dart after the ith dart of the path,
|
/// @return the dart after the ith dart of the path,
|
||||||
/// NULL if such a dart does not exist.
|
/// nullptr if such a dart does not exist.
|
||||||
Dart_const_handle get_next_dart(std::size_t i) const
|
Dart_const_handle get_next_dart(std::size_t i) const
|
||||||
{
|
{
|
||||||
CGAL_assertion(i<m_path.size());
|
CGAL_assertion(i<m_path.size());
|
||||||
if (i==m_path.size()-1 && !is_closed()) return NULL;
|
if (i==m_path.size()-1 && !is_closed()) return nullptr;
|
||||||
return m_path[next_index(i)];
|
return m_path[next_index(i)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,7 +214,7 @@ public:
|
||||||
bool can_be_pushed_by_label(const std::string& e) const
|
bool can_be_pushed_by_label(const std::string& e) const
|
||||||
{
|
{
|
||||||
Dart_const_handle dh=get_map().get_dart_labeled(e);
|
Dart_const_handle dh=get_map().get_dart_labeled(e);
|
||||||
if (dh!=NULL) { return false; }
|
if (dh!=nullptr) { return false; }
|
||||||
return can_be_pushed(dh);
|
return can_be_pushed(dh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ public:
|
||||||
for (std::string e; std::getline(iss, e, ' '); )
|
for (std::string e; std::getline(iss, e, ' '); )
|
||||||
{
|
{
|
||||||
Dart_const_handle dh=get_map().get_dart_labeled(e);
|
Dart_const_handle dh=get_map().get_dart_labeled(e);
|
||||||
if (dh!=NULL) { push_back(dh); }
|
if (dh!=nullptr) { push_back(dh); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,7 +682,7 @@ public:
|
||||||
/* This assert is long if (!m_map.darts().owns(m_path[i]))
|
/* This assert is long if (!m_map.darts().owns(m_path[i]))
|
||||||
{ return false; } */
|
{ return false; } */
|
||||||
|
|
||||||
if (m_path[i]==NULL || m_path[i]==m_map.null_dart_handle)
|
if (m_path[i]==nullptr || m_path[i]==m_map.null_dart_handle)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
Dart_const_handle pend=m_map.other_extremity(m_path[i-1]);
|
Dart_const_handle pend=m_map.other_extremity(m_path[i-1]);
|
||||||
|
|
|
||||||
|
|
@ -66,20 +66,20 @@ namespace Surface_mesh_topology {
|
||||||
Dart_handle dart_opposite_label,
|
Dart_handle dart_opposite_label,
|
||||||
std::unordered_map<std::string, Dart_handle>& edge_label_to_dart)
|
std::unordered_map<std::string, Dart_handle>& edge_label_to_dart)
|
||||||
{
|
{
|
||||||
if (dart_same_label!=NULL && dart_opposite_label!=NULL)
|
if (dart_same_label!=nullptr && dart_opposite_label!=nullptr)
|
||||||
{
|
{
|
||||||
std::cerr<<"Polygonal_schema ERROR: "<<"both labels "<<s
|
std::cerr<<"Polygonal_schema ERROR: "<<"both labels "<<s
|
||||||
<<" and "<<internal::opposite_label(s)<<" are already added in the surface."
|
<<" and "<<internal::opposite_label(s)<<" are already added in the surface."
|
||||||
<<" This label can not be use anymore."<<std::endl;
|
<<" This label can not be use anymore."<<std::endl;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dart_same_label!=NULL)
|
if (dart_same_label!=nullptr)
|
||||||
{
|
{
|
||||||
std::cerr<<"Polygonal_schema ERROR: "<<"label "<<s
|
std::cerr<<"Polygonal_schema ERROR: "<<"label "<<s
|
||||||
<<" is already added in the surface."
|
<<" is already added in the surface."
|
||||||
<<" Since the surface is orientable, this label can not be use anymore."<<std::endl;
|
<<" Since the surface is orientable, this label can not be use anymore."<<std::endl;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dart_handle res=cmap.create_dart();
|
Dart_handle res=cmap.create_dart();
|
||||||
|
|
@ -91,7 +91,7 @@ namespace Surface_mesh_topology {
|
||||||
if (prev_dart!=cmap.null_handle)
|
if (prev_dart!=cmap.null_handle)
|
||||||
{ cmap.template link_beta<1>(prev_dart, res); }
|
{ cmap.template link_beta<1>(prev_dart, res); }
|
||||||
|
|
||||||
if (dart_opposite_label!=NULL)
|
if (dart_opposite_label!=nullptr)
|
||||||
{ cmap.template link_beta<2>(res, dart_opposite_label); }
|
{ cmap.template link_beta<2>(res, dart_opposite_label); }
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -99,7 +99,7 @@ namespace Surface_mesh_topology {
|
||||||
|
|
||||||
std::string get_label(CMap& cmap, Dart_handle dh) const
|
std::string get_label(CMap& cmap, Dart_handle dh) const
|
||||||
{
|
{
|
||||||
CGAL_assertion(cmap.info(dh).m_label!=NULL);
|
CGAL_assertion(cmap.info(dh).m_label!=nullptr);
|
||||||
return std::string(cmap.info(dh).m_label);
|
return std::string(cmap.info(dh).m_label);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -117,12 +117,12 @@ namespace Surface_mesh_topology {
|
||||||
Dart_handle dart_opposite_label,
|
Dart_handle dart_opposite_label,
|
||||||
std::unordered_map<std::string, Dart_handle>& edge_label_to_dart)
|
std::unordered_map<std::string, Dart_handle>& edge_label_to_dart)
|
||||||
{
|
{
|
||||||
if (dart_same_label!=NULL && dart_opposite_label!=NULL)
|
if (dart_same_label!=nullptr && dart_opposite_label!=nullptr)
|
||||||
{
|
{
|
||||||
std::cerr<<"Polygonal_schema ERROR: "<<"both labels "<<s
|
std::cerr<<"Polygonal_schema ERROR: "<<"both labels "<<s
|
||||||
<<" and "<<internal::opposite_label(s)<<" are already added in the surface."
|
<<" and "<<internal::opposite_label(s)<<" are already added in the surface."
|
||||||
<<" This label can not be use anymore."<<std::endl;
|
<<" This label can not be use anymore."<<std::endl;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dart_handle res=gmap.create_dart();
|
Dart_handle res=gmap.create_dart();
|
||||||
|
|
@ -132,8 +132,8 @@ namespace Surface_mesh_topology {
|
||||||
if (prev_dart!=gmap.null_handle)
|
if (prev_dart!=gmap.null_handle)
|
||||||
{ gmap.template link_alpha<1>(res, gmap.template alpha<0>(prev_dart)); }
|
{ gmap.template link_alpha<1>(res, gmap.template alpha<0>(prev_dart)); }
|
||||||
|
|
||||||
if (dart_same_label!=NULL)
|
if (dart_same_label!=nullptr)
|
||||||
{ // Here dart_same_label!=NULL
|
{ // Here dart_same_label!=nullptr
|
||||||
std::string s2=internal::opposite_label(s);
|
std::string s2=internal::opposite_label(s);
|
||||||
edge_label_to_dart[s2]=dh2;
|
edge_label_to_dart[s2]=dh2;
|
||||||
gmap.info(dh2).m_label=new char[s2.size()+1];
|
gmap.info(dh2).m_label=new char[s2.size()+1];
|
||||||
|
|
@ -142,12 +142,12 @@ namespace Surface_mesh_topology {
|
||||||
gmap.template sew<2>(res, dart_same_label);
|
gmap.template sew<2>(res, dart_same_label);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Here either dart_opposite_label!=NULL, or both are NULL
|
{ // Here either dart_opposite_label!=nullptr, or both are nullptr
|
||||||
edge_label_to_dart[s]=res;
|
edge_label_to_dart[s]=res;
|
||||||
gmap.info(res).m_label=new char[s.size()+1];
|
gmap.info(res).m_label=new char[s.size()+1];
|
||||||
strncpy(gmap.info(res).m_label, s.c_str(), s.size()+1); // +1 to copy also the \0 char
|
strncpy(gmap.info(res).m_label, s.c_str(), s.size()+1); // +1 to copy also the \0 char
|
||||||
|
|
||||||
if (dart_opposite_label!=NULL)
|
if (dart_opposite_label!=nullptr)
|
||||||
{
|
{
|
||||||
std::string s2=internal::opposite_label(s);
|
std::string s2=internal::opposite_label(s);
|
||||||
edge_label_to_dart[s2]=res;
|
edge_label_to_dart[s2]=res;
|
||||||
|
|
@ -165,7 +165,7 @@ namespace Surface_mesh_topology {
|
||||||
{
|
{
|
||||||
char* label=gmap.info(dh).m_label;
|
char* label=gmap.info(dh).m_label;
|
||||||
|
|
||||||
if (label==NULL)
|
if (label==nullptr)
|
||||||
{
|
{
|
||||||
if (!gmap.is_free<2>(dh))
|
if (!gmap.is_free<2>(dh))
|
||||||
{ label=gmap.info(gmap.template alpha<2>(dh)).m_label; }
|
{ label=gmap.info(gmap.template alpha<2>(dh)).m_label; }
|
||||||
|
|
@ -175,7 +175,7 @@ namespace Surface_mesh_topology {
|
||||||
(std::string(gmap.info(gmap.template alpha<0>(dh))));
|
(std::string(gmap.info(gmap.template alpha<0>(dh))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGAL_assertion(label!=NULL);
|
CGAL_assertion(label!=nullptr);
|
||||||
return std::string(label);
|
return std::string(label);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -206,10 +206,10 @@ namespace Surface_mesh_topology {
|
||||||
{
|
{
|
||||||
for (auto it=this->darts().begin(), itend=this->darts().end(); it!=itend; ++it)
|
for (auto it=this->darts().begin(), itend=this->darts().end(); it!=itend; ++it)
|
||||||
{
|
{
|
||||||
if (this->info(it).m_label!=NULL)
|
if (this->info(it).m_label!=nullptr)
|
||||||
{
|
{
|
||||||
delete []this->info(it).m_label;
|
delete []this->info(it).m_label;
|
||||||
this->info(it).m_label=NULL;
|
this->info(it).m_label=nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,7 +320,7 @@ namespace Surface_mesh_topology {
|
||||||
std::cerr<<"Polygonal_schema ERROR: "
|
std::cerr<<"Polygonal_schema ERROR: "
|
||||||
<<"you try to end a facet"
|
<<"you try to end a facet"
|
||||||
<<" but the facet is not yet started."<<std::endl;
|
<<" but the facet is not yet started."<<std::endl;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
CGAL_assertion( first_dart!=this->null_handle && prev_dart!=this->null_handle );
|
CGAL_assertion( first_dart!=this->null_handle && prev_dart!=this->null_handle );
|
||||||
this->set_next(prev_dart, first_dart);
|
this->set_next(prev_dart, first_dart);
|
||||||
|
|
@ -329,12 +329,12 @@ namespace Surface_mesh_topology {
|
||||||
return first_dart;
|
return first_dart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return dart with the given label, NULL if this dart does not exist.
|
/// @return dart with the given label, nullptr if this dart does not exist.
|
||||||
Dart_handle get_dart_labeled(const std::string & s) const
|
Dart_handle get_dart_labeled(const std::string & s) const
|
||||||
{
|
{
|
||||||
auto ite=edge_label_to_dart.find(s);
|
auto ite=edge_label_to_dart.find(s);
|
||||||
if (ite==edge_label_to_dart.end())
|
if (ite==edge_label_to_dart.end())
|
||||||
{ return NULL; }
|
{ return nullptr; }
|
||||||
|
|
||||||
return ite->second;
|
return ite->second;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Surface_mesh_topology {
|
||||||
{
|
{
|
||||||
char* m_label;
|
char* m_label;
|
||||||
|
|
||||||
Info_for_darts() : m_label(NULL)
|
Info_for_darts() : m_label(nullptr)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -834,8 +834,8 @@ protected:
|
||||||
if (m_map.is_dart_used(it) && m_map.is_marked(it, toremove))
|
if (m_map.is_dart_used(it) && m_map.is_marked(it, toremove))
|
||||||
{
|
{
|
||||||
erase_edge_from_associative_arrays(it, origin_to_copy, copy_to_origin);
|
erase_edge_from_associative_arrays(it, origin_to_copy, copy_to_origin);
|
||||||
// TODO LATER (?) OPTIMIZE AND REPLACE THE REMOVE_CELL CALL BY THE MODIFICATION BY HAND
|
// TODO later (?) optimize and replace the remove_cell call by the modification by hand
|
||||||
// OR DEVELOP A SPECIALIZED VERSION OF REMOVE_CELL
|
// or develop a specialized version of remove_cell
|
||||||
m_map.template remove_cell<1>(it);
|
m_map.template remove_cell<1>(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
typedef CFlat<Map> Flat;
|
typedef CFlat<Map> Flat;
|
||||||
typedef std::list<Flat> List_of_flats;
|
typedef std::list<Flat> List_of_flats;
|
||||||
typedef typename List_of_flats::iterator List_iterator;
|
typedef typename List_of_flats::iterator List_iterator;
|
||||||
// TODO typedef typename List_of_dart_length::const_iterator List_const_iterator;
|
// TODO? typedef typename List_of_dart_length::const_iterator List_const_iterator;
|
||||||
|
|
||||||
struct List_iterator_hash
|
struct List_iterator_hash
|
||||||
{
|
{
|
||||||
|
|
@ -153,9 +153,6 @@ public:
|
||||||
|
|
||||||
if (apath.is_closed())
|
if (apath.is_closed())
|
||||||
{
|
{
|
||||||
/// Tempo pour debug
|
|
||||||
// i=get_default_random().get_int(0, apath.length());
|
|
||||||
/// END Tempo pour debug
|
|
||||||
if (!use_only_negative && apath.next_positive_turn(i)==2)
|
if (!use_only_negative && apath.next_positive_turn(i)==2)
|
||||||
{ positive_flat=true; negative_flat=false; }
|
{ positive_flat=true; negative_flat=false; }
|
||||||
else if (!use_only_positive && apath.next_negative_turn(i)==2)
|
else if (!use_only_positive && apath.next_negative_turn(i)==2)
|
||||||
|
|
@ -327,10 +324,10 @@ public:
|
||||||
if (is_empty()) { return !is_closed(); } // an empty past is not closed
|
if (is_empty()) { return !is_closed(); } // an empty past is not closed
|
||||||
|
|
||||||
unsigned int nbdarts=0,i=0;
|
unsigned int nbdarts=0,i=0;
|
||||||
Dart_const_handle prev=(is_closed()?back():NULL); // Last dart of the path
|
Dart_const_handle prev=(is_closed()?back():nullptr); // Last dart of the path
|
||||||
for (auto it=m_path.begin(); it!=m_path.end(); ++it)
|
for (auto it=m_path.begin(); it!=m_path.end(); ++it)
|
||||||
{
|
{
|
||||||
if (prev!=NULL && !m_map.template belong_to_same_cell<0>
|
if (prev!=nullptr && !m_map.template belong_to_same_cell<0>
|
||||||
(m_map.template beta<1>(prev), begin_of_flat(it)))
|
(m_map.template beta<1>(prev), begin_of_flat(it)))
|
||||||
{
|
{
|
||||||
std::cerr<<"ERROR: The path is not valid: flat in position "<<i
|
std::cerr<<"ERROR: The path is not valid: flat in position "<<i
|
||||||
|
|
@ -350,12 +347,6 @@ public:
|
||||||
|
|
||||||
if (test_minimal && can_merge_with_next_flat(it))
|
if (test_minimal && can_merge_with_next_flat(it))
|
||||||
{
|
{
|
||||||
/* std::cout<<"************* ERROR ************"<<std::endl;
|
|
||||||
display();
|
|
||||||
Path_on_surface<Map>(*this).display_pos_and_neg_turns(); std::cout<<std::endl;
|
|
||||||
display_pos_and_neg_turns(); std::cout<<std::endl;
|
|
||||||
std::cout<<"FLAT ERROR "<<*it<<std::endl; */
|
|
||||||
|
|
||||||
std::cout<<"ERROR: The path is not valid: flat at position "<<i
|
std::cout<<"ERROR: The path is not valid: flat at position "<<i
|
||||||
<<" with length "<<flat_length(it)<<" is not correct: it can be merged "
|
<<" with length "<<flat_length(it)<<" is not correct: it can be merged "
|
||||||
<<"with the next flat with length "
|
<<"with the next flat with length "
|
||||||
|
|
@ -370,7 +361,7 @@ public:
|
||||||
|
|
||||||
if (is_closed())
|
if (is_closed())
|
||||||
{
|
{
|
||||||
if (prev==NULL)
|
if (prev==nullptr)
|
||||||
{
|
{
|
||||||
std::cout<<"ERROR: The path is not valid: it is empty and closed."
|
std::cout<<"ERROR: The path is not valid: it is empty and closed."
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
|
|
@ -482,14 +473,6 @@ public:
|
||||||
return is_closed() || it!=m_path.begin();
|
return is_closed() || it!=m_path.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void advance_iterator(List_iterator& it)
|
|
||||||
{
|
|
||||||
CGAL_assertion(it!=m_path.end());
|
|
||||||
it=std::next(it);
|
|
||||||
if (is_closed() && it==m_path.end())
|
|
||||||
{ it=m_path.begin(); } // Here the path is closed, and it is the last element of the list
|
|
||||||
} */
|
|
||||||
|
|
||||||
void advance_iterator(List_iterator& it)
|
void advance_iterator(List_iterator& it)
|
||||||
{
|
{
|
||||||
CGAL_assertion(it!=m_path.end());
|
CGAL_assertion(it!=m_path.end());
|
||||||
|
|
@ -512,15 +495,6 @@ public:
|
||||||
it=std::prev(it);
|
it=std::prev(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void retreat_iterator(List_const_iterator& it) const
|
|
||||||
{
|
|
||||||
CGAL_assertion(it!=m_path.end());
|
|
||||||
CGAL_assertion(it!=m_path.begin() || is_closed());
|
|
||||||
if (is_closed() && it==m_path.begin())
|
|
||||||
{ it=m_path.end(); }
|
|
||||||
it=std::prev(it);
|
|
||||||
} */
|
|
||||||
|
|
||||||
List_iterator next_iterator(const List_iterator& it)
|
List_iterator next_iterator(const List_iterator& it)
|
||||||
{
|
{
|
||||||
List_iterator res=it;
|
List_iterator res=it;
|
||||||
|
|
@ -528,13 +502,6 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List_const_iterator next_iterator(const List_const_iterator& it) const
|
|
||||||
{
|
|
||||||
List_const_iterator res=it;
|
|
||||||
advance_iterator(res);
|
|
||||||
return res;
|
|
||||||
} */
|
|
||||||
|
|
||||||
List_iterator prev_iterator(const List_iterator& it)
|
List_iterator prev_iterator(const List_iterator& it)
|
||||||
{
|
{
|
||||||
List_iterator res=it;
|
List_iterator res=it;
|
||||||
|
|
@ -542,13 +509,6 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List_const_iterator prev_iterator(const List_const_iterator& it) const
|
|
||||||
{
|
|
||||||
List_const_iterator res=it;
|
|
||||||
retreat_iterator(res);
|
|
||||||
return res;
|
|
||||||
} */
|
|
||||||
|
|
||||||
/// @return the beginning of the flat
|
/// @return the beginning of the flat
|
||||||
Dart_const_handle begin_of_flat(const List_iterator& it)
|
Dart_const_handle begin_of_flat(const List_iterator& it)
|
||||||
{
|
{
|
||||||
|
|
@ -675,11 +635,9 @@ public:
|
||||||
Dart_const_handle dh2)
|
Dart_const_handle dh2)
|
||||||
{
|
{
|
||||||
#if defined(CGAL_PWRLE_TURN_V2) || defined(CGAL_PWRLE_TURN_V3)
|
#if defined(CGAL_PWRLE_TURN_V2) || defined(CGAL_PWRLE_TURN_V3)
|
||||||
unsigned int toto1=m_map.positive_turn(dh1, dh2);
|
/* CGAL_assertion(m_map.positive_turn(dh1, dh2)==
|
||||||
unsigned int toto2=compute_positive_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
compute_positive_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
||||||
get_dart_id(dh2));
|
get_dart_id(dh2))); */
|
||||||
// std::cout<<"toto1="<<toto1<<" toto2="<<toto2<<std::endl;
|
|
||||||
CGAL_assertion(toto1==toto2);
|
|
||||||
|
|
||||||
return compute_positive_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
return compute_positive_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
||||||
get_dart_id(dh2));
|
get_dart_id(dh2));
|
||||||
|
|
@ -693,10 +651,9 @@ public:
|
||||||
Dart_const_handle dh2)
|
Dart_const_handle dh2)
|
||||||
{
|
{
|
||||||
#if defined(CGAL_PWRLE_TURN_V2) || defined(CGAL_PWRLE_TURN_V3)
|
#if defined(CGAL_PWRLE_TURN_V2) || defined(CGAL_PWRLE_TURN_V3)
|
||||||
// TEMPO POUR DEBUG
|
/* CGAL_assertion(m_map.negative_turn(dh1, dh2)==
|
||||||
CGAL_assertion(m_map.negative_turn(dh1, dh2)==
|
|
||||||
compute_negative_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
compute_negative_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
||||||
get_dart_id(dh2)));
|
get_dart_id(dh2))); */
|
||||||
|
|
||||||
return compute_negative_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
return compute_negative_turn_given_ids(get_dart_id(m_map.template beta<2>(dh1)),
|
||||||
get_dart_id(dh2));
|
get_dart_id(dh2));
|
||||||
|
|
@ -711,32 +668,14 @@ public:
|
||||||
/// of the first dart)
|
/// of the first dart)
|
||||||
std::size_t next_positive_turn(const List_iterator& it)
|
std::size_t next_positive_turn(const List_iterator& it)
|
||||||
{
|
{
|
||||||
// CGAL_assertion(is_valid());
|
|
||||||
// CGAL_assertion(is_valid_iterator(it));
|
|
||||||
CGAL_assertion(next_flat_exist(it));
|
CGAL_assertion(next_flat_exist(it));
|
||||||
|
|
||||||
/* if (flat_length(it)!=0)
|
|
||||||
{
|
|
||||||
if (flat_length(it)<0) { return (m_map.number_of_darts()/2)-2; }
|
|
||||||
else { return 2; }
|
|
||||||
} */
|
|
||||||
|
|
||||||
return positive_turn(end_of_flat(it), begin_of_flat(next_iterator(it)));
|
return positive_turn(end_of_flat(it), begin_of_flat(next_iterator(it)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same than next_positive_turn but turning in reverse orientation around vertex.
|
/// Same than next_positive_turn but turning in reverse orientation around vertex.
|
||||||
std::size_t next_negative_turn(const List_iterator& it)
|
std::size_t next_negative_turn(const List_iterator& it)
|
||||||
{
|
{
|
||||||
// CGAL_assertion(is_valid());
|
|
||||||
// CGAL_assertion(is_valid_iterator(it));
|
|
||||||
CGAL_assertion(next_flat_exist(it));
|
CGAL_assertion(next_flat_exist(it));
|
||||||
|
|
||||||
/*if (flat_length(it)!=0)
|
|
||||||
{
|
|
||||||
if (flat_length(it)<0) { return 2; }
|
|
||||||
else { return (m_map.number_of_darts()/2)-2; }
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return negative_turn(end_of_flat(it), begin_of_flat(next_iterator(it)));
|
return negative_turn(end_of_flat(it), begin_of_flat(next_iterator(it)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -790,7 +729,6 @@ public:
|
||||||
if (prev_flat_exist(it))
|
if (prev_flat_exist(it))
|
||||||
{
|
{
|
||||||
retreat_iterator(it); // this is why we move it backward here
|
retreat_iterator(it); // this is why we move it backward here
|
||||||
// modified_flats.insert(it);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -855,7 +793,6 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//else
|
|
||||||
set_begin_of_flat(it, second_dart_of_a_flat(it));
|
set_begin_of_flat(it, second_dart_of_a_flat(it));
|
||||||
decrease_flat_length(it);
|
decrease_flat_length(it);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -882,7 +819,6 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// else
|
|
||||||
set_end_of_flat(it, before_last_dart_of_a_flat(it));
|
set_end_of_flat(it, before_last_dart_of_a_flat(it));
|
||||||
decrease_flat_length(it);
|
decrease_flat_length(it);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -893,13 +829,6 @@ public:
|
||||||
bool& positive2, bool& negative2)
|
bool& positive2, bool& negative2)
|
||||||
{
|
{
|
||||||
if (m_path.size()<=1) { return false; }
|
if (m_path.size()<=1) { return false; }
|
||||||
|
|
||||||
/* if (!is_valid_iterator(it))
|
|
||||||
{
|
|
||||||
std::cout<<"ERROR"<<std::endl;
|
|
||||||
CGAL_assertion(is_valid_iterator(it));
|
|
||||||
} */
|
|
||||||
|
|
||||||
if (!next_flat_exist(it)) { return false; }
|
if (!next_flat_exist(it)) { return false; }
|
||||||
|
|
||||||
List_iterator it2=next_iterator(it);
|
List_iterator it2=next_iterator(it);
|
||||||
|
|
@ -973,8 +902,6 @@ public:
|
||||||
display_flat(std::cout, next_iterator(it)); std::cout<<std::endl;
|
display_flat(std::cout, next_iterator(it)); std::cout<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Path_on_surface<Map> pbefore(*this);
|
|
||||||
|
|
||||||
List_iterator it2=next_iterator(it);
|
List_iterator it2=next_iterator(it);
|
||||||
set_flat_length(it, flat_length(it)+flat_length(it2)+
|
set_flat_length(it, flat_length(it)+flat_length(it2)+
|
||||||
(positive2?1:-1));
|
(positive2?1:-1));
|
||||||
|
|
@ -983,9 +910,6 @@ public:
|
||||||
if (modified_flats.count(it2)==1)
|
if (modified_flats.count(it2)==1)
|
||||||
modified_flats.erase(it2);
|
modified_flats.erase(it2);
|
||||||
|
|
||||||
//Path_on_surface<Map> pafter(*this);
|
|
||||||
//CGAL_assertion(pbefore==pafter);
|
|
||||||
|
|
||||||
// CGAL_assertion(is_flat_valid(it));
|
// CGAL_assertion(is_flat_valid(it));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1030,31 +954,15 @@ public:
|
||||||
|
|
||||||
CGAL_assertion(is_spur(it));
|
CGAL_assertion(is_spur(it));
|
||||||
Set_of_it modified_flats;
|
Set_of_it modified_flats;
|
||||||
|
|
||||||
//std::cout<<"*********************************** ";
|
|
||||||
/* static int TOTO=0;
|
|
||||||
std::cout<<"remove_spur "<<TOTO++<<std::endl; */
|
|
||||||
|
|
||||||
/*if (TOTO==984)
|
|
||||||
{
|
|
||||||
int dh=TOTO;
|
|
||||||
CGAL_assertion(is_valid());
|
|
||||||
display();
|
|
||||||
// Path_on_surface<Map>(*this).display_pos_and_neg_turns(); std::cout<<std::endl;
|
|
||||||
display_pos_and_neg_turns(); std::cout<<std::endl;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
List_iterator it2=next_iterator(it); // it2 is the next flat
|
List_iterator it2=next_iterator(it); // it2 is the next flat
|
||||||
|
|
||||||
// We reduce the first flat
|
// We reduce the first flat
|
||||||
reduce_flat_from_end(it, modified_flats); // If flat 'it' is erased, it is moved to the previous flat
|
reduce_flat_from_end(it, modified_flats); // If flat 'it' is erased, it is moved to the previous flat
|
||||||
|
|
||||||
// And we reduce the second flat
|
// We reduce the second flat
|
||||||
reduce_flat_from_beginning(it2, modified_flats);
|
reduce_flat_from_beginning(it2, modified_flats);
|
||||||
|
|
||||||
/* std::cout<<*prev_iterator(it)<<std::endl
|
// We merge adjacent flats if possible
|
||||||
<<*it<<std::endl<<*it2<<std::endl<<*next_iterator(it2)<<std::endl;*/
|
|
||||||
|
|
||||||
it=merge_modified_flats_when_possible(modified_flats);
|
it=merge_modified_flats_when_possible(modified_flats);
|
||||||
|
|
||||||
// CGAL_assertion(is_valid_iterator(it));
|
// CGAL_assertion(is_valid_iterator(it));
|
||||||
|
|
@ -1179,7 +1087,7 @@ public:
|
||||||
List_iterator it2;
|
List_iterator it2;
|
||||||
CGAL_assertion(is_negative_bracket(it1, it2)); // Here it2 is unused
|
CGAL_assertion(is_negative_bracket(it1, it2)); // Here it2 is unused
|
||||||
|
|
||||||
if (size_of_list()==1) // it1==it3)
|
if (size_of_list()==1) // it1==it3
|
||||||
{ // Case of cyclic bracket
|
{ // Case of cyclic bracket
|
||||||
CGAL_assertion(size_of_list()==1);
|
CGAL_assertion(size_of_list()==1);
|
||||||
CGAL_assertion(flat_length(it1)<0);
|
CGAL_assertion(flat_length(it1)<0);
|
||||||
|
|
@ -1227,7 +1135,7 @@ public:
|
||||||
List_iterator it2;
|
List_iterator it2;
|
||||||
CGAL_assertion(is_positive_bracket(it1, it2)); // Here it2 is unused
|
CGAL_assertion(is_positive_bracket(it1, it2)); // Here it2 is unused
|
||||||
|
|
||||||
if (size_of_list()==1) // it1==it3)
|
if (size_of_list()==1) // it1==it3
|
||||||
{ // Case of cyclic bracket
|
{ // Case of cyclic bracket
|
||||||
CGAL_assertion(size_of_list()==1);
|
CGAL_assertion(size_of_list()==1);
|
||||||
CGAL_assertion(flat_length(it1)>0);
|
CGAL_assertion(flat_length(it1)>0);
|
||||||
|
|
@ -1439,13 +1347,6 @@ public:
|
||||||
// CGAL_assertion(is_valid());
|
// CGAL_assertion(is_valid());
|
||||||
Set_of_it modified_flats;
|
Set_of_it modified_flats;
|
||||||
|
|
||||||
/* static int TOTO=0;
|
|
||||||
std::cout<<"right_push_l_shape "<<TOTO++<<std::endl;
|
|
||||||
if (TOTO==1)
|
|
||||||
{ std::cout<<"BUG"<<std::endl;} */
|
|
||||||
|
|
||||||
//Path_on_surface<Map> pbefore(*this);
|
|
||||||
|
|
||||||
if (m_path.size()==1)
|
if (m_path.size()==1)
|
||||||
{
|
{
|
||||||
if (next_negative_turn(it1)==2)
|
if (next_negative_turn(it1)==2)
|
||||||
|
|
@ -1486,7 +1387,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Here we have only one flat, with some -2
|
// Here we have only one flat, with some -2
|
||||||
// Is this case possible ??
|
// This case is not supposed possible.
|
||||||
CGAL_assertion(false);
|
CGAL_assertion(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1514,9 +1415,6 @@ public:
|
||||||
flat_modified(it2, modified_flats);
|
flat_modified(it2, modified_flats);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Path_on_surface<Map> pafter(*this);
|
|
||||||
//CGAL_assertion(pbefore==pafter);
|
|
||||||
|
|
||||||
// CGAL_assertion(is_valid(false));
|
// CGAL_assertion(is_valid(false));
|
||||||
// CGAL_assertion(is_l_shape(it1));
|
// CGAL_assertion(is_l_shape(it1));
|
||||||
|
|
||||||
|
|
@ -1572,8 +1470,7 @@ public:
|
||||||
set_begin_of_flat(it1, dh1);
|
set_begin_of_flat(it1, dh1);
|
||||||
set_end_of_flat(it1, dh1);
|
set_end_of_flat(it1, dh1);
|
||||||
set_begin_of_flat(it2, dh2);
|
set_begin_of_flat(it2, dh2);
|
||||||
set_end_of_flat(it2, dh6); // TODO WHY THIS DOES NOT WORK ????
|
set_end_of_flat(it2, dh6);
|
||||||
//set_end_of_flat(it2, m_map.template beta<1, 2, 1>(dh3)); // TODO VERY STRANGE
|
|
||||||
set_flat_length(it2, -flat_length(it1));
|
set_flat_length(it2, -flat_length(it1));
|
||||||
set_flat_length(it1, 0);
|
set_flat_length(it1, 0);
|
||||||
|
|
||||||
|
|
@ -1588,13 +1485,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// General case, with two flats with non zero length
|
// General case, with two flats with non zero length
|
||||||
|
|
||||||
/* List_iterator it_insert1=m_path.insert(it, std::make_pair
|
|
||||||
(first_dart_toinsert, 0));
|
|
||||||
List_iterator it_insert2=m_path.insert(next_iterator(it3),
|
|
||||||
std::make_pair
|
|
||||||
(second_dart_toinsert, 0)); */
|
|
||||||
|
|
||||||
if (next_iterator(it2)!=it1 || next_negative_turn(it2)!=3)
|
if (next_iterator(it2)!=it1 || next_negative_turn(it2)!=3)
|
||||||
{
|
{
|
||||||
// 1) Add the first dart before flat 'it'
|
// 1) Add the first dart before flat 'it'
|
||||||
|
|
@ -1734,7 +1624,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const typename Get_map<Mesh, Mesh>::storage_type m_map; // The underlying map
|
const typename Get_map<Mesh, Mesh>::storage_type m_map; // The underlying map
|
||||||
List_of_flats m_path; // The sequence of flats (a flat part is a pair of darts with positive or negative turn == 2). If negative value k, -k is the length of the flat part, for negative turns (-2).
|
List_of_flats m_path; // The sequence of flats (a flat part is a pair of darts
|
||||||
|
// with positive or negative turn == 2). If negative value k, -k is the
|
||||||
|
// length of the flat part, for negative turns (-2).
|
||||||
bool m_is_closed; // True iff the path is a cycle
|
bool m_is_closed; // True iff the path is a cycle
|
||||||
std::size_t m_length;
|
std::size_t m_length;
|
||||||
bool m_use_only_positive;
|
bool m_use_only_positive;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public:
|
||||||
/// usefull for very big object where this time could be long)
|
/// usefull for very big object where this time could be long)
|
||||||
Face_graph_with_path_viewer(QWidget* parent,
|
Face_graph_with_path_viewer(QWidget* parent,
|
||||||
const Mesh& amesh,
|
const Mesh& amesh,
|
||||||
const std::vector<Surface_mesh_topology::Path_on_surface<Mesh> >* paths=NULL,
|
const std::vector<Surface_mesh_topology::Path_on_surface<Mesh> >* paths=nullptr,
|
||||||
std::size_t amark=LCC::INVALID_MARK,
|
std::size_t amark=LCC::INVALID_MARK,
|
||||||
const char* title="", bool anofaces=false,
|
const char* title="", bool anofaces=false,
|
||||||
const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) :
|
const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) :
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue