mirror of https://github.com/CGAL/cgal
Mesh_2: sort the sequence tr.subconstraints_begin(), tr.subconstraints_end()
This commit is contained in:
parent
93fd96644c
commit
82b53596fd
|
|
@ -346,12 +346,26 @@ protected:
|
|||
{
|
||||
// with constraint hierarchy
|
||||
|
||||
for(typename Tr::Subconstraint_iterator it = tr.subconstraints_begin();
|
||||
it != tr.subconstraints_end(); ++it)
|
||||
{
|
||||
const Vertex_handle& v1 = it->first.first;
|
||||
const Vertex_handle& v2 = it->first.second;
|
||||
// create a vector of pairs of vertex handles, from the subconstraints
|
||||
// and sort it to ensure the determinism
|
||||
std::vector<std::array<Vertex_handle, 2>> subconstraints_vector(tr.number_of_subconstraints());
|
||||
std::transform(tr.subconstraints_begin(), tr.subconstraints_end(), subconstraints_vector.begin(),
|
||||
[](const auto& sc) {
|
||||
return std::array<Vertex_handle, 2>{sc.first.first, sc.first.second};
|
||||
});
|
||||
|
||||
auto comp_vh = [&] (Vertex_handle va, Vertex_handle vb) {
|
||||
return tr.compare_xy(va->point(), vb->point()) == SMALLER;
|
||||
};
|
||||
auto comp_pair_vh = [&] (const auto& e1, const auto& e2) {
|
||||
return comp_vh(e1[0], e2[0]) ||
|
||||
(!comp_vh(e2[0], e1[0]) && comp_vh(e1[1], e2[1]));
|
||||
};
|
||||
|
||||
std::sort(subconstraints_vector.begin(), subconstraints_vector.end(), comp_pair_vh);
|
||||
|
||||
for(const auto& [v1, v2] : subconstraints_vector)
|
||||
{
|
||||
if(!is_locally_conform(tr, v1, v2) ){
|
||||
add_constrained_edge_to_be_conformed(v1, v2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue